Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to install apt keys from list of different keyservers #6674

Merged
merged 1 commit into from
Sep 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions docker/lite/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,22 @@ set -euo pipefail
FLAVOR="$1"
export DEBIAN_FRONTEND=noninteractive

retry() {
for i in $(seq 1 10); do
if "$@"; then return; fi
KEYSERVERS=(
ha.pool.sks-keyservers.net
keyserver.ubuntu.com
hkp://p80.pool.sks-keyservers.net:80
hkp://keyserver.ubuntu.com:80
)

add_apt_key() {
for i in {1..3}; do
for keyserver in "${KEYSERVERS[@]}"; do
if apt-key adv --no-tty --keyserver "${keyserver}" --recv-keys "$1"; then return; fi
done
done
}


# Install base packages that are common to all flavors.
BASE_PACKAGES=(
bzip2
Expand Down Expand Up @@ -102,16 +112,16 @@ esac
case "${FLAVOR}" in
mysql56|mysql57|mysql80)
# repo.mysql.com
retry apt-key adv --no-tty --keyserver keyserver.ubuntu.com --recv-keys 8C718D3B5072E1F5
add_apt_key 8C718D3B5072E1F5
;;
mariadb|mariadb103)
# digitalocean.com
retry apt-key adv --no-tty --keyserver keyserver.ubuntu.com --recv-keys F1656F24C74CD1D8
add_apt_key F1656F24C74CD1D8
;;
esac

# All flavors (except mariadb*) include Percona XtraBackup (from repo.percona.com).
retry apt-key adv --no-tty --keyserver keys.gnupg.net --recv-keys 9334A25F8507EFA5
add_apt_key 9334A25F8507EFA5

# Add extra apt repositories for MySQL.
case "${FLAVOR}" in
Expand Down Expand Up @@ -171,7 +181,7 @@ esac
# Install flavor-specific packages
apt-get update
apt-get install -y --no-install-recommends "${PACKAGES[@]}"
# Clean up files we won't need in the final image.
rm -rf /var/lib/apt/lists/*
rm -rf /var/lib/mysql/

# Clean up files we won't need in the final image.
rm -rf /var/lib/apt/lists/*
rm -rf /var/lib/mysql/