topdir=$(dirname $(readlink -f $BASH_SOURCE))
exampledir=$(cd $topdir/../examples; pwd)
functions=${topdir}/functions
-tmpdir=$HOME/fueltmp
# Define common functions
. ${functions}/common.sh
exit 1
fi
-# Setup tmpdir
+# Setup tmpdir - if TMPDIR env variable is set, use that one
+# else create in $HOME/fueltmp
+if [ -n "${TMPDIR}" ]; then
+ if [ -d ${TMPDIR} ]; then
+ tmpdir=${TMPDIR}/fueltmp
+ echo "Using TMPDIR=${TMPDIR}, so tmpdir=${tmpdir}"
+ else
+ error_exit "No such directory for TMPDIR: ${TMPDIR}"
+ fi
+else
+ tmpdir=${HOME}/fueltmp
+ echo "Default: tmpdir=$tmpdir"
+fi
+
+# Umask must be changed so files created are readable by qemu
+umask 0022
+
if [ -d $tmpdir ]; then
rm -Rf $tmpdir || error_exit "Could not remove tmpdir $tmpdir"
fi
if [ ! -f $isofile ]; then
error_exit "Could not find ISO file $isofile"
elif [ ! -f $deafile ]; then
- error-exit "Could not find DEA file $deafile"
+ error_exit "Could not find DEA file $deafile"
elif [ ! -f $dhafile ]; then
- error-exit "Could not find DHA file $dhafile"
+ error_exit "Could not find DHA file $dhafile"
fi
# Connect adapter
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-# This is a temporary script - this should be rolled into a separate
-# build target "make ci-iso" instead!
-
exit_handler() {
rm -Rf $tmpnewdir
fusermount -u $tmporigdir 2>/dev/null
- test -d $tmporigdir && mdir $tmporigdir
+ test -d $tmporigdir && rmdir $tmporigdir
}
trap exit_handler exit
fuelHostname=$7
fuelDns=$8
-tmporigdir=/${tmpdir}/origiso
-tmpnewdir=/${tmpdir}/newiso
+tmporigdir=${tmpdir}/origiso
+tmpnewdir=${tmpdir}/newiso
test -f $origiso || error_exit "Could not find origiso $origiso"
test -d $tmpdir || error_exit "Could not find tmpdir $tmpdir"
fi
echo "Copying..."
-rm -Rf $tmporigdir $tmpnewdir
+rm -Rf $tmpnewdir || error_exit "Failed deleting old ISO copy dir"
mkdir -p $tmporigdir $tmpnewdir
-fuseiso $origiso $tmporigdir || error_exit "Failed fuseiso"
+fuseiso $origiso $tmporigdir || error_exit "Failed to FUSE mount ISO"
cd $tmporigdir
-find . | cpio -pd $tmpnewdir
+find . | cpio -pd $tmpnewdir || error_exit "Failed to copy FUSE ISO with cpio"
cd $tmpnewdir
-fusermount -u $tmporigdir
-rmdir $tmporigdir
-chmod -R 755 $tmpnewdir
+fusermount -u $tmporigdir || error_exit "Failed to FUSE unmount ISO"
+rmdir $tmporigdir || error_exit "Failed to delete original FUSE ISO directory"
+chmod -R 755 $tmpnewdir || error_exit "Failed to set protection on new ISO dir"
echo "Patching..."
cd $tmpnewdir