forked from bots-garden/capsule
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-capsule-launcher.sh
executable file
·58 lines (50 loc) · 1.61 KB
/
install-capsule-launcher.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
#!/bin/bash
LAST_CAPSULE_VERSION="v0.2.8"
echo "System: ${OSTYPE} $(uname -m)"
if [ -z "$CAPSULE_PATH" ]
then
CAPSULE_PATH="$HOME/.local/bin"
fi
if [[ $1 = "help" ]]
then
echo "usage: $0"
echo "The script will detect the OS & ARCH and use the last version of capsule (${LAST_CAPSULE_VERSION})"
echo "You can force the values by setting these environment variables:"
echo "- CAPSULE_OS (linux, darwin)"
echo "- CAPSULE_ARCH (amd64, arm64)"
echo "- CAPSULE_VERSION (default: ${LAST_CAPSULE_VERSION})"
echo "- CAPSULE_PATH (default: ${CAPSULE_PATH})"
exit 0
fi
if [ -z "$CAPSULE_VERSION" ]
then
CAPSULE_VERSION=$LAST_CAPSULE_VERSION
fi
if [ -z "$CAPSULE_OS" ]
then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
CAPSULE_OS="linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
CAPSULE_OS="darwin"
else
CAPSULE_OS="linux"
fi
fi
if [ -z "$CAPSULE_ARCH" ]
then
if [[ "$(uname -m)" == "x86_64" ]]; then
CAPSULE_ARCH="amd64"
elif [[ "$(uname -m)" == "arm64" ]]; then
CAPSULE_ARCH="arm64"
elif [[ $(uname -m) == "aarch64" ]]; then
CAPSULE_ARCH="arm64"
else
CAPSULE_ARCH="amd64"
fi
fi
CAPSULE_MODULE="capsule"
echo "Installing ${CAPSULE_MODULE}..."
wget https://github.com/bots-garden/capsule/releases/download/${CAPSULE_VERSION}/${CAPSULE_MODULE}-${CAPSULE_VERSION}-${CAPSULE_OS}-${CAPSULE_ARCH}.tar.gz
tar -zxf ${CAPSULE_MODULE}-${CAPSULE_VERSION}-${CAPSULE_OS}-${CAPSULE_ARCH}.tar.gz --directory ${CAPSULE_PATH}
rm ${CAPSULE_MODULE}-${CAPSULE_VERSION}-${CAPSULE_OS}-${CAPSULE_ARCH}.tar.gz
echo "Capsule $(capsule version) is installed 🎉"