summaryrefslogtreecommitdiffstats
path: root/modules.d
diff options
context:
space:
mode:
authorThomas Backlund <tmb@mageia.org>2013-10-19 19:27:20 +0100
committerJybz <j.biernacki@free.fr>2024-04-20 21:21:03 +0200
commit1ed60d25874839c7cc477210754ffd752c2cd797 (patch)
tree69bc601c772d9ed7a8dd9586f80b51beeef8d508 /modules.d
parentfcfb11e19a88ca8c6ae09bb8c4cc4105c70107dd (diff)
downloadmageia-dracut-conf-1ed60d25874839c7cc477210754ffd752c2cd797.tar
mageia-dracut-conf-1ed60d25874839c7cc477210754ffd752c2cd797.tar.gz
mageia-dracut-conf-1ed60d25874839c7cc477210754ffd752c2cd797.tar.bz2
mageia-dracut-conf-1ed60d25874839c7cc477210754ffd752c2cd797.tar.xz
mageia-dracut-conf-1ed60d25874839c7cc477210754ffd752c2cd797.zip
Updated to eject CD and pause on shutdown.
Signed-off-by: Martin Whitaker <mageia@martin-whitaker.me.uk> - origin: https://svnweb.mageia.org/packages/cauldron/dracut/current/SOURCES/0511-mgalive-A-module-to-mount-Mageia-Live-media.patch?r1=1231609&r2=1326566 - enable pivot back to dracut on shutdown (mga#22516) o see also upstream issue #481 - fix shutdown umount retry loop (upstream issue #483) - mgalive: ensure overlay filesystems are cleanly unmounted on shutdown - mgalive: eject optical media and pause on shutdown
Diffstat (limited to 'modules.d')
-rw-r--r--modules.d/90mgalive/mgalive-quit-plymouth.sh6
-rwxr-xr-xmodules.d/90mgalive/mgalive-root.sh11
-rw-r--r--modules.d/90mgalive/mgalive-shutdown.sh11
-rwxr-xr-xmodules.d/90mgalive/module-setup.sh5
4 files changed, 30 insertions, 3 deletions
diff --git a/modules.d/90mgalive/mgalive-quit-plymouth.sh b/modules.d/90mgalive/mgalive-quit-plymouth.sh
new file mode 100644
index 0000000..50fe953
--- /dev/null
+++ b/modules.d/90mgalive/mgalive-quit-plymouth.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+if [ -x /bin/plymouth ] ; then
+ /bin/plymouth --quit
+ /bin/plymouth --wait
+fi
+return 0
diff --git a/modules.d/90mgalive/mgalive-root.sh b/modules.d/90mgalive/mgalive-root.sh
index 584dccc..77a34bd 100755
--- a/modules.d/90mgalive/mgalive-root.sh
+++ b/modules.d/90mgalive/mgalive-root.sh
@@ -18,12 +18,14 @@ mkdir -m 0755 -p /run/mgalive/ovlsize
# Get the base device name
basedev=$(echo $livedev | sed 's,\(/dev/sd[a-z]\)1,\1,g')
+# Make it available to draklive-install and mgalive-shutdown
+echo $basedev > /run/mgalive/basedev
# 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
+# Get the device or path used for persistent 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)
@@ -75,6 +77,13 @@ mount -n -t overlay overlay -o lowerdir=/live/distrib,upperdir=/live/overlay/mem
ln -s /live/union /dev/root
printf '/bin/mount --rbind /live/union %s\n' "$NEWROOT" > $hookdir/mount/01-$$-live.sh
+printf '/bin/umount /live/union\n' >> $hookdir/mount/01-$$-live.sh
+
+# /live will not be visible once we pivot, so schedule its cleanup now.
+# This is needed to allow a persistent overlay to be shutdown cleanly.
+umount -l /live/distrib
+umount -l /live/overlay
+umount -l /live/media
need_shutdown
diff --git a/modules.d/90mgalive/mgalive-shutdown.sh b/modules.d/90mgalive/mgalive-shutdown.sh
new file mode 100644
index 0000000..ae927c2
--- /dev/null
+++ b/modules.d/90mgalive/mgalive-shutdown.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+clear
+basedev=$(cat /run/mgalive/basedev)
+if strstr "$basedev" "/dev/sr" ; then
+ eject $basedev
+fi
+echo "It is now safe to remove the Live medium"
+echo "Press <Enter> to continue..."
+read -t 30 a
+return 0
+
diff --git a/modules.d/90mgalive/module-setup.sh b/modules.d/90mgalive/module-setup.sh
index 99be401..b8f3f8d 100755
--- a/modules.d/90mgalive/module-setup.sh
+++ b/modules.d/90mgalive/module-setup.sh
@@ -15,11 +15,12 @@ installkernel() {
}
install() {
- inst_multiple umount dmsetup blkid dd losetup grep blockdev
- inst_multiple -o eject
+ inst_multiple blkid clear eject grep losetup umount
inst_hook cmdline 30 "$moddir/mgalive-parse.sh"
inst_hook pre-udev 30 "$moddir/mgalive-genrules.sh"
+ inst_hook pre-shutdown 99 "$moddir/mgalive-quit-plymouth.sh"
+ inst_hook shutdown 99 "$moddir/mgalive-shutdown.sh"
inst "$moddir/mgalive-root.sh" "/sbin/mgalive-root"
# should probably just be generally included
inst_rules 60-cdrom_id.rules