-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
43 lines (37 loc) · 1.33 KB
/
install.sh
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
#!/bin/bash
set -e
# Detect OS
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
OS="linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
OS="macos"
else
echo "Unsupported OS. Please install manually."
exit 1
fi
# Detect architecture
ARCH=$(uname -m)
if [[ "$ARCH" != "x86_64" ]]; then
echo "Unsupported architecture. Please install manually."
exit 1
fi
# Set GitHub repo and latest release info
REPO="doziestar/server_forge"
LATEST_RELEASE=$(curl -s https://api.github.com/repos/$REPO/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
# Download the appropriate package
if [[ "$OS" == "linux" ]]; then
curl -LO "https://github.com/$REPO/releases/download/$LATEST_RELEASE/serverforge-x86_64-unknown-linux-gnu.tar.gz"
tar xzf serverforge-x86_64-unknown-linux-gnu.tar.gz
sudo mv serverforge /usr/local/bin/
rm serverforge-x86_64-unknown-linux-gnu.tar.gz
elif [[ "$OS" == "macos" ]]; then
if command -v brew &> /dev/null; then
brew install doziestar/tap/serverforge
else
curl -LO "https://github.com/$REPO/releases/download/$LATEST_RELEASE/serverforge-x86_64-apple-darwin.tar.gz"
tar xzf serverforge-x86_64-apple-darwin.tar.gz
sudo mv serverforge /usr/local/bin/
rm serverforge-x86_64-apple-darwin.tar.gz
fi
fi
echo "ServerForge has been installed successfully!"