From 95d2dabc250b39d2452e0e8f57a702ab80db895c Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 2 Feb 2011 13:34:58 +0100 Subject: [PATCH] replaced check,install,installkernel with module-info.sh --- dracut | 10 +- dracut-functions | 182 +++++++++++------- dracut.xml | 59 +++--- modules.d/00bootchart/check | 7 - modules.d/00bootchart/install | 18 -- modules.d/00bootchart/module-info.sh | 30 +++ modules.d/00dash/check | 4 - modules.d/00dash/install | 9 - modules.d/00dash/module-info.sh | 20 ++ modules.d/01fips/check | 7 - modules.d/01fips/install | 15 -- modules.d/01fips/installkernel | 16 -- modules.d/01fips/module-info.sh | 41 ++++ modules.d/05busybox/check | 7 - modules.d/05busybox/install | 16 -- modules.d/05busybox/module-info.sh | 31 +++ modules.d/10i18n/check | 5 - modules.d/10i18n/install | 199 -------------------- modules.d/10i18n/module-info.sh | 209 +++++++++++++++++++++ modules.d/10rpmversion/check | 5 - modules.d/10rpmversion/install | 15 -- modules.d/10rpmversion/module-info.sh | 26 +++ modules.d/40network/check | 24 --- modules.d/40network/install | 26 --- modules.d/40network/installkernel | 22 --- modules.d/40network/module-info.sh | 74 ++++++++ modules.d/45ifcfg/check | 8 - modules.d/45ifcfg/install | 4 - .../{98selinux/check => 45ifcfg/module-info.sh} | 13 +- modules.d/50gensplash/check | 7 - modules.d/50gensplash/install | 65 ------- modules.d/50gensplash/module-info.sh | 77 ++++++++ modules.d/50plymouth/check | 5 - modules.d/50plymouth/install | 17 -- modules.d/50plymouth/installkernel | 7 - modules.d/50plymouth/module-info.sh | 35 ++++ modules.d/60xen/check | 17 -- modules.d/60xen/install | 7 - modules.d/60xen/installkernel | 11 -- modules.d/60xen/module-info.sh | 41 ++++ modules.d/90btrfs/check | 24 --- modules.d/90btrfs/install | 6 - modules.d/90btrfs/module-info.sh | 34 ++++ modules.d/90crypt/check | 26 --- modules.d/90crypt/install | 13 -- modules.d/90crypt/installkernel | 5 - modules.d/90crypt/module-info.sh | 50 +++++ modules.d/90dm/check | 6 - modules.d/90dm/install | 11 -- modules.d/90dm/installkernel | 7 - modules.d/90dm/module-info.sh | 26 +++ modules.d/90dmraid/check | 30 --- modules.d/90dmraid/install | 23 --- modules.d/90dmraid/module-info.sh | 58 ++++++ modules.d/90dmsquash-live/check | 17 -- modules.d/90dmsquash-live/install | 25 --- modules.d/90dmsquash-live/module-info.sh | 42 +++++ modules.d/90kernel-modules/install | 7 - modules.d/90kernel-modules/installkernel | 40 ---- modules.d/90kernel-modules/module-info.sh | 50 +++++ modules.d/90lvm/check | 28 --- modules.d/90lvm/install | 24 --- modules.d/90lvm/module-info.sh | 58 ++++++ modules.d/90mdraid/check | 25 --- modules.d/90mdraid/install | 44 ----- modules.d/90mdraid/installkernel | 5 - modules.d/90mdraid/module-info.sh | 80 ++++++++ modules.d/90multipath/check | 27 --- modules.d/90multipath/install | 22 --- modules.d/90multipath/installkernel | 10 - modules.d/90multipath/module-info.sh | 63 +++++++ modules.d/95dasd/check | 7 - modules.d/95dasd/install | 10 - modules.d/95dasd/installkernel | 6 - modules.d/95dasd/module-info.sh | 28 +++ modules.d/95dasd_mod/check | 7 - modules.d/95dasd_mod/install | 6 - modules.d/95dasd_mod/installkernel | 7 - modules.d/95dasd_mod/module-info.sh | 24 +++ modules.d/95debug/check | 6 - modules.d/95debug/install | 7 - modules.d/95debug/module-info.sh | 20 ++ modules.d/95fcoe/check | 13 -- modules.d/95fcoe/install | 14 -- modules.d/95fcoe/installkernel | 4 - modules.d/95fcoe/module-info.sh | 35 ++++ modules.d/95fstab-sys/check | 2 - modules.d/95fstab-sys/install | 3 - modules.d/95fstab-sys/module-info.sh | 16 ++ modules.d/95iscsi/check | 38 ---- modules.d/95iscsi/install | 10 - modules.d/95iscsi/installkernel | 4 - modules.d/95iscsi/module-info.sh | 54 ++++++ modules.d/95nbd/check | 21 --- modules.d/95nbd/install | 7 - modules.d/95nbd/installkernel | 4 - modules.d/95nbd/module-info.sh | 38 ++++ modules.d/95nfs/check | 15 -- modules.d/95nfs/install | 46 ----- modules.d/95nfs/installkernel | 5 - modules.d/95nfs/module-info.sh | 69 +++++++ modules.d/95resume/install | 17 -- modules.d/95resume/module-info.sh | 20 ++ modules.d/95rootfs-block/install | 10 - modules.d/95rootfs-block/module-info.sh | 13 ++ modules.d/95terminfo/install | 11 -- modules.d/95terminfo/module-info.sh | 14 ++ modules.d/95udev-rules/install | 56 ------ modules.d/95udev-rules/module-info.sh | 60 ++++++ modules.d/95zfcp/check | 8 - modules.d/95zfcp/install | 15 -- modules.d/95zfcp/installkernel | 7 - modules.d/95zfcp/module-info.sh | 34 ++++ modules.d/95znet/check | 8 - modules.d/95znet/install | 8 - modules.d/95znet/module-info.sh | 22 +++ modules.d/96insmodpost/check | 5 - modules.d/96insmodpost/install | 6 - modules.d/96insmodpost/module-info.sh | 17 ++ modules.d/97biosdevname/check | 7 - modules.d/97biosdevname/install | 14 -- modules.d/97biosdevname/module-info.sh | 18 ++ modules.d/98selinux/install | 5 - modules.d/98selinux/module-info.sh | 20 ++ modules.d/98syslog/check | 6 - modules.d/98syslog/install | 29 --- modules.d/98syslog/module-info.sh | 41 ++++ modules.d/99base/check | 6 - modules.d/99base/install | 32 ---- modules.d/99base/module-info.sh | 45 +++++ 130 files changed, 1796 insertions(+), 1561 deletions(-) delete mode 100755 modules.d/00bootchart/check delete mode 100755 modules.d/00bootchart/install create mode 100755 modules.d/00bootchart/module-info.sh delete mode 100755 modules.d/00dash/check delete mode 100755 modules.d/00dash/install create mode 100755 modules.d/00dash/module-info.sh delete mode 100755 modules.d/01fips/check delete mode 100755 modules.d/01fips/install delete mode 100755 modules.d/01fips/installkernel create mode 100755 modules.d/01fips/module-info.sh delete mode 100755 modules.d/05busybox/check delete mode 100755 modules.d/05busybox/install create mode 100755 modules.d/05busybox/module-info.sh delete mode 100755 modules.d/10i18n/check delete mode 100755 modules.d/10i18n/install create mode 100755 modules.d/10i18n/module-info.sh delete mode 100755 modules.d/10rpmversion/check delete mode 100755 modules.d/10rpmversion/install create mode 100755 modules.d/10rpmversion/module-info.sh delete mode 100755 modules.d/40network/check delete mode 100755 modules.d/40network/install delete mode 100755 modules.d/40network/installkernel create mode 100755 modules.d/40network/module-info.sh delete mode 100755 modules.d/45ifcfg/check delete mode 100755 modules.d/45ifcfg/install rename modules.d/{98selinux/check => 45ifcfg/module-info.sh} (51%) delete mode 100755 modules.d/50gensplash/check delete mode 100755 modules.d/50gensplash/install create mode 100755 modules.d/50gensplash/module-info.sh delete mode 100755 modules.d/50plymouth/check delete mode 100755 modules.d/50plymouth/install delete mode 100755 modules.d/50plymouth/installkernel create mode 100755 modules.d/50plymouth/module-info.sh delete mode 100755 modules.d/60xen/check delete mode 100755 modules.d/60xen/install delete mode 100755 modules.d/60xen/installkernel create mode 100755 modules.d/60xen/module-info.sh delete mode 100755 modules.d/90btrfs/check delete mode 100755 modules.d/90btrfs/install create mode 100755 modules.d/90btrfs/module-info.sh delete mode 100755 modules.d/90crypt/check delete mode 100755 modules.d/90crypt/install delete mode 100755 modules.d/90crypt/installkernel create mode 100755 modules.d/90crypt/module-info.sh delete mode 100755 modules.d/90dm/check delete mode 100755 modules.d/90dm/install delete mode 100755 modules.d/90dm/installkernel create mode 100755 modules.d/90dm/module-info.sh delete mode 100755 modules.d/90dmraid/check delete mode 100755 modules.d/90dmraid/install create mode 100755 modules.d/90dmraid/module-info.sh delete mode 100755 modules.d/90dmsquash-live/check delete mode 100755 modules.d/90dmsquash-live/install create mode 100755 modules.d/90dmsquash-live/module-info.sh delete mode 100755 modules.d/90kernel-modules/install delete mode 100755 modules.d/90kernel-modules/installkernel create mode 100755 modules.d/90kernel-modules/module-info.sh delete mode 100755 modules.d/90lvm/check delete mode 100755 modules.d/90lvm/install create mode 100755 modules.d/90lvm/module-info.sh delete mode 100755 modules.d/90mdraid/check delete mode 100755 modules.d/90mdraid/install delete mode 100755 modules.d/90mdraid/installkernel create mode 100755 modules.d/90mdraid/module-info.sh delete mode 100755 modules.d/90multipath/check delete mode 100755 modules.d/90multipath/install delete mode 100755 modules.d/90multipath/installkernel create mode 100755 modules.d/90multipath/module-info.sh delete mode 100755 modules.d/95dasd/check delete mode 100755 modules.d/95dasd/install delete mode 100755 modules.d/95dasd/installkernel create mode 100755 modules.d/95dasd/module-info.sh delete mode 100755 modules.d/95dasd_mod/check delete mode 100755 modules.d/95dasd_mod/install delete mode 100755 modules.d/95dasd_mod/installkernel create mode 100755 modules.d/95dasd_mod/module-info.sh delete mode 100755 modules.d/95debug/check delete mode 100755 modules.d/95debug/install create mode 100755 modules.d/95debug/module-info.sh delete mode 100755 modules.d/95fcoe/check delete mode 100755 modules.d/95fcoe/install delete mode 100755 modules.d/95fcoe/installkernel create mode 100755 modules.d/95fcoe/module-info.sh delete mode 100755 modules.d/95fstab-sys/check delete mode 100755 modules.d/95fstab-sys/install create mode 100755 modules.d/95fstab-sys/module-info.sh delete mode 100755 modules.d/95iscsi/check delete mode 100755 modules.d/95iscsi/install delete mode 100755 modules.d/95iscsi/installkernel create mode 100755 modules.d/95iscsi/module-info.sh delete mode 100755 modules.d/95nbd/check delete mode 100755 modules.d/95nbd/install delete mode 100755 modules.d/95nbd/installkernel create mode 100755 modules.d/95nbd/module-info.sh delete mode 100755 modules.d/95nfs/check delete mode 100755 modules.d/95nfs/install delete mode 100755 modules.d/95nfs/installkernel create mode 100755 modules.d/95nfs/module-info.sh delete mode 100755 modules.d/95resume/install create mode 100755 modules.d/95resume/module-info.sh delete mode 100755 modules.d/95rootfs-block/install create mode 100755 modules.d/95rootfs-block/module-info.sh delete mode 100755 modules.d/95terminfo/install create mode 100755 modules.d/95terminfo/module-info.sh delete mode 100755 modules.d/95udev-rules/install create mode 100755 modules.d/95udev-rules/module-info.sh delete mode 100755 modules.d/95zfcp/check delete mode 100755 modules.d/95zfcp/install delete mode 100755 modules.d/95zfcp/installkernel create mode 100755 modules.d/95zfcp/module-info.sh delete mode 100755 modules.d/95znet/check delete mode 100755 modules.d/95znet/install create mode 100755 modules.d/95znet/module-info.sh delete mode 100755 modules.d/96insmodpost/check delete mode 100755 modules.d/96insmodpost/install create mode 100755 modules.d/96insmodpost/module-info.sh delete mode 100755 modules.d/97biosdevname/check delete mode 100755 modules.d/97biosdevname/install create mode 100755 modules.d/97biosdevname/module-info.sh delete mode 100755 modules.d/98selinux/install create mode 100755 modules.d/98selinux/module-info.sh delete mode 100755 modules.d/98syslog/check delete mode 100755 modules.d/98syslog/install create mode 100755 modules.d/98syslog/module-info.sh delete mode 100755 modules.d/99base/check delete mode 100755 modules.d/99base/install create mode 100755 modules.d/99base/module-info.sh diff --git a/dracut b/dracut index 303d817..2122d1c 100755 --- a/dracut +++ b/dracut @@ -309,7 +309,7 @@ fi # check all our modules to see if they should be sourced. # This builds a list of modules that we will install next. -check_modules +check_module_dir # source our modules. for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do @@ -317,11 +317,11 @@ for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do if strstr "$mods_to_load" " $mod "; then dinfo "*** Sourcing module $mod" if [[ $kernel_only = yes ]]; then - [[ -x $moddir/installkernel ]] && . "$moddir/installkernel" + module_installkernel $mod else - . "$moddir/install" - if [[ $no_kernel != yes && -x $moddir/installkernel ]]; then - . "$moddir/installkernel" + module_install $mod + if [[ $no_kernel != yes ]]; then + module_installkernel $mod fi fi mods_to_load=${mods_to_load// $mod /} diff --git a/dracut-functions b/dracut-functions index 2232dc9..a183a43 100755 --- a/dracut-functions +++ b/dracut-functions @@ -57,6 +57,10 @@ vercmp() { esac } +is_func() { + [[ $(type -t $1) = "function" ]] +} + # Log initrd creation. if ! [[ $dracutlogfile ]]; then [[ $dracutbasedir = /usr/share/dracut ]] && \ @@ -511,85 +515,129 @@ inst_opt_decompress() { done } -check_module_deps() { - local moddir dep ret - # if we are already set to be loaded, we do not have to be checked again. - strstr " $mods_to_load " " $1 " && return - strstr " $omit_dracutmodules " " $1 " && return 1 - # turn a module name into a directory, if we can. - moddir=$(echo ${dracutbasedir}/modules.d/??${1}) - [[ -d $moddir && -x $moddir/install ]] || return 1 - # if we do not have a check script, we are unconditionally included - if [[ -x $moddir/check ]]; then - "$moddir/check" +module_check() { + local moddir=$(echo ${dracutbasedir}/modules.d/??${1}) + [[ -d $moddir ]] || return 1 + if [[ ! -f $moddir/module-info.sh ]]; then + # if we do not have a check script, we are unconditionally included + [[ -x $moddir/check ]] || return 0 + $moddir/check $hostonly + return $? + else + unset check depends install installkernel + . $moddir/module-info.sh + is_func check || return 0 + check ret=$? - # a return value of 255 = load module only as a dependency. - ((ret==0||ret==255)) || return 1 - for dep in $("$moddir/check" -d); do - check_module_deps "$dep" && continue - dwarning "Dependency $mod failed." - return 1 - done + unset check depends install installkernel + return $ret fi - mods_to_load+=" $1 " } -should_source_module() { - local dep - local ret - if [[ $kernel_only = yes ]]; then - [[ -x $1/installkernel ]] && return 0 - return 1 +module_depends() { + local moddir=$(echo ${dracutbasedir}/modules.d/??${1}) + [[ -d $moddir ]] || return 1 + if [[ ! -f $moddir/module-info.sh ]]; then + # if we do not have a check script, we have no deps + [[ -x $moddir/check ]] || return 0 + $moddir/check -d + return $? + else + unset check depends install installkernel + . $moddir/module-info.sh + is_func depends || return 0 + depends + ret=$? + unset check depends install installkernel + return $ret fi - [[ -x $1/install || -x $1/installkernel ]] || return 1 - [[ -x $1/check ]] || return 0 - "$1/check" $hostonly || continue - for dep in $("$1/check" -d); do - check_module_deps "$dep" && continue - dwarning "Cannot load dracut module \"$mod\", dependencies failed." - return 1 - done } -check_modules() { - local modcheck; - local mod; - for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do - local mod=${moddir##*/}; mod=${mod#[0-9][0-9]} - # If we are already scheduled to be loaded, no need to check again. - strstr " $mods_to_load " " $mod " && continue - # This should never happen, but... - [[ -d $moddir ]] || continue - strstr " $omit_dracutmodules " " $mod " && continue - - if ! strstr " $dracutmodules $add_dracutmodules " " $mod "; then - # module not in our list - if [[ $dracutmodules = all ]]; then - # check, if we can install this module - should_source_module "$moddir" || continue - else - # skip this module - continue - fi +module_install() { + local moddir=$(echo ${dracutbasedir}/modules.d/??${1}) + [[ -d $moddir ]] || return 1 + if [[ ! -f $moddir/module-info.sh ]]; then + [[ -x $moddir/install ]] && . "$moddir/install" + return $? + else + unset check depends install installkernel + . $moddir/module-info.sh + is_func install || return 0 + install + ret=$? + unset check depends install installkernel + return $ret + fi +} + +module_installkernel() { + local moddir=$(echo ${dracutbasedir}/modules.d/??${1}) + [[ -d $moddir ]] || return 1 + if [[ ! -f $moddir/module-info.sh ]]; then + [[ -x $moddir/installkernel ]] && . "$moddir/installkernel" + return $? + else + unset check depends install installkernel + . $moddir/module-info.sh + is_func installkernel || return 0 + installkernel + ret=$? + unset check depends install installkernel + return $ret + fi +} + +check_module() { + local mod=$1; + local moddir=$(echo ${dracutbasedir}/modules.d/??${1}) + local moddep; + # If we are already scheduled to be loaded, no need to check again. + strstr " $mods_to_load " " $mod " && return 0 + strstr " $mods_checked_as_dep " " $mod " && return 1 + + # This should never happen, but... + [[ -d $moddir ]] || return 1 + + [[ $2 ]] || mods_checked_as_dep+=" $mod " + + strstr " $omit_dracutmodules " " $mod " && return 1 + + if strstr " $dracutmodules $add_dracutmodules " " $mod "; then + module_check $mod; ret=$? + # explicit module, so also accept ret=255 + [[ $ret = 0 || $ret = 255 ]] || return 1 + else + # module not in our list + if [[ $dracutmodules = all ]]; then + # check, if we can and should install this module + module_check $mod || return 1 else - if [ -x "$moddir/check" ] \ - && "$moddir/check" -d > /dev/null 2>&1; then - check_module_deps "$mod" || { - dwarning "Cannot load dracut module \"$mod\", dependencies failed." - continue - } - fi + # skip this module + return 1 fi + fi - mods_to_load+=" $mod " + for moddep in $(module_depends $mod); do + # handle deps as if they were manually added + strstr " $add_dracutmodules " " $moddep " || \ + add_dracutmodules+=" $moddep " + # if a module we depend on fail, fail also + check_module $moddep || return 1 done - modcheck=$add_dracutmodules - [[ $dracutmodules != all ]] && modcheck="$m $dracutmodules" - for mod in $modcheck; do - strstr " $mods_to_load " " $mod " && continue - strstr " $omit_dracutmodules " " $mod " && continue - dwarning "Dracut module \"$mod\" cannot be found." + strstr " $mods_to_load " " $mod " || \ + mods_to_load+=" $mod " + + return 0 +} + +check_module_dir() { + local modcheck; + local mod; + mods_to_load="" + for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do + local mod=${moddir##*/}; mod=${mod#[0-9][0-9]} + check_module $mod 1 done } diff --git a/dracut.xml b/dracut.xml index d7ac1fc..089f8ee 100644 --- a/dracut.xml +++ b/dracut.xml @@ -1,9 +1,18 @@ + - - <inlinemediaobject><imageobject><imagedata valign="middle" fileref="dracut.png" format="PNG"/></imageobject><imageobject><imagedata valign="middle" fileref="dracut.svg" format="SVG"/></imageobject><imageobject> - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dracut.svg" encoding="UTF-8" parse="xml"/></imageobject></inlinemediaobject>dracut + <inlinemediaobject> + <imageobject> + <imagedata valign="middle" fileref="dracut.png" format="PNG"/> + </imageobject> + <imageobject> + <imagedata valign="middle" fileref="dracut.svg" format="SVG"/> + </imageobject> + <imageobject> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dracut.svg" encoding="UTF-8" parse="xml"/> + </imageobject> + </inlinemediaobject>dracut Harald @@ -604,11 +613,12 @@ Common used functions are in dracut-lib.sh, which can be so
Writing a Module A simple example module is 96insmodpost, which modprobes a kernel module after udev has settled and the basic device drivers have been loaded. - First we create a check script, which just exits with 0 indicating that this module should be included by default. - check: - exit 0 - The we create the install script, which installs a cmdline hook with priority number 20 called parse-insmodpost.sh. It also installs the insmodpost.sh script in /sbin. - install: + All module installation information is in the file module-info.sh. + First we create a check() function, which just exits with 0 indicating that this module should be included by default. + check(): + return 0 + The we create the install() function, which installs a cmdline hook with priority number 20 called parse-insmodpost.sh. It also installs the insmodpost.sh script in /sbin. + install(): inst_hook cmdline 20 "$moddir/parse-insmodpost.sh" inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh The pase-instmodpost.sh parses the kernel command line for a argument rd.driver.post, blacklists the module from being autoloaded and installs the hook insmodpost.sh in the initqueue-settled. @@ -630,39 +640,34 @@ for p in $(getargs rd.driver.post=); do done
- check - check is called by dracut to evaluate the inclusion of a dracut module in the initramfs. - check also can be called with arguments, which are described in the following list. + check() + + check() + is called by dracut to evaluate the inclusion of a dracut module in the initramfs. - check -d + $hostonly - If check is called with parameter -d, then the stdout output is taken as the dracut module names of the dependencies this module needs. - - - - check -h - - If check is called with parameter -h, then the module check should be in "hostonly" mode, which means, that the check should only return 0, if the module is really needed to boot this specific host. + If the $hostonly variable is set, then the module check() function should be in "hostonly" mode, which means, that the check() should only return 0, if the module is really needed to boot this specific host. - If check is called without parameters, it should return the following exit codes. + check() should return with: - exit 0 + 0 Include the dracut module in the initramfs. - exit 1 + 1 Do not include the dracut module. The requirements are not fullfilled (missing tools, etc.) - exit 255 + 255 Only include the dracut module, if another module requires it or if explicitly specified in the config file or on the argument list. @@ -670,7 +675,11 @@ done
- Install + depends() + The function depends() should echo all other dracut module names the module depends on. +
+
+ install() dracut_install inst inst_hook @@ -678,7 +687,7 @@ done
- Installkernel + installkernel() instmods
diff --git a/modules.d/00bootchart/check b/modules.d/00bootchart/check deleted file mode 100755 index 1e2f863..0000000 --- a/modules.d/00bootchart/check +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -[ -x /sbin/bootchartd ] || exit 1 - -# do not enable bootchartd by default -exit 255 diff --git a/modules.d/00bootchart/install b/modules.d/00bootchart/install deleted file mode 100755 index f06b097..0000000 --- a/modules.d/00bootchart/install +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -inst /sbin/bootchartd -inst /bin/bash -inst_symlink /init /sbin/init -inst_dir /lib/bootchart/tmpfs -inst /lib/bootchart/bootchart-collector -inst /etc/bootchartd.conf -inst /sbin/accton -inst /usr/bin/pkill /bin/pkill -inst /bin/echo -inst /bin/grep -inst /bin/usleep -inst /usr/bin/[ /bin/[ - -mknod -m 0666 "${initdir}/dev/null" c 1 3 diff --git a/modules.d/00bootchart/module-info.sh b/modules.d/00bootchart/module-info.sh new file mode 100755 index 0000000..b58ce35 --- /dev/null +++ b/modules.d/00bootchart/module-info.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + [ -x /sbin/bootchartd ] || return 1 + return 255 +} + +depends() { + return 0 +} + +install() { + inst /sbin/bootchartd + inst /bin/bash + inst_symlink /init /sbin/init + inst_dir /lib/bootchart/tmpfs + inst /lib/bootchart/bootchart-collector + inst /etc/bootchartd.conf + inst /sbin/accton + inst /usr/bin/pkill /bin/pkill + inst /bin/echo + inst /bin/grep + inst /bin/usleep + inst /usr/bin/[ /bin/[ + + mknod -m 0666 "${initdir}/dev/null" c 1 3 +} + diff --git a/modules.d/00dash/check b/modules.d/00dash/check deleted file mode 100755 index d18c69c..0000000 --- a/modules.d/00dash/check +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -[ -x /bin/dash ] \ No newline at end of file diff --git a/modules.d/00dash/install b/modules.d/00dash/install deleted file mode 100755 index 6203546..0000000 --- a/modules.d/00dash/install +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# If another shell is already installed, do not use dash -[[ -x $initdir/bin/sh ]] && return - -# Prefer dash as /bin/sh if it is available. -inst /bin/dash && ln -sf dash "${initdir}/bin/sh" diff --git a/modules.d/00dash/module-info.sh b/modules.d/00dash/module-info.sh new file mode 100755 index 0000000..dfd4d7b --- /dev/null +++ b/modules.d/00dash/module-info.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + [ -x /bin/dash ] +} + +depends() { + return 0 +} + +install() { + # If another shell is already installed, do not use dash + [[ -x $initdir/bin/sh ]] && return + + # Prefer dash as /bin/sh if it is available. + inst /bin/dash && ln -sf dash "${initdir}/bin/sh" +} + diff --git a/modules.d/01fips/check b/modules.d/01fips/check deleted file mode 100755 index 7856e39..0000000 --- a/modules.d/01fips/check +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -[[ $1 = -d ]] && exit 0 -exit 255 - diff --git a/modules.d/01fips/install b/modules.d/01fips/install deleted file mode 100755 index 622ce21..0000000 --- a/modules.d/01fips/install +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -inst_hook pre-trigger 01 "$moddir/fips.sh" -dracut_install sha512hmac rmmod insmod mount uname umount - -for dir in "$usrlibdir" "$libdir"; do - [[ -e $dir/libsoftokn3.so ]] && \ - dracut_install $dir/libsoftokn3.so $dir/libsoftokn3.chk \ - $dir/libfreebl3.so $dir/libfreebl3.chk && \ - break -done - -dracut_install $usrlibdir/hmaccalc/sha512hmac.hmac diff --git a/modules.d/01fips/installkernel b/modules.d/01fips/installkernel deleted file mode 100755 index daa248d..0000000 --- a/modules.d/01fips/installkernel +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -FIPSMODULES="aead aes_generic aes-x86_64 ansi_cprng cbc ccm chainiv ctr" -FIPSMODULES="$FIPSMODULES des deflate ecb eseqiv hmac seqiv sha256 sha512" -FIPSMODULES="$FIPSMODULES cryptomgr crypto_null tcrypt" - -mkdir -p "${initdir}/etc/modprobe.d" - -for mod in $FIPSMODULES; do - if instmods $mod; then - echo $mod >> "${initdir}/etc/fipsmodules" - echo "blacklist $mod" >> "${initdir}/etc/modprobe.d/fips.conf" - fi -done diff --git a/modules.d/01fips/module-info.sh b/modules.d/01fips/module-info.sh new file mode 100755 index 0000000..78541c1 --- /dev/null +++ b/modules.d/01fips/module-info.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + return 255 +} + +depends() { + return 0 +} + +installkernel() { + FIPSMODULES="aead aes_generic aes-x86_64 ansi_cprng cbc ccm chainiv ctr" + FIPSMODULES="$FIPSMODULES des deflate ecb eseqiv hmac seqiv sha256 sha512" + FIPSMODULES="$FIPSMODULES cryptomgr crypto_null tcrypt" + + mkdir -p "${initdir}/etc/modprobe.d" + + for mod in $FIPSMODULES; do + if instmods $mod; then + echo $mod >> "${initdir}/etc/fipsmodules" + echo "blacklist $mod" >> "${initdir}/etc/modprobe.d/fips.conf" + fi + done +} + +install() { + inst_hook pre-trigger 01 "$moddir/fips.sh" + dracut_install sha512hmac rmmod insmod mount uname umount + + for dir in "$usrlibdir" "$libdir"; do + [[ -e $dir/libsoftokn3.so ]] && \ + dracut_install $dir/libsoftokn3.so $dir/libsoftokn3.chk \ + $dir/libfreebl3.so $dir/libfreebl3.chk && \ + break + done + + dracut_install $usrlibdir/hmaccalc/sha512hmac.hmac +} + diff --git a/modules.d/05busybox/check b/modules.d/05busybox/check deleted file mode 100755 index dc57cca..0000000 --- a/modules.d/05busybox/check +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -[[ $1 = -d ]] && exit 0 - -type -P busybox >/dev/null || exit 1 - -exit 255 diff --git a/modules.d/05busybox/install b/modules.d/05busybox/install deleted file mode 100755 index 5252d03..0000000 --- a/modules.d/05busybox/install +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -inst busybox /sbin/busybox - -# List of shell programs that we use in other official dracut modules, that -# must be supported by the busybox installed on the host system -progs="echo grep usleep [ rmmod insmod mount uname umount setfont kbd_mode stty gzip bzip2 chvt readlink blkid dd losetup tr sed seq ps more cat rm free ping netstat vi ping6 fsck ip hostname basename mknod mkdir pidof sleep chroot ls cp mv dmesg mkfifo less ln modprobe" - -# FIXME: switch_root should be in the above list, but busybox version hangs -# (using busybox-1.15.1-7.fc14.i686 at the time of writing) - -for i in $progs; do - path=$(find_binary "$i") - ln -s /sbin/busybox "$initdir/$path" -done - diff --git a/modules.d/05busybox/module-info.sh b/modules.d/05busybox/module-info.sh new file mode 100755 index 0000000..031b335 --- /dev/null +++ b/modules.d/05busybox/module-info.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + type -P busybox >/dev/null || return 1 + + return 255 +} + +depends() { + return 0 +} + +install() { + inst busybox /sbin/busybox + + # List of shell programs that we use in other official dracut modules, that + # must be supported by the busybox installed on the host system + progs="echo grep usleep [ rmmod insmod mount uname umount setfont kbd_mode stty gzip bzip2 chvt readlink blkid dd losetup tr sed seq ps more cat rm free ping netstat vi ping6 fsck ip hostname basename mknod mkdir pidof sleep chroot ls cp mv dmesg mkfifo less ln modprobe" + + # FIXME: switch_root should be in the above list, but busybox version hangs + # (using busybox-1.15.1-7.fc14.i686 at the time of writing) + + for i in $progs; do + path=$(find_binary "$i") + ln -s /sbin/busybox "$initdir/$path" + done + +} + diff --git a/modules.d/10i18n/check b/modules.d/10i18n/check deleted file mode 100755 index e0292c8..0000000 --- a/modules.d/10i18n/check +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -exit 0 diff --git a/modules.d/10i18n/install b/modules.d/10i18n/install deleted file mode 100755 index 96d563d..0000000 --- a/modules.d/10i18n/install +++ /dev/null @@ -1,199 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps -DEFAULT_FONT=LatArCyrHeb-16 -I18N_CONF="/etc/locale.conf" -VCONFIG_CONF="/etc/vconsole.conf" - -# This is from 10redhat-i18n. -findkeymap () { - local MAP=$1 - [[ ! -f $MAP ]] && \ - MAP=$(find ${kbddir}/keymaps -type f -name $MAP -o -name $MAP.\* | head -n1) - [[ " $KEYMAPS " = *" $MAP "* ]] && return - KEYMAPS="$KEYMAPS $MAP" - case $MAP in - *.gz) cmd=zgrep;; - *.bz2) cmd=bzgrep;; - *) cmd=grep ;; - esac - - for INCL in $($cmd "^include " $MAP | cut -d' ' -f2 | tr -d '"'); do - for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do - findkeymap $FN - done - done -} - -# Function gathers variables from distributed files among the tree, maps to -# specified names and prints the result in format "new-name=value". -# -# $@ = list in format specified below (BNF notation) -# -# ::= | " " -# ::= ":" -# ::= | "," -# ::= "-" | -# -# We assume no whitespace are allowed between symbols. -# is a file holding in your system. -# is a variable holding value of meaning the same as . -# is a variable which will be set up inside initramfs. -# If has the same name as we can omit . -# -# Example: -# /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS -# = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS -# = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS -# = /etc/conf.d/keymaps -# = KEYMAP,extended_keymaps-EXT_KEYMAPS -# = KEYMAP -# = KEYMAP -# = extended_keymaps-EXT_KEYMAPS -# = extended_keymaps -# = EXT_KEYMAPS -gather_vars() { - local item map value - - for item in $@ - do - item=(${item/:/ }) - for map in ${item[1]//,/ } - do - map=(${map//-/ }) - value=$(grep "^${map[0]}=" "${item[0]}") - value=${value#*=} - echo "${map[1]:-${map[0]}}=${value}" - done - done -} - -install_base() { - dracut_install setfont loadkeys kbd_mode stty - - inst ${moddir}/console_init /lib/udev/console_init - inst_rules ${moddir}/10-console.rules - inst_hook cmdline 20 "${moddir}/parse-i18n.sh" -} - -install_all_kbd() { - local rel f - - for f in $(eval find ${kbddir}/{${KBDSUBDIRS}} -type f -print) - do - inst $f - done - - # remove unnecessary files - rm -f "${initdir}${kbddir}/consoletrans/utflist" - find "${initdir}${kbddir}/" -name README\* -delete - - dracut_install gzip bzip2 -} - -install_local_i18n() { - local map - - eval $(gather_vars ${i18n_vars}) - [ -f $I18N_CONF ] && . $I18N_CONF - [ -f $VCONFIG_CONF ] && . $VCONFIG_CONF - - # Gentoo user may have KEYMAP set to something like "-u pl2", - KEYMAP=${KEYMAP#-* } - # I'm not sure of the purpose of UNIKEYMAP and GRP_TOGGLE. They were in - # original redhat-i18n module. Anyway it won't hurt. - EXT_KEYMAPS+=\ ${UNIKEYMAP}\ ${GRP_TOGGLE} - - [[ ${KEYMAP} ]] || dwarning 'No KEYMAP.' || return 1 - findkeymap ${KEYMAP} - - for map in ${EXT_KEYMAPS} - do - dinfo "Adding extra map: ${map}" - findkeymap ${map} - done - - inst_opt_decompress ${KEYMAPS} - - inst_opt_decompress ${kbddir}/consolefonts/${DEFAULT_FONT}.* - - if [[ ${FONT} ]] - then - FONT=${FONT%.psf*} - inst_opt_decompress ${kbddir}/consolefonts/${FONT}.* - fi - - if [[ ${FONT_MAP} ]] - then - FONT_MAP=${FONT_MAP%.trans} - inst ${kbddir}/consoletrans/${FONT_MAP}.trans - fi - - if [[ ${FONT_UNIMAP} ]] - then - FONT_UNIMAP=${FONT_UNIMAP%.uni} - inst ${kbddir}/unimaps/${FONT_UNIMAP}.uni - fi - - if [[ ${UNICODE} ]] - then - if [[ ${UNICODE^^} = YES || ${UNICODE} = 1 ]] - then - UNICODE=1 - elif [[ ${UNICODE^^} = NO || ${UNICODE} = 0 ]] - then - UNICODE=0 - else - UNICODE='' - fi - fi - if [[ ! ${UNICODE} && ${LANG^^} =~ .*\.UTF-?8 ]] - then - UNICODE=1 - fi - - mksubdirs ${initdir}${I18N_CONF} - mksubdirs ${initdir}${VCONFIG_CONF} - print_vars LC_ALL LANG >> ${initdir}${I18N_CONF} - print_vars KEYMAP EXT_KEYMAPS UNICODE FONT FONT_MAP FONT_UNIMAP >> ${initdir}${VCONFIG_CONF} - return 0 -} - -checks() { - for kbddir in ${kbddir} /usr/lib/kbd /lib/kbd /usr/share /usr/share/kbd - do - [[ -d "${kbddir}" ]] && \ - for dir in ${KBDSUBDIRS//,/ } - do - [[ -d "${kbddir}/${dir}" ]] && continue - false - done && break - kbddir='' - done - - [[ ${kbddir} ]] || { - derror "Directories ${KBDSUBDIRS//,/, } not found. Please inform us about the issue including your OS name and version." - return 1 - } - - [[ -f $I18N_CONF && -f $VCONFIG_CONF ]] || \ - [[ ! ${hostonly} || ${i18n_vars} ]] || { - dwarning 'Please set up i18n_vars in configuration file.' - } - return 0 -} - - -if checks -then - install_base - - if [[ ${hostonly} ]] - then - install_local_i18n || install_all_kbd - else - install_all_kbd - fi -fi diff --git a/modules.d/10i18n/module-info.sh b/modules.d/10i18n/module-info.sh new file mode 100755 index 0000000..a524d2d --- /dev/null +++ b/modules.d/10i18n/module-info.sh @@ -0,0 +1,209 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + return 0 +} + +depends() { + return 0 +} + +install() { + KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps + DEFAULT_FONT=LatArCyrHeb-16 + I18N_CONF="/etc/locale.conf" + VCONFIG_CONF="/etc/vconsole.conf" + + # This is from 10redhat-i18n. + findkeymap () { + local MAP=$1 + [[ ! -f $MAP ]] && \ + MAP=$(find ${kbddir}/keymaps -type f -name $MAP -o -name $MAP.\* | head -n1) + [[ " $KEYMAPS " = *" $MAP "* ]] && return + KEYMAPS="$KEYMAPS $MAP" + case $MAP in + *.gz) cmd=zgrep;; + *.bz2) cmd=bzgrep;; + *) cmd=grep ;; + esac + + for INCL in $($cmd "^include " $MAP | cut -d' ' -f2 | tr -d '"'); do + for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do + findkeymap $FN + done + done + } + +# Function gathers variables from distributed files among the tree, maps to +# specified names and prints the result in format "new-name=value". +# +# $@ = list in format specified below (BNF notation) +# +# ::= | " " +# ::= ":" +# ::= | "," +# ::= "-" | +# +# We assume no whitespace are allowed between symbols. +# is a file holding in your system. +# is a variable holding value of meaning the same as . +# is a variable which will be set up inside initramfs. +# If has the same name as we can omit . +# +# Example: +# /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS +# = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS +# = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS +# = /etc/conf.d/keymaps +# = KEYMAP,extended_keymaps-EXT_KEYMAPS +# = KEYMAP +# = KEYMAP +# = extended_keymaps-EXT_KEYMAPS +# = extended_keymaps +# = EXT_KEYMAPS + gather_vars() { + local item map value + + for item in $@ + do + item=${item/:/ } + for map in ${item[1]//,/ } + do + map=${map//-/ } + value=$(grep "^${map[0]}=" "${item[0]}") + value=${value#*=} + echo "${map[1]:-${map[0]}}=${value}" + done + done + } + + install_base() { + dracut_install setfont loadkeys kbd_mode stty + + inst ${moddir}/console_init /lib/udev/console_init + inst_rules ${moddir}/10-console.rules + inst_hook cmdline 20 "${moddir}/parse-i18n.sh" + } + + install_all_kbd() { + local rel f + + for f in $(eval find ${kbddir}/{${KBDSUBDIRS}} -type f -print) + do + inst $f + done + + # remove unnecessary files + rm -f "${initdir}${kbddir}/consoletrans/utflist" + find "${initdir}${kbddir}/" -name README\* -delete + + dracut_install gzip bzip2 + } + + install_local_i18n() { + local map + + eval $(gather_vars ${i18n_vars}) + [ -f $I18N_CONF ] && . $I18N_CONF + [ -f $VCONFIG_CONF ] && . $VCONFIG_CONF + + # Gentoo user may have KEYMAP set to something like "-u pl2", + KEYMAP=${KEYMAP#-* } + # I'm not sure of the purpose of UNIKEYMAP and GRP_TOGGLE. They were in + # original redhat-i18n module. Anyway it won't hurt. + EXT_KEYMAPS+=\ ${UNIKEYMAP}\ ${GRP_TOGGLE} + + [[ ${KEYMAP} ]] || dwarning 'No KEYMAP.' || return 1 + findkeymap ${KEYMAP} + + for map in ${EXT_KEYMAPS} + do + dinfo "Adding extra map: ${map}" + findkeymap ${map} + done + + inst_opt_decompress ${KEYMAPS} + + inst_opt_decompress ${kbddir}/consolefonts/${DEFAULT_FONT}.* + + if [[ ${FONT} ]] + then + FONT=${FONT%.psf*} + inst_opt_decompress ${kbddir}/consolefonts/${FONT}.* + fi + + if [[ ${FONT_MAP} ]] + then + FONT_MAP=${FONT_MAP%.trans} + inst ${kbddir}/consoletrans/${FONT_MAP}.trans + fi + + if [[ ${FONT_UNIMAP} ]] + then + FONT_UNIMAP=${FONT_UNIMAP%.uni} + inst ${kbddir}/unimaps/${FONT_UNIMAP}.uni + fi + + if [[ ${UNICODE} ]] + then + if [[ ${UNICODE^^} = YES || ${UNICODE} = 1 ]] + then + UNICODE=1 + elif [[ ${UNICODE^^} = NO || ${UNICODE} = 0 ]] + then + UNICODE=0 + else + UNICODE='' + fi + fi + if [[ ! ${UNICODE} && ${LANG^^} =~ .*\.UTF-?8 ]] + then + UNICODE=1 + fi + + mksubdirs ${initdir}${I18N_CONF} + mksubdirs ${initdir}${VCONFIG_CONF} + print_vars LC_ALL LANG >> ${initdir}${I18N_CONF} + print_vars KEYMAP EXT_KEYMAPS UNICODE FONT FONT_MAP FONT_UNIMAP >> ${initdir}${VCONFIG_CONF} + return 0 + } + + checks() { + for kbddir in ${kbddir} /usr/lib/kbd /lib/kbd /usr/share /usr/share/kbd + do + [[ -d "${kbddir}" ]] && \ + for dir in ${KBDSUBDIRS//,/ } + do + [[ -d "${kbddir}/${dir}" ]] && continue + false + done && break + kbddir='' + done + + [[ ${kbddir} ]] || { + derror "Directories ${KBDSUBDIRS//,/, } not found. Please inform us about the issue including your OS name and version." + return 1 + } + + [[ -f $I18N_CONF && -f $VCONFIG_CONF ]] || \ + [[ ! ${hostonly} || ${i18n_vars} ]] || { + dwarning 'Please set up i18n_vars in configuration file.' + } + return 0 + } + + if checks + then + install_base + + if [[ ${hostonly} ]] + then + install_local_i18n || install_all_kbd + else + install_all_kbd + fi + fi +} + diff --git a/modules.d/10rpmversion/check b/modules.d/10rpmversion/check deleted file mode 100755 index 4002ae4..0000000 --- a/modules.d/10rpmversion/check +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -[ -f /etc/redhat-release ] - diff --git a/modules.d/10rpmversion/install b/modules.d/10rpmversion/install deleted file mode 100755 index 8fa9be0..0000000 --- a/modules.d/10rpmversion/install +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -if [ -e "$moddir/dracut-version" ]; then - dracut_rpm_version=$(cat "$moddir/dracut-version") - inst "$moddir/dracut-version" /$dracut_rpm_version -else - if rpm -qf $(type -P $0) &>/dev/null; then - dracut_rpm_version=$(rpm -qf --qf '%{name}-%{version}-%{release}\n' $(type -P $0) | { ver="";while read line;do ver=$line;done;echo $ver;} ) - echo $dracut_rpm_version > $initdir/$dracut_rpm_version - fi -fi -inst_hook cmdline 01 "$moddir/version.sh" - diff --git a/modules.d/10rpmversion/module-info.sh b/modules.d/10rpmversion/module-info.sh new file mode 100755 index 0000000..e26d785 --- /dev/null +++ b/modules.d/10rpmversion/module-info.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + [ -f /etc/redhat-release ] +} + +depends() { + return 0 +} + +install() { + if [ -e "$moddir/dracut-version" ]; then + dracut_rpm_version=$(cat "$moddir/dracut-version") + inst "$moddir/dracut-version" /$dracut_rpm_version + else + if rpm -qf $(type -P $0) &>/dev/null; then + dracut_rpm_version=$(rpm -qf --qf '%{name}-%{version}-%{release}\n' $(type -P $0) | { ver="";while read line;do ver=$line;done;echo $ver;} ) + echo $dracut_rpm_version > $initdir/$dracut_rpm_version + fi + fi + inst_hook cmdline 01 "$moddir/version.sh" + +} + diff --git a/modules.d/40network/check b/modules.d/40network/check deleted file mode 100755 index f575bd9..0000000 --- a/modules.d/40network/check +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -if [[ $1 = -d ]]; then - [ -d /etc/sysconfig/network-scripts/ ] && echo ifcfg - exit 0 -fi - -. $dracutfunctions - -for program in ip arping; do - if ! type -P $program >/dev/null; then - dwarning "Could not find program \"$program\" required by network." - exit 1 - fi -done -for program in dhclient brctl ifenslave tr; do - if ! type -P $program >/dev/null; then - dwarning "Could not find program \"$program\" it might be required by network." - fi -done - -exit 255 diff --git a/modules.d/40network/install b/modules.d/40network/install deleted file mode 100755 index b22cc96..0000000 --- a/modules.d/40network/install +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -dracut_install ip dhclient brctl arping ifenslave tr -inst "$moddir/ifup" "/sbin/ifup" -inst "$moddir/netroot" "/sbin/netroot" -inst "$moddir/dhclient-script" "/sbin/dhclient-script" -inst "$moddir/dhclient.conf" "/etc/dhclient.conf" -inst_hook pre-udev 50 "$moddir/ifname-genrules.sh" -inst_hook pre-udev 60 "$moddir/net-genrules.sh" -inst_hook cmdline 91 "$moddir/dhcp-root.sh" -inst_hook cmdline 99 "$moddir/parse-ip-opts.sh" -inst_hook cmdline 97 "$moddir/parse-bond.sh" -inst_hook cmdline 98 "$moddir/parse-bridge.sh" -inst_hook cmdline 99 "$moddir/parse-ifname.sh" -inst_hook pre-pivot 10 "$moddir/kill-dhclient.sh" - -arch=$(uname -m) - -for dir in "$usrlibdir/tls/$arch" "$usrlibdir/tls" "$usrlibdir/$arch" \ - "$usrlibdir" "$libdir"; do - for i in "$dir"/libnss_dns.so.* "$dir"/libnss_mdns4_minimal.so.*; do - [ -e "$i" ] && dracut_install "$i" - done -done - diff --git a/modules.d/40network/installkernel b/modules.d/40network/installkernel deleted file mode 100755 index c5944ab..0000000 --- a/modules.d/40network/installkernel +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# Include wired net drivers, excluding wireless - -net_module_test() { - local net_drivers='eth_type_trans|register_virtio_device' - local unwanted_drivers='/(wireless|isdn|uwb)/' - egrep -q $net_drivers "$1" && \ - egrep -qv 'iw_handler_get_spy' "$1" && \ - [[ ! $1 =~ $unwanted_drivers ]] -} - -instmods $(filter_kernel_modules net_module_test) - -instmods ecb arc4 -# bridge modules -instmods bridge stp llc -instmods ipv6 -# bonding -instmods bonding diff --git a/modules.d/40network/module-info.sh b/modules.d/40network/module-info.sh new file mode 100755 index 0000000..cb8c5df --- /dev/null +++ b/modules.d/40network/module-info.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + . $dracutfunctions + + for program in ip arping; do + if ! type -P $program >/dev/null; then + dwarning "Could not find program \"$program\" required by network." + return 1 + fi + done + for program in dhclient brctl ifenslave tr; do + if ! type -P $program >/dev/null; then + dwarning "Could not find program \"$program\" it might be required by network." + fi + done + + return 255 +} + +depends() { + [ -d /etc/sysconfig/network-scripts/ ] && echo ifcfg + return 0 +} + +installkernel() { + # Include wired net drivers, excluding wireless + + net_module_test() { + local net_drivers='eth_type_trans|register_virtio_device' + local unwanted_drivers='/(wireless|isdn|uwb)/' + egrep -q $net_drivers "$1" && \ + egrep -qv 'iw_handler_get_spy' "$1" && \ + [[ ! $1 =~ $unwanted_drivers ]] + } + + instmods $(filter_kernel_modules net_module_test) + + instmods ecb arc4 + # bridge modules + instmods bridge stp llc + instmods ipv6 + # bonding + instmods bonding +} + +install() { + dracut_install ip dhclient brctl arping ifenslave tr + inst "$moddir/ifup" "/sbin/ifup" + inst "$moddir/netroot" "/sbin/netroot" + inst "$moddir/dhclient-script" "/sbin/dhclient-script" + inst "$moddir/dhclient.conf" "/etc/dhclient.conf" + inst_hook pre-udev 50 "$moddir/ifname-genrules.sh" + inst_hook pre-udev 60 "$moddir/net-genrules.sh" + inst_hook cmdline 91 "$moddir/dhcp-root.sh" + inst_hook cmdline 99 "$moddir/parse-ip-opts.sh" + inst_hook cmdline 97 "$moddir/parse-bond.sh" + inst_hook cmdline 98 "$moddir/parse-bridge.sh" + inst_hook cmdline 99 "$moddir/parse-ifname.sh" + inst_hook pre-pivot 10 "$moddir/kill-dhclient.sh" + + arch=$(uname -m) + + for dir in "$usrlibdir/tls/$arch" "$usrlibdir/tls" "$usrlibdir/$arch" \ + "$usrlibdir" "$libdir"; do + for i in "$dir"/libnss_dns.so.* "$dir"/libnss_mdns4_minimal.so.*; do + [ -e "$i" ] && dracut_install "$i" + done + done + +} + diff --git a/modules.d/45ifcfg/check b/modules.d/45ifcfg/check deleted file mode 100755 index 636df1d..0000000 --- a/modules.d/45ifcfg/check +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# ifcfg is required by network -#[[ $1 = -d ]] && echo network - -exit 255 diff --git a/modules.d/45ifcfg/install b/modules.d/45ifcfg/install deleted file mode 100755 index ba456c2..0000000 --- a/modules.d/45ifcfg/install +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh" diff --git a/modules.d/98selinux/check b/modules.d/45ifcfg/module-info.sh similarity index 51% rename from modules.d/98selinux/check rename to modules.d/45ifcfg/module-info.sh index fa9ede2..3cd0c48 100755 --- a/modules.d/98selinux/check +++ b/modules.d/45ifcfg/module-info.sh @@ -2,10 +2,15 @@ # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # ex: ts=8 sw=4 sts=4 et filetype=sh -[[ $1 = '-h' ]] && { - [ -x "/usr/sbin/load_policy" -o -x "/sbin/load_policy" ] || exit 1 - exit 0 +check() { + return 255 } -exit 0 +depends() { + return 0 +} + +install() { + inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh" +} diff --git a/modules.d/50gensplash/check b/modules.d/50gensplash/check deleted file mode 100755 index eebce20..0000000 --- a/modules.d/50gensplash/check +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# TODO: splash_geninitramfs -# TODO: /usr/share/splashutils/initrd.splash -exit 255 diff --git a/modules.d/50gensplash/install b/modules.d/50gensplash/install deleted file mode 100755 index 2f6dcc5..0000000 --- a/modules.d/50gensplash/install +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -call_splash_geninitramfs() { - local out ret - - out=$(splash_geninitramfs -c "$1" ${@:2} 2>&1) - ret=$? - - if [[ ${out} ]]; then - local IFS=' -' - for line in ${out}; do - if [[ ${line} =~ ^Warning ]]; then - dwarning "${line}" - else - derror "${line}" - (( ret == 0 )) && ret=1 - fi - done - fi - - return ${ret} -} - - -type -P splash_geninitramfs >/dev/null || exit 1 - -opts='' - -if [[ ${DRACUT_GENSPLASH_THEME} ]]; then - # Variables from the environment - # They're supposed to be set up by e.g. Genkernel in basis of cmdline args. - # If user set them he/she would expect to be included only given theme - # rather then all even if we're building generic initramfs. - SPLASH_THEME=${DRACUT_GENSPLASH_THEME} - SPLASH_RES=${DRACUT_GENSPLASH_RES} -elif [[ ${hostonly} ]]; then - # Settings from config only in hostonly - [[ -e /etc/conf.d/splash ]] && source /etc/conf.d/splash - [[ ! ${SPLASH_THEME} ]] && SPLASH_THEME=default - [[ ${SPLASH_RES} ]] && opts+=" -r ${SPLASH_RES}" -else - # generic - SPLASH_THEME=--all -fi - -dinfo "Installing Gentoo Splash (using the ${SPLASH_THEME} theme)" - -pushd "${initdir}" >/dev/null -mv dev dev.old -call_splash_geninitramfs "${initdir}" ${opts} ${SPLASH_THEME} || { - derror "Could not build splash" - exit 1 -} -rm -rf dev -mv dev.old dev -popd >/dev/null - -dracut_install chvt -inst /usr/share/splashutils/initrd.splash /lib/gensplash-lib.sh -inst_hook pre-pivot 90 "${moddir}"/gensplash-newroot.sh -inst_hook pre-trigger 10 "${moddir}"/gensplash-pretrigger.sh -inst_hook emergency 50 "${moddir}"/gensplash-emergency.sh diff --git a/modules.d/50gensplash/module-info.sh b/modules.d/50gensplash/module-info.sh new file mode 100755 index 0000000..cdcdabd --- /dev/null +++ b/modules.d/50gensplash/module-info.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + # TODO: splash_geninitramfs + # TODO: /usr/share/splashutils/initrd.splash + return 255 +} + +depends() { + return 0 +} + +install() { + call_splash_geninitramfs() { + local out ret + + out=$(splash_geninitramfs -c "$1" ${@:2} 2>&1) + ret=$? + + if [[ ${out} ]]; then + local IFS=' +' + for line in ${out}; do + if [[ ${line} =~ ^Warning ]]; then + dwarning "${line}" + else + derror "${line}" + (( ret == 0 )) && ret=1 + fi + done + fi + + return ${ret} + } + + + type -P splash_geninitramfs >/dev/null || return 1 + + opts='' + + if [[ ${DRACUT_GENSPLASH_THEME} ]]; then + # Variables from the environment + # They're supposed to be set up by e.g. Genkernel in basis of cmdline args. + # If user set them he/she would expect to be included only given theme + # rather then all even if we're building generic initramfs. + SPLASH_THEME=${DRACUT_GENSPLASH_THEME} + SPLASH_RES=${DRACUT_GENSPLASH_RES} + elif [[ ${hostonly} ]]; then + # Settings from config only in hostonly + [[ -e /etc/conf.d/splash ]] && source /etc/conf.d/splash + [[ ! ${SPLASH_THEME} ]] && SPLASH_THEME=default + [[ ${SPLASH_RES} ]] && opts+=" -r ${SPLASH_RES}" + else + # generic + SPLASH_THEME=--all + fi + + dinfo "Installing Gentoo Splash (using the ${SPLASH_THEME} theme)" + + pushd "${initdir}" >/dev/null + mv dev dev.old + call_splash_geninitramfs "${initdir}" ${opts} ${SPLASH_THEME} || { + derror "Could not build splash" + return 1 + } + rm -rf dev + mv dev.old dev + popd >/dev/null + + dracut_install chvt + inst /usr/share/splashutils/initrd.splash /lib/gensplash-lib.sh + inst_hook pre-pivot 90 "${moddir}"/gensplash-newroot.sh + inst_hook pre-trigger 10 "${moddir}"/gensplash-pretrigger.sh + inst_hook emergency 50 "${moddir}"/gensplash-emergency.sh +} diff --git a/modules.d/50plymouth/check b/modules.d/50plymouth/check deleted file mode 100755 index f11c9fd..0000000 --- a/modules.d/50plymouth/check +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -[[ $1 = -d ]] && type -P cryptsetup >/dev/null && echo crypt -[[ -x /sbin/plymouthd && -x /bin/plymouth && -x /usr/sbin/plymouth-set-default-theme ]] diff --git a/modules.d/50plymouth/install b/modules.d/50plymouth/install deleted file mode 100755 index 7a0c237..0000000 --- a/modules.d/50plymouth/install +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -if grep -q nash /usr/libexec/plymouth/plymouth-populate-initrd \ - || ! grep -q PLYMOUTH_POPULATE_SOURCE_FUNCTIONS /usr/libexec/plymouth/plymouth-populate-initrd \ - || [ ! -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then - . "$moddir"/plymouth-populate-initrd -else - PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \ - /usr/libexec/plymouth/plymouth-populate-initrd -t $initdir -fi - -inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh -inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh -inst_hook emergency 50 "$moddir"/plymouth-emergency.sh -inst readlink diff --git a/modules.d/50plymouth/installkernel b/modules.d/50plymouth/installkernel deleted file mode 100755 index 61a8dfb..0000000 --- a/modules.d/50plymouth/installkernel +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -# Include KMS capable drm drivers -for modname in $(find "$srcmods/kernel/drivers/gpu/drm" "$srcmods/extra" -name '*.ko' 2>/dev/null); do - grep -q drm_crtc_init $modname && instmods $modname -done diff --git a/modules.d/50plymouth/module-info.sh b/modules.d/50plymouth/module-info.sh new file mode 100755 index 0000000..9a62617 --- /dev/null +++ b/modules.d/50plymouth/module-info.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + [[ -x /sbin/plymouthd && -x /bin/plymouth && -x /usr/sbin/plymouth-set-default-theme ]] +} + +depends() { + return 0 +} + +installkernel() { + # Include KMS capable drm drivers + for modname in $(find "$srcmods/kernel/drivers/gpu/drm" "$srcmods/extra" -name '*.ko' 2>/dev/null); do + grep -q drm_crtc_init $modname && instmods $modname + done +} + +install() { + if grep -q nash /usr/libexec/plymouth/plymouth-populate-initrd \ + || ! grep -q PLYMOUTH_POPULATE_SOURCE_FUNCTIONS /usr/libexec/plymouth/plymouth-populate-initrd \ + || [ ! -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then + . "$moddir"/plymouth-populate-initrd + else + PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \ + /usr/libexec/plymouth/plymouth-populate-initrd -t $initdir + fi + + inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh + inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh + inst_hook emergency 50 "$moddir"/plymouth-emergency.sh + inst readlink +} + diff --git a/modules.d/60xen/check b/modules.d/60xen/check deleted file mode 100755 index 55129ac..0000000 --- a/modules.d/60xen/check +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# No Xen-detect? Boo!! -if ! hash xen-detect 2>/dev/null; then - [[ -d /usr/lib/xen-default ]] && \ - hash -p /usr/lib/xen-default/bin/xen-detect xen-detect || exit 1 -fi - -. $dracutfunctions -[[ $debug ]] && set -x - -# Yes, we are under Xen PV env. -xen-detect | grep -q -v PV || exit 0 - -exit 1 diff --git a/modules.d/60xen/install b/modules.d/60xen/install deleted file mode 100755 index 08f3f0a..0000000 --- a/modules.d/60xen/install +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -hash xen-detect 2>/dev/null || \ - hash -p /usr/lib/xen-default/bin/xen-detect xen-detect -inst "$(hash -t xen-detect)" /sbin/xen-detect -inst_hook pre-udev 40 "$moddir/xen-pre-udev.sh" diff --git a/modules.d/60xen/installkernel b/modules.d/60xen/installkernel deleted file mode 100755 index 7c1ffd5..0000000 --- a/modules.d/60xen/installkernel +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -for i in \ - xenbus_probe_frontend xen-pcifront \ - xen-fbfront xen-kbdfront xen-blkfront xen-netfront \ - ; do - modinfo -k $kernel $i >/dev/null 2>&1 && instmods $i -done - diff --git a/modules.d/60xen/module-info.sh b/modules.d/60xen/module-info.sh new file mode 100755 index 0000000..52b2050 --- /dev/null +++ b/modules.d/60xen/module-info.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + # No Xen-detect? Boo!! + if ! hash xen-detect 2>/dev/null; then + [[ -d /usr/lib/xen-default ]] && \ + hash -p /usr/lib/xen-default/bin/xen-detect xen-detect || return 1 + fi + + . $dracutfunctions + [[ $debug ]] && set -x + + # Yes, we are under Xen PV env. + xen-detect | grep -q -v PV || return 0 + + return 1 +} + +depends() { + return 0 +} + +installkernel() { + for i in \ + xenbus_probe_frontend xen-pcifront \ + xen-fbfront xen-kbdfront xen-blkfront xen-netfront \ + ; do + modinfo -k $kernel $i >/dev/null 2>&1 && instmods $i + done + +} + +install() { + hash xen-detect 2>/dev/null || \ + hash -p /usr/lib/xen-default/bin/xen-detect xen-detect + inst "$(hash -t xen-detect)" /sbin/xen-detect + inst_hook pre-udev 40 "$moddir/xen-pre-udev.sh" +} + diff --git a/modules.d/90btrfs/check b/modules.d/90btrfs/check deleted file mode 100755 index 03c5293..0000000 --- a/modules.d/90btrfs/check +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# We depend on udev-rules being loaded -[[ "$1" = "-d" ]] && exit 0 - -# if we don't have btrfs (btrfsctl) installed on the host system, -# no point in trying to support it in the initramfs. -type -P btrfsctl >/dev/null || exit 1 - -. $dracutfunctions -[[ $debug ]] && set -x - -is_btrfs() { get_fs_type /dev/block/$1 |grep -q btrfs; } - -if [[ "$1" = "-h" ]]; then - rootdev=$(find_root_block_device) - if [[ $rootdev ]]; then - is_btrfs "$rootdev" || exit 1 - fi -fi - -exit 0 diff --git a/modules.d/90btrfs/install b/modules.d/90btrfs/install deleted file mode 100755 index e4858e2..0000000 --- a/modules.d/90btrfs/install +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -inst_rules "$moddir/80-btrfs.rules" -dracut_install btrfsctl diff --git a/modules.d/90btrfs/module-info.sh b/modules.d/90btrfs/module-info.sh new file mode 100755 index 0000000..0503e1d --- /dev/null +++ b/modules.d/90btrfs/module-info.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + # if we don't have btrfs (btrfsctl) installed on the host system, + # no point in trying to support it in the initramfs. + type -P btrfsctl >/dev/null || return 1 + + . $dracutfunctions + [[ $debug ]] && set -x + + is_btrfs() { get_fs_type /dev/block/$1 | grep -q btrfs; } + + if [[ $hostonly ]]; then + rootdev=$(find_root_block_device) + if [[ $rootdev ]]; then + is_btrfs "$rootdev" || return 1 + fi + fi + + return 0 +} + +depends() { + echo udev-rules + return 0 +} + +install() { + inst_rules "$moddir/80-btrfs.rules" + dracut_install btrfsctl +} + diff --git a/modules.d/90crypt/check b/modules.d/90crypt/check deleted file mode 100755 index 3ac8076..0000000 --- a/modules.d/90crypt/check +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# if cryptsetup is not installed, then we cannot support encrypted devices. -type -P cryptsetup >/dev/null || exit 1 - -[ "$1" = "-d" ] && echo dm - -. $dracutfunctions - -is_crypt() { [[ $(get_fs_type /dev/block/$1) = crypto_LUKS ]]; } - -[[ $1 = '-h' ]] && { - rootdev=$(find_root_block_device) - if [[ $rootdev ]]; then - # root lives on a block device, so we can be more precise about - # hostonly checking - check_block_and_slaves is_crypt "$rootdev" || exit 1 - else - # root is not on a block device, use the shotgun approach - blkid | grep -q crypto\?_LUKS || exit 1 - fi -} - -exit 0 diff --git a/modules.d/90crypt/install b/modules.d/90crypt/install deleted file mode 100755 index 12b3555..0000000 --- a/modules.d/90crypt/install +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -inst cryptsetup -inst rmdir -inst readlink -inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask -inst "$moddir"/probe-keydev.sh /sbin/probe-keydev -inst_hook cmdline 10 "$moddir/parse-keydev.sh" -inst_hook cmdline 30 "$moddir/parse-crypt.sh" -inst_hook pre-pivot 30 "$moddir/crypt-cleanup.sh" -inst /etc/crypttab -inst "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh" diff --git a/modules.d/90crypt/installkernel b/modules.d/90crypt/installkernel deleted file mode 100755 index f41e5ac..0000000 --- a/modules.d/90crypt/installkernel +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -instmods dm_crypt cbc sha256 xts aes aes_generic aesni-intel aes-x86_64 fpu - diff --git a/modules.d/90crypt/module-info.sh b/modules.d/90crypt/module-info.sh new file mode 100755 index 0000000..5b435e5 --- /dev/null +++ b/modules.d/90crypt/module-info.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + # if cryptsetup is not installed, then we cannot support encrypted devices. + type -P cryptsetup >/dev/null || return 1 + + . $dracutfunctions + + is_crypt() { [[ $(get_fs_type /dev/block/$1) = crypto_LUKS ]]; } + + [[ $hostonly ]] && { + rootdev=$(find_root_block_device) + if [[ $rootdev ]]; then + # root lives on a block device, so we can be more precise about + # hostonly checking + check_block_and_slaves is_crypt "$rootdev" || return 1 + else + # root is not on a block device, use the shotgun approach + blkid | grep -q crypto\?_LUKS || return 1 + fi + } + + return 0 +} + +depends() { + echo dm rootfs-block + return 0 +} + +installkernel() { + instmods dm_crypt cbc sha256 xts aes aes_generic aesni-intel aes-x86_64 fpu + +} + +install() { + inst cryptsetup + inst rmdir + inst readlink + inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask + inst "$moddir"/probe-keydev.sh /sbin/probe-keydev + inst_hook cmdline 10 "$moddir/parse-keydev.sh" + inst_hook cmdline 30 "$moddir/parse-crypt.sh" + inst_hook pre-pivot 30 "$moddir/crypt-cleanup.sh" + inst /etc/crypttab + inst "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh" +} + diff --git a/modules.d/90dm/check b/modules.d/90dm/check deleted file mode 100755 index 3a95d01..0000000 --- a/modules.d/90dm/check +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -exit 255 - diff --git a/modules.d/90dm/install b/modules.d/90dm/install deleted file mode 100755 index b2080e5..0000000 --- a/modules.d/90dm/install +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -modinfo -k $kernel dm_mod >/dev/null 2>&1 && \ - inst_hook pre-udev 30 "$moddir/dm-pre-udev.sh" - -inst dmsetup - -type -P dmeventd >/dev/null && dracut_install dmeventd -inst_rules 10-dm.rules 95-dm-notify.rules diff --git a/modules.d/90dm/installkernel b/modules.d/90dm/installkernel deleted file mode 100755 index f9fdfcb..0000000 --- a/modules.d/90dm/installkernel +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -instmods =drivers/md - - diff --git a/modules.d/90dm/module-info.sh b/modules.d/90dm/module-info.sh new file mode 100755 index 0000000..11985fd --- /dev/null +++ b/modules.d/90dm/module-info.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + return 255 +} + +depends() { + return 0 +} + +installkernel() { + instmods =drivers/md +} + +install() { + modinfo -k $kernel dm_mod >/dev/null 2>&1 && \ + inst_hook pre-udev 30 "$moddir/dm-pre-udev.sh" + + inst dmsetup + + type -P dmeventd >/dev/null && dracut_install dmeventd + inst_rules 10-dm.rules 95-dm-notify.rules +} + diff --git a/modules.d/90dmraid/check b/modules.d/90dmraid/check deleted file mode 100755 index fd7dde7..0000000 --- a/modules.d/90dmraid/check +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# We depend on dm_mod being loaded -[ "$1" = "-d" ] && echo dm - -# if we don't have dmraid installed on the host system, no point -# in trying to support it in the initramfs. -type -P dmraid >/dev/null || exit 1 - -. $dracutfunctions -[[ $debug ]] && set -x - -is_dmraid() { get_fs_type /dev/block/$1 |grep -v linux_raid_member | \ - grep -q _raid_member; } - -[[ $1 = '-h' ]] && { - rootdev=$(find_root_block_device) - if [[ $rootdev ]]; then - # root lives on a block device, so we can be more precise about - # hostonly checking - check_block_and_slaves is_dmraid "$rootdev" || exit 1 - else - # root is not on a block device, use the shotgun approach - dmraid -r | grep -q ok || exit 1 - fi -} - -exit 0 diff --git a/modules.d/90dmraid/install b/modules.d/90dmraid/install deleted file mode 100755 index 7626bdc..0000000 --- a/modules.d/90dmraid/install +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -dracut_install dmraid partx kpartx - -inst dmeventd - -for i in {"$libdir","$usrlibdir"}/libdmraid-events*.so; do - [ -e "$i" ] && dracut_install "$i" -done - -inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules - -inst "$moddir/dmraid.sh" /sbin/dmraid_scan - -if [ ! -x /lib/udev/vol_id ]; then - inst_rules 64-md-raid.rules -fi - -inst_rules "$moddir/61-dmraid-imsm.rules" -inst "$moddir/dmraid-cleanup.sh" /sbin/dmraid-cleanup -inst_hook pre-trigger 30 "$moddir/parse-dm.sh" - diff --git a/modules.d/90dmraid/module-info.sh b/modules.d/90dmraid/module-info.sh new file mode 100755 index 0000000..f437712 --- /dev/null +++ b/modules.d/90dmraid/module-info.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + # if we don't have dmraid installed on the host system, no point + # in trying to support it in the initramfs. + type -P dmraid >/dev/null || return 1 + + . $dracutfunctions + [[ $debug ]] && set -x + + is_dmraid() { get_fs_type /dev/block/$1 |grep -v linux_raid_member | \ + grep -q _raid_member; } + + [[ $hostonly ]] && { + rootdev=$(find_root_block_device) + if [[ $rootdev ]]; then + # root lives on a block device, so we can be more precise about + # hostonly checking + check_block_and_slaves is_dmraid "$rootdev" || return 1 + else + # root is not on a block device, use the shotgun approach + dmraid -r | grep -q ok || return 1 + fi + } + + return 0 +} + +depends() { + echo dm rootfs-block + return 0 +} + +install() { + dracut_install dmraid partx kpartx + + inst dmeventd + + for i in {"$libdir","$usrlibdir"}/libdmraid-events*.so; do + [ -e "$i" ] && dracut_install "$i" + done + + inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules + + inst "$moddir/dmraid.sh" /sbin/dmraid_scan + + if [ ! -x /lib/udev/vol_id ]; then + inst_rules 64-md-raid.rules + fi + + inst_rules "$moddir/61-dmraid-imsm.rules" + inst "$moddir/dmraid-cleanup.sh" /sbin/dmraid-cleanup + inst_hook pre-trigger 30 "$moddir/parse-dm.sh" + +} + diff --git a/modules.d/90dmsquash-live/check b/modules.d/90dmsquash-live/check deleted file mode 100755 index c25b2b8..0000000 --- a/modules.d/90dmsquash-live/check +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# if dmsetup is not installed, then we cannot support fedora/red hat -# style live images -if [ "$1" = "-d" ]; then - echo dm - exit 0 -fi - -# a live host-only image doesn't really make a lot of sense -if [ "$1" = "-h" ] ; then - exit 1 -fi - -exit 0 diff --git a/modules.d/90dmsquash-live/install b/modules.d/90dmsquash-live/install deleted file mode 100755 index ddbc90c..0000000 --- a/modules.d/90dmsquash-live/install +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -dracut_install umount -inst dmsetup -inst blkid -inst dd -inst losetup -inst grep - -# eject might be a symlink to consolehelper -if [ -L /usr/bin/eject ]; then - dracut_install /usr/sbin/eject -else - inst eject -fi - -inst blockdev -type -P checkisomd5 >/dev/null && inst checkisomd5 -inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh" -inst_hook pre-udev 30 "$moddir/dmsquash-live-genrules.sh" -inst_hook pre-udev 30 "$moddir/dmsquash-liveiso-genrules.sh" -inst "$moddir/dmsquash-live-root" "/sbin/dmsquash-live-root" -# should probably just be generally included -inst_rules 60-cdrom_id.rules diff --git a/modules.d/90dmsquash-live/module-info.sh b/modules.d/90dmsquash-live/module-info.sh new file mode 100755 index 0000000..2f46f67 --- /dev/null +++ b/modules.d/90dmsquash-live/module-info.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + # a live host-only image doesn't really make a lot of sense + [[ $hostonly ]] && return 1 + return 0 +} + +depends() { + # if dmsetup is not installed, then we cannot support fedora/red hat + # style live images + echo dm rootfs-block + return 0 +} + +install() { + dracut_install umount + inst dmsetup + inst blkid + inst dd + inst losetup + inst grep + + # eject might be a symlink to consolehelper + if [ -L /usr/bin/eject ]; then + dracut_install /usr/sbin/eject + else + inst eject + fi + + inst blockdev + type -P checkisomd5 >/dev/null && inst checkisomd5 + inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh" + inst_hook pre-udev 30 "$moddir/dmsquash-live-genrules.sh" + inst_hook pre-udev 30 "$moddir/dmsquash-liveiso-genrules.sh" + inst "$moddir/dmsquash-live-root" "/sbin/dmsquash-live-root" + # should probably just be generally included + inst_rules 60-cdrom_id.rules +} + diff --git a/modules.d/90kernel-modules/install b/modules.d/90kernel-modules/install deleted file mode 100755 index b635216..0000000 --- a/modules.d/90kernel-modules/install +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -[ -f /etc/modprobe.conf ] && dracut_install /etc/modprobe.conf -dracut_install $(find /etc/modprobe.d/ -type f -name '*.conf') -inst_hook cmdline 01 "$moddir/parse-kernel.sh" -inst "$srcmods/modules.builtin.bin" "/lib/modules/$kernel/modules.builtin.bin" diff --git a/modules.d/90kernel-modules/installkernel b/modules.d/90kernel-modules/installkernel deleted file mode 100755 index 4581668..0000000 --- a/modules.d/90kernel-modules/installkernel +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -if [[ -z $drivers ]]; then - block_module_test() { - local blockfuncs='ahci_init_controller|ata_scsi_ioctl|scsi_add_host|blk_init_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device' - - egrep -q "$blockfuncs" "$1" - } - hostonly='' instmods sr_mod sd_mod scsi_dh scsi_dh_rdac scsi_dh_emc - hostonly='' instmods pcmcia firewire-ohci - hostonly='' instmods usb_storage sdhci sdhci-pci - - # install keyboard support - hostonly='' instmods atkbd i8042 usbhid hid-apple hid-sunplus ehci-hcd ohci-hcd uhci-hcd - - instmods "=drivers/pcmcia" =ide "=drivers/usb/storage" - instmods $(filter_kernel_modules block_module_test) - # if not on hostonly mode, install all known filesystems if the required list is not set via the filesystems variable - if ! [[ $hostonly ]]; then - if [[ -z $filesystems ]]; then - instmods '=fs' - # hardcoded list of exceptions - # to save a lot of space - rm -fr ${initdir}/lib/modules/*/kernel/fs/ocfs2 - else - instmods $filesystems - fi - else - hostonly='' instmods $(get_fs_type "/dev/block/$(find_root_block_device)") - fi -else - hostonly='' instmods $drivers $filesystems -fi - -[[ $add_drivers ]] && hostonly='' instmods $add_drivers - -# force install of scsi_wait_scan -hostonly='' instmods scsi_wait_scan - diff --git a/modules.d/90kernel-modules/module-info.sh b/modules.d/90kernel-modules/module-info.sh new file mode 100755 index 0000000..342e650 --- /dev/null +++ b/modules.d/90kernel-modules/module-info.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +installkernel() { + if [[ -z $drivers ]]; then + block_module_test() { + local blockfuncs='ahci_init_controller|ata_scsi_ioctl|scsi_add_host|blk_init_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device' + + egrep -q "$blockfuncs" "$1" + } + hostonly='' instmods sr_mod sd_mod scsi_dh scsi_dh_rdac scsi_dh_emc + hostonly='' instmods pcmcia firewire-ohci + hostonly='' instmods usb_storage sdhci sdhci-pci + + # install keyboard support + hostonly='' instmods atkbd i8042 usbhid hid-apple hid-sunplus ehci-hcd ohci-hcd uhci-hcd + + instmods "=drivers/pcmcia" =ide "=drivers/usb/storage" + instmods $(filter_kernel_modules block_module_test) + # if not on hostonly mode, install all known filesystems, + # if the required list is not set via the filesystems variable + if ! [[ $hostonly ]]; then + if [[ -z $filesystems ]]; then + instmods '=fs' + # hardcoded list of exceptions + # to save a lot of space + rm -fr ${initdir}/lib/modules/*/kernel/fs/ocfs2 + else + instmods $filesystems + fi + else + hostonly='' instmods $(get_fs_type "/dev/block/$(find_root_block_device)") + fi + else + hostonly='' instmods $drivers $filesystems + fi + + [[ $add_drivers ]] && hostonly='' instmods $add_drivers + + # force install of scsi_wait_scan + hostonly='' instmods scsi_wait_scan +} + +install() { + [ -f /etc/modprobe.conf ] && dracut_install /etc/modprobe.conf + dracut_install $(find /etc/modprobe.d/ -type f -name '*.conf') + inst_hook cmdline 01 "$moddir/parse-kernel.sh" + inst "$srcmods/modules.builtin.bin" "/lib/modules/$kernel/modules.builtin.bin" +} diff --git a/modules.d/90lvm/check b/modules.d/90lvm/check deleted file mode 100755 index c211064..0000000 --- a/modules.d/90lvm/check +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# We depend on dm_mod being loaded -[ "$1" = "-d" ] && echo dm - -# No point trying to support lvm if the binaries are missing -type -P lvm >/dev/null || exit 1 - -. $dracutfunctions -[[ $debug ]] && set -x - -is_lvm() { [[ $(get_fs_type /dev/block/$1) = LVM2_member ]]; } - -[[ $1 = '-h' ]] && { - rootdev=$(find_root_block_device) - if [[ $rootdev ]]; then - # root lives on a block device, so we can be more precise about - # hostonly checking - check_block_and_slaves is_lvm "$rootdev" || exit 1 - else - # root is not on a block device, use the shotgun approach - blkid | grep -q LVM2_member || exit 1 - fi -} - -exit 0 diff --git a/modules.d/90lvm/install b/modules.d/90lvm/install deleted file mode 100755 index 8c40990..0000000 --- a/modules.d/90lvm/install +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -inst lvm - -inst_rules "$moddir/64-lvm.rules" - -if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then - if [ -f /etc/lvm/lvm.conf ]; then - inst /etc/lvm/lvm.conf - # FIXME: near-term hack to establish read-only locking; - # use command-line lvm.conf editor once it is available - sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 4/' ${initdir}/etc/lvm/lvm.conf - fi -fi - -inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules 11-dm-lvm.rules - -inst "$moddir/lvm_scan.sh" /sbin/lvm_scan -inst_hook cmdline 30 "$moddir/parse-lvm.sh" - -for i in {"$libdir","$usrlibdir"}/libdevmapper-event-lvm*.so; do - [ -e "$i" ] && dracut_install "$i" -done diff --git a/modules.d/90lvm/module-info.sh b/modules.d/90lvm/module-info.sh new file mode 100755 index 0000000..2555728 --- /dev/null +++ b/modules.d/90lvm/module-info.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + # No point trying to support lvm if the binaries are missing + type -P lvm >/dev/null || return 1 + + . $dracutfunctions + [[ $debug ]] && set -x + + is_lvm() { [[ $(get_fs_type /dev/block/$1) = LVM2_member ]]; } + + [[ $hostonly ]] && { + rootdev=$(find_root_block_device) + if [[ $rootdev ]]; then + # root lives on a block device, so we can be more precise about + # hostonly checking + check_block_and_slaves is_lvm "$rootdev" || return 1 + else + # root is not on a block device, use the shotgun approach + blkid | grep -q LVM2_member || return 1 + fi + } + + return 0 +} + +depends() { + # We depend on dm_mod being loaded + echo rootfs-block dm + return 0 +} + +install() { + inst lvm + + inst_rules "$moddir/64-lvm.rules" + + if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then + if [ -f /etc/lvm/lvm.conf ]; then + inst /etc/lvm/lvm.conf + # FIXME: near-term hack to establish read-only locking; + # use command-line lvm.conf editor once it is available + sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 4/' ${initdir}/etc/lvm/lvm.conf + fi + fi + + inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules 11-dm-lvm.rules + + inst "$moddir/lvm_scan.sh" /sbin/lvm_scan + inst_hook cmdline 30 "$moddir/parse-lvm.sh" + + for i in {"$libdir","$usrlibdir"}/libdevmapper-event-lvm*.so; do + [ -e "$i" ] && dracut_install "$i" + done +} + diff --git a/modules.d/90mdraid/check b/modules.d/90mdraid/check deleted file mode 100755 index 6996d84..0000000 --- a/modules.d/90mdraid/check +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# No mdadm? No mdraid support. -type -P mdadm >/dev/null || exit 1 - -. $dracutfunctions -[[ $debug ]] && set -x - -is_mdraid() { [[ -d "/sys/dev/block/$1/md" ]]; } - -[[ $1 = '-h' ]] && { - rootdev=$(find_root_block_device) - if [[ $rootdev ]]; then - # root lives on a block device, so we can be more precise about - # hostonly checking - check_block_and_slaves is_mdraid "$rootdev" || exit 1 - else - # root is not on a block device, use the shotgun approach - blkid | egrep -q '(linux|isw)_raid' || exit 1 - fi -} - -exit 0 diff --git a/modules.d/90mdraid/install b/modules.d/90mdraid/install deleted file mode 100755 index 80abda3..0000000 --- a/modules.d/90mdraid/install +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -dracut_install mdadm partx - - -# XXX: mdmon really needs to run as non-root? -# If so, write only the user it needs in the initrd's /etc/passwd (and maybe /etc/group) -# in a similar fashion to modules.d/95nfs. Do not copy /etc/passwd and /etc/group from -# the system into the initrd. -# dledford has hardware to test this, so he should be able to clean this up. -# inst /etc/passwd -# inst /etc/group - -if [ ! -x /lib/udev/vol_id ]; then - inst_rules 64-md-raid.rules -fi - -inst_rules "$moddir/65-md-incremental-imsm.rules" - -if ! mdadm -Q -e imsm /dev/null &> /dev/null; then - inst_hook pre-trigger 30 "$moddir/md-noimsm.sh" -fi - -if [[ $hostonly ]] || [[ $mdadmconf = "yes" ]]; then - if [ -f /etc/mdadm.conf ]; then - inst /etc/mdadm.conf - else - [ -f /etc/mdadm/mdadm.conf ] && inst /etc/mdadm/mdadm.conf /etc/mdadm.conf - fi -fi - -if [ -x /sbin/mdmon ] ; then - dracut_install mdmon -fi -inst_hook pre-udev 30 "$moddir/mdmon-pre-udev.sh" - -inst "$moddir/mdraid_start.sh" /sbin/mdraid_start -inst "$moddir/mdcontainer_start.sh" /sbin/mdcontainer_start -inst "$moddir/mdadm_auto.sh" /sbin/mdadm_auto -inst "$moddir/md_finished.sh" /sbin/md_finished.sh -inst_hook pre-trigger 30 "$moddir/parse-md.sh" -inst "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup diff --git a/modules.d/90mdraid/installkernel b/modules.d/90mdraid/installkernel deleted file mode 100755 index 679ac8e..0000000 --- a/modules.d/90mdraid/installkernel +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -instmods =drivers/md - diff --git a/modules.d/90mdraid/module-info.sh b/modules.d/90mdraid/module-info.sh new file mode 100755 index 0000000..8f69822 --- /dev/null +++ b/modules.d/90mdraid/module-info.sh @@ -0,0 +1,80 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + # No mdadm? No mdraid support. + type -P mdadm >/dev/null || return 1 + + . $dracutfunctions + [[ $debug ]] && set -x + + is_mdraid() { [[ -d "/sys/dev/block/$1/md" ]]; } + + [[ $hostonly ]] && { + rootdev=$(find_root_block_device) + if [[ $rootdev ]]; then + # root lives on a block device, so we can be more precise about + # hostonly checking + check_block_and_slaves is_mdraid "$rootdev" || return 1 + else + # root is not on a block device, use the shotgun approach + blkid | egrep -q '(linux|isw)_raid' || return 1 + fi + } + + return 0 +} + +depends() { + echo rootfs-block + return 0 +} + +installkernel() { + instmods =drivers/md +} + +install() { + dracut_install mdadm partx + + + # XXX: mdmon really needs to run as non-root? + # If so, write only the user it needs in the initrd's /etc/passwd (and maybe /etc/group) + # in a similar fashion to modules.d/95nfs. Do not copy /etc/passwd and /etc/group from + # the system into the initrd. + # dledford has hardware to test this, so he should be able to clean this up. + # inst /etc/passwd + # inst /etc/group + + if [ ! -x /lib/udev/vol_id ]; then + inst_rules 64-md-raid.rules + fi + + inst_rules "$moddir/65-md-incremental-imsm.rules" + + if ! mdadm -Q -e imsm /dev/null &> /dev/null; then + inst_hook pre-trigger 30 "$moddir/md-noimsm.sh" + fi + + if [[ $hostonly ]] || [[ $mdadmconf = "yes" ]]; then + if [ -f /etc/mdadm.conf ]; then + inst /etc/mdadm.conf + else + [ -f /etc/mdadm/mdadm.conf ] && inst /etc/mdadm/mdadm.conf /etc/mdadm.conf + fi + fi + + if [ -x /sbin/mdmon ] ; then + dracut_install mdmon + fi + inst_hook pre-udev 30 "$moddir/mdmon-pre-udev.sh" + + inst "$moddir/mdraid_start.sh" /sbin/mdraid_start + inst "$moddir/mdcontainer_start.sh" /sbin/mdcontainer_start + inst "$moddir/mdadm_auto.sh" /sbin/mdadm_auto + inst "$moddir/md_finished.sh" /sbin/md_finished.sh + inst_hook pre-trigger 30 "$moddir/parse-md.sh" + inst "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup +} + diff --git a/modules.d/90multipath/check b/modules.d/90multipath/check deleted file mode 100755 index 39d1fd2..0000000 --- a/modules.d/90multipath/check +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# if there's no multipath binary, no go. -type -P multipath >/dev/null || exit 1 - -[[ $1 = -d ]] && exit 0 - -. $dracutfunctions -[[ $debug ]] && set -x - -is_mpath() { - [ -e /sys/dev/block/$1/dm/uuid ] || return 1 - [[ $(cat /sys/dev/block/$1/dm/uuid) =~ ^mpath- ]] && return 0 - return 1 -} - -if [[ $1 = -h ]]; then - rootdev=$(find_root_block_device) - if [[ $rootdev ]]; then - check_block_and_slaves is_mpath "$rootdev" && exit 0 - fi - exit 1 -fi - -exit 0 diff --git a/modules.d/90multipath/install b/modules.d/90multipath/install deleted file mode 100755 index 57ac690..0000000 --- a/modules.d/90multipath/install +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -for f in \ - /sbin/dmsetup \ - /sbin/kpartx \ - /sbin/mpath_wait \ - /sbin/multipath \ - /sbin/multipathd \ - /sbin/xdrgetuid \ - /sbin/xdrgetprio \ - /etc/xdrdevices.conf \ - /etc/multipath.conf \ - /etc/multipath/* \ - "$libdir"/libmultipath* "$libdir"/multipath/*; do - [ -e "$f" ] && inst "$f" -done - -inst_hook pre-trigger 02 "$moddir/multipathd.sh" -inst_hook pre-pivot 02 "$moddir/multipathd-stop.sh" -inst_rules 40-multipath.rules diff --git a/modules.d/90multipath/installkernel b/modules.d/90multipath/installkernel deleted file mode 100755 index dbbbd27..0000000 --- a/modules.d/90multipath/installkernel +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -mp_mod_test() { - local mpfuncs='scsi_register_device_handler|dm_dirty_log_type_register|dm_register_path_selector|dm_register_target' - egrep -q "$mpfuncs" "$1" -} - -instmods $(filter_kernel_modules mp_mod_test) diff --git a/modules.d/90multipath/module-info.sh b/modules.d/90multipath/module-info.sh new file mode 100755 index 0000000..f78517c --- /dev/null +++ b/modules.d/90multipath/module-info.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + # if there's no multipath binary, no go. + type -P multipath >/dev/null || return 1 + + . $dracutfunctions + [[ $debug ]] && set -x + + is_mpath() { + [ -e /sys/dev/block/$1/dm/uuid ] || return 1 + [[ $(cat /sys/dev/block/$1/dm/uuid) =~ ^mpath- ]] && return 0 + return 1 + } + + if [[ $hostonly ]]; then + rootdev=$(find_root_block_device) + if [[ $rootdev ]]; then + check_block_and_slaves is_mpath "$rootdev" && return 0 + fi + return 1 + fi + + return 0 +} + +depends() { + echo rootfs-block + return 0 +} + +installkernel() { + mp_mod_test() { + local mpfuncs='scsi_register_device_handler|dm_dirty_log_type_register|dm_register_path_selector|dm_register_target' + egrep -q "$mpfuncs" "$1" + } + + instmods $(filter_kernel_modules mp_mod_test) +} + +install() { + for f in \ + /sbin/dmsetup \ + /sbin/kpartx \ + /sbin/mpath_wait \ + /sbin/multipath \ + /sbin/multipathd \ + /sbin/xdrgetuid \ + /sbin/xdrgetprio \ + /etc/xdrdevices.conf \ + /etc/multipath.conf \ + /etc/multipath/* \ + "$libdir"/libmultipath* "$libdir"/multipath/*; do + [ -e "$f" ] && inst "$f" + done + + inst_hook pre-trigger 02 "$moddir/multipathd.sh" + inst_hook pre-pivot 02 "$moddir/multipathd-stop.sh" + inst_rules 40-multipath.rules +} + diff --git a/modules.d/95dasd/check b/modules.d/95dasd/check deleted file mode 100755 index d9b6117..0000000 --- a/modules.d/95dasd/check +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -arch=$(uname -m) -[ "$arch" = "s390" -o "$arch" = "s390x" ] || exit 1 - -exit 0 diff --git a/modules.d/95dasd/install b/modules.d/95dasd/install deleted file mode 100755 index 54503db..0000000 --- a/modules.d/95dasd/install +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -inst_hook cmdline 30 "$moddir/parse-dasd.sh" -dracut_install tr dasdinfo dasdconf.sh -if [[ $hostonly ]]; then - inst /etc/dasd.conf -fi -inst_rules 56-dasd.rules -inst_rules 59-dasd.rules diff --git a/modules.d/95dasd/installkernel b/modules.d/95dasd/installkernel deleted file mode 100755 index 450f06e..0000000 --- a/modules.d/95dasd/installkernel +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -instmods dasd_mod dasd_eckd_mod dasd_fba_mod dasd_diag_mod - diff --git a/modules.d/95dasd/module-info.sh b/modules.d/95dasd/module-info.sh new file mode 100755 index 0000000..0cfb7b9 --- /dev/null +++ b/modules.d/95dasd/module-info.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + arch=$(uname -m) + [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 + return 0 +} + +depends() { + return 0 +} + +installkernel() { + instmods dasd_mod dasd_eckd_mod dasd_fba_mod dasd_diag_mod +} + +install() { + inst_hook cmdline 30 "$moddir/parse-dasd.sh" + dracut_install tr dasdinfo dasdconf.sh + if [[ $hostonly ]]; then + inst /etc/dasd.conf + fi + inst_rules 56-dasd.rules + inst_rules 59-dasd.rules +} + diff --git a/modules.d/95dasd_mod/check b/modules.d/95dasd_mod/check deleted file mode 100755 index dcd2421..0000000 --- a/modules.d/95dasd_mod/check +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -arch=$(uname -m) -[ "$arch" = "s390" -o "$arch" = "s390x" ] || exit 1 - -exit 0 diff --git a/modules.d/95dasd_mod/install b/modules.d/95dasd_mod/install deleted file mode 100755 index 3a74a7a..0000000 --- a/modules.d/95dasd_mod/install +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -inst_hook cmdline 31 "$moddir/parse-dasd-mod.sh" -dracut_install dasd_cio_free grep sed seq - diff --git a/modules.d/95dasd_mod/installkernel b/modules.d/95dasd_mod/installkernel deleted file mode 100755 index f8ba37a..0000000 --- a/modules.d/95dasd_mod/installkernel +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -instmods dasd_mod dasd_eckd_mod dasd_fba_mod dasd_diag_mod - - diff --git a/modules.d/95dasd_mod/module-info.sh b/modules.d/95dasd_mod/module-info.sh new file mode 100755 index 0000000..0f8700c --- /dev/null +++ b/modules.d/95dasd_mod/module-info.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + arch=$(uname -m) + [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 + + return 0 +} + +depends() { + return 0 +} + +installkernel() { + instmods dasd_mod dasd_eckd_mod dasd_fba_mod dasd_diag_mod +} + +install() { + inst_hook cmdline 31 "$moddir/parse-dasd-mod.sh" + dracut_install dasd_cio_free grep sed seq +} + diff --git a/modules.d/95debug/check b/modules.d/95debug/check deleted file mode 100755 index d61ec69..0000000 --- a/modules.d/95debug/check +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# do not add this module by default -exit 1 diff --git a/modules.d/95debug/install b/modules.d/95debug/install deleted file mode 100755 index 0112aac..0000000 --- a/modules.d/95debug/install +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -dracut_install -o ps grep more cat rm strace free showmount -dracut_install -o ping netstat rpcinfo vi scp ping6 ssh -dracut_install -o fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.vfat e2fsck - diff --git a/modules.d/95debug/module-info.sh b/modules.d/95debug/module-info.sh new file mode 100755 index 0000000..0c17251 --- /dev/null +++ b/modules.d/95debug/module-info.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + # do not add this module by default + return 255 +} + +depends() { + return 0 +} + +install() { + dracut_install -o ps grep more cat rm strace free showmount + dracut_install -o ping netstat rpcinfo vi scp ping6 ssh + dracut_install -o fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.vfat e2fsck + +} + diff --git a/modules.d/95fcoe/check b/modules.d/95fcoe/check deleted file mode 100755 index e3bd344..0000000 --- a/modules.d/95fcoe/check +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# We depend on network modules being loaded -[ "$1" = "-d" ] && echo network - -# FIXME -# If hostonly was requested, fail the check until we have some way of -# knowing we are booting from FCoE -[ "$1" = "-h" ] && exit 1 - -exit 0 diff --git a/modules.d/95fcoe/install b/modules.d/95fcoe/install deleted file mode 100755 index 53f8ca4..0000000 --- a/modules.d/95fcoe/install +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -dracut_install ip -inst dcbtool -inst fipvlan -inst lldpad - -mkdir -p "$initdir/var/lib/lldpad" - -inst "$moddir/fcoe-up" "/sbin/fcoe-up" -inst_hook pre-udev 60 "$moddir/fcoe-genrules.sh" -inst_hook cmdline 99 "$moddir/parse-fcoe.sh" diff --git a/modules.d/95fcoe/installkernel b/modules.d/95fcoe/installkernel deleted file mode 100755 index 4f1aec6..0000000 --- a/modules.d/95fcoe/installkernel +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -instmods fcoe 8021q diff --git a/modules.d/95fcoe/module-info.sh b/modules.d/95fcoe/module-info.sh new file mode 100755 index 0000000..d5500bb --- /dev/null +++ b/modules.d/95fcoe/module-info.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + # FIXME + # If hostonly was requested, fail the check until we have some way of + # knowing we are booting from FCoE + [[ $hostonly ]] && return 1 + + return 0 +} + +depends() { + echo network rootfs-block + return 0 +} + +installkernel() { + instmods fcoe 8021q +} + +install() { + dracut_install ip + inst dcbtool + inst fipvlan + inst lldpad + + mkdir -p "$initdir/var/lib/lldpad" + + inst "$moddir/fcoe-up" "/sbin/fcoe-up" + inst_hook pre-udev 60 "$moddir/fcoe-genrules.sh" + inst_hook cmdline 99 "$moddir/parse-fcoe.sh" +} + diff --git a/modules.d/95fstab-sys/check b/modules.d/95fstab-sys/check deleted file mode 100755 index f5e2f55..0000000 --- a/modules.d/95fstab-sys/check +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -test -f /etc/fstab.sys diff --git a/modules.d/95fstab-sys/install b/modules.d/95fstab-sys/install deleted file mode 100755 index a42ee25..0000000 --- a/modules.d/95fstab-sys/install +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -dracut_install /etc/fstab.sys -inst_hook pre-pivot 00 "$moddir/mount-sys.sh" diff --git a/modules.d/95fstab-sys/module-info.sh b/modules.d/95fstab-sys/module-info.sh new file mode 100755 index 0000000..f46c037 --- /dev/null +++ b/modules.d/95fstab-sys/module-info.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + test -f /etc/fstab.sys +} + +depends() { + return 0 +} + +install() { + dracut_install /etc/fstab.sys + inst_hook pre-pivot 00 "$moddir/mount-sys.sh" +} diff --git a/modules.d/95iscsi/check b/modules.d/95iscsi/check deleted file mode 100755 index f943359..0000000 --- a/modules.d/95iscsi/check +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# We depend on network modules being loaded -[ "$1" = "-d" ] && echo network - -# If our prerequisites are not met, fail anyways. -type -P iscsistart hostname iscsi-iname >/dev/null || exit 1 - -# If hostonly was requested, fail the check if we are not actually -# booting from root. - -. $dracutfunctions - -[[ $debug ]] && set -x - -is_iscsi() ( - [[ -L /sys/dev/block/$1 ]] || return - cd "$(readlink -f /sys/dev/block/$1)" - until [[ -d sys || -d iscsi_session ]]; do - cd .. - done - [[ -d iscsi_session ]] -) - -case $1 in - -h) rootdev=$(find_root_block_device) - if [[ $rootdev ]]; then - # root lives on a block device, so we can be more precise about - # hostonly checking - check_block_and_slaves is_iscsi "$rootdev" || exit 1 - else - exit 1 - fi ;; -esac - -exit 0 diff --git a/modules.d/95iscsi/install b/modules.d/95iscsi/install deleted file mode 100755 index a0db7c5..0000000 --- a/modules.d/95iscsi/install +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -dracut_install umount -inst iscsistart -inst hostname -inst iscsi-iname -inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh" -inst "$moddir/iscsiroot" "/sbin/iscsiroot" -inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh" diff --git a/modules.d/95iscsi/installkernel b/modules.d/95iscsi/installkernel deleted file mode 100755 index 80dd639..0000000 --- a/modules.d/95iscsi/installkernel +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -instmods iscsi_tcp crc32c iscsi_ibft diff --git a/modules.d/95iscsi/module-info.sh b/modules.d/95iscsi/module-info.sh new file mode 100755 index 0000000..23c612a --- /dev/null +++ b/modules.d/95iscsi/module-info.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + # If our prerequisites are not met, fail anyways. + type -P iscsistart hostname iscsi-iname >/dev/null || return 1 + + # If hostonly was requested, fail the check if we are not actually + # booting from root. + + . $dracutfunctions + + [[ $debug ]] && set -x + + is_iscsi() ( + [[ -L /sys/dev/block/$1 ]] || return + cd "$(readlink -f /sys/dev/block/$1)" + until [[ -d sys || -d iscsi_session ]]; do + cd .. + done + [[ -d iscsi_session ]] + ) + + [[ $hostonly ]] && { + rootdev=$(find_root_block_device) + if [[ $rootdev ]]; then + # root lives on a block device, so we can be more precise about + # hostonly checking + check_block_and_slaves is_iscsi "$rootdev" || return 1 + else + return 1 + fi + } + return 0 +} + +depends() { + echo network rootfs-block +} + +installkernel() { + instmods iscsi_tcp crc32c iscsi_ibft +} + +install() { + dracut_install umount + inst iscsistart + inst hostname + inst iscsi-iname + inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh" + inst "$moddir/iscsiroot" "/sbin/iscsiroot" + inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh" +} diff --git a/modules.d/95nbd/check b/modules.d/95nbd/check deleted file mode 100755 index adbeb7a..0000000 --- a/modules.d/95nbd/check +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -# We depend on network modules being loaded -[ "$1" = "-d" ] && echo network - -# If our prerequisites are not met, fail. -type -P nbd-client >/dev/null || exit 1 - -# if an nbd device is not somewhere in the chain of devices root is mounted on, -# fail the hostonly check. -[ "$1" = "-h" ] && { - is_nbd() { [[ -b /dev/block/$1 && $1 == 43:* ]] ;} - . $dracutfunctions - - rootdev=$(find_root_block_device) - [[ -b /dev/block/$rootdev ]] || exit 1 - check_block_and_slaves is_nbd "$rootdev" || exit 1 -} - -exit 0 diff --git a/modules.d/95nbd/install b/modules.d/95nbd/install deleted file mode 100755 index 1fcd952..0000000 --- a/modules.d/95nbd/install +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -inst nbd-client -inst_hook cmdline 90 "$moddir/parse-nbdroot.sh" - -inst "$moddir/nbdroot" "/sbin/nbdroot" diff --git a/modules.d/95nbd/installkernel b/modules.d/95nbd/installkernel deleted file mode 100755 index 38d413d..0000000 --- a/modules.d/95nbd/installkernel +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -instmods nbd diff --git a/modules.d/95nbd/module-info.sh b/modules.d/95nbd/module-info.sh new file mode 100755 index 0000000..3cf14ef --- /dev/null +++ b/modules.d/95nbd/module-info.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + # If our prerequisites are not met, fail. + type -P nbd-client >/dev/null || return 1 + + # if an nbd device is not somewhere in the chain of devices root is + # mounted on, fail the hostonly check. + [[ $hostonly ]] && { + is_nbd() { [[ -b /dev/block/$1 && $1 == 43:* ]] ;} + . $dracutfunctions + + rootdev=$(find_root_block_device) + [[ -b /dev/block/$rootdev ]] || return 1 + check_block_and_slaves is_nbd "$rootdev" || return 1 + } + + return 0 +} + +depends() { + # We depend on network modules being loaded + echo network rootfs-block +} + +installkernel() { + instmods nbd +} + +install() { + inst nbd-client + inst_hook cmdline 90 "$moddir/parse-nbdroot.sh" + + inst "$moddir/nbdroot" "/sbin/nbdroot" +} + diff --git a/modules.d/95nfs/check b/modules.d/95nfs/check deleted file mode 100755 index 5eb2d6a..0000000 --- a/modules.d/95nfs/check +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# We depend on network modules being loaded -[ "$1" = "-d" ] && echo network - -# If hostonly was requested, fail the check if we are not actually -# booting from root. -[ "$1" = "-h" ] && ! egrep -q '/ nfs[34 ]' /proc/mounts && exit 1 - -# If our prerequisites are not met, fail anyways. -type -P rpcbind >/dev/null || type -P portmap >/dev/null || exit 1 -type -P rpc.statd mount.nfs mount.nfs4 umount >/dev/null || exit 1 -exit 0 diff --git a/modules.d/95nfs/install b/modules.d/95nfs/install deleted file mode 100755 index 455fbbf..0000000 --- a/modules.d/95nfs/install +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -type -P portmap >/dev/null && dracut_install portmap -type -P rpcbind >/dev/null && dracut_install rpcbind - -dracut_install rpc.statd mount.nfs mount.nfs4 umount -[ -f /etc/netconfig ] && dracut_install /etc/netconfig -dracut_install /etc/services -dracut_install /etc/nsswitch.conf /etc/rpc /etc/protocols -dracut_install rpc.idmapd /etc/idmapd.conf -dracut_install sed - -for i in {"$libdir","$usrlibdir"}/libnfsidmap_nsswitch.so* \ - {"$libdir","$usrlibdir"}/libnfsidmap/*.so \ - {"$libdir","$usrlibdir"}/libnfsidmap*.so*; do - [ -e "$i" ] && dracut_install "$i" -done - -nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \ - | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|') -nsslibs=${nsslibs#|} -nsslibs=${nsslibs%|} - -dracut_install $(for i in $(ls {/usr,}$libdir/libnss*.so 2>/dev/null); do echo $i;done | egrep "$nsslibs") - -inst_hook cmdline 90 "$moddir/parse-nfsroot.sh" -inst_hook pre-pivot 99 "$moddir/nfsroot-cleanup.sh" -inst "$moddir/nfsroot" "/sbin/nfsroot" -mkdir -p "$initdir/var/lib/nfs/rpc_pipefs" -mkdir -p "$initdir/var/lib/rpcbind" -mkdir -p "$initdir/var/lib/nfs/statd/sm" - -# Rather than copy the passwd file in, just set a user for rpcbind -# We'll save the state and restart the daemon from the root anyway -egrep '^root:' "$initdir/etc/passwd" 2>/dev/null || echo 'root:x:0:0::/:/bin/sh' >> "$initdir/etc/passwd" -egrep '^nobody:' /etc/passwd >> "$initdir/etc/passwd" -egrep '^nfsnobody:' /etc/passwd >> "$initdir/etc/passwd" -egrep '^rpc:' /etc/passwd >> "$initdir/etc/passwd" -egrep '^rpcuser:' /etc/passwd >> "$initdir/etc/passwd" -#type -P nologin >/dev/null && dracut_install nologin - -# rpc user needs to be able to write to this directory to save the warmstart -# file -chmod 777 "$initdir/var/lib/rpcbind" diff --git a/modules.d/95nfs/installkernel b/modules.d/95nfs/installkernel deleted file mode 100755 index b4f6d99..0000000 --- a/modules.d/95nfs/installkernel +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -instmods nfs sunrpc ipv6 diff --git a/modules.d/95nfs/module-info.sh b/modules.d/95nfs/module-info.sh new file mode 100755 index 0000000..84673ab --- /dev/null +++ b/modules.d/95nfs/module-info.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + # If hostonly was requested, fail the check if we are not actually + # booting from root. + [ $hostonly ] && ! egrep -q '/ nfs[34 ]' /proc/mounts && return 1 + + # If our prerequisites are not met, fail anyways. + type -P rpcbind >/dev/null || type -P portmap >/dev/null || return 1 + type -P rpc.statd mount.nfs mount.nfs4 umount >/dev/null || return 1 + return 0 +} + +depends() { + # We depend on network modules being loaded + echo network +} + +installkernel() { + instmods nfs sunrpc ipv6 +} + +install() { + type -P portmap >/dev/null && dracut_install portmap + type -P rpcbind >/dev/null && dracut_install rpcbind + + dracut_install rpc.statd mount.nfs mount.nfs4 umount + [ -f /etc/netconfig ] && dracut_install /etc/netconfig + dracut_install /etc/services + dracut_install /etc/nsswitch.conf /etc/rpc /etc/protocols + dracut_install rpc.idmapd /etc/idmapd.conf + dracut_install sed + + for i in {"$libdir","$usrlibdir"}/libnfsidmap_nsswitch.so* \ + {"$libdir","$usrlibdir"}/libnfsidmap/*.so \ + {"$libdir","$usrlibdir"}/libnfsidmap*.so*; do + [ -e "$i" ] && dracut_install "$i" + done + + nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \ + | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|') + nsslibs=${nsslibs#|} + nsslibs=${nsslibs%|} + + dracut_install $(for i in $(ls {/usr,}$libdir/libnss*.so 2>/dev/null); do echo $i;done | egrep "$nsslibs") + + inst_hook cmdline 90 "$moddir/parse-nfsroot.sh" + inst_hook pre-pivot 99 "$moddir/nfsroot-cleanup.sh" + inst "$moddir/nfsroot" "/sbin/nfsroot" + mkdir -p "$initdir/var/lib/nfs/rpc_pipefs" + mkdir -p "$initdir/var/lib/rpcbind" + mkdir -p "$initdir/var/lib/nfs/statd/sm" + + # Rather than copy the passwd file in, just set a user for rpcbind + # We'll save the state and restart the daemon from the root anyway + egrep '^root:' "$initdir/etc/passwd" 2>/dev/null || echo 'root:x:0:0::/:/bin/sh' >> "$initdir/etc/passwd" + egrep '^nobody:' /etc/passwd >> "$initdir/etc/passwd" + egrep '^nfsnobody:' /etc/passwd >> "$initdir/etc/passwd" + egrep '^rpc:' /etc/passwd >> "$initdir/etc/passwd" + egrep '^rpcuser:' /etc/passwd >> "$initdir/etc/passwd" + #type -P nologin >/dev/null && dracut_install nologin + + # rpc user needs to be able to write to this directory to save the warmstart + # file + chmod 777 "$initdir/var/lib/rpcbind" +} + diff --git a/modules.d/95resume/install b/modules.d/95resume/install deleted file mode 100755 index 330a3ea..0000000 --- a/modules.d/95resume/install +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# Optional uswsusp support -for bin in /usr/sbin/resume /usr/lib/suspend/resume -do - [[ -x "${bin}" ]] && { - inst "${bin}" /usr/sbin/resume - [[ -f /etc/suspend.conf ]] && inst /etc/suspend.conf - break - } -done - -inst_hook cmdline 10 "$moddir/parse-resume.sh" -inst_hook pre-udev 30 "$moddir/resume-genrules.sh" -inst_hook mount 10 "$moddir/resume.sh" diff --git a/modules.d/95resume/module-info.sh b/modules.d/95resume/module-info.sh new file mode 100755 index 0000000..cde9fca --- /dev/null +++ b/modules.d/95resume/module-info.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +install() { + # Optional uswsusp support + for bin in /usr/sbin/resume /usr/lib/suspend/resume + do + [[ -x "${bin}" ]] && { + inst "${bin}" /usr/sbin/resume + [[ -f /etc/suspend.conf ]] && inst /etc/suspend.conf + break + } + done + + inst_hook cmdline 10 "$moddir/parse-resume.sh" + inst_hook pre-udev 30 "$moddir/resume-genrules.sh" + inst_hook mount 10 "$moddir/resume.sh" +} + diff --git a/modules.d/95rootfs-block/install b/modules.d/95rootfs-block/install deleted file mode 100755 index 9e2c834..0000000 --- a/modules.d/95rootfs-block/install +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -dracut_install umount -dracut_install /sbin/fsck* -type -P e2fsck >/dev/null && dracut_install e2fsck -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" diff --git a/modules.d/95rootfs-block/module-info.sh b/modules.d/95rootfs-block/module-info.sh new file mode 100755 index 0000000..419351b --- /dev/null +++ b/modules.d/95rootfs-block/module-info.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +install() { + dracut_install umount + dracut_install /sbin/fsck* + type -P e2fsck >/dev/null && dracut_install e2fsck + 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" +} + diff --git a/modules.d/95terminfo/install b/modules.d/95terminfo/install deleted file mode 100755 index 0509645..0000000 --- a/modules.d/95terminfo/install +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# terminfo bits make things work better if you fall into interactive mode -for TERMINFODIR in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -d ${TERMINFODIR} ] && break -done - -[ -d ${TERMINFODIR} ] && \ - dracut_install $(find ${TERMINFODIR} -type f) diff --git a/modules.d/95terminfo/module-info.sh b/modules.d/95terminfo/module-info.sh new file mode 100755 index 0000000..8022db3 --- /dev/null +++ b/modules.d/95terminfo/module-info.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +install() { + # terminfo bits make things work better if you fall into interactive mode + for TERMINFODIR in /lib/terminfo /etc/terminfo /usr/share/terminfo; do + [ -d ${TERMINFODIR} ] && break + done + + [ -d ${TERMINFODIR} ] && \ + dracut_install $(find ${TERMINFODIR} -type f) +} + diff --git a/modules.d/95udev-rules/install b/modules.d/95udev-rules/install deleted file mode 100755 index ee32b56..0000000 --- a/modules.d/95udev-rules/install +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# FIXME: would be nice if we didn't have to know which rules to grab.... -# ultimately, /lib/initramfs/rules.d or somesuch which includes links/copies -# of the rules we want so that we just copy those in would be best -dracut_install udevd udevadm /etc/udev/udev.conf /etc/group -dracut_install basename -inst_rules 50-udev-default.rules 60-persistent-storage.rules \ - 61-persistent-storage-edd.rules 80-drivers.rules 95-udev-late.rules \ - 60-pcmcia.rules -#Some debian udev rules are named differently -inst_rules 50-udev.rules 95-late.rules - -# ignore some devices in the initrd -inst_rules "$moddir/01-ignore.rules" - -# for firmware loading -inst_rules 50-firmware.rules -dracut_install cat uname - -if [ ! -x /lib/udev/vol_id ]; then - dracut_install blkid - inst_rules "$moddir/59-persistent-storage.rules" -else - inst_rules "$moddir/59-persistent-storage-volid.rules" -fi -inst_rules "$moddir/61-persistent-storage.rules" - -for i in \ - ata_id \ - cdrom_id \ - create_floppy_devices \ - edd_id \ - firmware.sh \ - firmware \ - firmware.agent \ - hotplug.functions \ - fw_unit_symlinks.sh \ - hid2hci \ - path_id \ - scsi_id \ - usb_id \ - vol_id \ - pcmcia-socket-startup \ - pcmcia-check-broken-cis \ - ; do - [ -e /lib/udev/$i ] && dracut_install /lib/udev/$i -done - -[ -f /etc/arch-release ] && inst "$moddir/load-modules.sh" /lib/udev/load-modules.sh - -for i in {"$libdir","$usrlibdir"}/libnss_files*; do - [ -e "$i" ] && dracut_install "$i" -done diff --git a/modules.d/95udev-rules/module-info.sh b/modules.d/95udev-rules/module-info.sh new file mode 100755 index 0000000..944bbc2 --- /dev/null +++ b/modules.d/95udev-rules/module-info.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +install() { + # FIXME: would be nice if we didn't have to know which rules to grab.... + # ultimately, /lib/initramfs/rules.d or somesuch which includes links/copies + # of the rules we want so that we just copy those in would be best + dracut_install udevd udevadm /etc/udev/udev.conf /etc/group + dracut_install basename + inst_rules 50-udev-default.rules 60-persistent-storage.rules \ + 61-persistent-storage-edd.rules 80-drivers.rules 95-udev-late.rules \ + 60-pcmcia.rules + #Some debian udev rules are named differently + inst_rules 50-udev.rules 95-late.rules + + # ignore some devices in the initrd + inst_rules "$moddir/01-ignore.rules" + + # for firmware loading + inst_rules 50-firmware.rules + dracut_install cat uname + + if [ ! -x /lib/udev/vol_id ]; then + dracut_install blkid + inst_rules "$moddir/59-persistent-storage.rules" + else + inst_rules "$moddir/59-persistent-storage-volid.rules" + fi + inst_rules "$moddir/61-persistent-storage.rules" + + for i in \ + ata_id \ + cdrom_id \ + create_floppy_devices \ + edd_id \ + firmware.sh \ + firmware \ + firmware.agent \ + hotplug.functions \ + fw_unit_symlinks.sh \ + hid2hci \ + path_id \ + scsi_id \ + usb_id \ + vol_id \ + pcmcia-socket-startup \ + pcmcia-check-broken-cis \ + ; do + [ -e /lib/udev/$i ] && dracut_install /lib/udev/$i + done + + [ -f /etc/arch-release ] && \ + inst "$moddir/load-modules.sh" /lib/udev/load-modules.sh + + for i in {"$libdir","$usrlibdir"}/libnss_files*; do + [ -e "$i" ] && dracut_install "$i" + done +} + diff --git a/modules.d/95zfcp/check b/modules.d/95zfcp/check deleted file mode 100755 index 3090f6d..0000000 --- a/modules.d/95zfcp/check +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -arch=$(uname -m) -[ "$arch" = "s390" -o "$arch" = "s390x" ] || exit 1 - -exit 0 diff --git a/modules.d/95zfcp/install b/modules.d/95zfcp/install deleted file mode 100755 index 4169d9c..0000000 --- a/modules.d/95zfcp/install +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -inst_hook cmdline 30 "$moddir/parse-zfcp.sh" -dracut_install tr - -inst /sbin/zfcpconf.sh -inst_rules 56-zfcp.rules - -if [[ $hostonly ]]; then - inst /etc/zfcp.conf -fi -dracut_install zfcp_cio_free grep sed seq - diff --git a/modules.d/95zfcp/installkernel b/modules.d/95zfcp/installkernel deleted file mode 100755 index 85694ce..0000000 --- a/modules.d/95zfcp/installkernel +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -instmods zfcp - - diff --git a/modules.d/95zfcp/module-info.sh b/modules.d/95zfcp/module-info.sh new file mode 100755 index 0000000..06c8d8f --- /dev/null +++ b/modules.d/95zfcp/module-info.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + arch=$(uname -m) + [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 + + return 0 +} + +depends() { + arch=$(uname -m) + [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 + + return 0 +} + +installkernel() { + instmods zfcp +} + +install() { + inst_hook cmdline 30 "$moddir/parse-zfcp.sh" + dracut_install tr + + inst /sbin/zfcpconf.sh + inst_rules 56-zfcp.rules + + if [[ $hostonly ]]; then + inst /etc/zfcp.conf + fi + dracut_install zfcp_cio_free grep sed seq +} \ No newline at end of file diff --git a/modules.d/95znet/check b/modules.d/95znet/check deleted file mode 100755 index 3090f6d..0000000 --- a/modules.d/95znet/check +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -arch=$(uname -m) -[ "$arch" = "s390" -o "$arch" = "s390x" ] || exit 1 - -exit 0 diff --git a/modules.d/95znet/install b/modules.d/95znet/install deleted file mode 100755 index ecf09c5..0000000 --- a/modules.d/95znet/install +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -inst_hook cmdline 30 "$moddir/parse-ccw.sh" -inst /lib/udev/ccw_init -inst_rules 81-ccw.rules -dracut_install znet_cio_free grep sed seq readlink diff --git a/modules.d/95znet/module-info.sh b/modules.d/95znet/module-info.sh new file mode 100755 index 0000000..0964761 --- /dev/null +++ b/modules.d/95znet/module-info.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + arch=$(uname -m) + [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 + + return 0 +} + +depends() { + return 0 +} + +install() { + inst_hook cmdline 30 "$moddir/parse-ccw.sh" + inst /lib/udev/ccw_init + inst_rules 81-ccw.rules + dracut_install znet_cio_free grep sed seq readlink +} + diff --git a/modules.d/96insmodpost/check b/modules.d/96insmodpost/check deleted file mode 100755 index e0292c8..0000000 --- a/modules.d/96insmodpost/check +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -exit 0 diff --git a/modules.d/96insmodpost/install b/modules.d/96insmodpost/install deleted file mode 100755 index 4509d1b..0000000 --- a/modules.d/96insmodpost/install +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -inst_hook cmdline 20 "$moddir/parse-insmodpost.sh" -inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh diff --git a/modules.d/96insmodpost/module-info.sh b/modules.d/96insmodpost/module-info.sh new file mode 100755 index 0000000..586765d --- /dev/null +++ b/modules.d/96insmodpost/module-info.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + return 0 +} + +depends() { + return 0 +} + +install() { + inst_hook cmdline 20 "$moddir/parse-insmodpost.sh" + inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh +} + diff --git a/modules.d/97biosdevname/check b/modules.d/97biosdevname/check deleted file mode 100755 index f269c69..0000000 --- a/modules.d/97biosdevname/check +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -type -P biosdevname >/dev/null || exit 1 - -# do not enable bootchartd by default -exit 0 diff --git a/modules.d/97biosdevname/install b/modules.d/97biosdevname/install deleted file mode 100755 index a108d46..0000000 --- a/modules.d/97biosdevname/install +++ /dev/null @@ -1,14 +0,0 @@ -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -dracut_install biosdevname -inst_rules 71-biosdevname.rules -inst_hook pre-trigger 30 "$moddir/parse-biosdevname.sh" - -# set the default state according to the config -if [[ -e /etc/sysconfig/network ]]; then - . /etc/sysconfig/network -fi - -if [[ "$BIOSDEVNAME" = "no" ]]; then - echo "biosdevname=0" >> ${initdir}/etc/cmdline -fi diff --git a/modules.d/97biosdevname/module-info.sh b/modules.d/97biosdevname/module-info.sh new file mode 100755 index 0000000..834831f --- /dev/null +++ b/modules.d/97biosdevname/module-info.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + type -P biosdevname >/dev/null || return 1 + return 0 +} + +depends() { + return 0 +} + +install() { + dracut_install biosdevname + inst_rules 71-biosdevname.rules +} + diff --git a/modules.d/98selinux/install b/modules.d/98selinux/install deleted file mode 100755 index 6d64048..0000000 --- a/modules.d/98selinux/install +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -inst_hook pre-pivot 50 "$moddir/selinux-loadpolicy.sh" diff --git a/modules.d/98selinux/module-info.sh b/modules.d/98selinux/module-info.sh new file mode 100755 index 0000000..483e42f --- /dev/null +++ b/modules.d/98selinux/module-info.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + [[ $hostonly ]] && { + [ -x "/usr/sbin/load_policy" -o -x "/sbin/load_policy" ] || return 1 + return 0 + } + return 0 +} + +depends() { + return 0 +} + +install() { + inst_hook pre-pivot 50 "$moddir/selinux-loadpolicy.sh" +} + diff --git a/modules.d/98syslog/check b/modules.d/98syslog/check deleted file mode 100755 index 8ee8098..0000000 --- a/modules.d/98syslog/check +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# do not add this module by default -exit 255 diff --git a/modules.d/98syslog/install b/modules.d/98syslog/install deleted file mode 100755 index cca088d..0000000 --- a/modules.d/98syslog/install +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -if type -P rsyslogd >/dev/null; then - installs="rsyslogd" - for i in {"$libdir","$usrlibdir"}/rsyslog/lmnet.so \ - {"$libdir","$usrlibdir"}/rsyslog/imklog.so \ - {"$libdir","$usrlibdir"}/rsyslog/imuxsock.so ; do - [ -e "$i" ] && installs="$installs $i" - done -elif type -P syslogd >/dev/null; then - installs="syslogd" -elif type -P syslog-ng >/dev/null; then - installs="syslog-ng" -else - dwarn "Could not find any syslog binary although the syslogmodule is selected to be installed. Please check." -fi -if [ -n "$installs" ]; then - dracut_install cat - dracut_install $installs - inst_hook cmdline 90 "$moddir/parse-syslog-opts.sh" - inst_hook pre-udev 61 "$moddir/syslog-genrules.sh" - inst_hook pre-pivot 99 "$moddir/syslog-cleanup.sh" - inst_simple "$moddir/rsyslogd-start.sh" /sbin/rsyslogd-start - inst_simple "$moddir/rsyslogd-stop.sh" /sbin/rsyslogd-stop - mkdir -p ${initdir}/etc/templates - inst_simple "${moddir}/rsyslog.conf" /etc/templates -fi diff --git a/modules.d/98syslog/module-info.sh b/modules.d/98syslog/module-info.sh new file mode 100755 index 0000000..968fba0 --- /dev/null +++ b/modules.d/98syslog/module-info.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + # do not add this module by default + return 255 +} + +depends() { + return 0 +} + +install() { + if type -P rsyslogd >/dev/null; then + installs="rsyslogd" + for i in {"$libdir","$usrlibdir"}/rsyslog/lmnet.so \ + {"$libdir","$usrlibdir"}/rsyslog/imklog.so \ + {"$libdir","$usrlibdir"}/rsyslog/imuxsock.so ; do + [ -e "$i" ] && installs="$installs $i" + done + elif type -P syslogd >/dev/null; then + installs="syslogd" + elif type -P syslog-ng >/dev/null; then + installs="syslog-ng" + else + dwarn "Could not find any syslog binary although the syslogmodule is selected to be installed. Please check." + fi + if [ -n "$installs" ]; then + dracut_install cat + dracut_install $installs + inst_hook cmdline 90 "$moddir/parse-syslog-opts.sh" + inst_hook pre-udev 61 "$moddir/syslog-genrules.sh" + inst_hook pre-pivot 99 "$moddir/syslog-cleanup.sh" + inst_simple "$moddir/rsyslogd-start.sh" /sbin/rsyslogd-start + inst_simple "$moddir/rsyslogd-stop.sh" /sbin/rsyslogd-stop + mkdir -p ${initdir}/etc/templates + inst_simple "${moddir}/rsyslog.conf" /etc/templates + fi +} + diff --git a/modules.d/99base/check b/modules.d/99base/check deleted file mode 100755 index b7ba12c..0000000 --- a/modules.d/99base/check +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -[[ $1 = -d ]] && echo udev-rules -exit 0 diff --git a/modules.d/99base/install b/modules.d/99base/install deleted file mode 100755 index 95d60bb..0000000 --- a/modules.d/99base/install +++ /dev/null @@ -1,32 +0,0 @@ -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -dracut_install mount mknod mkdir modprobe pidof sleep chroot \ - sed ls flock cp mv dmesg rm ln rmmod mkfifo -dracut_install -o less -if [ ! -e "${initdir}/bin/sh" ]; then - dracut_install bash - (ln -s bash "${initdir}/bin/sh" || :) -fi -# install our scripts and hooks -inst "$moddir/init" "/init" -inst "$moddir/initqueue" "/sbin/initqueue" -inst "$moddir/loginit" "/sbin/loginit" -mkdir -p ${initdir}/initqueue -mkdir -p ${initdir}/emergency -mkdir -p ${initdir}/initqueue-finished -mkdir -p ${initdir}/initqueue-settled -mkdir -p ${initdir}/tmp -# Bail out if switch_root does not exist -if type -P switch_root >/dev/null; then - inst $(type -P switch_root) /sbin/switch_root \ - || derror "Failed to install switch_root" -else - inst "$moddir/switch_root" "/sbin/switch_root" \ - || derror "Failed to install switch_root" -fi -inst "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh" -inst_hook cmdline 10 "$moddir/parse-root-opts.sh" -inst_hook cmdline 20 "$moddir/parse-blacklist.sh" -mkdir -p "${initdir}/var/run" -[ -x /lib/systemd/systemd-timestamp ] && inst /lib/systemd/systemd-timestamp diff --git a/modules.d/99base/module-info.sh b/modules.d/99base/module-info.sh new file mode 100755 index 0000000..a55cdc4 --- /dev/null +++ b/modules.d/99base/module-info.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + return 0 +} + +depends() { + echo udev-rules + return 0 +} + +install() { + dracut_install mount mknod mkdir modprobe pidof sleep chroot \ + sed ls flock cp mv dmesg rm ln rmmod mkfifo + dracut_install -o less + if [ ! -e "${initdir}/bin/sh" ]; then + dracut_install bash + (ln -s bash "${initdir}/bin/sh" || :) + fi + # install our scripts and hooks + inst "$moddir/init" "/init" + inst "$moddir/initqueue" "/sbin/initqueue" + inst "$moddir/loginit" "/sbin/loginit" + mkdir -p ${initdir}/initqueue + mkdir -p ${initdir}/emergency + mkdir -p ${initdir}/initqueue-finished + mkdir -p ${initdir}/initqueue-settled + mkdir -p ${initdir}/tmp + # Bail out if switch_root does not exist + if type -P switch_root >/dev/null; then + inst $(type -P switch_root) /sbin/switch_root \ + || derror "Failed to install switch_root" + else + inst "$moddir/switch_root" "/sbin/switch_root" \ + || derror "Failed to install switch_root" + fi + inst "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh" + inst_hook cmdline 10 "$moddir/parse-root-opts.sh" + inst_hook cmdline 20 "$moddir/parse-blacklist.sh" + mkdir -p "${initdir}/var/run" + [ -x /lib/systemd/systemd-timestamp ] && inst /lib/systemd/systemd-timestamp +} + -- 2.7.4