-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·52 lines (38 loc) · 1.4 KB
/
install.sh
File metadata and controls
executable file
·52 lines (38 loc) · 1.4 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
#!/usr/bin/env bash
set -e
REPO="benca137/apt-remote"
OS="$(uname -s)"
echo "🔍 Detected OS: $OS"
echo "📡 Fetching latest release info..."
LATEST_URL=$(curl -s https://api.github.com/repos/$REPO/releases/latest)
if [[ "$OS" == "Linux" ]]; then
echo "📦 Downloading latest .deb package..."
FILE_URL=$(echo "$LATEST_URL" | grep "browser_download_url" | grep ".deb" | cut -d '"' -f 4)
if [ -z "$FILE_URL" ]; then
echo "❌ Could not find .deb file in latest release."
exit 1
fi
TMP_FILE="/var/tmp/apt-remote.deb"
curl -L "$FILE_URL" -o "$TMP_FILE"
echo "📦 Installing .deb package..."
sudo apt install -y "$TMP_FILE"
rm "$TMP_FILE"
echo "✅ apt-remote installed successfully!"
elif [[ "$OS" == "Darwin" ]]; then
echo "🍎 Downloading latest .pkg package..."
FILE_URL=$(echo "$LATEST_URL" | grep "browser_download_url" | grep ".pkg" | cut -d '"' -f 4)
if [ -z "$FILE_URL" ]; then
echo "❌ Could not find .pkg file in latest release."
exit 1
fi
TMP_DIR=$(mktemp -d)
curl -L "$FILE_URL" -o "$TMP_DIR/apt-remote.pkg"
echo "📦 Installing .pkg package..."
sudo installer -pkg "$TMP_DIR/apt-remote.pkg" -target /
rm "$TMP_DIR"
echo "✅ apt-remote installed successfully!"
else
echo "❌ Unsupported OS: $OS"
echo "This script currently supports Linux (.deb) and macOS (.pkg) only."
exit 1
fi