aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2024-04-18 20:09:05 -0500
committerRob Landley <rob@landley.net>2024-04-18 20:09:05 -0500
commit880e973acebe4a14e2a60a2a3a73aa869e899a58 (patch)
tree5e5f1b3a1b82913d7fddce50b1947d52d4f2dbee
parent7d9ee89d3cf80f5e712badd7caa988ce235ccda1 (diff)
downloadtoybox-880e973acebe4a14e2a60a2a3a73aa869e899a58.tar.gz
Let record-commands be run from an arbitrary directory.
-rwxr-xr-xmkroot/record-commands7
1 files 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