diff options
author | Jybz <j.biernacki@free.fr> | 2024-04-20 20:57:06 +0200 |
---|---|---|
committer | Jybz <j.biernacki@free.fr> | 2024-04-20 20:57:06 +0200 |
commit | fcfb11e19a88ca8c6ae09bb8c4cc4105c70107dd (patch) | |
tree | 3994dc217c6d7c825d5086e81037f0f61ff0fde6 /modules.d | |
parent | 245782034beafe9db0aee6c27a9d5abd075b64c6 (diff) | |
download | mageia-dracut-conf-fcfb11e19a88ca8c6ae09bb8c4cc4105c70107dd.tar mageia-dracut-conf-fcfb11e19a88ca8c6ae09bb8c4cc4105c70107dd.tar.gz mageia-dracut-conf-fcfb11e19a88ca8c6ae09bb8c4cc4105c70107dd.tar.bz2 mageia-dracut-conf-fcfb11e19a88ca8c6ae09bb8c4cc4105c70107dd.tar.xz mageia-dracut-conf-fcfb11e19a88ca8c6ae09bb8c4cc4105c70107dd.zip |
Updated to support persistance and multi-boot USB sticks.
- origin:
https://svnweb.mageia.org/packages/updates/9/dracut/current/SOURCES/0511-mgalive-A-module-to-mount-Mageia-Live-media.patch?r1=1191157&r2=1231609
Diffstat (limited to 'modules.d')
-rwxr-xr-x | modules.d/90mgalive/mgalive-parse.sh | 4 | ||||
-rwxr-xr-x | modules.d/90mgalive/mgalive-root.sh | 65 |
2 files changed, 53 insertions, 16 deletions
diff --git a/modules.d/90mgalive/mgalive-parse.sh b/modules.d/90mgalive/mgalive-parse.sh index 7952957..8cc9ef7 100755 --- a/modules.d/90mgalive/mgalive-parse.sh +++ b/modules.d/90mgalive/mgalive-parse.sh @@ -18,6 +18,10 @@ case "$liveroot" in root="$(echo $root | sed 's,/,\\x2f,g')" root="mgalive:/dev/disk/by-label/${root#LABEL=}" rootok=1 ;; + mgalive:UUID=*|UUID=*) \ + root="${root#mgalive:}" + root="mgalive:/dev/disk/by-uuid/${root#UUID=}" + rootok=1 ;; esac info "root was $liveroot, is now $root" diff --git a/modules.d/90mgalive/mgalive-root.sh b/modules.d/90mgalive/mgalive-root.sh index 1a36c70..584dccc 100755 --- a/modules.d/90mgalive/mgalive-root.sh +++ b/modules.d/90mgalive/mgalive-root.sh @@ -9,35 +9,68 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin [ -z "$1" ] && exit 1 livedev="$1" -# create live tree +# Create live tree mkdir -m 0755 -p /live/distrib mkdir -m 0755 -p /live/media -mkdir -m 0755 -p /live/tmpfs +mkdir -m 0755 -p /live/overlay mkdir -m 0755 -p /live/union mkdir -m 0755 -p /run/mgalive/ovlsize -# fix udev isohybrid LABEL issues (mga #3334) -# by reading the device we get, stripping away partition number, -# and mount the resulting device -realdev=$(echo $livedev |sed 's,\(/dev/sd[a-z]\)1,\1,g') +# Get the base device name +basedev=$(echo $livedev | sed 's,\(/dev/sd[a-z]\)1,\1,g') -# mount the live media -getargbool 0 UEFI && liveuefi="yes" -if [ -n "$liveuefi" ]; then - mount -n -t vfat -o ro $livedev /live/media +# Get the base directory for locating the loopback file. In normal use this is +# the root directory, but a multi-boot USB stick may want to override this. +basedir=$(getarg mgalive.basedir) + +# Get the device or path used for persistant storage (if it exists). In normal +# use this is another partition on the same base device, but a multi-boot USB +# stick may want to override this. +overlay=$(getarg mgalive.overlay) +if [ -z "$overlay" ] ; then + overlay=`blkid -t LABEL=mgalive-persist -o device | grep $basedev` +else + overlay=$livedev$overlay +fi + +if [ -z "$basedir" -a -z "$overlay" ] ; then + # Fix udev isohybrid LABEL issues (mga #3334) + # (things have moved on - this may not be needed now) + media=$basedev else - mount -n -t iso9660 -o ro $realdev /live/media + media=$livedev fi +info "mgalive basedev is $basedev" +info "mgalive livedev is $livedev" +info "mgalive basedir is $basedir/" +info "mgalive overlay is $overlay" + +# Mount the live media +mount -n -o ro $media /live/media + +# Mount the loopback filesystem LOOPDEV=$( losetup -f ) -losetup -r $LOOPDEV /live/media/loopbacks/distrib-lzma.sqfs +if [ -e /live/media$basedir/loopbacks/distrib-lzma.sqfs ] ; then + # Retain support for the original draklive. Note that despite the file + # name, it uses xz compression. + losetup -r $LOOPDEV /live/media$basedir/loopbacks/distrib-lzma.sqfs +else + losetup -r $LOOPDEV /live/media$basedir/loopbacks/distrib.sqfs +fi mount -n -t squashfs -o ro $LOOPDEV /live/distrib mount -n -t squashfs -o ro $LOOPDEV /run/mgalive/ovlsize -mount -n -t tmpfs -o mode=755 /live/tmpfs /live/tmpfs + +# Mount the overlay filesystem +if [ -z "$overlay" ] ; then + mount -n -t tmpfs -o mode=755 none /live/overlay +else + mount -n -o noatime $overlay /live/overlay +fi # work and memory must be on same root -mkdir -m 0755 -p /live/tmpfs/work -mkdir -m 0755 -p /live/tmpfs/memory -mount -n -t overlay overlay -o lowerdir=/live/distrib,upperdir=/live/tmpfs/memory,workdir=/live/tmpfs/work /live/union +mkdir -m 0755 -p /live/overlay/work +mkdir -m 0755 -p /live/overlay/memory +mount -n -t overlay overlay -o lowerdir=/live/distrib,upperdir=/live/overlay/memory,workdir=/live/overlay/work,noatime /live/union ln -s /live/union /dev/root |