Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gnap-dev
Navigation:
Lists: gnap-dev: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gnap-dev@g.o
From: "Philipp Riegger" <lists@...>
Subject: 08-namespace-gnap_shared.patch
Date: Thu, 5 Jul 2007 16:10:37 +0300 (EEST)
Index: tools/gnap_shared.sh
===================================================================
--- tools/gnap_shared.sh	(revision 73)
+++ tools/gnap_shared.sh	(working copy)
@@ -1,23 +1,24 @@
-GNAPNAME=$(basename "$0")
+GNAP_NAME=$(basename "$0")

-case ${GNAPNAME} in
-	gnap_make )     GNAPPRODUCT="Build";;
-	gnap_overlay )  GNAPPRODUCT="Overlay";;
-	gnap_remaster ) GNAPPRODUCT="Remaster";;
-	* )             GNAPPRODUCT="Something";;
+case ${GNAP_NAME} in
+	gnap_make )     GNAP_PRODUCT="Build";;
+	gnap_overlay )  GNAP_PRODUCT="Overlay";;
+	gnap_remaster ) GNAP_PRODUCT="Remaster";;
+	* )             GNAP_PRODUCT="Something";;
 esac

-GNAPLIBDIR='/usr/lib/gnap'
-STAGE3FILE="${GNAPLIBDIR}/gnap-stage3seed.tar.bz2"
-SNAPSHOTFILE="${GNAPLIBDIR}/gnap-portagesnapshot.tar.bz2"
-SPECS="${GNAPLIBDIR}/gnap-specs.tar.bz2"
-GNAPCORE="${GNAPLIBDIR}/gnap-core.tar"
-GNAPMBR="${GNAPLIBDIR}/mbr/mbr.bin"
-GNAPEXTDIR="${GNAPLIBDIR}/extensions"
-GNAPBASEFS="${GNAPLIBDIR}/gnap-basefs.tar.bz2"
+GNAP_LIBDIR='/usr/lib/gnap'
+GNAP_STAGE3FILE="${GNAP_LIBDIR}/gnap-stage3seed.tar.bz2"
+GNAP_SNAPSHOTFILE="${GNAP_LIBDIR}/gnap-portagesnapshot.tar.bz2"
+GNAP_SPECS="${GNAP_LIBDIR}/gnap-specs.tar.bz2"
+GNAP_CORE="${GNAP_LIBDIR}/gnap-core.tar"
+GNAP_MBR="${GNAP_LIBDIR}/mbr/mbr.bin"
+GNAP_EXTDIR="${GNAP_LIBDIR}/extensions"
+GNAP_BASEFS="${GNAP_LIBDIR}/gnap-basefs.tar.bz2"
+GNAP_TEMPDIR=''

-TEMPDIR=''
 LOOP=''
+FORCEYES=0

 G=$'\e[32;01m'
 B=$'\e[31;01m'
@@ -37,10 +38,10 @@
 	else
 		read -ep " ${W}*${N} ${*} [N]: " answer
 		if [[ "${answer}" != 'y' && "${answer}" != 'Y' ]]; then
-			if [[ -n "${TEMPDIR}" ]]; then
+			if [[ -n "${GNAP_TEMPDIR}" ]]; then
 				cleanup
 			fi
-			echo "${GNAPPRODUCT} aborted !"
+			echo "${GNAP_PRODUCT} aborted !"
 			exit 2
 		fi
 	fi
@@ -67,10 +68,10 @@
 			echo -en " ${B}*${N} ${*}"
 			echo -e "${E}  ${K}[ ${B}!!${K} ]${N}"
 		fi
-		if [[ -n "${TEMPDIR}" ]]; then
+		if [[ -n "${GNAP_TEMPDIR}" ]]; then
 			cleanup
 		fi
-		echo "${GNAPPRODUCT} failed, try ${GNAPNAME} -h for more help"
+		echo "${GNAP_PRODUCT} failed, try ${GNAP_NAME} -h for help"
 		exit 1
 	fi
 }
@@ -82,9 +83,9 @@
 		gtest $? "Failed to unmount ${LOOP}"
 	fi
 	gbegin 'Cleaning temporary directories'
-	if [[ -d "${TEMPDIR}" ]]; then
-		DIRTOREMOVE="${TEMPDIR}"
-		TEMPDIR=''
+	if [[ -d "${GNAP_TEMPDIR}" ]]; then
+		DIRTOREMOVE="${GNAP_TEMPDIR}"
+		GNAP_TEMPDIR=''
 		rm -rf "${DIRTOREMOVE}"
 		gtest $? "Failed to remove ${DIRTOREMOVE}"
 	else
@@ -93,13 +94,13 @@
 }

 make_tempdir() {
-	if [[ "${TEMPDIR}" = "" ]]; then
-		TEMPDIR=$(mktemp -d -t gnap_make.XXXXXX)
+	if [[ "${GNAP_TEMPDIR}" = "" ]]; then
+		GNAP_TEMPDIR=$(mktemp -d -t gnap_make.XXXXXX)
 		gtest continued $? 'Failed to create temporary directory'
-	elif [[ -d "${TEMPDIR}" ]]
-		gconfirm "${TEMPDIR} already exists. Continue?"
+	elif [[ -d "${GNAP_TEMPDIR}" ]]
+		gconfirm "${GNAP_TEMPDIR} already exists. Continue?"
 	else
-		mkdir -p "${TEMPDIR}"
-		gtest continued $? "Failed to create ${TEMPDIR}"
+		mkdir -p "${GNAP_TEMPDIR}"
+		gtest continued $? "Failed to create ${GNAP_TEMPDIR}"
 	fi
 }
Index: tools/gnap_overlay
===================================================================
--- tools/gnap_overlay	(revision 73)
+++ tools/gnap_overlay	(working copy)
@@ -2,15 +2,15 @@
 VERSION='2.0'

 source "gnap_shared.sh"
-echo "GNAP overlay tool ${GNAPNAME} ${VERSION}"
+echo "GNAP overlay tool ${GNAP_NAME} ${VERSION}"

 IMG_SIZE=15

 usage() {
 	echo
     echo 'Usage:'
-    echo "  ${GNAPNAME} -i isoname -o overlay [ options ]"
-    echo "  ${GNAPNAME} -d hostdisk -r rootdev -o overlay [ options ]"
+    echo "  ${GNAP_NAME} -i isoname -o overlay [ options ]"
+    echo "  ${GNAP_NAME} -d hostdisk -r rootdev -o overlay [ options ]"
     echo
     echo 'Common options:'
     echo '  -o overlay       Overlay directory or tbz2 file'
@@ -36,7 +36,7 @@
     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."
+    echo "Run man ${GNAP_NAME} for more details."
 }

 if [[ "$#" -eq 0 || "${1}" == '-h' ]]; then
@@ -47,11 +47,21 @@
 gbegin 'Checking parameters'

 # Read options
+OVERLAYS=''
+OVERLAYCONF=''
+NOLOGO=0
+OUTPUT=''
+TYPE=''
+CREATE=''
+TARGETROOT=''
+CACHE=''
+SERIAL=''
+BAUDRATE=''
 while getopts ':hg:o:c:nfi:d:l:r:ms:S:L:T:' options; do
 	case ${options} in
 		h ) usage
 			exit 0;;
-		g ) GNAPCORE="${OPTARG}";;
+		g ) GNAP_CORE="${OPTARG}";;
 		o ) OVERLAYS="${OVERLAYS} ${OPTARG}";;
 		c ) OVERLAYCONF="${OPTARG}";;
 		n ) NOLOGO=1;;
@@ -71,7 +81,7 @@
 		m ) CACHE='docache ';;
 		s ) SERIAL="console=ttyS0,${OPTARG}n81"
 			BAUDRATE="${OPTARG}";;
-		T ) TEMPDIR="${OPTARG}";;
+		T ) GNAP_TEMPDIR="${OPTARG}";;
 		* ) gtest 1 'Specified options are incomplete or unknown !';;
 	esac
 done
@@ -81,7 +91,7 @@
 gtest continued $? 'Please specify a target (-i or -d option)'

 # Core file is required
-test -f "${GNAPCORE}"
+test -f "${GNAP_CORE}"
 gtest continued $? 'Please specify a valid GNAP core file (-g option)'

 case "${TYPE}" in
@@ -111,7 +121,7 @@
 	gwarn 'Warning : you have selected disk install'
 	gwarn "Make sure you are root or have full access to ${OUTPUT}"
 	gwarn "${PARENTDEV} must have an MBR installed, run:"
-	gwarn "${W}dd if=${GNAPMBR} of=${PARENTDEV} bs=512 count=1${N} if needed"
+	gwarn "${W}dd if=${GNAP_MBR} of=${PARENTDEV} bs=512 count=1${N} if needed"
 	gwarn "${OUTPUT} must contain an active partition:"
 	gwarn " use ${W}fdisk ${PARENTDEV}${N} if needed"
 	gwarn "Current data on ${OUTPUT} will be ${B}destroyed${N} !"
@@ -122,15 +132,15 @@
 make_tempdir

 # Common actions
-gbegin "Expanding ${GNAPCORE} core"
-TEMPCOREDIR="${TEMPDIR}/core"
+gbegin "Expanding ${GNAP_CORE} core"
+TEMPCOREDIR="${GNAP_TEMPDIR}/core"
 mkdir "${TEMPCOREDIR}"
 gtest continued $? 'Failed to create core temporary subdirectory'
-tar x -C "${TEMPCOREDIR}" -f "${GNAPCORE}"
+tar x -C "${TEMPCOREDIR}" -f "${GNAP_CORE}"
 gtest $? 'Failed to extract core'

 gbegin 'Preparing overlay'
-TEMPOVERDIR="${TEMPDIR}/overlay"
+TEMPOVERDIR="${GNAP_TEMPDIR}/overlay"
 mkdir "${TEMPOVERDIR}"
 gtest $? 'Failed to create overlay temporary subdirectory'

@@ -250,7 +260,7 @@
 	gtest $?

 	gbegin "Mounting ${OUTPUT}"
-	TEMPMOUNTDIR="${TEMPDIR}/mount"
+	TEMPMOUNTDIR="${GNAP_TEMPDIR}/mount"
 	mkdir "${TEMPMOUNTDIR}"
 	gtest continued $? 'Failed to create mount temporary subdirectory'
 	mount -t msdos "${OUTPUT}" "${TEMPMOUNTDIR}"
@@ -289,7 +299,7 @@
 		image)
 			gbegin 'Preparing disk for boot'
 			syslinux -o "${offset}" "${ORIG_OUTPUT}" && \
-			dd if="${GNAPMBR}" of="${ORIG_OUTPUT}" bs=512 count=1 \
+			dd if="${GNAP_MBR}" of="${ORIG_OUTPUT}" bs=512 count=1 \
 				conv=notrunc >/dev/null 2>&1
 			gtest $?
 		;;
@@ -298,5 +308,5 @@

 # Successful finish
 cleanup
-echo 'Overlay successful !'
+echo "${GNAP_PRODUCT} successful !"
 exit 0
Index: tools/gnap_remaster
===================================================================
--- tools/gnap_remaster	(revision 73)
+++ tools/gnap_remaster	(working copy)
@@ -2,14 +2,14 @@
 VERSION='2.0'

 source "gnap_shared.sh"
-echo "GNAP remastering tool ${GNAPNAME} ${VERSION}"
+echo "GNAP remastering tool ${GNAP_NAME} ${VERSION}"

 OUTPUT='mygnap-core.tar'

 usage() {
 	echo
 	echo 'Usage:'
-	echo "  ${GNAPNAME} [ options ]"
+	echo "  ${GNAP_NAME} [ options ]"
 	echo
 	echo 'Options:'
 	echo '  -e extension    Extension to include in core file'
@@ -22,7 +22,7 @@
 	echo '  -f              Force all answers to yes (dangerous !)'
 	echo '  -T gnap_tempdir Use given temp dir'
 	echo
-	echo "Please man ${GNAPNAME} for more details."
+	echo "Use man ${GNAP_NAME} for more details."
 }

 if [[ "$#" -eq 0 || "${1}" == '-h' ]]; then
@@ -41,25 +41,25 @@
 		k ) KERNEXT="${OPTARG}";;
 		m ) MODEXT="${OPTARG}";;
 		o ) OUTPUT="${OPTARG}";;
-		g ) GNAPCORE="${OPTARG}";;
-		b ) GNAPBASEFS="${OPTARG}";;
-		d ) GNAPEXTDIR="${OPTARG}";;
+		g ) GNAP_CORE="${OPTARG}";;
+		b ) GNAP_BASEFS="${OPTARG}";;
+		d ) GNAP_EXTDIR="${OPTARG}";;
 		f ) FORCEYES=1;;
-		T ) TEMPDIR="${OPTARG}";;
+		T ) GNAP_TEMPDIR="${OPTARG}";;
 		* ) gtest 1 'Specified options are incomplete or unknown !';;
 	esac
 done

 # Root is needed
 test "${EUID}" -eq 0
-gtest continued $? "You need to be root to run ${GNAPNAME}"
+gtest continued $? "You need to be root to run ${GNAP_NAME}"

 # basefs file is required
-test -f "${GNAPBASEFS}"
+test -f "${GNAP_BASEFS}"
 gtest continued $? 'Please specify a valid GNAP basefs file (-b option)'

 # core file is required
-test -f "${GNAPCORE}"
+test -f "${GNAP_CORE}"
 gtest continued $? 'Please specify a valid GNAP core file (-g option)'

 # At least one operation is required
@@ -75,34 +75,34 @@
 make_tempdir

 # Preparing new FS
-gbegin "Unpacking ${GNAPBASEFS} basefs"
-TEMPOVERDIR="${TEMPDIR}/basefs"
+gbegin "Unpacking ${GNAP_BASEFS} basefs"
+TEMPOVERDIR="${GNAP_TEMPDIR}/basefs"
 mkdir "${TEMPOVERDIR}"
 gtest continued $? 'Failed to create basefs temporary subdirectory'

-tar jx -C "${TEMPOVERDIR}" -f "${GNAPBASEFS}"
+tar jx -C "${TEMPOVERDIR}" -f "${GNAP_BASEFS}"
 gtest $? 'Failed to unpack basefs'

 for overlay in ${EXTENSIONS} ; do
 	gbegin "Adding ${overlay} extension"
-	test -f "${GNAPEXTDIR}/gnapext_${overlay}.tbz2"
-	gtest continued $? "${GNAPEXTDIR}/gnapext_${overlay}.tbz2 does not exist"
-	tar jxf "${GNAPEXTDIR}/gnapext_${overlay}.tbz2" -C "${TEMPOVERDIR}"
+	test -f "${GNAP_EXTDIR}/gnapext_${overlay}.tbz2"
+	gtest continued $? "${GNAP_EXTDIR}/gnapext_${overlay}.tbz2 does not exist"
+	tar jxf "${GNAP_EXTDIR}/gnapext_${overlay}.tbz2" -C "${TEMPOVERDIR}"
 	gtest $? "${overlay} is not a valid extension (tbz2 format)"
 done

 # Preparing new core
 gbegin 'Extracting core tarball'
-TEMPCOREDIR="${TEMPDIR}/core"
+TEMPCOREDIR="${GNAP_TEMPDIR}/core"
 mkdir "${TEMPCOREDIR}"
 gtest continued $? 'Failed to create core temporary subdirectory'

-tar x -C "${TEMPCOREDIR}" -f "${GNAPCORE}" --exclude image.squashfs
+tar x -C "${TEMPCOREDIR}" -f "${GNAP_CORE}" --exclude image.squashfs
 gtest $? 'Failed to extract core'

 if [[ -f "${KERNEXT}" ]]; then
 	gbegin "Replacing kernel and initrd using ${KERNEXT}"
-	TEMPKERNDIR="${TEMPDIR}/kernel"
+	TEMPKERNDIR="${GNAP_TEMPDIR}/kernel"
 	mkdir "${TEMPKERNDIR}"
 	gtest continued $? 'Failed to create kernel temporary subdirectory'

@@ -136,6 +136,6 @@

 # Successful finish
 cleanup
-echo 'Remaster successful !'
+echo "${GNAP_PRODUCT} successful !"
 exit 0

Index: src/gnap_make
===================================================================
--- src/gnap_make	(revision 73)
+++ src/gnap_make	(working copy)
@@ -17,7 +17,7 @@
 	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."
+	echo "Use man ${GNAP_NAME} for more details."
 }

 if [[ "$#" -eq 0 || "${1}" == '-h' ]]; then
@@ -34,8 +34,8 @@
 	case ${options} in
 		h ) usage
 			exit 0;;
-		s ) STAGE3FILE="${OPTARG}";;
-		p ) SNAPSHOTFILE="${OPTARG}";;
+		s ) GNAP_STAGE3FILE="${OPTARG}";;
+		p ) GNAP_SNAPSHOTFILE="${OPTARG}";;
 		o ) PORTAGE_OVERLAYS="${PORTAGE_OVERLAYS} ${OPTARG}";;
 		v ) STAMP="${OPTARG}";;
 		t )
@@ -59,31 +59,31 @@
 		f ) FORCEYES=1;;
 		l ) GNAPLOGPREFIX="${OPTARG}";;
 		c ) CATALYST_CONF="${OPTARG}";;
-		e ) SPECS="${OPTARG}";;
-		T ) TEMPDIR="${OPTARG}";;
+		e ) GNAP_SPECS="${OPTARG}";;
+		T ) GNAP_TEMPDIR="${OPTARG}";;
 		* ) gtest 1 'Specified options are incomplete or unknown !';;
 	esac
 done

 # Root is needed
 test "${EUID}" -eq 0
-gtest continued $? "You need to be root to run ${GNAPNAME}"
+gtest continued $? "You need to be root to run ${GNAP_NAME}"

 # Setting up temporary directory
 make_tempdir

 # Prepare specs dir and check common.conf file
-SPECDIR="${TEMPDIR}/specs"
-if [[ -f "${SPECS}" ]]; then
+SPECDIR="${GNAP_TEMPDIR}/specs"
+if [[ -f "${GNAP_SPECS}" ]]; then
 	mkdir "${SPECDIR}"
 	gtest continued $? 'Failed to create specs temporary subdirectory'
-	tar jx -f "${SPECS}" -C "${SPECDIR}"
+	tar jx -f "${GNAP_SPECS}" -C "${SPECDIR}"
 	gtest continued $? 'Failed to unpack specs'
-elif [[ -d "${SPECS}" ]]; then
-	cp -rp "${SPECS}" "${SPECDIR}"
+elif [[ -d "${GNAP_SPECS}" ]]; then
+	cp -rp "${GNAP_SPECS}" "${SPECDIR}"
 	gtest continued $? 'Failed to copy specs directory contents'
 else
-	gtest continued 1 "${SPECS} not found, provide a valid -e option"
+	gtest continued 1 "${GNAP_SPECS} not found, provide a valid -e option"
 fi
 test -f "${SPECDIR}/common.conf"
 gtest continued $? "Incorrect specdir: ${SPECDIR}/common.conf not found !"
@@ -124,20 +124,20 @@

 # Stage3 needs a seed stage
 if [[ "${STAGE3}" -eq 1 ]]; then
-	test -f "${STAGE3FILE}"
+	test -f "${GNAP_STAGE3FILE}"
 	gtest continued $? 'The "-s" option needs to designate a valid seed stage'
 fi

 # Snapshot must exist if a stage is selected
 if [[ "${NEEDS_SNAPSHOT}" -eq 1 ]]; then
-	test -f "${SNAPSHOTFILE}"
-	gtest continued $? "Can't find ${SNAPSHOTFILE}"
+	test -f "${GNAP_SNAPSHOTFILE}"
+	gtest continued $? "Can't find ${GNAP_SNAPSHOTFILE}"
 fi

 # Seed stage if needed must be an existing file
 if [[ "${STAGE3}" -eq 1 ]]; then
-	test -f "${STAGE3FILE}"
-	gtest continued $? "${STAGE3FILE} is not a valid stage3 tarball"
+	test -f "${GNAP_STAGE3FILE}"
+	gtest continued $? "${GNAP_STAGE3FILE} is not a valid stage3 tarball"
 fi
 gtest 0

@@ -150,7 +150,7 @@
 		if [[ ! -d "${CATALYST_DIR}/builds/${RELTYPE}" ]]; then
 			mkdir -p "${CATALYST_DIR}/builds/${RELTYPE}"
 		fi
-		cp "${STAGE3FILE}" "${STAGE3LOC}"
+		cp "${GNAP_STAGE3FILE}" "${STAGE3LOC}"
 	fi
 fi

@@ -182,7 +182,7 @@

 # Logfile setup and confirmation
 if [[ -z "$GNAPLOGPREFIX" ]]; then
-	GNAPLOGPREFIX="./${GNAPNAME}-${STAMP}"
+	GNAPLOGPREFIX="./${GNAP_NAME}-${STAMP}"
 fi

 if [[ -f "${GNAPLOGPREFIX}.out" || -f "${GNAPLOGPREFIX}.err" ]]; then
@@ -208,14 +208,14 @@
 	fi

 	if [[ -z "${PORTAGE_OVERLAYS}" ]]; then
-		cp "${SNAPSHOTFILE}" "${CATALYST_DIR}/snapshots/portage-${STAMP}.tar.bz2"
+		cp "${GNAP_SNAPSHOTFILE}"
"${CATALYST_DIR}/snapshots/portage-${STAMP}.tar.bz2"
 		gtest $? "Snapshot preparation failed, ${SEELOGFILES}"
 	else
-		TEMPPRTDIR="${TEMPDIR}/portage"
+		TEMPPRTDIR="${GNAP_TEMPDIR}/portage"
 		mkdir "${TEMPPRTDIR}"
 		gtest continued $? 'Failed to create portage temporary subdirectory'

-		tar jxf "${SNAPSHOTFILE}" -C "${TEMPPRTDIR}" \
+		tar jxf "${GNAP_SNAPSHOTFILE}" -C "${TEMPPRTDIR}" \
 			>> "${GNAPLOGPREFIX}.out" 2>> "${GNAPLOGPREFIX}.err"

 		for overlay in ${PORTAGE_OVERLAYS} ; do
@@ -237,9 +237,9 @@
 	if [[ ! -d "${CATALYST_DIR}/builds/${RELTYPE}" ]]; then
 		mkdir -p "${CATALYST_DIR}/builds/${RELTYPE}"
 	fi
-	cp "${STAGE3FILE}" "${CATALYST_DIR}/builds/${RELTYPE}/seedstage.tar.bz2"
+	cp "${GNAP_STAGE3FILE}"
"${CATALYST_DIR}/builds/${RELTYPE}/seedstage.tar.bz2"

-	TEMPCONF="${TEMPDIR}/stage3.conf"
+	TEMPCONF="${GNAP_TEMPDIR}/stage3.conf"
 	touch "${TEMPCONF}"
 	gtest continued $? 'Failed to create stage3 temporary conf file'
 	cat >> "${TEMPCONF}" <<EOF
@@ -262,7 +262,7 @@
 # LIVECD-STAGE1 phase
 if [[ "${LIVECD1}" -eq 1 ]]; then
 	gbegin "${G}[livecd-stage1]${N} stage (GNAP-specific packages build)"
-	TEMPCONF="${TEMPDIR}/livecd-stage1.conf"
+	TEMPCONF="${GNAP_TEMPDIR}/livecd-stage1.conf"
 	touch "${TEMPCONF}"
 	gtest continued $? 'Failed to create livecd-stage1 temporary conf file'
 	cat >> "${TEMPCONF}" <<EOF
@@ -286,7 +286,7 @@
 # LIVECD-STAGE2 phase
 if [[ "${LIVECD2}" -eq 1 ]]; then
 	gbegin "${G}[livecd-stage2]${N} stage (kernel and LiveCD builds)"
-	TEMPCONF="${TEMPDIR}/livecd-stage2.conf"
+	TEMPCONF="${GNAP_TEMPDIR}/livecd-stage2.conf"
 	touch "${TEMPCONF}"
 	gtest continued $? 'Failed to create livecd-stage2 temporary conf file'
 	cat >> "${TEMPCONF}" <<EOF
@@ -321,10 +321,10 @@
 	gtest $? 'Missing livecd-stage2 results'

 	gbegin '  Creating core component'
-	TEMPMNTDIR="${TEMPDIR}/mount"
+	TEMPMNTDIR="${GNAP_TEMPDIR}/mount"
 	mkdir "${TEMPMNTDIR}"
 	gtest continued $? 'Failed to create mount temporary subdirectory'
-	TEMPISODIR="${TEMPDIR}/iso"
+	TEMPISODIR="${GNAP_TEMPDIR}/iso"
 	mkdir "${TEMPISODIR}"
 	gtest continued $? 'Failed to create iso temporary subdirectory'

@@ -368,7 +368,7 @@
 		mod_packlist="${mod_packlist/${mod_name}\/packlist:/}"
 		mod_cleanup=$(grep "^${mod_name}/cleanup:" ${SPECMODULE} 2>/dev/null);
 		mod_cleanup="${mod_cleanup/${mod_name}\/cleanup:/}"
-		TEMPCONF="${TEMPDIR}/ext-${mod_name}.conf"
+		TEMPCONF="${GNAP_TEMPDIR}/ext-${mod_name}.conf"
 		touch "${TEMPCONF}"
 		gtest continued $? 'Failed to create extension temporary conf file'
 		cat >> $TEMPCONF <<EOF
@@ -391,7 +391,7 @@
 		gtest continued $? \
 			"Extension build failed, ${SEELOGFILES}"

-		TEMPMODULEDIR="${TEMPDIR}/module_${mod_name}"
+		TEMPMODULEDIR="${GNAP_TEMPDIR}/module_${mod_name}"
 		mkdir "${TEMPMODULEDIR}"
 		gtest continued $? 'Failed to create module temporary subdirectory'
 		for pkg in $( ls ${GRP_PREFIX}/${mod_name}/All/*.tbz2 ); do
@@ -416,5 +416,5 @@
 fi

 cleanup
-echo 'Build successful !'
+echo "${GNAP_PRODUCT} successful !"
 exit 0
Index: src/gnap_shared.sh
===================================================================
--- src/gnap_shared.sh	(revision 73)
+++ src/gnap_shared.sh	(working copy)
@@ -1,23 +1,24 @@
-GNAPNAME=$(basename "$0")
+GNAP_NAME=$(basename "$0")

-case ${GNAPNAME} in
-	gnap_make )     GNAPPRODUCT="Build";;
-	gnap_overlay )  GNAPPRODUCT="Overlay";;
-	gnap_remaster ) GNAPPRODUCT="Remaster";;
-	* )             GNAPPRODUCT="Something";;
+case ${GNAP_NAME} in
+	gnap_make )     GNAP_PRODUCT="Build";;
+	gnap_overlay )  GNAP_PRODUCT="Overlay";;
+	gnap_remaster ) GNAP_PRODUCT="Remaster";;
+	* )             GNAP_PRODUCT="Something";;
 esac

-GNAPLIBDIR='/usr/lib/gnap'
-STAGE3FILE="${GNAPLIBDIR}/gnap-stage3seed.tar.bz2"
-SNAPSHOTFILE="${GNAPLIBDIR}/gnap-portagesnapshot.tar.bz2"
-SPECS="${GNAPLIBDIR}/gnap-specs.tar.bz2"
-GNAPCORE="${GNAPLIBDIR}/gnap-core.tar"
-GNAPMBR="${GNAPLIBDIR}/mbr/mbr.bin"
-GNAPEXTDIR="${GNAPLIBDIR}/extensions"
-GNAPBASEFS="${GNAPLIBDIR}/gnap-basefs.tar.bz2"
+GNAP_LIBDIR='/usr/lib/gnap'
+GNAP_STAGE3FILE="${GNAP_LIBDIR}/gnap-stage3seed.tar.bz2"
+GNAP_SNAPSHOTFILE="${GNAP_LIBDIR}/gnap-portagesnapshot.tar.bz2"
+GNAP_SPECS="${GNAP_LIBDIR}/gnap-specs.tar.bz2"
+GNAP_CORE="${GNAP_LIBDIR}/gnap-core.tar"
+GNAP_MBR="${GNAP_LIBDIR}/mbr/mbr.bin"
+GNAP_EXTDIR="${GNAP_LIBDIR}/extensions"
+GNAP_BASEFS="${GNAP_LIBDIR}/gnap-basefs.tar.bz2"
+GNAP_TEMPDIR=''

-TEMPDIR=''
 LOOP=''
+FORCEYES=0

 G=$'\e[32;01m'
 B=$'\e[31;01m'
@@ -37,10 +38,10 @@
 	else
 		read -ep " ${W}*${N} ${*} [N]: " answer
 		if [[ "${answer}" != 'y' && "${answer}" != 'Y' ]]; then
-			if [[ -n "${TEMPDIR}" ]]; then
+			if [[ -n "${GNAP_TEMPDIR}" ]]; then
 				cleanup
 			fi
-			echo "${GNAPPRODUCT} aborted !"
+			echo "${GNAP_PRODUCT} aborted !"
 			exit 2
 		fi
 	fi
@@ -67,10 +68,10 @@
 			echo -en " ${B}*${N} ${*}"
 			echo -e "${E}  ${K}[ ${B}!!${K} ]${N}"
 		fi
-		if [[ -n "${TEMPDIR}" ]]; then
+		if [[ -n "${GNAP_TEMPDIR}" ]]; then
 			cleanup
 		fi
-		echo "${GNAPPRODUCT} failed, try ${GNAPNAME} -h for more help"
+		echo "${GNAP_PRODUCT} failed, try ${GNAP_NAME} -h for help"
 		exit 1
 	fi
 }
@@ -82,9 +83,9 @@
 		gtest $? "Failed to unmount ${LOOP}"
 	fi
 	gbegin 'Cleaning temporary directories'
-	if [[ -d "${TEMPDIR}" ]]; then
-		DIRTOREMOVE="${TEMPDIR}"
-		TEMPDIR=''
+	if [[ -d "${GNAP_TEMPDIR}" ]]; then
+		DIRTOREMOVE="${GNAP_TEMPDIR}"
+		GNAP_TEMPDIR=''
 		rm -rf "${DIRTOREMOVE}"
 		gtest $? "Failed to remove ${DIRTOREMOVE}"
 	else
@@ -93,13 +94,13 @@
 }

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

-- 
gnap-dev@g.o mailing list


References:
Some patches for gnap
-- Philipp Riegger
Navigation:
Lists: gnap-dev: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
07-split-make_tempdir.patch
Next by thread:
09-cleanup-gnap_make.patch
Previous by date:
07-split-make_tempdir.patch
Next by date:
09-cleanup-gnap_make.patch


Updated Jun 17, 2009

Summary: Archive of the gnap-dev mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.