summaryrefslogtreecommitdiffstats
path: root/modules.d
diff options
context:
space:
mode:
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