-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
executable file
·45 lines (39 loc) · 1.12 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
#!/bin/bash
set -euo pipefail
# determine loda executable based on OS/architecture
if [[ "$OSTYPE" == linux* ]]; then
arch=$(lscpu | grep "Architecture" | awk '{print $2}')
if [[ "$arch" == "x86_64" ]] || [[ "$arch" == "i686" ]]; then
LODA_EXEC="loda-linux-x86"
elif [[ "$arch" == "aarch64" ]]; then
LODA_EXEC="loda-linux-arm64"
fi
elif [[ "$OSTYPE" == darwin* ]]; then
arch=$(uname -m)
if [[ "$arch" == "x86_64" ]] || [[ "$arch" == "i686" ]]; then
LODA_EXEC="loda-macos-x86"
elif [[ "$arch" == "arm64" ]]; then
LODA_EXEC="loda-macos-arm64"
fi
fi
if [ -z ${LODA_EXEC+x} ]; then
echo "Unsupported OS/architecture"
exit 1
fi
# check if git is installed
if ! [ -x "$(command -v git)" ]; then
echo "git is not installed. Please install it and retry."
echo "For more information on git, see https://git-scm.com/"
exit 1
fi
if [ -z ${LODA_HOME+x} ]; then
LODA_HOME=$HOME/loda
fi
# download loda and start setup
mkdir -p $LODA_HOME/bin
cd $LODA_HOME/bin
if ! [ -x "./loda" ]; then
curl -fsSLo loda https://github.com/loda-lang/loda-cpp/releases/latest/download/$LODA_EXEC
chmod u+x loda
fi
./loda setup