Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Include all modified files in backup #206 #207

Merged
merged 2 commits into from
May 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading