From d2b7425db7b5c573d0552d3ef5d4f1c72c616af5 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Thu, 20 Dec 2012 23:10:47 +0400 Subject: [PATCH] -c, --config option for kernel-rebuild.sh --- sbin/kernel-rebuild.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sbin/kernel-rebuild.sh b/sbin/kernel-rebuild.sh index d57494c..421fd4f 100755 --- a/sbin/kernel-rebuild.sh +++ b/sbin/kernel-rebuild.sh @@ -3,35 +3,35 @@ SILENT=false MRPROPER=false NICE_CMD="nice -n 19 ionice -c2" +CONFIG_FILE=/proc/config.gz [ -f /etc/gentoo-upgrade.conf ] && source /etc/gentoo-upgrade.conf # available parameters -eval set -- "`getopt -o hs --long help,silent,mrproper -- \"$@\"`" +eval set -- "`getopt -o hsc: --long help,silent,mrproper,config: -- \"$@\"`" while true ; do case "$1" in -h|--help) echo "Usage: kernel-rebuild.sh [keys]..." echo "Keys:" - echo -e "-h, --help\tShow this help and exit." - echo -e "-s, --silent \tMake with silentoldconfig." - echo -e "--mrproper\tClean kernel sources before rebuild." + echo -e "-h, --help\t\tShow this help and exit." + echo -e "-s, --silent\t\tMake with silentoldconfig." + echo -e "--mrproper\t\tClean kernel sources before rebuild." + echo -e "-c, --config [CONFIG]\tPath to custom kernel config." echo echo -e "This program works on any GNU/Linux with GNU Baurne's shell" echo -e "Report bugs to " exit 0 ;; - -s|--silent) SILENT=true ; shift ;; - --mrproper) MRPROPER=true ; shift ;; + -s|--silent) SILENT=true ; shift ;; + --mrproper) MRPROPER=true ; shift ;; + -c|--config) CONFIG_FILE=$2 ; shift 2 ;; --) shift ; break ;; *) echo "Internal error!" ; exit -1 ;; esac done -CONFIG_FILE=/proc/config.gz -[ "$1" != "" ] && CONFIG_FILE=$1 - # remounting file systems ro->rw for fs in $RW_REMOUNT; do if [[ "$fs" =~ ^/+usr/*$ || "$fs" =~ ^/+boot/*$ ]]; then @@ -48,7 +48,7 @@ if [ true == "$MRPROPER" ]; then make clean && make mrproper [ 0 -ne $? ] && echo "make clean && make mrproper failed ;-( =======" && exit -1 fi - +echo CONFIG_FILE=$CONFIG_FILE zcat $CONFIG_FILE >.config 2>/dev/null || cat $CONFIG_FILE >.config [ "$?" != "0" ] && echo "$CONFIG_FILE doesn't exist or /usr mounted as read-only" && exit -1