Gentoo Archives: gnap-dev

From: Philipp Riegger <lists@××××××××××××.de>
To: gnap-dev@l.g.o
Subject: [gnap-dev] 04-feature-gnap_make-T.patch
Date: Thu, 05 Jul 2007 13:07:00
Message-Id: 44048.130.230.11.107.1183640799.squirrel@my.bawue.net
In Reply to: [gnap-dev] Some patches for gnap by Philipp Riegger
Index: src/gnap_make
===================================================================
--- src/gnap_make	(revision 55)
+++ src/gnap_make	(revision 57)
@@ -15,6 +15,7 @@
 	echo '    -l logfile           Use specific log file prefix'
 	echo '    -c catalyst.conf     Use specific catalyst.conf file'
 	echo '    -e specs             Specs directory or tar.bz2 file'
+	echo '    -T gnap_tempdir      Use given temp dir'
 	echo
 	echo "Please man ${GNAPNAME} for more details."
 }
@@ -29,7 +30,8 @@
 # Read options
 NOTARGET=1
 STAMP=$(date +%Y%m%d)
-while getopts ':hs:p:m:o:v:t:fl:c:e:' options; do
+TEMPDIR=''
+while getopts ':hs:p:m:o:v:t:fl:c:e:T:' options; do
 	case ${options} in
 		h ) usage
 			exit 0;;
@@ -59,6 +61,7 @@
 		l ) GNAPLOGPREFIX="${OPTARG}";;
 		c ) CATALYST_CONF="${OPTARG}";;
 		e ) SPECS="${OPTARG}";;
+		T ) TEMPDIR="${OPTARG}";;
 		* ) gtest 1 'Specified options are incomplete or unknown !';;
 	esac
 done
@@ -68,8 +71,15 @@
 gtest continued $? "You need to be root to run ${GNAPNAME}"

 # Setting up temporary directory
-TEMPDIR=$(mktemp -d -t gnap_make.XXXXXX)
-gtest continued $? 'Failed to create 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

 # Prepare specs dir and check common.conf file
 SPECDIR="${TEMPDIR}/specs"

-- 
gnap-dev@g.o mailing list