-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·77 lines (60 loc) · 1.91 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
#!/bin/sh
# This script is for installing the latest version of Netmap CLI on your machine.
set -e
BINARY_NAME="netmap"
VERSION="v0.1.3"
probe_arch() {
ARCH=$(uname -m)
case $ARCH in
x86_64) ARCH="x86_64" ;;
aarch64) ARCH="arm64" ;;
arm64) ARCH="arm64" ;;
*) printf "Architecture ${ARCH} is not supported by this installation script\n"; exit 1 ;;
esac
}
probe_os() {
OS=$(uname -s)
case $OS in
Darwin) OS="Darwin" ;;
Linux) OS="Linux" ;;
*) printf "Operating system ${OS} is not supported by this installation script\n"; exit 1 ;;
esac
}
install_netmap_cli() {
printf "\nInstalling Netmap!\n"
case $ARCH in
x86_64) ARCH_TARGET="amd64" ;;
aarch64) ARCH_TARGET="aarch64" ;;
arm64) ARCH_TARGET="arm64" ;;
*)
printf "Architecture ${ARCH} is not supported for netmap\n"
return 1
;;
esac
case $OS in
Darwin) OS_TARGET="darwin" ;;
Linux) OS_TARGET="linux" ;;
*)
printf "Operating system ${OS} is not supported for netmap\n"
return 1
;;
esac
NETMAP_TARGET="${BINARY_NAME}-${OS_TARGET}-${ARCH_TARGET}-${VERSION}"
# URL for MacOS AMD64: https://github.com/opennetworktools/netmap/releases/download/v0.1.3/netmap-darwin-amd64-v0.1.3
NETMAP_URL_PREFIX="https://github.com/opennetworktools/netmap/releases/download/${VERSION}"
NETMAP_URL="${NETMAP_URL_PREFIX}/${NETMAP_TARGET}"
# printf "\n$NETMAP_URL"
curl --progress-bar -L -o $BINARY_NAME $NETMAP_URL
chmod +x $BINARY_NAME
sudo mv $BINARY_NAME /usr/local/bin/$BINARY_NAME
}
main() {
printf "\nWelcome to the Netmap CLI installer!\n"
probe_arch
probe_os
install_netmap_cli
printf "\nNetmap CLI installed!\n"
Printf "\nRun \"netmap version\" to verify the installation."
printf "\nRun \"netmap help\" to get started!\n\n"
}
main