From 44a349c531c306f59763256ead51b1620522844a Mon Sep 17 00:00:00 2001 From: FriendlyNeighborhoodShane Date: Thu, 22 Jul 2021 16:32:08 +0530 Subject: [PATCH] script-addon.sh: recursively pass files to functions, not dirs The addon.d helper functions don't like being passed directories, so we just use find and pass the them the files ourselves. We could have implemented the helper functions, but there's too much of a mess going on in the addon.d world. That will probably cause more problems that it will solve. --- res/util/script-addon.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/res/util/script-addon.sh b/res/util/script-addon.sh index 5876122..192c64d 100755 --- a/res/util/script-addon.sh +++ b/res/util/script-addon.sh @@ -57,8 +57,11 @@ case "$1" in log "Backing up..."; save_files | translate_path | while read -r object; do [ "$object" ] && [ -e "$S/$object" ] || continue; - backup_file "$S/$object"; - log "BACKUPER: Object backed up ($object)"; + for file in $(find "$S/$object" -type f); do + file="${file#$S/}"; + backup_file "$S/$file"; + log "BACKUPER: Object backed up ($file)"; + done; done; ;; restore) @@ -66,8 +69,11 @@ case "$1" in log "Restoring..."; save_files | translate_path | while read -r object; do [ "$object" ] && [ -e "$C/$S/$object" ] || continue; - restore_file "$S/$object"; - log "RESTORER: Object restored ($object)"; + for file in $(find "$C/$S/$object" -type f); do + file="${file#$C/$S/}"; + restore_file "$S/$file"; + log "RESTORER: Object restored ($file)"; + done; done; ;; post-restore)