Skip to content

Commit f4dbb7c

Browse files
fix(install): Fix Debian post installation script when awscli2 is already installed or the installation failed previously (#6276) (#6277)
(cherry picked from commit 35a30d3) Co-authored-by: Ashley Kleynhans <ashleykleynhans@users.noreply.github.com>
1 parent 6bcea39 commit f4dbb7c

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

clouddriver-web/pkg_scripts/postInstall.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,24 @@ install_kubectl() {
2929
}
3030

3131
install_awscli2() {
32-
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${AWS_CLI_VERSION}.zip" -o "awscliv2.zip"
33-
unzip awscliv2.zip
34-
./aws/install
35-
rm -rf ./awscliv2.zip ./aws
32+
if [ -d "/usr/local/aws-cli/v2/${AWS_CLI_VERSION}" ]; then
33+
echo "awscli2 ${AWS_CLI_VERSION} is already installed"
34+
else
35+
echo "Installing awscli2 ${AWS_CLI_VERSION}"
36+
curl -s "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${AWS_CLI_VERSION}.zip" -o "awscliv2.zip"
37+
38+
# This shouldn't usually exist unless the installation failed previously
39+
if [ -d "./aws" ]; then
40+
rm -rf ./aws
41+
fi
42+
43+
unzip awscliv2.zip
44+
./aws/install --update
45+
rm -rf ./awscliv2.zip ./aws
46+
fi
3647

37-
curl "https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v${AWS_AIM_AUTHENTICATOR_VERSION}/aws-iam-authenticator_${AWS_AIM_AUTHENTICATOR_VERSION}_linux_amd64" -o aws-iam-authenticator
48+
echo "Installing aws-iam-authenticator ${AWS_AIM_AUTHENTICATOR_VERSION}"
49+
curl -s "https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v${AWS_AIM_AUTHENTICATOR_VERSION}/aws-iam-authenticator_${AWS_AIM_AUTHENTICATOR_VERSION}_linux_amd64" -o aws-iam-authenticator
3850
chmod +x ./aws-iam-authenticator
3951
mv ./aws-iam-authenticator /usr/local/bin/aws-iam-authenticator
4052
}

0 commit comments

Comments
 (0)