-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
53 lines (45 loc) · 1.3 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
#!/usr/bin/env bash
# Installer for cidls CLI
set -o errexit
set -o nounset
set -o pipefail
# Check if the script is running as root, if not then prompt the user to run with sudo
if [ "$EUID" -ne 0 ]; then
echo "Please run this script with sudo for necessary permissions"
exit 1
fi
# Config
USERNAME="orvn"
REPO_NAME="cidls"
VERSION="v1.0.0"
APP="cidls"
BASE_URL="https://github.com/${USERNAME}/${REPO_NAME}/releases/download/${VERSION}"
OS="$(uname)"
ARCH="$(uname -m)"
# Determine appropriate architecture and OS based on local system
if [ "$OS" == "Darwin" ]; then
if [ "$ARCH" == "x86_64" ]; then
BINARY_URL="${BASE_URL}/${APP}_darwin_amd64"
elif [ "$ARCH" == "arm64" ]; then
BINARY_URL="${BASE_URL}/${APP}_darwin_arm64"
else
echo "Unsupported architecture: $ARCH"
exit 1
fi
elif [ "$OS" == "Linux" ]; then
if [ "$ARCH" == "x86_64" ]; then
BINARY_URL="${BASE_URL}/${APP}_linux_amd64"
elif [[ "$ARCH" == "arm"* ]]; then
BINARY_URL="${BASE_URL}/${APP}_linux_arm64"
else
echo "Unsupported architecture: $ARCH"
exit 1
fi
else
echo "Unsupported OS: $OS"
exit 1
fi
curl -L $BINARY_URL -o /tmp/$APP
chmod +x /tmp/$APP
sudo mv /tmp/$APP /usr/local/bin/$APP
echo -e "\n 🎉 All set! Installed at /usr/local/bin/$APP \n"