update
This commit is contained in:
parent
83303ccac6
commit
0016219ca6
1 changed files with 33 additions and 17 deletions
|
@ -4,7 +4,7 @@
|
||||||
# VARIABLES #
|
# VARIABLES #
|
||||||
#-----------------------------------#
|
#-----------------------------------#
|
||||||
|
|
||||||
this_script_url="https://git.hhf.technology/hhf/script-management-cloudpanel/raw/branch/main/install/docker-install.sh"
|
this_script_url="https://example.com/docker-install.sh"
|
||||||
this_script_name="Docker Installation Script"
|
this_script_name="Docker Installation Script"
|
||||||
formatter_url="https://git.hhf.technology/hhf/TaskFormatter/raw/branch/main/bash_task_formatter/task_formatter.sh"
|
formatter_url="https://git.hhf.technology/hhf/TaskFormatter/raw/branch/main/bash_task_formatter/task_formatter.sh"
|
||||||
scriptname=$0
|
scriptname=$0
|
||||||
|
@ -101,26 +101,42 @@ install_dependencies() {
|
||||||
|
|
||||||
# Function to setup Docker repository
|
# Function to setup Docker repository
|
||||||
setup_docker_repo() {
|
setup_docker_repo() {
|
||||||
# Create directory for keyrings
|
# Create directory for keyrings if it doesn't exist
|
||||||
sudo install -m 0755 -d /etc/apt/keyrings
|
sudo install -m 0755 -d /etc/apt/keyrings
|
||||||
|
|
||||||
# Download Docker's official GPG key
|
# Download Docker's official GPG key with error handling
|
||||||
curl -fsSL https://download.docker.com/linux/$ID/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
if ! curl -fsSL "https://download.docker.com/linux/$ID/gpg" -o /tmp/docker.gpg; then
|
||||||
sudo chmod a+r /etc/apt/keyrings/docker.gpg
|
echo -e "Failed to download Docker GPG key $CROSS_MARK"
|
||||||
|
|
||||||
# Add the repository to Apt sources
|
|
||||||
echo \
|
|
||||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/$ID \
|
|
||||||
$VERSION_CODENAME stable" | \
|
|
||||||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo -e "Docker repository setup completed $CHECK_MARK"
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
echo -e "Docker repository setup failed $CROSS_MARK"
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Dearmor and store the GPG key with error handling
|
||||||
|
if ! sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg /tmp/docker.gpg; then
|
||||||
|
echo -e "Failed to dearmor GPG key $CROSS_MARK"
|
||||||
|
rm -f /tmp/docker.gpg
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
rm -f /tmp/docker.gpg
|
||||||
|
|
||||||
|
# Set proper permissions
|
||||||
|
sudo chmod a+r /etc/apt/keyrings/docker.gpg
|
||||||
|
|
||||||
|
# Create the repository configuration with error handling
|
||||||
|
local repo_config="deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/$ID $VERSION_CODENAME stable"
|
||||||
|
|
||||||
|
if ! echo "$repo_config" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null; then
|
||||||
|
echo -e "Failed to create repository configuration $CROSS_MARK"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verify the repository file exists and has content
|
||||||
|
if [ ! -s /etc/apt/sources.list.d/docker.list ]; then
|
||||||
|
echo -e "Repository configuration file is empty or missing $CROSS_MARK"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "Docker repository setup completed $CHECK_MARK"
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install Docker
|
# Function to install Docker
|
||||||
|
|
Loading…
Reference in a new issue