Check losetup capabilities before specifying to mount as read-only.
authorChris Lamb <chris@chris-lamb.co.uk>
Sun, 15 Jun 2008 04:30:42 +0000 (05:30 +0100)
committerDaniel Baumann <daniel@debian.org>
Wed, 9 Mar 2011 16:48:00 +0000 (17:48 +0100)
This is to retain compatibility with Etch's non-loop-aes-utils' losetup.

scripts/live
scripts/live-helpers

index 3f39c97..ee363c3 100755 (executable)
@@ -1008,7 +1008,12 @@ setup_unionfs ()
                        rofslist="${image} ${rofslist}"
                elif [ -f "${image}" ]
                then
-                       backdev=$(get_backing_device "${image}" "-r")
+                       if /sbin/losetup --help 2>&1 | grep -q -- "-r\b"
+                       then
+                               backdev=$(get_backing_device "${image}" "-r")
+                       else
+                               backdev=$(get_backing_device "${image}")
+                       fi
                        fstype=$(get_fstype "${backdev}")
 
                        if [ "${fstype}" = "unknown" ]
index 02c3e55..20952f3 100644 (file)
@@ -181,7 +181,10 @@ setup_loop ()
 
                        if [ -n ${readonly} ]
                        then
-                               options="${options} -r"
+                               if /sbin/losetup --help 2>&1 | grep -q -- "-r\b"
+                               then
+                                       options="${options} -r"
+                               fi
                        fi
 
                        if [ 0 -lt "${offset}" ]