#!/bin/bash set -e echo "======================================" echo " Updating NexusGuard Repository " echo "======================================" # Step 1: Docker down echo "[+] Stopping Docker containers..." docker-compose down --remove-orphans echo "[+] Docker containers stopped." # Step 2: Git pull main repo echo "[+] Pulling latest main repo..." git pull # Step 3: Update submodules echo "[+] Updating submodules..." git submodule update --init --recursive # Step 4: Pull latest on each submodule for sub in apps/server-core apps/device-agent apps/dashboard-ui; do if [ -d "$sub" ]; then echo "[+] Updating $sub..." cd "$sub" git checkout main 2>/dev/null || git checkout master 2>/dev/null || true git pull cd - > /dev/null fi done # Step 5: Re-check submodule pointers git submodule update --remote --merge 2>/dev/null || true echo "======================================" echo " Repository updated! " echo " Docker is stopped. " echo " Run ./setup.sh or ./upgrade.sh " echo " to start the services. " echo "======================================"