commit:     deef895b91b8632033a1d1cd151c947f8b73a78a
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 13 23:01:25 2014 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Mon Apr 14 00:59:30 2014 +0000
URL:        
http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=deef895b

Make it possible to turn off all of the on-exit cleanup.

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

---
 gen_cmdline.sh       |  6 ++++++
 gen_determineargs.sh |  1 +
 genkernel            | 37 ++++++++++++++++++++++---------------
 3 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index 715ad49..7bee618 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -22,6 +22,8 @@ longusage() {
   echo "       --logfile=<outfile>     Output file for debug info"
   echo "       --color                 Output debug in color"
   echo "       --no-color              Do not output debug in color"
+  echo "       --debug-cleanup Clean up temporary build directories on exit"
+  echo "       --no-debug-cleanup      Do not remove any temporary directories 
on exit"
   echo "  Kernel Configuration settings"
   echo "       --menuconfig            Run menuconfig after oldconfig"
   echo "       --no-menuconfig         Do not run menuconfig after oldconfig"
@@ -471,6 +473,10 @@ parse_cmdline() {
                        print_info 2 "USECOLOR: ${USECOLOR}"
                        setColorVars
                        ;;
+               --debug-cleanup|--no-debug-cleanup)
+                       CMD_DEBUGCLEANUP=`parse_optbool "$*"`
+                       print_info 2 "DEBUGCLEANUP: ${DEBUGCLEANUP}"
+                       ;;
                --logfile=*)
                        CMD_LOGFILE=`parse_opt "$*"`
                        LOGFILE=`parse_opt "$*"`

diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index e0c9984..615f274 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -136,6 +136,7 @@ determine_real_args() {
        set_config_with_override BOOL   DOKEYMAPAUTO         CMD_DOKEYMAPAUTO
        set_config_with_override STRING BUSYBOX_CONFIG       CMD_BUSYBOX_CONFIG
        set_config_with_override BOOL   INSTALL              CMD_INSTALL        
      "yes"
+       set_config_with_override BOOL   DEBUGCLEANUP         CMD_DEBUGCLEANUP   
      "yes"
 
        BOOTDIR=`arch_replace "${BOOTDIR}"`
        BOOTDIR=${BOOTDIR%/}    # Remove any trailing slash

diff --git a/genkernel b/genkernel
index b62c3f7..f10cd49 100755
--- a/genkernel
+++ b/genkernel
@@ -61,21 +61,28 @@ trap_cleanup(){
 }
 
 cleanup(){
-    if [ -n "$TEMP" -a -d "$TEMP" ]; then
-       rm -rf "$TEMP"
-    fi
-
-    if isTrue ${POSTCLEAR}
-    then
-           echo
-           print_info 1 'RUNNING FINAL CACHE/TMP CLEANUP'
-           print_info 1 "CACHE_DIR: ${CACHE_DIR}"
-           CLEAR_CACHE_DIR='yes'
-           setup_cache_dir
-           echo
-           print_info 1 "TMPDIR: ${TMPDIR}"
-           clear_tmpdir
-           fi
+       if [ "${CMD_DEBUGCLEANUP}" == "no" ]; then
+               print_info 1 "Not running any cleanup per DEBUGCLEANUP"
+               print_info 1 "TEMP: ${TEMP}"
+               print_info 1 "CACHE_DIR: ${CACHE_DIR}"
+               print_info 1 "TMPDIR: ${TMPDIR}"
+       else
+               if [ -n "$TEMP" -a -d "$TEMP" ]; then
+                       rm -rf "$TEMP"
+               fi
+
+               if isTrue ${POSTCLEAR}
+               then
+                       echo
+                       print_info 1 'RUNNING FINAL CACHE/TMP CLEANUP'
+                       print_info 1 "CACHE_DIR: ${CACHE_DIR}"
+                       CLEAR_CACHE_DIR='yes'
+                       setup_cache_dir
+                       echo
+                       print_info 1 "TMPDIR: ${TMPDIR}"
+                       clear_tmpdir
+               fi
+       fi
 }
 
 trap trap_cleanup SIGHUP SIGQUIT SIGINT SIGTERM SIGKILL

Reply via email to