aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/bin
diff options
context:
space:
mode:
authorjason2024-05-21 14:57:15 -0600
committerjason2024-05-21 14:57:35 -0600
commitfb1d46efc650099bdc9536991ec905405d791fef (patch)
treeea368a62fe2395fc8e9f1ed6e769729423502328 /scripts/bin
parentbb626d366830da77e7190b6e9feb7a8c30b878fc (diff)
downloaddotfiles-fb1d46efc650099bdc9536991ec905405d791fef.tar.gz
dotfiles-fb1d46efc650099bdc9536991ec905405d791fef.zip
add aws cli tools installer
Diffstat (limited to 'scripts/bin')
-rwxr-xr-xscripts/bin/_aws_cli_installer_upgrader.sh76
1 files changed, 76 insertions, 0 deletions
diff --git a/scripts/bin/_aws_cli_installer_upgrader.sh b/scripts/bin/_aws_cli_installer_upgrader.sh
new file mode 100755
index 0000000..5aeb125
--- /dev/null
+++ b/scripts/bin/_aws_cli_installer_upgrader.sh
@@ -0,0 +1,76 @@
1#!/usr/bin/env bash
2
3#
4# This script is duplicated in aws.org notes
5#
6
7set -x
8
9INSTALL_DIR=${HOME}/.local
10BIN_DIR=${HOME}/bin
11
12create_choices_file(){
13 cat<<EOF > /tmp/awschoices.xml
14<?xml version="1.0" encoding="UTF-8"?>
15<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
16<plist version="1.0">
17 <array>
18 <dict>
19 <key>choiceAttribute</key>
20 <string>customLocation</string>
21 <key>attributeSetting</key>
22 <string>${INSTALL_DIR}</string>
23 <key>choiceIdentifier</key>
24 <string>default</string>
25 </dict>
26 </array>
27</plist>
28EOF
29}
30
31cleanup_choices_file(){
32 rm /tmp/awschoices.xml
33}
34install_awscli() {
35 curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "/tmp/AWSCLIV2.pkg" \
36 && installer -pkg /tmp/AWSCLIV2.pkg \
37 -target CurrentUserHomeDirectory \
38 -applyChoiceChangesXML /tmp/awschoices.xml \
39 && ln -sf ${INSTALL_DIR}/aws-cli/aws ${BIN_DIR}/aws \
40 && ln -sf ${INSTALL_DIR}/aws-cli/aws_completer ${BIN_DIR}/aws_completer
41
42 rm /tmp/AWSCLIV2.pkg
43}
44install_samcli() {
45 curl -L "https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-macos-arm64.pkg" -o "/tmp/AWS_SAM_CLI.pkg" \
46 && installer -pkg /tmp/AWS_SAM_CLI.pkg \
47 -target CurrentUserHomeDirectory \
48 -applyChoiceChangesXML /tmp/awschoices.xml \
49 && ln -sf ${INSTALL_DIR}/aws-sam-cli/sam ${BIN_DIR}/sam
50
51 rm /tmp/AWS_SAM_CLI.pkg
52}
53
54
55create_choices_file
56
57while [[ $# -gt 0 ]]; do
58 key="$1"
59
60 case $key in
61 --sam)
62 install_samcli
63 shift # past argument
64 ;;
65 --cli)
66 install_awscli
67 shift # past argument
68 ;;
69 *)
70 echo -e "Skipping unknown argument: $1."
71 shift
72 ;;
73 esac
74done
75
76cleanup_choices_file