hackingtool/update.sh

35 lines
962 B
Bash
Raw Permalink Normal View History

#!/bin/bash
2026-03-15 08:24:30 +00:00
set -euo pipefail
2026-03-15 08:24:30 +00:00
INSTALL_DIR="/usr/share/hackingtool"
if [[ $EUID -ne 0 ]]; then
2026-03-15 08:24:30 +00:00
echo "[ERROR] Run as root: sudo bash update.sh"
exit 1
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."
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."
exit 1
fi
2026-03-15 08:24:30 +00:00
echo "[✔] Internet OK"
2026-03-15 08:24:30 +00:00
echo "[*] Pulling latest changes..."
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
"$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."
fi
2026-03-15 08:24:30 +00:00
echo "[✔] Hackingtool updated. Run 'hackingtool' to start."