diff --git a/scripts/backup/locations/location_loader.sh b/scripts/backup/locations/location_loader.sh index 9e04d61..e936199 100644 --- a/scripts/backup/locations/location_loader.sh +++ b/scripts/backup/locations/location_loader.sh @@ -11,8 +11,18 @@ sourceBackupLocations() dir=$(backupLocationsDir) [[ ! -d "$dir" ]] && return 0 + # configs/backup/locations/ lives in the manager-owned configs tree (not + # the dockerinstall-owned containers tree), so a plain find works fine. + # runFileOp was adding ~50 ms of sudo-shell overhead per invocation for + # no benefit. Fall back to runFileOp only if the directory isn't readable + # for some reason (relocated tree, custom permissions, …). + local find_cmd=(find) + if [[ ! -r "$dir" || ! -x "$dir" ]] && declare -f runFileOp >/dev/null 2>&1; then + find_cmd=(runFileOp find) + fi + local cfg while IFS= read -r -d '' cfg; do [[ -f "$cfg" ]] && source "$cfg" - done < <(runFileOp find "$dir" -mindepth 2 -maxdepth 2 -name location.config -type f -print0 2>/dev/null) + done < <("${find_cmd[@]}" "$dir" -mindepth 2 -maxdepth 2 -name location.config -type f -print0 2>/dev/null) }