From 75774cea62f349e435c019e2b79209bb6b39565d Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 5 Jun 2025 12:50:45 +0200 Subject: [PATCH] update --- update_firmware.sh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/update_firmware.sh b/update_firmware.sh index 59737f3..4ad9576 100755 --- a/update_firmware.sh +++ b/update_firmware.sh @@ -3,6 +3,7 @@ # NebuleAir Pro 4G - Comprehensive Update Script # This script performs a complete system update including git pull, # config initialization, and service management +# Non-interactive version for WebUI echo "======================================" echo "NebuleAir Pro 4G - Firmware Update" @@ -13,7 +14,7 @@ echo "" # Set working directory cd /var/www/nebuleair_pro_4g -# Ensure this script is executable (needed because git config core.fileMode false) +# Ensure this script is executable chmod +x /var/www/nebuleair_pro_4g/update_firmware.sh # Function to print status messages @@ -33,14 +34,23 @@ check_status() { # Step 1: Git operations print_status "Step 1: Updating firmware from repository..." + +# Disable filemode to prevent permission issues +git -C /var/www/nebuleair_pro_4g config core.fileMode false +check_status "Git fileMode disabled" + +# Fetch latest changes git fetch origin check_status "Git fetch" -# Show current branch and any changes +# Show current branch print_status "Current branch: $(git branch --show-current)" + +# Check for local changes if [ -n "$(git status --porcelain)" ]; then - print_status "Warning: Local changes detected:" - git status --short + print_status "Warning: Local changes detected, stashing..." + git stash push -m "Auto-stash before update $(date)" + check_status "Git stash" fi # Pull latest changes @@ -62,6 +72,7 @@ sudo chmod 755 /var/www/nebuleair_pro_4g/NPM/*.py sudo chmod 755 /var/www/nebuleair_pro_4g/BME280/*.py sudo chmod 755 /var/www/nebuleair_pro_4g/SARA/*.py sudo chmod 755 /var/www/nebuleair_pro_4g/envea/*.py +sudo chmod 755 /var/www/nebuleair_pro_4g/MPPT/*.py 2>/dev/null check_status "File permissions update" # Step 4: Restart critical services if they exist @@ -122,6 +133,9 @@ print_status "Step 6: Cleaning up..." sudo find /var/www/nebuleair_pro_4g/logs -name "*.log" -size +10M -exec truncate -s 0 {} \; check_status "Log cleanup" +print_status "" +print_status "======================================" print_status "Update completed successfully!" +print_status "======================================" exit 0 \ No newline at end of file