Compare commits

...

46 Commits
030 ... 031

Author SHA1 Message Date
Harald Hoyer
de50e9c002 dracut-031 2013-07-31 14:24:25 +02:00
Harald Hoyer
868f935e23 kernel-modules/module-setup.sh: silently omit some filesystem drivers 2013-07-31 13:56:03 +02:00
Harald Hoyer
4ba662ff90 dracut.conf.d/fedora.conf.example: don't omit drivers 2013-07-31 13:56:03 +02:00
Harald Hoyer
dc7085ceeb systemd: use systemd in the initramfs, if installed on the system
and systemd version is >= 198
2013-07-31 13:56:03 +02:00
Harald Hoyer
9444bf6161 network: add vlan support for iBFT 2013-07-31 13:17:24 +02:00
Harald Hoyer
06ca27cdf5 dracut-logger.sh: do not use systemd-cat, if no /run/systemd/journal 2013-07-31 13:12:41 +02:00
Harald Hoyer
dd82da4e27 network/net-lib.sh: safeguard against incomplete iBFT settings 2013-07-31 12:00:53 +02:00
Harald Hoyer
190047f161 fips: handle checksum checks for RHEV kernels
https://bugzilla.redhat.com/show_bug.cgi?id=947729
2013-07-31 11:31:13 +02:00
Harald Hoyer
748867d177 fips: cope with module aliases, when checking modules
Also do not fail, if module aliases try to load CPU specific modules
like crc32c_intel.
2013-07-31 11:26:46 +02:00
Harald Hoyer
b806625d41 TEST-30-ISCSI: eth0 -> ens3 2013-07-31 11:23:51 +02:00
Harald Hoyer
dba2055979 remove "< <(" syntax
bash seems to want /dev/fd in that case. dracut is sometimes called in
environments, where /proc and /dev are not mounted.
2013-07-31 11:00:29 +02:00
Harald Hoyer
aa23dcd8ae TEST-50-MULTINIC: change interface names to ens* 2013-07-31 10:59:25 +02:00
Harald Hoyer
5bbbfeaf19 TEST-10: double disk space 2013-07-31 09:57:57 +02:00
Harald Hoyer
9b6c5fd7c7 dracut.spec: add bcache and modsign module 2013-07-30 16:21:59 +02:00
Harald Hoyer
904a76376f base/init.sh: create static device nodes with kmod 2013-07-30 16:20:05 +02:00
Harald Hoyer
52814c0ee3 systemd/dracut-pre-trigger.service: run after systemd-tmpfiles-setup-dev 2013-07-30 16:18:51 +02:00
Harald Hoyer
d124904f2b systemd: include systemd-tempfiles 2013-07-30 16:18:03 +02:00
Harald Hoyer
7fd850d58e dracut.sh: check for file existance before trying to read from it 2013-07-30 15:33:10 +02:00
Harald Hoyer
71bb2ecd79 base: hard depend on systemd, if system was started by systemd 2013-07-30 15:28:47 +02:00
James Lee
6e0348f33b crypt: Wait for udev to settle before unlocking disk
To eliminate a race condition that occurs when unlocking one device
depends on the result of unlocking a device before it, the crypt
module must wait for udev to settle between each unlock attempt.

Example

/etc/crypttab:

  keyfile /dev/md1 none luks
  sda4_crypt /dev/sda4 /dev/mapper/keyfile luks
  sdb4_crypt /dev/sdb4 /dev/mapper/keyfile luks

Without this patch, sometimes /dev/sda4 fails to unlock because udev
doesn't have time to create /dev/mapper/keyfile before it's needed.
2013-07-30 15:28:47 +02:00
Harald Hoyer
27458b10ff url-lib/module-setup.sh: fixed grepping libcurl 2013-07-30 15:28:46 +02:00
Harald Hoyer
bf27e473cb mdraid/mdmon-pre-shutdown.sh: removed unneeded code 2013-07-30 15:28:46 +02:00
Harald Hoyer
549442cc2a base/dracut-lib.sh: check for /proc/cmdline existance 2013-07-30 15:28:46 +02:00
Harald Hoyer
98836432c1 dracut.spec: fix typo 2013-07-30 15:28:46 +02:00
Harald Hoyer
d988dc30df systemd: add support for kmod static devnodes 2013-07-30 11:58:33 +02:00
Harald Hoyer
c5f8b69ad7 network:ifup handle bootif style interfaces
e.g. ip=77-77-6f-6f-64-73:dhcp
2013-07-29 16:06:28 +02:00
Amadeusz Żołnowski
2beee35d5e LatArCyrHeb-16 as a default i18n font for Gentoo 2013-07-26 08:03:16 +02:00
Amadeusz Żołnowski
1ae8b8aa02 crypt: Skip /etc/crypttab if not present
Prevents following error message:

I: *** Including module: crypt ***
/usr/lib/dracut/modules.d/90crypt/module-setup.sh: line 31: /etc/crypttab: No such file or directory
2013-07-26 08:03:15 +02:00
Harald Hoyer
8f092d0dda bcache: add support for bcache 2013-07-24 14:35:19 +02:00
Harald Hoyer
d624f60682 dracut.sh: check for /sbin /bin /lib
use readlink to detect, if /usr has to be mounted
2013-07-24 13:43:32 +02:00
Harald Hoyer
5decf6d813 add debian udev rule files 2013-07-24 13:42:17 +02:00
Harald Hoyer
1a1c80febe usrmount: do not install, if /sbin/init does not live in /usr 2013-07-24 13:41:57 +02:00
Harald Hoyer
7b3ff4e055 dracut-functions.sh:get_fs_env() fallback to blkid for ID_FS_TYPE not found 2013-07-24 13:38:57 +02:00
Harald Hoyer
56b58c0a94 modsign: do not install, if no keys present
also fixed inst_hook
2013-07-24 10:34:19 +02:00
Kyle McMartin
ad2565c8ff dracut: 90kernel-modules/module-setup.sh: add ehci-tegra.ko on arm
kernel-tegra is now part of the base kernel package, so bits and pieces
ended up modular, and as a result, if you boot off the internal USB, you
drop to a dracut shell with no way of getting to root.
2013-07-24 10:23:10 +02:00
Peter Jones
9f3d191fce Load kernel module signing keys before we start doing any real work.
This loads kernel module signing keys, so that we can verify signed
modules in secure boot mode.

Signed-off-by: Peter Jones <pjones@redhat.com>
2013-07-24 10:23:09 +02:00
Brandon Philips
f17c5fa573 95rootfs-block: fix PARTUUID parsing
In the kernel comments PARTUUID is shown using uppercase A-F:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/init/do_mounts.c?id=HEAD#n183

However, dracut tries to use the value of PARTUUID directly in
/dev/disks/by-partuuid/ which expects the hex to be lowercase. This will
cause root to never be found, oops!

Fix dracut so it can, like the Kernel, accept either casing.

Untested but I added a hack on my local system that was similar.
2013-07-24 10:23:09 +02:00
Colin Walters
99369bea1c systemd: Replace prefdm.service with display-manager.service
The former is dead, the latter is the new name.  See:

http://cgit.freedesktop.org/systemd/systemd/commit/?id=b2c9cbafb8b1a2742978e1faf37fbb3cf4fb5d44
https://fedoraproject.org/wiki/Features/DisplayManagerRework
2013-07-24 10:23:08 +02:00
Harald Hoyer
45ef8eb723 base: provide pidof() shell function 2013-07-23 12:56:20 +02:00
Harald Hoyer
bc6eae15ab init.sh: don't check for systemd-udevd in lower version branch 2013-07-23 12:26:06 +02:00
Harald Hoyer
475f3a8128 dracut.spec: require procps-ng for ps 2013-07-23 12:25:38 +02:00
Harald Hoyer
6b1e7a6ca4 dracut: use sysloglvl for systemd-cat logging 2013-07-19 09:46:00 +02:00
Harald Hoyer
bbaa0d5917 Use systemd-cat for logging on systemd systems, if logfile is empty 2013-07-19 09:34:45 +02:00
Harald Hoyer
3c4bfd685a dracut-functions.sh: only wait for the last pid spawned 2013-07-19 09:34:04 +02:00
Harald Hoyer
9dde7a66b5 dracut-functions.sh: don't warn twice about omitted modules 2013-07-19 09:33:45 +02:00
Harald Hoyer
34b56de12a resume: do not include in hostonly, if no swap is present 2013-07-18 14:41:31 +02:00
36 changed files with 499 additions and 214 deletions

View File

@@ -11,9 +11,9 @@ Michal Soltys <soltys@ziu.info>
Amerigo Wang <amwang@redhat.com>
Colin Guthrie <colin@mageia.org>
Andrey Borzenkov <arvidjaar@gmail.com>
Peter Jones <pjones@redhat.com>
Andreas Thienemann <andreas@bawue.net>
Hans de Goede <hdegoede@redhat.com>
Peter Jones <pjones@redhat.com>
John Reiser <jreiser@bitwagon.com>
Luca Berra <bluca@vodka.it>
Daniel Drake <dsd@laptop.org>
@@ -31,6 +31,7 @@ Milan Broz <mbroz@redhat.com>
Roberto Sassu <roberto.sassu@polito.it>
Anton Blanchard <anton@samba.org>
Bill Nottingham <notting@redhat.com>
Colin Walters <walters@verbum.org>
David Cantrell <dcantrell@redhat.com>
Dennis Gilmore <dennis@ausil.us>
Jon Ander Hernandez <jonan.h@gmail.com>
@@ -43,7 +44,6 @@ Radek Vykydal <rvykydal@redhat.com>
Wim Muskee <wimmuskee@gmail.com>
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Alan Pevec <apevec@redhat.com>
Colin Walters <walters@verbum.org>
Frederick Grose <fgrose@sugarlabs.org>
Ian Dall <ian@beware.dropbear.id.au>
James Buren <ryuo@frugalware.org>
@@ -59,6 +59,7 @@ Adam Williamson <awilliam@redhat.com>
Alexander Todorov <atodorov@redhat.com>
Andy Lutomirski <luto@mit.edu>
Anssi Hannula <anssi@mageia.org>
Brandon Philips <brandon@ifup.co>
Canek Peláez Valdés <caneko@gmail.com>
Chris Leech <cleech@redhat.com>
Christian Heinz <christian.ch.heinz@gmail.com>
@@ -70,10 +71,12 @@ Duane Griffin <duaneg@dghda.com>
Glen Gray <slaine@slaine.org>
Hermann Gausterer <git-dracut-2012@mrq1.org>
James Laska <jlaska@redhat.com>
James Lee <jlee@thestaticvoid.com>
Jan Stodola <jstodola@redhat.com>
Jiri Pirko <jiri@resnulli.us>
Joe Lawrence <Joe.Lawrence@stratus.com>
Kevin Yung <Kevin.Yung@myob.com>
Kyle McMartin <kyle@redhat.com>
Lars R. Damerow <lars@pixar.com>
Lennert Buytenhek <buytenh@wantstofly.org>
Lubomir Rintel <lkundrak@v3.sk>

31
NEWS
View File

@@ -1,3 +1,29 @@
dracut-031
==========
- do not include the resume dracut module in hostonly mode,
if no swap is present
- don't warn twice about omitted modules
- use systemd-cat for logging on systemd systems, if logfile is unset
- fixed PARTUUID parsing
- support kernel module signing keys
- do not install the usrmount dracut module in hostonly mode,
if /sbin/init does not live in /usr
- add debian udev rule files
- add support for bcache
- network: handle bootif style interfaces
e.g. ip=77-77-6f-6f-64-73:dhcp
- add support for kmod static devnodes
- add vlan support for iBFT
Contributions from:
Harald Hoyer
Amadeusz Żołnowski
Brandon Philips
Colin Walters
James Lee
Kyle McMartin
Peter Jones
dracut-030
==========
- support new persistent network interface names
@@ -14,6 +40,11 @@ dracut-030
- dmraid, let dmraid setup its own partitions
- sosreport renamed to rdsosreport
Contributions from:
Harald Hoyer
Konrad Rzeszutek Wilk
WANG Chao
dracut-029
==========
- wait for IPv6 autoconfiguration

View File

@@ -283,12 +283,11 @@ get_fs_env() {
printf "%s" "${line#ID_FS_TYPE=}";
exit 0;
fi
done; [[ $found ]] && exit 0; exit 1; }) ; then
done; [[ $found ]] && exit 0; exit 1; }) ; then
if [[ $ID_FS_TYPE ]]; then
printf "%s" "$ID_FS_TYPE"
return 0
fi
return 1
fi
# Fallback, if we don't have udev information
@@ -314,9 +313,9 @@ get_fs_env() {
# $ get_maj_min /dev/sda2
# 8:2
get_maj_min() {
local _maj _min
read _maj _min < <(stat -L -c '%t %T' "$1" 2>/dev/null)
printf "%s" "$((0x$_maj)):$((0x$_min))"
local _maj _min _majmin
_majmin="$(stat -L -c '%t:%T' "$1" 2>/dev/null)"
printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))"
}
# find_block_device <mountpoint>
@@ -334,11 +333,35 @@ find_block_device() {
_find_mpt="$1"
if [[ $use_fstab != yes ]]; then
[[ -d $_find_mpt/. ]]
while read _majmin _dev; do
if [[ -b $_dev ]]; then
if ! [[ $_majmin ]] || [[ $_majmin == 0:* ]]; then
read _majmin < <(get_maj_min $_dev)
findmnt -e -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | { \
while read _majmin _dev; do
if [[ -b $_dev ]]; then
if ! [[ $_majmin ]] || [[ $_majmin == 0:* ]]; then
_majmin=$(get_maj_min $_dev)
fi
if [[ $_majmin ]]; then
echo $_majmin
else
echo $_dev
fi
return 0
fi
if [[ $_dev = *:* ]]; then
echo $_dev
return 0
fi
done; return 1; } && return 0
fi
# fall back to /etc/fstab
findmnt -e --fstab -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | { \
while read _majmin _dev; do
if ! [[ $_dev ]]; then
_dev="$_majmin"
unset _majmin
fi
if [[ -b $_dev ]]; then
[[ $_majmin ]] || _majmin=$(get_maj_min $_dev)
if [[ $_majmin ]]; then
echo $_majmin
else
@@ -350,29 +373,7 @@ find_block_device() {
echo $_dev
return 0
fi
done < <(findmnt -e -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt")
fi
# fall back to /etc/fstab
while read _majmin _dev; do
if ! [[ $_dev ]]; then
_dev="$_majmin"
unset _majmin
fi
if [[ -b $_dev ]]; then
[[ $_majmin ]] || read _majmin < <(get_maj_min $_dev)
if [[ $_majmin ]]; then
echo $_majmin
else
echo $_dev
fi
return 0
fi
if [[ $_dev = *:* ]]; then
echo $_dev
return 0
fi
done < <(findmnt -e --fstab -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt")
done; return 1; } && return 0
return 1
}
@@ -389,20 +390,22 @@ find_mp_fstype() {
local _fs
if [[ $use_fstab != yes ]]; then
findmnt -e -v -n -o 'FSTYPE' --target "$1" | { \
while read _fs; do
[[ $_fs ]] || continue
[[ $_fs = "autofs" ]] && continue
echo -n $_fs
return 0
done; return 1; } && return 0
fi
findmnt --fstab -e -v -n -o 'FSTYPE' --target "$1" | { \
while read _fs; do
[[ $_fs ]] || continue
[[ $_fs = "autofs" ]] && continue
echo -n $_fs
return 0
done < <(findmnt -e -v -n -o 'FSTYPE' --target "$1")
fi
while read _fs; do
[[ $_fs ]] || continue
[[ $_fs = "autofs" ]] && continue
echo -n $_fs
return 0
done < <(findmnt --fstab -e -v -n -o 'FSTYPE' --target "$1")
done; return 1; } && return 0
return 1
}
@@ -421,20 +424,22 @@ find_dev_fstype() {
[[ "$_find_dev" = /dev* ]] || _find_dev="/dev/block/$_find_dev"
if [[ $use_fstab != yes ]]; then
findmnt -e -v -n -o 'FSTYPE' --source "$_find_dev" | { \
while read _fs; do
[[ $_fs ]] || continue
[[ $_fs = "autofs" ]] && continue
echo -n $_fs
return 0
done; return 1; } && return 0
fi
findmnt --fstab -e -v -n -o 'FSTYPE' --source "$_find_dev" | { \
while read _fs; do
[[ $_fs ]] || continue
[[ $_fs = "autofs" ]] && continue
echo -n $_fs
return 0
done < <(findmnt -e -v -n -o 'FSTYPE' --source "$_find_dev")
fi
while read _fs; do
[[ $_fs ]] || continue
[[ $_fs = "autofs" ]] && continue
echo -n $_fs
return 0
done < <(findmnt --fstab -e -v -n -o 'FSTYPE' --source "$_find_dev")
done; return 1; } && return 0
return 1
@@ -475,12 +480,12 @@ check_block_and_slaves() {
"$1" $2 && return
check_vol_slaves "$@" && return 0
if [[ -f /sys/dev/block/$2/../dev ]]; then
check_block_and_slaves $1 $(cat "/sys/dev/block/$2/../dev") && return 0
check_block_and_slaves $1 $(<"/sys/dev/block/$2/../dev") && return 0
fi
[[ -d /sys/dev/block/$2/slaves ]] || return 1
for _x in /sys/dev/block/$2/slaves/*/dev; do
[[ -f $_x ]] || continue
check_block_and_slaves $1 $(cat "$_x") && return 0
check_block_and_slaves $1 $(<"$_x") && return 0
done
return 1
}
@@ -489,16 +494,16 @@ check_block_and_slaves_all() {
local _x _ret=1
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
if "$1" $2; then
_ret=0
_ret=0
fi
check_vol_slaves "$@" && return 0
if [[ -f /sys/dev/block/$2/../dev ]]; then
check_block_and_slaves_all $1 $(cat "/sys/dev/block/$2/../dev") && _ret=0
check_block_and_slaves_all $1 $(<"/sys/dev/block/$2/../dev") && _ret=0
fi
[[ -d /sys/dev/block/$2/slaves ]] || return 1
for _x in /sys/dev/block/$2/slaves/*/dev; do
[[ -f $_x ]] || continue
check_block_and_slaves_all $1 $(cat "$_x") && _ret=0
check_block_and_slaves_all $1 $(<"$_x") && _ret=0
done
return $_ret
}
@@ -516,7 +521,7 @@ for_each_host_dev_and_slaves_all()
for _dev in ${host_devs[@]}; do
[[ -b "$_dev" ]] || continue
if check_block_and_slaves_all $_func $(get_maj_min $_dev); then
_ret=0
_ret=0
fi
done
return $_ret
@@ -1226,7 +1231,7 @@ module_installkernel() {
else
unset check depends install installkernel
installkernel() { true; }
. $_moddir/module-setup.sh
. $_moddir/module-setup.sh
installkernel
_ret=$?
unset check depends install installkernel
@@ -1255,7 +1260,6 @@ check_mount() {
[[ $2 ]] || mods_checked_as_dep+=" $_mod "
if [[ " $omit_dracutmodules " == *\ $_mod\ * ]]; then
dinfo "dracut module '$_mod' will not be installed, because it's in the list to be omitted!"
return 1
fi
@@ -1406,6 +1410,14 @@ install_kmod_with_fw() {
fi
fi
if [[ $silent_omit_drivers ]]; then
local _kmod=${1##*/}
_kmod=${_kmod%.ko}
_kmod=${_kmod/-/_}
[[ "$_kmod" =~ $silent_omit_drivers ]] && return 0
[[ "${1##*/lib/modules/$kernel/}" =~ $silent_omit_drivers ]] && return 0
fi
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}"
ret=$?
[[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \
@@ -1456,6 +1468,7 @@ for_each_kmod_dep() {
dracut_kernel_post() {
local _moddirname=${srcmods%%/lib/modules/*}
local _pid
if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && [[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" ]]; then
xargs -r modprobe -a ${_moddirname+-d ${_moddirname}/} \
@@ -1479,6 +1492,8 @@ dracut_kernel_post() {
done < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
fi
) &
_pid=$(jobs -p | while read a ; do printf ":$a";done)
_pid=${_pid##*:}
if [[ $DRACUT_INSTALL ]]; then
xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" \
@@ -1498,7 +1513,7 @@ dracut_kernel_post() {
done
fi
wait
wait $_pid
fi
for _f in modules.builtin.bin modules.builtin; do
@@ -1522,7 +1537,7 @@ dracut_kernel_post() {
[[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && rm -fr -- "$DRACUT_KERNEL_LAZY_HASHDIR"
}
module_is_host_only() { (
module_is_host_only() {
local _mod=$1
_mod=${_mod##*/}
_mod=${_mod%.ko}
@@ -1541,7 +1556,6 @@ module_is_host_only() { (
modinfo -F filename "$_mod" &>/dev/null || return 0
return 1
)
}
find_kernel_modules_by_path () {
@@ -1663,7 +1677,7 @@ instmods() {
# Capture all stderr from modprobe to _fderr. We could use {var}>...
# redirections, but that would make dracut require bash4 at least.
eval "( instmods_1 \"\$@\" ) ${_fderr}>&1" \
| while read line; do [[ "$line" =~ $_filter_not_found ]] || echo $line;done | derror
| while read line; do [[ "$line" =~ $_filter_not_found ]] || echo $line;done | derror
_ret=$?
return $_ret
}

View File

@@ -117,30 +117,38 @@ dlog_init() {
if [ -z "$fileloglvl" ]; then
[ -w "$logfile" ] && fileloglvl=4 || fileloglvl=0
elif (( $fileloglvl > 0 )); then
__oldumask=$(umask)
umask 0377
! [ -e "$logfile" ] && >"$logfile"
umask $__oldumask
if [ -w "$logfile" -a -f "$logfile" ]; then
if [[ $logfile ]]; then
__oldumask=$(umask)
umask 0377
! [ -e "$logfile" ] && >"$logfile"
umask $__oldumask
if [ -w "$logfile" -a -f "$logfile" ]; then
# Mark new run in the log file
echo >>"$logfile"
if command -v date >/dev/null; then
echo "=== $(date) ===" >>"$logfile"
echo >>"$logfile"
if command -v date >/dev/null; then
echo "=== $(date) ===" >>"$logfile"
else
echo "===============================================" >>"$logfile"
fi
echo >>"$logfile"
else
echo "===============================================" >>"$logfile"
fi
echo >>"$logfile"
else
# We cannot log to file, so turn this facility off.
fileloglvl=0
ret=1
errmsg="'$logfile' is not a writable file"
fileloglvl=0
ret=1
errmsg="'$logfile' is not a writable file"
fi
fi
fi
if (( $sysloglvl > 0 )); then
if ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null
then
if [[ -d /run/systemd/journal ]] && type -P systemd-cat &>/dev/null && (( $UID == 0 )) ; then
readonly _dlogdir="$(mktemp --tmpdir="$TMPDIR/" -d -t dracut-log.XXXXXX)"
readonly _systemdcatfile="$_dlogdir/systemd-cat"
mkfifo "$_systemdcatfile"
readonly _dlogfd=15
systemd-cat -t 'dracut' <"$_systemdcatfile" &
exec 15>"$_systemdcatfile"
elif ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null; then
# We cannot log to syslog, so turn this facility off.
sysloglvl=0
ret=1
@@ -306,15 +314,23 @@ _dlvl2syslvl() {
_do_dlog() {
local lvl="$1"; shift
local lvlc=$(_lvl2char "$lvl") || return 0
local msg="$lvlc: $*"
local msg="$*"
local lmsg="$lvlc: $*"
(( $lvl <= $stdloglvl )) && echo "$msg" >&2
if (( $lvl <= $sysloglvl )); then
logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) "$msg"
if [[ "$_dlogfd" ]]; then
echo "<$(_dlvl2syslvl $lvl)>$msg" >&$_dlogfd
else
logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) "$msg"
fi
fi
if (( $lvl <= $fileloglvl )) && [[ -w "$logfile" ]] && [[ -f "$logfile" ]]; then
echo "$msg" >>"$logfile"
echo "$lmsg" >>"$logfile"
fi
(( $lvl <= $kmsgloglvl )) && \
echo "<$(_dlvl2syslvl $lvl)>dracut[$$] $msg" >/dev/kmsg
}

View File

@@ -3,15 +3,12 @@
# i18n
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
i18n_default_font="latarcyrheb-sun16"
omit_drivers+=' .*/fs/ocfs/.* i2o_scsi'
stdloglvl=3
logfile=/var/log/dracut.log
fileloglvl=6
sysloglvl=5
install_items+=" vi /etc/virc ps grep cat rm "
prefix="/"
systemdutildir=/usr/lib/systemd
systemdsystemunitdir=/usr/lib/systemd/system
systemdsystemconfdir=/etc/systemd/system
udevdir=/usr/lib/udev
add_dracutmodules+=" systemd "
hostonly="yes"

View File

@@ -10,5 +10,6 @@ ro_mnt=yes
# i18n
i18n_vars="/etc/conf.d/keymaps:keymap-KEYMAP,extended_keymaps-EXT_KEYMAPS /etc/conf.d/consolefont:consolefont-FONT,consoletranslation-FONT_MAP /etc/rc.conf:unicode-UNICODE"
i18n_default_font="LatArCyrHeb-16"
omit_drivers+=" i2o_scsi"

133
dracut.sh
View File

@@ -245,24 +245,24 @@ dropindirs_sort()
local -a files
local f d
readarray -t files < <(
for d in "$@"; do
for i in "$d/"*"$suffix"; do
if [[ -e "$i" ]]; then
printf "%s\n" "${i##*/}"
fi
done
done | sort -Vu
)
for f in "${files[@]}"; do
for d in "$@"; do
if [[ -e "$d/$f" ]]; then
printf "%s\n" "$d/$f"
continue 2
for d in "$@"; do
for i in "$d/"*"$suffix"; do
if [[ -e "$i" ]]; then
printf "%s\n" "${i##*/}"
fi
done
done
done | sort -Vu | {
readarray -t files
for f in "${files[@]}"; do
for d in "$@"; do
if [[ -e "$d/$f" ]]; then
printf "%s\n" "$d/$f"
continue 2
fi
done
done
}
}
verbosity_mod_l=0
@@ -683,7 +683,15 @@ if [[ $early_microcode = yes ]]; then
}
fi
# clean up after ourselves no matter how we die.
trap 'ret=$?;[[ $outfile ]] && [[ -f $outfile.$$ ]] && rm -f -- "$outfile.$$";[[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf -- "$initdir"; [[ $microcode_dir ]] && rm -Rf -- "$microcode_dir"; exit $ret; };' EXIT
trap '
ret=$?;
[[ $outfile ]] && [[ -f $outfile.$$ ]] && rm -f -- "$outfile.$$";
[[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf -- "$initdir"; };
[[ $keep ]] && echo "Not removing $microcode_dir." >&2 || { [[ $microcode_dir ]] && rm -Rf -- "$microcode_dir"; };
[[ $_dlogdir ]] && rm -Rf -- "$_dlogdir";
exit $ret;
' EXIT
# clean up after ourselves no matter how we die.
trap 'exit 1;' SIGINT
@@ -761,7 +769,7 @@ for ((i=0; i < ${#dracut_args[@]}; i++)); do
dracut_args[$i]="\"${dracut_args[$i]}\""
#" keep vim happy
done
ddebug "Executing: $0 ${dracut_args[@]}"
dinfo "Executing: $0 ${dracut_args[@]}"
[[ $do_list = yes ]] && {
for mod in $dracutbasedir/modules.d/*; do
@@ -855,70 +863,70 @@ if [[ $hostonly ]]; then
for mp in \
"/" \
"/etc" \
"/usr" \
"/usr/bin" \
"/usr/sbin" \
"/usr/lib" \
"/usr/lib64" \
"/bin" \
"/sbin" \
"/lib" \
"/lib64" \
"/boot";
do
mp=$(readlink -f "$mp")
mountpoint "$mp" >/dev/null 2>&1 || continue
_dev="$(readlink -f "/dev/block/$(find_block_device "$mp")")"
[[ "$_mp" == "/" ]] && root_dev="$_dev"
push host_devs "$_dev"
done
while read dev type rest; do
[[ -b $dev ]] || continue
[[ "$type" == "partition" ]] || continue
while read _d _m _t _o _r; do
[[ "$_d" == \#* ]] && continue
[[ $_d ]] || continue
[[ $_t != "swap" ]] || [[ $_m != "swap" ]] && continue
[[ "$_o" == *noauto* ]] && continue
[[ "$_d" == UUID\=* ]] && _d="/dev/disk/by-uuid/${_d#UUID=}"
[[ "$_d" == LABEL\=* ]] && _d="/dev/disk/by-label/$_d#LABEL=}"
[[ "$_d" -ef "$dev" ]] || continue
if [[ -f /proc/swaps ]] && [[ -f /etc/fstab ]]; then
while read dev type rest; do
[[ -b $dev ]] || continue
[[ "$type" == "partition" ]] || continue
while read _mapper _a _p _o; do
[[ $_mapper = \#* ]] && continue
[[ "$_d" -ef /dev/mapper/"$_mapper" ]] || continue
[[ "$_o" ]] || _o="$_p"
while read _d _m _t _o _r; do
[[ "$_d" == \#* ]] && continue
[[ $_d ]] || continue
[[ $_t != "swap" ]] || [[ $_m != "swap" ]] && continue
[[ "$_o" == *noauto* ]] && continue
[[ "$_d" == UUID\=* ]] && _d="/dev/disk/by-uuid/${_d#UUID=}"
[[ "$_d" == LABEL\=* ]] && _d="/dev/disk/by-label/$_d#LABEL=}"
[[ "$_d" -ef "$dev" ]] || continue
if [[ -f /etc/crypttab ]]; then
while read _mapper _a _p _o; do
[[ $_mapper = \#* ]] && continue
[[ "$_d" -ef /dev/mapper/"$_mapper" ]] || continue
[[ "$_o" ]] || _o="$_p"
# skip mkswap swap
[[ $_o == *swap* ]] && continue 2
done < /etc/crypttab
[[ $_o == *swap* ]] && continue 2
done < /etc/crypttab
fi
push host_devs "$(readlink -f "$dev")"
break
done < /etc/fstab
done < /proc/swaps
push host_devs "$(readlink -f "$dev")"
break
done < /etc/fstab
done < /proc/swaps
fi
fi
_get_fs_type() { (
_get_fs_type() {
[[ $1 ]] || return
if [[ -b /dev/block/$1 ]] && ID_FS_TYPE=$(get_fs_env "/dev/block/$1"); then
printf "%s\n" "$(readlink -f "/dev/block/$1")" "$ID_FS_TYPE"
host_fs_types["$(readlink -f "/dev/block/$1")"]="$ID_FS_TYPE"
return 1
fi
if [[ -b $1 ]] && ID_FS_TYPE=$(get_fs_env "$1"); then
printf "%s\n" "$(readlink -f "$1")" "$ID_FS_TYPE"
host_fs_types["$(readlink -f "$1")"]="$ID_FS_TYPE"
return 1
fi
if fstype=$(find_dev_fstype "$1"); then
printf "%s\n" "$1" "$fstype"
host_fs_types["$1"]="$fstype"
return 1
fi
return 1
) }
}
for dev in "${host_devs[@]}"; do
while read key; do
read val
host_fs_types["$key"]="$val"
done < <(
_get_fs_type "$dev"
check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")"
)
for dev in ${host_devs[@]}; do
_get_fs_type "$dev"
check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")"
done
[[ -d $udevdir ]] \
@@ -1167,11 +1175,6 @@ if [[ $kernel_only != yes ]]; then
fi
fi
if (( maxloglvl >= 5 )); then
ddebug "Listing sizes of included files:"
du -c "$initdir" | sort -n | ddebug
fi
PRELINK_BIN="$(command -v prelink)"
if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then
if [[ $DRACUT_FIPS_MODE ]]; then
@@ -1258,6 +1261,7 @@ if [[ $early_microcode = yes ]]; then
done
(cd "$microcode_dir/d"; find . | cpio -o -H newc --quiet >../ucode.cpio)
fi
rm -f -- "$outfile"
dinfo "*** Creating image file ***"
if [[ $early_microcode = yes ]]; then
@@ -1272,7 +1276,8 @@ fi
mv -- "$outfile.$$" "$outfile"
dinfo "*** Creating image file done ***"
dinfo "Wrote $outfile:"
dinfo "$(ls -l "$outfile")"
if (( maxloglvl >= 5 )); then
lsinitrd "$outfile"| ddebug
fi
exit 0

View File

@@ -78,7 +78,7 @@ Provides: dracut-kernel = %{version}-%{release}
Obsoletes: dracut <= 029
Obsoletes: dracut-norescue
Provides: dracut-horescue
Provides: dracut-norescue
Requires: bash >= 4
Requires: coreutils
@@ -95,6 +95,7 @@ Requires: kpartx
%if 0%{?fedora} || 0%{?rhel} > 6
Requires: util-linux >= 2.21
Requires: systemd >= 199
Requires: procps-ng
Conflicts: grubby < 8.23
%else
Requires: udev > 166
@@ -269,9 +270,6 @@ echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-generic-i
echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-rescue.conf
%endif
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
install -m 0644 dracut.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/dracut_log
# create compat symlink
mkdir -p $RPM_BUILD_ROOT/sbin
ln -s /usr/bin/dracut $RPM_BUILD_ROOT/sbin/dracut
@@ -320,6 +318,7 @@ rm -rf -- $RPM_BUILD_ROOT
%else
%{dracutlibdir}/modules.d/00bootchart
%endif
%{dracutlibdir}/modules.d/03modsign
%{dracutlibdir}/modules.d/03rescue
%{dracutlibdir}/modules.d/04watchdog
%{dracutlibdir}/modules.d/05busybox
@@ -329,6 +328,7 @@ rm -rf -- $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/50drm
%{dracutlibdir}/modules.d/50plymouth
%{dracutlibdir}/modules.d/80cms
%{dracutlibdir}/modules.d/90bcache
%{dracutlibdir}/modules.d/90btrfs
%{dracutlibdir}/modules.d/90crypt
%{dracutlibdir}/modules.d/90dm
@@ -367,7 +367,6 @@ rm -rf -- $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/99fs-lib
%{dracutlibdir}/modules.d/99img-lib
%{dracutlibdir}/modules.d/99shutdown
%config(noreplace) %{_sysconfdir}/logrotate.d/dracut_log
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
%dir %{_sharedstatedir}/initramfs
%if %{defined _unitdir}

View File

@@ -55,8 +55,29 @@ mount_boot()
fi
}
do_rhevh_check()
{
KERNEL=$(uname -r)
kpath=${1}
# If we're on RHEV-H, the kernel is in /dev/.initramfs/live/vmlinuz0
HMAC_SUM_ORIG=$(cat /boot/.vmlinuz-${KERNEL}.hmac | while read a b; do printf "%s\n" $a; done)
HMAC_SUM_CALC=$(sha512hmac $kpath | while read a b; do printf "%s\n" $a; done || return 1)
if [ -z "$HMAC_SUM_ORIG" ] || [ -z "$HMAC_SUM_CALC" ] || [ "${HMAC_SUM_ORIG}" != "${HMAC_SUM_CALC}" ]; then
warn "HMAC sum mismatch"
return 1
fi
info "rhevh_check OK"
return 0
}
do_fips()
{
local _v
local _s
local _v
local _module
KERNEL=$(uname -r)
if ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
@@ -67,17 +88,37 @@ do_fips()
FIPSMODULES=$(cat /etc/fipsmodules)
info "Loading and integrity checking all crypto modules"
for module in $FIPSMODULES; do
if [ "$module" != "tcrypt" ]; then
modprobe ${module}
mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
for _module in $FIPSMODULES; do
if [ "$_module" != "tcrypt" ]; then
if ! modprobe "${_module}"; then
# check if kernel provides generic algo
_found=0
while read _k _s _v; do
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
[ "$_k" = "driver" ] && _v=$(str_replace "$_v" "_" "-")
[ "$_v" != "$_module" ] && continue
_found=1
break
done </proc/crypto
[ "$_found" = "0" ] && return 1
fi
fi
done
mv /etc/modprobe.d/fips.conf.bak /etc/modprobe.d/fips.conf
info "Self testing crypto algorithms"
modprobe tcrypt || return 1
rmmod tcrypt
info "Checking integrity of kernel"
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
if [ -e "$NEWROOT/dev/.initramfs/live/vmlinuz0" ]; then
do_rhevh_check "$NEWROOT/dev/.initramfs/live/vmlinuz0" || return 1
elif [ -e "$NEWROOT/dev/.initramfs/live/isolinux/vmlinuz0" ]; then
do_rhevh_check "$NEWROOT/dev/.initramfs/live/isolinux/vmlinuz0" || return 1
else
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
fi
info "All initrd crypto checks done"

View File

@@ -0,0 +1,13 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Licensed under the GPLv2
#
# Copyright 2013 Red Hat, Inc.
# Peter Jones <pjones@redhat.com>
for x in /lib/modules/keys/* ; do
[ "${x}" = "/lib/modules/keys/*" ] && break
keyctl padd asymmetric "" @s < ${x}
done

View File

@@ -0,0 +1,37 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Licensed under the GPLv2
#
# Copyright 2013 Red Hat, Inc.
# Peter Jones <pjones@redhat.com>
check() {
[[ -x /usr/bin/keyctl ]] || return 1
# do not include module in hostonly mode,
# if no keys are present
if [[ $hostonly ]]; then
x=$(echo /lib/modules/keys/*)
[[ "${x}" = "/lib/modules/keys/*" ]] && return 255
fi
return 0
}
depends() {
return 0
}
install() {
inst_dir /lib/modules/keys
inst_binary /usr/bin/keyctl
inst_hook pre-trigger 01 "$moddir/load-modsign-keys.sh"
for x in /lib/modules/keys/* ; do
[[ "${x}" = "/lib/modules/keys/*" ]] && break
inst_simple "${x}"
done
}

View File

@@ -287,6 +287,17 @@ for p in $(getargs ip=); do
# skip ibft
[ "$autoconf" = "ibft" ] && continue
case "$dev" in
??:??:??:??:??:??) # MAC address
_dev=$(iface_for_mac $dev)
[ -n "$_dev" ] && dev="$_dev"
;;
??-??-??-??-??-??) # MAC address in BOOTIF form
_dev=$(iface_for_mac $(fix_bootif $dev))
[ -n "$_dev" ] && dev="$_dev"
;;
esac
# If this option isn't directed at our interface, skip it
[ -n "$dev" ] && [ "$dev" != "$netif" ] && \
[ "$use_bridge" != 'true' ] && \

View File

@@ -205,16 +205,33 @@ ibft_to_cmdline() {
mac=$(read a < ${iface}/mac; echo $a)
[ -z "$mac" ] && continue
dev=$(set_ifname ibft $mac)
dhcp=$(read a < ${iface}/dhcp; echo $a)
[ -e ${iface}/dhcp ] && dhcp=$(read a < ${iface}/dhcp; echo $a)
if [ -e ${iface}/vlan ]; then
vlan=$(read a < ${iface}/vlan; echo $a)
echo "vlan=$vlan:$dev"
fi
if [ -n "$dhcp" ]; then
echo "ip=$dev:dhcp"
elif [ -e ${iface}/ip-addr ]; then
[ -e ${iface}/ip-addr ] && ip=$(read a < ${iface}/ip-addr; echo $a)
[ -e ${iface}/gateway ] && gw=$(read a < ${iface}/gateway; echo $a)
[ -e ${iface}/subnet-mask ] && mask=$(read a < ${iface}/subnet-mask; echo $a)
[ -e ${iface}/hostname ] && hostname=$(read a < ${iface}/hostname; echo $a)
if [ -n "$ip" ] && [ -n "$mask" ]; then
echo "ip=$ip::$gw:$mask:$hostname:$dev:none"
else
warn "${iface} does not contain a valid iBFT configuration"
warn "ip-addr=$ip"
warn "gateway=$gw"
warn "subnet-mask=$mask"
warn "hostname=$hostname"
fi
else
ip=$(read a < ${iface}/ip-addr; echo $a)
gw=$(read a < ${iface}/gateway; echo $a)
mask=$(read a < ${iface}/subnet-mask; echo $a)
hostname=$(read a < ${iface}/hostname; echo $a)
echo "ip=$ip::$gw:$mask:$hostname:$dev:none"
info "${iface} does not contain a valid iBFT configuration"
ls -l ${iface} | vinfo
fi
echo $mac > /tmp/net.${dev}.has_ibft_config
done
) >> /etc/cmdline.d/40-ibft.conf

View File

@@ -12,7 +12,7 @@ depends() {
}
install() {
local _dir _crt _found
local _dir _crt _found _lib
inst_simple "$moddir/url-lib.sh" "/lib/url-lib.sh"
dracut_install curl
# also install libs for curl https
@@ -22,8 +22,10 @@ install() {
inst_libdir_file "libsqlite3.so*"
for _dir in $libdirs; do
[[ -d $_dir ]] || continue
_crt=$(grep -F --binary-files=text -z .crt $_dir/libcurl.so)
[[ -d $_dir ]] || continue
for _lib in $_dir/libcurl.so.*; do
[[ -e $_lib ]] || continue
_crt=$(grep -F --binary-files=text -z .crt $_lib)
[[ $_crt ]] || continue
[[ $_crt == /*/* ]] || continue
if ! inst_simple "$_crt"; then
@@ -31,6 +33,7 @@ install() {
continue
fi
_found=1
done
done
[[ $_found ]] || dwarn "Couldn't find SSL CA cert bundle; HTTPS won't work."
}

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() {
type -P probe-bcache >/dev/null || return 1
[[ $hostonly ]] || [[ $mount_needs ]] && {
for fs in "${host_fs_types[@]}"; do
[[ $fs = "bcache" ]] && return 0
done
return 255
}
return 0
}
depends() {
return 0
}
installkernel() {
instmods bcache
}
install() {
dracut_install probe-bcache ${udevdir}/bcache-register
inst_rules 61-bcache.rules
}

View File

@@ -57,7 +57,7 @@ install() {
inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
fi
if [[ $hostonly ]]; then
if [[ $hostonly ]] && [[ -f /etc/cryptab ]]; then
# filter /etc/crypttab for the devices we need
while read _mapper _dev _rest; do
[[ $_mapper = \#* ]] && continue

View File

@@ -23,7 +23,7 @@ else
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
printf -- 'RUN+="%s --settled --unique --onetime ' $(command -v initqueue)
printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask)
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout
} >> /etc/udev/rules.d/70-luks.rules.new
@@ -31,7 +31,7 @@ else
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
printf -- 'RUN+="%s --settled --unique --onetime ' $(command -v initqueue)
printf -- '--name systemd-cryptsetup-%%k %s start ' $(command -v systemctl)
printf -- 'systemd-cryptsetup@luks$$(dev_unit_name -$env{ID_FS_UUID}).service"\n'
} >> /etc/udev/rules.d/70-luks.rules.new
@@ -51,13 +51,13 @@ else
if [ -z "$DRACUT_SYSTEMD" ]; then
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
printf -- '--unique --onetime --name cryptroot-ask-%%k '
printf -- '--unique --settled --onetime --name cryptroot-ask-%%k '
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $(command -v cryptroot-ask) $tout
} >> /etc/udev/rules.d/70-luks.rules.new
else
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
printf -- '--unique --onetime --name crypt-run-generator-%%k '
printf -- '--unique --settled --onetime --name crypt-run-generator-%%k '
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID}"\n' $(command -v crypt-run-generator)
} >> /etc/udev/rules.d/70-luks.rules.new
fi

View File

@@ -29,6 +29,8 @@ install() {
# 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
# debian udev rules
inst_rules 60-persistent-storage-dm.rules 55-dm.rules
inst_rules "$moddir/11-dm.rules"

View File

@@ -47,7 +47,8 @@ installkernel() {
if [[ "$(uname -p)" == arm* ]]; then
# arm specific modules
hostonly='' instmods sdhci_esdhc_imx mmci sdhci_tegra mvsdio omap omapdrm \
omap_hsmmc panel-tfp410 sdhci_dove ahci_platform pata_imx sata_mv
omap_hsmmc panel-tfp410 sdhci_dove ahci_platform pata_imx sata_mv \
ehci-tegra
fi
# install virtual machine support
@@ -60,8 +61,7 @@ installkernel() {
# if the required list is not set via the filesystems variable
if ! [[ $hostonly ]]; then
if [[ -z $filesystems ]]; then
omit_drivers="${omit_drivers}|kernel/fs/nfs|kernel/fs/nfsd|kernel/fs/lockd" \
omit_drivers="${omit_drivers##|}" \
silent_omit_drivers="kernel/fs/nfs|kernel/fs/nfsd|kernel/fs/lockd" \
instmods '=fs'
fi
else

View File

@@ -65,6 +65,8 @@ install() {
# 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
# debian udev rules
inst_rules 56-lvm.rules 60-persistent-storage-lvm.rules
inst_script "$moddir/lvm_scan.sh" /sbin/lvm_scan
inst_hook cmdline 30 "$moddir/parse-lvm.sh"

View File

@@ -11,6 +11,4 @@ _do_mdmon_takeover() {
if command -v mdmon >/dev/null; then
_do_mdmon_takeover $1
else
:
fi

View File

@@ -2,6 +2,18 @@
# -*- 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 resume, if no swap partition exist
[[ $hostonly ]] || [[ $mount_needs ]] && {
for fs in "${host_fs_types[@]}"; do
[[ $fs = swap ]] && return 0
done
return 255
}
return 0
}
install() {
local _bin
# Optional uswsusp support

View File

@@ -31,6 +31,7 @@ depends() {
install() {
dracut_install umount
dracut_install tr
if ! dracut_module_included "systemd"; then
inst_hook cmdline 95 "$moddir/parse-block.sh"
inst_hook pre-udev 30 "$moddir/block-genrules.sh"

View File

@@ -10,11 +10,15 @@ case "$root" in
rootok=1 ;;
block:UUID=*|UUID=*)
root="${root#block:}"
root="${root#UUID=}"
root="$(echo $root | tr "[:upper:]" "[:lower:]")"
root="block:/dev/disk/by-uuid/${root#UUID=}"
rootok=1 ;;
block:PARTUUID=*|PARTUUID=*)
root="${root#block:}"
root="block:/dev/disk/by-partuuid/${root#PARTUUID=}"
root="${root#PARTUUID=}"
root="$(echo $root | tr "[:upper:]" "[:lower:]")"
root="block:/dev/disk/by-partuuid/${root}"
rootok=1 ;;
block:PARTLABEL=*|PARTLABEL=*)
root="${root#block:}"

View File

@@ -36,6 +36,8 @@ install() {
"$moddir/61-persistent-storage.rules"
prepare_udev_rules 59-persistent-storage.rules 61-persistent-storage.rules
# debian udev rules
inst_rules 91-permissions.rules
{
for i in cdrom tape dialout floppy; do

View File

@@ -12,7 +12,7 @@ Description=dracut pre-trigger hook
Documentation=man:dracut-pre-trigger.service(8)
DefaultDependencies=no
Before=systemd-udev-trigger.service dracut-initqueue.service
After=dracut-pre-udev.service systemd-udevd.service
After=dracut-pre-udev.service systemd-udevd.service systemd-tmpfiles-setup-dev.service
Wants=dracut-pre-udev.service systemd-udevd.service
ConditionPathExists=/etc/initrd-release
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-trigger

View File

@@ -8,7 +8,7 @@
[Unit]
Description=Restore /run/initramfs
Documentation=man:dracut-shutdown.service(8)
After=getty@tty1.service prefdm.service
After=getty@tty1.service display-manager.service
Before=systemd-reboot.service shutdown.target
DefaultDependencies=no
ConditionPathExists=/run/initramfs/.need_shutdown

View File

@@ -5,6 +5,8 @@
check() {
[[ $mount_needs ]] && return 1
if [[ -x $systemdutildir/systemd ]]; then
SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
(( $SYSTEMD_VERSION >= 198 )) && return 0
return 255
fi
@@ -18,12 +20,6 @@ depends() {
install() {
local _mods
# SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
# if (( $SYSTEMD_VERSION < 198 )); then
# dfatal "systemd version $SYSTEMD_VERSION is too low. Need at least version 198."
# exit 1
# fi
if [[ "$prefix" == /run/* ]]; then
dfatal "systemd does not work with a prefix, which contains \"/run\"!!"
exit 1
@@ -69,6 +65,8 @@ install() {
$systemdsystemunitdir/timers.target \
$systemdsystemunitdir/paths.target \
$systemdsystemunitdir/umount.target \
$systemdsystemunitdir/kmod-static-nodes.service \
$systemdsystemunitdir/systemd-tmpfiles-setup-dev.service \
$systemdsystemunitdir/systemd-ask-password-console.path \
$systemdsystemunitdir/systemd-udevd-control.socket \
$systemdsystemunitdir/systemd-udevd-kernel.socket \
@@ -88,6 +86,7 @@ install() {
$systemdsystemunitdir/systemd-journald.service \
$systemdsystemunitdir/systemd-vconsole-setup.service \
$systemdsystemunitdir/systemd-random-seed-load.service \
\
$systemdsystemunitdir/sysinit.target.wants/systemd-modules-load.service \
$systemdsystemunitdir/sysinit.target.wants/systemd-ask-password-console.path \
$systemdsystemunitdir/sysinit.target.wants/systemd-journald.service \
@@ -96,6 +95,8 @@ install() {
$systemdsystemunitdir/sockets.target.wants/systemd-journald.socket \
$systemdsystemunitdir/sysinit.target.wants/systemd-udevd.service \
$systemdsystemunitdir/sysinit.target.wants/systemd-udev-trigger.service \
$systemdsystemunitdir/sysinit.target.wants/kmod-static-nodes.service \
$systemdsystemunitdir/sysinit.target.wants/systemd-tmpfiles-setup-dev.service \
\
$systemdsystemunitdir/ctrl-alt-del.target \
$systemdsystemunitdir/syslog.socket \
@@ -108,7 +109,7 @@ install() {
$systemdsystemunitdir/slices.target \
$systemdsystemunitdir/system.slice \
\
journalctl systemctl echo swapoff systemd-cgls
journalctl systemctl echo swapoff systemd-cgls systemd-tmpfiles
dracut_install -o \
/usr/lib/modules-load.d/*.conf \

View File

@@ -3,7 +3,10 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
local _init
[[ $mount_needs ]] && return 1
_init=$(readlink -f /sbin/init)
[[ "$init" == "${init##/usr}" ]] && return 255
return 0
}

View File

@@ -77,8 +77,10 @@ _getcmdline() {
CMDLINE_ETC_D="$CMDLINE_ETC_D $_line";
done <"$_i";
done
read -r CMDLINE </proc/cmdline;
CMDLINE="$CMDLINE_ETC_D $CMDLINE_ETC $CMDLINE"
if [ -e /proc/cmdline ]; then
read -r CMDLINE </proc/cmdline;
CMDLINE="$CMDLINE_ETC_D $CMDLINE_ETC $CMDLINE"
fi
fi
}
@@ -927,6 +929,31 @@ wait_for_loginit()
rm -f -- /run/initramfs/loginit.pipe /run/initramfs/loginit.pid
}
# pidof version for root
if ! command -v pidof >/dev/null 2>/dev/null; then
pidof() {
local _cmd
local _exe
local _rl
local i
_cmd="$1"
[ -z "$_cmd" ] && return 1
_exe=$(type -P "$1")
for i in /proc/*/exe; do
[ -e "$i" ] || return 1
if [ -n "$_exe" ]; then
[ "$i" -ef "$_cmd" ] || continue
else
_rl=$(readlink -f "$i");
[ "${_rl%/$_cmd}" != "$_rl" ] || continue
fi
i=${i%/exe}
echo ${i##/proc/}
done
return 0
}
fi
_emergency_shell()
{
local _name="$1"

View File

@@ -81,6 +81,20 @@ if ! ismounted /run; then
rm -fr -- /newrun
fi
if command -v kmod >/dev/null 2>/dev/null; then
kmod static-nodes --format=tmpfiles 2>/dev/null | \
while read type file mode a a a majmin; do
case $type in
d)
mkdir -m $mode -p $file
;;
c)
mknod -m $mode $file $type ${majmin%:*} ${majmin#*:}
;;
esac
done
fi
trap "action_on_fail Signal caught!" 0
[ -d /run/initramfs ] || mkdir -p -m 0755 /run/initramfs
@@ -278,8 +292,8 @@ if [ $UDEVVERSION -lt 168 ]; then
udevadm control --stop-exec-queue
HARD=""
while pidof systemd-udevd >/dev/null 2>&1; do
for pid in $(pidof systemd-udevd); do
while pidof udevd >/dev/null 2>&1; do
for pid in $(pidof udevd); do
kill $HARD $pid >/dev/null 2>&1
done
HARD="-9"

View File

@@ -13,11 +13,12 @@ depends() {
install() {
local _d
dracut_install mount mknod mkdir pidof sleep chroot \
dracut_install mount mknod mkdir sleep chroot \
sed ls flock cp mv dmesg rm ln rmmod mkfifo umount readlink setsid
inst $(command -v modprobe) /sbin/modprobe
dracut_install -o findmnt less
dracut_install -o findmnt less kmod
if [ ! -e "${initdir}/bin/sh" ]; then
dracut_install bash

View File

@@ -6,11 +6,11 @@ done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
# save a partition at the beginning for future flagging purposes
sfdisk -C 1280 -H 2 -S 32 -L /dev/sda <<EOF
,16
,400
,400
,400
sfdisk -C 2560 -H 2 -S 32 -L /dev/sda <<EOF
,32
,800
,800
,800
EOF
mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/sda2 /dev/sda3 /dev/sda4
# wait for the array to finish initailizing, otherwise this sometimes fails

View File

@@ -5,7 +5,7 @@ KVERSION=${KVERSION-$(uname -r)}
# Uncomment this to debug failures
#DEBUGFAIL="rd.shell rd.udev.log-priority=debug loglevel=70 systemd.log_target=kmsg"
#DEBUGFAIL="rd.debug rd.break=pre-mount rd.shell"
#DEBUGFAIL="rd.break rd.shell"
test_run() {
DISKIMAGE=$TESTDIR/TEST-10-RAID-root.img
$testdir/run-qemu \
@@ -21,7 +21,7 @@ test_setup() {
DISKIMAGE=$TESTDIR/TEST-10-RAID-root.img
# Create the blank file to use as a root filesystem
rm -f -- $DISKIMAGE
dd if=/dev/null of=$DISKIMAGE bs=1M seek=40
dd if=/dev/null of=$DISKIMAGE bs=1M seek=80
kernel=$KVERSION
# Create what will eventually be our root filesystem onto an overlay

View File

@@ -65,11 +65,11 @@ do_test_run() {
run_client "root=iscsi" \
"root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0" \
"ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:eth0:off" \
"ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:ens3:off" \
|| return 1
run_client "netroot=iscsi" \
"root=LABEL=sysroot ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:eth0:off" \
"root=LABEL=sysroot ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:ens3:off" \
"netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1 netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
|| return 1
return 0

View File

@@ -97,31 +97,31 @@ test_client() {
client_test "MULTINIC root=nfs BOOTIF=" \
00 01 02 \
"root=nfs:192.168.50.1:/nfs/client BOOTIF=52-54-00-12-34-00" \
"eth0" || return 1
"ens3" || return 1
# PXE Style BOOTIF= with dhcp root-path
client_test "MULTINIC root=dhcp BOOTIF=" \
00 01 02 \
"root=dhcp BOOTIF=52-54-00-12-34-02" \
"eth2" || return 1
"ens5" || return 1
# Multinic case, where only one nic works
client_test "MULTINIC root=nfs ip=dhcp" \
FF 00 FE \
"root=nfs:192.168.50.1:/nfs/client ip=dhcp" \
"eth1" || return 1
"ens4" || return 1
# Require two interfaces
client_test "MULTINIC root=nfs ip=eth1:dhcp ip=eth2:dhcp bootdev=eth1" \
client_test "MULTINIC root=nfs ip=ens4:dhcp ip=ens5:dhcp bootdev=ens4" \
00 01 02 \
"root=nfs:192.168.50.1:/nfs/client ip=eth1:dhcp ip=eth2:dhcp bootdev=eth1" \
"eth1 eth2" || return 1
"root=nfs:192.168.50.1:/nfs/client ip=ens4:dhcp ip=ens5:dhcp bootdev=ens4" \
"ens4 ens5" || return 1
# Require three interfaces with dhcp root-path
client_test "MULTINIC root=dhcp ip=eth0:dhcp ip=eth1:dhcp ip=eth2:dhcp bootdev=eth2" \
client_test "MULTINIC root=dhcp ip=ens3:dhcp ip=ens4:dhcp ip=ens5:dhcp bootdev=ens5" \
00 01 02 \
"root=dhcp ip=eth0:dhcp ip=eth1:dhcp ip=eth2:dhcp bootdev=eth2" \
"eth0 eth1 eth2" || return 1
"root=dhcp ip=ens3:dhcp ip=ens4:dhcp ip=ens5:dhcp bootdev=ens5" \
"ens3 ens4 ens5" || return 1
kill_server
return 0