ipcrm,ipcs: make them NOEXEC
[oweals/busybox.git] / make_single_applets.sh
index 6473e4dddb98cd510251b65d334b788a4a990eef..329a27d32ff17e857aab87b11f1fb4293a816e14 100755 (executable)
@@ -26,10 +26,16 @@ allno="$cfg"
 for app in $apps; do
        allno="`echo "$allno" | sed "s/^CONFIG_${app}=y\$/# CONFIG_${app} is not set/"`"
 done
+#echo "$allno" >.config_allno
+
+trap 'test -f .config.SV && mv .config.SV .config && touch .config' EXIT
+
 
 # Turn on each applet individually and build single-applet executable
+# (give config names on command line to build only those)
+test $# = 0 && set -- $apps
 fail=0
-for app in $apps; do
+for app; do
        # Only if it was indeed originally enabled...
        { echo "$cfg" | grep -q "^CONFIG_${app}=y\$"; } || continue
 
@@ -37,22 +43,36 @@ for app in $apps; do
        mv .config .config.SV
        echo "CONFIG_${app}=y" >.config
        echo "$allno" | sed "/^# CONFIG_${app} is not set\$/d" >>.config
+
+       if test x"${app}" != x"SH_IS_ASH" && test x"${app}" != x"SH_IS_HUSH"; then
+               # $allno has all choices for "sh" aliasing set to off.
+               # "sh" aliasing defaults to "ash", not none.
+               # without this fix, "make oldconfig" sets it wrong,
+               # resulting in NUM_APPLETS = 2 (the second applet is "sh")
+               sed '/CONFIG_SH_IS_NONE/d' -i .config
+               echo "CONFIG_SH_IS_NONE=y" >>.config
+       fi
+
        if ! yes '' | make oldconfig >busybox_make_${app}.log 2>&1; then
-               : $((fail++))
+               fail=$((fail+1))
                echo "Config error for ${app}"
                mv .config busybox_config_${app}
-       elif ! make $makeopts >busybox_make_${app}.log 2>&1; then
-               : $((fail++))
+       elif ! make $makeopts >>busybox_make_${app}.log 2>&1; then
+               fail=$((fail+1))
+               grep -i -e error: -e warning: busybox_make_${app}.log
                echo "Build error for ${app}"
                mv .config busybox_config_${app}
        elif ! grep -q '^#define NUM_APPLETS 1$' include/NUM_APPLETS.h; then
+               grep -i -e error: -e warning: busybox_make_${app}.log
                mv busybox busybox_${app}
-               : $((fail++))
+               fail=$((fail+1))
                echo "NUM_APPLETS != 1 for ${app}: `cat include/NUM_APPLETS.h`"
                mv .config busybox_config_${app}
        else
+               grep -i -e error: -e warning: busybox_make_${app}.log \
+               || rm busybox_make_${app}.log
                mv busybox busybox_${app}
-               rm busybox_make_${app}.log
+               #mv .config busybox_config_${app}
        fi
        mv .config.SV .config
        #exit