summaryrefslogtreecommitdiffstats
path: root/fuel/prototypes/auto-deploy/deploy/functions/patch-iso.sh
diff options
context:
space:
mode:
authorStefan K. Berg <stefan.k.berg@ericsson.com>2015-05-19 10:14:43 +0200
committerStefan K. Berg <stefan.k.berg@ericsson.com>2015-05-19 10:55:02 +0200
commit14674941d0e504a942886d36749a0f64490e4ade (patch)
tree2d5268a69f1d329c31afb84f8263959851802b90 /fuel/prototypes/auto-deploy/deploy/functions/patch-iso.sh
parentd3995f1df04dc64aba37d70309899f556982aac1 (diff)
Deployment corrections for Fuel
The most important change is the introduction of support for a selectable temporary directory for ISO manipulations by setting the TMPDIR variable. Invoke deploy.sh as "sudo TMPDIR=/my/tmp/dir ./deploy.sh ..." to make use of this, otherwise the temporary directory defaults to that of the user running the script. Other improvements: - Added error check for when the patch-iso.sh gets an error from copying data with cpio (potentially indicating out of disk space) - Corrected typo in deploy.sh: error-exit -> error_exit JIRA Change-Id: I74966c3fe2bee0ac1923cfa9bd9ebfe1ca73a9da Signed-off-by: Stefan K. Berg <stefan.k.berg@ericsson.com>
Diffstat (limited to 'fuel/prototypes/auto-deploy/deploy/functions/patch-iso.sh')
-rwxr-xr-xfuel/prototypes/auto-deploy/deploy/functions/patch-iso.sh21
1 files changed, 9 insertions, 12 deletions
diff --git a/fuel/prototypes/auto-deploy/deploy/functions/patch-iso.sh b/fuel/prototypes/auto-deploy/deploy/functions/patch-iso.sh
index 933281f..d27dcdf 100755
--- a/fuel/prototypes/auto-deploy/deploy/functions/patch-iso.sh
+++ b/fuel/prototypes/auto-deploy/deploy/functions/patch-iso.sh
@@ -9,13 +9,10 @@
# 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
@@ -39,8 +36,8 @@ fuelGateway=$6
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"
@@ -51,15 +48,15 @@ if [ "`whoami`" != "root" ]; then
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