summaryrefslogtreecommitdiff
path: root/src/lib/photo-list.source.sh
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-07-18 12:42:02 +0300
committerPaul Buetow <paul@buetow.org>2026-07-18 12:42:02 +0300
commit42036d5ec36160a9caa6de64f9476726a5386a69 (patch)
treecea966e9683dc5adc967912341b9847abd40dfed /src/lib/photo-list.source.sh
parent3c35381b71f992eb7a86552697ea647bb76b68b1 (diff)
Support FreeBSD and macOS via resolved GNU tool variables
shuriken relied on GNU-only extensions (find -printf, stat -c, cp -a, sort -R) and hard-refused to run outside Linux. Resolve each of the four tools once at startup to a FIND/STAT/CP/SORT variable, preferring a g-prefixed sibling (gfind, gstat, gcp, gsort) when present on PATH - mirroring the $SED/$GREP/$DATE tool-selection pattern in the sibling gemtexter project - so the same source runs unmodified on Linux, macOS, and FreeBSD once GNU coreutils/findutils are installed there. - src/lib/compat.source.sh: add resolve_gnu_tool + FIND/STAT/CP/SORT; add a fast verify_gnu_tool_versions preflight (--version contains "GNU") ahead of the existing behavioral probes, which now run against the resolved variables instead of hardcoded tool names; split the probes and error reporting into their own ~30-line functions. - Replace the GNU-only find -printf / stat -c / cp -a / sort -R call sites in photo-list, image, album-photo-select, metadata-cache, config.staging, and random source files with the resolved variables. POSIX-portable find/sort calls elsewhere are untouched. - README.md: drop the "Linux-only" claim; document brew/pkg GNU coreutils+findutils install steps for macOS and FreeBSD. - tests/cli.sh: add coverage for the g-prefixed-sibling preference and for the new --version-string preflight's error message, alongside the existing behavioral-probe guard tests. just build / just check-generated / just shellcheck / just test / git diff --check all pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'src/lib/photo-list.source.sh')
-rw-r--r--src/lib/photo-list.source.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/photo-list.source.sh b/src/lib/photo-list.source.sh
index 9e7ce72..754e09e 100644
--- a/src/lib/photo-list.source.sh
+++ b/src/lib/photo-list.source.sh
@@ -23,11 +23,13 @@
# suppressed (the stats background loader) adds its own 2>/dev/null. This is the
# SORTED listing; album_photo_files deliberately keeps its own maybe_shuffle
# variant because the album's display order is the configurable shuffle, not a
-# plain sort.
+# plain sort. Uses $FIND (compat.source.sh): -printf is GNU-only, so this must
+# run against the resolved GNU find, not whatever "find" plain resolves to on
+# macOS/FreeBSD. The trailing plain "sort" is POSIX-portable and left as-is.
list_photos() {
local -r photos_dir="$1"; shift
- find "$DIST_DIR/$photos_dir" -maxdepth 1 -type f -printf '%f\n' | sort
+ "$FIND" "$DIST_DIR/$photos_dir" -maxdepth 1 -type f -printf '%f\n' | sort
}
# Pick one seeded-random entry from an already-collected list, addressed by