2008-01-19 15:08:39 -08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2008-01-20 17:00:16 -08:00
|
|
|
# This has to be a separate file from scripts/make.sh so it can be called
|
|
|
|
# before menuconfig. (It's called again from scripts/make.sh just to be sure.)
|
|
|
|
|
2008-01-19 15:08:39 -08:00
|
|
|
mkdir -p generated
|
2012-02-03 21:16:28 -08:00
|
|
|
OUTFILE=generated/Config.in
|
2008-01-19 15:08:39 -08:00
|
|
|
|
2012-02-13 06:44:32 -08:00
|
|
|
source configure
|
|
|
|
|
2012-02-23 19:03:18 -08:00
|
|
|
probeconfig()
|
2008-01-19 15:08:39 -08:00
|
|
|
{
|
2012-02-03 21:16:28 -08:00
|
|
|
# Probe for container support on target
|
|
|
|
|
|
|
|
echo -e "# container support\nconfig TOYBOX_CONTAINER\n\tbool" || return 1
|
2012-03-19 18:15:08 -07:00
|
|
|
${CROSS_COMPILE}${CC} -xc -o /dev/null - 2>/dev/null << EOF
|
2012-03-03 23:24:06 -08:00
|
|
|
#include <linux/sched.h>
|
2012-02-03 21:16:28 -08:00
|
|
|
int x=CLONE_NEWNS|CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWNET;
|
2012-03-19 18:15:08 -07:00
|
|
|
|
|
|
|
int main(int argc, char *argv[]) { return unshare(x); }
|
2012-02-03 21:16:28 -08:00
|
|
|
EOF
|
|
|
|
[ $? -eq 0 ] && DEFAULT=y || DEFAULT=n
|
2012-03-19 18:15:08 -07:00
|
|
|
rm a.out 2>/dev/null
|
2012-02-03 21:16:28 -08:00
|
|
|
echo -e "\tdefault $DEFAULT\n" || return 1
|
2012-02-23 19:03:18 -08:00
|
|
|
}
|
2012-03-19 18:15:08 -07:00
|
|
|
|
2012-02-23 19:03:18 -08:00
|
|
|
genconfig()
|
|
|
|
{
|
2012-08-25 12:25:22 -07:00
|
|
|
# I could query the directory here, but I want to control the order
|
|
|
|
# and capitalization in the menu
|
|
|
|
for j in Posix LSB Other
|
2008-01-19 15:08:39 -08:00
|
|
|
do
|
2012-08-25 12:25:22 -07:00
|
|
|
echo "menu \"$j commands\""
|
2008-01-19 15:08:39 -08:00
|
|
|
echo
|
2012-08-25 12:25:22 -07:00
|
|
|
|
|
|
|
DIR=$(echo $j | tr A-Z a-z)
|
|
|
|
|
|
|
|
# extract config stanzas from each source file, in alphabetical order
|
|
|
|
for i in $(ls -1 toys/$DIR/*.c)
|
|
|
|
do
|
|
|
|
# Grab the config block for Config.in
|
|
|
|
echo "# $i"
|
|
|
|
sed -n '/^\*\//q;/^config [A-Z]/,$p' $i || return 1
|
|
|
|
echo
|
|
|
|
done
|
|
|
|
|
|
|
|
echo endmenu
|
2008-01-19 15:08:39 -08:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2012-02-23 19:03:18 -08:00
|
|
|
probeconfig > generated/Config.probed || rm generated/Config.probed
|
|
|
|
genconfig > generated/Config.in || rm generated/Config.in
|