-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·43 lines (35 loc) · 1.38 KB
/
install
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
# Function to fetch the latest release version from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/gperreymond/ministack/releases/latest" |
sed -n 's/.*"tag_name": "\([^"]*\)".*/\1/p'
}
# Detect the operating system
OS=$(uname -s)
# Fetch the latest version of ministack
LATEST_VERSION=$(get_latest_release)
echo "[INFO] latest ministack version: $LATEST_VERSION"
# Download the binary based on the operating system
if [[ "$OS" == "Linux" ]]; then
echo "[INFO] downloading ministack for Linux..."
sudo curl -sL "https://github.com/gperreymond/ministack/releases/download/$LATEST_VERSION/ministack-linux" -o /usr/local/bin/ministack
elif [[ "$OS" == "Darwin" ]]; then
echo "[INFO] downloading ministack for macOS..."
sudo curl -sL "https://github.com/gperreymond/ministack/releases/download/$LATEST_VERSION/ministack-macos" -o /usr/local/bin/ministack
else
echo "[ERROR] unsupported operating system: $OS"
exit 1
fi
# Set execution permissions on the binary
echo "[INFO] setting execute permissions on the binary..."
sudo chmod +x /usr/local/bin/ministack
# Verify the installation
echo "[INFO] verifying installation..."
if command -v ministack > /dev/null; then
ministack --version
echo "[INFO] installation completed successfully."
else
echo "[ERROR] ministack command not found. Installation failed."
exit 1
fi