Some more generalcleanup and adding support for using a config file other than /etc...
authorChris Gianelloni <wolf31o2@gentoo.org>
Mon, 17 Sep 2007 22:20:23 +0000 (22:20 +0000)
committerChris Gianelloni <wolf31o2@gentoo.org>
Mon, 17 Sep 2007 22:20:23 +0000 (22:20 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@542 67a159dc-881f-0410-a524-ba9dfbe2cb84

ChangeLog
gen_cmdline.sh
gen_configkernel.sh
genkernel

index 668a940a1123f25e985ab980a697ab269e287e31..d85c4364597b7bb44d343eac6bab9709655717fd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,11 @@
 # Copyright 2006-2007 Gentoo Foundation; Distributed under the GPL v2
 # $Header: $
 
+  17 Sep 2007; Chris Gianelloni <wolf31o2@gentoo.org> gen_cmdline.sh,
+  gen_configkernel.sh, genkernel:
+  Some more generalcleanup and adding support for using a config file other
+  than /etc/genkernel.conf to add flexibility.
+
   17 Sep 2007; Chris Gianelloni <wolf31o2@gentoo.org>
   -pkg/module-init-tools-0.9.15-pre4.tar.bz2,
   -pkg/klibc-1.1.16-sparc2.patch, -pkg/klibc-1.2.1-nostdinc-flags.patch,
index f7c8adbb23c1897ed37960fe5de910e64cb5798a..53ac1a91a5b293ba09477cc51c9fc184893cf84a 100755 (executable)
@@ -12,6 +12,8 @@ longusage() {
   echo "  initrd                       Build only the initrd"
   echo
   echo "Available Options: "
+  echo "  Configuration settings"
+  echo "       --config=<file> genkernel configuration file to use"
   echo "  Debug settings"
   echo "       --debuglevel=<0-5>      Debug Verbosity Level"
   echo "       --debugfile=<outfile>   Output file for debug info"
@@ -128,386 +130,377 @@ usage() {
   echo '       genkernel --help'
 }
 
-parse_opt() {
-       case "$1" in
-               *\=*)
-                       echo "$1" | cut -f2- -d=
-               ;;
-       esac
-}
-
 parse_cmdline() {
        case "$*" in
-             --kernel-cc=*)
-                     CMD_KERNEL_CC=`parse_opt "$*"`
-                     print_info 2 "CMD_KERNEL_CC: ${CMD_KERNEL_CC}"
-             ;;
-             --kernel-ld=*)
-                     CMD_KERNEL_LD=`parse_opt "$*"`
-                     print_info 2 "CMD_KERNEL_LD: ${CMD_KERNEL_LD}"
-             ;;
-             --kernel-as=*)
-                     CMD_KERNEL_AS=`parse_opt "$*"`
-                     print_info 2 "CMD_KERNEL_AS: ${CMD_KERNEL_AS}"
-             ;;
-             --kernel-make=*)
-                     CMD_KERNEL_MAKE=`parse_opt "$*"`
-                     print_info 2 "CMD_KERNEL_MAKE: ${CMD_KERNEL_MAKE}"
-             ;;
-             --kernel-cross-compile=*)
-                     CMD_KERNEL_CROSS_COMPILE=`parse_opt "$*"`
-                     CMD_KERNEL_CROSS_COMPILE=$(echo ${CMD_KERNEL_CROSS_COMPILE}|sed -e 's/.*[^-]$/&-/g')
-                     print_info 2 "CMD_KERNEL_CROSS_COMPILE: ${CMD_KERNEL_CROSS_COMPILE}"
-             ;;
-             --utils-cc=*)
-                     CMD_UTILS_CC=`parse_opt "$*"`
-                     print_info 2 "CMD_UTILS_CC: ${CMD_UTILS_CC}"
-             ;;
-             --utils-ld=*)
-                     CMD_UTILS_LD=`parse_opt "$*"`
-                     print_info 2 "CMD_UTILS_LD: ${CMD_UTILS_LD}"
-             ;;
-             --utils-as=*)
-                     CMD_UTILS_AS=`parse_opt "$*"`
-                     print_info 2 "CMD_UTILS_AS: ${CMD_UTILS_AS}"
-             ;;
-             --utils-make=*)
-                     CMD_UTILS_MAKE=`parse_opt "$*"`
-                     print_info 2 "CMD_UTILS_MAKE: ${CMD_UTILS_MAKE}"
-             ;;
-             --utils-cross-compile=*)
-                     CMD_UTILS_CROSS_COMPILE=`parse_opt "$*"`
-                     CMD_UTILS_CROSS_COMPILE=$(echo ${CMD_UTILS_CROSS_COMPILE}|sed -e 's/.*[^-]$/&-/g')
-                     print_info 2 "CMD_UTILS_CROSS_COMPILE: ${CMD_UTILS_CROSS_COMPILE}"
-             ;;
-             --utils-arch=*)
-                     CMD_UTILS_ARCH=`parse_opt "$*"`
-                     print_info 2 "CMD_UTILS_ARCH: ${CMD_ARCHOVERRIDE}"
-             ;;
-             --makeopts=*)
-                     CMD_MAKEOPTS=`parse_opt "$*"`
-                     print_info 2 "CMD_MAKEOPTS: ${CMD_MAKEOPTS}"
-             ;;
-             --mountboot)
-                     CMD_MOUNTBOOT=1
-                     print_info 2 "CMD_MOUNTBOOT: ${CMD_MOUNTBOOT}"
-             ;;
-             --no-mountboot)
-                     CMD_MOUNTBOOT=0
-                     print_info 2 "CMD_MOUNTBOOT: ${CMD_MOUNTBOOT}"
-             ;;
-             --bootdir=*)
-                     BOOTDIR=`parse_opt "$*"`
-                     print_info 2 "BOOTDIR: ${BOOTDIR}"
-             ;;
-             --do-keymap-auto)
-                     CMD_DOKEYMAPAUTO=1
-                     print_info 2 "CMD_DOKEYMAPAUTO: ${CMD_DOKEYMAPAUTO}"
-             ;;
-             --evms)
-                     CMD_EVMS=1
-                     print_info 2 "CMD_EVMS: ${CMD_EVMS}"
-             ;;
-             --evms2)
-                     CMD_EVMS=1
-                     print_info 2 "CMD_EVMS: ${CMD_EVMS}"
-                         echo
-                         print_warning 1 "Please use --evms, as --evms2 is deprecated."
-             ;;
-             --unionfs)
-                     CMD_UNIONFS=1
-                     print_info 2 "CMD_UNIONFS: ${CMD_UNIONFS}"
-                     echo
-                     print_warning 1 "WARNING: unionfs support is in active development and is not meant for general"
-                         print_warning 1 "use."
-                     print_warning 1 "Bug Reports without patches/fixes will be ignored."
-                     print_warning 1 "Use at your own risk as this could blow up your system."
-                     print_warning 1 "This code is subject to change at any time."
-                     echo
-             ;;
-             --lvm)
-                     CMD_LVM=1
-                     print_info 2 "CMD_LVM: ${CMD_LVM}"
-             ;;
-             --lvm2)
-                     CMD_LVM=1
-                     print_info 2 "CMD_LVM: ${CMD_LVM}"
-                         echo
-                         print_warning 1 "Please use --lvm, as --lvm2 is deprecated."
-             ;;
-             --no-busybox)
-                     CMD_NO_BUSYBOX=1
-                     print_info 2 "CMD_NO_BUSYBOX: ${CMD_NO_BUSYBOX}"
-             ;;
-             --slowusb)
-                     CMD_SLOWUSB=1
-                     print_info 2 "CMD_SLOWUSB: ${CMD_SLOWUSB}"
-             ;;
-             --dmraid)
-                     if [ ! -e /usr/include/libdevmapper.h ]
-                     then
-                       echo 'Error: --dmraid requires device-mapper to be installed'
-                       echo '       on the host system; try "emerge device-mapper".'
-                       exit 1
-                     fi
-                     CMD_DMRAID=1
-                     print_info 2 "CMD_DMRAID: ${CMD_DMRAID}"
-             ;;
-             --bootloader=*)
-                     CMD_BOOTLOADER=`parse_opt "$*"`
-                     print_info 2 "CMD_BOOTLOADER: ${CMD_BOOTLOADER}"
-             ;;
-             --debuglevel=*)
-                     CMD_DEBUGLEVEL=`parse_opt "$*"`
-                     DEBUGLEVEL="${CMD_DEBUGLEVEL}"
-                     print_info 2 "CMD_DEBUGLEVEL: ${CMD_DEBUGLEVEL}"
-             ;;
-             --menuconfig)
-                     TERM_LINES=`stty -a | head -n 1 | cut -d\  -f5 | cut -d\; -f1`
-                     TERM_COLUMNS=`stty -a | head -n 1 | cut -d\  -f7 | cut -d\; -f1`
-
-                     if [[ TERM_LINES -lt 19 || TERM_COLUMNS -lt 80 ]]
-                     then
-                       echo "Error: You need a terminal with at least 80 columns"
-                       echo "       and 19 lines for --menuconfig; try --nomenuconfig..."
-                       exit 1
-                     fi
-                     CMD_MENUCONFIG=1
-                     print_info 2 "CMD_MENUCONFIG: ${CMD_MENUCONFIG}"
-             ;;
-             --no-menuconfig)
-                     CMD_MENUCONFIG=0
-                     print_info 2 "CMD_MENUCONFIG: ${CMD_MENUCONFIG}"
-             ;;
-             --gconfig)
-                     CMD_GCONFIG=1
-                     print_info 2 "CMD_GCONFIG: ${CMD_GCONFIG}"
-             ;;
-             --xconfig)
-                     CMD_XCONFIG=1
-                     print_info 2 "CMD_XCONFIG: ${CMD_XCONFIG}"
-             ;;
-             --save-config)
-                     CMD_SAVE_CONFIG=1
-                     print_info 2 "CMD_SAVE_CONFIG: ${CMD_SAVE_CONFIG}"
-             ;;
-             --no-save-config)
-                     CMD_SAVE_CONFIG=0
-                     print_info 2 "CMD_SAVE_CONFIG: ${CMD_SAVE_CONFIG}"
-             ;;
-             --mrproper)
-                     CMD_MRPROPER=1
-                     print_info 2 "CMD_MRPROPER: ${CMD_MRPROPER}"
-             ;;
-             --no-mrproper)
-                     CMD_MRPROPER=0
-                     print_info 2 "CMD_MRPROPER: ${CMD_MRPROPER}"
-             ;;
-             --clean)
-                     CMD_CLEAN=1
-                     print_info 2 "CMD_CLEAN: ${CMD_CLEAN}"
-             ;;
-             --no-clean)
-                     CMD_CLEAN=0
-                     print_info 2 "CMD_CLEAN: ${CMD_CLEAN}"
-             ;;
-             --oldconfig)
-                     CMD_CLEAN=0
-                     CMD_OLDCONFIG=1
-                     print_info 2 "CMD_CLEAN: ${CMD_CLEAN}"
-                     print_info 2 "CMD_OLDCONFIG: ${CMD_OLDCONFIG}"
-             ;;
-             --gensplash=*)
-                     CMD_SPLASH=1
-                     SPLASH_THEME=`parse_opt "$*"`
-                     print_info 2 "CMD_SPLASH: ${CMD_SPLASH}"
-                     print_info 2 "SPLASH_THEME: ${SPLASH_THEME}"
-                         echo
-                         print_warning 1 "Please use --splash, as --gensplash is deprecated."
-             ;;
-             --gensplash)
-                     CMD_SPLASH=1
-                     SPLASH_THEME='default'
-                     print_info 2 "CMD_SPLASH: ${CMD_SPLASH}"
-                         echo
-                         print_warning 1 "Please use --splash, as --gensplash is deprecated."
-             ;;
-             --splash=*)
-                     CMD_SPLASH=1
-                     SPLASH_THEME=`parse_opt "$*"`
-                     print_info 2 "CMD_SPLASH: ${CMD_SPLASH}"
-                     print_info 2 "SPLASH_THEME: ${SPLASH_THEME}"
-             ;;
-             --splash)
-                     CMD_SPLASH=1
-                     SPLASH_THEME='default'
-                     print_info 2 "CMD_SPLASH: ${CMD_SPLASH}"
-             ;;
-             --no-splash)
-                     CMD_SPLASH=0
-                     print_info 2 "CMD_SPLASH: ${CMD_SPLASH}"
-             ;;
-             --gensplash-res=*)
-                     SPLASH_RES=`parse_opt "$*"`
-                     print_info 2 "SPLASH_RES: ${SPLASH_RES}"
-                         echo
-                         print_warning 1 "Please use --splash-res, as --gensplash-res is deprecated."
-             ;;
-             --splash-res=*)
-                     SPLASH_RES=`parse_opt "$*"`
-                     print_info 2 "SPLASH_RES: ${SPLASH_RES}"
-             ;;
-             --install)
-                     CMD_NOINSTALL=0
-                     print_info 2 "CMD_NOINSTALL: ${CMD_NOINSTALL}"
-             ;;
-             --no-install)
-                     CMD_NOINSTALL=1
-                     print_info 2 "CMD_NOINSTALL: ${CMD_NOINSTALL}"
-             ;;
-             --no-initrdmodules)
-                     CMD_NOINITRDMODULES=1
-                     print_info 2 "CMD_NOINITRDMODULES: ${CMD_NOINITRDMODULES}"
-             ;;
-             --callback=*)
-                     CMD_CALLBACK=`parse_opt "$*"`
-                     print_info 2 "CMD_CALLBACK: ${CMD_CALLBACK}/$*"
-             ;;
-             --static)
-                     CMD_STATIC=1
-                     print_info 2 "CMD_STATIC: ${CMD_STATIC}"
-             ;;
-             --initramfs)
-                     CMD_INITRAMFS=1
-                     print_info 2 "CMD_INITRAMFS: ${CMD_INITRAMFS}"
-             ;;
-             --tempdir=*)
-                     TMPDIR=`parse_opt "$*"`
-                     TEMP=${TMPDIR}/$RANDOM.$RANDOM.$RANDOM.$$
-                     print_info 2 "TMPDIR: ${TMPDIR}"
-                     print_info 2 "TEMP: ${TEMP}"
-             ;; 
-             --postclear)
-                     CMD_POSTCLEAR=1
-                     print_info 2 "CMD_POSTCLEAR: ${CMD_POSTCLEAR}"
-             ;; 
-             --arch-override=*)
-                     CMD_ARCHOVERRIDE=`parse_opt "$*"`
-                     print_info 2 "CMD_ARCHOVERRIDE: ${CMD_ARCHOVERRIDE}"
-             ;;
-             --color)
-                     USECOLOR=1
-                     print_info 2 "USECOLOR: ${USECOLOR}"
-                     setColorVars
-             ;;
-             --no-color)
-                     USECOLOR=0
-                     print_info 2 "USECOLOR: ${USECOLOR}"
-                     setColorVars
-             ;;
-             --debugfile=*)
-                     CMD_DEBUGFILE=`parse_opt "$*"`
-                     DEBUGFILE=`parse_opt "$*"`
-                     print_info 2 "CMD_DEBUGFILE: ${CMD_DEBUGFILE}"
-                     print_info 2 "DEBUGFILE: ${CMD_DEBUGFILE}"
-             ;;
-             --kerneldir=*)
-                     CMD_KERNELDIR=`parse_opt "$*"`
-                     print_info 2 "CMD_KERNELDIR: ${CMD_KERNELDIR}"
-             ;;
-             --kernel-config=*)
-                     CMD_KERNEL_CONFIG=`parse_opt "$*"`
-                     print_info 2 "CMD_KERNEL_CONFIG: ${CMD_KERNEL_CONFIG}"
-             ;;
-             --module-prefix=*)
-                     CMD_INSTALL_MOD_PATH=`parse_opt "$*"`
-                     print_info 2 "CMD_INSTALL_MOD_PATH: ${CMD_INSTALL_MOD_PATH}"
-             ;;
-             --cachedir=*)
-                     CACHE_DIR=`parse_opt "$*"`
-                     print_info 2 "CACHE_DIR: ${CACHE_DIR}"
-             ;;
-             --minkernpackage=*)
-                     CMD_MINKERNPACKAGE=`parse_opt "$*"`
-                     print_info 2 "MINKERNPACKAGE: ${CMD_MINKERNPACKAGE}"
-             ;;
-             --modulespackage=*)
-                     CMD_MODULESPACKAGE=`parse_opt "$*"`
-                     print_info 2 "MODULESPACKAGE: ${CMD_MODULESPACKAGE}"
-             ;;
-             --kerncache=*)
-                     CMD_KERNCACHE=`parse_opt "$*"`
-                     print_info 2 "KERNCACHE: ${CMD_KERNCACHE}"
-             ;;
-             --kernname=*)
-                     CMD_KERNNAME=`parse_opt "$*"`
-                     print_info 2 "KERNNAME: ${CMD_KERNNAME}"
-             ;;
-             --symlink)
-                     CMD_SYMLINK=1
-                     print_info 2 "CMD_SYMLINK: ${CMD_SYMLINK}"
-             ;;
-             --no-symlink)
-                     CMD_SYMLINK=0
-                     print_info 2 "CMD_SYMLINK: ${CMD_SYMLINK}"
-             ;;
-             --no-kernel-sources)
-                     CMD_NO_KERNEL_SOURCES=1
-                     print_info 2 "CMD_NO_KERNEL_SOURCES: ${CMD_NO_KERNEL_SOURCES}"
-             ;;
-             --initramfs-overlay=*)
-                     CMD_INITRAMFS_OVERLAY=`parse_opt "$*"`
-                     print_info 2 "CMD_INITRAMFS_OVERLAY: ${CMD_INITRAMFS_OVERLAY}"
-             ;;
-             --linuxrc=*)
-                       CMD_LINUXRC=`parse_opt "$*"`
+               --kernel-cc=*)
+                       CMD_KERNEL_CC=`parse_opt "$*"`
+                       print_info 2 "CMD_KERNEL_CC: ${CMD_KERNEL_CC}"
+                       ;;
+               --kernel-ld=*)
+                       CMD_KERNEL_LD=`parse_opt "$*"`
+                       print_info 2 "CMD_KERNEL_LD: ${CMD_KERNEL_LD}"
+                       ;;
+               --kernel-as=*)
+                       CMD_KERNEL_AS=`parse_opt "$*"`
+                       print_info 2 "CMD_KERNEL_AS: ${CMD_KERNEL_AS}"
+                       ;;
+               --kernel-make=*)
+                       CMD_KERNEL_MAKE=`parse_opt "$*"`
+                       print_info 2 "CMD_KERNEL_MAKE: ${CMD_KERNEL_MAKE}"
+                       ;;
+               --kernel-cross-compile=*)
+                       CMD_KERNEL_CROSS_COMPILE=`parse_opt "$*"`
+                       CMD_KERNEL_CROSS_COMPILE=$(echo ${CMD_KERNEL_CROSS_COMPILE}|sed -e 's/.*[^-]$/&-/g')
+                       print_info 2 "CMD_KERNEL_CROSS_COMPILE: ${CMD_KERNEL_CROSS_COMPILE}"
+                       ;;
+               --utils-cc=*)
+                       CMD_UTILS_CC=`parse_opt "$*"`
+                       print_info 2 "CMD_UTILS_CC: ${CMD_UTILS_CC}"
+                       ;;
+               --utils-ld=*)
+                       CMD_UTILS_LD=`parse_opt "$*"`
+                       print_info 2 "CMD_UTILS_LD: ${CMD_UTILS_LD}"
+                       ;;
+               --utils-as=*)
+                       CMD_UTILS_AS=`parse_opt "$*"`
+                       print_info 2 "CMD_UTILS_AS: ${CMD_UTILS_AS}"
+                       ;;
+               --utils-make=*)
+                       CMD_UTILS_MAKE=`parse_opt "$*"`
+                       print_info 2 "CMD_UTILS_MAKE: ${CMD_UTILS_MAKE}"
+                       ;;
+               --utils-cross-compile=*)
+                       CMD_UTILS_CROSS_COMPILE=`parse_opt "$*"`
+                       CMD_UTILS_CROSS_COMPILE=$(echo ${CMD_UTILS_CROSS_COMPILE}|sed -e 's/.*[^-]$/&-/g')
+                       print_info 2 "CMD_UTILS_CROSS_COMPILE: ${CMD_UTILS_CROSS_COMPILE}"
+                       ;;
+               --utils-arch=*)
+                       CMD_UTILS_ARCH=`parse_opt "$*"`
+                       print_info 2 "CMD_UTILS_ARCH: ${CMD_ARCHOVERRIDE}"
+                       ;;
+               --makeopts=*)
+                       CMD_MAKEOPTS=`parse_opt "$*"`
+                       print_info 2 "CMD_MAKEOPTS: ${CMD_MAKEOPTS}"
+                       ;;
+               --mountboot)
+                       CMD_MOUNTBOOT=1
+                       print_info 2 "CMD_MOUNTBOOT: ${CMD_MOUNTBOOT}"
+                       ;;
+               --no-mountboot)
+                       CMD_MOUNTBOOT=0
+                       print_info 2 "CMD_MOUNTBOOT: ${CMD_MOUNTBOOT}"
+                       ;;
+               --bootdir=*)
+                       BOOTDIR=`parse_opt "$*"`
+                       print_info 2 "BOOTDIR: ${BOOTDIR}"
+                       ;;
+               --do-keymap-auto)
+                       CMD_DOKEYMAPAUTO=1
+                       print_info 2 "CMD_DOKEYMAPAUTO: ${CMD_DOKEYMAPAUTO}"
+                       ;;
+               --evms)
+                       CMD_EVMS=1
+                       print_info 2 "CMD_EVMS: ${CMD_EVMS}"
+                       ;;
+               --evms2)
+                       CMD_EVMS=1
+                       print_info 2 "CMD_EVMS: ${CMD_EVMS}"
+                       echo
+                       print_warning 1 "Please use --evms, as --evms2 is deprecated."
+                       ;;
+               --unionfs)
+                       CMD_UNIONFS=1
+                       print_info 2 "CMD_UNIONFS: ${CMD_UNIONFS}"
+                       echo
+                       print_warning 1 "WARNING: unionfs support is in active development and is not meant for general"
+                       print_warning 1 "use."
+                       print_warning 1 "Bug Reports without patches/fixes will be ignored."
+                       print_warning 1 "Use at your own risk as this could blow up your system."
+                       print_warning 1 "This code is subject to change at any time."
+                       echo
+                       ;;
+               --lvm)
+                       CMD_LVM=1
+                       print_info 2 "CMD_LVM: ${CMD_LVM}"
+                       ;;
+               --lvm2)
+                       CMD_LVM=1
+                       print_info 2 "CMD_LVM: ${CMD_LVM}"
+                       echo
+                       print_warning 1 "Please use --lvm, as --lvm2 is deprecated."
+                       ;;
+               --no-busybox)
+                       CMD_NO_BUSYBOX=1
+                       print_info 2 "CMD_NO_BUSYBOX: ${CMD_NO_BUSYBOX}"
+                       ;;
+               --slowusb)
+                       CMD_SLOWUSB=1
+                       print_info 2 "CMD_SLOWUSB: ${CMD_SLOWUSB}"
+                       ;;
+               --dmraid)
+                       if [ ! -e /usr/include/libdevmapper.h ]
+                       then
+                               echo 'Error: --dmraid requires device-mapper to be installed'
+                               echo '           on the host system; try "emerge device-mapper".'
+                               exit 1
+                       fi
+                       CMD_DMRAID=1
+                       print_info 2 "CMD_DMRAID: ${CMD_DMRAID}"
+                       ;;
+               --bootloader=*)
+                       CMD_BOOTLOADER=`parse_opt "$*"`
+                       print_info 2 "CMD_BOOTLOADER: ${CMD_BOOTLOADER}"
+                       ;;
+               --debuglevel=*)
+                       CMD_DEBUGLEVEL=`parse_opt "$*"`
+                       DEBUGLEVEL="${CMD_DEBUGLEVEL}"
+                       print_info 2 "CMD_DEBUGLEVEL: ${CMD_DEBUGLEVEL}"
+                       ;;
+               --menuconfig)
+                       TERM_LINES=`stty -a | head -n 1 | cut -d\  -f5 | cut -d\; -f1`
+                       TERM_COLUMNS=`stty -a | head -n 1 | cut -d\  -f7 | cut -d\; -f1`
+                       if [[ TERM_LINES -lt 19 || TERM_COLUMNS -lt 80 ]]
+                       then
+                               echo "Error: You need a terminal with at least 80 columns"
+                               echo "           and 19 lines for --menuconfig; try --nomenuconfig..."
+                               exit 1
+                       fi
+                       CMD_MENUCONFIG=1
+                       print_info 2 "CMD_MENUCONFIG: ${CMD_MENUCONFIG}"
+                       ;;
+               --no-menuconfig)
+                       CMD_MENUCONFIG=0
+                       print_info 2 "CMD_MENUCONFIG: ${CMD_MENUCONFIG}"
+                       ;;
+               --gconfig)
+                       CMD_GCONFIG=1
+                       print_info 2 "CMD_GCONFIG: ${CMD_GCONFIG}"
+                       ;;
+               --xconfig)
+                       CMD_XCONFIG=1
+                       print_info 2 "CMD_XCONFIG: ${CMD_XCONFIG}"
+                       ;;
+               --save-config)
+                       CMD_SAVE_CONFIG=1
+                       print_info 2 "CMD_SAVE_CONFIG: ${CMD_SAVE_CONFIG}"
+                       ;;
+               --no-save-config)
+                       CMD_SAVE_CONFIG=0
+                       print_info 2 "CMD_SAVE_CONFIG: ${CMD_SAVE_CONFIG}"
+                       ;;
+               --mrproper)
+                       CMD_MRPROPER=1
+                       print_info 2 "CMD_MRPROPER: ${CMD_MRPROPER}"
+                       ;;
+               --no-mrproper)
+                       CMD_MRPROPER=0
+                       print_info 2 "CMD_MRPROPER: ${CMD_MRPROPER}"
+                       ;;
+               --clean)
+                       CMD_CLEAN=1
+                       print_info 2 "CMD_CLEAN: ${CMD_CLEAN}"
+                       ;;
+               --no-clean)
+                       CMD_CLEAN=0
+                       print_info 2 "CMD_CLEAN: ${CMD_CLEAN}"
+                       ;;
+               --oldconfig)
+                       CMD_CLEAN=0
+                       CMD_OLDCONFIG=1
+                       print_info 2 "CMD_CLEAN: ${CMD_CLEAN}"
+                       print_info 2 "CMD_OLDCONFIG: ${CMD_OLDCONFIG}"
+                       ;;
+               --gensplash=*)
+                       CMD_SPLASH=1
+                       SPLASH_THEME=`parse_opt "$*"`
+                       print_info 2 "CMD_SPLASH: ${CMD_SPLASH}"
+                       print_info 2 "SPLASH_THEME: ${SPLASH_THEME}"
+                       echo
+                       print_warning 1 "Please use --splash, as --gensplash is deprecated."
+                       ;;
+               --gensplash)
+                       CMD_SPLASH=1
+                       SPLASH_THEME='default'
+                       print_info 2 "CMD_SPLASH: ${CMD_SPLASH}"
+                       echo
+                       print_warning 1 "Please use --splash, as --gensplash is deprecated."
+                       ;;
+               --splash=*)
+                       CMD_SPLASH=1
+                       SPLASH_THEME=`parse_opt "$*"`
+                       print_info 2 "CMD_SPLASH: ${CMD_SPLASH}"
+                       print_info 2 "SPLASH_THEME: ${SPLASH_THEME}"
+                       ;;
+               --splash)
+                       CMD_SPLASH=1
+                       SPLASH_THEME='default'
+                       print_info 2 "CMD_SPLASH: ${CMD_SPLASH}"
+                       ;;
+               --no-splash)
+                       CMD_SPLASH=0
+                       print_info 2 "CMD_SPLASH: ${CMD_SPLASH}"
+                       ;;
+               --gensplash-res=*)
+                       SPLASH_RES=`parse_opt "$*"`
+                       print_info 2 "SPLASH_RES: ${SPLASH_RES}"
+                       echo
+                       print_warning 1 "Please use --splash-res, as --gensplash-res is deprecated."
+                       ;;
+               --splash-res=*)
+                       SPLASH_RES=`parse_opt "$*"`
+                       print_info 2 "SPLASH_RES: ${SPLASH_RES}"
+                       ;;
+               --install)
+                       CMD_NOINSTALL=0
+                       print_info 2 "CMD_NOINSTALL: ${CMD_NOINSTALL}"
+                       ;;
+               --no-install)
+                       CMD_NOINSTALL=1
+                       print_info 2 "CMD_NOINSTALL: ${CMD_NOINSTALL}"
+                       ;;
+               --no-initrdmodules)
+                       CMD_NOINITRDMODULES=1
+                       print_info 2 "CMD_NOINITRDMODULES: ${CMD_NOINITRDMODULES}"
+                       ;;
+               --callback=*)
+                       CMD_CALLBACK=`parse_opt "$*"`
+                       print_info 2 "CMD_CALLBACK: ${CMD_CALLBACK}/$*"
+                       ;;
+               --static)
+                       CMD_STATIC=1
+                       print_info 2 "CMD_STATIC: ${CMD_STATIC}"
+                       ;;
+               --initramfs)
+                       CMD_INITRAMFS=1
+                       print_info 2 "CMD_INITRAMFS: ${CMD_INITRAMFS}"
+                       ;;
+               --tempdir=*)
+                       TMPDIR=`parse_opt "$*"`
+                       TEMP=${TMPDIR}/$RANDOM.$RANDOM.$RANDOM.$$
+                       print_info 2 "TMPDIR: ${TMPDIR}"
+                       print_info 2 "TEMP: ${TEMP}"
+                       ;; 
+               --postclear)
+                       CMD_POSTCLEAR=1
+                       print_info 2 "CMD_POSTCLEAR: ${CMD_POSTCLEAR}"
+                       ;; 
+               --arch-override=*)
+                       CMD_ARCHOVERRIDE=`parse_opt "$*"`
+                       print_info 2 "CMD_ARCHOVERRIDE: ${CMD_ARCHOVERRIDE}"
+                       ;;
+               --color)
+                       USECOLOR=1
+                       print_info 2 "USECOLOR: ${USECOLOR}"
+                       setColorVars
+                       ;;
+               --no-color)
+                       USECOLOR=0
+                       print_info 2 "USECOLOR: ${USECOLOR}"
+                       setColorVars
+                       ;;
+               --debugfile=*)
+                       CMD_DEBUGFILE=`parse_opt "$*"`
+                       DEBUGFILE=`parse_opt "$*"`
+                       print_info 2 "CMD_DEBUGFILE: ${CMD_DEBUGFILE}"
+                       print_info 2 "DEBUGFILE: ${CMD_DEBUGFILE}"
+                       ;;
+               --kerneldir=*)
+                       CMD_KERNELDIR=`parse_opt "$*"`
+                       print_info 2 "CMD_KERNELDIR: ${CMD_KERNELDIR}"
+                       ;;
+               --kernel-config=*)
+                       CMD_KERNEL_CONFIG=`parse_opt "$*"`
+                       print_info 2 "CMD_KERNEL_CONFIG: ${CMD_KERNEL_CONFIG}"
+                       ;;
+               --module-prefix=*)
+                       CMD_INSTALL_MOD_PATH=`parse_opt "$*"`
+                       print_info 2 "CMD_INSTALL_MOD_PATH: ${CMD_INSTALL_MOD_PATH}"
+                       ;;
+               --cachedir=*)
+                       CACHE_DIR=`parse_opt "$*"`
+                       print_info 2 "CACHE_DIR: ${CACHE_DIR}"
+                       ;;
+               --minkernpackage=*)
+                       CMD_MINKERNPACKAGE=`parse_opt "$*"`
+                       print_info 2 "MINKERNPACKAGE: ${CMD_MINKERNPACKAGE}"
+                       ;;
+               --modulespackage=*)
+                       CMD_MODULESPACKAGE=`parse_opt "$*"`
+                       print_info 2 "MODULESPACKAGE: ${CMD_MODULESPACKAGE}"
+                       ;;
+               --kerncache=*)
+                       CMD_KERNCACHE=`parse_opt "$*"`
+                       print_info 2 "KERNCACHE: ${CMD_KERNCACHE}"
+                       ;;
+               --kernname=*)
+                       CMD_KERNNAME=`parse_opt "$*"`
+                       print_info 2 "KERNNAME: ${CMD_KERNNAME}"
+                       ;;
+               --symlink)
+                       CMD_SYMLINK=1
+                       print_info 2 "CMD_SYMLINK: ${CMD_SYMLINK}"
+                       ;;
+               --no-symlink)
+                       CMD_SYMLINK=0
+                       print_info 2 "CMD_SYMLINK: ${CMD_SYMLINK}"
+                       ;;
+               --no-kernel-sources)
+                       CMD_NO_KERNEL_SOURCES=1
+                       print_info 2 "CMD_NO_KERNEL_SOURCES: ${CMD_NO_KERNEL_SOURCES}"
+                       ;;
+               --initramfs-overlay=*)
+                       CMD_INITRAMFS_OVERLAY=`parse_opt "$*"`
+                       print_info 2 "CMD_INITRAMFS_OVERLAY: ${CMD_INITRAMFS_OVERLAY}"
+                       ;;
+               --linuxrc=*)
+                       CMD_LINUXRC=`parse_opt "$*"`
                        print_info 2 "CMD_LINUXRC: ${CMD_LINUXRC}"
-             ;;
-             --genzimage)
+                       ;;
+               --genzimage)
                        KERNEL_MAKE_DIRECTIVE_2='zImage.initrd'
                        KERNEL_BINARY_2='arch/powerpc/boot/zImage.initrd'
                        GENERATE_Z_IMAGE=1
                        print_info 2 "GENERATE_Z_IMAGE: ${GENERATE_Z_IMAGE}"
-             ;;
-             --disklabel)
-                     CMD_DISKLABEL=1
-                     print_info 2 "CMD_DISKLABEL: ${CMD_DISKLABEL}"
-             ;;
-             --luks)
-                     CMD_LUKS=1
-                     print_info 2 "CMD_LUKS: ${CMD_LUKS}"
-             ;;
-             all)
-                     BUILD_KERNEL=1
-                     BUILD_MODULES=1
-                     BUILD_INITRD=1
-             ;;
-             initrd)
-                     BUILD_INITRD=1
-             ;;
-             kernel)
-                     BUILD_KERNEL=1
-                     BUILD_MODULES=1
-                     BUILD_INITRD=0
-             ;;
-             bzImage)
-                     BUILD_KERNEL=1
-                     BUILD_MODULES=0
-                     BUILD_INITRD=1
-                     CMD_NOINITRDMODULES=1
-                     print_info 2 "CMD_NOINITRDMODULES: ${CMD_NOINITRDMODULES}"
-             ;;
-             --help)
-                     longusage
-                     exit 1
-             ;;
-             --version)
-                     echo "${GK_V}"
-                     exit 0
-             ;;
-             *)
-                     echo "Error: Unknown option '$*'!"
-                     exit 1
-             ;;
+                       ;;
+               --disklabel)
+                       CMD_DISKLABEL=1
+                       print_info 2 "CMD_DISKLABEL: ${CMD_DISKLABEL}"
+                       ;;
+               --luks)
+                       CMD_LUKS=1
+                       print_info 2 "CMD_LUKS: ${CMD_LUKS}"
+                       ;;
+               all)
+                       BUILD_KERNEL=1
+                       BUILD_MODULES=1
+                       BUILD_INITRD=1
+                       ;;
+               initrd)
+                       BUILD_INITRD=1
+                       ;;
+               kernel)
+                       BUILD_KERNEL=1
+                       BUILD_MODULES=1
+                       BUILD_INITRD=0
+                       ;;
+               bzImage)
+                       BUILD_KERNEL=1
+                       BUILD_MODULES=0
+                       BUILD_INITRD=1
+                       CMD_NOINITRDMODULES=1
+                       print_info 2 "CMD_NOINITRDMODULES: ${CMD_NOINITRDMODULES}"
+                       ;;
+               --help)
+                       longusage
+                       exit 1
+                       ;;
+               --version)
+                       echo "${GK_V}"
+                       exit 0
+                       ;;
+               *)
+                       echo "Error: Unknown option '$*'!"
+                       exit 1
+                       ;;
        esac
 }
index 7d71e70ca229f867d09db80a5f2c68c2d2e1a034..24dcd4a16246ff87fddb995322995efced463d29 100644 (file)
@@ -35,7 +35,7 @@ config_kernel() {
                compile_generic mrproper kernel
        fi
 
-       # If we're not cleaning, then we don't want to try to overwrite the configs there
+       # If we're not cleaning, then we don't want to try to overwrite the configs
        # or we might remove configurations someone is trying to test.
 
        if isTrue "${CLEAN}"
@@ -52,7 +52,7 @@ config_kernel() {
                else
                        print_info 1 '        >> Running oldconfig...'
                fi
-               yes '' 2>/dev/null | compile_generic oldconfig kernel 2>/dev/null # Nullify to stop broken pipe messages
+               yes '' 2>/dev/null | compile_generic oldconfig kernel 2>/dev/null
        fi
        if isTrue "${CLEAN}"
        then
@@ -98,8 +98,9 @@ config_kernel() {
        # TODO: force on with --genzimage
        if [ "${KERN_24}" -eq '1' ]
        then
-           # Make sure Ext2 support is on...
-           sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_EXT2_FS[ =].*/CONFIG_EXT2_FS=y/g'
+               # Make sure Ext2 support is on...
+               sed -e 's/#\? \?CONFIG_EXT2_FS[ =].*/CONFIG_EXT2_FS=y/g' \
+                       -i ${KERNEL_DIR}/.config 
        fi
 
        # Make sure lvm modules are on if --lvm/--lvm
@@ -120,11 +121,4 @@ config_kernel() {
        then
                sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_FB_SPLASH is.*/CONFIG_FB_SPLASH=y/g'
        fi
-
-       # This check isn't complete: SOFTWARE_SUSPEND has extra deps on some systems such as CPU hotplug
-#      if isTrue ${CMD_SUSPEND}
-#      then
-#              sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_SOFTWARE_SUSPEND is.*/CONFIG_SOFTWARE_SUSPEND=y/g'
-#      fi
-
 }
index 61496d003dade02d0e8d6cfab6fa6891f0f1c4ef..77337317998da2000f29c7503a2d492844962e4f 100755 (executable)
--- a/genkernel
+++ b/genkernel
@@ -1,5 +1,4 @@
 #!/bin/bash
-# Genkernel v3
 
 PATH="/bin:/usr/bin:/sbin:/usr/sbin"
 GK_V='3.4.9_pre3'
@@ -15,7 +14,25 @@ small_die() {
   exit 1
 }
 
-source /etc/genkernel.conf || small_die "Could not read /etc/genkernel.conf"
+parse_opt() {
+       case "$1" in
+               *\=*)
+                       echo "$1" | cut -f2- -d=
+               ;;
+       esac
+}
+
+# We don't know where our config is, so we check for it, and default to using
+# /etc/genkernel.conf if nobody has specified one.
+case "$*" in
+       --config=*)
+               CMD_GK_CONFIG=`parse_opt "$*"`
+               ;;
+       esac
+}
+
+source ${CMD_GK_CONFIG:-/etc/genkernel.conf} || small_die "Could not read /etc/genkernel.conf"
+
 source ${GK_SHARE}/gen_funcs.sh || small_die "Could not read ${GK_SHARE}/gen_funcs.sh"
 source ${GK_SHARE}/gen_cmdline.sh || gen_die "Could not read ${GK_SHARE}/gen_cmdline.sh"
 source ${GK_SHARE}/gen_arch.sh || gen_die "Could not read ${GK_SHARE}/gen_arch.sh"