-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·65 lines (44 loc) · 1.3 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·65 lines (44 loc) · 1.3 KB
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
#!/bin/bash -e
echo "################################"
echo "Installing Target CLI to /usr/local/bin/target"
echo ""
echo "Please note: You may be prompted for your password"
# Determine the OS and architecure
OS=$(uname)
ARCH=$(uname -m)
TARGET_OS="linux"
TARGET_ARCH="amd64"
if [ "${ARCH}" == "arm64" ]; then
TARGET_ARCH="arm64"
fi
if [ "${OS}" == "Linux" ]; then
TARGET_OS="linux"
TARGET_EXT="tar.gz"
TARGET_COMMAND="tar -xzf"
fi
if [ "${OS}" == "Darwin" ]; then
TARGET_OS="darwin"
TARGET_EXT="zip"
TARGET_COMMAND="unzip"
fi
version=$(curl https://api.github.com/repos/devops-rob/target-cli/releases/latest | awk -F':|,' '/tag_name/{gsub(/[" ]/,"",$2); print $2}')
binary="target-cli_${version}_${TARGET_OS}_${TARGET_ARCH}.${TARGET_EXT}"
repo="https://github.com/devops-rob/target-cli/releases/download/${version}"
echo "Downloading $repo/$binary"
rm -f /tmp/target-cli.${TARGET_EXT}
rm -f /tmp/target-cli
curl -L -s -o /tmp/target-cli.${TARGET_EXT} "$repo/$binary"
cd /tmp
eval ${TARGET_COMMAND} target-cli.${TARGET_EXT}
rm target-cli.${TARGET_EXT}
if which sudo; then
sudo mv target /usr/local/bin
sudo chmod +x /usr/local/bin/target
else
# try without sudo might be running in a container
mv target /usr/local/bin
chmod +x /usr/local/bin/target
fi
echo ""
target
target version