[Fedora-livecd-list] [PATCH] Handle the case when the kernel can't mount squashfs.img (probably a mksquashfs/running kernel mismatch).

Alexander Boström abo at stacken.kth.se
Wed Mar 25 20:33:58 UTC 2009


Hi,

The loop mount of the squashfs from rawhide images fails for me on F10, 
which makes livecd-iso-to-disk exit without cleaning up (unmounting etc.).

This make iso-to-disk handle the error and also makes it do almost what 
the user asked by copying the squashfs as-is. Maybe it should clean up 
and exit instead, telling the user to remove --skipcompress or add 
--compress after --xo or something like that...

/abo

---
  tools/livecd-iso-to-disk.sh |   16 ++++++++++++----
  1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index f0c7331..4621d45 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -462,9 +462,17 @@ else
  fi
  livesize=$(du -s -B 1M $check | awk {'print $1;'})
  if [ -n "$skipcompress" ]; then
-    mount -o loop $CDMNT/LiveOS/squashfs.img $CDMNT
-    livesize=$(du -s -B 1M $CDMNT/LiveOS/ext3fs.img | awk {'print $1;'})
-    umount $CDMNT
+    if [ -e $CDMNT/LiveOS/squashfs.img ]; then
+	if mount -o loop $CDMNT/LiveOS/squashfs.img $CDMNT; then
+	    livesize=$(du -s -B 1M $CDMNT/LiveOS/ext3fs.img | awk {'print $1;'})
+	    umount $CDMNT
+	else
+	    echo "WARNING: --skipcompress or --xo was specified but the currently"
+	    echo "running kernel can not mount the squashfs from the ISO file
to extract"
+	    echo "it. The compressed squashfs will be copied to the USB stick."
+	    skipcompress=""
+	fi
+    fi
  fi
  free=$(df  -B1M $USBDEV  |tail -n 1 |awk {'print $4;'})

@@ -505,7 +513,7 @@ if [ -z "$skipcopy" ];then
    [ ! -d $USBMNT/$LIVEOS ] && mkdir $USBMNT/$LIVEOS
    [ -n "$keephome" -a -f "$USBMNT/$HOMEFILE" ] && mv $USBMNT/$HOMEFILE
$USBMNT/$LIVEOS/$HOMEFILE
    if [ -n "$skipcompress" -a -f $CDMNT/LiveOS/squashfs.img ]; then
-      mount -o loop $CDMNT/LiveOS/squashfs.img $CDMNT
+      mount -o loop $CDMNT/LiveOS/squashfs.img $CDMNT || exitclean
        cp $CDMNT/LiveOS/ext3fs.img $USBMNT/$LIVEOS/ext3fs.img ||
(umount $CDMNT ; exitclean)
        umount $CDMNT
    elif [ -f $CDMNT/LiveOS/squashfs.img ]; then




More information about the Fedora-livecd-list mailing list