-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
52 lines (40 loc) · 1.22 KB
/
install.sh
File metadata and controls
52 lines (40 loc) · 1.22 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
48
49
50
51
52
#!/bin/bash
set -e
APP_NAME="tinymancer"
REPO="tinymancer/cli"
VERSION="v0.1.0"
INSTALL_DIR="/usr/local/bin"
# Detect arch
ARCH=$(uname -m)
case "$ARCH" in
x86_64) ARCH="amd64" ;;
aarch64 | arm64) ARCH="arm64" ;;
*) echo "[✖] Unsupported architecture: $ARCH" && exit 1 ;;
esac
PLATFORM="linux"
ASSET="${APP_NAME}-${PLATFORM}-${ARCH}.zip"
CHECKSUM_FILE="${APP_NAME}_${VERSION}_checksums.txt"
TMP_DIR=$(mktemp -d)
cd "$TMP_DIR"
echo "[⇩] Downloading ${ASSET}..."
curl -sL -O "https://github.com/${REPO}/releases/download/${VERSION}/${ASSET}"
echo "[⇩] Downloading checksums..."
curl -sL -O "https://github.com/${REPO}/releases/download/${VERSION}/${CHECKSUM_FILE}"
echo "[🔐] Verifying checksum..."
SHA256=$(shasum -a 256 "${ASSET}" | awk '{print $1}')
MATCH=$(grep "${SHA256}" "${CHECKSUM_FILE}" || true)
if [ -z "$MATCH" ]; then
echo "[✖] Checksum verification failed!"
exit 1
fi
echo "[📦] Extracting..."
unzip -q "${ASSET}"
echo "[⚙] Installing to ${INSTALL_DIR}..."
if [ -w "$INSTALL_DIR" ]; then
mv "${APP_NAME}" "$INSTALL_DIR/"
else
sudo mv "${APP_NAME}" "$INSTALL_DIR/"
fi
chmod +x "${INSTALL_DIR}/${APP_NAME}"
echo "[✅] Installed: ${INSTALL_DIR}/${APP_NAME}"
"${APP_NAME}" --version || "${APP_NAME}"