-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·101 lines (89 loc) · 2.99 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·101 lines (89 loc) · 2.99 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/env sh
set -e
REPO="BobbyNooby/agamoto"
BINARY="agamoto"
FORCE=false
for arg in "$@"; do
case "$arg" in
--force|-f) FORCE=true ;;
esac
done
echo "[agamoto] Installing..."
# Detect OS
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
case "$OS" in
linux*) OS="linux" ;;
darwin*) OS="darwin" ;;
msys*|cygwin*|mingw*|nt|win*)
echo "[agamoto] Windows is not supported by this installer."
echo "[agamoto] Install Go and run: go install github.com/${REPO}/cmd/${BINARY}@latest"
exit 1
;;
*) echo "[agamoto] Unsupported OS: $OS"; exit 1 ;;
esac
# Detect arch
ARCH=$(uname -m)
case "$ARCH" in
x86_64|amd64) ARCH="amd64" ;;
arm64|aarch64) ARCH="arm64" ;;
*) echo "[agamoto] Unsupported arch: $ARCH"; exit 1 ;;
esac
echo "[agamoto] Detected $OS/$ARCH"
# Check if already installed
EXISTING=$(command -v agamoto || true)
if [ -n "$EXISTING" ] && [ "$FORCE" != "true" ]; then
echo "[agamoto] Already installed at $EXISTING"
echo "[agamoto] Version: $(agamoto --version)"
echo "[agamoto] To update: go install github.com/${REPO}/cmd/${BINARY}@latest"
echo "[agamoto] To reinstall: curl -fsSL https://github.com/${REPO}/raw/main/install.sh | sh -s -- --force"
exit 0
fi
# Check nmap
if ! command -v nmap >/dev/null 2>&1; then
echo "[agamoto] nmap not found. Installing..."
case "$OS" in
darwin)
if command -v brew >/dev/null 2>&1; then
brew install nmap
else
echo "[agamoto] Homebrew not found. Please install nmap manually: https://nmap.org/download.html"
exit 1
fi
;;
linux)
if command -v apt >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install -y nmap
elif command -v dnf >/dev/null 2>&1; then
sudo dnf install -y nmap
elif command -v pacman >/dev/null 2>&1; then
sudo pacman -S --noconfirm nmap
else
echo "[agamoto] No supported package manager found. Please install nmap manually."
exit 1
fi
;;
esac
else
echo "[agamoto] nmap found"
fi
# Check Go
if ! command -v go >/dev/null 2>&1; then
echo "[agamoto] Go not found. Install from https://go.dev/dl/"
exit 1
fi
# Install agamoto
echo "[agamoto] Installing agamoto via go install..."
go install "github.com/${REPO}/cmd/${BINARY}@latest"
# Verify + PATH help
INSTALL_DIR="$(go env GOPATH)/bin"
if command -v agamoto >/dev/null 2>&1; then
echo "[agamoto] Installed: $(agamoto --version)"
else
echo "[agamoto] Installed to $INSTALL_DIR but agamoto is not on PATH."
echo "[agamoto] Add this to your shell config:"
echo " export PATH=\"\$PATH:$INSTALL_DIR\""
echo "[agamoto] Then reload with: source ~/.zshrc (or ~/.bashrc, etc.)"
fi
echo "[agamoto] To update later: go install github.com/${REPO}/cmd/${BINARY}@latest"
echo "[agamoto] Done. Run 'agamoto doctor' to verify."