From 7c327d8e54d5d09c68f522be27cf8eb3bb55a430 Mon Sep 17 00:00:00 2001 From: Christpoh Date: Mon, 13 Jan 2025 14:52:34 +0000 Subject: [PATCH] bbb-pre-install.sh: fix some error installing 'docker-ce'. --- bbb-pre-install.sh | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/bbb-pre-install.sh b/bbb-pre-install.sh index cc5ca42..85ea84c 100755 --- a/bbb-pre-install.sh +++ b/bbb-pre-install.sh @@ -519,6 +519,8 @@ fi +blank_line + # --- # Install latest version of docker # --- @@ -527,12 +529,15 @@ echo "" echo -e " \033[1m---\033[m" echo -e " \033[32mInstall latest version of docker\033[m" echo -e " \033[1m---\033[m" -echo "" :> "$log_file" -if ! $(grep -Eq "^\s*deb\s+.*https://download.docker.com/linux/ubuntu\s+$DIST_CODENAME\s+stable" /etc/apt/sources.list) \ - && ! $(grep -r -Eq "^\s*deb\s+.*https://download.docker.com/linux/ubuntu\s+$DIST_CODENAME\s+stable" /etc/apt/sources.list.d/*) +#if ! $(grep -Eq "^\s*deb\s+.*https://download.docker.com/linux/ubuntu\s+$DIST_CODENAME\s+stable" /etc/apt/sources.list) \ +# && ! $(grep -r -Eq "^\s*deb\s+.*https://download.docker.com/linux/ubuntu\s+$DIST_CODENAME\s+stable" /etc/apt/sources.list.d/*) +if ! $(grep -r -Eq "^\s*deb\s+.*https://download.docker.com/linux/ubuntu\s+$DIST_CODENAME\s+stable" /etc/apt/*) then + + blank_line + echononl "Add GPG key for official Docker repository.." curl -fsSL https://download.docker.com/linux/ubuntu/gpg 2> "$log_file" | apt-key add - >> "$log_file" 2>&1 @@ -553,6 +558,28 @@ then echo_ok fi + + echononl "Add (official) Docker-Repository to APT sources.." + add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu ${DIST_CODENAME} stable" > "$log_file" 2>&1 + + if [[ $? -ne 0 ]]; then + echo_failed + error "$(cat "$log_file")" + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interrupted by user." + + else + echo_ok + fi + + echononl "Update repositories.." apt-get update > "$log_file" 2>&1 if [[ $? -ne 0 ]]; then @@ -581,7 +608,7 @@ echononl "Install docker-ce .." if $(dpkg -s docker-ce> /dev/null 2>&1 ) ; then echo_skipped else - DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes language-pack-en > "$log_file" 2>&1 + DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes docker-ce > "$log_file" 2>&1 if [[ $? -ne 0 ]]; then echo_failed error "$(cat "$log_file")"