|
|
712866 |
From 4584826e9a25fdddb876f07875423196d9fc8840 Mon Sep 17 00:00:00 2001
|
|
|
712866 |
From: Harald Hoyer <harald@redhat.com>
|
|
|
712866 |
Date: Mon, 7 Oct 2013 15:06:22 +0200
|
|
|
712866 |
Subject: [PATCH] rootfs-block: add support for the rootfallback= kernel
|
|
|
712866 |
cmdline option
|
|
|
712866 |
|
|
|
712866 |
---
|
|
|
712866 |
dracut.cmdline.7.asc | 6 +++++
|
|
|
712866 |
modules.d/95rootfs-block/module-setup.sh | 3 ++-
|
|
|
712866 |
modules.d/95rootfs-block/rootfallback.sh | 46 ++++++++++++++++++++++++++++++++
|
|
|
712866 |
3 files changed, 54 insertions(+), 1 deletion(-)
|
|
|
712866 |
create mode 100755 modules.d/95rootfs-block/rootfallback.sh
|
|
|
712866 |
|
|
|
712866 |
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
|
|
|
712866 |
index 09c47e8..4b2ab03 100644
|
|
|
712866 |
--- a/dracut.cmdline.7.asc
|
|
|
712866 |
+++ b/dracut.cmdline.7.asc
|
|
|
712866 |
@@ -69,6 +69,12 @@ rootfstype=ext3
|
|
|
712866 |
force mounting _/_ and _/usr_ (if it is a separate device) read-write.
|
|
|
712866 |
See also ro option.
|
|
|
712866 |
|
|
|
712866 |
+**rootfallback=**_<path to blockdevice>_::
|
|
|
712866 |
+ specify the block device to use as the root filesystem, if the normal root cannot be found.
|
|
|
712866 |
+ This can only be a simple block device with a simple file system, for which the filesystem
|
|
|
712866 |
+ driver is either compiled in, or added manually to the initramfs.
|
|
|
712866 |
+ This parameter can be specified multiple times.
|
|
|
712866 |
+
|
|
|
712866 |
**rd.auto** **rd.auto=1**::
|
|
|
712866 |
enable autoassembly of special devices like cryptoLUKS, dmraid, mdraid or lvm.
|
|
|
712866 |
Default is off as of dracut version >= 024.
|
|
|
712866 |
diff --git a/modules.d/95rootfs-block/module-setup.sh b/modules.d/95rootfs-block/module-setup.sh
|
|
|
712866 |
index f066a79..7e714eb 100755
|
|
|
712866 |
--- a/modules.d/95rootfs-block/module-setup.sh
|
|
|
712866 |
+++ b/modules.d/95rootfs-block/module-setup.sh
|
|
|
712866 |
@@ -44,5 +44,6 @@ install() {
|
|
|
712866 |
inst_hook pre-udev 30 "$moddir/block-genrules.sh"
|
|
|
712866 |
inst_hook mount 99 "$moddir/mount-root.sh"
|
|
|
712866 |
fi
|
|
|
712866 |
-}
|
|
|
712866 |
|
|
|
712866 |
+ inst_hook initqueue/timeout 99 "$moddir/rootfallback.sh"
|
|
|
712866 |
+}
|
|
|
712866 |
diff --git a/modules.d/95rootfs-block/rootfallback.sh b/modules.d/95rootfs-block/rootfallback.sh
|
|
|
712866 |
new file mode 100755
|
|
|
712866 |
index 0000000..246ce9a
|
|
|
712866 |
--- /dev/null
|
|
|
712866 |
+++ b/modules.d/95rootfs-block/rootfallback.sh
|
|
|
712866 |
@@ -0,0 +1,46 @@
|
|
|
712866 |
+#!/bin/sh
|
|
|
712866 |
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
|
|
712866 |
+# ex: ts=8 sw=4 sts=4 et filetype=sh
|
|
|
712866 |
+
|
|
|
712866 |
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
|
|
712866 |
+
|
|
|
712866 |
+for root in $(getargs rootfallback=); do
|
|
|
712866 |
+ case "$root" in
|
|
|
712866 |
+ block:LABEL=*|LABEL=*)
|
|
|
712866 |
+ root="${root#block:}"
|
|
|
712866 |
+ root="$(echo $root | sed 's,/,\\x2f,g')"
|
|
|
712866 |
+ root="/dev/disk/by-label/${root#LABEL=}"
|
|
|
712866 |
+ ;;
|
|
|
712866 |
+ block:UUID=*|UUID=*)
|
|
|
712866 |
+ root="${root#block:}"
|
|
|
712866 |
+ root="${root#UUID=}"
|
|
|
712866 |
+ root="$(echo $root | tr "[:upper:]" "[:lower:]")"
|
|
|
712866 |
+ root="/dev/disk/by-uuid/${root#UUID=}"
|
|
|
712866 |
+ ;;
|
|
|
712866 |
+ block:PARTUUID=*|PARTUUID=*)
|
|
|
712866 |
+ root="${root#block:}"
|
|
|
712866 |
+ root="${root#PARTUUID=}"
|
|
|
712866 |
+ root="$(echo $root | tr "[:upper:]" "[:lower:]")"
|
|
|
712866 |
+ root="/dev/disk/by-partuuid/${root}"
|
|
|
712866 |
+ ;;
|
|
|
712866 |
+ block:PARTLABEL=*|PARTLABEL=*)
|
|
|
712866 |
+ root="${root#block:}"
|
|
|
712866 |
+ root="/dev/disk/by-partlabel/${root#PARTLABEL=}"
|
|
|
712866 |
+ ;;
|
|
|
712866 |
+ esac
|
|
|
712866 |
+
|
|
|
712866 |
+ if ! [ -b "$root" ]; then
|
|
|
712866 |
+ warn "Could not find rootfallback $root"
|
|
|
712866 |
+ continue
|
|
|
712866 |
+ fi
|
|
|
712866 |
+
|
|
|
712866 |
+ if mount "$root" /sysroot; then
|
|
|
712866 |
+ info "Mounted rootfallback $root"
|
|
|
712866 |
+ exit 0
|
|
|
712866 |
+ else
|
|
|
712866 |
+ warn "Failed to mount rootfallback $root"
|
|
|
712866 |
+ exit 1
|
|
|
712866 |
+ fi
|
|
|
712866 |
+done
|
|
|
712866 |
+
|
|
|
712866 |
+[ -e "$job" ] && rm -f "$job"
|