annotate scripts/genconfig.sh @ 669:10ad87be2c55

Trivial cleanup
author Rob Landley <rob@landley.net>
date Sat, 06 Oct 2012 19:01:23 -0500
parents 2986aa63a021
children f5ef67700a26
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
233
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
1 #!/bin/bash
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
2
239
4f1ca01db000 Fluff out hello.c to supply more example code as a skeleton for new commands,
Rob Landley <rob@landley.net>
parents: 233
diff changeset
3 # This has to be a separate file from scripts/make.sh so it can be called
4f1ca01db000 Fluff out hello.c to supply more example code as a skeleton for new commands,
Rob Landley <rob@landley.net>
parents: 233
diff changeset
4 # before menuconfig. (It's called again from scripts/make.sh just to be sure.)
4f1ca01db000 Fluff out hello.c to supply more example code as a skeleton for new commands,
Rob Landley <rob@landley.net>
parents: 233
diff changeset
5
233
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
6 mkdir -p generated
426
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
7 OUTFILE=generated/Config.in
233
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
8
454
8f5780dd6da4 The unshare test needs $CC defined, source configure to get it.
Rob Landley <rob@landley.net>
parents: 426
diff changeset
9 source configure
8f5780dd6da4 The unshare test needs $CC defined, source configure to get it.
Rob Landley <rob@landley.net>
parents: 426
diff changeset
10
496
f0247cfc37f2 Don't mix the the probed symbols with the command symbols.
Rob Landley <rob@landley.net>
parents: 454
diff changeset
11 probeconfig()
233
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
12 {
426
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
13 # Probe for container support on target
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
14
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
15 echo -e "# container support\nconfig TOYBOX_CONTAINER\n\tbool" || return 1
552
7b85b0a0e9c0 Have probe for unshare test for actual unshare() function in libc.
Rob Landley <rob@landley.net>
parents: 519
diff changeset
16 ${CROSS_COMPILE}${CC} -xc -o /dev/null - 2>/dev/null << EOF
519
c6b3bd689d0a Fix build on slackware-current.
Georgi Chorbadzhiyski <gf@unixsol.org>
parents: 512
diff changeset
17 #include <linux/sched.h>
426
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
18 int x=CLONE_NEWNS|CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWNET;
552
7b85b0a0e9c0 Have probe for unshare test for actual unshare() function in libc.
Rob Landley <rob@landley.net>
parents: 519
diff changeset
19
7b85b0a0e9c0 Have probe for unshare test for actual unshare() function in libc.
Rob Landley <rob@landley.net>
parents: 519
diff changeset
20 int main(int argc, char *argv[]) { return unshare(x); }
426
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
21 EOF
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
22 [ $? -eq 0 ] && DEFAULT=y || DEFAULT=n
552
7b85b0a0e9c0 Have probe for unshare test for actual unshare() function in libc.
Rob Landley <rob@landley.net>
parents: 519
diff changeset
23 rm a.out 2>/dev/null
426
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
24 echo -e "\tdefault $DEFAULT\n" || return 1
496
f0247cfc37f2 Don't mix the the probed symbols with the command symbols.
Rob Landley <rob@landley.net>
parents: 454
diff changeset
25 }
552
7b85b0a0e9c0 Have probe for unshare test for actual unshare() function in libc.
Rob Landley <rob@landley.net>
parents: 519
diff changeset
26
496
f0247cfc37f2 Don't mix the the probed symbols with the command symbols.
Rob Landley <rob@landley.net>
parents: 454
diff changeset
27 genconfig()
f0247cfc37f2 Don't mix the the probed symbols with the command symbols.
Rob Landley <rob@landley.net>
parents: 454
diff changeset
28 {
653
2986aa63a021 Move commands into "posix", "lsb", and "other" menus/directories.
Rob Landley <rob@landley.net>
parents: 552
diff changeset
29 # I could query the directory here, but I want to control the order
2986aa63a021 Move commands into "posix", "lsb", and "other" menus/directories.
Rob Landley <rob@landley.net>
parents: 552
diff changeset
30 # and capitalization in the menu
2986aa63a021 Move commands into "posix", "lsb", and "other" menus/directories.
Rob Landley <rob@landley.net>
parents: 552
diff changeset
31 for j in Posix LSB Other
233
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
32 do
653
2986aa63a021 Move commands into "posix", "lsb", and "other" menus/directories.
Rob Landley <rob@landley.net>
parents: 552
diff changeset
33 echo "menu \"$j commands\""
233
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
34 echo
653
2986aa63a021 Move commands into "posix", "lsb", and "other" menus/directories.
Rob Landley <rob@landley.net>
parents: 552
diff changeset
35
2986aa63a021 Move commands into "posix", "lsb", and "other" menus/directories.
Rob Landley <rob@landley.net>
parents: 552
diff changeset
36 DIR=$(echo $j | tr A-Z a-z)
2986aa63a021 Move commands into "posix", "lsb", and "other" menus/directories.
Rob Landley <rob@landley.net>
parents: 552
diff changeset
37
2986aa63a021 Move commands into "posix", "lsb", and "other" menus/directories.
Rob Landley <rob@landley.net>
parents: 552
diff changeset
38 # extract config stanzas from each source file, in alphabetical order
2986aa63a021 Move commands into "posix", "lsb", and "other" menus/directories.
Rob Landley <rob@landley.net>
parents: 552
diff changeset
39 for i in $(ls -1 toys/$DIR/*.c)
2986aa63a021 Move commands into "posix", "lsb", and "other" menus/directories.
Rob Landley <rob@landley.net>
parents: 552
diff changeset
40 do
2986aa63a021 Move commands into "posix", "lsb", and "other" menus/directories.
Rob Landley <rob@landley.net>
parents: 552
diff changeset
41 # Grab the config block for Config.in
2986aa63a021 Move commands into "posix", "lsb", and "other" menus/directories.
Rob Landley <rob@landley.net>
parents: 552
diff changeset
42 echo "# $i"
2986aa63a021 Move commands into "posix", "lsb", and "other" menus/directories.
Rob Landley <rob@landley.net>
parents: 552
diff changeset
43 sed -n '/^\*\//q;/^config [A-Z]/,$p' $i || return 1
2986aa63a021 Move commands into "posix", "lsb", and "other" menus/directories.
Rob Landley <rob@landley.net>
parents: 552
diff changeset
44 echo
2986aa63a021 Move commands into "posix", "lsb", and "other" menus/directories.
Rob Landley <rob@landley.net>
parents: 552
diff changeset
45 done
2986aa63a021 Move commands into "posix", "lsb", and "other" menus/directories.
Rob Landley <rob@landley.net>
parents: 552
diff changeset
46
2986aa63a021 Move commands into "posix", "lsb", and "other" menus/directories.
Rob Landley <rob@landley.net>
parents: 552
diff changeset
47 echo endmenu
233
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
48 done
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
49 }
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
50
496
f0247cfc37f2 Don't mix the the probed symbols with the command symbols.
Rob Landley <rob@landley.net>
parents: 454
diff changeset
51 probeconfig > generated/Config.probed || rm generated/Config.probed
f0247cfc37f2 Don't mix the the probed symbols with the command symbols.
Rob Landley <rob@landley.net>
parents: 454
diff changeset
52 genconfig > generated/Config.in || rm generated/Config.in