From f4dbb7cdacbc122473c6612eac067ce9365e7b74 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 16:45:10 +0000 Subject: [PATCH] fix(install): Fix Debian post installation script when awscli2 is already installed or the installation failed previously (#6276) (#6277) (cherry picked from commit 35a30d395329a2522eca275024a25b34fd4f99ab) Co-authored-by: Ashley Kleynhans --- clouddriver-web/pkg_scripts/postInstall.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/clouddriver-web/pkg_scripts/postInstall.sh b/clouddriver-web/pkg_scripts/postInstall.sh index 4021e5406b..50d56cfe37 100755 --- a/clouddriver-web/pkg_scripts/postInstall.sh +++ b/clouddriver-web/pkg_scripts/postInstall.sh @@ -29,12 +29,24 @@ install_kubectl() { } install_awscli2() { - curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${AWS_CLI_VERSION}.zip" -o "awscliv2.zip" - unzip awscliv2.zip - ./aws/install - rm -rf ./awscliv2.zip ./aws + if [ -d "/usr/local/aws-cli/v2/${AWS_CLI_VERSION}" ]; then + echo "awscli2 ${AWS_CLI_VERSION} is already installed" + else + echo "Installing awscli2 ${AWS_CLI_VERSION}" + curl -s "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${AWS_CLI_VERSION}.zip" -o "awscliv2.zip" + + # This shouldn't usually exist unless the installation failed previously + if [ -d "./aws" ]; then + rm -rf ./aws + fi + + unzip awscliv2.zip + ./aws/install --update + rm -rf ./awscliv2.zip ./aws + fi - 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 + echo "Installing aws-iam-authenticator ${AWS_AIM_AUTHENTICATOR_VERSION}" + 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 chmod +x ./aws-iam-authenticator mv ./aws-iam-authenticator /usr/local/bin/aws-iam-authenticator }