summaryrefslogtreecommitdiffstats
path: root/sysprep/sysprep_operation_script.ml
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-04-01 20:00:28 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-04-01 20:00:28 +0100
commitb1f997164ef6c34dbcdefdd7c7ee044255f83333 (patch)
tree4202d5f44eb6fe8e01b0222595dff267554c40b9 /sysprep/sysprep_operation_script.ml
parentde656448f7949d2b04e75455d5a2233d0c5856b9 (diff)
sysprep: script: Miscellaneous fixes and cleanups to shell script.
Diffstat (limited to 'sysprep/sysprep_operation_script.ml')
-rw-r--r--sysprep/sysprep_operation_script.ml14
1 files changed, 11 insertions, 3 deletions
diff --git a/sysprep/sysprep_operation_script.ml b/sysprep/sysprep_operation_script.ml
index 5e47733b..044fd784 100644
--- a/sysprep/sysprep_operation_script.ml
+++ b/sysprep/sysprep_operation_script.ml
@@ -83,16 +83,24 @@ and run_scripts mp scripts =
let cmd =
sprintf "\
set -e
-sysprep_unmount ()
+#set -x
+cleanup ()
{
+ status=$?
cd /
count=10
- while ! fusermount -u %s && [ $count -gt 0 ]; do
+ while ! fusermount -u %s >/dev/null 2>&1 && [ $count -gt 0 ]; do
sleep 1
((count--))
done
+ if [ $count -eq 0 ]; then
+ echo \"fusermount: failed to unmount directory\" %s >&2
+ exit 1
+ fi
+ exit $status
}
-trap sysprep_unmount INT TERM QUIT EXIT ERR\n" (Filename.quote mp) ^
+trap cleanup INT TERM QUIT EXIT ERR\n"
+ (Filename.quote mp) (Filename.quote mp) ^
String.concat "\n" scripts in
let args = [| sh; "-c"; cmd |] in