Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit 253314b

Browse files
authored
Regression fixes for stretch, fallback logic
1 parent 89a70b9 commit 253314b

26 files changed

+83
-50
lines changed

Diff for: script-library/azcli-debian.sh

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export DEBIAN_FRONTEND=noninteractive
5858
architecture="$(dpkg --print-architecture)"
5959
if [ "${architecture}" = "amd64" ]; then
6060
# Install dependencies
61-
check_packages apt-transport-https curl ca-certificates gnupg2
61+
check_packages apt-transport-https curl ca-certificates gnupg2 dirmngr
6262
# Import key safely (new 'signed-by' method rather than deprecated apt-key approach) and install
6363
. /etc/os-release
6464
get_common_setting MICROSOFT_GPG_KEYS_URI

Diff for: script-library/common-alpine.sh

100644100755
File mode changed.

Diff for: script-library/common-debian.sh

100644100755
+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then
7878
package_list="apt-utils \
7979
openssh-client \
8080
gnupg2 \
81+
dirmngr \
8182
iproute2 \
8283
procps \
8384
lsof \

Diff for: script-library/common-redhat.sh

100644100755
+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then
6363
package_list="\
6464
openssh-clients \
6565
gnupg2 \
66+
dirmngr \
6667
iproute \
6768
procps \
6869
lsof \

Diff for: script-library/desktop-lite-debian.sh

100644100755
File mode changed.

Diff for: script-library/docker-debian.sh

100644100755
+5-3
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,10 @@ check_packages() {
7878
export DEBIAN_FRONTEND=noninteractive
7979

8080
# Install dependencies
81-
check_packages apt-transport-https curl ca-certificates gnupg2
81+
check_packages apt-transport-https curl ca-certificates gnupg2 dirmngr
8282

8383
# Install Docker / Moby CLI if not already installed
84+
architecture="$(dpkg --print-architecture)"
8485
if type docker > /dev/null 2>&1; then
8586
echo "Docker / Moby CLI already installed."
8687
else
@@ -90,9 +91,10 @@ else
9091
# Import key safely (new 'signed-by' method rather than deprecated apt-key approach) and install
9192
get_common_setting MICROSOFT_GPG_KEYS_URI
9293
curl -sSL ${MICROSOFT_GPG_KEYS_URI} | gpg --dearmor > /usr/share/keyrings/microsoft-archive-keyring.gpg
93-
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/microsoft-${ID}-${VERSION_CODENAME}-prod ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/microsoft.list
94+
echo "deb [arch=${architecture} signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/microsoft-${ID}-${VERSION_CODENAME}-prod ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/microsoft.list
9495
apt-get update
95-
apt-get -y install --no-install-recommends moby-cli moby-buildx moby-compose
96+
apt-get -y install --no-install-recommends moby-cli moby-buildx moby-engine
97+
apt-get -y install --no-install-recommends moby-compose || echo "(*) Package moby-compose (Docker Compose v2) not available for ${VERSION_CODENAME} ${architecture}. Skipping."
9698
else
9799
# Import key safely (new 'signed-by' method rather than deprecated apt-key approach) and install
98100
curl -fsSL https://download.docker.com/linux/${ID}/gpg | gpg --dearmor > /usr/share/keyrings/docker-archive-keyring.gpg

Diff for: script-library/docker-in-docker-debian.sh

100644100755
+11-9
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ check_packages() {
7676
export DEBIAN_FRONTEND=noninteractive
7777

7878
# Install dependencies
79-
check_packages apt-transport-https curl ca-certificates lxc pigz iptables gnupg2
79+
check_packages apt-transport-https curl ca-certificates lxc pigz iptables gnupg2 dirmngr
8080

8181
# Swap to legacy iptables for compatibility
8282
if type iptables-legacy > /dev/null 2>&1; then
@@ -85,6 +85,7 @@ if type iptables-legacy > /dev/null 2>&1; then
8585
fi
8686

8787
# Install Docker / Moby CLI if not already installed
88+
architecture="$(dpkg --print-architecture)"
8889
if type docker > /dev/null 2>&1 && type dockerd > /dev/null 2>&1; then
8990
echo "Docker / Moby CLI and Engine already installed."
9091
else
@@ -94,9 +95,10 @@ else
9495
# Import key safely (new 'signed-by' method rather than deprecated apt-key approach) and install
9596
get_common_setting MICROSOFT_GPG_KEYS_URI
9697
curl -sSL ${MICROSOFT_GPG_KEYS_URI} | gpg --dearmor > /usr/share/keyrings/microsoft-archive-keyring.gpg
97-
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/microsoft-${ID}-${VERSION_CODENAME}-prod ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/microsoft.list
98+
echo "deb [arch=${architecture} signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/microsoft-${ID}-${VERSION_CODENAME}-prod ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/microsoft.list
9899
apt-get update
99-
apt-get -y install --no-install-recommends moby-cli moby-buildx moby-compose moby-engine
100+
apt-get -y install --no-install-recommends moby-cli moby-buildx moby-engine
101+
apt-get -y install --no-install-recommends moby-compose || echo "(*) Package moby-compose (Docker Compose v2) not available for ${VERSION_CODENAME} ${architecture}. Skipping."
100102
else
101103
# Import key safely (new 'signed-by' method rather than deprecated apt-key approach) and install
102104
curl -fsSL https://download.docker.com/linux/${ID}/gpg | gpg --dearmor > /usr/share/keyrings/docker-archive-keyring.gpg
@@ -112,11 +114,11 @@ echo "Finished installing docker / moby"
112114
if type docker-compose > /dev/null 2>&1; then
113115
echo "Docker Compose already installed."
114116
else
115-
TARGET_COMPOSE_ARCH="$(uname -m)"
116-
if [ "${TARGET_COMPOSE_ARCH}" = "amd64" ]; then
117-
TARGET_COMPOSE_ARCH="x86_64"
117+
target_compose_arch="${architecture}"
118+
if [ "${target_compose_arch}" = "amd64" ]; then
119+
target_compose_arch="x86_64"
118120
fi
119-
if [ "${TARGET_COMPOSE_ARCH}" != "x86_64" ]; then
121+
if [ "${target_compose_arch}" != "x86_64" ]; then
120122
# Use pip to get a version that runns on this architecture
121123
if ! dpkg -s python3-minimal python3-pip libffi-dev python3-venv > /dev/null 2>&1; then
122124
apt_get_update_if_needed
@@ -135,8 +137,8 @@ else
135137
${pipx_bin} install --system-site-packages --pip-args '--no-cache-dir --force-reinstall' docker-compose
136138
rm -rf /tmp/pip-tmp
137139
else
138-
LATEST_COMPOSE_VERSION=$(basename "$(curl -fsSL -o /dev/null -w "%{url_effective}" https://github.com/docker/compose/releases/latest)")
139-
curl -fsSL "https://github.com/docker/compose/releases/download/${LATEST_COMPOSE_VERSION}/docker-compose-$(uname -s)-${TARGET_COMPOSE_ARCH}" -o /usr/local/bin/docker-compose
140+
latest_compose_version=$(basename "$(curl -fsSL -o /dev/null -w "%{url_effective}" https://github.com/docker/compose/releases/latest)")
141+
curl -fsSL "https://github.com/docker/compose/releases/download/${latest_compose_version}/docker-compose-$(uname -s)-${target_compose_arch}" -o /usr/local/bin/docker-compose
140142
chmod +x /usr/local/bin/docker-compose
141143
fi
142144
fi

Diff for: script-library/docker-redhat.sh

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fi
4343
if yum list deltarpm > /dev/null 2>&1; then
4444
yum -y install deltarpm
4545
fi
46-
yum -y install ca-certificates curl gnupg2 dnf net-tools dialog git openssh-clients curl less procps
46+
yum -y install ca-certificates curl gnupg2 dirmngr dnf net-tools dialog git openssh-clients curl less procps
4747

4848
# Try to load os-release
4949
. /etc/os-release 2>/dev/null

Diff for: script-library/fish-debian.sh

100644100755
File mode changed.

Diff for: script-library/git-from-src-debian.sh

100644100755
+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ receive_gpg_keys() {
7171
done
7272
set -e
7373
if [ "${gpg_ok}" = "false" ]; then
74-
echo "(!) Failed to install rvm."
74+
echo "(!) Failed to get gpg key."
7575
exit 1
7676
fi
7777
}
@@ -102,7 +102,7 @@ export DEBIAN_FRONTEND=noninteractive
102102
# If ubuntu, PPAs allowed, and latest - install from there
103103
if ([ "${GIT_VERSION}" = "latest" ] || [ "${GIT_VERSION}" = "lts" ] || [ "${GIT_VERSION}" = "current" ]) && [ "${ID}" = "ubuntu" ] && [ "${USE_PPA_IF_AVAILABLE}" = "true" ]; then
104104
echo "Using PPA to install latest git..."
105-
check_packages apt-transport-https curl ca-certificates gnupg2
105+
check_packages apt-transport-https curl ca-certificates gnupg2 dirmngr
106106
receive_gpg_keys GIT_CORE_PPA_ARCHIVE_GPG_KEY /usr/share/keyrings/gitcoreppa-archive-keyring.gpg
107107
echo -e "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/gitcoreppa-archive-keyring.gpg] http://ppa.launchpad.net/git-core/ppa/ubuntu ${VERSION_CODENAME} main\ndeb-src [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/gitcoreppa-archive-keyring.gpg] http://ppa.launchpad.net/git-core/ppa/ubuntu ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/git-core-ppa.list
108108
apt-get update

Diff for: script-library/git-lfs-debian.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export DEBIAN_FRONTEND=noninteractive
163163

164164
# Install git, curl, gpg, dirmngr and debian-archive-keyring if missing
165165
. /etc/os-release
166-
check_packages curl ca-certificates gnupg2 apt-transport-https dirmngr
166+
check_packages curl ca-certificates gnupg2 dirmngr apt-transport-https
167167
if ! type git > /dev/null 2>&1; then
168168
apt_get_update_if_needed
169169
apt-get -y install --no-install-recommends git

Diff for: script-library/github-debian.sh

100644100755
+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ receive_gpg_keys() {
6565
done
6666
set -e
6767
if [ "${gpg_ok}" = "false" ]; then
68-
echo "(!) Failed to install rvm."
68+
echo "(!) Failed to get gpg key."
6969
exit 1
7070
fi
7171
}
@@ -135,7 +135,7 @@ receive_gpg_keys() {
135135
done
136136
set -e
137137
if [ "${gpg_ok}" = "false" ]; then
138-
echo "(!) Failed to install rvm."
138+
echo "(!) Failed to get gpg key."
139139
exit 1
140140
fi
141141
}

Diff for: script-library/go-debian.sh

100644100755
+4-3
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ fi
4848
updaterc() {
4949
if [ "${UPDATE_RC}" = "true" ]; then
5050
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc..."
51-
echo -e "$1" >> /etc/bash.bashrc
52-
if [ -f "/etc/zsh/zshrc" ]; then
51+
if [[ "$(cat /etc/bash.bashrc)" != *"$1"* ]]; then
52+
echo -e "$1" >> /etc/bash.bashrc
53+
fi
54+
if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"$1"* ]]; then
5355
echo -e "$1" >> /etc/zsh/zshrc
5456
fi
5557
fi
5658
}
57-
5859
# Figure out correct version of a three part version number is not passed
5960
find_version_from_git_tags() {
6061
local variable_name=$1

Diff for: script-library/gradle-debian.sh

100644100755
+4-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ fi
4646
updaterc() {
4747
if [ "${UPDATE_RC}" = "true" ]; then
4848
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc..."
49-
echo -e "$1" >> /etc/bash.bashrc
50-
if [ -f "/etc/zsh/zshrc" ]; then
49+
if [[ "$(cat /etc/bash.bashrc)" != *"$1"* ]]; then
50+
echo -e "$1" >> /etc/bash.bashrc
51+
fi
52+
if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"$1"* ]]; then
5153
echo -e "$1" >> /etc/zsh/zshrc
5254
fi
5355
fi

Diff for: script-library/homebrew-debian.sh

100644100755
+4-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ fi
4242
function updaterc() {
4343
if [ "${UPDATE_RC}" = "true" ]; then
4444
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc..."
45-
echo -e "$1" >> /etc/bash.bashrc
46-
if [ -f "/etc/zsh/zshrc" ]; then
45+
if [[ "$(cat /etc/bash.bashrc)" != *"$1"* ]]; then
46+
echo -e "$1" >> /etc/bash.bashrc
47+
fi
48+
if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"$1"* ]]; then
4749
echo -e "$1" >> /etc/zsh/zshrc
4850
fi
4951
fi

Diff for: script-library/java-debian.sh

100644100755
+4-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ fi
4646
updaterc() {
4747
if [ "${UPDATE_RC}" = "true" ]; then
4848
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc..."
49-
echo -e "$1" >> /etc/bash.bashrc
50-
if [ -f "/etc/zsh/zshrc" ]; then
49+
if [[ "$(cat /etc/bash.bashrc)" != *"$1"* ]]; then
50+
echo -e "$1" >> /etc/bash.bashrc
51+
fi
52+
if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"$1"* ]]; then
5153
echo -e "$1" >> /etc/zsh/zshrc
5254
fi
5355
fi

Diff for: script-library/kubectl-helm-debian.sh

100644100755
File mode changed.

Diff for: script-library/maven-debian.sh

100644100755
+4-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ fi
4646
updaterc() {
4747
if [ "${UPDATE_RC}" = "true" ]; then
4848
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc..."
49-
echo -e "$1" >> /etc/bash.bashrc
50-
if [ -f "/etc/zsh/zshrc" ]; then
49+
if [[ "$(cat /etc/bash.bashrc)" != *"$1"* ]]; then
50+
echo -e "$1" >> /etc/bash.bashrc
51+
fi
52+
if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"$1"* ]]; then
5153
echo -e "$1" >> /etc/zsh/zshrc
5254
fi
5355
fi

Diff for: script-library/node-debian.sh

100644100755
+5-3
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ fi
4848
updaterc() {
4949
if [ "${UPDATE_RC}" = "true" ]; then
5050
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc..."
51-
echo -e "$1" >> /etc/bash.bashrc
52-
if [ -f "/etc/zsh/zshrc" ]; then
51+
if [[ "$(cat /etc/bash.bashrc)" != *"$1"* ]]; then
52+
echo -e "$1" >> /etc/bash.bashrc
53+
fi
54+
if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"$1"* ]]; then
5355
echo -e "$1" >> /etc/zsh/zshrc
5456
fi
5557
fi
@@ -78,7 +80,7 @@ check_packages() {
7880
export DEBIAN_FRONTEND=noninteractive
7981

8082
# Install dependencies
81-
check_packages apt-transport-https curl ca-certificates tar gnupg2
83+
check_packages apt-transport-https curl ca-certificates tar gnupg2 dirmngr
8284

8385
# Install yarn
8486
if type yarn > /dev/null 2>&1; then

Diff for: script-library/powershell-debian.sh

100644100755
+23-11
Original file line numberDiff line numberDiff line change
@@ -91,23 +91,20 @@ check_packages() {
9191
fi
9292
}
9393

94-
export DEBIAN_FRONTEND=noninteractive
95-
96-
# Source /etc/os-release to get OS info
97-
. /etc/os-release
98-
architecture="$(dpkg --print-architecture)"
99-
if [[ "${POWERSHELL_ARCHIVE_ARCHITECTURES}" = *"${architecture}"* ]] && [[ "${POWERSHELL_ARCHIVE_VERSION_CODENAMES}" = *"${VERSION_CODENAME}"* ]]; then
94+
install_using_apt() {
10095
# Install dependencies
101-
check_packages apt-transport-https curl ca-certificates gnupg2
96+
check_packages apt-transport-https curl ca-certificates gnupg2 dirmngr
10297
# Import key safely (new 'signed-by' method rather than deprecated apt-key approach) and install
10398
get_common_setting MICROSOFT_GPG_KEYS_URI
10499
curl -sSL ${MICROSOFT_GPG_KEYS_URI} | gpg --dearmor > /usr/share/keyrings/microsoft-archive-keyring.gpg
105100
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/microsoft-${ID}-${VERSION_CODENAME}-prod ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/microsoft.list
106101
apt-get update -yq
107-
apt-get install -yq powershell
108-
else
109-
# Fall back on direct download if no apt package exists in microsoft pool
110-
check_packages curl ca-certificates gnupg2 libc6 libgcc1 libgssapi-krb5-2 liblttng-ust0 libstdc++6 libunwind8 libuuid1 zlib1g libicu[0-9][0-9]
102+
apt-get install -yq powershell || return 1
103+
}
104+
105+
install_using_github() {
106+
# Fall back on direct download if no apt package exists in microsoft pool
107+
check_packages curl ca-certificates gnupg2 dirmngr libc6 libgcc1 libgssapi-krb5-2 liblttng-ust0 libstdc++6 libunwind8 libuuid1 zlib1g libicu[0-9][0-9]
111108
if ! type git > /dev/null 2>&1; then
112109
apt_get_update_if_needed
113110
apt-get install -y --no-install-recommends git
@@ -134,6 +131,21 @@ else
134131
tar xf "${powershell_filename}" -C "${powershell_target_path}"
135132
ln -s "${powershell_target_path}/pwsh" /usr/local/bin/pwsh
136133
rm -rf /tmp/pwsh
134+
}
135+
136+
export DEBIAN_FRONTEND=noninteractive
137+
138+
# Source /etc/os-release to get OS info
139+
. /etc/os-release
140+
architecture="$(dpkg --print-architecture)"
141+
if [[ "${POWERSHELL_ARCHIVE_ARCHITECTURES}" = *"${architecture}"* ]] && [[ "${POWERSHELL_ARCHIVE_VERSION_CODENAMES}" = *"${VERSION_CODENAME}"* ]]; then
142+
install_using_apt || use_github="true"
143+
else
144+
use_github="true"
145+
fi
146+
147+
if [ "${use_github}" = "true" ]; then
148+
install_using_github
137149
fi
138150

139151
echo "Done!"

Diff for: script-library/python-debian.sh

100644100755
File mode changed.

Diff for: script-library/ruby-debian.sh

100644100755
+5-3
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ fi
5252
updaterc() {
5353
if [ "${UPDATE_RC}" = "true" ]; then
5454
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc..."
55-
echo -e "$1" >> /etc/bash.bashrc
56-
if [ -f "/etc/zsh/zshrc" ]; then
55+
if [[ "$(cat /etc/bash.bashrc)" != *"$1"* ]]; then
56+
echo -e "$1" >> /etc/bash.bashrc
57+
fi
58+
if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"$1"* ]]; then
5759
echo -e "$1" >> /etc/zsh/zshrc
5860
fi
5961
fi
@@ -105,7 +107,7 @@ receive_gpg_keys() {
105107
done
106108
set -e
107109
if [ "${gpg_ok}" = "false" ]; then
108-
echo "(!) Failed to install rvm."
110+
echo "(!) Failed to get gpg key."
109111
exit 1
110112
fi
111113
}

Diff for: script-library/rust-debian.sh

100644100755
+4-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ fi
4747
updaterc() {
4848
if [ "${UPDATE_RC}" = "true" ]; then
4949
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc..."
50-
echo -e "$1" >> /etc/bash.bashrc
51-
if [ -f "/etc/zsh/zshrc" ]; then
50+
if [[ "$(cat /etc/bash.bashrc)" != *"$1"* ]]; then
51+
echo -e "$1" >> /etc/bash.bashrc
52+
fi
53+
if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"$1"* ]]; then
5254
echo -e "$1" >> /etc/zsh/zshrc
5355
fi
5456
fi

Diff for: script-library/shared/utils.sh

100644100755
File mode changed.

Diff for: script-library/sshd-debian.sh

100644100755
File mode changed.

Diff for: script-library/terraform-debian.sh

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ receive_gpg_keys() {
8484
done
8585
set -e
8686
if [ "${gpg_ok}" = "false" ]; then
87-
echo "(!) Failed to install rvm."
87+
echo "(!) Failed to get gpg key."
8888
exit 1
8989
fi
9090
}

0 commit comments

Comments
 (0)