Skip to content

Instantly share code, notes, and snippets.

@zph
Created July 10, 2016 04:32
Show Gist options
  • Save zph/a7c7ad7b56e9d9244c91b46d9455ccf2 to your computer and use it in GitHub Desktop.
Save zph/a7c7ad7b56e9d9244c91b46d9455ccf2 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -eou pipefail
install_aws(){
local tmpdir="$1"
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "$tmpdir/awscli-bundle.zip"
cd $tmpdir
unzip $tmpdir/awscli-bundle.zip
python $tmpdir/awscli-bundle/install -b ~/bin/aws
}
cleanup_aws(){
local tmpdir=$1
rm -rf "$tmpdir/awscli-bundle*"
}
main(){
if [[ ! -x $(which aws 2>&1 /dev/null) ]];then
if [[ ! -d $HOME/bin ]];then
mkdir "$HOME/bin"
fi
local tmpdir="${HOME}/.cache"
if [[ ! -d $tmpdir ]];then
mkdir $tmpdir
fi
install_aws "$tmpdir"
cleanup_aws "$tmpdir"
fi
}
main "$@"
@zph
Copy link
Author

zph commented Jul 10, 2016

Wrap the AWSCLI install script and install it for non-sudo systems into ~/bin. User level install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment