diff options
author | Rob Landley <rob@landley.net> | 2024-04-20 09:58:06 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2024-04-20 09:58:06 -0500 |
commit | 7c6aecd477a9b898df981197088c9e1d5775fe9c (patch) | |
tree | 55fb8794b5e0fab0d41c9b775690e234725ba06a | |
parent | 475d3aa8577cd4ac8aee1bbcf6a57f0b0bd34943 (diff) | |
download | toybox-7c6aecd477a9b898df981197088c9e1d5775fe9c.tar.gz |
Two changes to record-commands: 1) busybox find doesn't understand commas
in -type so use parentheses and -o, 2) change semantics (sourcing changes
variables) so running with no arguments sets up a persistent wrapper
and outputs an export line to update variables.
-rwxr-xr-x | mkroot/mkroot.sh | 2 | ||||
-rwxr-xr-x | mkroot/record-commands | 23 | ||||
-rw-r--r-- | scripts/prereq/generated/config.h | 2 |
3 files changed, 11 insertions, 16 deletions
diff --git a/mkroot/mkroot.sh b/mkroot/mkroot.sh index cb6a78f9..227dbb3c 100755 --- a/mkroot/mkroot.sh +++ b/mkroot/mkroot.sh @@ -82,7 +82,7 @@ if [ -z "$NOLOGPATH" ]; then CROSS_COMPILE=${CROSS_COMPILE##*/} export WRAPDIR="$BUILD/record-commands" LOGPATH="$LOG"-commands.txt rm -rf "$WRAPDIR" "$LOGPATH" generated/obj && - WRAPDIR="$WRAPDIR" CROSS_COMPILE= NOSTRIP=1 source mkroot/record-commands || + eval "$(WRAPDIR="$WRAPDIR" CROSS_COMPILE= NOSTRIP=1 mkroot/record-commands)"|| exit 1 fi diff --git a/mkroot/record-commands b/mkroot/record-commands index e2bbb83c..71f2c4ef 100755 --- a/mkroot/record-commands +++ b/mkroot/record-commands @@ -5,23 +5,15 @@ [ -z "$WRAPDIR" ] && WRAPDIR="$PWD"/record-commands && RM=$(which rm) [ -z "$LOGPATH" ] && export LOGPATH="$PWD"/log.txt -if [ ${#BASH_SOURCE[@]} -lt 2 ] && [ $# -eq 0 ] -then - echo "usage: WRAPDIR=dir LOGPATH=log.txt record-commands COMMAND..." - echo 'Then examine log.txt. "record-commands echo" to just setup $WRAPDIR' - exit 1 -fi - if [ ! -x "$WRAPDIR/logpath" ] then LOG="$(which logpath)" mkdir -p "$WRAPDIR" || 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 + [ -e "$LOG" ] && cp -H "$LOG" "$WRAPDIR/logpath" || { cd "$(dirname $0)/.." && + PREFIX="$WRAPDIR/" scripts/single.sh logpath >/dev/null && + LOG="$PWD/logpath" || exit 1; } tr : '\n' <<< "$PATH" | while read i; do - find "$i" -type f,l -maxdepth 1 -executable -exec basename {} \; | \ + find "$i" \( -type f -o -type l \) -maxdepth 1 -executable -exec basename {} \; | \ while read FILE; do ln -s logpath "$WRAPDIR/$FILE" 2>/dev/null; done done fi @@ -30,13 +22,14 @@ fi rm -f "$LOGPATH" # When sourced, set up wrapper for current context. -export PATH="$WRAPDIR:$PATH" -if [ ${#BASH_SOURCE[@]} -lt 2 ] +if [ $# -gt 0 ] then - "$@" + PATH="$WRAPDIR:$PATH" "$@" X=$? [ -n "$RM" ] && "$RM" -rf "$WRAPDIR" exit $X +else + echo export LOGPATH=${LOGPATH@Q} PATH=${WRAPDIR@Q}:${PATH@Q} fi diff --git a/scripts/prereq/generated/config.h b/scripts/prereq/generated/config.h index f46eed9b..60c87b5b 100644 --- a/scripts/prereq/generated/config.h +++ b/scripts/prereq/generated/config.h @@ -700,5 +700,7 @@ #define USE_TOYBOX_NORECURSE(...) #define CFG_TOYBOX_DEBUG 0 #define USE_TOYBOX_DEBUG(...) +#define CFG_TOYBOX_UID_SYS 100 +#define CFG_TOYBOX_UID_USR 500 #define CFG_TOYBOX_FORCE_NOMMU 0 #define USE_TOYBOX_FORCE_NOMMU(...) |