From 880e973acebe4a14e2a60a2a3a73aa869e899a58 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 18 Apr 2024 20:09:05 -0500 Subject: [PATCH] Let record-commands be run from an arbitrary directory. --- mkroot/record-commands | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mkroot/record-commands b/mkroot/record-commands index 32557a3e..e2bbb83c 100755 --- a/mkroot/record-commands +++ b/mkroot/record-commands @@ -14,9 +14,12 @@ fi if [ ! -x "$WRAPDIR/logpath" ] then + LOG="$(which logpath)" mkdir -p "$WRAPDIR" || exit 1 - [ -e "$(which logpath)" ] && cp -H "$(which logpath)" "$WRAPDIR/logpath" || - PREFIX="$WRAPDIR/" scripts/single.sh logpath || exit 1 + [ -e "$(which logpath)" ] || { cd "$(dirname $0)/.." && + PREFIX="$WRAPDIR/" scripts/single.sh logpath && LOG=$(readlink -f logpath)|| + exit 1; } + cp -H "$LOG" "$WRAPDIR/logpath" || exit 1 tr : '\n' <<< "$PATH" | while read i; do find "$i" -type f,l -maxdepth 1 -executable -exec basename {} \; | \ while read FILE; do ln -s logpath "$WRAPDIR/$FILE" 2>/dev/null; done -- 2.39.2