-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·71 lines (62 loc) · 2.22 KB
/
install.sh
File metadata and controls
executable file
·71 lines (62 loc) · 2.22 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
#!/usr/bin/env bash
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "[DropLAN] Installing dependencies..."
pip3 install --user -r "$SCRIPT_DIR/requirements.txt"
echo "[DropLAN] Setting up CLI..."
mkdir -p "$HOME/.local/bin"
# Create the droplan launcher script
cat > "$HOME/.local/bin/droplan" <<EOF
#!/usr/bin/env bash
exec python3 "$SCRIPT_DIR/src/cli.py" "\$@"
EOF
chmod +x "$HOME/.local/bin/droplan"
# Check if ~/.local/bin is in PATH
if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
echo ""
echo "[DropLAN] Adding ~/.local/bin to your PATH..."
# Detect shell and add to appropriate config
SHELL_NAME=$(basename "$SHELL")
case "$SHELL_NAME" in
zsh)
# Check for custom ZDOTDIR or common locations
if [[ -n "$ZDOTDIR" && -f "$ZDOTDIR/.zshrc" ]]; then
SHELL_RC="$ZDOTDIR/.zshrc"
elif [[ -f "$HOME/.config/zsh/.zshrc" ]]; then
SHELL_RC="$HOME/.config/zsh/.zshrc"
else
SHELL_RC="$HOME/.zshrc"
fi
;;
bash)
if [[ -f "$HOME/.bash_profile" ]]; then
SHELL_RC="$HOME/.bash_profile"
else
SHELL_RC="$HOME/.bashrc"
fi
;;
fish)
# Fish uses a different method
fish -c 'set -U fish_user_paths $HOME/.local/bin $fish_user_paths' 2>/dev/null || true
SHELL_RC=""
;;
*)
SHELL_RC="$HOME/.profile"
;;
esac
if [[ -n "$SHELL_RC" ]]; then
echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$SHELL_RC"
echo "[DropLAN] Added PATH to $SHELL_RC"
fi
fi
echo ""
echo "════════════════════════════════════════════════"
echo " ✅ DropLAN installed successfully!"
echo "════════════════════════════════════════════════"
echo ""
echo " To start using droplan, either:"
echo " 1. Restart your terminal, OR"
echo " 2. Run: source ~/.zshrc (or your shell's rc file)"
echo ""
echo " Then simply type: droplan"
echo ""