-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·45 lines (33 loc) · 1.07 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·45 lines (33 loc) · 1.07 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
#!/usr/bin/env sh
set -eu
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case "$ARCH" in
x86_64) ARCH="amd64" ;;
aarch64) ARCH="arm64" ;;
arm64) ARCH="arm64" ;;
*) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;;
esac
VERSION=$(curl -sSL https://api.github.com/repos/ytnobody/hermit/releases/latest \
| grep '"tag_name"' | cut -d'"' -f4)
if [ -z "$VERSION" ]; then
echo "Failed to fetch latest release version" >&2
exit 1
fi
BINARY_URL="https://github.com/ytnobody/hermit/releases/download/${VERSION}/hermit-${OS}-${ARCH}"
SHA256_URL="${BINARY_URL}.sha256"
echo "Downloading HERMIT ${VERSION} for ${OS}/${ARCH}..."
curl -sSL "$BINARY_URL" -o /tmp/hermit
curl -sSL "$SHA256_URL" -o /tmp/hermit.sha256
# Verify checksum
cd /tmp
sha256sum -c hermit.sha256
cd - > /dev/null
INSTALL_PATH="${HOME}/.local/bin/hermit"
install -m 755 /tmp/hermit "$INSTALL_PATH"
rm -f /tmp/hermit /tmp/hermit.sha256
echo "Installed hermit to $INSTALL_PATH"
"$INSTALL_PATH" install
echo ""
echo "HERMIT installed successfully!"
echo "Next: cd <your-project> && hermit init"