-if [ "${root#/dev/}" != "$root" ]; then
+#!/bin/bash # for highlighting
+
+if [ "${root%%:*}" = "block" ]; then
(
- echo 'KERNEL=="'${root#/dev/}'", RUN+="/bin/mount '$fstype' -o '$rflags' '$root' '$NEWROOT'" '
- echo 'SYMLINK=="'${root#/dev/}'", RUN+="/bin/mount '$fstype' -o '$rflags' '$root' '$NEWROOT'" '
+ printf 'KERNEL=="%s", RUN+="/bin/mount -t %s -o %s %s %s"\n' \
+ ${root#block:/dev/} "$fstype" "$rflags" "${root#block:}" "$NEWROOT"
+ printf 'SYMLINK=="%s", RUN+="/bin/mount -t %s -o %s %s %s"\n' \
+ ${root#block:/dev/} "$fstype" "$rflags" "${root#block:}" "$NEWROOT"
) >> /etc/udev/rules.d/99-mount.rules
fi
#!/bin/sh
-dracut_install echo
-inst_hook cmdline 20 "$moddir/parse-root-opts.sh"
+inst_hook cmdline 10 "$moddir/parse-root-opts.sh"
+inst_hook cmdline 95 "$moddir/parse-block.sh"
inst_hook pre-udev 30 "$moddir/block-genrules.sh"
inst_hook mount 99 "$moddir/mount-root.sh"
--- /dev/null
+#!/bin/bash # for highlighting
+
+case "$root" in
+ block:LABEL=*|LABEL=*)
+ root="${root#block:}"
+ root="$(echo $root | sed 's,/,\\x2f,g')"
+ root="block:/dev/disk/by-label/${root#LABEL=}"
+ rootok=1 ;;
+ block:UUID=*|UUID=*)
+ root="${root#block:}"
+ root="block:/dev/disk/by-uuid/${root#UUID=}"
+ rootok=1 ;;
+ /dev/*)
+ root="block:${root}"
+ rootok=1 ;;
+esac
-#!/bin/sh
+#!/bin/bash # for highlighting
root=$(getarg root=)
-case $root in
- LABEL=*) root=${root#LABEL=}
- root="$(echo $root |sed 's,/,\\x2f,g')"
- root="/dev/disk/by-label/${root}" ;;
- UUID=*) root="/dev/disk/by-uuid/${root#UUID=}" ;;
- '') echo "Warning: no root specified"
- root="/dev/sda1" ;;
-esac
if rflags="$(getarg rootflags=)"; then
getarg rw && rflags="${rflags},rw" || rflags="${rflags},ro"
getarg rw && rflags=rw || rflags=ro
fi
-fstype="$(getarg rootfstype=)" && fstype="-t ${fstype}"
+fstype="$(getarg rootfstype=)"
+if [ -z "$fstype" ]; then
+ fstype="auto"
+fi
export fstype rflags root
getarg 'rdbreak=cmdline' && emergency_shell
source_all cmdline
+if [ -z "$rootok" -a -n "${root%%error:*}" ]; then
+ root="error: No handler for root=${root}"
+fi
+
+if [ -z "${root%%error:*}" ]; then
+ case "${root%%:*}" in
+ '') echo "FATAL: no root= option specified" ;;
+ error) echo "FATAL: ${root#error:}" ;;
+ esac
+ emergency_shell
+fi
+
# pre-udev scripts run before udev starts, and are run only once.
getarg 'rdbreak=pre-udev' && emergency_shell
source_all pre-udev