replaced check,install,installkernel with module-info.sh

master
Harald Hoyer 2011-02-02 13:34:58 +01:00
parent 07caee2662
commit 95d2dabc25
130 changed files with 1797 additions and 1562 deletions

10
dracut
View File

@ -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 /}

View File

@ -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."
unset check depends install installkernel
return $ret
fi
}

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
}

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
# skip this module
return 1
done
fi
fi
mods_to_load+=" $1 "
}

should_source_module() {
local dep
local ret
if [[ $kernel_only = yes ]]; then
[[ -x $1/installkernel ]] && return 0
return 1
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
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

strstr " $mods_to_load " " $mod " || \
mods_to_load+=" $mod "

return 0
}

check_modules() {
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]}
# 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
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
fi

mods_to_load+=" $mod "
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."
check_module $mod 1
done
}


View File

@ -1,9 +1,18 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- This document was created with Syntext Serna Free. -->
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
<book>
<title>
<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</title>
<title><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</title>
<bookinfo>
<author>
<firstname>Harald</firstname>
@ -604,11 +613,12 @@ Common used functions are in <filename>dracut-lib.sh</filename>, which can be so
<section>
<title>Writing a Module</title>
<para>A simple example module is <filename>96insmodpost</filename>, which modprobes a kernel module after udev has settled and the basic device drivers have been loaded.</para>
<para>First we create a <filename>check</filename> script, which just exits with <errorcode>0</errorcode> indicating that this module should be included by default.</para>
<para><filename>check</filename>:</para>
<programlisting>exit 0</programlisting>
<para>The we create the install script, which installs a cmdline hook with priority number 20 called <filename>parse-insmodpost.sh</filename>. It also installs the <filename>insmodpost.sh</filename> script in <filename>/sbin</filename>.</para>
<para><filename>install</filename>:</para>
<para>All module installation information is in the file module-info.sh.</para>
<para>First we create a <function>check()</function> function, which just exits with <errorcode>0</errorcode> indicating that this module should be included by default.</para>
<para><function>check()</function>:</para>
<programlisting>return 0</programlisting>
<para>The we create the <function>install()</function> function, which installs a cmdline hook with priority number 20 called <filename>parse-insmodpost.sh</filename>. It also installs the <filename>insmodpost.sh</filename> script in <filename>/sbin</filename>.</para>
<para><function>install()</function>:</para>
<programlisting>inst_hook cmdline 20 &quot;$moddir/parse-insmodpost.sh&quot;
inst_simple &quot;$moddir/insmodpost.sh&quot; /sbin/insmodpost.sh</programlisting>
<para>The <filename>pase-instmodpost.sh</filename> parses the kernel command line for a argument <envar>rd.driver.post</envar>, blacklists the module from being autoloaded and installs the hook <filename>insmodpost.sh</filename> in the <filename>initqueue-settled</filename>.</para>
@ -630,39 +640,34 @@ for p in $(getargs rd.driver.post=); do
done
</programlisting>
<section>
<title>check</title>
<para><filename>check</filename> is called by dracut to evaluate the inclusion of a dracut module in the initramfs.</para>
<para><filename>check</filename> also can be called with arguments, which are described in the following list.</para>
<title>check()</title>
<para><filename>
<function>check()</function>
</filename> is called by dracut to evaluate the inclusion of a dracut module in the initramfs.</para>
<variablelist>
<varlistentry>
<term><filename>check</filename> -d</term>
<term> $hostonly</term>
<listitem>
<para>If <filename>check</filename> is called with parameter <parameter>-d</parameter>, then the stdout output is taken as the dracut module names of the dependencies this module needs.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>check</filename> -h</term>
<listitem>
<para>If check is called with parameter <parameter>-h</parameter>, then the module check should be in &quot;hostonly&quot; mode, which means, that the check should only return 0, if the module is really needed to boot this specific host.</para>
<para>If the $hostonly variable is set, then the module check() function should be in &quot;hostonly&quot; mode, which means, that the check() should only return 0, if the module is really needed to boot this specific host.</para>
</listitem>
</varlistentry>
</variablelist>
<para>If <filename>check</filename> is called without parameters, it should return the following exit codes.</para>
<para><function>check()</function> should return with:</para>
<variablelist>
<varlistentry>
<term>exit 0</term>
<term>0</term>
<listitem>
<para>Include the dracut module in the initramfs.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>exit 1</term>
<term>1</term>
<listitem>
<para>Do not include the dracut module. The requirements are not fullfilled (missing tools, etc.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>exit 255</term>
<term>255</term>
<listitem>
<para>Only include the dracut module, if another module requires it or if explicitly specified in the config file or on the argument list.</para>
</listitem>
@ -670,7 +675,11 @@ done
</variablelist>
</section>
<section>
<title>Install</title>
<title>depends()</title>
<para>The function <function>depends()</function> should <function>echo</function> all other dracut module names the module depends on.</para>
</section>
<section>
<title>install()</title>
<para>dracut_install</para>
<para>inst</para>
<para>inst_hook</para>
@ -678,7 +687,7 @@ done
<para/>
</section>
<section>
<title>Installkernel</title>
<title>installkernel()</title>
<para>instmods</para>
</section>
<section>

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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 ]

View File

@ -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"

20
modules.d/00dash/module-info.sh Executable file
View File

@ -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"
}

View File

@ -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

View File

@ -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

View File

@ -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

41
modules.d/01fips/module-info.sh Executable file
View File

@ -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
}

View File

@ -1,7 +0,0 @@
#!/bin/bash

[[ $1 = -d ]] && exit 0

type -P busybox >/dev/null || exit 1

exit 255

View File

@ -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

View File

@ -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

}

View File

@ -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

View File

@ -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)
#
# <list> ::= <element> | <element> " " <list>
# <element> ::= <conf-file-name> ":" <map-list>
# <map-list> ::= <mapping> | <mapping> "," <map-list>
# <mapping> ::= <src-var> "-" <dst-var> | <src-var>
#
# We assume no whitespace are allowed between symbols.
# <conf-file-name> is a file holding <src-var> in your system.
# <src-var> is a variable holding value of meaning the same as <dst-var>.
# <dst-var> is a variable which will be set up inside initramfs.
# If <dst-var> has the same name as <src-var> we can omit <dst-var>.
#
# Example:
# /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
# <list> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
# <element> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
# <conf-file-name> = /etc/conf.d/keymaps
# <map-list> = KEYMAP,extended_keymaps-EXT_KEYMAPS
# <mapping> = KEYMAP
# <src-var> = KEYMAP
# <mapping> = extended_keymaps-EXT_KEYMAPS
# <src-var> = extended_keymaps
# <dst-var> = 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

209
modules.d/10i18n/module-info.sh Executable file
View File

@ -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)
#
# <list> ::= <element> | <element> " " <list>
# <element> ::= <conf-file-name> ":" <map-list>
# <map-list> ::= <mapping> | <mapping> "," <map-list>
# <mapping> ::= <src-var> "-" <dst-var> | <src-var>
#
# We assume no whitespace are allowed between symbols.
# <conf-file-name> is a file holding <src-var> in your system.
# <src-var> is a variable holding value of meaning the same as <dst-var>.
# <dst-var> is a variable which will be set up inside initramfs.
# If <dst-var> has the same name as <src-var> we can omit <dst-var>.
#
# Example:
# /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
# <list> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
# <element> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
# <conf-file-name> = /etc/conf.d/keymaps
# <map-list> = KEYMAP,extended_keymaps-EXT_KEYMAPS
# <mapping> = KEYMAP
# <src-var> = KEYMAP
# <mapping> = extended_keymaps-EXT_KEYMAPS
# <src-var> = extended_keymaps
# <dst-var> = 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
}

View File

@ -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 ]

View File

@ -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"

View File

@ -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"

}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

}

View File

@ -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

View File

@ -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"

View File

@ -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"
}

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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 ]]

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -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"

View File

@ -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

41
modules.d/60xen/module-info.sh Executable file
View File

@ -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"
}

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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"
}

View File

@ -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

View File

@ -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

View File

@ -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


26
modules.d/90dm/module-info.sh Executable file
View File

@ -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
}

View File

@ -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

View File

@ -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"

View File

@ -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"

}

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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"

View File

@ -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

View File

@ -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"
}

View File

@ -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

View File

@ -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

58
modules.d/90lvm/module-info.sh Executable file
View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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

28
modules.d/95dasd/module-info.sh Executable file
View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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


View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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

}

View File

@ -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

View File

@ -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"

View File

@ -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

35
modules.d/95fcoe/module-info.sh Executable file
View File

@ -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"
}

View File

@ -1,2 +0,0 @@
#!/bin/sh
test -f /etc/fstab.sys

View File

@ -1,3 +0,0 @@
#!/bin/sh
dracut_install /etc/fstab.sys
inst_hook pre-pivot 00 "$moddir/mount-sys.sh"

View File

@ -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"
}

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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"
}

View File

@ -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

View File

@ -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"

View File

@ -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

38
modules.d/95nbd/module-info.sh Executable file
View File

@ -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"
}

View File

@ -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

View File

@ -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"

View File

@ -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

Some files were not shown because too many files have changed in this diff Show More