aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2019-04-06 20:53:30 +0200
committerThomas Deutschmann <whissi@gentoo.org>2019-04-06 20:53:30 +0200
commit2d5c1dc73b2c44200e7bbb0ebb18a46adcc63af1 (patch)
tree58f22a3588bc9b635907057f179b3d6440a3052f
parentMake sure $TMPDIR exists (diff)
downloadgenkernel-2d5c1dc73b2c44200e7bbb0ebb18a46adcc63af1.tar.gz
genkernel-2d5c1dc73b2c44200e7bbb0ebb18a46adcc63af1.tar.bz2
genkernel-2d5c1dc73b2c44200e7bbb0ebb18a46adcc63af1.zip
Fix "Make sure $TMPDIR exists"
Previous attempt to ensure $TMPDIR exists introduced a new bug: The used one-line if clause was invalid. Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
-rwxr-xr-xgen_cmdline.sh6
-rwxr-xr-xgenkernel7
2 files changed, 11 insertions, 2 deletions
diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index c5697e2..be04cdb 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -587,8 +587,12 @@ parse_cmdline() {
;;
--tempdir=*)
TMPDIR="${*#*=}"
- [ ! -d "${TMPDIR}" ] && mkdir -p "${TMPDIR}" || gen_die "Failed to create '${TMPDIR}'!"
+ if [ ! -d "${TMPDIR}" ]
+ then
+ mkdir -p "${TMPDIR}" || gen_die "Failed to create '${TMPDIR}'!"
+ fi
TEMP=$(mktemp -d -p "${TMPDIR}" gk.XXXXXXXX)
+ [ -z "${TEMP}" ] && gen_die "mktemp failed!"
print_info 2 "TMPDIR: ${TMPDIR}"
print_info 2 "TEMP: ${TEMP}"
;;
diff --git a/genkernel b/genkernel
index 6904ff2..5337833 100755
--- a/genkernel
+++ b/genkernel
@@ -44,8 +44,13 @@ source ${GK_SHARE}/gen_moddeps.sh || gen_die "Could not read ${GK_SHARE}/gen_mod
source ${GK_SHARE}/gen_package.sh || gen_die "Could not read ${GK_SHARE}/gen_package.sh"
source ${GK_SHARE}/gen_bootloader.sh || gen_die "Could not read ${GK_SHARE}/gen_bootloader.sh"
-[ ! -d "${TMPDIR}" ] && mkdir -p "${TMPDIR}" || gen_die "Failed to create '${TMPDIR}'!"
+if [ ! -d "${TMPDIR}" ]
+then
+ mkdir -p "${TMPDIR}" || gen_die "Failed to create '${TMPDIR}'!"
+fi
+
TEMP=$(mktemp -d -p "${TMPDIR}" gk.XXXXXXXX)
+[ -z "${TEMP}" ] && gen_die "mktemp failed!"
trap_cleanup(){
# Call exit code of 1 for failure