From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1100970-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id A8FCA138334
	for <garchives@archives.gentoo.org>; Sun, 21 Jul 2019 16:26:43 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id ADE76E086B;
	Sun, 21 Jul 2019 16:26:41 +0000 (UTC)
Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 75E8FE086B
	for <gentoo-commits@lists.gentoo.org>; Sun, 21 Jul 2019 16:26:41 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 5C1803483DF
	for <gentoo-commits@lists.gentoo.org>; Sun, 21 Jul 2019 16:26:40 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 6A26272F
	for <gentoo-commits@lists.gentoo.org>; Sun, 21 Jul 2019 16:26:37 +0000 (UTC)
From: "Thomas Deutschmann" <whissi@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Thomas Deutschmann" <whissi@gentoo.org>
Message-ID: <1563724071.2cefc2738a7fd73139b3c80ad16b4deacd12920c.whissi@gentoo>
Subject: [gentoo-commits] proj/genkernel:master commit in: /
X-VCS-Repository: proj/genkernel
X-VCS-Files: gen_cmdline.sh gen_determineargs.sh genkernel
X-VCS-Directories: /
X-VCS-Committer: whissi
X-VCS-Committer-Name: Thomas Deutschmann
X-VCS-Revision: 2cefc2738a7fd73139b3c80ad16b4deacd12920c
X-VCS-Branch: master
Date: Sun, 21 Jul 2019 16:26:37 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: f1f26f8d-3e7a-4567-850a-c40eedd2fe7e
X-Archives-Hash: 45e774b51acf340b288dc40650de2437

commit:     2cefc2738a7fd73139b3c80ad16b4deacd12920c
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 20 21:13:33 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Jul 21 15:47:51 2019 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=2cefc273

genkernel: Move --tempdir handling to determine_real_args()

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 gen_cmdline.sh       | 11 ++---------
 gen_determineargs.sh |  9 +++++++++
 genkernel            | 12 ------------
 3 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index a7b35a8..b9f1326 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -585,15 +585,8 @@ parse_cmdline() {
 			print_info 3 "CMD_STATIC: ${CMD_STATIC}"
 			;;
 		--tempdir=*)
-			TMPDIR="${*#*=}"
-			if [ ! -d "${TMPDIR}" ]
-			then
-				mkdir -p "${TMPDIR}" || gen_die "Failed to create '${TMPDIR}'!"
-			fi
-			TEMP=$(mktemp -d -p "${TMPDIR}" gk.XXXXXXXX 2>/dev/null)
-			[ -z "${TEMP}" ] && gen_die "mktemp failed!"
-			print_info 3 "TMPDIR: ${TMPDIR}"
-			print_info 3 "TEMP: ${TEMP}"
+			CMD_TMPDIR="${*#*=}"
+			print_info 3 "CMD_TMPDIR: ${CMD_TMPDIR}"
 			;;
 		--postclear|--no-postclear)
 			CMD_POSTCLEAR=$(parse_optbool "$*")

diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index c969188..d39412c 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -97,6 +97,7 @@ determine_real_args() {
 
 	#                               Dest / Config File   Command Line                     Arch Default
 	#                               ------------------   ------------                     ------------
+	set_config_with_override STRING TMPDIR                   CMD_TMPDIR                   "/var/tmp/genkernel"
 	set_config_with_override STRING LOGFILE                  CMD_LOGFILE                  "/var/log/genkernel.conf"
 	set_config_with_override STRING KERNEL_DIR               CMD_KERNEL_DIR               "${DEFAULT_KERNEL_SOURCE}"
 	set_config_with_override BOOL   KERNEL_SOURCES           CMD_KERNEL_SOURCES           "yes"
@@ -187,6 +188,14 @@ determine_real_args() {
 	set_config_with_override BOOL   INSTALL                  CMD_INSTALL                  "yes"
 	set_config_with_override BOOL   CLEANUP                  CMD_CLEANUP                  "yes"
 
+	if [ ! -d "${TMPDIR}" ]
+	then
+		mkdir -p "${TMPDIR}" || gen_die "Failed to create '${TMPDIR}'!"
+	fi
+
+	declare -gr TEMP=$(mktemp -d -p "${TMPDIR}" gk.XXXXXXXX 2>/dev/null)
+	[ -z "${TEMP}" ] && gen_die "'mktemp -d -p \"${TMPDIR}\" gk.XXXXXXXX' failed!"
+
 	declare -gr GK_V_CACHEDIR="${CACHE_DIR}/${GK_V}"
 
 	if [ -n "${CMD_CROSS_COMPILE}" ]

diff --git a/genkernel b/genkernel
index ccd0820..8991e69 100755
--- a/genkernel
+++ b/genkernel
@@ -4,10 +4,6 @@
 PATH="${PATH}:/sbin:/usr/sbin"
 GK_V='4.0.0_beta7'
 
-# Set the default for TMPDIR. May be modified by genkernel.conf or the
-# --tempdir command line option.
-TMPDIR='/var/tmp/genkernel'
-
 TODEBUGCACHE=yes # Until an error occurs or LOGFILE is fully qualified.
 
 small_die() {
@@ -75,14 +71,6 @@ source "${GK_SHARE}"/gen_moddeps.sh || gen_die "Could not read '${GK_SHARE}/gen_
 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'"
 
-if [ ! -d "${TMPDIR}" ]
-then
-	mkdir -p "${TMPDIR}" || gen_die "Failed to create '${TMPDIR}'!"
-fi
-
-TEMP=$(mktemp -d -p "${TMPDIR}" gk.XXXXXXXX 2>/dev/null)
-[ -z "${TEMP}" ] && gen_die "mktemp failed!"
-
 export GK_MASTER_PID=${BASHPID}
 
 set_default_gk_trap