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@g.o mailing list
|