forked from chainbase-labs/manuscript-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-gui.sh
42 lines (31 loc) · 1.21 KB
/
install-gui.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
#!/bin/bash
# Fetch the latest version tag from GitHub API
REPO="chainbase-labs/manuscript-core"
LATEST_VERSION=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
if [[ -z "$LATEST_VERSION" ]]; then
echo "Failed to fetch the latest version. Please check your internet connection or the repository."
exit 1
fi
echo "Latest version: $LATEST_VERSION"
# Define the base URL with the latest version
BASE_URL="https://github.com/$REPO/releases/download/$LATEST_VERSION"
# Determine OS type and set the download URL
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
BINARY_URL="$BASE_URL/manuscript-gui-linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
BINARY_URL="$BASE_URL/manuscript-gui-mac"
else
echo "Unsupported OS type: $OSTYPE"
exit 1
fi
# Download the binary
echo "Downloading from $BINARY_URL..."
curl -L -o manuscript-gui "$BINARY_URL"
if [[ $? -ne 0 ]]; then
echo "Failed to download the binary. Please check the URL or your network connection."
exit 1
fi
# Make the binary executable
chmod +x manuscript-gui
# Run the binary
echo -e "🚀 Success! The binary is locked, loaded, and ready to go. \n🏃 Start it with: ./manuscript-gui"