Commit 0468a748 authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Make helper try to umount $target on errors

Since the mount and umount commands are tasks, if a task fails, the
filesystem may have been left mounted. For this case, I've created a
trap that tries to umount the filesystem
parent aac16418
...@@ -67,6 +67,10 @@ if [ -z "$RUN_PARTS" ]; then ...@@ -67,6 +67,10 @@ if [ -z "$RUN_PARTS" ]; then
log_error "run-parts programe is missing from the system" log_error "run-parts programe is missing from the system"
fi fi
# If something goes wrong with the tasks, try to umount the target filesystem
# in case it is left mounted...
trap '{ umount $target; }' ERR
echo "Execute all snf-image tasks...." echo "Execute all snf-image tasks...."
$RUN_PARTS -v --exit-on-error "@tasksdir@" $RUN_PARTS -v --exit-on-error "@tasksdir@"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment