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-31-garchives=archives.gentoo.org@gentoo.org>)
	id 1I6R3W-0002BL-Ka
	for garchives@archives.gentoo.org; Thu, 05 Jul 2007 13:07:35 +0000
Received: from robin.gentoo.org (localhost [127.0.0.1])
	by robin.gentoo.org (8.14.0/8.14.0) with SMTP id l65D7WRZ007856;
	Thu, 5 Jul 2007 13:07:32 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 l65D7VQ1007824
	for <gnap-dev@lists.gentoo.org>; Thu, 5 Jul 2007 13:07:31 GMT
Received: from my.bawue.net (imap.bawue.net [193.7.176.64])
	by mail.bawue.net (Postfix) with ESMTP id 5FB40B92C8
	for <gnap-dev@lists.gentoo.org>; Thu,  5 Jul 2007 15:07:31 +0200 (CEST)
Received: from 130.230.11.107
        (SquirrelMail authenticated user stoile)
        by my.bawue.net with HTTP;
        Thu, 5 Jul 2007 16:07:31 +0300 (EEST)
Message-ID: <44054.130.230.11.107.1183640851.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:07:31 +0300 (EEST)
Subject: [gnap-dev] 05-festure-gnap_overlay-T.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: 72301d03-c316-4f87-a6c1-99803e791218
X-Archives-Hash: 15c2e242b2dae7a23bf838c032eb581e

Index: tools/gnap_overlay
===================================================================
--- tools/gnap_overlay	(revision 58)
+++ tools/gnap_overlay	(revision 60)
@@ -13,26 +13,27 @@
     echo "  ${GNAPNAME} -d hostdisk -r rootdev -o overlay [ options ]"
     echo
     echo 'Common options:'
-    echo '  -o overlay    Overlay directory or tbz2 file'
-    echo '  -c conf       overlay.conf file to use (if not in overlays)'
-    echo '  -g gnap_core  Use specific GNAP core tarball file'
-    echo '  -n            Do not use the GNAP castle logo'
-    echo '  -f            Force all answers to yes (dangerous!)'
+    echo '  -o overlay       Overlay directory or tbz2 file'
+    echo '  -c conf          overlay.conf file to use (if not in overlays)'
+    echo '  -g gnap_core     Use specific GNAP core tarball file'
+    echo '  -n               Do not use the GNAP castle logo'
+    echo '  -f               Force all answers to yes (dangerous!)'
+	echo '  -T gnap_tempdir  Use given temp dir'
     echo
     echo 'Options for ISO target (create an ISO containing bootable CD):'
-    echo '  -i isoname    Customized LiveCD ISO output file name'
+    echo '  -i isoname       Customized LiveCD ISO output file name'
     echo
     echo 'Options for disk target (install to a disk plugged in system):'
-    echo '  -d hostdisk   Disk to install to, as seen on current host'
-    echo '  -r rootdev    Boot device name as seen from target system'
-    echo '  -m            Cache filesystem in memory to reduce media wear'
-    echo '  -s            Use serial console on ttyS0'
+    echo '  -d hostdisk      Disk to install to, as seen on current host'
+    echo '  -r rootdev       Boot device name as seen from target system'
+    echo '  -m               Cache filesystem in memory to reduce media
wear'
+    echo '  -s               Use serial console on ttyS0'
     echo
     echo 'Options for image target (install into a disk image):'
-    echo '  -l image      Use existing image file as output'
-    echo '                Warning: only one partition is supported!'
-    echo '  -L image      Create image file and use it as output'
-    echo '  -S size       Size of image file in megabyte'
+    echo '  -l image         Use existing image file as output'
+    echo '                   Warning: only one partition is supported!'
+    echo '  -L image         Create image file and use it as output'
+    echo '  -S size          Size of image file in megabyte'
     echo '  The disk target options also apply, except -d.'
     echo
     echo "Please man ${GNAPNAME} for more details."
@@ -46,7 +47,8 @@
 gbegin 'Checking parameters'

 # Read options
-while getopts ':hg:o:c:nfi:d:l:r:ms:S:L:' options; do
+TEMPDIR=''
+while getopts ':hg:o:c:nfi:d:l:r:ms:S:L:T:' options; do
 	case ${options} in
 		h ) usage
 			exit 0;;
@@ -70,6 +72,7 @@
 		m ) CACHE='docache ';;
 		s ) SERIAL="console=ttyS0,${OPTARG}n81"
 			BAUDRATE="${OPTARG}";;
+		T ) TEMPDIR="${OPTARG}";;
 		* ) gtest 1 'Specified options are incomplete or unknown !';;
 	esac
 done
@@ -116,10 +119,19 @@
 	gconfirm 'Are you sure you want to continue ?'
 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
+
 # Common actions
 gbegin "Expanding ${GNAPCORE} core"
-TEMPDIR=$(mktemp -d -t gnap_overlay.XXXXXX)
-gtest continued $? 'Failed to create temporary directory'
 TEMPCOREDIR="${TEMPDIR}/core"
 mkdir "${TEMPCOREDIR}"
 gtest continued $? 'Failed to create core temporary subdirectory'

-- 
gnap-dev@gentoo.org mailing list