summaryrefslogtreecommitdiffstats
path: root/examples/dracut/mgalive-parse.sh
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2018-04-15 22:03:06 +0100
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2018-04-15 22:06:36 +0100
commitd3ef216c34d9b8e0c720cbb3b9b3b88da63b08a2 (patch)
treef48ed764413d3491ca7a7e4e1bbd9432a7e32901 /examples/dracut/mgalive-parse.sh
parente8776cdc56be26520efb4007c319d2356a30055a (diff)
downloaddrakiso-d3ef216c34d9b8e0c720cbb3b9b3b88da63b08a2.tar
drakiso-d3ef216c34d9b8e0c720cbb3b9b3b88da63b08a2.tar.gz
drakiso-d3ef216c34d9b8e0c720cbb3b9b3b88da63b08a2.tar.bz2
drakiso-d3ef216c34d9b8e0c720cbb3b9b3b88da63b08a2.tar.xz
drakiso-d3ef216c34d9b8e0c720cbb3b9b3b88da63b08a2.zip
Support persistance and multiboot USB sticks in examples.
Diffstat (limited to 'examples/dracut/mgalive-parse.sh')
-rwxr-xr-xexamples/dracut/mgalive-parse.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/dracut/mgalive-parse.sh b/examples/dracut/mgalive-parse.sh
new file mode 100755
index 0000000..c5225ba
--- /dev/null
+++ b/examples/dracut/mgalive-parse.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+# live images are specified with
+# root=mgalive:backingdev
+
+[ -z "$root" ] && root=$(getarg root=)
+
+if [ "${root%%:*}" = "mgalive" ] ; then
+ liveroot=$root
+fi
+
+[ "${liveroot%%:*}" = "mgalive" ] || return
+
+modprobe -q loop
+
+case "$liveroot" in
+ mgalive:LABEL=*|LABEL=*) \
+ root="${root#mgalive:}"
+ 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"
+
+# make sure that init doesn't complain
+[ -z "$root" ] && root="mgalive"
+
+wait_for_dev /live/union