Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·70 lines (60 loc) · 1.6 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·70 lines (60 loc) · 1.6 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
set -e
REPO="misut/exon"
INSTALL_DIR="$HOME/.exon/bin"
# Platform detection
OS=$(uname -s)
ARCH=$(uname -m)
case "$OS" in
Darwin)
case "$ARCH" in
arm64) PLATFORM="aarch64-apple-darwin" ;;
*)
echo "error: unsupported macOS architecture: $ARCH"
exit 1
;;
esac
;;
Linux)
case "$ARCH" in
x86_64) PLATFORM="x86_64-linux-gnu" ;;
aarch64) PLATFORM="aarch64-linux-gnu" ;;
*)
echo "error: unsupported Linux architecture: $ARCH"
exit 1
;;
esac
;;
*)
echo "error: unsupported OS: $OS"
exit 1
;;
esac
# Get latest release tag
echo "fetching latest release..."
TAG=$(curl -fsSL "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name"' | sed 's/.*"tag_name": "\(.*\)".*/\1/')
if [ -z "$TAG" ]; then
echo "error: failed to fetch latest release"
exit 1
fi
echo "installing exon $TAG for $PLATFORM..."
# Download
URL="https://github.com/$REPO/releases/download/$TAG/exon-$TAG-$PLATFORM.tar.gz"
TMPDIR=$(mktemp -d)
curl -fsSL "$URL" -o "$TMPDIR/exon.tar.gz"
# Extract and install
tar -xzf "$TMPDIR/exon.tar.gz" -C "$TMPDIR"
mkdir -p "$INSTALL_DIR"
mv "$TMPDIR/exon" "$INSTALL_DIR/exon"
chmod +x "$INSTALL_DIR/exon"
rm -rf "$TMPDIR"
echo "installed exon $TAG to $INSTALL_DIR/exon"
echo ""
# PATH check
case ":$PATH:" in
*":$INSTALL_DIR:"*) ;;
*)
echo "add this to your shell profile:"
echo " export PATH=\"$INSTALL_DIR:\$PATH\""
;;
esac