2023-03-04 11:07:11 +00:00
|
|
|
#!/bin/bash
|
2026-03-15 08:24:30 +00:00
|
|
|
set -euo pipefail
|
2023-03-04 11:07:11 +00:00
|
|
|
|
2026-03-15 08:24:30 +00:00
|
|
|
INSTALL_DIR="/usr/share/hackingtool"
|
2023-03-04 11:07:11 +00:00
|
|
|
|
|
|
|
|
if [[ $EUID -ne 0 ]]; then
|
2026-03-15 08:24:30 +00:00
|
|
|
echo "[ERROR] Run as root: sudo bash update.sh"
|
|
|
|
|
exit 1
|
2023-03-04 11:07:11 +00:00
|
|
|
fi
|
|
|
|
|
|
2026-03-15 08:24:30 +00:00
|
|
|
if [[ ! -d "$INSTALL_DIR" ]]; then
|
|
|
|
|
echo "[ERROR] Installation not found at $INSTALL_DIR. Run install.py first."
|
2023-03-04 11:07:11 +00:00
|
|
|
exit 1
|
|
|
|
|
fi
|
2026-03-15 08:24:30 +00:00
|
|
|
|
|
|
|
|
echo "[*] Checking internet connection..."
|
|
|
|
|
if ! curl -sSf --max-time 10 https://github.com > /dev/null; then
|
|
|
|
|
echo "[ERROR] No internet connection."
|
2023-03-04 11:07:11 +00:00
|
|
|
exit 1
|
|
|
|
|
fi
|
2026-03-15 08:24:30 +00:00
|
|
|
echo "[✔] Internet OK"
|
2023-03-04 11:07:11 +00:00
|
|
|
|
2026-03-15 08:24:30 +00:00
|
|
|
echo "[*] Pulling latest changes..."
|
2026-03-15 14:25:00 +00:00
|
|
|
git -C "$INSTALL_DIR" config --local safe.directory "$INSTALL_DIR"
|
2026-03-15 08:24:30 +00:00
|
|
|
git -C "$INSTALL_DIR" pull --rebase
|
|
|
|
|
|
|
|
|
|
echo "[*] Updating Python dependencies..."
|
|
|
|
|
if [[ -f "$INSTALL_DIR/venv/bin/pip" ]]; then
|
2026-03-15 14:25:00 +00:00
|
|
|
"$INSTALL_DIR/venv/bin/pip" install -q --upgrade -r "$INSTALL_DIR/requirements.txt"
|
2026-03-15 08:24:30 +00:00
|
|
|
else
|
|
|
|
|
echo "[WARN] venv not found — skipping pip update. Run install.py to create it."
|
2023-03-04 11:07:11 +00:00
|
|
|
fi
|
|
|
|
|
|
2026-03-15 08:24:30 +00:00
|
|
|
echo "[✔] Hackingtool updated. Run 'hackingtool' to start."
|