22
33LOG_PATH=${LOG_PATH}
44VERSION=${VERSION}
5+ DOWNLOAD_URL=${DOWNLOAD_URL}
56
6- BOLD=' \033[0;1m'
7- RESET=' \033[0m'
7+ BOLD=' \\ 033[0;1m'
8+ RESET=' \\ 033[0m'
89
9- printf " ${BOLD} Installing AWS CLI...\n${RESET} "
10+ printf " ${BOLD} Installing AWS CLI...\\ n${RESET} "
1011
1112# Check if AWS CLI is already installed
1213if command -v aws > /dev/null 2>&1 ; then
1314 INSTALLED_VERSION=$( aws --version 2>&1 | cut -d' ' -f1 | cut -d' /' -f2)
1415 if [ -n " $VERSION " ] && [ " $INSTALLED_VERSION " != " $VERSION " ]; then
15- printf " AWS CLI $INSTALLED_VERSION is installed, but version $VERSION was requested.\n"
16+ printf " AWS CLI $INSTALLED_VERSION is installed, but version $VERSION was requested.\\ n"
1617 else
17- printf " AWS CLI is already installed ($INSTALLED_VERSION ). Skipping installation.\n"
18+ printf " AWS CLI is already installed ($INSTALLED_VERSION ). Skipping installation.\\ n"
1819 exit 0
1920 fi
2021fi
@@ -27,16 +28,19 @@ case "$ARCH" in
2728 x86_64) ARCH=" x86_64" ;;
2829 aarch64 | arm64) ARCH=" aarch64" ;;
2930 * )
30- printf " Unsupported architecture: $ARCH \n" > " ${LOG_PATH} " 2>&1
31+ printf " Unsupported architecture: $ARCH \\ n" > " ${LOG_PATH} " 2>&1
3132 exit 1
3233 ;;
3334esac
3435
3536# Install AWS CLI
3637if [ " $OS " = " linux" ]; then
37- DOWNLOAD_URL=" https://awscli.amazonaws.com/awscli-exe-linux-${ARCH} .zip"
38+ # Use custom download URL if provided, otherwise use default AWS URL
39+ if [ -z " $DOWNLOAD_URL " ]; then
40+ DOWNLOAD_URL=" https://awscli.amazonaws.com/awscli-exe-linux-${ARCH} .zip"
41+ fi
3842
39- printf " Downloading AWS CLI from $DOWNLOAD_URL ...\n"
43+ printf " Downloading AWS CLI from $DOWNLOAD_URL ...\\ n"
4044 curl -fsSL " $DOWNLOAD_URL " -o /tmp/awscliv2.zip >> " ${LOG_PATH} " 2>&1
4145
4246 unzip -q /tmp/awscliv2.zip -d /tmp >> " ${LOG_PATH} " 2>&1
@@ -45,25 +49,28 @@ if [ "$OS" = "linux" ]; then
4549 rm -rf /tmp/awscliv2.zip /tmp/aws
4650
4751elif [ " $OS " = " darwin" ]; then
48- DOWNLOAD_URL=" https://awscli.amazonaws.com/AWSCLIV2.pkg"
52+ # Use custom download URL if provided, otherwise use default AWS URL
53+ if [ -z " $DOWNLOAD_URL " ]; then
54+ DOWNLOAD_URL=" https://awscli.amazonaws.com/AWSCLIV2.pkg"
55+ fi
4956
50- printf " Downloading AWS CLI from $DOWNLOAD_URL ...\n"
57+ printf " Downloading AWS CLI from $DOWNLOAD_URL ...\\ n"
5158 curl -fsSL " $DOWNLOAD_URL " -o /tmp/AWSCLIV2.pkg >> " ${LOG_PATH} " 2>&1
5259
5360 sudo installer -pkg /tmp/AWSCLIV2.pkg -target / >> " ${LOG_PATH} " 2>&1
5461
5562 rm -f /tmp/AWSCLIV2.pkg
5663
5764else
58- printf " Unsupported OS: $OS \n" > " ${LOG_PATH} " 2>&1
65+ printf " Unsupported OS: $OS \\ n" > " ${LOG_PATH} " 2>&1
5966 exit 1
6067fi
6168
6269if command -v aws > /dev/null 2>&1 ; then
63- printf " 🥳 AWS CLI installed successfully!\n"
70+ printf " 🥳 AWS CLI installed successfully!\\ n"
6471 aws --version
6572else
66- printf " ❌ AWS CLI installation failed. Check logs at ${LOG_PATH} \n"
73+ printf " ❌ AWS CLI installation failed. Check logs at ${LOG_PATH} \\ n"
6774 exit 1
6875fi
6976
@@ -75,7 +82,7 @@ if command -v aws_completer > /dev/null 2>&1; then
7582 if [ -f ~ /.bashrc ]; then
7683 if ! grep -q " aws_completer.*aws" ~ /.bashrc; then
7784 echo " complete -C '$AWS_COMPLETER_PATH ' aws" >> ~ /.bashrc
78- printf " ✓ Configured AWS CLI autocomplete for bash\n"
85+ printf " ✓ Configured AWS CLI autocomplete for bash\\ n"
7986 fi
8087 fi
8188
@@ -89,7 +96,7 @@ autoload bashcompinit && bashcompinit
8996autoload -Uz compinit && compinit
9097complete -C '$AWS_COMPLETER_PATH ' aws
9198EOF
92- printf " ✓ Configured AWS CLI autocomplete for zsh\n"
99+ printf " ✓ Configured AWS CLI autocomplete for zsh\\ n"
93100 fi
94101 fi
95102
101108 cat > " $FISH_COMPLETION " << 'EOF '
102109complete --command aws --no-files --arguments '(begin; set --local --export COMP_SHELL fish; set --local --export COMP_LINE (commandline); aws_completer | sed '"'"'s/ $//'"'"'; end)'
103110EOF
104- printf " ✓ Configured AWS CLI autocomplete for fish\n"
111+ printf " ✓ Configured AWS CLI autocomplete for fish\\ n"
105112 fi
106113 fi
107114fi
0 commit comments