From 1a5bc4e5c1c1031d302581e4e52e4cd9ed39a918 Mon Sep 17 00:00:00 2001 From: Oliver Kraitschy Date: Thu, 11 Apr 2024 17:19:11 +0200 Subject: [PATCH 1/2] [fix] Include all modified files in backup #206 Fixes #206 --- openwisp-config/files/openwisp.agent | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openwisp-config/files/openwisp.agent b/openwisp-config/files/openwisp.agent index 8cf8807..d02bc93 100755 --- a/openwisp-config/files/openwisp.agent +++ b/openwisp-config/files/openwisp.agent @@ -830,9 +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}.tmp" rm $BACKUP_FILE_LIST } From 579915ca979f72cc8a325638d0ab951b2bcd0e60 Mon Sep 17 00:00:00 2001 From: Federico Capoano Date: Sat, 25 May 2024 13:13:39 -0400 Subject: [PATCH 2/2] [chores] Minor improvement --- openwisp-config/files/openwisp.agent | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openwisp-config/files/openwisp.agent b/openwisp-config/files/openwisp.agent index d02bc93..b203c91 100755 --- a/openwisp-config/files/openwisp.agent +++ b/openwisp-config/files/openwisp.agent @@ -837,8 +837,7 @@ backup_configuration() { 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}.tmp" - rm $BACKUP_FILE_LIST + rm "${BACKUP_FILE_LIST}*" } restore_backup() {