This repository has been archived by the owner on Jun 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgov.sh
55 lines (47 loc) · 1.4 KB
/
gov.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
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
# Define the URL of the gov binary
GOV_URL="https://gov.theprocedural.com/bin"
# Define the installation directory (where gov will be installed)
INSTALL_DIR="/usr/local/bin"
# Determine the platform (Linux or macOS)
PLATFORM=""
if [ "$(uname)" = "Linux" ]; then
PLATFORM="linux"
elif [ "$(uname)" = "Darwin" ]; then
PLATFORM="darwin"
else
echo "Unsupported operating system. Please use Linux or macOS."
exit 1
fi
# Determine the architecture for Linux
ARCH=""
if [ "$PLATFORM" = "linux" ]; then
if [ "$(uname -m)" = "x86_64" ]; then
ARCH="amd64"
elif [ "$(uname -m)" = "i386" ]; then
ARCH="386"
elif [ "$(uname -m)" = "aarch64" ]; then
ARCH="arm64"
elif [ "$(uname -m)" = "armv7l" ]; then
ARCH="arm"
else
echo "Unsupported architecture. Please use x86_64, i386, armv7l, or aarch64."
exit 1
fi
fi
# Determine the architecture for macOS
if [ "$PLATFORM" = "darwin" ]; then
ARCH="$(uname -m)"
fi
# Download the appropriate gov binary
if command -v curl >/dev/null 2>&1; then
sudo curl -sSL "$GOV_URL/$PLATFORM/$ARCH/gov" -o "$INSTALL_DIR/gov"
elif command -v wget >/dev/null 2>&1; then
sudo wget -q "$GOV_URL/$PLATFORM/$ARCH/gov" -O "$INSTALL_DIR/gov"
else
echo "Neither curl nor wget found. Please install one of them and try again."
exit 1
fi
# Make the gov binary executable
sudo chmod +x "$INSTALL_DIR/gov"
echo "gov has been installed to $INSTALL_DIR/gov."