-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sh
80 lines (66 loc) · 1.7 KB
/
install.sh
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/sh
set -e
echo
echo "# Determining your OS and architecture"
echo
case `uname -s` in
Darwin)
OPERATING_SYSTEM=mac
INSTALL_DIR="$HOME/bin"
;;
Linux)
OPERATING_SYSTEM=linux
INSTALL_DIR="$HOME/.local/bin"
;;
*)
echo "Error: Unknown operating system: `uname -s`"
exit 1
;;
esac
case `uname -m` in
aarch64) ARCHITECTURE=arm64 ;;
arm64) ARCHITECTURE=arm64 ;;
armv7l) ARCHITECTURE=arm32 ;;
i386) ARCHITECTURE=i386 ;;
i686) ARCHITECTURE=i386 ;;
x86_64) ARCHITECTURE=amd64 ;;
*)
echo "Error: Unknown architecture: `uname -m`"
exit 1
;;
esac
echo " Operating system: $OPERATING_SYSTEM"
echo " Architecture: $ARCHITECTURE"
echo
echo "# Looking up the latest release for your environment"
echo
RELEASE_URL=`curl -sfL "https://api.github.com/repos/skupperproject/skupper/releases/121869522" \
| grep browser_download_url \
| cut -d '"' -f 4 \
| grep "${OPERATING_SYSTEM}-${ARCHITECTURE}"`
echo " $RELEASE_URL"
echo
echo "# Downloading and installing the Skupper command"
echo
mkdir -p "$INSTALL_DIR"
curl -fL "$RELEASE_URL" | tar -C "$INSTALL_DIR" -xzf -
echo
echo "# Testing the Skupper command"
echo
if PATH="$INSTALL_DIR:$PATH" skupper version > /dev/null; then
echo " Result: OK"
echo
else
echo "Error: Skupper command execution failed"
exit 1
fi
echo "# The Skupper command is now available:"
echo
echo " $INSTALL_DIR/skupper"
echo
if [ "`which skupper`" != "$INSTALL_DIR/skupper" ]; then
echo "# Use the following command to place it on your path:"
echo
echo " export PATH=\"$INSTALL_DIR:\$PATH\""
echo
fi