aboutsummaryrefslogtreecommitdiff
path: root/share/hoarder/awscli2/unix/linux/install
blob: 8eaf4200c7ad9a53895cc735c850a82845a199f0 (plain)
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
#!/usr/bin/env sh
#
# Install AWS Command Line v2
#

# Parameters
SHARE="$1"
LIB="$2"

# Include basic functions
. $LIB/trashman/functions || exit 1

# Requirements
trashman_require wget

# Additional parameters
FILE="awscli-exe-linux-`uname -m`.zip"
URL="https://awscli.amazonaws.com/$FILE"
WORK="`mktemp -d`" || exit 1

# Download
wget "$URL"     -O $WORK/$FILE     || exit 1
wget "$URL.sig" -O $WORK/$FILE.sig || exit 1

# Verify
gpg --homedir $WORK/.gnupg --import $SHARE/awscli2/unix/linux/files/awscli2.asc || exit 1
gpg --homedir $WORK/.gnupg --verify $WORK/$FILE.sig                             || exit 1
rm -rf $WORK/.gnupg                                                             || exit 1

# Unpack
unzip $WORK/$FILE -d $WORK || exit 1

# Prepare
mkdir -p $HOME/.local/share || exit 1
cd $HOME/.local/share       || exit 1
rm -rf aws-cli              || exit 1

# Install
$WORK/aws/install -i $HOME/.local/share/aws-cli -b $HOME/.local/bin || exit 1

# Cleanup
rm -rf $WORK || exit 1

# Inform
trashman_installed_at $HOME/.local/share/aws-cli
trashman_run_with $HOME/.local/bin/aws