diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-14 15:17:32 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-14 15:17:32 +0300 |
| commit | 67231312ba2d80592e305b08bbf03f7aece2e4a3 (patch) | |
| tree | 960a4cf09d741215b3d4c6a2fefbc8c52d09b0ac /src/lib/config.validate.source.sh | |
| parent | aabe2efbb79938dbbdb4f0ab496cdc22e7280736 (diff) | |
lm0 de-duplicate imagemagick detection and config-array parsing
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>
Diffstat (limited to 'src/lib/config.validate.source.sh')
| -rw-r--r-- | src/lib/config.validate.source.sh | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lib/config.validate.source.sh b/src/lib/config.validate.source.sh index 7988821..b858144 100644 --- a/src/lib/config.validate.source.sh +++ b/src/lib/config.validate.source.sh @@ -152,10 +152,16 @@ validate_refresh_splash_config() { } validate_imagemagick() { - if command -v magick >/dev/null 2>&1; then - return - fi - if command -v convert >/dev/null 2>&1; then + # Reuse the canonical detection in resolve_imagemagick_command instead of + # duplicating the magick/convert probing here. Its own error message is + # suppressed so we report the failure through config_error, keeping the + # validation output consistent (single "ERROR: ..." line, return code 1). + # imagemagick_command is a nameref output filled by the resolver; we only + # care about the exit status here, not the resolved command. + # shellcheck disable=SC2034 + local -a imagemagick_command=() + + if resolve_imagemagick_command convert imagemagick_command 2>/dev/null; then return fi |
