-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·91 lines (75 loc) · 1.98 KB
/
install.sh
File metadata and controls
executable file
·91 lines (75 loc) · 1.98 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
set -e
REPO="slowmove/applaunch"
INSTALL_DIR="/usr/local/bin"
FALLBACK_DIR="$HOME/.local/bin"
BINARY_NAME="applaunch"
echo "Installing applaunch..."
echo ""
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case "$ARCH" in
x86_64)
ARCH="amd64"
;;
aarch64|arm64)
ARCH="arm64"
;;
*)
echo "Error: Unsupported architecture: $ARCH"
echo "Supported architectures: x86_64 (amd64), aarch64 (arm64)"
exit 1
;;
esac
case "$OS" in
linux)
;;
darwin)
;;
*)
echo "Error: Unsupported operating system: $OS"
echo "Supported operating systems: Linux, macOS (Darwin)"
exit 1
;;
esac
echo "Platform: $OS ($ARCH)"
echo "Fetching latest version..."
LATEST=$(curl -sL "https://api.github.com/repos/${REPO}/releases/latest" | \
grep '"tag_name"' | cut -d'"' -f4)
if [ -z "$LATEST" ]; then
echo "Error: Could not determine latest version"
echo "Please visit https://github.com/${REPO}/releases to download manually"
exit 1
fi
echo "Version: $LATEST"
FILENAME="${BINARY_NAME}_${OS}_${ARCH}"
TARBALL="${FILENAME}.tar.gz"
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${LATEST}/${TARBALL}"
echo "Downloading..."
TEMP_DIR=$(mktemp -d)
curl -sL "$DOWNLOAD_URL" -o "${TEMP_DIR}/${TARBALL}"
echo "Extracting..."
tar -xzf "${TEMP_DIR}/${TARBALL}" -C "$TEMP_DIR"
INSTALL_TARGET=""
if [ -w "$INSTALL_DIR" ]; then
INSTALL_TARGET="${INSTALL_DIR}/${BINARY_NAME}"
else
INSTALL_TARGET="${FALLBACK_DIR}/${BINARY_NAME}"
mkdir -p "$FALLBACK_DIR"
fi
mv "${TEMP_DIR}/${BINARY_NAME}" "$INSTALL_TARGET"
chmod +x "$INSTALL_TARGET"
rm -rf "$TEMP_DIR"
echo ""
echo "✓ Installation complete!"
echo ""
echo "Installed to: $INSTALL_TARGET"
echo ""
echo "To run applaunch, run:"
echo " $INSTALL_TARGET"
echo ""
echo "To update in the future:"
echo " $INSTALL_TARGET --update"
echo ""
echo "For more information, visit:"
echo " https://github.com/${REPO}"