-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·120 lines (106 loc) · 2.32 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/sh
# Modified Linkerd2 bash install script: curl -sL run.linkerd.io/install
set -eu
KPKG_VERSION=${KPKG_VERSION:-0.4.3}
KPKG_ROOT=${KPKG_ROOT:-"${HOME}/.kpkg"}
happyexit() {
echo ""
echo "Add kpkg CLI and kpkg installed binaries to your path with:"
echo ""
echo " export PATH=\$PATH:${KPKG_ROOT}/bin:${KPKG_ROOT}/original"
echo ""
echo "Now run:"
echo ""
echo " kpkg get # validate that CLI was installed"
echo ""
echo "For more info: Visit https://github.com/spachava753/kpkg"
echo ""
exit 0
}
OS=$(uname -s)
arch=$(uname -m)
cli_arch=""
case $OS in
CYGWIN* | MINGW64*)
;;
Darwin)
case $arch in
x86_64)
cli_arch=amd64
;;
armv8*)
cli_arch=arm64
;;
aarch64*)
cli_arch=arm64
;;
amd64|arm64)
cli_arch=$arch
;;
*)
echo "There is no kpkg $OS support for $arch. Please open an issue with your platform details."
exit 1
;;
esac
;;
Linux)
case $arch in
x86_64)
cli_arch=amd64
;;
armv8*)
cli_arch=arm64
;;
aarch64*)
cli_arch=arm64
;;
armv*)
cli_arch=arm
;;
amd64|arm64)
cli_arch=$arch
;;
*)
echo "There is no kpkg $OS support for $arch. Please open an issue with your platform details."
exit 1
;;
esac
;;
*)
echo "There is no kpkg support for $OS/$arch. Please open an issue with your platform details."
exit 1
;;
esac
OS=$(echo $OS | tr '[:upper:]' '[:lower:]')
tmpdir=$(mktemp -d /tmp/kpkg.XXXXXX)
srcfile="kpkg_${OS}_${cli_arch}.zip"
dstfile="${KPKG_ROOT}/original/kpkg"
url="https://github.com/spachava753/kpkg/releases/download/${KPKG_VERSION}/${srcfile}"
(
cd "$tmpdir"
echo "Downloading ${srcfile} at ${url}..."
curl -fLO "${url}"
echo "Download complete!"
echo ""
echo "Unzipping... 📤"
unzip "${srcfile}"
echo "Unzipped! ☑"
echo ""
)
srcfile="kpkg"
(
echo "Installing... 💣"
mkdir -p "${KPKG_ROOT}/original"
rm -f "${dstfile}"
mv "${tmpdir}/${srcfile}" "${dstfile}"
chmod +x "${dstfile}"
echo "Installed! 💥"
)
rm -r "$tmpdir"
(
echo "exporting PATH"
export PATH=${PATH}:${KPKG_ROOT}/bin:${KPKG_ROOT}/original
)
echo "kpkg was successfully installed 🎉"
echo ""
happyexit