diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-13 10:15:20 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-13 10:15:20 +0300 |
| commit | d4971998edae804c39797486be7a342d43e61e5c (patch) | |
| tree | 830c008847704b40b7f45d4c7c620beed03958d6 /src/lib/config.sync.source.sh | |
| parent | e9437367b8fc7a4cb0ffed6c0a8ba89356a3b9ad (diff) | |
Refactor helper modules for im0
Diffstat (limited to 'src/lib/config.sync.source.sh')
| -rw-r--r-- | src/lib/config.sync.source.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/lib/config.sync.source.sh b/src/lib/config.sync.source.sh index b9362ac..68bb759 100644 --- a/src/lib/config.sync.source.sh +++ b/src/lib/config.sync.source.sh @@ -1,3 +1,26 @@ +resolve_sync_destinations() { + local -n destinations_ref="$1"; shift + local destinations_decl + + destinations_ref=() + + if ! destinations_decl=$(declare -p SYNC_DESTINATIONS 2>/dev/null); then + return + fi + + case "$destinations_decl" in + declare\ -a*\ SYNC_DESTINATIONS=*) + destinations_ref=("${SYNC_DESTINATIONS[@]}") + ;; + *) + if [ -n "${SYNC_DESTINATIONS:-}" ]; then + # shellcheck disable=SC2034 + read -r -a destinations_ref <<< "$SYNC_DESTINATIONS" + fi + ;; + esac +} + sync_dist() { local destination local -a rsync_args=(-av) |
