bbb-pre-install.sh: support ubuntu 22.04

This commit is contained in:
2025-11-23 18:13:00 +01:00
parent e69d35c393
commit cea53f2325

View File

@@ -130,6 +130,8 @@ detect_os () {
DIST="${DIST// /}" DIST="${DIST// /}"
DIST_VERSION="${DIST_VERSION// /}" DIST_VERSION="${DIST_VERSION// /}"
DIST_VERSION_MAJOR=$(echo $DIST_VERSION | cut -d'.' -f1)
} }
@@ -555,78 +557,138 @@ echo -e " \033[32mInstall latest version of docker\033[m"
echo -e " \033[1m---\033[m" echo -e " \033[1m---\033[m"
:> "$log_file" :> "$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 -r -Eq "^\s*deb\s+.*https://download.docker.com/linux/ubuntu\s+$DIST_CODENAME\s+stable" /etc/apt/*)
then
blank_line if [[ ${DIST_VERSION_MAJOR} -lt 22 ]] ; then
echononl "Add GPG key for official Docker repository.." if ! $(grep -r -Eq "^\s*deb\s+.*https://download.docker.com/linux/ubuntu\s+$DIST_CODENAME\s+stable" /etc/apt/*)
curl -fsSL https://download.docker.com/linux/ubuntu/gpg 2> "$log_file" | apt-key add - >> "$log_file" 2>&1 then
if [[ $? -ne 0 ]]; then blank_line
echo_failed
error "$(cat "$log_file")"
echononl "continue anyway [yes/no]: " echononl "Add GPG key for official Docker repository.."
read OK curl -fsSL https://download.docker.com/linux/ubuntu/gpg 2> "$log_file" | apt-key add - >> "$log_file" 2>&1
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do if [[ $? -ne 0 ]]; then
echononl "Wrong entry! - repeat [yes/no]: " echo_failed
error "$(cat "$log_file")"
echononl "continue anyway [yes/no]: "
read OK read OK
done OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
[[ $OK = "yes" ]] || fatal "Interrupted by user." 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 "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
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
else else
echo_ok info "Docker repository already present."
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
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 fi
else else
info "Docker repository already present."
echononl "Add GPG key for official Docker repository.."
if [[ -f "/etc/apt/keyrings/docker.asc" ]] ; then
echo_skipped
else
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc > "$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
fi
echononl "Add (official) Docker-Repository to APT sources.."
tee /etc/apt/sources.list.d/docker.sources <<EOF > "$log_file" 2>&1
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Signed-By: /etc/apt/keyrings/docker.asc
EOF
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
fi fi
echononl "Install docker-ce .." echononl "Install docker-ce .."
if $(dpkg -s docker-ce> /dev/null 2>&1 ) ; then if $(dpkg -s docker-ce> /dev/null 2>&1 ) ; then