[Ovirt-devel] [PATCH node-image] edit-livecd: Retry upon failed umount.

Jim Meyering jim at meyering.net
Tue Dec 2 17:10:11 UTC 2008


This is useful when you manually edit an image and forget to "cd"
out of the working directory.  Without this, the script can't
clean up, and it's a pain to do manually.

---
 edit-livecd |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/edit-livecd b/edit-livecd
index c122eee..ce9e65b 100755
--- a/edit-livecd
+++ b/edit-livecd
@@ -141,8 +141,20 @@ else
     echo "***"
     read
 fi
-echo ">>> Unmounting ext3fs"
-umount $WDIR/ex
+
+# Try to unmount.  But this is likely to fail, so let the user retry,
+# e.g., if he forgot to "cd" out of $WDIR/ex.
+while :; do
+  echo ">>> Unmounting ext3fs"
+  umount $WDIR/ex && break
+  echo ">>> Unmounting ext3fs failed"
+  echo "***"
+  echo "*** Did you forget to 'cd' out of $WDIR/ex?"
+  echo "***"
+  echo "*** Press any key to repeat the attempt."
+  echo "***"
+  read
+done

 echo ">>> Compressing filesystem"
 mksquashfs $WDIR/sq-w/ $WDIR/cd-w/LiveOS/squashfs.img -noappend
--
1.6.1.rc1.279.g45d11




More information about the ovirt-devel mailing list