aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2014-04-16 01:32:11 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2014-04-16 01:32:20 -0700
commitbe1d4c66a79701f400a7bbbea588582164b0f5ca (patch)
tree6fe176a8364a027d6304282fef99a1ebfadaf7bd
parentBump version to 3.4.49.1 (diff)
downloadgenkernel-be1d4c66a79701f400a7bbbea588582164b0f5ca.tar.gz
genkernel-be1d4c66a79701f400a7bbbea588582164b0f5ca.tar.bz2
genkernel-be1d4c66a79701f400a7bbbea588582164b0f5ca.zip
Improve debugcleanup code
- Improve the debug-cleanup code to use isTrue and match other code style. - add explicit return 0 after debug-cleanup to avoid passing a false negative failure code up to a higher level function. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rwxr-xr-xgen_compile.sh30
-rwxr-xr-xgenkernel12
2 files changed, 25 insertions, 17 deletions
diff --git a/gen_compile.sh b/gen_compile.sh
index 9b5df01..0fb33d5 100755
--- a/gen_compile.sh
+++ b/gen_compile.sh
@@ -430,7 +430,7 @@ compile_busybox() {
yes '' 2>/dev/null | compile_generic oldconfig utils
print_info 1 'busybox: >> Compiling...'
- compile_generic all utils
+ compile_generic all utils V=1
print_info 1 'busybox: >> Copying to cache...'
[ -f "${TEMP}/${BUSYBOX_DIR}/busybox" ] ||
gen_die 'Busybox executable does not exist!'
@@ -440,7 +440,8 @@ compile_busybox() {
gen_die 'Could not create the busybox bincache!'
cd "${TEMP}"
- rm -rf "${BUSYBOX_DIR}" > /dev/null
+ isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${BUSYBOX_DIR}" > /dev/null
+ return 0
fi
}
@@ -485,8 +486,9 @@ compile_lvm() {
gen_die 'Could not create binary cache'
cd "${TEMP}"
- rm -rf "${TEMP}/lvm" > /dev/null
- rm -rf "${LVM_DIR}" lvm
+ isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${TEMP}/lvm" > /dev/null
+ isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${LVM_DIR}" lvm
+ return 0
fi
}
@@ -525,7 +527,8 @@ compile_mdadm() {
gen_die 'Could not create binary cache'
cd "${TEMP}"
- rm -rf "${MDADM_DIR}" mdadm
+ isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${MDADM_DIR}" mdadm
+ return 0
fi
}
@@ -574,8 +577,9 @@ compile_dmraid() {
gen_die 'Could not create binary cache'
cd "${TEMP}"
- rm -rf "${TEMP}/lvm" > /dev/null
- rm -rf "${DMRAID_DIR}" dmraid
+ isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${TEMP}/lvm" > /dev/null
+ isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${DMRAID_DIR}" dmraid
+ return 0
fi
}
@@ -612,7 +616,8 @@ compile_fuse() {
# gen_die 'Could not create fuse bincache!'
cd "${TEMP}"
-# rm -rf "${FUSE_DIR}" > /dev/null
+# isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${FUSE_DIR}" > /dev/null
+ return 0
fi
}
@@ -647,7 +652,8 @@ compile_unionfs_fuse() {
gen_die 'Could not copy the unionfs binary to the package directory, does the directory exist?'
cd "${TEMP}"
- rm -rf "${UNIONFS_FUSE_DIR}" > /dev/null
+ isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${UNIONFS_FUSE_DIR}" > /dev/null
+ return 0
fi
}
@@ -697,7 +703,8 @@ compile_iscsi() {
gen_die 'Could not copy the iscsistart binary to the package directory, does the directory exist?'
cd "${TEMP}"
- rm -rf "${ISCSI_DIR}" > /dev/null
+ isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${ISCSI_DIR}" > /dev/null
+ return 0
fi
}
@@ -742,6 +749,7 @@ compile_gpg() {
gen_die 'Could not copy the gpg binary to the package directory, does the directory exist?'
cd "${TEMP}"
- rm -rf "${GPG_DIR}" > /dev/null
+ isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${GPG_DIR}" > /dev/null
+ return 0
fi
}
diff --git a/genkernel b/genkernel
index ed7f3ad..1d2a372 100755
--- a/genkernel
+++ b/genkernel
@@ -61,12 +61,7 @@ trap_cleanup(){
}
cleanup(){
- 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 isTrue "${CMD_DEBUGCLEANUP}"; then
if [ -n "$TEMP" -a -d "$TEMP" ]; then
rm -rf "$TEMP"
fi
@@ -82,6 +77,11 @@ cleanup(){
print_info 1 "TMPDIR: ${TMPDIR}"
clear_tmpdir
fi
+ else
+ 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}"
fi
}