diff options
Diffstat (limited to 'sysprep/sysprep_operation_script.ml')
| -rw-r--r-- | sysprep/sysprep_operation_script.ml | 14 |
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 |
