Right now, most of the testing is done using a qemu/kvm guest and
generating the initramfs on another box but the support is all present
to build for the "running" machine. For the former, you can boot the guest
-using qemu's -kernel and -initrd options.
+using qemu's -kernel and -initrd options.
dracut exists and will build an image. It is command-line equivalent
to most mkinitrd implementations and should be pretty straight-forward
-to use.
+to use.
To use, just run dracut with an output file name and, optionally, a
kernel version (it defaults to using the current). The appropriate
and set
dracutmodules="foo bar baz"
-Note that dracut calls functional components in modules.d "modules"
+Note that dracut calls functional components in modules.d "modules"
while kernel modules are called "drivers".
Requirements:
- add btrfsctl scan for btrfs multi-devices (raid)
- teach dmsquash live-root to use rootflags
- trigger udev with action=add
-- fixed add_drivers handling
+- fixed add_drivers handling
- add sr_mod
- use pigz instead of gzip, if available
- boot from LVM mirrors and snapshots
dracut-005
==========
-- dcb support to dracut's FCoE support
+- dcb support to dracut's FCoE support
- add readonly overlay support for dmsquash
- add keyboard kernel modules
- dracut.conf: added add_dracutmodules
- add s390 network support
- fixed dracut-gencmdline for root=UUID or LABEL
- do not destroy assembled raid arrays if mdadm.conf present
-- mount /dev/shm
+- mount /dev/shm
- let udevd not resolve group and user names
- moved network from udev to initqueue
- improved debug output: specifying "rdinitdebug" now logs
- strip kernel modules which have no x bit set
- redirect stdin, stdout, stderr all RW to /dev/console
so the user can use "less" to view /init.log and dmesg
-- add new device mapper udev rules and dmeventd
+- add new device mapper udev rules and dmeventd
- fixed dracut-gencmdline for root=UUID or LABEL
- do not destroy assembled raid arrays if mdadm.conf present
- mount /dev/shm
Supported cmdline formats:
fcoe=<networkdevice>:<dcb|nodcb>
fcoe=<macaddress>:<dcb|nodcb>
-
+
Note currently only nodcb is supported, the dcb option is reserved for
future use.
-
+
Note letters in the macaddress must be lowercase!
-
+
Examples:
fcoe=eth0:nodcb
fcoe=4A:3F:4C:04:F8:D7:nodcb
-- Syslog support for dracut
+- Syslog support for dracut
This module provides syslog functionality in the initrd.
This is especially interesting when complex configuration being
used to provide access to the device the rootfs resides on.
dracut-0.7
==========
- dracut: strip binaries in initramfs
-
+
--strip
strip binaries in the initramfs (default)
-
+
--nostrip
do not strip binaries in the initramfs
- dracut-catimages
-
+
Usage: ./dracut-catimages [OPTION]... <initramfs> <base image>
[<image>...]
Creates initial ramdisk image by concatenating several images from the
command
line and /boot/dracut/
-
+
-f, --force Overwrite existing initramfs file.
-i, --imagedir Directory with additional images to add
(default: /boot/dracut/)
dracut-0.6
==========
- dracut: add --kernel-only and --no-kernel arguments
-
+
--kernel-only
only install kernel drivers and firmware files
-
+
--no-kernel
do not install kernel drivers and firmware files
-
+
All kernel module related install commands moved from "install"
to "installkernel".
-
+
For "--kernel-only" all installkernel scripts of the specified
modules are used, regardless of any checks, so that all modules
which might be needed by any dracut generic image are in.
-
+
The basic idea is to create two images. One image with the kernel
modules and one without. So if the kernel changes, you only have
to replace one image.
-
+
Grub and the kernel can handle multiple images, so grub entry can
look like this:
-
+
title Fedora (2.6.29.5-191.fc11.i586)
root (hd0,0)
kernel /vmlinuz-2.6.29.5-191.fc11.i586 ro rhgb quiet
initrd /initrd-20090722.img /initrd-kernel-2.6.29.5-191.fc11.i586.img /initrd-config.img
-
+
initrd-20090722.img
the image provided by the initrd rpm
one old backup version is kept like with the kernel
-
+
initrd-kernel-2.6.29.5-191.fc11.i586.img
the image provided by the kernel rpm
-
+
initrd-config.img
optional image with local configuration files
- dracut: add --kmoddir directory, where to look for kernel modules
-
+
-k, --kmoddir [DIR]
specify the directory, where to look for kernel modules
- firmware loading support
- new internal queue (initqueue)
initqueue now loops until /dev/root exists or root is mounted
-
+
init now has the following points to inject scripts:
-
+
/cmdline/*.sh
scripts for command line parsing
-
+
/pre-udev/*.sh
scripts to run before udev is started
-
+
/pre-trigger/*.sh
scripts to run before the main udev trigger is pulled
-
+
/initqueue/*.sh
runs in parallel to the udev trigger
Udev events can add scripts here with /sbin/initqueue.
filesystem was mounted, the user will be dropped to a shell after
a timeout.
Scripts can remove themselves from the initqueue by "rm $job".
-
+
/pre-mount/*.sh
scripts to run before the root filesystem is mounted
NFS is an exception, because it has no device node to be created
and mounts in the udev events
-
+
/mount/*.sh
scripts to mount the root filesystem
NFS is an exception, because it has no device node to be created
If the udev queue is empty and no root device is found or no root
filesystem was mounted, the user will be dropped to a shell after
a timeout.
-
+
/pre-pivot/*.sh
scripts to run before the real init is executed and the initramfs
disappears
All processes started before should be killed here.
-
+
The behaviour of the dmraid module demonstrates how to use the new
mechanism. If it detects a device which is part of a raidmember from a
udev rule, it installs a job to scan for dmraid devices, if the udev
------
Dracut is a new initramfs infrastructure.
-Information about the initial goals and aims can be found at
-https://fedoraproject.org/wiki/Initrdrewrite
+Information about the initial goals and aims can be found at
+https://fedoraproject.org/wiki/Initrdrewrite
Unlike existing initramfs's, this is an attempt at having as little as
possible hard-coded into the initramfs as possible. The initramfs has
Most of the initrd generation functionality in dracut is provided by a bunch
of generator modules that are sourced by the main dracut script to install
-specific functionality into the initrd. They live in the modules.d
-subdirectory, and use functionality provided by dracut-functions to do their
+specific functionality into the initrd. They live in the modules.d
+subdirectory, and use functionality provided by dracut-functions to do their
work.
Some general rules for writing modules:
* We have some breakpoints for debugging your hooks. If you pass 'rdbreak'
as a kernel parameter, the initramfs will drop to a shell just before
switching to a new root. You can pass 'rdbreak=hookpoint', and the initramfs
- will break just before hooks in that hookpoint run.
+ will break just before hooks in that hookpoint run.
Also, there is an attempt to keep things as distribution-agnostic as
possible. Every distribution has their own tool here and it's not
Project Page:
https://sourceforge.net/projects/dracut/
-Drop Harald Hoyer <harald@redhat.com> a mail, if you want to help with
+Drop Harald Hoyer <harald@redhat.com> a mail, if you want to help with
the documentation, git access, etc.
Git Repository:
git://dracut.git.sourceforge.net/gitroot/dracut/dracut
Trac Instance:
-http://apps.sourceforge.net/trac/dracut/
+http://apps.sourceforge.net/trac/dracut/
The git tree can be found at
git://dracut.git.sourceforge.net/gitroot/dracut/dracut for now. See the TODO
instructions on how to get started. There is also a mailing list that
is being used for the discussion -- initramfs@vger.kernel.org. It is
a typical vger list, send mail to majordomo@vger.kernel.org with body
-of 'subscribe initramfs email@host.com'
+of 'subscribe initramfs email@host.com'
Licensed under the GPLv2
To build a generic initramfs, you have to install the following software packages:
* device-mapper
* cryptsetup-luks
- * rpcbind nfs-utils
+ * rpcbind nfs-utils
* lvm2
* iscsi-initiator-utils
* nbd
The numeric code must be present and in the range of 00 - 99.
Modules with lower numbers are installed first. This is important
because the dracut install functions (which install files onto
- the initrd) refuse to overwrite already installed files. This makes
- it easy for an earlier module to override the functionality of a
+ the initrd) refuse to overwrite already installed files. This makes
+ it easy for an earlier module to override the functionality of a
later module, so that you can have a distro or system specific
module override or modify the functionality of a generic module
without having to patch the more generic module.
module-setup.sh:
- dracut sources this script to install the functionality that a
+ dracut sources this script to install the functionality that a
module implements onto the initrd. For the most part, this amounts
to copying files from the host system onto the initrd in a controlled
- manner.
+ manner.
install():
- This function of module-setup.sh is called to install all
+ This function of module-setup.sh is called to install all
non-kernel files. dracut supplies several install functions that are
specialized for different file types. Browse through dracut-functions
fore more details. dracut also provides a $moddir variable if you
hook, a udev rule, or a specialized executable.
installkernel():
- This function of module-setup.sh is called to install all
+ This function of module-setup.sh is called to install all
kernel related files.
-check():
+check():
Dracut calls this function to check and see if a module can be installed
on the initrd.
-
+
When called without options, check should check to make sure that
any files it needs to install into the initrd from the host system
are present. It should exit with a 0 if they are, and a 1 if they are
not.
- When called with $hostonly set, it should perform the same check
- that it would without it set, and it should also check to see if the
+ When called with $hostonly set, it should perform the same check
+ that it would without it set, and it should also check to see if the
functionality the module implements is being used on the host system.
For example, if this module handles installing support for LUKS
encrypted volumes, it should return 0 if all the tools to handle
which rely on the network module to detect and configure network
interfaces.
-Any other files in the module will not be touched by dracut directly.
+Any other files in the module will not be touched by dracut directly.
You are encouraged to provide a README that describes what the module is for.
Udev events can add scripts here with /sbin/initqueue.
If /sbin/initqueue is called with the "--onetime" option, the script
will be removed after it was run.
- If /lib/dracut/hooks/initqueue/work is created and udev >= 143 then
+ If /lib/dracut/hooks/initqueue/work is created and udev >= 143 then
this loop can process the jobs in parallel to the udevtrigger.
If the udev queue is empty and no root device is found or no root
filesystem was mounted, the user will be dropped to a shell after
/lib/dracut/hooks/pre-mount/*.sh
scripts to run before the root filesystem is mounted
- Network filesystems like NFS that do not use device files are an
+ Network filesystems like NFS that do not use device files are an
exception. Root can be mounted already at this point.
/lib/dracut/hooks/mount/*.sh
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
-#
+#
# Generator script for a dracut initramfs
# Tries to retain some degree of compatibility with the command line
# of the various mkinitrd implementations out there
-a, --add [LIST] Add a space-separated list of dracut modules.
-d, --drivers [LIST] Specify a space-separated list of kernel modules to
exclusively include in the initramfs.
- --add-drivers [LIST] Specify a space-separated list of kernel
+ --add-drivers [LIST] Specify a space-separated list of kernel
modules to add to the initramfs.
--filesystems [LIST] Specify a space-separated list of kernel filesystem
modules to exclusively include in the generic
initramfs.
- -k, --kmoddir [DIR] Specify the directory, where to look for kernel
+ -k, --kmoddir [DIR] Specify the directory, where to look for kernel
modules
- --fwdir [DIR] Specify additional directories, where to look for
+ --fwdir [DIR] Specify additional directories, where to look for
firmwares, separated by :
--kernel-only Only install kernel drivers and firmware files
--no-kernel Do not install kernel drivers and firmware files
-q, --quiet Decrease verbosity level (default is info(4))
-c, --conf [FILE] Specify configuration file to use.
Default: /etc/dracut.conf
- --confdir [DIR] Specify configuration directory to use *.conf files
+ --confdir [DIR] Specify configuration directory to use *.conf files
from. Default: /etc/dracut.conf.d
-l, --local Local mode. Use modules from the current working
directory instead of the system-wide installed in
-i, --include [SOURCE] [TARGET]
Include the files in the SOURCE directory into the
Target directory in the final initramfs.
- If SOURCE is a file, it will be installed to TARGET
+ If SOURCE is a file, it will be installed to TARGET
in the final initramfs.
-I, --install [LIST] Install the space separated list of files into the
initramfs.
Make sure your kernel has bzip2 decompression support
compiled in, otherwise you will not be able to boot.
--lzma Compress the generated initramfs using lzma.
- Make sure your kernel has lzma support compiled in,
+ Make sure your kernel has lzma support compiled in,
otherwise you will not be able to boot.
--xz Compress the generated initramfs using xz.
Make sure that your kernel has xz support compiled
in, otherwise you will not be able to boot.
--compress [COMPRESSION] Compress the generated initramfs with the
passed compression program. Make sure your kernel
- knows how to decompress the generated initramfs,
+ knows how to decompress the generated initramfs,
otherwise you will not be able to boot.
--no-compress Do not compress the generated initramfs. This will
override any other compression options.
# val=$(pop stack)
pop() {
local __stack=$1; shift
- local __resultvar=$1
+ local __resultvar=$1
local myresult;
# check for empty stack
eval '[[ ${#'${__stack}'[@]} -eq 0 ]] && return 1'
show_modules_l="yes"
;;
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
- *)
+ *)
if ! [[ ${outfile+x} ]]; then
outfile=$1
elif ! [[ ${kernel+x} ]]; then
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
-[[ $debug ]] && {
+[[ $debug ]] && {
export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
set -x
}
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
[[ $allowlocal && -f "$(readlink -f ${0%/*})/dracut-functions" ]] && \
- dracutbasedir="$(readlink -f ${0%/*})"
+ dracutbasedir="$(readlink -f ${0%/*})"
# if we were not passed a config file, try the default one
if [[ ! -f $conffile ]]; then
# source our config dir
if [[ $confdir && -d $confdir ]]; then
- for f in "$confdir"/*.conf; do
+ for f in "$confdir"/*.conf; do
[[ -e $f ]] && . "$f"
done
fi
readonly initdir=$(mktemp --tmpdir=/var/tmp/ -d -t initramfs.XXXXXX)
# clean up after ourselves no matter how we die.
-trap 'ret=$?;rm -rf "$initdir";exit $ret;' EXIT
+trap 'ret=$?;rm -rf "$initdir";exit $ret;' EXIT
# clean up after ourselves no matter how we die.
-trap 'exit 1;' SIGINT
+trap 'exit 1;' SIGINT
# Need to be able to have non-root users read stuff (rpcbind etc)
chmod 755 "$initdir"
[[ $prefix ]] && ln -sfn "${prefix#/}/lib" "$initdir/lib"
if [[ $kernel_only != yes ]]; then
- for d in bin etc lib "$libdir" sbin tmp usr var; do
+ for d in bin etc lib "$libdir" sbin tmp usr var; do
[[ -e "${initdir}${prefix}/$d" ]] && continue
mkdir -m 0755 -p "${initdir}${prefix}/$d"
[[ $prefix ]] && ln -sfn "${prefix#/}/${d#/}" "$initdir/$d"
- done
+ done
- for d in proc sys sysroot root run run/lock run/initramfs; do
- mkdir -m 0755 -p "$initdir/$d";
+ for d in proc sys sysroot root run run/lock run/initramfs; do
+ mkdir -m 0755 -p "$initdir/$d";
done
ln -sfn /run "$initdir/var/run"
if [[ -f $src ]]; then
inst $src $tgt
else
- ddebug "Including directory: $src"
+ ddebug "Including directory: $src"
mkdir -p "${initdir}/${tgt}"
# check for preexisting symlinks, so we can cope with the
# symlinks to $prefix
cp -a -t "$s" "$i"/*
else
cp -a -t "$s" "$i"
- fi
+ fi
done
fi
fi
du -c "$initdir" | sort -n | ddebug
fi
-# strip binaries
+# strip binaries
if [[ $do_strip = yes ]] ; then
- for p in strip grep find; do
+ for p in strip grep find; do
if ! type -P $p >/dev/null; then
derror "Could not find '$p'. You should run $0 with '--nostrip'."
do_strip=no
fi
if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet | \
- $compress > "$outfile"; ); then
+ $compress > "$outfile"; ); then
dfatal "dracut: creation of $outfile failed"
exit 1
-fi
+fi
dinfo "Wrote $outfile:"
dinfo "$(ls -l "$outfile")"
line and /boot/dracut/
-f, --force Overwrite existing initramfs file.
- -i, --imagedir Directory with additional images to add
+ -i, --imagedir Directory with additional images to add
(default: /boot/dracut/)
-o, --overlaydir Overlay directory, which contains files that
will be used to create an additional image
dinfo "Using base image $baseimage"
cat "$baseimage" > "$outfile"
-for i in "${images[@]}"; do
+for i in "${images[@]}"; do
dinfo "Appending $i"
cat "$i" >> "$outfile"
done
<varlistentry>
<term><option>-h</option>, <option>--help</option></term>
<listitem>
-<para>display help text and exit.</para>
+<para>display help text and exit.</para>
</listitem>
</varlistentry>
<varlistentry>
if [[ -e "${src%/*}/.${src##*/}.hmac" ]]; then
inst "${src%/*}/.${src##*/}.hmac" "${target%/*}/.${target##*/}.hmac"
fi
- ddebug "Installing $src"
+ ddebug "Installing $src"
cp -pfL "$src" "${initdir}$target"
}
inst_dir "/lib/udev/rules.d"
inst_dir "$target"
- for rule in "$@"; do
+ for rule in "$@"; do
for r in /lib/udev/rules.d /etc/udev/rules.d; do
if [[ -f $r/$rule ]]; then
found="$r/$rule"
inst_simple "$found"
fi
- done
+ done
for r in '' ./ $dracutbasedir/rules.d/; do
if [[ -f ${r}$rule ]]; then
found="${r}$rule"
- inst_simple "$found" "$target/${found##*/}"
+ inst_simple "$found" "$target/${found##*/}"
fi
done
[[ $found ]] || dinfo "Skipping udev rule: $rule"
dfatal "Aborting initrd creation."
exit 1
elif ! strstr "$hookdirs" "$1"; then
- dfatal "No such hook type $1. Aborting initrd creation."
+ dfatal "No such hook type $1. Aborting initrd creation."
exit 1
fi
inst_simple "$3" "/lib/dracut/hooks/${1}/${2}${3##*/}"
real=$(freadlink /dev/disk/by-label/${1##LABEL=})
[ -b $real ] && { echo $real; return; }
fi
- echo "$1"
+ echo "$1"
}
finddevnoinsys() {
chap=${result}
if [ -n "${chap}" -a "${chap}" != "<empty>" ]; then
chap="-u ${chap}"
- iscsi_get_rec_val $tmpfile "node.session.auth.password"
+ iscsi_get_rec_val $tmpfile "node.session.auth.password"
chap_pw="-w ${result}"
else
chap=""
chap_in=${result}
if [ -n "${chap_in}" -a "${chap_in}" != "<empty>" ]; then
chap_in="-U ${chap_in}"
- iscsi_get_rec_val $tmpfile "node.session.auth.password_in"
+ iscsi_get_rec_val $tmpfile "node.session.auth.password_in"
chap_in_pw="-W ${result}"
else
chap_in=""
path=$1
if echo $path | grep -q "/platform/host[0-9]*/session[0-9]*/target[0-9]*:[0-9]*:[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*"; then
return 0
- else
+ else
return 1
fi
}
EOF
local name=$(dmsetup info --noheadings -c -j $major -m $minor -o name)
local vg=$(lvshow "/dev/mapper/$name")
- local raids=$(/sbin/dmraid -s -craidname 2>/dev/null | grep -vi "no raid disks")
+ local raids=$(/sbin/dmraid -s -craidname 2>/dev/null | grep -vi "no raid disks")
if [ -n "$vg" ]; then
vg=`echo $vg` # strip whitespace
case " $vg_list " in
cemit()
{
- cat
+ cat
}
emit()
NONL="-n"
shift
fi
- echo $NONL "$@"
+ echo $NONL "$@"
}
emitdmraids()
echo -n "rd_NO_MD "
fi
-if [ -z "$nolvm" -a -n "$vg_list" ]; then
- for vg in $vg_list; do
+if [ -z "$nolvm" -a -n "$vg_list" ]; then
+ for vg in $vg_list; do
echo -n "rd_LVM_VG=$vg "
done
else
<!-- body begins here -->
<refsynopsisdiv id='synopsis'>
<cmdsynopsis>
- <command>dracut-gencmdline</command>
+ <command>dracut-gencmdline</command>
<sbr/>
</cmdsynopsis>
</refsynopsisdiv>
<option>--modules <replaceable><list of dracut modules></replaceable></option>
</term>
<listitem>
- <para>specify a space-separated list of dracut modules to call
-when building the initramfs.
-Modules are located in
+ <para>specify a space-separated list of dracut modules to call
+when building the initramfs.
+Modules are located in
<filename>/usr/share/dracut/modules.d</filename>. This parameter can be specified multiple times.</para>
</listitem>
</varlistentry>
<option>--filesystems <replaceable><list of filesystems></replaceable></option>
</term>
<listitem>
- <para>specify a space-separated list of kernel filesystem modules to exclusively
+ <para>specify a space-separated list of kernel filesystem modules to exclusively
include in the generic initramfs. This parameter can be specified multiple times.</para>
</listitem>
</varlistentry>
</term>
<listitem>
<para>specify configuration file to use.
-Default:
+Default:
<filename>/etc/dracut.conf</filename></para>
</listitem>
</varlistentry>
</term>
<listitem>
<para>specify configuration directory to use.
-Default:
+Default:
<filename>/etc/dracut.conf.d</filename></para>
</listitem>
</varlistentry>
<option>--hostonly</option>
</term>
<listitem>
- <para>Host-Only mode: Install only what is needed for booting
-the local host instead of a generic host.
+ <para>Host-Only mode: Install only what is needed for booting
+the local host instead of a generic host.
<warning>
<para>If chrooted to another root other than the real root device, use "--fstab" and provide a valid <filename>/etc/fstab</filename>.</para>
</warning></para>
</term>
<listitem>
<para>Any files found in <filename>/etc/conf.d/</filename> will be sourced in the initramfs to
-set initial values. Command line options will override these values
+set initial values. Command line options will override these values
set in the configuration files.</para>
</listitem>
</varlistentry>
<envar>add_drivers+=" <replaceable><kernel modules></replaceable> "</envar>
</term>
<listitem>
- <para>Specify a space-separated list of kernel
+ <para>Specify a space-separated list of kernel
modules to add to the initramfs.
The kernel modules have to be specified without the ".ko" suffix.</para>
</listitem>
<envar>hostonly="<replaceable>{yes|no}</replaceable>"</envar>
</term>
<listitem>
- <para>Host-Only mode: Install only what is needed for booting
+ <para>Host-Only mode: Install only what is needed for booting
the local host instead of a generic host.
<warning><para>If chrooted to another root other than the real root device, use <option>--fstab</option> and provide a valid <filename>/etc/fstab</filename>.</para>
</warning>
<refsect1>
<title>Description</title>
<para>The root filesystem used by the kernel is specified in the boot configuration
-file, as always. The traditional <emphasis remap="B">root=/dev/hda1</emphasis> style device
+file, as always. The traditional <emphasis remap="B">root=/dev/hda1</emphasis> style device
specification is allowed. If a label is used, as in <emphasis remap="B">root=LABEL=rootPart</emphasis>
the initramfs will search all available devices for an ext2 or ext3 filesystem
with the appropriate label, and mount that device as the root filesystem.
-<emphasis remap="B">root=UUID=uuidnumber</emphasis> will mount the partition with that UUID as the
+<emphasis remap="B">root=UUID=uuidnumber</emphasis> will mount the partition with that UUID as the
root filesystem.</para>
<refsect2>
<title>Standard</title>
<envar>root=<replaceable><path to blockdevice></replaceable></envar>
</term>
<listitem>
- <para>specify blockdevice to use as root filesystem.
+ <para>specify blockdevice to use as root filesystem.
e.g.: <programlisting>root=/dev/sda1
root=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1 </programlisting></para>
</listitem>
</term>
<listitem>
<para>specify additional mount options for the root filesystem. If not set, <filename>/etc/fstab</filename>
-of the real root will be parsed for special mount options and mounted
+of the real root will be parsed for special mount options and mounted
accordingly.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>rd.fstab</envar>=0</term>
<listitem>
- <para>do not honor special mount options for the root filesystem found in
+ <para>do not honor special mount options for the root filesystem found in
<filename>/etc/fstab</filename> of the real root.</para>
</listitem>
</varlistentry>
<listitem>
<para>only activate the LUKS partitions with the given UUID
Any "luks-" of the LUKS UUID is removed before comparing to <replaceable><luks uuid></replaceable>.
-The comparisons also matches, if <replaceable><luks uuid></replaceable> is only the beginning of the
+The comparisons also matches, if <replaceable><luks uuid></replaceable> is only the beginning of the
LUKS UUID, so you don't have to specify the full UUID.
This parameter can be specified multiple times.</para>
</listitem>
<envar>ip=</envar><replaceable>{dhcp|on|any|dhcp6|auto6|ibft}</replaceable>
</term>
<listitem>
- <para>dhcp|on|any: get ip from dhcp server from all interfaces. If root=dhcp,
-loop sequentially through all interfaces (eth0, eth1, ...) and use the first
+ <para>dhcp|on|any: get ip from dhcp server from all interfaces. If root=dhcp,
+loop sequentially through all interfaces (eth0, eth1, ...) and use the first
with a valid DHCP root-path.</para>
<para><constant>auto6</constant>: IPv6 autoconfiguration</para>
<para><constant>dhcp6</constant>: IPv6 DHCP</para>
<envar>bootdev=</envar><replaceable><interface></replaceable>
</term>
<listitem>
- <para>specify network interface to use routing and netroot information from.
+ <para>specify network interface to use routing and netroot information from.
Required if multiple ip= lines are used.</para>
</listitem>
</varlistentry>
<envar>root=</envar><replaceable>{dhcp|dhcp6}</replaceable>
</term>
<listitem>
- <para>root=dhcp alone directs initrd to look at the DHCP root-path where NFS
+ <para>root=dhcp alone directs initrd to look at the DHCP root-path where NFS
options can be specified.
root-path=<server-ip>:<root-dir>[,<nfs-options>]
root-path=nfs:<server-ip>:<root-dir>[,<nfs-options>]
<envar> nfsroot=</envar><optional><replaceable><server-ip></replaceable>:</optional><replaceable><root-dir></replaceable><optional>:<replaceable><nfs-options></replaceable></optional>
</term>
<listitem>
- <para><emphasis remap="B">Deprecated!</emphasis> kernel Documentation<filename>/filesystems/nfsroot.txt</filename> defines
-this method.
+ <para><emphasis remap="B">Deprecated!</emphasis> kernel Documentation<filename>/filesystems/nfsroot.txt</filename> defines
+this method.
This is supported by dracut, but not recommended.</para>
</listitem>
</varlistentry>
associated fields.</para>
<para>See <ulink url="http://tools.ietf.org/html/rfc4173#section-5">http://tools.ietf.org/html/rfc4173</ulink>.</para>
<para>e.g.:<programlisting>root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0 </programlisting></para>
- <para>If servername is an IPv6 address, it has to be put in brackets. e.g.:
+ <para>If servername is an IPv6 address, it has to be put in brackets. e.g.:
<programlisting>root=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0 </programlisting></para>
</listitem>
</varlistentry>
<replaceable><LUN></replaceable>
</optional>:<replaceable><targetname></replaceable> ...</term>
<listitem>
- <para>multiple netroot options allow setting up multiple iscsi disks. e.g.:
+ <para>multiple netroot options allow setting up multiple iscsi disks. e.g.:
<programlisting>root=UUID=12424547
netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1 </programlisting></para>
</term>
<listitem>
<para>with dhcp root-path=nbd:<server>:<port>[:<fstype>][:<mountopts>]
-root=dhcp alone directs initrd to look at the DHCP root-path where NBD
+root=dhcp alone directs initrd to look at the DHCP root-path where NBD
options can be specified.
-This syntax is only usable in cases where you are directly mounting the volume
+This syntax is only usable in cases where you are directly mounting the volume
as the rootfs.</para>
</listitem>
</varlistentry>
</term>
<listitem>
<para>Any files found in <filename>/etc/conf.d/</filename> will be sourced in the initramfs to
-set initial values. Command line options will override these values
+set initial values. Command line options will override these values
set in the configuration files.</para>
</listitem>
</varlistentry>
Summary: Initramfs generator using udev
%if 0%{?fedora}
-Group: System Environment/Base
+Group: System Environment/Base
%endif
%if 0%{?suse_version}
Group: System/Base
%endif
-License: GPLv2+
+License: GPLv2+
URL: https://dracut.wiki.kernel.org/
-# Source can be generated by
+# Source can be generated by
# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{?dashgittag};sf=tgz
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}%{?dashgittag}.tar.bz2
%description
-Dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
-Unlike existing implementations, dracut does hard-code as little as possible
-into the initramfs. Dracut contains various modules which are driven by the
-event-based udev. Having root on MD, DM, LVM2, LUKS is supported as well as
+Dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
+Unlike existing implementations, dracut does hard-code as little as possible
+into the initramfs. Dracut contains various modules which are driven by the
+event-based udev. Having root on MD, DM, LVM2, LUKS is supported as well as
NFS, iSCSI, NBD, FCoE with the dracut-network package.
%package network
Summary: Dracut modules to build a dracut initramfs with network support
Requires: %{name} = %{version}-%{release}
-Requires: rpcbind
+Requires: rpcbind
%if %{with_nbd}
Requires: nbd
%endif
%if 0%{?fedora}
Requires: iscsi-initiator-utils
-Requires: nfs-utils
+Requires: nfs-utils
Requires: dhclient
%endif
%setup -q -n %{name}-%{version}%{?dashgittag}
%build
-make
+make
%install
%if 0%{?fedora}
rm -rf $RPM_BUILD_ROOT
%endif
make install DESTDIR=$RPM_BUILD_ROOT sbindir=/sbin \
- sysconfdir=/etc mandir=%{_mandir}
+ sysconfdir=/etc mandir=%{_mandir}
echo %{name}-%{version}-%{release} > $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/10rpmversion/dracut-version
%defattr(-,root,root,0755)
%{_datadir}/dracut/modules.d/02caps
-%files tools
+%files tools
%defattr(-,root,root,0755)
%{_mandir}/man8/dracut-gencmdline.8*
%{_mandir}/man8/dracut-catimages.8*
<para>A <acronym>TFTP</acronym> server (on systems that can boot from Ethernet) </para>
</listitem>
</itemizedlist>
- <para>The bootloader will load the kernel and initial root file system image into memory and then start the kernel, passing in the memory address of the image.
+ <para>The bootloader will load the kernel and initial root file system image into memory and then start the kernel, passing in the memory address of the image.
</para>
<para>Depending on which algorithms were compiled statically into it, the kernel can currently unpack initrd/initramfs images compressed with gzip, bzip2 and <acronym>LZMA</acronym>. </para>
</section>
<para>Remove the boot arguments ''rhgb'' and ''quiet''
</para>
<para>
-A sample <filename>/etc/grub.conf</filename> bootloader configuration file is listed below.
+A sample <filename>/etc/grub.conf</filename> bootloader configuration file is listed below.
</para>
<para><screen>default=0
timeout=5
terminal --timeout=5 serial console
title Fedora (2.6.29.5-191.fc11.x86_64)
root (hd0,0)
- kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
+ kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
initrd /dracut-2.6.29.5-191.fc11.x86_64.img</screen></para>
</listitem>
<listitem>
<para>If system boot fails, you will be dropped into a shell as seen in the example below.
-<screen>No root device found
+<screen>No root device found
Dropping to debug shell.
sh: can't access tty; job control turned off
inst_simple "$moddir/insmodpost.sh" /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>
<para><filename>parse-insmodpost.sh</filename>:</para>
- <programlisting>for p in $(getargs rd.driver.post=); do
+ <programlisting>for p in $(getargs rd.driver.post=); do
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
_do_insmodpost=1
done
<para><filename>insmodpost.sh</filename>:</para>
<programlisting>. /lib/dracut-lib.sh
-for p in $(getargs rd.driver.post=); do
+for p in $(getargs rd.driver.post=); do
modprobe $p
done
</programlisting>
-#!/bin/bash
+#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
echo "$image:"
echo "========================================================================"
-$CAT "$image" | cpio --extract --verbose --quiet --to-stdout 'lib/dracut/dracut-*' 2>/dev/null
+$CAT "$image" | cpio --extract --verbose --quiet --to-stdout 'lib/dracut/dracut-*' 2>/dev/null
echo "========================================================================"
$CAT "$image" | cpio --extract --verbose --quiet --list
echo "========================================================================"
}
install() {
- inst /sbin/bootchartd
- inst /bin/bash
+ 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 /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/grep
inst /bin/usleep
inst /usr/bin/[ /bin/[
installkernel() {
FIPSMODULES="aead aes_generici aes-xts 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"
+ FIPSMODULES="$FIPSMODULES cryptomgr crypto_null tcrypt"
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
- for mod in $FIPSMODULES; do
+ for mod in $FIPSMODULES; do
if instmods $mod; then
echo $mod >> "${initdir}/etc/fipsmodules"
echo "blacklist $mod" >> "${initdir}/etc/modprobe.d/fips.conf"
info "Loading CAPS_MODULES $CAPS_MODULES"
for i in $CAPS_MODULES;do modprobe $i 2>&1 >/dev/null | vinfo; done
-
+
if [ "$CAPS_MODULES_DISABLED" = "1" -a -e /proc/sys/kernel/modules_disabled ]; then
info "Disabling module loading."
echo $CAPS_MODULES_DISABLED > /proc/sys/kernel/modules_disabled
echo $CAPS_USERMODEHELPER_BSET > /proc/sys/kernel/usermodehelper/bset
echo $CAPS_USERMODEHELPER_BSET > /proc/sys/kernel/usermodehelper/inheritable
fi
-
+
echo "CAPS_INIT_DROP=\"$CAPS_INIT_DROP\"" > /etc/capsdrop
info "Will drop capabilities $CAPS_INIT_DROP from init."
fi
the installation script we handle it by mappings between variables used
by Dracut and the ones in the system. Package maintainer is expected to
create those for his/her distribution and it's appreciated to share it
-with us, so we can include it in source package.
+with us, so we can include it in source package.
1. Hostonly vs Generic
for kbddir in ${kbddir} /usr/lib/kbd /lib/kbd /usr/share /usr/share/kbd
do
[[ -d "${kbddir}" ]] && \
- for dir in ${KBDSUBDIRS//,/ }
+ for dir in ${KBDSUBDIRS//,/ }
do
[[ -d "${kbddir}/${dir}" ]] && continue
false
done && break
- kbddir=''
+ kbddir=''
done
[[ ${kbddir} ]] || {
-#!/bin/sh
+#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
if [ -n "$namesrv" ] ; then
for s in $namesrv; do
- echo nameserver $s
+ echo nameserver $s
done
fi >> /tmp/net.$netif.resolv.conf
warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
exit 1
fi
- setup_interface
+ setup_interface
set | while read line; do
[ "${line#new_}" = "$line" ] && continue
- echo "$line"
+ echo "$line"
done >/tmp/dhclient.$netif.dhcpopts
echo online > /sys/class/net/$netif/uevent
- initqueue --onetime --name netroot-$netif netroot $netif
+ initqueue --onetime --name netroot-$netif netroot $netif
;;
*) echo "dhcp: $reason";;
esac
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
- root-path, interface-mtu;
+ root-path, interface-mtu;
do_ipv6auto() {
load_ipv6
{
- echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
+ echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
- echo ip link set $netif up
+ echo ip link set $netif up
echo wait_for_if_up $netif
} > /tmp/net.$netif.up
namesrv=$(getargs nameserver)
if [ -n "$namesrv" ] ; then
for s in $namesrv; do
- echo nameserver $s
+ echo nameserver $s
done
fi >> /tmp/net.$netif.resolv.conf
echo online > /sys/class/net/$netif/uevent
- initqueue --onetime --name netroot-$netif netroot $netif
+ initqueue --onetime --name netroot-$netif netroot $netif
}
# Handle static ip configuration
strstr $ip '*:*:*' && load_ipv6
{
- echo ip link set $netif up
+ echo ip link set $netif up
echo wait_for_if_up $netif
# do not flush addr for ipv6
strstr $ip '*:*:*' || \
namesrv=$(getargs nameserver)
if [ -n "$namesrv" ] ; then
for s in $namesrv; do
- echo nameserver $s
+ echo nameserver $s
done
fi >> /tmp/net.$netif.resolv.conf
echo online > /sys/class/net/$netif/uevent
- initqueue --onetime --name netroot-$netif netroot $netif
+ initqueue --onetime --name netroot-$netif netroot $netif
}
export PS4="ifup.$1.$$ + "
do_dhcp -6 ;;
auto6)
do_ipv6auto ;;
- *)
+ *)
do_static ;;
esac
break
check() {
. $dracutfunctions
- for program in ip arping dhclient ; do
+ for program in ip arping dhclient ; do
if ! type -P $program >/dev/null; then
derror "Could not find program \"$program\" required by network."
return 1
}
install() {
- dracut_install ip arping tr dhclient
+ dracut_install ip arping tr dhclient
dracut_install -o brctl ifenslave
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 "$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"
[ -z "$netroot" ] && exit 1
# Let's see if we have to wait for other interfaces
-# Note: exit works just fine, since the last interface to be
+# Note: exit works just fine, since the last interface to be
# online'd should see all files
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
for iface in $IFACES ; do
[ -e /tmp/net.$iface.up ] || exit 1
done
-# Set or override primary interface
+# Set or override primary interface
netif=$1
[ -e "/tmp/net.bootdev" ] && read netif < /tmp/net.bootdev
-# Figure out the handler for root=dhcp by recalling all netroot cmdline
+# Figure out the handler for root=dhcp by recalling all netroot cmdline
# handlers
if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then
# Unset root so we can check later
# Load dhcp options
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
- # If we have a specific bootdev with no dhcpoptions or empty root-path,
+ # If we have a specific bootdev with no dhcpoptions or empty root-path,
# we die. Otherwise we just warn
if [ -z "$new_root_path" ] ; then
[ -n "$BOOTDEV" ] && die "No dhcp root-path received for '$BOOTDEV'"
for f in $hookdir/cmdline/90*.sh; do
[ -f "$f" ] && . "$f";
done
-else
+else
rootok="1"
fi
# Note: This assumes that if no router is present the
# root server is on the same subnet.
#
-# TODO There's some netroot variants that don't (yet) have their
+# TODO There's some netroot variants that don't (yet) have their
# server-ip netroot
# Get router IP if set
# Save used netif for later use
[ ! -f /tmp/net.ifaces ] && echo $netif > /tmp/net.ifaces
-else
+else
warn "Mounting root via '$netif' failed"
# If we're trying with multiple interfaces, put that one down.
# ip down/flush ensures that routeing info goes away as well
# return if bond already parsed
[ -n "$bondname" ] && return
-# Check if bond parameter is valid
+# Check if bond parameter is valid
if getarg bond= >/dev/null ; then
if [ -z "$netroot" ] ; then
die "No netboot configured, bond is invalid"
if getarg bond >/dev/null; then
# Read bond= parameters if they exist
bond="$(getarg bond=)"
- if [ ! "$bond" = "bond" ]; then
+ if [ ! "$bond" = "bond" ]; then
parsebond "$(getarg bond=)"
fi
# Simple default bond
# return if bridge already parsed
[ -n "$bridgename" ] && return
-# Check if bridge parameter is valid
+# Check if bridge parameter is valid
if getarg bridge= >/dev/null ; then
if [ -z "$netroot" ] ; then
die "No netboot configured, bridge is invalid"
if getarg bridge >/dev/null; then
# Read bridge= parameters if they exist
bridge="$(getarg bridge=)"
- if [ ! "$bridge" = "bridge" ]; then
+ if [ ! "$bridge" = "bridge" ]; then
parsebridge "$(getarg bridge=)"
fi
# Simple default bridge
done
# This ensures that BOOTDEV is always first in IFACES
-if [ -n "$BOOTDEV" ] && [ -n "$IFACES" ] ; then
+if [ -n "$BOOTDEV" ] && [ -n "$IFACES" ] ; then
IFACES="${IFACES%$BOOTDEV*} ${IFACES#*$BOOTDEV}"
IFACES="$BOOTDEV $IFACES"
fi
[ -n "$BOOTDEV" ] && echo $BOOTDEV > /tmp/net.bootdev
[ -n "$IFACES" ] && echo $IFACES > /tmp/net.ifaces
-# We need a ip= line for the configured bootdev=
+# We need a ip= line for the configured bootdev=
[ -n "$NEEDBOOTDEV" ] && [ -z "$BOOTDEVOK" ] && die "Bootdev Argument '$BOOTDEV' not found"
fi
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
{
- echo "# Generated by dracut initrd"
+ echo "# Generated by dracut initrd"
echo "DEVICE=$netif"
echo "ONBOOT=yes"
echo "NETBOOT=yes"
if [ -f /tmp/net.$netif.lease ]; then
strstr "$ip" '*:*:*' &&
- echo "DHCPV6C=yes"
- echo "BOOTPROTO=dhcp"
+ echo "DHCPV6C=yes"
+ echo "BOOTPROTO=dhcp"
else
- echo "BOOTPROTO=none"
+ echo "BOOTPROTO=none"
# If we've booted with static ip= lines, the override file is there
- [ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
+ [ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
echo "IPADDR=$ip"
echo "NETMASK=$mask"
[ -n "$gw" ] && echo "GATEWAY=$gw"
{
echo "HWADDR=$(cat /sys/class/net/$netif/address)"
echo "TYPE=Ethernet"
- echo "NAME=\"Boot Disk\""
+ echo "NAME=\"Boot Disk\""
} >> /tmp/ifcfg/ifcfg-$netif
fi
# bridge
{
echo "TYPE=Bridge"
- echo "NAME=\"Boot Disk\""
+ echo "NAME=\"Boot Disk\""
} >> /tmp/ifcfg/ifcfg-$netif
if [ "$ethname" = "$bondname" ] ; then
{
# This variable is an indicator of a bond interface for initscripts
echo "BONDING_OPTS=\"$bondoptions\""
echo "BRIDGE=$netif"
- echo "NAME=\"$bondname\""
+ echo "NAME=\"$bondname\""
} >> /tmp/ifcfg/ifcfg-$bondname
for slave in $bondslaves ; do
# write separate ifcfg file for the raw eth interface
install() {
call_splash_geninitramfs() {
- local out ret
+ local out ret
out=$(splash_geninitramfs -c "$1" ${@:2} 2>&1)
ret=$?
inst /sbin/plymouthd /bin/plymouthd
dracut_install /bin/plymouth \
"${PLYMOUTH_LOGO_FILE}" \
- /etc/system-release
+ /etc/system-release
mkdir -m 0755 -p "${initdir}/usr/share/plymouth"
-if [[ $hostonly ]]; then
+if [[ $hostonly ]]; then
dracut_install "${usrlibdir}/plymouth/text.so" \
"${usrlibdir}/plymouth/details.so" \
"/usr/share/plymouth/themes/details/details.plymouth" \
done
(
cd ${initdir}/usr/share/plymouth/themes;
- ln -s text/text.plymouth default.plymouth 2>&1;
+ ln -s text/text.plymouth default.plymouth 2>&1;
)
fi
fi
;;
*) cat "$mntp/$keypath" ;;
- esac
+ esac
umount "$mntp"
rmdir "$mntp"
luksname="$name"
break
fi
-
+
# path used in crypttab
else
cdev=$(readlink -f $dev)
[[ $hostonly ]] && {
rootdev=$(find_root_block_device)
if [[ $rootdev ]]; then
- # root lives on a block device, so we can be more precise about
+ # 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
LUKS=$(getargs rd.luks.uuid rd_LUKS_UUID)
if [ -n "$LUKS" ]; then
- for luksid in $LUKS; do
+ for luksid in $LUKS; do
luksid=${luksid##luks-}
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
printf -- '--unique --onetime --name cryptroot-ask-%%k '
- printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID}"\n' $(command -v cryptroot-ask)
+ printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID}"\n' $(command -v cryptroot-ask)
} >> /etc/udev/rules.d/70-luks.rules.new
fi
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
-strstr "$(cat /proc/misc)" device-mapper || modprobe dm_mod
+strstr "$(cat /proc/misc)" device-mapper || modprobe dm_mod
if [ -n "$DM_RAIDS" ]; then
# only activate specified DM RAIDS
- for r in $DM_RAIDS; do
- for s in $SETS; do
+ for r in $DM_RAIDS; do
+ for s in $SETS; do
if [ "${s##$r}" != "$s" ]; then
info "Activating $s"
dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
fi
done
done
-else
+else
# scan and activate all DM RAIDS
for s in $SETS; do
info "Activating $s"
[[ $hostonly ]] && {
rootdev=$(find_root_block_device)
if [[ $rootdev ]]; then
- # root lives on a block device, so we can be more precise about
+ # 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
}
install() {
- dracut_install dmraid partx kpartx
+ dracut_install dmraid partx kpartx
inst dmeventd
[ -e "$i" ] && dracut_install "$i"
done
- inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
+ inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
# Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
# files, but provides the one below:
inst_rules 64-device-mapper.rules
live:/dev/*)
{
printf 'KERNEL=="%s", SYMLINK+="live"\n' \
- ${root#live:/dev/}
+ ${root#live:/dev/}
printf 'SYMLINK=="%s", SYMLINK+="live"\n' \
- ${root#live:/dev/}
+ ${root#live:/dev/}
} >> $UDEVRULESD/99-live-mount.rules
{
printf 'KERNEL=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
- ${root#live:/dev/}
+ ${root#live:/dev/}
printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
- ${root#live:/dev/}
+ ${root#live:/dev/}
} >> $UDEVRULESD/99-live-squash.rules
echo '[ -e /dev/root ]' > $hookdir/initqueue/finished/dmsquash.sh
;;
}
depends() {
- # if dmsetup is not installed, then we cannot support fedora/red hat
+ # if dmsetup is not installed, then we cannot support fedora/red hat
# style live images
echo dm rootfs-block
return 0
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
-for p in $(getargs rd.driver.post rdinsmodpost=); do
+for p in $(getargs rd.driver.post rdinsmodpost=); do
(
IFS=,
- for p in $i; do
+ for p in $i; do
modprobe $p
done
)
hostonly='' instmods atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech hid-microsoft ehci-hcd ohci-hcd uhci-hcd
instmods "=drivers/pcmcia" =ide "=drivers/usb/storage"
- instmods $(filter_kernel_modules block_module_test)
+ 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
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
-for i in $(getargs rd.driver.pre rdloaddriver=); do
- (
+for i in $(getargs rd.driver.pre rdloaddriver=); do
+ (
IFS=,
- for p in $i; do
+ for p in $i; do
modprobe $p 2>&1 | vinfo
done
)
done
-for i in $(getargs rd.driver.blacklist rdblacklist=); do
+for i in $(getargs rd.driver.blacklist rdblacklist=); do
(
IFS=,
- for p in $i; do
+ for p in $i; do
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
done
)
done
-for p in $(getargs rd.driver.post rdinsmodpost=); do
+for p in $(getargs rd.driver.post rdinsmodpost=); do
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
_do_insmodpost=1
done
done
)
-if [ ! -e /etc/lvm/lvm.conf ]; then
+if [ ! -e /etc/lvm/lvm.conf ]; then
{
echo 'devices {';
echo -n ' filter = [ '
printf '"a|^/dev/%s$|", ' $dev;
done;
echo '"r/.*/" ]';
- echo '}';
+ echo '}';
# establish LVM locking
if [ -n $SNAPSHOT ]; then
maj=${1##*:}
min=$2
sub=${3%% *}
-sub=${sub%%\(*};
+sub=${sub%%\(*};
check_lvm_ver 2 2 57 $maj $min $sub && \
nopoll="--poll n"
[[ $hostonly ]] && {
rootdev=$(find_root_block_device)
if [[ $rootdev ]]; then
- # root lives on a block device, so we can be more precise about
+ # 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
install() {
inst lvm
- inst_rules "$moddir/64-lvm.rules"
+ inst_rules "$moddir/64-lvm.rules"
- if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
+ 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;
LABEL="do_md_inc"
-#
+#
# if rd_MDADMCONF do not assemble incrementally
# defer auto assembly until the udev queue is settled
-#
+#
ENV{rd_MDADMCONF}!="?*", GOTO="md_auto_end"
RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh $hookdir/initqueue/finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique /sbin/mdadm_auto'"
# ex: ts=8 sw=4 sts=4 et filetype=sh
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
-info "Autoassembling MD Raid"
+info "Autoassembling MD Raid"
mdadm -As --auto=yes --run 2>&1 | vinfo
[ -b $i ] || continue
mddetail=$(udevadm info --query=property --name=$i)
- case "$mddetail" in
- *MD_LEVEL=container*)
+ case "$mddetail" in
+ *MD_LEVEL=container*)
;;
*DEVTYPE=partition*)
;;
# there could still be some leftover devices
# which have had a container added
-for md in /dev/md[0-9]* /dev/md/*; do
+for md in /dev/md[0-9]* /dev/md/*; do
[ -b "$md" ] || continue
udevinfo="$(udevadm info --query=env --name=$md)"
strstr "$udevinfo" "MD_UUID=" && continue
[[ $hostonly ]] && {
rootdev=$(find_root_block_device)
if [[ $rootdev ]]; then
- # root lives on a block device, so we can be more precise about
+ # 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
}
install() {
- dracut_install mdadm partx
+ 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
+ # 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_rules "$moddir/65-md-incremental-imsm.rules"
- if ! mdadm -Q -e imsm /dev/null &> /dev/null; then
+ 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 [[ $hostonly ]] || [[ $mdadmconf = "yes" ]]; then
if [ -f /etc/mdadm.conf ]; then
inst /etc/mdadm.conf
else
if [ -x /sbin/mdmon ] ; then
dracut_install mdmon
- fi
+ fi
inst_hook pre-udev 30 "$moddir/mdmon-pre-udev.sh"
inst "$moddir/mdraid_start.sh" /sbin/mdraid_start
if [ -n "$MD_UUID" ]; then
for f in /etc/udev/rules.d/65-md-incremental*.rules; do
[ -e "$f" ] || continue
- while read line; do
+ while read line; do
if [ "${line%%UUID CHECK}" != "$line" ]; then
for uuid in $MD_UUID; do
printf 'ENV{MD_UUID}=="%s", GOTO="do_md_inc"\n' $uuid
done;
- printf 'GOTO="md_inc_end"\n';
+ printf 'GOTO="md_inc_end"\n';
else
- echo $line;
+ echo $line;
fi
done < "${f}" > "${f}.new"
- mv "${f}.new" "$f"
+ mv "${f}.new" "$f"
done
fi
fi
if [ -e /etc/multipath.conf ]; then
HARD=""
- while pidof multipathd >/dev/null 2>&1; do
+ while pidof multipathd >/dev/null 2>&1; do
for pid in $(pidof multipathd); do
kill $HARD $pid >/dev/null 2>&1
done
modprobe dm-multipath
multipathd -B || multipathd
else
- rm /etc/udev/rules.d/??-multipath.rules 2>/dev/null
+ rm /etc/udev/rules.d/??-multipath.rules 2>/dev/null
fi
check() {
arch=$(uname -m)
- [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
+ [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
return 0
}
}
install() {
- dracut_install -o ps grep more cat rm strace free showmount
+ 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
}
install() {
- dracut_install ip
- inst dcbtool
+ dracut_install ip
+ inst dcbtool
inst fipvlan
inst lldpad
#
# This implementation is incomplete: Discovery mode is not implemented and
# the argument handling doesn't follow currently agreed formats. This is mainly
-# because rfc4173 does not say anything about iscsi_initiator but open-iscsi's
+# because rfc4173 does not say anything about iscsi_initiator but open-iscsi's
# iscsistart needs this.
#
# Huh? Empty $2?
[ -z "$2" ] && exit 1
-# Huh? Empty $3? This isn't really necessary, since NEWROOT isn't
+# Huh? Empty $3? This isn't really necessary, since NEWROOT isn't
# used here. But let's be consistent
[ -z "$3" ] && exit 1
arg=$(getargs rd.iscsi.in.password iscsi_in_password=)
[ -n "$arg" ] && iscsi_in_password=$arg
-handle_netroot()
+handle_netroot()
{
iroot=$1
# override conf/commandline options by dhcp root_path
IFS=@
set $iroot
if [ $# -gt 1 ]; then
- authinfo=$1; shift
+ authinfo=$1; shift
iroot=$*
# allow empty authinfo to allow having an @ in iscsi_target_name like this:
# netroot=iscsi:@192.168.1.100::3260::iqn.2009-01.com.example:testdi@sk
iscsi_in_password=$4
fi
fi
- fi
+ fi
IFS="$OLDIFS"
local v=${iroot}:
local i
- set --
+ set --
while [ -n "$v" ]; do
if [ "${v#\[*:*:*\]:}" != "$v" ]; then
# handle IPv6 address
i="${i##\[}"
set -- "$@" "$i"
v=${v#\[$i\]:}
- else
+ else
set -- "$@" "${v%%:*}"
v=${v#*:}
fi
}
# loop over all netroot parameter
-if getarg netroot; then
- for nroot in $(getargs netroot); do
+if getarg netroot; then
+ for nroot in $(getargs netroot); do
[ "${netroot%%:*}" = "iscsi" ] || continue
handle_netroot ${nroot##iscsi:}
done
local iscsifuncs='iscsi_register_transport'
fgrep -q "$iscsifuncs" "$1"
}
- instmods $(filter_kernel_modules iscsi_module_test)
+ instmods $(filter_kernel_modules iscsi_module_test)
}
install() {
# 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
+ # 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:* ]] ;}
v=${v#*:}
done
- unset server port
+ unset server port
server=$2; port=$3;
}
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 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
[ -n "$var" ] && server=$var && break;
done
- # XXX This blindly assumes that if new_root_path has to used that
+ # XXX This blindly assumes that if new_root_path has to used that
# XXX it really can be used as server
server=${server%%:*}
fi
# XXX Should we loop here?
{ mount -t nfs -o$options${options:+,}nolock,nfsvers=3 $server:$path $NEWROOT || \
mount -t nfs -o$options${options:+,}nolock,nfsvers=2 $server:$path $NEWROOT ; } \
- && { [ -e /dev/root ] || >/dev/root ; }
+ && { [ -e /dev/root ] || >/dev/root ; }
fi
# inject new exit_if_exists
pid=$(pidof rpcbind)
[ -n "$pid" ] && kill $pid
-if incol2 /proc/mounts /var/lib/nfs/rpc_pipefs; then
+if incol2 /proc/mounts /var/lib/nfs/rpc_pipefs; then
# try to create the destination directory
[ -d $NEWROOT/$rpcpipefspath ] || \
mkdir -m 0755 -p $NEWROOT/$rpcpipefspath 2>/dev/null
# root=/dev/nfs nfsroot=[server:]path[,options]
#
# In Legacy root=/dev/nfs mode, if the 'nfsroot' parameter is not given
-# on the command line or is empty, the dhcp root-path is used as
+# on the command line or is empty, the dhcp root-path is used as
# [server:]path[:options] or the default "/tftpboot/%s" will be used.
#
# If server is unspecified it will be pulled from one of the following
fi
else
netroot=$root;
-fi
+fi
# LEGACY: nfsroot= is valid only if root=/dev/nfs
if [ -n "$nfsroot" ] ; then
# Done, all good!
rootok=1
-# Shut up init error check or make sure that block parser wont get
+# Shut up init error check or make sure that block parser wont get
# confused by having /dev/nfs[4]
root="$fstype"
[[ -x "${bin}" ]] && {
inst "${bin}" /usr/sbin/resume
[[ -f /etc/suspend.conf ]] && inst /etc/suspend.conf
- break
+ break
}
done
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
-if resume=$(getarg resume=) && ! getarg noresume; then
+if resume=$(getarg resume=) && ! getarg noresume; then
export resume
echo "$resume" >/.resume
else
[ -x $(command -v resume) ] && command resume $a_splash "$resume"
# parsing the output of ls is Bad, but until there is a better way...
- ls -lH "$resume" | (
+ ls -lH "$resume" | (
read x x x x maj min x;
echo "${maj%,}:$min"> /sys/power/resume)
>/.resume
if [ "${root%%:*}" = "block" ]; then
{
printf 'KERNEL=="%s", SYMLINK+="root"\n' \
- ${root#block:/dev/}
+ ${root#block:/dev/}
printf 'SYMLINK=="%s", SYMLINK+="root"\n' \
- ${root#block:/dev/}
+ ${root#block:/dev/}
} >> $UDEVRULESD/99-root.rules
-
+
printf '[ -e "%s" ] && { ln -s "%s" /dev/root 2>/dev/null; rm "$job"; }\n' \
"${root#block:}" "${root#block:}" >> $hookdir/initqueue/settled/blocksymlink.sh
if [ -n "$root" -a -z "${root%%block:*}" ]; then
mount -t ${fstype:-auto} -o "$rflags",ro "${root#block:}" "$NEWROOT" \
- && ROOTFS_MOUNTED=yes
+ && ROOTFS_MOUNTED=yes
READONLY=
fsckoptions=
&& ! getarg rootflags \
&& [ -f "$NEWROOT/etc/fstab" ] \
&& ! [ -L "$NEWROOT/etc/fstab" ]; then
- # if $NEWROOT/etc/fstab contains special mount options for
+ # if $NEWROOT/etc/fstab contains special mount options for
# the root filesystem,
# remount it with the proper options
rootopts="defaults"
- while read dev mp fs opts rest; do
+ while read dev mp fs opts rest; do
# skip comments
[ "${dev%%#*}" != "$dev" ] && continue
-
+
if [ "$mp" = "/" ]; then
rootfs=$fs
rootopts=$opts
if [ -z "$fastboot" -a "$READONLY" != "yes" ]; then
info "Checking filesystems"
info fsck -T -t noopts=_netdev -A $fsckoptions
- out=$(fsck -T -t noopts=_netdev -A $fsckoptions)
+ out=$(fsck -T -t noopts=_netdev -A $fsckoptions)
export RD_ROOTFS_FSCK=$?
echo $RD_ROOTFS_FSCK > /run/initramfs/root-fsck
-
+
# A return of 4 or higher means there were serious problems.
if [ $RD_ROOTFS_FSCK -gt 3 ]; then
warn $out
for TERMINFODIR in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
[ -d ${TERMINFODIR} ] && break
done
-
+
[ -d ${TERMINFODIR} ] && \
dracut_install $(find ${TERMINFODIR} -type f)
}
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
+ 60-pcmcia.rules
#Some debian udev rules are named differently
inst_rules 50-udev.rules 95-late.rules
dracut_install cat uname
- inst_dir /run/udev
- inst_dir /run/udev/rules.d
+ inst_dir /run/udev
+ inst_dir /run/udev/rules.d
if [ ! -x /lib/udev/vol_id ]; then
dracut_install blkid
check() {
arch=$(uname -m)
- [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
+ [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
return 0
}
depends() {
arch=$(uname -m)
- [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
+ [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
return 0
}
getargbool 1 rd.zfcp.conf -n rd_NO_ZFCPCONF || rm /etc/zfcp.conf
for zfcp_arg in $(getargs rd.zfcp 'rd_ZFCP='); do
- (
+ (
IFS=","
set $zfcp_arg
echo "$@" >> /etc/zfcp.conf
# deviceno WWPN FCPLUN
#
# Example:
-# 0.0.4000 0x5005076300C213e9 0x5022000000000000
-# 0.0.4001 0x5005076300c213e9 0x5023000000000000
+# 0.0.4000 0x5005076300C213e9 0x5022000000000000
+# 0.0.4001 0x5005076300c213e9 0x5023000000000000
#
#
# manual setup:
# modprobe zfcp
# echo 1 > /sys/bus/ccw/drivers/zfcp/0.0.4000/online
# echo LUN > /sys/bus/ccw/drivers/zfcp/0.0.4000/WWPN/unit_add
-#
+#
# Example:
# modprobe zfcp
# echo 1 > /sys/bus/ccw/drivers/zfcp/0.0.4000/online
check() {
arch=$(uname -m)
- [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
+ [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
return 0
}
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
-# FIXME: load selinux policy. this should really be done after we switchroot
+# FIXME: load selinux policy. this should really be done after we switchroot
rd_load_policy()
{
- # If SELinux is disabled exit now
+ # If SELinux is disabled exit now
getarg "selinux=0" > /dev/null && return 0
SELINUX="enforcing"
# Check whether SELinux is in permissive mode
permissive=0
- getarg "enforcing=0" > /dev/null
+ getarg "enforcing=0" > /dev/null
if [ $? -eq 0 -o "$SELINUX" = "permissive" ]; then
permissive=1
fi
local ret=0
local out
info "Loading SELinux policy"
- # load_policy does mount /proc and /selinux in
+ # load_policy does mount /proc and /selinux in
# libselinux,selinux_init_load_policy()
if [ -x "$NEWROOT/sbin/load_policy" ]; then
out=$(chroot "$NEWROOT" /sbin/load_policy -i 2>&1)
Syslog support for dracut
This module provides syslog functionality in the initrd.
-This is especially interesting when complex configuration being
+This is especially interesting when complex configuration being
used to provide access to the device the rootfs resides on.
-When this module is installed into the ramfs it is triggered by
+When this module is installed into the ramfs it is triggered by
the udev event from the nic being setup (online).
Then if syslog is configured it is started and will forward all
kernel messages to the given syslog server.
-The syslog implementation is detected automatically by finding the
+The syslog implementation is detected automatically by finding the
apropriate binary with the following order:
rsyslogd
syslogd
Bootparameters:
syslogserver=ip Where to syslog to
sysloglevel=level What level has to be logged
-syslogtype=rsyslog|syslog|syslogng
- Don't auto detect syslog but set it
+syslogtype=rsyslog|syslog|syslogng
+ Don't auto detect syslog but set it
#Bootparameters:
#syslogserver=ip Where to syslog to
#sysloglevel=level What level has to be logged
-#syslogtype=rsyslog|syslog|syslogng
+#syslogtype=rsyslog|syslog|syslogng
# Don't auto detect syslog but set it
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
shift
local filters=$*
local filter=
-
+
cat $syslog_template
for filter in $filters; do
if [ -n "$server" ]; then
rsyslog_config "$server" "$template" "$filters" > $conf
rsyslogd -c3
-fi
+fi
fi
echo "$syslogtype"
[ -n "$syslogtype" ]
-}
+}
read syslogtype < /tmp/syslog.type
if [ -z "$syslogtype" ]; then
for _o in $CMDLINE; do
if [ "$_o" = "$1" ]; then
- return 0;
+ return 0;
fi
[ "${_o%%=*}" = "${1%=}" ] && _val=${_o#*=};
done
if [ -n "$_val" ]; then
- echo $_val;
+ echo $_val;
return 0;
fi
return 1;
shift;;
esac
done
- [ "$RD_DEBUG" = "yes" ] && set -x
+ [ "$RD_DEBUG" = "yes" ] && set -x
return 1
}
}
_dogetargs() {
- set +x
+ set +x
local _o _found
unset _o
unset _found
return 0;
fi
if [ "${_o%%=*}" = "${1%=}" ]; then
- echo -n "${_o#*=} ";
+ echo -n "${_o#*=} ";
_found=1;
fi
done
done
if [ -n "$_val" ]; then
echo -n $_val
- [ "$RD_DEBUG" = "yes" ] && set -x
+ [ "$RD_DEBUG" = "yes" ] && set -x
return 0
fi
- [ "$RD_DEBUG" = "yes" ] && set -x
+ [ "$RD_DEBUG" = "yes" ] && set -x
return 1;
}
# it just returns 0. Otherwise 1 is returned.
# $1 = options separated by commas
# $2 = option we are interested in
-#
+#
# Example:
# $1 = cipher=aes-cbc-essiv:sha256,hash=sha256,verify
# $2 = hash
if [ -e /proc/cmdline ]; then
RD_DEBUG=no
if getargbool 0 rd.debug -y rdinitdebug -y rdnetdebug; then
- RD_DEBUG=yes
+ RD_DEBUG=yes
[ -n "$BASH" ] && \
export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
fi
fi
export RD_DEBUG
fi
- [ "$RD_DEBUG" = "yes" ] && set -x
+ [ "$RD_DEBUG" = "yes" ] && set -x
}
setdebug
echo "<24>dracut: Refusing to continue";
} > /dev/kmsg
- {
+ {
echo "warn dracut: FATAL: \"$@\"";
echo "warn dracut: Refusing to continue";
echo "exit 1"
check_quiet
echo "<30>dracut: $@" > /dev/kmsg
[ "$DRACUT_QUIET" != "yes" ] && \
- echo "dracut: $@"
+ echo "dracut: $@"
}
vinfo() {
- while read line; do
+ while read line; do
info $line;
done
}
wait_for_if_up() {
local cnt=0
- while [ $cnt -lt 20 ]; do
+ while [ $cnt -lt 20 ]; do
li=$(ip link show $1)
[ -z "${li##*state UP*}" ] && return 0
sleep 0.1
cnt=$(($cnt+1))
- done
+ done
return 1
}
-# root=nfs:[<server-ip>:]<root-dir>[:<nfs-options>]
+# root=nfs:[<server-ip>:]<root-dir>[:<nfs-options>]
# root=nfs4:[<server-ip>:]<root-dir>[:<nfs-options>]
nfsroot_to_var() {
# strip nfs[4]:
options="${options##:}"
# strip ":"
options="${options%%:}"
-
+
# Does it really start with '/'?
[ -n "${path%%/*}" ] && path="error";
-
+
#Fix kernel legacy style separating path and options with ','
if [ "$path" != "${path#*,}" ] ; then
options=${path#*,}
ip_to_var() {
local v=${1}:
local i
- set --
+ set --
while [ -n "$v" ]; do
if [ "${v#\[*:*:*\]:}" != "$v" ]; then
# handle IPv6 address
i="${i##\[}"
set -- "$@" "$i"
v=${v#\[$i\]:}
- else
+ else
set -- "$@" "${v%%:*}"
v=${v#*:}
fi
exec 0<>/dev/console 1<>/dev/console 2<>/dev/console
# wait for loginit
i=0
- while [ $i -lt 10 ]; do
+ while [ $i -lt 10 ]; do
if [ ! -e /run/initramfs/loginit.pipe ]; then
j=$(jobs)
[ -z "$j" ] && break
fi
sleep 0.1
i=$(($i+1))
- done
+ done
if [ $i -eq 10 ]; then
kill %1 >/dev/null 2>&1
set +e
if [ "$1" = "-n" ]; then
_rdshell_name=$2
- shift 2
+ shift 2
else
_rdshell_name=dracut
fi
# try to mount devtmpfs
if ! mount -t devtmpfs -o mode=0755,nosuid,noexec udev /dev >/dev/null 2>&1; then
# if it failed fall back to normal tmpfs
- mount -t tmpfs -o mode=0755,nosuid udev /dev >/dev/null 2>&1
+ mount -t tmpfs -o mode=0755,nosuid udev /dev >/dev/null 2>&1
# Make some basic devices first, let udev handle the rest
mknod -m 0666 /dev/null c 1 3
mknod -m 0666 /dev/ptmx c 5 2
# newer versions of udev use /run/udev/rules.d
export UDEVRULESD=/run/udev/rules.d
else
- mkdir -m 0755 /dev/.udev /dev/.udev/rules.d
+ mkdir -m 0755 /dev/.udev /dev/.udev/rules.d
export UDEVRULESD=/dev/.udev/rules.d
fi
while :; do
check_finished && break
-
+
udevsettle
check_finished && break
if [ -f $hookdir/initqueue/work ]; then
rm $hookdir/initqueue/work
fi
-
+
for job in $hookdir/initqueue/*.sh; do
[ -e "$job" ] || break
job=$job . $job
# which report no medium for quiet
# some time.
for cdrom in /sys/block/sr*; do
- [ -e "$cdrom" ] || continue
+ [ -e "$cdrom" ] || continue
# skip, if cdrom medium was already found
strstr "$(udevadm info --query=env --path=${cdrom##/sys})" \
ID_CDROM_MEDIA && continue
echo change > "$cdrom/uevent"
fi
done
-
+
i=$(($i+1))
[ $i -gt $RDRETRY ] \
&& { flock -s 9 ; emergency_shell "No root device \"$root\" found"; } 9>/.console_lock
# reset cdrom polling
for cdrom in /sys/block/sr*; do
- [ -e "$cdrom" ] || continue
+ [ -e "$cdrom" ] || continue
if [ -e "$cdrom"/events_poll_msecs ]; then
echo -1 > "$cdrom"/events_poll_msecs
fi
{
echo -n "Mounted root filesystem "
- while read dev mp rest; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
+ while read dev mp rest; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
} | vinfo
# pre pivot scripts are sourced just before we switch over to the new root.
udevadm control --stop-exec-queue
HARD=""
- while pidof udevd >/dev/null 2>&1; do
+ while pidof udevd >/dev/null 2>&1; do
for pid in $(pidof udevd); do
kill $HARD $pid >/dev/null 2>&1
done
set $CLINE
shift
for x in "$@"; do
- for s in $ignoreargs; do
+ for s in $ignoreargs; do
[ "${x%%=*}" = $s ] && continue 2
done
initargs="$initargs $x"
done
fi
[ "$RD_DEBUG" = "yes" ] && set -x
-
+
if [ -d "$NEWROOT"/run ]; then
NEWRUN="${NEWROOT}/run"
mount --bind /run "$NEWRUN"
NEWINITRAMFSROOT="$NEWRUN/initramfs"
if [ "$NEWINITRAMFSROOT/lib" -ef "/lib" ]; then
- for d in bin etc lib lib64 sbin tmp usr var; do
+ for d in bin etc lib lib64 sbin tmp usr var; do
[ -h /$d ] && ln -fsn $NEWINITRAMFSROOT/$d /$d
done
fi
fi
wait_for_loginit
-
+
info "Switching root"
-
+
umount -l /run
unset PS4
[ -x "$exe" ] || exe=$(command -v $exe)
if [ -n "$onetime" ]; then
- {
+ {
echo '[ -e "$job" ] && rm "$job"'
- echo "$exe $@"
+ echo "$exe $@"
} > "/tmp/$$-${job}.sh"
else
echo "$exe $@" > "/tmp/$$-${job}.sh"
[ -e /dev/kmsg ] && exec 5>/dev/kmsg || exec 5>/dev/null
exec 6>/run/initramfs/init.log
-while read line; do
+while read line; do
if [ "$line" = "DRACUT_LOG_END" ]; then
rm -f /run/initramfs/loginit.pipe
exit 0
fi
echo "<31>dracut: $line" >&5
# if "quiet" is specified we output to /dev/console
- [ -n "$QUIET" ] && echo "dracut: $line"
+ [ -n "$QUIET" ] && echo "dracut: $line"
echo "$line" >&6
done
}
depends() {
- echo udev-rules
+ 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 umount
- dracut_install -o less
+ dracut_install -o less
if [ ! -e "${initdir}/bin/sh" ]; then
dracut_install bash
(ln -s bash "${initdir}/bin/sh" || :)
EOF
mkfs.ext3 -L dracut /dev/sda2
-mkdir -p /root
-mount /dev/sda2 /root
-cp -a -t /root /source/*
+mkdir -p /root
+mount /dev/sda2 /root
+cp -a -t /root /source/*
mkdir -p /root/run
umount /root
echo "dracut-root-block-created" >/dev/sda1
}
test_setup() {
-
+
if [ ! -e root.ext3 ]; then
# Create the blank file to use as a root filesystem
(
initdir=overlay
. $basedir/dracut-functions
- dracut_install sfdisk mkfs.ext3 poweroff cp umount
+ dracut_install sfdisk mkfs.ext3 poweroff cp umount
inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
-f initramfs.testing $KVERSION || return 1
-# -o "plymouth network md dmraid multipath fips caps crypt btrfs resume dmsquash-live dm"
+# -o "plymouth network md dmraid multipath fips caps crypt btrfs resume dmsquash-live dm"
}
test_cleanup() {
initdir=overlay/source
. $basedir/dracut-functions
dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
- /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
+ /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
dracut_install grep
cp -a /etc/ld.so.conf* $initdir/etc
sudo ldconfig -r "$initdir"
)
-
+
# second, install the files needed to make the root filesystem
(
initdir=overlay
. $basedir/dracut-functions
- dracut_install sfdisk mke2fs poweroff cp umount
+ dracut_install sfdisk mke2fs poweroff cp umount
inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
-
+
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
initdir=overlay/source
. $basedir/dracut-functions
dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
- /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
+ /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
dracut_install grep
mkdir $initdir/run
sudo ldconfig -r "$initdir"
)
-
+
# second, install the files needed to make the root filesystem
(
initdir=overlay
. $basedir/dracut-functions
- dracut_install sfdisk mke2fs poweroff cp umount
+ dracut_install sfdisk mke2fs poweroff cp umount
inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
-
+
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
. /tmp/mduuid;
} && \
{
-echo "dracut-root-block-created"
-echo MD_UUID=$MD_UUID
+echo "dracut-root-block-created"
+echo MD_UUID=$MD_UUID
}> /dev/sda1
dd if=/dev/zero of=/dev/sda2
poweroff -f
echo "MD_UUID=$MD_UUID"
client_run || return 1
-
+
# client_run rd.md.conf=0 || return 1
client_run rd.lvm=0 failme && return 1
test_setup() {
# Create the blank file to use as a root filesystem
dd if=/dev/zero of=root.ext2 bs=1M count=40
-
+
kernel=$KVERSION
# Create what will eventually be our root filesystem onto an overlay
(
initdir=overlay/source
. $basedir/dracut-functions
dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
- /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
+ /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
dracut_install grep
cp -a /etc/ld.so.conf* $initdir/etc
sudo ldconfig -r "$initdir"
)
-
+
# second, install the files needed to make the root filesystem
(
initdir=overlay
inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
-
+
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
cryptsetup -q luksFormat /dev/sda3 /keyfile
cryptsetup -q luksFormat /dev/sda4 /keyfile
cryptsetup luksOpen /dev/sda2 dracut_sda2 </keyfile
-cryptsetup luksOpen /dev/sda3 dracut_sda3 </keyfile
+cryptsetup luksOpen /dev/sda3 dracut_sda3 </keyfile
cryptsetup luksOpen /dev/sda4 dracut_sda4 </keyfile
mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/mapper/dracut_sda2 /dev/mapper/dracut_sda3 /dev/mapper/dracut_sda4
# wait for the array to finish initailizing, otherwise this sometimes fails
cryptsetup luksClose /dev/mapper/dracut_sda4 && \
:; :;} && \
{
- echo "dracut-root-block-created"
+ echo "dracut-root-block-created"
for i in /dev/sda[234]; do
udevadm info --query=env --name=$i|grep 'ID_FS_UUID='
done
LUKSARGS=$(cat luks.txt)
dd if=/dev/zero of=check-success.img bs=1M count=1
-
+
echo "CLIENT TEST START: $LUKSARGS"
$testdir/run-qemu -hda root.ext2 -hdb check-success.img -m 256M -nographic \
-net none -kernel /boot/vmlinuz-$KVERSION \
initdir=overlay/source
. $basedir/dracut-functions
dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
- /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
+ /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
dracut_install grep
cp -a /etc/ld.so.conf* $initdir/etc
sudo ldconfig -r "$initdir"
)
-
+
# second, install the files needed to make the root filesystem
(
initdir=overlay
inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
-
+
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
cryptoUUIDS=$(grep --binary-files=text -m 3 ID_FS_UUID root.ext2)
for uuid in $cryptoUUIDS; do
eval $uuid
- printf ' rd.luks.uuid=luks-%s ' $ID_FS_UUID
+ printf ' rd.luks.uuid=luks-%s ' $ID_FS_UUID
done > luks.txt
-
+
(
initdir=overlay
udevadm control --reload-rules
# dmraid does not want symlinks in --disk "..."
-if [ -e /dev/hda ] ; then
+if [ -e /dev/hda ] ; then
echo y|dmraid -f isw -C Test0 --type 1 --disk "/dev/hdb /dev/hdc"
-else
+else
echo y|dmraid -f isw -C Test0 --type 1 --disk "/dev/sdb /dev/sdc"
fi
udevadm settle
SETS=$(dmraid -c -s)
# scan and activate all DM RAIDS
for s in $SETS; do
- dmraid -ay -i -p --rm_partitions "$s"
- [ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s"
+ dmraid -ay -i -p --rm_partitions "$s"
+ [ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s"
done
udevadm settle
-sfdisk -g /dev/mapper/isw*Test0
+sfdisk -g /dev/mapper/isw*Test0
# save a partition at the beginning for future flagging purposes
sfdisk -C 2560 -H 2 -S 32 -L /dev/mapper/isw*Test0 <<EOF
,1
SETS=$(dmraid -c -s -i)
# scan and activate all DM RAIDS
for s in $SETS; do
- dmraid -ay -i -p --rm_partitions "$s"
- [ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s"
+ dmraid -ay -i -p --rm_partitions "$s"
+ [ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s"
done
udevadm settle
mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 \
/dev/mapper/isw*p2 \
/dev/mapper/isw*p3 \
- /dev/mapper/isw*p4
+ /dev/mapper/isw*p4
# wait for the array to finish initailizing, otherwise this sometimes fails
# randomly.
initdir=overlay/source
. $basedir/dracut-functions
dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
- /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
+ /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
dracut_install grep
mkdir $initdir/run
sudo ldconfig -r "$initdir"
)
-
+
# second, install the files needed to make the root filesystem
(
initdir=overlay
. $basedir/dracut-functions
- dracut_install sfdisk mke2fs poweroff cp umount
+ dracut_install sfdisk mke2fs poweroff cp umount
inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
-
+
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
-#!/bin/sh
+#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
export TERM=linux
export PS1='nfstest-server:\w\$ '
fi
# nfsinfo=( server:/path nfs{,4} options )
- nfsinfo=($(awk '{print $2, $3, $4; exit}' client.img))
+ nfsinfo=($(awk '{print $2, $3, $4; exit}' client.img))
if [[ "${nfsinfo[0]%%:*}" != "$server" ]]; then
echo "CLIENT TEST INFO: got server: ${nfsinfo[0]%%:*}"
/etc/services sleep mount chmod
type -P portmap >/dev/null && dracut_install portmap
type -P rpcbind >/dev/null && dracut_install rpcbind
- [ -f /etc/netconfig ] && dracut_install /etc/netconfig
+ [ -f /etc/netconfig ] && dracut_install /etc/netconfig
type -P dhcpd >/dev/null && dracut_install dhcpd
[ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
instmods nfsd sunrpc ipv6
-#!/bin/sh
+#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
export TERM=linux
export PS1='nfstest-server:\w\$ '
cp -a /etc/ld.so.conf* $initdir/etc
sudo ldconfig -r "$initdir"
)
-
+
# second, install the files needed to make the root filesystem
(
initdir=overlay
. $basedir/dracut-functions
- dracut_install sfdisk mke2fs poweroff cp umount
+ dracut_install sfdisk mke2fs poweroff cp umount
inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
-
+
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
dracut_install /usr/sbin/iscsi-target
instmods iscsi_tcp crc32c ipv6
inst ./targets /etc/iscsi/targets
- [ -f /etc/netconfig ] && dracut_install /etc/netconfig
+ [ -f /etc/netconfig ] && dracut_install /etc/netconfig
type -P dhcpd >/dev/null && dracut_install dhcpd
[ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
inst ./server-init /sbin/init
-#!/bin/sh
+#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
export TERM=linux
export PS1='nbdtest-server:\w\$ '
-#!/bin/sh
+#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
export TERM=linux
export PS1='nfstest-server:\w\$ '
/etc/services sleep mount chmod
type -P portmap >/dev/null && dracut_install portmap
type -P rpcbind >/dev/null && dracut_install rpcbind
- [ -f /etc/netconfig ] && dracut_install /etc/netconfig
+ [ -f /etc/netconfig ] && dracut_install /etc/netconfig
type -P dhcpd >/dev/null && dracut_install dhcpd
[ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
instmods nfsd sunrpc ipv6
while (($# > 0)); do
case $1 in
- --run)
+ --run)
echo "TEST RUN: $TEST_DESCRIPTION"
test_run
exit $?;;
- --setup)
+ --setup)
echo "TEST SETUP: $TEST_DESCRIPTION"
test_setup
exit $?;;
- --clean)
+ --clean)
echo "TEST CLEANUP: $TEST_DESCRIPTION"
test_cleanup
exit $?;;
- --all)
+ --all)
echo -n "TEST: $TEST_DESCRIPTION ";
(
test_setup && test_run