From fbfb6b2febddbb746b2193f19be65f6b26316fe3 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 19 Jul 2025 21:56:32 -0500 Subject: [PATCH] For single builds, disable TOYFLAG_HELP and TOYFLAG_SUID for commands that don't need them. --- scripts/single.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/single.sh b/scripts/single.sh index e2ed9880..20b6575d 100755 --- a/scripts/single.sh +++ b/scripts/single.sh @@ -25,13 +25,14 @@ KCONFIG_CONFIG=.singleconfig for i in "$@" do echo -n "$i:" - TOYFILE="$(egrep -l "TOY[(]($i)[ ,]" toys/*/*.c)" + NEWTOY="$(egrep -H "TOY[(]($i)[ ,]" toys/*/*.c)" - if [ -z "$TOYFILE" ] + if [ -z "$NEWTOY" ] then echo "Unknown command '$i'" >&2 exit 1 fi + TOYFILE="${NEWTOY/:*/}" make allnoconfig > /dev/null || exit 1 @@ -41,7 +42,10 @@ do then DEPENDS="$($SED -n 's/USE_\([^(]*\)(...TOY([^,]*,.*TOYFLAG_MAYFORK.*/\1/p' toys/*/*.c)" else + # Disable multiplexer and features not needed by this command to save space MPDEL='s/CONFIG_TOYBOX=y/# CONFIG_TOYBOX is not set/;t' + [ "${NEWTOY/NOHELP/}" != "$NEWTOY" ] && GLOBDEP="${DEPENDS/TOYBOX_HELP/}" + [ "${NEWTOY/ROOT/}" != "$NEWTOY" ] && GLOBDEP="${DEPENDS/TOYBOX_SUID/}" fi # Enable stuff this command depends on -- 2.39.5