This repository has been archived by the owner on May 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure-cloud-utils
executable file
·64 lines (57 loc) · 2.61 KB
/
configure-cloud-utils
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
if [ "${SETUP_AWSCLI_LOGIN}" == true ]
then
if [ ! -e ~/.aws-login/config ]
then
echo "[START] awscli-login configuration"
# make sure endpoint variable is set, if not set to CIT default
if [[ -z "${ECP_ENDPOINT}" ]]
then
echo "[INFO] ECP_EMDPOINT environment variables not set, setting to default CIT endpoint"
export ECP_ENDPOINT="https://shibidp.cit.cornell.edu/idp/profile/SAML2/SOAP/ECP"
fi
# create array of options that will be used to write aws-login config file
config_array=( "[default]" "ecp_endpoint_url = ${ECP_ENDPOINT}" "username = ${NETID}" "factor = ${DUO_FACTOR}" )
# configure aws cli to use awscli-login
aws configure set plugins.login awscli_login >/dev/null
# write aws-login config file
printf "%s\n" "${config_array[@]}" > ~/.aws-login/config
echo "[FINISH] awscli-login configuration successful"
else
echo "[INFO] skipping awscli-login configuration - config found"
fi
else
echo "[INFO] skipping awscli-login configuration"
fi
# install fx (via node/npm)
if [ "${SETUP_NODEJS}" == true ]
then
echo "[START] nodejs/npm installation"
curl -sL https://deb.nodesource.com/setup_12.x | bash - &> /dev/null
apt-get install -qy nodejs &> /dev/null
npm i -g fx &> /dev/null
echo "[FINISH] nodejs/npm installation successful"
else
echo "[INFO] skipping nodejs/npm installation"
fi
# install oh-my-zsh, zsh-completions/zsh-autosuggestions plugins, and set shell to zsh
if [ "${SETUP_OHMYZSH}" == true ]
then
echo "[START] oh-my-zsh setup/configuration"
curl -Lo install.sh https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh &> /dev/null
sh ./install.sh --unattended &> /dev/null
chsh -s /bin/zsh &> /dev/null
rm ./install.sh &> /dev/null
git clone --quiet https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions &> /dev/null
git clone --quiet https://github.com/zsh-users/zsh-completions ~/.oh-my-zsh/custom/plugins/zsh-completions &> /dev/null
sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="refined"/g' ~/.zshrc &> /dev/null
sed -i 's/# HYPHEN_INSENSITIVE=/HYPHEN_INSENSITIVE=/g' ~/.zshrc &> /dev/null
sed -i 's/plugins=(git)/plugins=(git aws terraform zsh-completions zsh-autosuggestions)/g' ~/.zshrc &> /dev/null
sed -i '/plugins=(git aws terraform zsh-completions zsh-autosuggestions)/a autoload -U compinit && compinit' ~/.zshrc &> /dev/null
echo -e "\nsource /etc/bash_completion.d/azure-cli\n" >> ~/.zshrc
echo "[FINISH] oh-my-zsh setup/configuration successful"
/bin/zsh
else
echo "[INFO] skipping oh-my-zsh setup/configuration"
/bin/bash
fi