Skip to content

Commit

Permalink
[fix] Include all modified files in backup #206
Browse files Browse the repository at this point in the history
Fixes #206

Co-authored-by: Federico Capoano <[email protected]>
  • Loading branch information
okraits and nemesifier authored May 25, 2024
1 parent 985f300 commit 05cfe4e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions openwisp-config/files/openwisp.agent
Original file line number Diff line number Diff line change
Expand Up @@ -830,10 +830,14 @@ backup_configuration() {
# save list of files that are going to be changed by openwisp
# so that if the changes sent by openwisp cause problems,
# the previous version can be rolled back
tar -ztf $CONFIGURATION_ARCHIVE | sed 's/^/\//' >$BACKUP_FILE_LIST
tar -ztf $CONFIGURATION_ARCHIVE | sed 's/^/\//' >"${BACKUP_FILE_LIST}.tmp"
# include all currently modified files because a change might
# get removed in the new configuration and then a file would disappear
find /etc/openwisp/remote/ -type f | sed 's/^\/etc\/openwisp\/remote//' >>"${BACKUP_FILE_LIST}.tmp"
sort -u "${BACKUP_FILE_LIST}.tmp" >$BACKUP_FILE_LIST
# backup only those files
tar -zcf $CONFIGURATION_BACKUP -T $BACKUP_FILE_LIST
rm $BACKUP_FILE_LIST
rm "${BACKUP_FILE_LIST}*"
}

restore_backup() {
Expand Down

0 comments on commit 05cfe4e

Please sign in to comment.