Add reimage bootstrap: deploy.sh, setup_wifi.sh, fix setup.sh enable/reinstall, idempotent DB inserts

This commit is contained in:
Cobra
2026-04-07 13:20:15 -04:00
parent 0f754cfb7f
commit 7070f6548c
4 changed files with 186 additions and 16 deletions
+36 -12
View File
@@ -24,6 +24,7 @@ FLAG_REINSTALL=0
FLAG_JUMPBOX=0
FLAG_NO_TOOLS=0
FLAG_VERIFY_ONLY=0
FLAG_ENABLE_SVC=0
# ── Output helpers ──────────────────────────────────────────────────────────
info() { echo -e "${GREEN}[+]${NC} $*"; }
@@ -47,22 +48,24 @@ usage() {
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Options:"
echo " --reinstall Force reinstall all components"
echo " --jumpbox Minimal install for RPi Zero 2W jumpbox mode"
echo " --no-tools Skip GitHub tool installation"
echo " --verify-only Check installation without changes"
echo " -h, --help Show this help"
echo " --reinstall Force reinstall all components"
echo " --jumpbox Minimal install for RPi Zero 2W jumpbox mode"
echo " --no-tools Skip GitHub tool installation"
echo " --enable-service Enable and start bigbrother-core.service after setup"
echo " --verify-only Check installation without changes"
echo " -h, --help Show this help"
exit 0
}
while [[ $# -gt 0 ]]; do
case "$1" in
--reinstall) FLAG_REINSTALL=1; shift ;;
--jumpbox) FLAG_JUMPBOX=1; shift ;;
--no-tools) FLAG_NO_TOOLS=1; shift ;;
--verify-only) FLAG_VERIFY_ONLY=1; shift ;;
-h|--help) usage ;;
*) die "Unknown option: $1" ;;
--reinstall) FLAG_REINSTALL=1; shift ;;
--jumpbox) FLAG_JUMPBOX=1; shift ;;
--no-tools) FLAG_NO_TOOLS=1; shift ;;
--enable-service) FLAG_ENABLE_SVC=1; shift ;;
--verify-only) FLAG_VERIFY_ONLY=1; shift ;;
-h|--help) usage ;;
*) die "Unknown option: $1" ;;
esac
done
@@ -691,7 +694,9 @@ if [[ ! -f "$BUILD_DATA" ]]; then
fi
if [[ -f "$BUILD_DATA" ]]; then
"${VENV_DIR}/bin/python3" "$BUILD_DATA" --output-dir "${INSTALL_DIR}/data" >> "$LOG_FILE" 2>&1
BUILD_DATA_FLAGS="--output-dir ${INSTALL_DIR}/data"
[[ $FLAG_REINSTALL -eq 1 ]] && BUILD_DATA_FLAGS="$BUILD_DATA_FLAGS --force"
"${VENV_DIR}/bin/python3" "$BUILD_DATA" $BUILD_DATA_FLAGS >> "$LOG_FILE" 2>&1
info "Data databases created"
else
warn "build_data.py not found -- databases will need to be created manually"
@@ -847,3 +852,22 @@ echo " Mode: $(if [[ $FLAG_JUMPBOX -eq 1 ]]; then echo 'jumpbox (minimal
echo " Log: ${LOG_FILE}"
echo ""
info "Run '${INSTALL_DIR}/bigbrother.py' to start"
# ════════════════════════════════════════════════════════════════════════════
# 12. ENABLE AND START SERVICE
# ════════════════════════════════════════════════════════════════════════════
if [[ $FLAG_ENABLE_SVC -eq 1 ]]; then
step "Enabling and starting bigbrother-core service..."
if systemctl enable bigbrother-core.service 2>/dev/null; then
info "bigbrother-core.service enabled"
else
warn "Failed to enable bigbrother-core.service"
fi
if systemctl start bigbrother-core.service 2>/dev/null; then
info "bigbrother-core.service started"
sleep 3
systemctl status bigbrother-core.service --no-pager -l 2>/dev/null || true
else
warn "Failed to start bigbrother-core.service — check journalctl -u bigbrother-core"
fi
fi