]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dmsquash-live-root cleanups/mini-fixes
authorWill Woods <wwoods@redhat.com>
Mon, 1 Aug 2011 20:21:07 +0000 (16:21 -0400)
committerHarald Hoyer <harald@redhat.com>
Fri, 12 Aug 2011 06:03:55 +0000 (08:03 +0200)
- use last ro/rw cmdline arg rather than favoring 'rw' over 'ro'
- don't bother with useless RES variable for holding $?
- only do fs check when $livedev is a block device

Signed-off-by: Will Woods <wwoods@redhat.com>
modules.d/90dmsquash-live/dmsquash-live-root

index 4d1d9024a7a5981e8420553fdb97e046239403b9..a76cbc7aae9c29ed6a149547c1368302a8b1ad47 100755 (executable)
@@ -25,7 +25,8 @@ getargbool 0 rd.live.overlay.reset -y reset_overlay && reset_overlay="yes"
 getargbool 0 rd.live.overlay.readonly -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
 overlay=$(getarg rd.live.overlay overlay)
 
-[ -e $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
+# CD/DVD media check
+[ -b $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
 if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
     check="yes"
 fi
@@ -40,9 +41,7 @@ if [ -n "$check" ]; then
     [ -x /bin/plymouth ] && /bin/plymouth --show-splash
 fi
 
-getarg ro && liverw=ro
-getarg rw && liverw=rw
-[ -z "$liverw" ] && liverw=ro
+for arg in $CMDLINE; do case $arg in ro|rw) liverw=$arg ;; esac; done
 # mount the backing of the live image first
 mkdir -m 0755 -p /run/initramfs/live
 if [ -f $livedev ]; then
@@ -52,9 +51,8 @@ if [ -f $livedev ]; then
         *ext3fs.img|*rootfs.img) FSIMG=$livedev ;;
     esac
 else
-    mount -n -t $fstype -o $liverw $livedev /run/initramfs/live
-    RES=$?
-    if [ "$RES" != "0" ]; then
+    mount -n -t $fstype -o ${liverw:-ro} $livedev /run/initramfs/live
+    if [ "$?" != "0" ]; then
         die "Failed to mount block device of live image"
         exit 1
     fi