hush: allow hush to run embedded scripts

Embedded scripts require a shell to be present in the BusyBox
binary.  Allow either ash or hush to be used for this purpose.
If both are enabled ash takes precedence.

The size of the binary is unchanged in the default configuration:
both ash and hush are present but support for embedded scripts
isn't compiled into hush.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Ron Yorston 2018-11-27 14:34:25 +00:00 committed by Denys Vlasenko
parent f4709d78cb
commit 71df2d3589
10 changed files with 62 additions and 32 deletions

View file

@ -1,5 +1,7 @@
#!/bin/sh
. ./.config || exit 1
target="$1"
custom_loc="$2"
applet_loc="$3"
@ -8,6 +10,12 @@ test "$target" || exit 1
test "$SED" || SED=sed
test "$DD" || DD=dd
if [ x"$CONFIG_FEATURE_SH_EMBEDDED_SCRIPTS" != x"y" ]
then
printf '#define NUM_SCRIPTS 0\n' >"$target"
exit 0
fi
# Some people were bitten by their system lacking a (proper) od
od -v -b </dev/null >/dev/null
if test $? != 0; then

View file

@ -25,7 +25,7 @@ custom_scripts()
then
for i in $(cd "$custom_loc"; ls * 2>/dev/null)
do
printf "APPLET_SCRIPTED(%s, scripted, BB_DIR_USR_BIN, BB_SUID_DROP, scripted)\n" $i;
printf "IF_FEATURE_SH_EMBEDDED_SCRIPTS(APPLET_SCRIPTED(%s, scripted, BB_DIR_USR_BIN, BB_SUID_DROP, scripted))\n" $i;
done
fi
}