summaryrefslogtreecommitdiffstats
path: root/modules.d/90mgalive/mgalive-parse.sh
diff options
context:
space:
mode:
Diffstat (limited to 'modules.d/90mgalive/mgalive-parse.sh')
-rwxr-xr-xmodules.d/90mgalive/mgalive-parse.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/modules.d/90mgalive/mgalive-parse.sh b/modules.d/90mgalive/mgalive-parse.sh
new file mode 100755
index 0000000..7952957
--- /dev/null
+++ b/modules.d/90mgalive/mgalive-parse.sh
@@ -0,0 +1,27 @@
+#!/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 ;;
+esac
+info "root was $liveroot, is now $root"
+
+# make sure that init doesn't complain
+[ -z "$root" ] && root="mgalive"
+
+wait_for_dev /live/union