summaryrefslogtreecommitdiff
path: root/src/lib/config.sync.source.sh
AgeCommit message (Collapse)Author
2026-06-27qr0: timeout + per-destination isolation for rsync sync_distPaul Buetow
Wrap each rsync in sync_dist in run_with_timeout (new SYNC_TIMEOUT config, default 300s) so a hung or unreachable mirror cannot block the whole sync, matching every other external call. Make destinations isolated: under set -euo pipefail a single failing destination used to abort the loop and silently skip the rest. Now each destination runs under a localized set +e (the project's refresh_splash idiom), results are collected per destination, a clear pass/fail summary is logged, and sync returns non-zero if any destination failed while still attempting all of them. SYNC_TIMEOUT is plumbed like TAR_TIMEOUT: shuriken.default.conf, apply_config_defaults, print_config, verbose config log, and positive-integer validation in both validate_config (generate path) and validate_sync_config (sync path). No CLI flag, matching TAR_TIMEOUT. Tests: a sync where one destination fails still attempts the others and exits non-zero with the summary; SYNC_TIMEOUT=0 is rejected as a positive integer. Adds install_rsync_spy_failing_one helper and updates the print_config expected blocks. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17an0 reject scalar SYNC_DESTINATIONS instead of word-splitting itPaul Buetow
A scalar SYNC_DESTINATIONS containing spaces was word-split by the shared resolve_config_array helper, breaking a single destination into multiple broken arguments passed to rsync. A list of rsync destinations is inherently a list, and array syntax is the only spelling that preserves embedded spaces. resolve_sync_destinations now detects a scalar declaration via declare -p and fails with a clear config_error telling the user to use array syntax. The array path is unchanged, and resolve_config_array's scalar word-splitting is left intact for TAR_OPTS (where turning "-c -v" into separate options is desired). Adds focused tests proving the scalar case errors without invoking rsync and the array case preserves a space-containing destination as one argument. Updates src/shuriken.default.conf and README.md to document the requirement. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-14lm0 harden resolve_config_array callers against set -ePaul Buetow
The shared resolve_config_array helper returns non-zero when the source config var was never declared. Both callers (resolve_tar_opts, resolve_sync_destinations) invoked it unconditionally and ignored the return value, so under set -euo pipefail a genuinely-unset TAR_OPTS or SYNC_DESTINATIONS would abort the function before the empty-array fallback could run. Currently masked because apply_config_defaults always declares both vars, but the contract was unsafe to rely on. Guard both call sites with `|| true` and document why: the empty array the helper leaves behind is exactly what each caller's fallback expects. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-14lm0 de-duplicate imagemagick detection and config-array parsingPaul Buetow
Introduce a shared resolve_config_array helper in bootstrap.source.sh that parses a config variable declared as either a Bash array or a whitespace-separated scalar into a named output array. resolve_tar_opts and resolve_sync_destinations now both delegate to it, with resolve_tar_opts keeping its "-c" default for the empty/unset case. validate_imagemagick now reuses resolve_imagemagick_command instead of duplicating the magick/convert probing, reporting failures through config_error so the validation output is unchanged. Add a print-config test covering the empty TAR_OPTS (scalar and array) fallback to the default. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-13Refactor helper modules for im0Paul Buetow
2026-06-13jm0: centralize runtime config defaultsPaul Buetow
2026-06-11Split config module concerns for task 9m0Paul Buetow