From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org)
	by nuthatch.gentoo.org with esmtp (Exim 4.62)
	(envelope-from <gnap-dev+bounces-33-garchives=archives.gentoo.org@gentoo.org>)
	id 1I6R5a-0002AC-9h
	for garchives@archives.gentoo.org; Thu, 05 Jul 2007 13:09:42 +0000
Received: from robin.gentoo.org (localhost [127.0.0.1])
	by robin.gentoo.org (8.14.0/8.14.0) with SMTP id l65D9d60010815;
	Thu, 5 Jul 2007 13:09:39 GMT
Received: from mail.bawue.net (phoenix.bawue.net [193.7.176.60])
	by robin.gentoo.org (8.14.0/8.14.0) with ESMTP id l65D9dtl010808
	for <gnap-dev@lists.gentoo.org>; Thu, 5 Jul 2007 13:09:39 GMT
Received: from my.bawue.net (imap.bawue.net [193.7.176.64])
	by mail.bawue.net (Postfix) with ESMTP id 456EFBA1CC
	for <gnap-dev@lists.gentoo.org>; Thu,  5 Jul 2007 15:09:39 +0200 (CEST)
Received: from 130.230.11.107
        (SquirrelMail authenticated user stoile)
        by my.bawue.net with HTTP;
        Thu, 5 Jul 2007 16:09:39 +0300 (EEST)
Message-ID: <51428.130.230.11.107.1183640979.squirrel@my.bawue.net>
In-Reply-To: <59506.130.230.11.107.1183640031.squirrel@my.bawue.net>
References: <59506.130.230.11.107.1183640031.squirrel@my.bawue.net>
Date: Thu, 5 Jul 2007 16:09:39 +0300 (EEST)
Subject: [gnap-dev]  07-split-make_tempdir.patch
From: "Philipp Riegger" <lists@anderedomain.de>
To: gnap-dev@lists.gentoo.org
User-Agent: SquirrelMail/1.4.2
Precedence: bulk
List-Post: <mailto:gnap-dev@lists.gentoo.org>
List-Help: <mailto:gnap-dev+help@gentoo.org>
List-Unsubscribe: <mailto:gnap-dev+unsubscribe@gentoo.org>
List-Subscribe: <mailto:gnap-dev+subscribe@gentoo.org>
List-Id: Gentoo GNAP development <gnap-dev.gentoo.org>
X-BeenThere: gnap-dev@gentoo.org
Reply-to: gnap-dev@lists.gentoo.org
MIME-Version: 1.0
Content-Type: text/plain;charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Priority: 3
Importance: Normal
X-Archives-Salt: b6402044-d615-438b-848a-d417642f135c
X-Archives-Hash: 3cb7c240956cf8b4c98a2ccb351e2d20

Index: tools/gnap_shared.sh
===================================================================
--- tools/gnap_shared.sh	(revision 55)
+++ tools/gnap_shared.sh	(working copy)
@@ -16,6 +16,7 @@
 GNAPEXTDIR="${GNAPLIBDIR}/extensions"
 GNAPBASEFS="${GNAPLIBDIR}/gnap-basefs.tar.bz2"

+TEMPDIR=''
 LOOP=''

 G=$'\e[32;01m'
@@ -90,3 +91,15 @@
 		gtest 0
 	fi
 }
+
+make_tempdir() {
+	if [[ "${TEMPDIR}" = "" ]]; then
+		TEMPDIR=$(mktemp -d -t gnap_make.XXXXXX)
+		gtest continued $? 'Failed to create temporary directory'
+	elif [[ -d "${TEMPDIR}" ]]
+		gconfirm "${TEMPDIR} already exists. Continue?"
+	else
+		mkdir -p "${TEMPDIR}"
+		gtest continued $? "Failed to create ${TEMPDIR}"
+	fi
+}
Index: tools/gnap_overlay
===================================================================
--- tools/gnap_overlay	(revision 60)
+++ tools/gnap_overlay	(working copy)
@@ -47,7 +47,6 @@
 gbegin 'Checking parameters'

 # Read options
-TEMPDIR=''
 while getopts ':hg:o:c:nfi:d:l:r:ms:S:L:T:' options; do
 	case ${options} in
 		h ) usage
@@ -120,15 +119,7 @@
 fi

 # Setting up temporary directory
-if [[ "${TEMPDIR}" = "" ]]; then
-	TEMPDIR=$(mktemp -d -t gnap_overlay.XXXXXX)
-	gtest continued $? 'Failed to create temporary directory'
-elif [[ -d "${TEMPDIR}" ]]
-	gconfirm "${TEMPDIR} already exists. Continue?"
-else
-	mkdir -p "${TEMPDIR}"
-	gtest continued $? "Failed to create ${TEMPDIR}"
-fi
+make_tempdir

 # Common actions
 gbegin "Expanding ${GNAPCORE} core"
Index: tools/gnap_remaster
===================================================================
--- tools/gnap_remaster	(revision 61)
+++ tools/gnap_remaster	(working copy)
@@ -33,7 +33,6 @@
 gbegin 'Checking parameters'

 # Read options
-TEMPDIR=''
 while getopts ':he:k:m:o:g:b:d:fT:' options; do
 	case ${options} in
 		h ) usage
@@ -73,15 +72,7 @@
 fi

 # Setting up temporary directory
-if [[ "${TEMPDIR}" = "" ]]; then
-	TEMPDIR=$(mktemp -d -t gnap_remaster.XXXXXX)
-	gtest continued $? 'Failed to create temporary directory'
-elif [[ -d "${TEMPDIR}" ]]
-	gconfirm "${TEMPDIR} already exists. Continue?"
-else
-	mkdir -p "${TEMPDIR}"
-	gtest continued $? "Failed to create ${TEMPDIR}"
-fi
+make_tempdir

 # Preparing new FS
 gbegin "Unpacking ${GNAPBASEFS} basefs"
Index: src/gnap_make
===================================================================
--- src/gnap_make	(revision 58)
+++ src/gnap_make	(working copy)
@@ -30,7 +30,6 @@
 # Read options
 NOTARGET=1
 STAMP=$(date +%Y%m%d)
-TEMPDIR=''
 while getopts ':hs:p:m:o:v:t:fl:c:e:T:' options; do
 	case ${options} in
 		h ) usage
@@ -71,15 +70,7 @@
 gtest continued $? "You need to be root to run ${GNAPNAME}"

 # Setting up temporary directory
-if [[ "${TEMPDIR}" = "" ]]; then
-	TEMPDIR=$(mktemp -d -t gnap_make.XXXXXX)
-	gtest continued $? 'Failed to create temporary directory'
-elif [[ -d "${TEMPDIR}" ]]
-	gconfirm "${TEMPDIR} already exists. Continue?"
-else
-	mkdir -p "${TEMPDIR}"
-	gtest continued $? "Failed to create ${TEMPDIR}"
-fi
+make_tempdir

 # Prepare specs dir and check common.conf file
 SPECDIR="${TEMPDIR}/specs"
Index: src/gnap_shared.sh
===================================================================
--- src/gnap_shared.sh	(revision 55)
+++ src/gnap_shared.sh	(working copy)
@@ -16,6 +16,7 @@
 GNAPEXTDIR="${GNAPLIBDIR}/extensions"
 GNAPBASEFS="${GNAPLIBDIR}/gnap-basefs.tar.bz2"

+TEMPDIR=''
 LOOP=''

 G=$'\e[32;01m'
@@ -90,3 +91,15 @@
 		gtest 0
 	fi
 }
+
+make_tempdir() {
+	if [[ "${TEMPDIR}" = "" ]]; then
+		TEMPDIR=$(mktemp -d -t gnap_make.XXXXXX)
+		gtest continued $? 'Failed to create temporary directory'
+	elif [[ -d "${TEMPDIR}" ]]
+		gconfirm "${TEMPDIR} already exists. Continue?"
+	else
+		mkdir -p "${TEMPDIR}"
+		gtest continued $? "Failed to create ${TEMPDIR}"
+	fi
+}

-- 
gnap-dev@gentoo.org mailing list