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.
This commit is contained in:
FriendlyNeighborhoodShane 2021-07-22 16:32:08 +05:30
parent a06a773915
commit 44a349c531

View File

@ -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)