From 551bfcdcd6270cec0a949bf61e04eeabf644d269 Mon Sep 17 00:00:00 2001 From: lotherk Date: Tue, 24 Nov 2026 06:34:07 +0000 Subject: [PATCH] ext-sync: relative links in plain sh, NetBSD's realpath has no -m/--relative-to On the MacBook every recipe mirror came out empty (realpath: unknown option -- m), so userland.sh found 'don't know how to make install' for mcde, splinter, tasksd. Checked with a scratch tree: misc/tasksd links resolve, no dangling link. Co-Authored-By: Claude Sonnet 5.5 --- tools/ext-sync.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tools/ext-sync.sh b/tools/ext-sync.sh index bc3d00d334..5bf500d314 100755 --- a/tools/ext-sync.sh +++ b/tools/ext-sync.sh @@ -62,8 +62,22 @@ mirror_one() # every file of the recipe, by name; a directory ($FILESDIR, patches/) # is mirrored file by file the same way (cd "$recipe" && find . -type f | sed 's|^\./||') | while read -r f; do - mkdir -p "$dst/$(dirname "$f")" - rel=$(cd "$dst/$(dirname "$f")" && realpath -m --relative-to=. "$recipe/$f") + dd=$dst + case $f in */*) dd=$dst/${f%/*} ;; esac + mkdir -p "$dd" + # relative link target in plain sh: one ../ per component of the + # link's directory below TOP, then the file's path below TOP. + # NetBSD's realpath(1) has no -m / --relative-to (GNU only). + case $dd:$recipe in + "$TOP"/*:"$TOP"/*) + up= + oldifs=$IFS; IFS=/ + for c in ${dd#$TOP/}; do up=$up../; done + IFS=$oldifs + rel=$up${recipe#$TOP/}/$f + ;; + *) rel=$(cd "$dd" && realpath -m --relative-to=. "$recipe/$f") ;; + esac ln -s "$rel" "$dst/$f" done echo "ext-sync: $cat/$pkg from ${recipe#$TOP/}"