Fix app re-enable after upgrade (#2797)#2816
Open
notarealnumber wants to merge 1 commit intonextcloud:mainfrom
Open
Fix app re-enable after upgrade (#2797)#2816notarealnumber wants to merge 1 commit intonextcloud:mainfrom
notarealnumber wants to merge 1 commit intonextcloud:mainfrom
Conversation
The enabled_apps_before_upgrade.txt was written to $BACKUP before the backup rotation moved all contents to $BACKUP-OLD/<timestamp> and recreated an empty $BACKUP directory. The re-enable logic at the end of the script could never find the file. Fix: Move the timestamp into the $BACKUP variable itself (lib.sh) so that each backup run gets its own directory under /mnt/NCBACKUP/. This eliminates the rotation step that destroyed the file and also fixes a minor race condition where $(date) was called twice for mkdir and rsync, potentially creating two different timestamp directories. Additionally: - Add cleanup of backups older than one year - Fix legacy migration block to use correct target paths
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2797
Problem
The
enabled_apps_before_upgrade.txtis saved to$BACKUPin line 369, but the backuprotation (formerly lines 1157-1164) moves everything to
$BACKUP-OLD/<timestamp>/, deletes$BACKUP, and recreates it empty. When the re-enable logic runs at line 1366, the file isgone. The condition silently evaluates to false and no apps are re-enabled.
Root cause
$BACKUPpointed to a fixed path (/mnt/NCBACKUP) that was reused and rotated duringthe same script run.
Fix
$BACKUPnow includes a timestamp (/mnt/NCBACKUP/<timestamp>), giving eachrun its own directory. No rotation needed, no file loss.
year. Fix the legacy migration block (
/var/NCBACKUP→ new structure). The re-enablelogic works unchanged since
$BACKUPnow persists throughout the script.Additional fixes
$(date +%Y-%m-%d-%H%M%S)was called separately formkdirandrsync, potentially producing two different timestamps.