-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
46 lines (39 loc) · 1.25 KB
/
Copy pathinstall.sh
File metadata and controls
46 lines (39 loc) · 1.25 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
#!/usr/bin/env bash
set -e
echo "[*] Installing ShellCraft..."
# Check Go exists
if ! command -v go >/dev/null 2>&1; then
echo "[!] Go not found."
echo "Install Go first: https://go.dev/dl/"
exit 1
fi
# Install from main branch (always up to date)
INSTALL_PATH="github.com/MKMithun2806/ShellCraft/cmd/shellcraft@main"
echo "[*] Running: go install $INSTALL_PATH"
go install "$INSTALL_PATH"
# Determine GOBIN
GOBIN=$(go env GOBIN)
if [ -z "$GOBIN" ]; then
GOPATH=$(go env GOPATH)
GOBIN="$GOPATH/bin"
fi
# Add Go bin to PATH if missing
if ! echo "$PATH" | grep -q "$GOBIN"; then
SHELL_RC="$HOME/.bashrc"
if [[ "$SHELL" == */zsh ]] || [ -f "$HOME/.zshrc" ]; then
SHELL_RC="$HOME/.zshrc"
fi
echo "" >> "$SHELL_RC"
echo "# Go Binaries" >> "$SHELL_RC"
echo "export PATH=\"\$PATH:$GOBIN\"" >> "$SHELL_RC"
export PATH="$PATH:$GOBIN"
echo "[*] Added $GOBIN to $SHELL_RC"
echo "[*] Please run: source $SHELL_RC"
fi
if command -v shellcraft >/dev/null 2>&1; then
echo "[+] ShellCraft installed successfully!"
echo "[+] Try: shellcraft --version"
else
echo "[!] Installation finished, but 'shellcraft' command not found in PATH."
echo "[!] You may need to restart your terminal or source your config."
fi