summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJybz <j.biernacki@free.fr>2024-04-20 22:36:32 +0200
committerJybz <j.biernacki@free.fr>2024-04-20 22:36:32 +0200
commit39c4645c4ba9c0b98dd3c5e4eedd9445b38414b6 (patch)
tree7615cea1c1844530b864adbcc667358aff69fc93
parent38b4b5765362257e21b06e06f612cd764d4a3f6b (diff)
downloadmageia-dracut-conf-39c4645c4ba9c0b98dd3c5e4eedd9445b38414b6.tar
mageia-dracut-conf-39c4645c4ba9c0b98dd3c5e4eedd9445b38414b6.tar.gz
mageia-dracut-conf-39c4645c4ba9c0b98dd3c5e4eedd9445b38414b6.tar.bz2
mageia-dracut-conf-39c4645c4ba9c0b98dd3c5e4eedd9445b38414b6.tar.xz
mageia-dracut-conf-39c4645c4ba9c0b98dd3c5e4eedd9445b38414b6.zip
Updated to handle /dev/disk/by-label linking to base device, not first partition (mga#27638).
- origin: https://svnweb.mageia.org/packages/cauldron/dracut/current/SOURCES/0511-mgalive-A-module-to-mount-Mageia-Live-media.patch?r1=1559144&r2=1649586 - mgalive: handle /dev/disk/by-label linking to base device, not 1st partition (mga#27638)
-rwxr-xr-xmodules.d/90mgalive/mgalive-root.sh33
1 files changed, 24 insertions, 9 deletions
diff --git a/modules.d/90mgalive/mgalive-root.sh b/modules.d/90mgalive/mgalive-root.sh
index 347c676..e5dd177 100755
--- a/modules.d/90mgalive/mgalive-root.sh
+++ b/modules.d/90mgalive/mgalive-root.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/sh
. /lib/dracut-lib.sh
@@ -54,25 +54,40 @@ else
overlay=$livedev$overlay
fi
+# If the base device is partitioned (i.e. it's a USB stick, not a DVD), get the
+# device name and start offset of the first partition. This is the protective
+# partition covering the iso9660 filesystem.
+if [ $livedev = $basedev ] ; then
+ ps=0
+ case $basedev in
+ /dev/sd*)
+ test -b ${basedev}1 && livedev=${basedev}1 && ps=$(partx -go START $livedev)
+ ;;
+ /dev/mmblk*)
+ test -b ${basedev}p1 && livedev=${basedev}p1 && ps=$(partx -go START $livedev)
+ ;;
+ esac
+else
+ ps=$(partx -go START $livedev)
+fi
+
info "mgalive basedev is $basedev"
info "mgalive livedev is $livedev"
info "mgalive basedir is $basedir/"
info "mgalive overlay is $overlay"
media=$livedev
-if [ $livedev = $basedev ] ; then
- ps=0
-else
- ps=$(partx -go START $livedev)
-fi
+
if [ $ps -ne 0 ] ; then
if strstr "$(blkid $basedev)" "iso9660" ; then
# This happens when we boot from a USB stick with a isohybrid partition
# scheme where the first sector is unclaimed, so the first partition starts
# at sector 1. The iso9660 filesystem starts at sector 0, so blkid doesn't
- # detect a valid filesystem in the first partition. udev, however, links
+ # detect a valid filesystem in the first partition. In the past, udev linked
# the entry in /dev/disk/by-label to the first partition, not to the raw
- # device, and that is what we get passed in $1 (mga#3334).
+ # device, and that is what we got passed in $1 (mga#3334). More recently,
+ # udev links it to the base device (mga#27629). The preceding tests ensure
+ # we handle both cases.
if [ -n "$overlay" ] ; then
# If we mount the raw device, we can't then also mount a partition
# on that device. So to enable persistence, we need to extend the
@@ -91,7 +106,7 @@ if [ $ps -ne 0 ] ; then
media=$basedev
fi
else
- info "$livedev does not contain a valid filesystem"
+ info "$basedev does not contain a valid filesystem"
fi
fi