-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
54 lines (43 loc) · 1.11 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
#!/bin/bash
GITHUB_REPO="lederniermetre/shortcut"
RELEASE_TAG=$(curl -s "https://api.github.com/repos/$GITHUB_REPO/releases/latest" | jq -r '.tag_name')
# Define the installation directory
INSTALL_DIR="."
# Determine the current OS and architecture
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
# Map OS and ARCH to GitHub release assets
case $OS in
"linux")
OS="Linux"
;;
"darwin")
OS="Darwin"
;;
*)
echo "Unsupported operating system: $OS"
exit 1
;;
esac
case $ARCH in
"x86_64")
ARCH="amd64"
;;
"aarch64"|"arm64")
ARCH="arm64"
;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac
echo $RELEASE_TAG
# Construct the download URL
DOWNLOAD_URL="https://github.com/$GITHUB_REPO/releases/download/$RELEASE_TAG/shortcut_${OS}_${ARCH}.tar.gz"
# Download and install the release
echo "Downloading $RELEASE_TAG for $OS-$ARCH..."
echo $DOWNLOAD_URL
curl -s -L -o "$INSTALL_DIR/$(basename $DOWNLOAD_URL)" "$DOWNLOAD_URL"
tar xf "$INSTALL_DIR/$(basename $DOWNLOAD_URL)"
chmod u+x "shortcut"
echo "Installed $RELEASE_TAG to $INSTALL_DIR/shortcut"