-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathinstaller.sh
More file actions
executable file
·76 lines (60 loc) · 1.41 KB
/
installer.sh
File metadata and controls
executable file
·76 lines (60 loc) · 1.41 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
#!/usr/bin/env bash
set -e
INSTALL_DIR="$HOME/.local/bin"
BINARIES=("litterbox")
print_path_warning() {
case ":$PATH:" in
*":$HOME/.local/bin:"*)
echo "✓ $HOME/.local/bin is already in your PATH."
;;
*)
echo "⚠️ NOTE: $HOME/.local/bin is not in your PATH."
echo "Add this to your shell config (e.g., ~/.bashrc or ~/.zshrc):"
echo ""
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
echo ""
;;
esac
}
uninstall() {
echo ""
echo "=== Uninstalling Litterbox ==="
echo ""
for bin in "${BINARIES[@]}"; do
TARGET="$INSTALL_DIR/$bin"
if [[ -f "$TARGET" ]]; then
echo "Removing $TARGET"
rm -f "$TARGET"
else
echo "Not found: $TARGET"
fi
done
echo ""
echo "Uninstallation complete!"
echo ""
exit 0
}
if [[ "$1" == "--uninstall" ]]; then
uninstall
fi
echo ""
echo "=== Installing Litterbox ==="
echo ""
# Find the embedded archive
PAYLOAD_LINE=$(grep -n "^__ARCHIVE_BELOW__$" "$0" | cut -d: -f1)
PAYLOAD_LINE=$((PAYLOAD_LINE + 1))
TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
echo "Extracting embedded package..."
tail -n +$PAYLOAD_LINE "$0" | tar -xz -C "$TMPDIR"
mkdir -p "$INSTALL_DIR"
echo "Installing binaries to $INSTALL_DIR ..."
for bin in "${BINARIES[@]}"; do
install -m 755 "$TMPDIR/$bin" "$INSTALL_DIR"
done
echo ""
echo "Installation complete!"
echo ""
print_path_warning
exit 0
__ARCHIVE_BELOW__