## cLIeNUX kernel config entry point

## dependancies
## sh, awk, clear, ed, rm, ls, mv 


# function declaration


swap () { 		## Last field, CONFIG_*, to second, after #
awk -- '
      {
      ORS=""
      print "\n# "  $NF
      for ( i = 1 ; i < NF ; i++ )  print " "$i
      } ' $1
}


# declarations
ARCH=i386
MCA=ONLY
C_INCLUDE_PATH=$C_INCLUDE_PATH:/source/kernel/$1
DATE=`date`


clear
echo -e "\t\t\tcLIeNUX linux/config\n\n\n\n
\nmaking base config data\n\n"

#### if a Config.in file isn't in this list variable you won't see
###               the options that Config.in file contains.
##                Season to taste.
configlist="
arch/i386/config.in
fs/Config.in
drivers/char/Config.in
drivers/block/Config.in
drivers/scsi/Config.in
drivers/net/Config.in
fs/nls/Config.in
net/ipv4/Config.in
net/Config.in
net/sched/Config.in
net/irda/Config.in
net/irda/compressors/Config.in
drivers/net/hamradio/Config.in
drivers/net/irda/Config.in
drivers/block/paride/Config.in
drivers/char/ftape/Config.in
drivers/char/hfmodem/Config.in
drivers/char/joystick/Config.in
drivers/sound/lowlevel/Config.in
drivers/sound/Config.in
drivers/isdn/Config.in
drivers/video/Config.in
drivers/fc4/Config.in
fs/ncpfs/Config.in
net/ax25/Config.in
net/ipx/Config.in
"

##                      EXCLUDED from the above
## drivers/pnp/Config.in            ## put this back if not MCA
## drivers/cdrom/Config.in          ## put this back if not MCA
## drivers/usb/Config.in
## net/irda/irlpt/Config.in
## net/irda/ircomm/Config.in
## net/irda/irlan/Config.in
## net/irda/irlpt/Config.in
## drivers/acorn/net/Config.in		Acorn
## drivers/acorn/scsi/Config.in
## drivers/acorn/block/Config.in
## drivers/acorn/char/Config.in
## drivers/sgi/Config.in		SGI
## drivers/sbus/char/Config.in		Mac
## drivers/sbus/audio/Config.in
## net/ipv6/Config.in
## drivers/fc4/Config.in		Fiber channel

cd linux


###MMMMMMMMMMMAAAAAAAAAAAAAIIIIIIIIIIINNNNNNNNNNNNNNN

echo > /.tm/BASE

## generate bulk CONFIG_ list.
#
for CF in $configlist
do
      echo -en  "\n# CONFIG\n# CONFIG " $CF "# CONFIG\n"  >> /.tm/BASE
      cat $CF >> /.tm/BASE
done

## format, then prune. Prune out experimental up front.
#
swap /.tm/BASE |grep "^# CONFIG" | grep -v -i "XPERIMEN" \
      | cut -b 1-74 >  /.tm/BASE2

rm /.tm/BASE


echo -e "\n\n\npruning...\n\n\n"


## convert choice types to "=y" and "=ym", then prune
#
ed <<HEREDOC   /.tm/BASE2
,s/ tristate '/=ym      #/
,s/ bool '/=y     #/
,s/'$//
g/Sun /d
g/Atari/d
g/Mac /d
g/Sparc/d
g/Amiga/d
wq
HEREDOC


## pro-Microchannel extreme prejudice
#
if test "$MCA" = "ONLY"
then
      ed <<HEREDOC   /.tm/BASE2
      g/PCI/d
      g/IDE/d
      g/PNP/d
      g/ISA/d
      g/_APM_/d
      wq
HEREDOC

fi

## header and assemble CONFIG
#
echo "##  " `date` >   CONFIG
cat  <<HEREDOC >>  CONFIG
#
# This is the cLIeNUX Linux kernel configuration variables file. It's a
# shell script. It gets called by make config. The variables that are active
# in here are then asserted in a kernel C sourcecode header file, and the
# kernel is built accordingly. Variables can be =y or completely unset, and
# module options can also be =m. If an option in CONFIG is =y you just have
# to uncomment it. If it's =ym you have to decide if you want it as a module
# or in the base kernel and pick y or m. If you enable modules, and want that
# option. These options are additive. An x86 kernel will build, albeit
# uselessly, with just CONFIG_M386 and maybe a memsize option. There are
# some interdependancies though, and your only automated check on them
# with this config setup is compiling and running the result.
#
# The linux/config script that generates this file is flexible. You can
# tweak it to not show any options you're not interested in if you have a
# working knowledge of regular expression match patterns. see regex. All that
# really matters is that the end result be valid. You are actually modifying
# the kernel code when you edit this file, to stretch a point a bit. If you
# don't use modules all you have to know about shell scripting is that "#"
# starts a comment.
#
#                Break a leg   :o)
#                                         Rick
HEREDOC

cat /.tm/BASE3 > CONFIG

## call an editor, then do what "make config" does to assert the config
#

edit CONFIG


clear
echo "Clobbering .config.old..."
mv .config .config.old
cp  CONFIG .config

mv .tmpconfig.h include/linux/autoconf.h
