From 7f5112e3d6746f8b0b7e332e10779897221aba27 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 5 Mar 2009 14:19:41 +0100 Subject: [PATCH] add dmraid --- dracut.conf | 2 +- init | 115 ----------------------------------- modules.d/90dmraid/dmraid.sh | 4 ++ modules.d/90dmraid/install | 4 ++ 4 files changed, 9 insertions(+), 116 deletions(-) delete mode 100755 init create mode 100644 modules.d/90dmraid/dmraid.sh create mode 100755 modules.d/90dmraid/install diff --git a/dracut.conf b/dracut.conf index 46383046..bd8f4af4 100644 --- a/dracut.conf +++ b/dracut.conf @@ -1,2 +1,2 @@ # specify the dracut modules to use -dracutmodules="redhat-i18n crypt kernel-modules lvm terminfo udev-rules base" +dracutmodules="redhat-i18n crypt kernel-modules lvm terminfo udev-rules base dmraid" diff --git a/init b/init deleted file mode 100755 index a0e83a7b..00000000 --- a/init +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/sh -# -# Licensed under the GPLv2 -# -# Copyright 2008, Red Hat, Inc. -# Jeremy Katz - -emergency_shell() -{ - echo ; echo - echo "Bug in initramfs /init detected. Dropping to a shell. Good luck!" - echo - sh -i -} - -getarg() { - local o line - for o in $CMDLINE; do - [ "${o%%=*}" = "$1" ] && { echo $o; return 0; } - done - return 1 -} - -source_all() { - local f - [ "$1" ] && [ -d "/$1" ] || return - for f in "/$1"/*.sh; do [ -f "$f" ] && . "$f"; done -} - -echo "Starting initrd..." -export PATH=/sbin:/bin:/usr/sbin:/usr/bin -export TERM=linux -CONSOLE=/dev/console -[ -c $CONSOLE ] && exec >$CONSOLE 2>&1 <$CONSOLE -trap "emergency_shell" 0 -# mount some important things -mount -t proc /proc /proc -mount -t sysfs /sys /sys -mount -t tmpfs -omode=0755 udev /dev -read CMDLINE /dev/null 2>&1 - -# mount the rootfs -NEWROOT="/sysroot" - -# FIXME: there's got to be a better way ... -# it'd be nice if we had a udev rule that just did all of the bits for -# figuring out what the specified root is and linking it /dev/root -root=$(getarg root); root=${root#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 - -# should we have a timeout? -tries=0 -echo "Waiting up to 30 seconds for $root to become available" -udevadm settle --timeout=30 -source_all pre-mount - -echo "Trying to mount rootfs $root" -if rflags="$(getarg rootflags)"; then - rflags="${rflags#rootflags=}" - getarg rw >/dev/null && rflags="${rflags},rw" || rflags="${rflags},ro" -else - getarg rw >/dev/null && rflags=rw || rflags=ro -fi -[ -e "$root" ] || emergency_shell -ln -s "$root" /dev/root -fstype="$(getarg rootfstype)" && fstype="-t ${fstype#rootfstype=}" -mount $fstype -o $rflags /dev/root $NEWROOT || emergency_shell - -INIT=$(getarg init); INIT=${INIT#init=} -[ "$INIT" ] || { - for i in /sbin/init /etc/init /init /bin/sh; do - [ -x "$NEWROOT$i" ] && { INIT="$i"; break; } - done - [ "$INIT" ] || { - echo "Cannot find init! Please check to make sure you passed" - echo "a valid root filesystem! Dropping to a shell." - emergency_shell - } -} - -source_all pre-pivot - -kill $(pidof udevd) - -echo "Switching to real root filesystem $root" -exec switch_root "$NEWROOT" "$INIT" $CMDLINE || { - # davej doesn't like initrd bugs - echo "Something went very badly wrong in the initrd. Please " - echo "file a bug against mkinitrd." - emergency_shell -} diff --git a/modules.d/90dmraid/dmraid.sh b/modules.d/90dmraid/dmraid.sh new file mode 100644 index 00000000..17a92fb9 --- /dev/null +++ b/modules.d/90dmraid/dmraid.sh @@ -0,0 +1,4 @@ +#!/bin/sh +dmraid -ay +udevadm settle --timeout=30 >/dev/null 2>&1 + diff --git a/modules.d/90dmraid/install b/modules.d/90dmraid/install new file mode 100755 index 00000000..c96bef82 --- /dev/null +++ b/modules.d/90dmraid/install @@ -0,0 +1,4 @@ +#!/bin/bash +dracut_install dmraid +inst_hook pre-mount 10 "$moddir/dmraid.sh" +