forked from openfaas/faas-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget.sh
More file actions
executable file
·64 lines (54 loc) · 1.34 KB
/
get.sh
File metadata and controls
executable file
·64 lines (54 loc) · 1.34 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
61
62
63
64
version=$(curl -s https://api.github.com/repos/openfaas/faas-cli/releases/latest | grep 'tag_name' | cut -d\" -f4)
hasCli() {
has=$(which faas-cli)
if [ "$?" = "0" ]; then
echo "You already have the faas-cli!"
export n=1
echo "Overwriting in $n seconds.. Press Control+C to cancel."
sleep $n
fi
hasCurl=$(which curl)
if [ "$?" = "1" ]; then
echo "You need curl to use this script."
exit 1
fi
}
getPackage() {
uname=$(uname)
suffix=""
case $uname in
"Darwin")
suffix="-darwin"
;;
"Linux")
arch=$(uname -m)
echo $arch
case $arch in
"aarch64")
suffix="-arm64"
;;
esac
case $arch in
"armv6l" | "armv7l")
suffix="-armhf"
;;
esac
;;
esac
if [ -e /tmp/faas-cli ]; then
rm /tmp/faas-cli
fi
url=https://github.com/openfaas/faas-cli/releases/download/$version/faas-cli$suffix
echo "Getting package $url"
curl -sSL $url > /tmp/faas-cli
if [ "$?" = "0" ]; then
echo "Attemping to move faas-cli to /usr/local/bin"
chmod +x /tmp/faas-cli
cp /tmp/faas-cli /usr/local/bin/
if [ "$?" = "0" ]; then
echo "New version of faas-cli installed to /usr/local/bin"
fi
fi
}
hasCli
getPackage