-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·50 lines (39 loc) · 908 Bytes
/
Copy pathinstall.sh
File metadata and controls
executable file
·50 lines (39 loc) · 908 Bytes
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
#!/usr/bin/env bash
set -e
BIN="nmsurf"
INSTALL_DIR="/usr/local/bin"
echo "Installing $BIN..."
# Check Go exists
if ! command -v go >/dev/null 2>&1; then
echo "Error: Go is not installed."
exit 1
fi
# Check runtime dependencies
check_dep() {
if ! command -v "$1" >/dev/null 2>&1; then
echo "Warning: dependency '$1' not found"
fi
}
check_dep nmcli
if command -v wofi >/dev/null 2>&1; then
:
elif command -v rofi >/dev/null 2>&1; then
:
else
echo "Warning: neither wofi nor rofi found"
fi
# Ensure modules are correct
echo "Resolving dependencies..."
go mod tidy
# Build binary
echo "Building $BIN..."
go build -ldflags="-s -w" -o "$BIN" ./cmd/nmsurf
# Install binary
echo "Installing to $INSTALL_DIR..."
sudo install -Dm755 "$BIN" "$INSTALL_DIR/$BIN"
echo
echo "Install complete."
echo "Binary location: $INSTALL_DIR/$BIN"
echo
echo "Run with:"
echo " nmsurf"