diff --git a/.github/scripts/generate-pr-plugin.sh b/.github/scripts/generate-pr-plugin.sh index 922c67b3f..602a8bf66 100755 --- a/.github/scripts/generate-pr-plugin.sh +++ b/.github/scripts/generate-pr-plugin.sh @@ -123,12 +123,17 @@ while IFS= read -r file; do # The tarball contains usr/local/emhttp/... (no leading slash) # When we extract with -C /, it becomes /usr/local/emhttp/... SYSTEM_FILE="/${file}" + BACKUP_FILE="$BACKUP_DIR/$(echo "$file" | tr '/' '_')" - # Check if file exists and backup the ORIGINAL (before our changes) echo "Processing: $file" - if [ -f "$SYSTEM_FILE" ]; then - BACKUP_FILE="$BACKUP_DIR/$(echo "$file" | tr '/' '_')" - echo " → Backing up existing: $SYSTEM_FILE" + + # Only backup if we haven't already backed up this file + # (preserves original backups across updates) + if [ -f "$BACKUP_FILE" ]; then + echo " → Using existing backup: $BACKUP_FILE" + echo "$SYSTEM_FILE|$BACKUP_FILE" >> "$MANIFEST" + elif [ -f "$SYSTEM_FILE" ]; then + echo " → Creating backup of original: $SYSTEM_FILE" cp -p "$SYSTEM_FILE" "$BACKUP_FILE" echo "$SYSTEM_FILE|$BACKUP_FILE" >> "$MANIFEST" else @@ -140,11 +145,15 @@ done < /tmp/plugin_files.txt # Clean up temp file rm -f /tmp/plugin_files.txt -# Extract the tarball to root +# Extract the tarball to root with verbose output # Since tarball contains usr/local/emhttp/..., extracting to / makes it /usr/local/emhttp/... echo "" -echo "Extracting files to system..." -tar -xzvf "$TARBALL" -C / 2>&1 | head -20 +echo "Extracting files to system (verbose mode)..." +echo "----------------------------------------" +tar -xzvf "$TARBALL" -C / +EXTRACT_STATUS=$? +echo "----------------------------------------" +echo "Extraction completed with status: $EXTRACT_STATUS" echo "" # Verify extraction @@ -188,6 +197,57 @@ echo "⚠️ Remove this plugin before applying production updates" + + + + "$MANIFEST" + +echo "Step 2: Update will now proceed with installation of new PR files..." +echo "" +]]> + + + diff --git a/.github/workflows/pr-plugin-build.yml b/.github/workflows/pr-plugin-build.yml index 19b382759..e87749e46 100644 --- a/.github/workflows/pr-plugin-build.yml +++ b/.github/workflows/pr-plugin-build.yml @@ -216,4 +216,5 @@ jobs: --- 🤖 This comment is automatically generated and will be updated with each new push to this PR. - edit-mode: replace \ No newline at end of file + edit-mode: replace + comment-id: deploy-comment \ No newline at end of file