commit:     8de563ba9df1c81c23a8daccc7c69f45b31cb518
Author:     Vadim A. Misbakh-Soloviov (mva) <gentoo <AT> mva <DOT> name>
AuthorDate: Mon Jan  2 23:08:07 2017 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Mon Jan  2 23:08:29 2017 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=8de563ba

Implement kernel nconfig just like menuconfig.

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 gen_cmdline.sh       | 19 +++++++++++++++++++
 gen_configkernel.sh  |  5 +++++
 gen_determineargs.sh |  1 +
 genkernel.conf       |  6 ++++++
 4 files changed, 31 insertions(+)

diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index f4392f9..0e1e7ef 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -27,6 +27,8 @@ longusage() {
   echo "  Kernel Configuration settings"
   echo "       --menuconfig            Run menuconfig after oldconfig"
   echo "       --no-menuconfig         Do not run menuconfig after oldconfig"
+  echo "       --nconfig               Run nconfig after oldconfig"
+  echo "       --no-nconfig            Do not run nconfig after oldconfig"
   echo "       --gconfig                       Run gconfig after oldconfig"
   echo "       --no-gconfig            Don't run gconfig after oldconfig"
   echo "       --xconfig                       Run xconfig after oldconfig"
@@ -185,6 +187,7 @@ usage() {
   echo
   echo 'Some useful options:'
   echo '       --menuconfig            Run menuconfig after oldconfig'
+  echo '       --nconfig               Run nconfig after oldconfig (requires 
ncurses)'
   echo '       --no-clean              Do not run make clean before 
compilation'
   echo '       --no-mrproper           Do not run make mrproper before 
compilation,'
   echo '                               this is implied by --no-clean.'
@@ -411,6 +414,22 @@ parse_cmdline() {
                        CMD_MENUCONFIG=0
                        print_info 2 "CMD_MENUCONFIG: ${CMD_MENUCONFIG}"
                        ;;
+               --nconfig)
+                       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 --nconfig; 
try --no-nconfig..."
+                               exit 1
+                       fi
+                       CMD_NCONFIG=1
+                       print_info 2 "CMD_NCONFIG: ${CMD_NCONFIG}"
+                       ;;
+               --no-nconfig)
+                       CMD_NCONFIG=0
+                       print_info 2 "CMD_NCONFIG: ${CMD_NCONFIG}"
+                       ;;
                --gconfig|--no-gconfig)
                        CMD_GCONFIG=`parse_optbool "$*"`
                        print_info 2 "CMD_GCONFIG: ${CMD_GCONFIG}"

diff --git a/gen_configkernel.sh b/gen_configkernel.sh
index 74693f3..6ca0200 100755
--- a/gen_configkernel.sh
+++ b/gen_configkernel.sh
@@ -90,6 +90,11 @@ config_kernel() {
                print_info 1 'kernel: >> Invoking menuconfig...'
                compile_generic menuconfig kernelruntask
                [ "$?" ] || gen_die 'Error: menuconfig failed!'
+       elif isTrue ${NCONFIG}
+       then
+               print_info 1 'kernel: >> Invoking nconfig...'
+               compile_generic nconfig kernelruntask
+               [ "$?" ] || gen_die 'Error: nconfig failed!'
        elif isTrue ${CMD_GCONFIG}
        then
                print_info 1 'kernel: >> Invoking gconfig...'

diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index 2dbd958..313dbd0 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -98,6 +98,7 @@ determine_real_args() {
        set_config_with_override BOOL   POSTCLEAR            CMD_POSTCLEAR
        set_config_with_override BOOL   MRPROPER             CMD_MRPROPER
        set_config_with_override BOOL   MENUCONFIG           CMD_MENUCONFIG
+       set_config_with_override BOOL   NCONFIG              CMD_NCONFIG
        set_config_with_override BOOL   CLEAN                CMD_CLEAN
 
        set_config_with_override STRING MINKERNPACKAGE       CMD_MINKERNPACKAGE

diff --git a/genkernel.conf b/genkernel.conf
index e62d294..7e5a46f 100644
--- a/genkernel.conf
+++ b/genkernel.conf
@@ -17,6 +17,12 @@ OLDCONFIG="yes"
 # Run 'make menuconfig' before compiling this kernel?
 MENUCONFIG="no"
 
+# Run 'make nconfig' (ncurses 'menuconfig') before compiling this kernel?
+NCONFIG="no"
+
+# Note, that two previous lines are mutual exclusive (logically), while
+# MENUCONFIG has a higher priority if both them is enabled.
+
 # Run 'make clean' before compilation?
 # If set to NO, implies MRPROPER WILL NOT be run
 # Also, if clean is NO, it won't copy over any configuration

Reply via email to