-
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·47 lines (41 loc) · 1.44 KB
/
install.sh
File metadata and controls
executable file
·47 lines (41 loc) · 1.44 KB
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
#!/bin/sh
CUR_DIR=$(pwd)
. "$(dirname "$0")/version.env"
BIN_DIR="$HOME/.local/bin"
PLATFORM=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case $PLATFORM in
linux|darwin|mingw*)
case $ARCH in
x86_64|amd64) ARCH="x86_64" ;;
aarch64|arm64) ARCH="aarch64" ;;
armv7l) ARCH="armv7" ;;
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
esac
;;
*) echo "Unsupported platform: $PLATFORM"; exit 1 ;;
esac
case $PLATFORM in
linux)
case $ARCH in
x86_64) PLATFORM="unknown-linux-musl" ;;
aarch64) PLATFORM="unknown-linux-gnu" ;;
armv7) PLATFORM="unknown-linux-musleabihf" ;;
*) echo "Unsupported platform and architecture combination"; exit 1 ;;
esac
;;
darwin) PLATFORM="apple-darwin" ;;
mingw*) PLATFORM="pc-windows-msvc" ;;
*) echo "Unsupported platform: $PLATFORM"; exit 1 ;;
esac
TAR="cocogitto-$VERSION-$ARCH-$PLATFORM.tar.gz"
echo "Downloading cocogitto version $VERSION for $ARCH-$PLATFORM from https://github.com/cocogitto/cocogitto/releases/download/$VERSION/$TAR"
mkdir -p "$BIN_DIR"
cd "$BIN_DIR" || exit
curl -OL https://github.com/cocogitto/cocogitto/releases/download/"$VERSION"/"$TAR"
if [ "$PLATFORM" = "pc-windows-msvc" ]; then
tar --strip-components=1 -xzf $TAR "$ARCH-$PLATFORM/cog.exe"
else
tar --strip-components=1 -xzf $TAR "$ARCH-$PLATFORM/cog"
fi
cd "$CUR_DIR" || exit