This commit is contained in:
Your Name
2025-06-05 12:50:45 +02:00
parent 3731c2b7cf
commit 75774cea62

View File

@@ -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