Compare commits
68 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2f6ed29d04 | ||
![]() |
a3044aba53 | ||
![]() |
50f5bbbbaf | ||
![]() |
c4c1c4f456 | ||
![]() |
46cc29261f | ||
![]() |
7f5701eb8d | ||
![]() |
b7d1b6f904 | ||
![]() |
58ef91ff50 | ||
![]() |
fbf338ff98 | ||
![]() |
40db1daf00 | ||
![]() |
cbd1b385a2 | ||
![]() |
6470e0a12b | ||
![]() |
da5ef1737e | ||
![]() |
ecc13ef17e | ||
![]() |
5bcf262d59 | ||
![]() |
d97eb42593 | ||
![]() |
63330a89fc | ||
![]() |
49268028b9 | ||
![]() |
b874d4b5be | ||
![]() |
283d385fbd | ||
![]() |
96cf7270da | ||
![]() |
b19bdcbea7 | ||
![]() |
4e93c3f707 | ||
![]() |
f3b14c2b6a | ||
![]() |
d8b04dc184 | ||
![]() |
b5b608e44a | ||
![]() |
78d5cf7cb4 | ||
![]() |
f4a942783a | ||
![]() |
3b9aaaab42 | ||
![]() |
fc68c87afa | ||
![]() |
63f3bcd852 | ||
![]() |
57f90974f9 | ||
![]() |
d8cc8c0499 | ||
![]() |
36b2e5e2c2 | ||
![]() |
3c4315fa13 | ||
![]() |
d97d130da9 | ||
![]() |
e0aa98a1df | ||
![]() |
84bc192946 | ||
![]() |
e684eab878 | ||
![]() |
debf483d4d | ||
![]() |
d681df8e5f | ||
![]() |
540a5169b9 | ||
![]() |
12beb05a73 | ||
![]() |
e6aafacb23 | ||
![]() |
8d3d72a68c | ||
![]() |
b2fab575dc | ||
![]() |
de74e1ef41 | ||
![]() |
f2cbd4cbd6 | ||
![]() |
5ecc117a25 | ||
![]() |
00ed3ccfd9 | ||
![]() |
6a877a79c4 | ||
![]() |
cb73315dd6 | ||
![]() |
8552a3270c | ||
![]() |
281327f72c | ||
![]() |
da119ab18c | ||
![]() |
87bd8907a6 | ||
![]() |
a242ef13e0 | ||
![]() |
2b9d8f65a6 | ||
![]() |
ffc68f357e | ||
![]() |
ace51ef520 | ||
![]() |
93b02f502e | ||
![]() |
49c062821a | ||
![]() |
c504d8b435 | ||
![]() |
39fe00ef60 | ||
![]() |
bae44febb5 | ||
![]() |
5c274467d6 | ||
![]() |
c82a11334d | ||
![]() |
f34e1d6b0e |
@@ -22,7 +22,7 @@ done
|
||||
ret=0
|
||||
case "$1" in
|
||||
add)
|
||||
dracut ${noimageifnotneeded+--noimageifnotneeded} "$3"/initrd "$2"
|
||||
dracut ${noimageifnotneeded:+--noimageifnotneeded} "$3"/initrd "$2"
|
||||
ret=$?
|
||||
;;
|
||||
remove)
|
||||
|
8
AUTHORS
8
AUTHORS
@@ -14,9 +14,10 @@ Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Peter Jones <pjones@redhat.com>
|
||||
Andreas Thienemann <andreas@bawue.net>
|
||||
Hans de Goede <hdegoede@redhat.com>
|
||||
WANG Chao <chaowang@redhat.com>
|
||||
John Reiser <jreiser@bitwagon.com>
|
||||
Luca Berra <bluca@vodka.it>
|
||||
WANG Chao <chaowang@redhat.com>
|
||||
Thomas Renninger <trenn@suse.de>
|
||||
Daniel Drake <dsd@laptop.org>
|
||||
Dan Horák <dhorak@redhat.com>
|
||||
Baoquan He <bhe@redhat.com>
|
||||
@@ -25,14 +26,15 @@ Brian C. Lane <bcl@redhat.com>
|
||||
Kamil Rytarowski <n54@gmx.com>
|
||||
Marc Grimme <grimme@atix.de>
|
||||
Chao Wang <chaowang@redhat.com>
|
||||
Colin Walters <walters@verbum.org>
|
||||
Frederic Crozat <fcrozat@suse.com>
|
||||
Jesse Keating <jkeating@redhat.com>
|
||||
Milan Broz <mbroz@redhat.com>
|
||||
Peter Rajnoha <prajnoha@redhat.com>
|
||||
Radek Vykydal <rvykydal@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>
|
||||
@@ -40,10 +42,10 @@ Juan RP <xtraeme@gmail.com>
|
||||
Lance Albertson <lance@osuosl.org>
|
||||
Marian Ganisin <mganisin@redhat.com>
|
||||
Michael Ploujnikov <plouj@somanetworks.com>
|
||||
Peter Rajnoha <prajnoha@redhat.com>
|
||||
Wim Muskee <wimmuskee@gmail.com>
|
||||
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
||||
Alan Pevec <apevec@redhat.com>
|
||||
Alexander Tsoy <alexander@tsoy.me>
|
||||
Frederick Grose <fgrose@sugarlabs.org>
|
||||
Ian Dall <ian@beware.dropbear.id.au>
|
||||
James Buren <ryuo@frugalware.org>
|
||||
|
8
Makefile
8
Makefile
@@ -76,11 +76,11 @@ endif
|
||||
%.xml: %.asc
|
||||
asciidoc -d manpage -b docbook -o $@ $<
|
||||
|
||||
dracut.html: dracut.asc $(manpages)
|
||||
dracut.html: dracut.asc $(manpages) dracut.css
|
||||
asciidoc -a numbered -d book -b docbook -o dracut.xml dracut.asc
|
||||
xsltproc -o dracut.html --xinclude -nonet \
|
||||
--stringparam html.stylesheet \
|
||||
http://docs.fedoraproject.org/en-US/Common_Content/css/default.css \
|
||||
--stringparam custom.css.source dracut.css \
|
||||
--stringparam generate.css.header 1 \
|
||||
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
|
||||
rm -f -- dracut.xml
|
||||
|
||||
@@ -204,7 +204,7 @@ testimages: all
|
||||
@echo wrote test-dracut.img
|
||||
|
||||
hostimage: all
|
||||
./dracut.sh -H -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
|
||||
./dracut.sh -H -l -f test-$(shell uname -r).img $(shell uname -r)
|
||||
@echo wrote test-$(shell uname -r).img
|
||||
|
||||
AUTHORS:
|
||||
|
48
NEWS
48
NEWS
@@ -1,3 +1,51 @@
|
||||
dracut-034
|
||||
==========
|
||||
- do not run dhcp on parts of assembled network interfaces (bond, bridge)
|
||||
- add option to turn on/off prelinking
|
||||
--prelink, --noprelink
|
||||
do_prelink=[yes|no]
|
||||
- add ACPI table overriding
|
||||
- do not log to syslog/kmsg/journal for UID != 0
|
||||
- lvm/mdraid: Fix LVM on MD activation
|
||||
- bcache module removed (now in bcache-tools upstream)
|
||||
- mdadm: also install configs from /etc/mdadm.conf.d
|
||||
- fixes for mdadm-3.2.6+
|
||||
- mkinitrd: better compat support for SUSE
|
||||
- fcoe: add FCoE UEFI boot device support
|
||||
- rootfs-block: add support for the rootfallback= kernel cmdline option
|
||||
|
||||
Contributions from:
|
||||
Thomas Renninger
|
||||
Alexander Tsoy
|
||||
Peter Rajnoha
|
||||
WANG Chao
|
||||
Harald Hoyer
|
||||
|
||||
|
||||
dracut-033
|
||||
==========
|
||||
- improved hostonly device recognition
|
||||
- improved hostonly module recognition
|
||||
- add dracut.css for dracut.html
|
||||
- do not install udev rules from /etc in generic mode
|
||||
- fixed LABEL= parsing for swap devices
|
||||
- fixed iBFT network setup
|
||||
- url-lib.sh: handle 0-size files with curl
|
||||
- dracut.asc: document debugging dracut on shutdown
|
||||
- if rd.md=0, use dmraid for imsm and ddf
|
||||
- skip empty dracut modules
|
||||
- removed caching of kernel cmdline
|
||||
- fixed iso-scan, if the loop device driver is a kernel module
|
||||
- bcache: support new blkid
|
||||
- fixed ifup udev rules
|
||||
- ifup with dhcp, if no "ip=" specified for the interface
|
||||
|
||||
Contributions from:
|
||||
WANG Chao
|
||||
Colin Walters
|
||||
Harald Hoyer
|
||||
|
||||
|
||||
dracut-032
|
||||
==========
|
||||
- add parameter --print-cmdline
|
||||
|
@@ -34,7 +34,7 @@ _dracut() {
|
||||
--local --hostonly --no-hostonly --fstab --help --bzip2 --lzma
|
||||
--xz --no-compress --gzip --list-modules --show-modules --keep
|
||||
--printsize --regenerate-all --noimageifnotneeded --early-microcode
|
||||
--no-early-microcode --print-cmdline'
|
||||
--no-early-microcode --print-cmdline --prelink --noprelink'
|
||||
|
||||
[ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers
|
||||
--omit-drivers --modules --omit --drivers --filesystems --install
|
||||
|
@@ -296,6 +296,23 @@ get_maj_min() {
|
||||
printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))"
|
||||
}
|
||||
|
||||
|
||||
# get_devpath_block <device>
|
||||
# get the DEVPATH in /sys of a block device
|
||||
get_devpath_block() {
|
||||
local _majmin _i
|
||||
_majmin=$(get_maj_min "$1")
|
||||
|
||||
for _i in /sys/block/*/dev /sys/block/*/*/dev; do
|
||||
[[ -e "$_i" ]] || continue
|
||||
if [[ "$_majmin" == "$(<"$_i")" ]]; then
|
||||
printf "%s" "${_i%/dev}"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# get a persistent path from a device
|
||||
get_persistent_dev() {
|
||||
local i _tmp _dev
|
||||
@@ -313,6 +330,7 @@ get_persistent_dev() {
|
||||
/dev/disk/by-id/* \
|
||||
/dev/disk/by-path/* \
|
||||
; do
|
||||
[[ -e "$i" ]] || continue
|
||||
[[ $i == /dev/mapper/control ]] && continue
|
||||
[[ $i == /dev/mapper/mpath* ]] && continue
|
||||
_tmp=$(get_maj_min "$i")
|
||||
@@ -323,19 +341,43 @@ get_persistent_dev() {
|
||||
done
|
||||
}
|
||||
|
||||
expand_persistent_dev() {
|
||||
local _dev=$1
|
||||
|
||||
case "$_dev" in
|
||||
LABEL=*)
|
||||
_dev="/dev/disk/by-label/${_dev#LABEL=}"
|
||||
;;
|
||||
UUID=*)
|
||||
_dev="${_dev#UUID=}"
|
||||
_dev="${_dev,,}"
|
||||
_dev="/dev/disk/by-uuid/${_dev}"
|
||||
;;
|
||||
PARTUUID=*)
|
||||
_dev="${_dev#PARTUUID=}"
|
||||
_dev="${_dev,,}"
|
||||
_dev="/dev/disk/by-partuuid/${_dev}"
|
||||
;;
|
||||
PARTLABEL=*)
|
||||
_dev="/dev/disk/by-partlabel/${_dev#PARTLABEL=}"
|
||||
;;
|
||||
esac
|
||||
printf "%s" "$_dev"
|
||||
}
|
||||
|
||||
shorten_persistent_dev() {
|
||||
local dev="$1"
|
||||
case "$dev" in
|
||||
local _dev="$1"
|
||||
case "$_dev" in
|
||||
/dev/disk/by-uuid/*)
|
||||
printf "%s" "UUID=${dev##*/}";;
|
||||
printf "%s" "UUID=${_dev##*/}";;
|
||||
/dev/disk/by-label/*)
|
||||
printf "%s" "LABEL=${dev##*/}";;
|
||||
printf "%s" "LABEL=${_dev##*/}";;
|
||||
/dev/disk/by-partuuid/*)
|
||||
printf "%s" "PARTUUID=${dev##*/}";;
|
||||
printf "%s" "PARTUUID=${_dev##*/}";;
|
||||
/dev/disk/by-partlabel/*)
|
||||
printf "%s" "PARTLABEL=${dev##*/}";;
|
||||
printf "%s" "PARTLABEL=${_dev##*/}";;
|
||||
*)
|
||||
printf "%s" "$dev";;
|
||||
printf "%s" "$_dev";;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -664,37 +706,37 @@ fi
|
||||
[[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
|
||||
inst_dir() {
|
||||
[[ -e ${initdir}/"$1" ]] && return 0 # already there
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} -d "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} -d "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} -d "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -d "$@" || :
|
||||
}
|
||||
|
||||
inst() {
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
#dinfo "$DRACUT_INSTALL -l $@"
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_simple() {
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -e $1 ]] || return 1 # no source
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} "$@" || :
|
||||
}
|
||||
|
||||
inst_symlink() {
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -L $1 ]] || return 1
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_multiple() {
|
||||
local ret
|
||||
#dinfo "initdir=$initdir $DRACUT_INSTALL -l $@"
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
|
||||
ret=$?
|
||||
(($ret != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
(($ret != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
|
||||
return $ret
|
||||
}
|
||||
|
||||
@@ -705,18 +747,18 @@ dracut_install() {
|
||||
inst_library() {
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -e $1 ]] || return 1 # no source
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_binary() {
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_script() {
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
|
||||
}
|
||||
|
||||
# find symlinks linked to given library file
|
||||
@@ -830,8 +872,8 @@ inst_rules() {
|
||||
inst_dir "$_target"
|
||||
for _rule in "$@"; do
|
||||
if [ "${_rule#/}" = "$_rule" ]; then
|
||||
for r in ${udevdir}/rules.d /etc/udev/rules.d; do
|
||||
if [[ -f $r/$_rule ]]; then
|
||||
for r in ${udevdir}/rules.d ${hostonly:+/etc/udev/rules.d}; do
|
||||
if [[ -e $r/$_rule ]]; then
|
||||
_found="$r/$_rule"
|
||||
inst_rule_programs "$_found"
|
||||
inst_rule_group_owner "$_found"
|
||||
@@ -840,7 +882,10 @@ inst_rules() {
|
||||
fi
|
||||
done
|
||||
fi
|
||||
for r in '' ./ $dracutbasedir/rules.d/; do
|
||||
for r in '' $dracutbasedir/rules.d/; do
|
||||
# skip rules without an absolute path
|
||||
[[ "${r}$_rule" != /* ]] && continue
|
||||
|
||||
if [[ -f ${r}$_rule ]]; then
|
||||
_found="${r}$_rule"
|
||||
inst_rule_programs "$_found"
|
||||
@@ -1260,6 +1305,9 @@ for_each_module_dir() {
|
||||
local _func
|
||||
_func=$1
|
||||
for _moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
[[ -d $_moddir ]] || continue;
|
||||
[[ -e $_moddir/install || -e $_moddir/installkernel || \
|
||||
-e $_moddir/module-setup.sh ]] || continue
|
||||
_mod=${_moddir##*/}; _mod=${_mod#[0-9][0-9]}
|
||||
$_func $_mod 1
|
||||
done
|
||||
@@ -1362,7 +1410,7 @@ dracut_kernel_post() {
|
||||
local _pid
|
||||
|
||||
if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && [[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" ]]; then
|
||||
xargs -r modprobe -a ${_moddirname+-d ${_moddirname}/} \
|
||||
xargs -r modprobe -a ${_moddirname:+-d ${_moddirname}/} \
|
||||
--ignore-install --show-depends --set-version $kernel \
|
||||
< "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" 2>/dev/null \
|
||||
| sort -u \
|
||||
@@ -1373,7 +1421,7 @@ dracut_kernel_post() {
|
||||
|
||||
(
|
||||
if [[ $DRACUT_INSTALL ]] && [[ -z $_moddirname ]]; then
|
||||
xargs -r $DRACUT_INSTALL ${initdir+-D "$initdir"} -a < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
|
||||
xargs -r $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
|
||||
else
|
||||
while read _modpath; do
|
||||
local _destpath=$_modpath
|
||||
@@ -1392,7 +1440,7 @@ dracut_kernel_post() {
|
||||
for _fwdir in $fw_dir; do
|
||||
echo $_fwdir/$line;
|
||||
done;
|
||||
done | xargs -r $DRACUT_INSTALL ${initdir+-D "$initdir"} -a -o
|
||||
done | xargs -r $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a -o
|
||||
else
|
||||
for _fw in $(xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"); do
|
||||
for _fwdir in $fw_dir; do
|
||||
@@ -1428,23 +1476,41 @@ dracut_kernel_post() {
|
||||
[[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && rm -fr -- "$DRACUT_KERNEL_LAZY_HASHDIR"
|
||||
}
|
||||
|
||||
[[ "$kernel_current" ]] || export kernel_current=$(uname -r)
|
||||
|
||||
module_is_host_only() {
|
||||
local _mod=$1
|
||||
local _modenc a i
|
||||
_mod=${_mod##*/}
|
||||
_mod=${_mod%.ko}
|
||||
_modenc=${_mod//-/_}
|
||||
|
||||
[[ " $add_drivers " == *\ ${_mod}\ * ]] && return 0
|
||||
|
||||
# check if module is loaded
|
||||
for i in /sys/module/${_mod//-/_}; do
|
||||
[[ -d $i ]] && return 0
|
||||
done
|
||||
[[ ${host_modules["$_modenc"]} ]] && return 0
|
||||
|
||||
# check if module is loadable on the current kernel
|
||||
# this covers the case, where a new module is introduced
|
||||
# or a module was renamed
|
||||
# or a module changed from builtin to a module
|
||||
modinfo -F filename "$_mod" &>/dev/null || return 0
|
||||
[[ "$kernel_current" ]] || export kernel_current=$(uname -r)
|
||||
|
||||
if [[ "$kernel_current" != "$kernel" ]]; then
|
||||
# check if module is loadable on the current kernel
|
||||
# this covers the case, where a new module is introduced
|
||||
# or a module was renamed
|
||||
# or a module changed from builtin to a module
|
||||
if [[ -d /lib/modules/$kernel_current ]]; then
|
||||
# if the modinfo can be parsed, but the module
|
||||
# is not loaded, then we can safely return 1
|
||||
modinfo -F filename "$_mod" &>/dev/null && return 1
|
||||
fi
|
||||
|
||||
# Finally check all modalias, if we install for a kernel
|
||||
# different from the current one
|
||||
for a in $(modinfo -k $kernel -F alias $_mod 2>/dev/null); do
|
||||
for i in "${!host_modalias[@]}"; do
|
||||
[[ $i == $a ]] && return 0
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
@@ -140,8 +140,16 @@ dlog_init() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( $UID != 0 )); then
|
||||
kmsgloglvl=0
|
||||
sysloglvl=0
|
||||
fi
|
||||
|
||||
if (( $sysloglvl > 0 )); then
|
||||
if [[ -d /run/systemd/journal ]] && type -P systemd-cat &>/dev/null && (( $UID == 0 )) ; then
|
||||
if [[ -d /run/systemd/journal ]] \
|
||||
&& type -P systemd-cat &>/dev/null \
|
||||
&& systemctl --quiet is-active systemd-journald.socket &>/dev/null \
|
||||
&& { echo "dracut-$DRACUT_VERSION" | systemd-cat -t 'dracut' &>/dev/null; } ; then
|
||||
readonly _dlogdir="$(mktemp --tmpdir="$TMPDIR/" -d -t dracut-log.XXXXXX)"
|
||||
readonly _systemdcatfile="$_dlogdir/systemd-cat"
|
||||
mkfifo "$_systemdcatfile"
|
||||
@@ -150,6 +158,7 @@ dlog_init() {
|
||||
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.
|
||||
kmsgloglvl=$sysloglvl
|
||||
sysloglvl=0
|
||||
ret=1
|
||||
errmsg="No '/dev/log' or 'logger' included for syslog logging"
|
||||
|
@@ -269,6 +269,12 @@ example:
|
||||
**--nostrip**::
|
||||
do not strip binaries in the initramfs
|
||||
|
||||
**--prelink**::
|
||||
prelink binaries in the initramfs (default)
|
||||
|
||||
**--noprelink**::
|
||||
do not prelink binaries in the initramfs
|
||||
|
||||
**--hardlink**::
|
||||
hardlink files in the initramfs (default)
|
||||
|
||||
|
17
dracut.asc
17
dracut.asc
@@ -744,6 +744,23 @@ the dracut shell
|
||||
==== Additional dracut boot parameters
|
||||
For more debugging options, see <<dracutkerneldebug>> in <<dracutcmdline7>>.
|
||||
|
||||
|
||||
[[debugging-dracut-on-shutdown]]
|
||||
==== Debugging dracut on shutdown
|
||||
|
||||
To debug the shutdown sequence on systemd systems, you can _rd.break_
|
||||
on _pre-shutdown_ or _shutdown_.
|
||||
|
||||
To do this from an already booted system:
|
||||
----
|
||||
# mkdir -p /run/initramfs/etc/cmdline.d
|
||||
# echo "rd.break=pre-shutdown" > /run/initramfs/etc/cmdline.d/debug.conf
|
||||
# touch /run/initramfs/.need_shutdown
|
||||
----
|
||||
|
||||
This will give you a dracut shell after the system pivot'ed back in the initramfs.
|
||||
|
||||
|
||||
= Developer Manual
|
||||
|
||||
== dracut Components
|
||||
|
@@ -69,6 +69,12 @@ rootfstype=ext3
|
||||
force mounting _/_ and _/usr_ (if it is a separate device) read-write.
|
||||
See also ro option.
|
||||
|
||||
**rootfallback=**_<path to blockdevice>_::
|
||||
specify the block device to use as the root filesystem, if the normal root cannot be found.
|
||||
This can only be a simple block device with a simple file system, for which the filesystem
|
||||
driver is either compiled in, or added manually to the initramfs.
|
||||
This parameter can be specified multiple times.
|
||||
|
||||
**rd.auto** **rd.auto=1**::
|
||||
enable autoassembly of special devices like cryptoLUKS, dmraid, mdraid or lvm.
|
||||
Default is off as of dracut version >= 024.
|
||||
|
@@ -67,6 +67,9 @@ Configuration files must have the extension .conf; other extensions are ignored.
|
||||
*do_strip=*"__{yes|no}__"::
|
||||
Strip binaries in the initramfs (default=yes)
|
||||
|
||||
*do_prelink=*"__{yes|no}__"::
|
||||
Prelink binaries in the initramfs (default=yes)
|
||||
|
||||
*hostonly=*"__{yes|no}__"::
|
||||
Host-Only mode: Install only what is needed for booting the local host
|
||||
instead of a generic host and generate host-specific configuration.
|
||||
@@ -122,6 +125,21 @@ If chrooted to another root other than the real root device, use --fstab and pro
|
||||
*no_kernel=*"{yes|no}"::
|
||||
Do not install kernel drivers and firmware files (default=no)
|
||||
|
||||
*acpi_override=*"{yes|no}"::
|
||||
[WARNING] ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING! +
|
||||
Override BIOS provided ACPI tables. For further documentation read
|
||||
Documentation/acpi/initrd_table_override.txt in the kernel sources.
|
||||
Search for ACPI table files (must have .aml suffix) in acpi_table_dir=
|
||||
directory (see below) and add them to a separate uncompressed cpio
|
||||
archive. This cpio archive gets glued (concatenated, uncompressed one
|
||||
must be the first one) to the compressed cpio archive. The first,
|
||||
uncompressed cpio archive is for data which the kernel must be able
|
||||
to access very early (and cannot make use of uncompress alogrithms yet)
|
||||
like microcode or ACPI tables (default=no).
|
||||
|
||||
*acpi_table_dir=*"__<dir>__"::
|
||||
Directory to search for ACPI tables if acpi_override= is set to yes.
|
||||
|
||||
*early_microcode=*"{yes|no}"::
|
||||
Combine early microcode with ramdisk (default=no)
|
||||
|
||||
|
1550
dracut.css
Normal file
1550
dracut.css
Normal file
File diff suppressed because it is too large
Load Diff
128
dracut.sh
128
dracut.sh
@@ -97,6 +97,8 @@ Creates initial ramdisk images for preloading modules
|
||||
--kernel-cmdline [PARAMETERS] Specify default kernel command line parameters
|
||||
--strip Strip binaries in the initramfs
|
||||
--nostrip Do not strip binaries in the initramfs
|
||||
--prelink Prelink binaries in the initramfs
|
||||
--noprelink Do not prelink binaries in the initramfs
|
||||
--hardlink Hardlink files in the initramfs
|
||||
--nohardlink Do not hardlink files in the initramfs
|
||||
--prefix [DIR] Prefix initramfs files with [DIR]
|
||||
@@ -315,6 +317,8 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \
|
||||
--long kernel-cmdline: \
|
||||
--long strip \
|
||||
--long nostrip \
|
||||
--long prelink \
|
||||
--long noprelink \
|
||||
--long hardlink \
|
||||
--long nohardlink \
|
||||
--long noprefix \
|
||||
@@ -394,6 +398,8 @@ while :; do
|
||||
--no-early-microcode) early_microcode_l="no";;
|
||||
--strip) do_strip_l="yes";;
|
||||
--nostrip) do_strip_l="no";;
|
||||
--prelink) do_prelink_l="yes";;
|
||||
--noprelink) do_prelink_l="no";;
|
||||
--hardlink) do_hardlink_l="yes";;
|
||||
--nohardlink) do_hardlink_l="no";;
|
||||
--noprefix) prefix_l="/";;
|
||||
@@ -651,6 +657,8 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||
[[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
|
||||
[[ $do_strip_l ]] && do_strip=$do_strip_l
|
||||
[[ $do_strip ]] || do_strip=yes
|
||||
[[ $do_prelink_l ]] && do_prelink=$do_prelink_l
|
||||
[[ $do_prelink ]] || do_prelink=yes
|
||||
[[ $do_hardlink_l ]] && do_hardlink=$do_hardlink_l
|
||||
[[ $do_hardlink ]] || do_hardlink=yes
|
||||
[[ $prefix_l ]] && prefix=$prefix_l
|
||||
@@ -696,9 +704,9 @@ readonly initdir="$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)"
|
||||
}
|
||||
|
||||
if [[ $early_microcode = yes ]]; then
|
||||
readonly microcode_dir="$(mktemp --tmpdir="$TMPDIR/" -d -t early_microcode.XXXXXX)"
|
||||
[ -d "$microcode_dir" ] || {
|
||||
printf "%s\n" "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t early_microcode.XXXXXX failed." >&2
|
||||
readonly early_cpio_dir="$(mktemp --tmpdir="$TMPDIR/" -d -t early_cpio.XXXXXX)"
|
||||
[ -d "$early_cpio_dir" ] || {
|
||||
printf "%s\n" "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t early_cpio.XXXXXX failed." >&2
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
@@ -707,7 +715,7 @@ 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"; };
|
||||
[[ $keep ]] && echo "Not removing $early_cpio_dir." >&2 || { [[ $early_cpio_dir ]] && rm -Rf -- "$early_cpio_dir"; };
|
||||
[[ $_dlogdir ]] && rm -Rf -- "$_dlogdir";
|
||||
exit $ret;
|
||||
' EXIT
|
||||
@@ -729,7 +737,7 @@ fi
|
||||
|
||||
if ! [[ $print_cmdline ]]; then
|
||||
inst /bin/sh
|
||||
if ! $DRACUT_INSTALL ${initdir+-D "$initdir"} -R "$initdir/bin/sh" &>/dev/null; then
|
||||
if ! $DRACUT_INSTALL ${initdir:+-D "$initdir"} -R "$initdir/bin/sh" &>/dev/null; then
|
||||
unset DRACUT_RESOLVE_LAZY
|
||||
export DRACUT_RESOLVE_DEPS=1
|
||||
fi
|
||||
@@ -816,23 +824,25 @@ if [[ -d $srcmods ]]; then
|
||||
}
|
||||
fi
|
||||
|
||||
if [[ -f $outfile && ! $force && ! $print_cmdline ]]; then
|
||||
dfatal "Will not override existing initramfs ($outfile) without --force"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! $print_cmdline ]]; then
|
||||
if [[ -f $outfile && ! $force ]]; then
|
||||
dfatal "Will not override existing initramfs ($outfile) without --force"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
outdir=${outfile%/*}
|
||||
[[ $outdir ]] || outdir="/"
|
||||
outdir=${outfile%/*}
|
||||
[[ $outdir ]] || outdir="/"
|
||||
|
||||
if [[ ! -d "$outdir" ]]; then
|
||||
dfatal "Can't write to $outdir: Directory $outdir does not exist or is not accessible."
|
||||
exit 1
|
||||
elif [[ ! -w "$outdir" ]]; then
|
||||
dfatal "No permission to write to $outdir."
|
||||
exit 1
|
||||
elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
|
||||
dfatal "No permission to write $outfile."
|
||||
exit 1
|
||||
if [[ ! -d "$outdir" ]]; then
|
||||
dfatal "Can't write to $outdir: Directory $outdir does not exist or is not accessible."
|
||||
exit 1
|
||||
elif [[ ! -w "$outdir" ]]; then
|
||||
dfatal "No permission to write to $outdir."
|
||||
exit 1
|
||||
elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
|
||||
dfatal "No permission to write $outfile."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Need to be able to have non-root users read stuff (rpcbind etc)
|
||||
@@ -913,8 +923,7 @@ if [[ $hostonly ]]; then
|
||||
[[ $_t != "swap" ]] && continue
|
||||
[[ $_m != "swap" ]] && [[ $_m != "none" ]] && continue
|
||||
[[ "$_o" == *noauto* ]] && continue
|
||||
[[ "$_d" == UUID\=* ]] && _d="/dev/disk/by-uuid/${_d#UUID=}"
|
||||
[[ "$_d" == LABEL\=* ]] && _d="/dev/disk/by-label/$_d#LABEL=}"
|
||||
_d=$(expand_persistent_dev "$_d")
|
||||
[[ "$_d" -ef "$dev" ]] || continue
|
||||
|
||||
if [[ -f /etc/crypttab ]]; then
|
||||
@@ -932,8 +941,29 @@ if [[ $hostonly ]]; then
|
||||
done < /etc/fstab
|
||||
done < /proc/swaps
|
||||
fi
|
||||
# record all host modaliases
|
||||
declare -A host_modalias
|
||||
find /sys/devices/ -name uevent -print > "$initdir/.modalias"
|
||||
while read m; do
|
||||
while read line; do
|
||||
[[ "$line" != MODALIAS\=* ]] && continue
|
||||
modalias="${line##MODALIAS=}" && [[ $modalias ]] && host_modalias["$modalias"]=1
|
||||
break
|
||||
done < "$m"
|
||||
done < "$initdir/.modalias"
|
||||
|
||||
rm -f -- "$initdir/.modalias"
|
||||
|
||||
# check /proc/modules
|
||||
declare -A host_modules
|
||||
while read m rest; do
|
||||
host_modules["$m"]=1
|
||||
done </proc/modules
|
||||
fi
|
||||
|
||||
unset m
|
||||
unset rest
|
||||
|
||||
_get_fs_type() {
|
||||
[[ $1 ]] || return
|
||||
if [[ -b /dev/block/$1 ]] && ID_FS_TYPE=$(get_fs_env "/dev/block/$1"); then
|
||||
@@ -1004,7 +1034,8 @@ export initdir dracutbasedir dracutmodules \
|
||||
stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
|
||||
debug host_fs_types host_devs sshkey add_fstab \
|
||||
DRACUT_VERSION udevdir prefix filesystems drivers \
|
||||
systemdutildir systemdsystemunitdir systemdsystemconfdir
|
||||
systemdutildir systemdsystemunitdir systemdsystemconfdir \
|
||||
host_modalias host_modules
|
||||
|
||||
mods_to_load=""
|
||||
# check all our modules to see if they should be sourced.
|
||||
@@ -1185,7 +1216,7 @@ if [[ $kernel_only != yes ]]; then
|
||||
find "$initdir" -type f \
|
||||
'(' -perm -0100 -or -perm -0010 -or -perm -0001 ')' \
|
||||
-not -path '*.ko' -print0 \
|
||||
| xargs -r -0 $DRACUT_INSTALL ${initdir+-D "$initdir"} -R ${DRACUT_FIPS_MODE+-H} --
|
||||
| xargs -r -0 $DRACUT_INSTALL ${initdir:+-D "$initdir"} -R ${DRACUT_FIPS_MODE:+-H} --
|
||||
dinfo "*** Resolving executable dependencies done***"
|
||||
fi
|
||||
fi
|
||||
@@ -1230,18 +1261,20 @@ if [[ $kernel_only != yes ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
PRELINK_BIN="$(command -v prelink)"
|
||||
if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then
|
||||
if [[ $DRACUT_FIPS_MODE ]]; then
|
||||
dinfo "*** Installing prelink files ***"
|
||||
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache
|
||||
else
|
||||
dinfo "*** Pre-linking files ***"
|
||||
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf
|
||||
chroot "$initdir" "$PRELINK_BIN" -a
|
||||
rm -f -- "$initdir/$PRELINK_BIN"
|
||||
rm -fr -- "$initdir"/etc/prelink.*
|
||||
dinfo "*** Pre-linking files done ***"
|
||||
if [[ $do_prelink == yes ]]; then
|
||||
PRELINK_BIN="$(command -v prelink)"
|
||||
if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then
|
||||
if [[ $DRACUT_FIPS_MODE ]]; then
|
||||
dinfo "*** Installing prelink files ***"
|
||||
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache
|
||||
else
|
||||
dinfo "*** Pre-linking files ***"
|
||||
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf
|
||||
chroot "$initdir" "$PRELINK_BIN" -a
|
||||
rm -f -- "$initdir/$PRELINK_BIN"
|
||||
rm -fr -- "$initdir"/etc/prelink.*
|
||||
dinfo "*** Pre-linking files done ***"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1280,7 +1313,7 @@ if [[ $early_microcode = yes ]]; then
|
||||
dinfo "*** Generating early-microcode cpio image ***"
|
||||
ucode_dir=(amd-ucode intel-ucode)
|
||||
ucode_dest=(AuthenticAMD.bin GenuineIntel.bin)
|
||||
_dest_dir="$microcode_dir/d/kernel/x86/microcode"
|
||||
_dest_dir="$early_cpio_dir/d/kernel/x86/microcode"
|
||||
_dest_idx="0 1"
|
||||
mkdir -p $_dest_dir
|
||||
if [[ $hostonly ]]; then
|
||||
@@ -1295,19 +1328,34 @@ if [[ $early_microcode = yes ]]; then
|
||||
dinfo "*** Constructing ${ucode_dest[$idx]} ****"
|
||||
if [[ $hostonly ]]; then
|
||||
_src=$(get_ucode_file)
|
||||
if ! [[ -r $_fwdir/$_fw/$_src ]];then
|
||||
break;
|
||||
fi
|
||||
fi
|
||||
cat $_fwdir/$_fw/$_src > $_dest_dir/${ucode_dest[$idx]}
|
||||
create_early_cpio="yes"
|
||||
fi
|
||||
done
|
||||
done
|
||||
(cd "$microcode_dir/d"; find . -print0 | cpio --null -o -H newc --quiet >../ucode.cpio)
|
||||
fi
|
||||
|
||||
if [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]]; then
|
||||
dinfo "*** Packaging ACPI tables to override BIOS provided ones ***"
|
||||
_dest_dir="$early_cpio_dir/d/kernel/firmware/acpi"
|
||||
mkdir -p $_dest_dir
|
||||
for table in $acpi_table_dir/*.aml; do
|
||||
dinfo " Adding ACPI table: $table"
|
||||
cp $table $_dest_dir
|
||||
create_early_cpio="yes"
|
||||
done
|
||||
fi
|
||||
|
||||
rm -f -- "$outfile"
|
||||
dinfo "*** Creating image file ***"
|
||||
if [[ $early_microcode = yes ]]; then
|
||||
if [[ $create_early_cpio = yes ]]; then
|
||||
# The microcode blob is _before_ the initramfs blob, not after
|
||||
mv $microcode_dir/ucode.cpio $outfile.$$
|
||||
(cd "$early_cpio_dir/d"; find . -print0 | cpio --null -o -H newc --quiet >../early.cpio)
|
||||
mv $early_cpio_dir/early.cpio $outfile.$$
|
||||
fi
|
||||
if ! ( umask 077; cd "$initdir"; find . -print0 | cpio --null -R 0:0 -H newc -o --quiet| \
|
||||
$compress >> "$outfile.$$"; ); then
|
||||
|
14
dracut.spec
14
dracut.spec
@@ -97,16 +97,14 @@ Requires: util-linux >= 2.21
|
||||
Requires: systemd >= 199
|
||||
Requires: procps-ng
|
||||
Conflicts: grubby < 8.23
|
||||
Conflicts: initscripts < 8.63-1
|
||||
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
|
||||
Conflicts: bcache-tools < 0-0.14.20130909git
|
||||
%else
|
||||
Requires: udev > 166
|
||||
Requires: util-linux-ng >= 2.21
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
Conflicts: initscripts < 8.63-1
|
||||
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
|
||||
%endif
|
||||
|
||||
Conflicts: mdadm < 3.2.6-14
|
||||
|
||||
%description
|
||||
@@ -271,6 +269,10 @@ 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
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
> $RPM_BUILD_ROOT/etc/system-fips
|
||||
%endif
|
||||
|
||||
# create compat symlink
|
||||
mkdir -p $RPM_BUILD_ROOT/sbin
|
||||
ln -s /usr/bin/dracut $RPM_BUILD_ROOT/sbin/dracut
|
||||
@@ -330,7 +332,6 @@ 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
|
||||
@@ -413,6 +414,7 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/modules.d/01fips
|
||||
%{dracutlibdir}/dracut.conf.d/40-fips.conf
|
||||
%config(missingok) /etc/system-fips
|
||||
%endif
|
||||
|
||||
%files fips-aesni
|
||||
|
175
mkinitrd-dracut.sh
Normal file → Executable file
175
mkinitrd-dracut.sh
Normal file → Executable file
@@ -1,6 +1,11 @@
|
||||
#!/bin/bash --norc
|
||||
kver=$(uname -r)
|
||||
|
||||
boot_dir="/boot"
|
||||
quiet=0
|
||||
host_only=0
|
||||
force=0
|
||||
|
||||
error() { echo "$@" >&2; }
|
||||
|
||||
usage () {
|
||||
@@ -24,36 +29,105 @@ read_arg() {
|
||||
# $1 = arg name
|
||||
# $2 = arg value
|
||||
# $3 = arg parameter
|
||||
local rematch='^[^=]*=(.*)$'
|
||||
param="$1"
|
||||
local rematch='^[^=]*=(.*)$' result
|
||||
if [[ $2 =~ $rematch ]]; then
|
||||
read "$1" <<< "${BASH_REMATCH[1]}"
|
||||
elif [[ $3 != -* ]]; then
|
||||
# Only read next arg if it not an arg itself.
|
||||
read "$1" <<< "$3"
|
||||
# There is no way to shift our callers args, so
|
||||
# return 1 to indicate they should do it instead.
|
||||
return 1
|
||||
read "$param" <<< "${BASH_REMATCH[1]}"
|
||||
else
|
||||
for ((i=3; $i <= $#; i++)); do
|
||||
# Only read next arg if it not an arg itself.
|
||||
if [[ ${@:$i:1} = -* ]];then
|
||||
break
|
||||
fi
|
||||
result="$result ${@:$i:1}"
|
||||
# There is no way to shift our callers args, so
|
||||
# return "no of args" to indicate they should do it instead.
|
||||
done
|
||||
read "$1" <<< "$result"
|
||||
return $(($i - 3))
|
||||
fi
|
||||
}
|
||||
|
||||
# Taken over from SUSE mkinitrd
|
||||
default_kernel_images() {
|
||||
local regex kernel_image kernel_version version_version initrd_image
|
||||
local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
|
||||
|
||||
case "$(uname -m)" in
|
||||
s390|s390x)
|
||||
regex='image'
|
||||
;;
|
||||
ppc|ppc64)
|
||||
regex='vmlinux'
|
||||
;;
|
||||
i386|x86_64)
|
||||
regex='vmlinuz'
|
||||
;;
|
||||
arm*)
|
||||
regex='[uz]Image'
|
||||
;;
|
||||
aarch64)
|
||||
regex='Image'
|
||||
;;
|
||||
*) regex='vmlinu.'
|
||||
;;
|
||||
esac
|
||||
|
||||
# user mode linux
|
||||
if grep -q UML /proc/cpuinfo; then
|
||||
regex='linux'
|
||||
fi
|
||||
|
||||
kernel_images=""
|
||||
initrd_images=""
|
||||
for kernel_image in $(ls $boot_dir \
|
||||
| sed -ne "\|^$regex\(-[0-9.]\+-[0-9]\+-[a-z0-9]\+$\)\?|p" \
|
||||
| grep -v kdump$ ) ; do
|
||||
|
||||
# Note that we cannot check the RPM database here -- this
|
||||
# script is itself called from within the binary kernel
|
||||
# packages, and rpm does not allow recursive calls.
|
||||
|
||||
[ -L "$boot_dir/$kernel_image" ] && continue
|
||||
[ "${kernel_image%%.gz}" != "$kernel_image" ] && continue
|
||||
kernel_version=$(/usr/bin/get_kernel_version \
|
||||
$boot_dir/$kernel_image 2> /dev/null)
|
||||
initrd_image=$(echo $kernel_image | sed -e "s|${regex}|initrd|")
|
||||
if [ "$kernel_image" != "$initrd_image" -a \
|
||||
-n "$kernel_version" -a \
|
||||
-d "/lib/modules/$kernel_version" ]; then
|
||||
kernel_images="$kernel_images $boot_dir/$kernel_image"
|
||||
initrd_images="$initrd_images $boot_dir/$initrd_image"
|
||||
fi
|
||||
done
|
||||
for kernel_image in $kernel_images;do
|
||||
kernels="$kernels ${kernel_image#*-}"
|
||||
done
|
||||
for initrd_image in $initrd_images;do
|
||||
targets="$targets $initrd_image"
|
||||
done
|
||||
host_only=1
|
||||
force=1
|
||||
}
|
||||
|
||||
while (($# > 0)); do
|
||||
case ${1%%=*} in
|
||||
--with-usb) read_arg usbmodule "$@" || shift
|
||||
--with-usb) read_arg usbmodule "$@" || shift $?
|
||||
basicmodules="$basicmodules ${usbmodule:-usb-storage}"
|
||||
unset usbmodule;;
|
||||
--with-avail) read_arg modname "$@" || shift
|
||||
--with-avail) read_arg modname "$@" || shift $?
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--with) read_arg modname "$@" || shift
|
||||
--with) read_arg modname "$@" || shift $?
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--version)
|
||||
echo "mkinitrd: dracut compatibility wrapper"
|
||||
exit 0;;
|
||||
-v|--verbose) dracut_args="${dracut_args} -v";;
|
||||
-f|--force) dracut_args="${dracut_args} -f";;
|
||||
--preload) read_arg modname "$@" || shift
|
||||
-f|--force) force=1;;
|
||||
--preload) read_arg modname "$@" || shift $?
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--image-version) img_vers=yes;;
|
||||
--rootfs) read_arg rootfs "$@" || shift
|
||||
--rootfs|-d) read_arg rootfs "$@" || shift $?
|
||||
dracut_args="${dracut_args} --filesystems $rootfs";;
|
||||
--nocompress) dracut_args="$dracut_args --no-compress";;
|
||||
--help) usage -n;;
|
||||
@@ -80,10 +154,31 @@ while (($# > 0)); do
|
||||
--looppath*) ;;
|
||||
--dsdt*) ;;
|
||||
--bootchart) ;;
|
||||
*) if [[ ! $target ]]; then
|
||||
target=$1
|
||||
elif [[ ! $kernel ]]; then
|
||||
kernel=$1
|
||||
-s) ;;
|
||||
--quiet|-q) quiet=1;;
|
||||
-b) read_arg boot_dir "$@" || shift $?
|
||||
if [ ! -d $boot_dir ];then
|
||||
error "Boot directory $boot_dir does not exist"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-k) # Would be nice to get a list of images here
|
||||
read_arg kernel_images "$@" || shift $?
|
||||
for kernel_image in $kernel_images;do
|
||||
kernels="$kernels ${kernel_image#*-}"
|
||||
done
|
||||
host_only=1
|
||||
force=1
|
||||
;;
|
||||
-i) read_arg initrd_images "$@" || shift $?
|
||||
for initrd_image in $initrd_images;do
|
||||
targets="$targets $boot_dir/$initrd_image"
|
||||
done
|
||||
;;
|
||||
*) if [[ ! $targets ]]; then
|
||||
targets=$1
|
||||
elif [[ ! $kernels ]]; then
|
||||
kernels=$1
|
||||
else
|
||||
usage
|
||||
fi;;
|
||||
@@ -91,11 +186,41 @@ while (($# > 0)); do
|
||||
shift
|
||||
done
|
||||
|
||||
[[ $target && $kernel ]] || usage
|
||||
[[ $img_vers ]] && target="$target-$kernel"
|
||||
[[ $targets && $kernels ]] || default_kernel_images
|
||||
[[ $targets && $kernels ]] || (error "No kernel found in $boot_dir" && usage)
|
||||
|
||||
if [[ $basicmodules ]]; then
|
||||
dracut $dracut_args --add-drivers "$basicmodules" "$target" "$kernel"
|
||||
else
|
||||
dracut $dracut_args "$target" "$kernel"
|
||||
fi
|
||||
# We can have several targets/kernels, transform the list to an array
|
||||
targets=( $targets )
|
||||
[[ $kernels ]] && kernels=( $kernels )
|
||||
|
||||
[[ $host_only == 1 ]] && dracut_args="${dracut_args} -H"
|
||||
[[ $force == 1 ]] && dracut_args="${dracut_args} -f"
|
||||
|
||||
echo "Creating: target|kernel|dracut args|basicmodules "
|
||||
for ((i=0 ; $i<${#targets[@]} ; i++)); do
|
||||
|
||||
if [[ $img_vers ]];then
|
||||
target="${targets[$i]}-${kernels[$i]}"
|
||||
else
|
||||
target="${targets[$i]}"
|
||||
fi
|
||||
kernel="${kernels[$i]}"
|
||||
|
||||
# Duplicate code: No way found how to redirect output based on $quiet
|
||||
if [[ $quiet == 1 ]];then
|
||||
echo "$target|$kernel|$dracut_args|$basicmodules"
|
||||
if [[ $basicmodules ]]; then
|
||||
dracut $dracut_args --add-drivers "$basicmodules" "$target" \
|
||||
"$kernel" &>/dev/null
|
||||
else
|
||||
dracut $dracut_args "$target" "$kernel" &>/dev/null
|
||||
fi
|
||||
else
|
||||
if [[ $basicmodules ]]; then
|
||||
dracut $dracut_args --add-drivers "$basicmodules" "$target" \
|
||||
"$kernel"
|
||||
else
|
||||
dracut $dracut_args "$target" "$kernel"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
@@ -4,6 +4,11 @@
|
||||
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
|
||||
for i in setfont loadkeys kbd_mode; do
|
||||
type -P "$i" >/dev/null || return 1
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@@ -42,7 +42,7 @@ setup_interface() {
|
||||
|
||||
# Note: hostname can be fqdn OR short hostname, so chop off any
|
||||
# trailing domain name and explicity add any domain if set.
|
||||
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
}
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
@@ -2,20 +2,24 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# Don't continue if root is ok
|
||||
[ -n "$rootok" ] && return
|
||||
|
||||
# This script is sourced, so root should be set. But let's be paranoid
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
[ -z "$netroot" ] && netroot=$(getarg netroot=)
|
||||
|
||||
if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] ; then
|
||||
if [ -z "$netroot" ]; then
|
||||
for netroot in $(getargs netroot=); do
|
||||
[ "$netroot" = "dhcp" ] && break
|
||||
[ "$netroot" = "dhcp6" ] && break
|
||||
done
|
||||
[ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] || unset netroot
|
||||
fi
|
||||
|
||||
if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ]; then
|
||||
# Tell ip= checker that we need dhcp
|
||||
NEEDDHCP="1"
|
||||
|
||||
# Done, all good!
|
||||
rootok=1
|
||||
if [ "$netroot" != "dhcp" ] ; then
|
||||
if [ "$netroot" != "dhcp" ] && [ "$netroot" != "dhcp6" ]; then
|
||||
netroot=$root
|
||||
fi
|
||||
|
||||
|
@@ -124,10 +124,10 @@ do_static() {
|
||||
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
|
||||
if strstr $ip '*:*:*'; then
|
||||
# note no ip addr flush for ipv6
|
||||
ip addr add $ip/$mask ${srv+peer $srv} dev $netif
|
||||
ip addr add $ip/$mask ${srv:+peer $srv} dev $netif
|
||||
else
|
||||
ip addr flush dev $netif
|
||||
ip addr add $ip/$mask ${srv+peer $srv} brd + dev $netif
|
||||
ip addr add $ip/$mask ${srv:+peer $srv} brd + dev $netif
|
||||
fi
|
||||
|
||||
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
@@ -333,6 +333,19 @@ for p in $(getargs ip=); do
|
||||
;;
|
||||
esac
|
||||
|
||||
break
|
||||
exit 0
|
||||
done
|
||||
|
||||
# netif isn't the top stack? Then we should exit here.
|
||||
# eg. netif is bond0. br0 is on top of it. dhcp br0 is correct but dhcp
|
||||
# bond0 doesn't make sense.
|
||||
if [ -n "$DO_BOND_SETUP" -o -n "$DO_TEAM_SETUP" -o -n "$DO_VLAN_SETUP" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# no ip option directed at our interface?
|
||||
if [ ! -e /tmp/setup_net_${netif}.ok ]; then
|
||||
do_dhcp -4
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
@@ -16,7 +16,6 @@ check() {
|
||||
}
|
||||
|
||||
depends() {
|
||||
[ -d /etc/sysconfig/network-scripts/ ] && echo ifcfg
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -83,6 +82,7 @@ install() {
|
||||
inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"
|
||||
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
|
||||
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
|
||||
inst_hook cmdline 92 "$moddir/parse-ibft.sh"
|
||||
inst_hook cmdline 95 "$moddir/parse-vlan.sh"
|
||||
inst_hook cmdline 96 "$moddir/parse-bond.sh"
|
||||
inst_hook cmdline 96 "$moddir/parse-team.sh"
|
||||
|
@@ -54,23 +54,30 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
ifup='/sbin/ifup $env{INTERFACE}'
|
||||
[ -z "$netroot" ] && ifup="$ifup -m"
|
||||
|
||||
runcmd="RUN+=\"/sbin/initqueue --onetime $ifup\""
|
||||
runcmd="RUN+=\"/sbin/initqueue --name ifup-\$env{INTERFACE} --unique --onetime $ifup\""
|
||||
|
||||
# We have some specific interfaces to handle
|
||||
if [ -n "$IFACES" ]; then
|
||||
echo 'SUBSYSTEM!="net", GOTO="net_end"'
|
||||
echo 'ACTION=="remove", GOTO="net_end"'
|
||||
echo 'ACTION!="add|change|move", GOTO="net_end"'
|
||||
for iface in $IFACES; do
|
||||
case "$iface" in
|
||||
??:??:??:??:??:??) # MAC address
|
||||
cond="ATTR{address}==\"$iface\"" ;;
|
||||
cond="ATTR{address}==\"$iface\""
|
||||
echo "$cond, $runcmd, GOTO=\"net_end\""
|
||||
;;
|
||||
??-??-??-??-??-??) # MAC address in BOOTIF form
|
||||
cond="ATTR{address}==\"$(fix_bootif $iface)\"" ;;
|
||||
cond="ATTR{address}==\"$(fix_bootif $iface)\""
|
||||
echo "$cond, $runcmd, GOTO=\"net_end\""
|
||||
;;
|
||||
*) # an interface name
|
||||
cond="ENV{INTERFACE}==\"$iface\"" ;;
|
||||
cond="ENV{INTERFACE}==\"$iface\""
|
||||
echo "$cond, $runcmd, GOTO=\"net_end\""
|
||||
cond="NAME==\"$iface\""
|
||||
echo "$cond, $runcmd, GOTO=\"net_end\""
|
||||
;;
|
||||
esac
|
||||
# The GOTO prevents us from trying to ifup the same device twice
|
||||
echo "$cond, $runcmd, GOTO=\"net_end\""
|
||||
done
|
||||
echo 'LABEL="net_end"'
|
||||
|
||||
|
@@ -203,11 +203,13 @@ fix_bootif() {
|
||||
}
|
||||
|
||||
ibft_to_cmdline() {
|
||||
local iface="" mac="" dev=""
|
||||
local dhcp="" ip="" gw="" mask="" hostname=""
|
||||
local iface=""
|
||||
modprobe -q iscsi_ibft
|
||||
(
|
||||
for iface in /sys/firmware/ibft/ethernet*; do
|
||||
local mac="" dev=""
|
||||
local dhcp="" ip="" gw="" mask="" hostname=""
|
||||
|
||||
[ -e ${iface}/mac ] || continue
|
||||
mac=$(read a < ${iface}/mac; echo $a)
|
||||
[ -z "$mac" ] && continue
|
||||
@@ -216,10 +218,6 @@ ibft_to_cmdline() {
|
||||
[ -e /tmp/net.${dev}.has_ibft_config ] && continue
|
||||
|
||||
[ -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"
|
||||
@@ -244,11 +242,23 @@ ibft_to_cmdline() {
|
||||
ls -l ${iface} | vinfo
|
||||
fi
|
||||
|
||||
if [ -e ${iface}/vlan ]; then
|
||||
vlan=$(read a < ${iface}/vlan; echo $a)
|
||||
if [ "$vlan" -ne "0" ]; then
|
||||
case "$vlan" in
|
||||
[0-9]*)
|
||||
echo "vlan=$dev.$vlan:$dev"
|
||||
;;
|
||||
*)
|
||||
echo "vlan=$vlan:$dev"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
echo $mac > /tmp/net.${dev}.has_ibft_config
|
||||
done
|
||||
) >> /etc/cmdline.d/40-ibft.conf
|
||||
# reread cmdline
|
||||
unset CMDLINE
|
||||
}
|
||||
|
||||
parse_iscsi_root()
|
||||
|
@@ -51,6 +51,7 @@ if [ -z "$2" ]; then
|
||||
netroot=$new_root_path
|
||||
|
||||
# FIXME!
|
||||
unset rootok
|
||||
for f in $hookdir/cmdline/90*.sh; do
|
||||
[ -f "$f" ] && . "$f";
|
||||
done
|
||||
|
10
modules.d/40network/parse-ibft.sh
Executable file
10
modules.d/40network/parse-ibft.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
command -v getarg >/dev/null || . /lib/dracut-lib.sh
|
||||
command -v ibft_to_cmdline >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
# If ibft is requested, read ibft vals and write ip=XXX cmdline args
|
||||
[ "ibft" = "$(getarg ip=)" ] && ibft_to_cmdline
|
||||
|
@@ -15,7 +15,6 @@
|
||||
#
|
||||
|
||||
command -v getarg >/dev/null || . /lib/dracut-lib.sh
|
||||
command -v ibft_to_cmdline >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
if [ -n "$netroot" ] && [ -z "$(getarg ip=)" ] && [ -z "$(getarg BOOTIF=)" ]; then
|
||||
# No ip= argument(s) for netroot provided, defaulting to DHCP
|
||||
@@ -39,9 +38,6 @@ if [ -n "$NEEDBOOTDEV" ] ; then
|
||||
[ -z "$BOOTDEV" ] && warn "Please supply bootdev argument for multiple ip= lines"
|
||||
fi
|
||||
|
||||
# If ibft is requested, read ibft vals and write ip=XXX cmdline args
|
||||
[ "ibft" = "$(getarg ip=)" ] && ibft_to_cmdline
|
||||
|
||||
# Check ip= lines
|
||||
# XXX Would be nice if we could errorcheck ip addresses here as well
|
||||
for p in $(getargs ip=); do
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
[[ -d /etc/sysconfig/network-scripts ]] && return 0
|
||||
return 255
|
||||
}
|
||||
|
||||
|
@@ -64,7 +64,7 @@ curl_fetch_url() {
|
||||
local url="$1" outloc="$2"
|
||||
echo "$url" > /proc/self/fd/0
|
||||
if [ -n "$outloc" ]; then
|
||||
curl $curl_args --output "$outloc" -- "$url" || return $?
|
||||
curl $curl_args --output - -- "$url" > "$outloc" || return $?
|
||||
else
|
||||
local outdir="$(mkuniqdir /tmp curl_fetch_url)"
|
||||
( cd "$outdir"; curl $curl_args --remote-name "$url" || return $? )
|
||||
|
@@ -32,7 +32,6 @@ fi
|
||||
echo "nameserver=$i"
|
||||
done
|
||||
} > /etc/cmdline.d/80-cms.conf
|
||||
unset CMDLINE
|
||||
|
||||
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
|
||||
IFACES="$IFACES $DEVICE"
|
||||
|
@@ -1,30 +0,0 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
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() {
|
||||
inst_multiple probe-bcache ${udevdir}/bcache-register
|
||||
inst_rules 61-bcache.rules
|
||||
}
|
||||
|
@@ -39,8 +39,7 @@ install() {
|
||||
fi
|
||||
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_script "$moddir/btrfs_timeout.sh" \
|
||||
/usr/lib/dracut/hooks/initqueue/timeout/btrfs_timeout.sh
|
||||
inst_hook initqueue/timeout 10 "$moddir/btrfs_timeout.sh"
|
||||
fi
|
||||
|
||||
inst_multiple -o btrfsck btrfs-zero-log
|
||||
|
@@ -9,8 +9,17 @@ check() {
|
||||
type -P dmraid >/dev/null || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ $fs = *_raid_member ]] && return 0
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
[[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
|
||||
|
||||
DEVPATH=$(get_devpath_block "$dev")
|
||||
|
||||
for holder in "$DEVPATH"/holders/*; do
|
||||
[[ -e "$holder" ]] || continue
|
||||
[[ -e "$holder/dm" ]] && return 0
|
||||
break
|
||||
done
|
||||
|
||||
done
|
||||
return 255
|
||||
}
|
||||
@@ -31,16 +40,7 @@ cmdline() {
|
||||
local holder DEVPATH DM_NAME majmin
|
||||
[[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
|
||||
|
||||
majmin=$(get_maj_min $dev)
|
||||
DEVPATH=$(
|
||||
for i in /sys/block/*; do
|
||||
[[ -e "$i/dev" ]] || continue
|
||||
if [[ $a == $(<"$i/dev") ]]; then
|
||||
printf "%s" "$i"
|
||||
break
|
||||
fi
|
||||
done
|
||||
)
|
||||
DEVPATH=$(get_devpath_block "$dev")
|
||||
|
||||
for holder in "$DEVPATH"/holders/*; do
|
||||
[[ -e "$holder" ]] || continue
|
||||
|
@@ -7,12 +7,16 @@ if ! getargbool 1 rd.dm -d -n rd_NO_DM || getarg "rd.dm=0" -d nodmraid; then
|
||||
udevproperty rd_NO_DM=1
|
||||
fi
|
||||
|
||||
if ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.imsm -d -n rd_NO_MDIMSM -n noiswmd; then
|
||||
if ! command -v mdadm >/dev/null \
|
||||
|| ! getargbool 1 rd.md.imsm -d -n rd_NO_MDIMSM -n noiswmd \
|
||||
|| ! getargbool 1 rd.md -d -n rd_NO_MD; then
|
||||
info "rd.md.imsm=0: no MD RAID for imsm/isw raids"
|
||||
udevproperty rd_NO_MDIMSM=1
|
||||
fi
|
||||
|
||||
if ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF -n noddfmd; then
|
||||
if ! command -v mdadm >/dev/null \
|
||||
|| ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF -n noddfmd \
|
||||
|| ! getargbool 1 rd.md -d -n rd_NO_MD; then
|
||||
info "rd.md.ddf=0: no MD RAID for SNIA ddf raids"
|
||||
udevproperty rd_NO_MDDDF=1
|
||||
fi
|
||||
|
@@ -57,7 +57,7 @@ det_img_fs() {
|
||||
}
|
||||
|
||||
modprobe squashfs
|
||||
|
||||
CMDLINE=$(getcmdline)
|
||||
for arg in $CMDLINE; do case $arg in ro|rw) liverw=$arg ;; esac; done
|
||||
# mount the backing of the live image first
|
||||
mkdir -m 0755 -p /run/initramfs/live
|
||||
|
@@ -10,7 +10,7 @@ isofile=$1
|
||||
|
||||
[ -z "$isofile" ] && exit 1
|
||||
|
||||
ismounted "/run/initramfs/isoscan" && exit 1
|
||||
ismounted "/run/initramfs/isoscan" && exit 0
|
||||
|
||||
mkdir -p "/run/initramfs/isoscan"
|
||||
|
||||
|
@@ -7,8 +7,5 @@
|
||||
isofile=$(getarg iso-scan/filename)
|
||||
|
||||
if [ -n "$isofile" ]; then
|
||||
{
|
||||
printf 'KERNEL=="loop0", RUN+="/sbin/initqueue --settled --unique /sbin/iso-scan %s"\n' \
|
||||
"'${isofile}'"
|
||||
} >> /etc/udev/rules.d/99-isofile-mount.rules
|
||||
/sbin/initqueue --settled --unique /sbin/iso-scan "$isofile"
|
||||
fi
|
||||
|
@@ -11,7 +11,6 @@ if [ -n "$updates" ]; then
|
||||
# make sure network comes up even if we're doing a local live device
|
||||
if [ -z "$netroot" ]; then
|
||||
echo > /tmp/net.ifaces
|
||||
unset CMDLINE
|
||||
fi
|
||||
echo "$updates" > /tmp/liveupdates.info
|
||||
echo '[ -e /tmp/liveupdates.done ]' > \
|
||||
|
@@ -82,7 +82,7 @@ install() {
|
||||
} > "${initdir}/etc/lvm/lvm.conf"
|
||||
fi
|
||||
|
||||
inst_rules 11-dm-lvm.rules
|
||||
inst_rules 11-dm-lvm.rules 69-dm-lvm-metad.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
|
||||
|
@@ -20,4 +20,5 @@ IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
|
||||
IMPORT BLKID
|
||||
OPTIONS+="link_priority=100"
|
||||
OPTIONS+="watch"
|
||||
OPTIONS+="db_persist"
|
||||
LABEL="md_end"
|
||||
|
@@ -8,8 +8,17 @@ check() {
|
||||
type -P mdadm >/dev/null || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ "$fs" == *_raid_member ]] && return 0
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
[[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
|
||||
|
||||
DEVPATH=$(get_devpath_block "$dev")
|
||||
|
||||
for holder in "$DEVPATH"/holders/*; do
|
||||
[[ -e "$holder" ]] || continue
|
||||
[[ -e "$holder/md" ]] && return 0
|
||||
break
|
||||
done
|
||||
|
||||
done
|
||||
return 255
|
||||
}
|
||||
@@ -50,6 +59,7 @@ cmdline() {
|
||||
}
|
||||
|
||||
install() {
|
||||
local rule rule_path
|
||||
inst_multiple cat
|
||||
inst_multiple -o mdmon
|
||||
inst $(command -v partx) /sbin/partx
|
||||
@@ -58,12 +68,20 @@ install() {
|
||||
cmdline >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
||||
|
||||
# <mdadm-3.3 udev rule
|
||||
inst_rules 64-md-raid.rules
|
||||
# >=mdadm-3.3 udev rules
|
||||
inst_rules 63-md-raid-arrays.rules 64-md-raid-assembly.rules
|
||||
# remove incremental assembly from stock rules, so they don't shadow
|
||||
# 65-md-inc*.rules and its fine-grained controls, or cause other problems
|
||||
# when we explicitly don't want certain components to be incrementally
|
||||
# assembled
|
||||
sed -i -r -e '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode)"/d' "${initdir}${udevdir}/rules.d/64-md-raid.rules"
|
||||
for rule in 64-md-raid.rules 64-md-raid-assembly.rules; do
|
||||
rule_path="${initdir}${udevdir}/rules.d/${rule}"
|
||||
[ -f "${rule_path}" ] && sed -i -r \
|
||||
-e '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode|\$devnode)/d' \
|
||||
"${rule_path}"
|
||||
done
|
||||
|
||||
inst_rules "$moddir/65-md-incremental-imsm.rules"
|
||||
|
||||
@@ -84,6 +102,14 @@ install() {
|
||||
else
|
||||
[ -f /etc/mdadm/mdadm.conf ] && inst /etc/mdadm/mdadm.conf /etc/mdadm.conf
|
||||
fi
|
||||
if [ -d /etc/mdadm.conf.d ]; then
|
||||
local f
|
||||
inst_dir /etc/mdadm.conf.d
|
||||
for f in /etc/mdadm.conf.d/*.conf; do
|
||||
[ -f "$f" ] || continue
|
||||
inst "$f"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
inst_hook pre-udev 30 "$moddir/mdmon-pre-udev.sh"
|
||||
|
@@ -14,22 +14,20 @@
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
. /lib/cifs-lib.sh
|
||||
|
||||
#Don't continue if root is ok
|
||||
[ -n "$rootok" ] && return
|
||||
|
||||
# This script is sourced, so root should be set. But let's be paranoid
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
[ -z "$netroot" ] && netroot=$(getarg netroot=)
|
||||
|
||||
if [ -z "$netroot" ]; then
|
||||
for netroot in $(getargs netroot=); do
|
||||
[ "${netroot%%:*}" = "cifs" ] && break
|
||||
done
|
||||
[ "${netroot%%:*}" = "cifs" ] || unset netroot
|
||||
fi
|
||||
|
||||
# Root takes precedence over netroot
|
||||
if [ "${root%%:*}" = "cifs" ] ; then
|
||||
|
||||
# Don't continue if root is ok
|
||||
[ -n "$rootok" ] && return
|
||||
|
||||
if [ -n "$netroot" ] ; then
|
||||
warn "root takes precedence over netroot. Ignoring netroot"
|
||||
|
||||
fi
|
||||
netroot=$root
|
||||
unset root
|
||||
|
@@ -32,6 +32,7 @@ install() {
|
||||
inst "$moddir/fcoe-up.sh" "/sbin/fcoe-up"
|
||||
inst "$moddir/fcoe-edd.sh" "/sbin/fcoe-edd"
|
||||
inst "$moddir/fcoe-genrules.sh" "/sbin/fcoe-genrules.sh"
|
||||
inst_hook cmdline 20 "$moddir/parse-uefifcoe.sh"
|
||||
inst_hook cmdline 99 "$moddir/parse-fcoe.sh"
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
35
modules.d/95fcoe/parse-uefifcoe.sh
Executable file
35
modules.d/95fcoe/parse-uefifcoe.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
command -v getarg >/dev/null || . /lib/dracut-lib.sh
|
||||
command -v get_fcoe_boot_mac >/dev/null || . /lib/uefi-lib.sh
|
||||
command -v set_ifname >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
print_fcoe_uefi_conf()
|
||||
{
|
||||
local mac dev vlan
|
||||
mac=$(get_fcoe_boot_mac)
|
||||
[ -z "$mac" ] && continue
|
||||
dev=$(set_ifname fcoe $mac)
|
||||
vlan=$(get_fcoe_boot_vlan)
|
||||
if [ "$vlan" -ne "0" ]; then
|
||||
case "$vlan" in
|
||||
[0-9]*)
|
||||
printf "%s\n" "vlan=$dev.$vlan:$dev"
|
||||
dev="$dev.$vlan"
|
||||
;;
|
||||
*)
|
||||
printf "%s\n" "vlan=$vlan:$dev"
|
||||
dev="$vlan"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
# fcoe=eth0:nodcb
|
||||
printf "%s\n" "$dev:nodcb"
|
||||
}
|
||||
|
||||
|
||||
if [ -e /sys/firmware/efi/vars/FcoeBootDevice-a0ebca23-5f9c-447a-a268-22b6c158c2ac/data ]; then
|
||||
print_fcoe_uefi_conf > /etc/cmdline.d/40-fcoe-uefi.conf
|
||||
fi
|
@@ -96,7 +96,7 @@ handle_netroot()
|
||||
# XXX is this needed?
|
||||
getarg ro && iscsirw=ro
|
||||
getarg rw && iscsirw=rw
|
||||
fsopts=${fsopts+$fsopts,}${iscsirw}
|
||||
fsopts=${fsopts:+$fsopts,}${iscsirw}
|
||||
|
||||
if [ -z $iscsi_initiator ]; then
|
||||
# XXX Where are these from?
|
||||
@@ -155,12 +155,12 @@ handle_netroot()
|
||||
iscsistart -i $iscsi_initiator -t $iscsi_target_name \
|
||||
-g $iscsi_target_group -a $iscsi_target_ip \
|
||||
-p $iscsi_target_port \
|
||||
${iscsi_username+-u $iscsi_username} \
|
||||
${iscsi_password+-w $iscsi_password} \
|
||||
${iscsi_in_username+-U $iscsi_in_username} \
|
||||
${iscsi_in_password+-W $iscsi_in_password} \
|
||||
${iscsi_iface_name+--param iface.iscsi_ifacename=$iscsi_iface_name} \
|
||||
${iscsi_netdev_name+--param iface.net_ifacename=$iscsi_netdev_name} \
|
||||
${iscsi_username:+-u $iscsi_username} \
|
||||
${iscsi_password:+-w $iscsi_password} \
|
||||
${iscsi_in_username:+-U $iscsi_in_username} \
|
||||
${iscsi_in_password:+-W $iscsi_in_password} \
|
||||
${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \
|
||||
${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \
|
||||
${iscsi_param} \
|
||||
|| :
|
||||
|
||||
|
@@ -13,12 +13,14 @@
|
||||
# root= takes precedence over netroot= if root=iscsi[...]
|
||||
#
|
||||
|
||||
# Don't continue if root is ok
|
||||
[ -n "$rootok" ] && return
|
||||
|
||||
# This script is sourced, so root should be set. But let's be paranoid
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
[ -z "$netroot" ] && netroot=$(getarg netroot=)
|
||||
if [ -z "$netroot" ]; then
|
||||
for netroot in $(getargs netroot=); do
|
||||
[ "${netroot%%:*}" = "iscsi" ] && break
|
||||
done
|
||||
[ "${netroot%%:*}" = "iscsi" ] || unset netroot
|
||||
fi
|
||||
[ -z "$iscsiroot" ] && iscsiroot=$(getarg iscsiroot=)
|
||||
[ -z "$iscsi_firmware" ] && getargbool 0 rd.iscsi.firmware -y iscsi_firmware && iscsi_firmware="1"
|
||||
|
||||
|
@@ -76,12 +76,12 @@ while [ -n "$nbdflags" ]; do
|
||||
nbdrw=$f
|
||||
continue
|
||||
fi
|
||||
fsopts=${fsopts+$fsopts,}$f
|
||||
fsopts=${fsopts:+$fsopts,}$f
|
||||
done
|
||||
|
||||
getarg ro && nbdrw=ro
|
||||
getarg rw && nbdrw=rw
|
||||
fsopts=${fsopts+$fsopts,}${nbdrw}
|
||||
fsopts=${fsopts:+$fsopts,}${nbdrw}
|
||||
|
||||
# XXX better way to wait for the device to be made?
|
||||
i=0
|
||||
|
@@ -26,14 +26,16 @@ netroot_to_var() {
|
||||
|
||||
# This script is sourced, so root should be set. But let's be paranoid
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
[ -z "$netroot" ] && netroot=$(getarg netroot=)
|
||||
|
||||
if [ -z "$netroot" ]; then
|
||||
for netroot in $(getargs netroot=); do
|
||||
[ "${netroot%%:*}" = "nbd" ] && break
|
||||
done
|
||||
[ "${netroot%%:*}" = "nbd" ] || unset netroot
|
||||
fi
|
||||
|
||||
# Root takes precedence over netroot
|
||||
if [ "${root%%:*}" = "nbd" ] ; then
|
||||
|
||||
# Don't continue if root is ok
|
||||
[ -n "$rootok" ] && return
|
||||
|
||||
if [ -n "$netroot" ] ; then
|
||||
warn "root takes precedence over netroot. Ignoring netroot"
|
||||
|
||||
|
@@ -128,7 +128,7 @@ mount_nfs() {
|
||||
nfs_to_var $nfsroot $netif
|
||||
munge_nfs_options
|
||||
if [ "$nfs" = "nfs4" ]; then
|
||||
options=$options${nfslock+,$nfslock}
|
||||
options=$options${nfslock:+,$nfslock}
|
||||
else
|
||||
# NFSv{2,3} doesn't support using locks as it requires a helper to
|
||||
# transfer the rpcbind state to the new root
|
||||
|
@@ -24,9 +24,9 @@ if incol2 /proc/mounts /var/lib/nfs/rpc_pipefs; then
|
||||
if [ -d $NEWROOT/$rpcpipefspath ]; then
|
||||
# mount --move does not seem to work???
|
||||
mount --bind /var/lib/nfs/rpc_pipefs $NEWROOT/$rpcpipefspath
|
||||
umount /var/lib/nfs/rpc_pipefs
|
||||
umount /var/lib/nfs/rpc_pipefs 2>/dev/null
|
||||
else
|
||||
umount /var/lib/nfs/rpc_pipefs
|
||||
umount /var/lib/nfs/rpc_pipefs 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@@ -27,18 +27,19 @@
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
#Don't continue if root is ok
|
||||
[ -n "$rootok" ] && return
|
||||
|
||||
# This script is sourced, so root should be set. But let's be paranoid
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
[ -z "$netroot" ] && netroot=$(getarg netroot=)
|
||||
[ -z "$nfsroot" ] && nfsroot=$(getarg nfsroot=)
|
||||
|
||||
[ -n "$netroot" ] && oldnetroot="$netroot"
|
||||
|
||||
# netroot= cmdline argument must be ignored, but must be used if
|
||||
# we're inside netroot to parse dhcp root-path
|
||||
if [ -n "$netroot" ] ; then
|
||||
if [ "$netroot" = "$(getarg netroot=)" ] ; then
|
||||
for n in $(getargs netroot=); do
|
||||
[ "$n" = "$netroot" ] && break
|
||||
done
|
||||
if [ "$n" = "$netroot" ]; then
|
||||
warn "Ignoring netroot argument for NFS"
|
||||
netroot=$root
|
||||
fi
|
||||
@@ -67,7 +68,14 @@ esac
|
||||
# Continue if nfs
|
||||
case "${netroot%%:*}" in
|
||||
nfs|nfs4|/dev/nfs);;
|
||||
*) unset netroot; return;;
|
||||
*)
|
||||
if [ -n "$oldnetroot" ]; then
|
||||
netroot="$oldnetroot"
|
||||
else
|
||||
unset netroot
|
||||
fi
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
# Check required arguments
|
||||
|
@@ -17,7 +17,7 @@ check() {
|
||||
install() {
|
||||
local _bin
|
||||
# Optional uswsusp support
|
||||
for _bin in /usr/sbin/resume /usr/lib/suspend/resume
|
||||
for _bin in /usr/sbin/resume /usr/lib/suspend/resume /usr/lib/uswsusp/resume
|
||||
do
|
||||
[[ -x "${_bin}" ]] && {
|
||||
inst "${_bin}" /usr/sbin/resume
|
||||
|
@@ -44,5 +44,6 @@ install() {
|
||||
inst_hook pre-udev 30 "$moddir/block-genrules.sh"
|
||||
inst_hook mount 99 "$moddir/mount-root.sh"
|
||||
fi
|
||||
}
|
||||
|
||||
inst_hook initqueue/timeout 99 "$moddir/rootfallback.sh"
|
||||
}
|
||||
|
46
modules.d/95rootfs-block/rootfallback.sh
Executable file
46
modules.d/95rootfs-block/rootfallback.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
for root in $(getargs rootfallback=); do
|
||||
case "$root" in
|
||||
block:LABEL=*|LABEL=*)
|
||||
root="${root#block:}"
|
||||
root="$(echo $root | sed 's,/,\\x2f,g')"
|
||||
root="/dev/disk/by-label/${root#LABEL=}"
|
||||
;;
|
||||
block:UUID=*|UUID=*)
|
||||
root="${root#block:}"
|
||||
root="${root#UUID=}"
|
||||
root="$(echo $root | tr "[:upper:]" "[:lower:]")"
|
||||
root="/dev/disk/by-uuid/${root#UUID=}"
|
||||
;;
|
||||
block:PARTUUID=*|PARTUUID=*)
|
||||
root="${root#block:}"
|
||||
root="${root#PARTUUID=}"
|
||||
root="$(echo $root | tr "[:upper:]" "[:lower:]")"
|
||||
root="/dev/disk/by-partuuid/${root}"
|
||||
;;
|
||||
block:PARTLABEL=*|PARTLABEL=*)
|
||||
root="${root#block:}"
|
||||
root="/dev/disk/by-partlabel/${root#PARTLABEL=}"
|
||||
;;
|
||||
esac
|
||||
|
||||
if ! [ -b "$root" ]; then
|
||||
warn "Could not find rootfallback $root"
|
||||
continue
|
||||
fi
|
||||
|
||||
if mount "$root" /sysroot; then
|
||||
info "Mounted rootfallback $root"
|
||||
exit 0
|
||||
else
|
||||
warn "Failed to mount rootfallback $root"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
[ -e "$job" ] && rm -f "$job"
|
@@ -99,28 +99,29 @@ killall_proc_mountpoint() {
|
||||
done
|
||||
}
|
||||
|
||||
_getcmdline() {
|
||||
getcmdline() {
|
||||
local _line
|
||||
local _i
|
||||
local CMDLINE_ETC_D
|
||||
local CMDLINE_ETC
|
||||
unset _line
|
||||
if [ -z "$CMDLINE" ]; then
|
||||
unset CMDLINE_ETC CMDLINE_ETC_D
|
||||
if [ -e /etc/cmdline ]; then
|
||||
while read -r _line; do
|
||||
CMDLINE_ETC="$CMDLINE_ETC $_line";
|
||||
done </etc/cmdline;
|
||||
fi
|
||||
for _i in /etc/cmdline.d/*.conf; do
|
||||
[ -e "$_i" ] || continue
|
||||
while read -r _line; do
|
||||
CMDLINE_ETC_D="$CMDLINE_ETC_D $_line";
|
||||
done <"$_i";
|
||||
done
|
||||
if [ -e /proc/cmdline ]; then
|
||||
read -r CMDLINE </proc/cmdline;
|
||||
CMDLINE="$CMDLINE_ETC_D $CMDLINE_ETC $CMDLINE"
|
||||
fi
|
||||
|
||||
if [ -e /etc/cmdline ]; then
|
||||
while read -r _line; do
|
||||
CMDLINE_ETC="$CMDLINE_ETC $_line";
|
||||
done </etc/cmdline;
|
||||
fi
|
||||
for _i in /etc/cmdline.d/*.conf; do
|
||||
[ -e "$_i" ] || continue
|
||||
while read -r _line; do
|
||||
CMDLINE_ETC_D="$CMDLINE_ETC_D $_line";
|
||||
done <"$_i";
|
||||
done
|
||||
if [ -e /proc/cmdline ]; then
|
||||
read -r CMDLINE </proc/cmdline;
|
||||
CMDLINE="$CMDLINE_ETC_D $CMDLINE_ETC $CMDLINE"
|
||||
fi
|
||||
printf "%s" "$CMDLINE"
|
||||
}
|
||||
|
||||
_dogetarg() {
|
||||
@@ -128,7 +129,7 @@ _dogetarg() {
|
||||
unset _val
|
||||
unset _o
|
||||
unset _doecho
|
||||
_getcmdline
|
||||
CMDLINE=$(getcmdline)
|
||||
|
||||
for _o in $CMDLINE; do
|
||||
if [ "${_o%%=*}" = "${1%%=*}" ]; then
|
||||
@@ -259,7 +260,7 @@ _dogetargs() {
|
||||
local _o _found _key
|
||||
unset _o
|
||||
unset _found
|
||||
_getcmdline
|
||||
CMDLINE=$(getcmdline)
|
||||
_key="$1"
|
||||
set --
|
||||
for _o in $CMDLINE; do
|
||||
|
@@ -42,6 +42,7 @@ install() {
|
||||
mkdir -p ${initdir}/tmp
|
||||
|
||||
inst_simple "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh"
|
||||
inst_simple "$moddir/uefi-lib.sh" "/lib/uefi-lib.sh"
|
||||
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_multiple switch_root || dfatal "Failed to install switch_root"
|
||||
|
155
modules.d/99base/uefi-lib.sh
Executable file
155
modules.d/99base/uefi-lib.sh
Executable file
@@ -0,0 +1,155 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Copyright 2013 Red Hat, Inc. All rights reserved.
|
||||
# Copyright 2013 Harald Hoyer <harald@redhat.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
getbyte () {
|
||||
local IFS= LC_CTYPE=C res c
|
||||
read -r -n 1 -d '' c
|
||||
res=$?
|
||||
# the single quote in the argument of the printf
|
||||
# yields the numeric value of $c (ASCII since LC_CTYPE=C)
|
||||
[[ -n $c ]] && c=$(printf '%u' "'$c") || c=0
|
||||
printf "$c"
|
||||
return $res
|
||||
}
|
||||
|
||||
getword () {
|
||||
local b1 b2 val
|
||||
b1=$(getbyte) || return 1
|
||||
b2=$(getbyte) || return 1
|
||||
(( val = b2 * 256 + b1 ))
|
||||
echo $val
|
||||
return 0
|
||||
}
|
||||
|
||||
# Acpi(PNP0A08,0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)/MAC(90E2BA265ED4,0x0)/Vlan(172)/Fibre(0x4EA06104A0CC0050,0x0)
|
||||
uefi_device_path()
|
||||
{
|
||||
local IFS= LC_CTYPE=C res tt len type hextype first
|
||||
first=1
|
||||
|
||||
while :; do
|
||||
type=$(getbyte) || return 1
|
||||
subtype=$(getbyte) || return 1
|
||||
len=$(getword) || return 1
|
||||
hextype=$(printf "%02x%02x" "$type" "$subtype")
|
||||
if [[ $first == 1 ]]; then
|
||||
first=0
|
||||
elif [[ $hextype != "7fff" ]]; then
|
||||
printf "/"
|
||||
fi
|
||||
case $hextype in
|
||||
0101)
|
||||
# PCI
|
||||
tt=$(getword)
|
||||
printf "PCI(0x%x,0x%x)" $(($tt / 256)) $(($tt & 255))
|
||||
;;
|
||||
0201)
|
||||
# ACPI
|
||||
printf "Acpi(0x%x,0x%x)" $(($(getword) + $(getword) * 65536)) $(($(getword) + $(getword) * 65536))
|
||||
;;
|
||||
0303)
|
||||
# FIBRE
|
||||
getword &>/dev/null
|
||||
getword &>/dev/null
|
||||
printf "Fibre(0x%x%x%x%x%x%x%x%x,0x%x)" \
|
||||
$(getbyte) $(getbyte) $(getbyte) $(getbyte) \
|
||||
$(getbyte) $(getbyte) $(getbyte) $(getbyte) \
|
||||
$(( $(getword) + $(getword) * 65536 + 4294967296 * ( $(getword) + $(getword) * 65536 ) ))
|
||||
;;
|
||||
030b)
|
||||
# MAC
|
||||
printf "MAC(%02x%02x%02x%02x%02x%02x," $(getbyte) $(getbyte) $(getbyte) $(getbyte) $(getbyte) $(getbyte)
|
||||
read -r -N 26 tt || return 1
|
||||
printf "0x%x)" $(getbyte)
|
||||
;;
|
||||
0314)
|
||||
# VLAN
|
||||
printf "VLAN(%d)" $(getword)
|
||||
;;
|
||||
7fff)
|
||||
# END
|
||||
printf "\n"
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
printf "Unknown(Type:%d SubType:%d len=%d)" "$type" "$subtype" "$len"
|
||||
read -r -N $(($len-4)) tt || return 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
get_fcoe_boot_mac()
|
||||
{
|
||||
data=${1:-/sys/firmware/efi/vars/FcoeBootDevice-a0ebca23-5f9c-447a-a268-22b6c158c2ac/data}
|
||||
[ -f $data ] || return 1
|
||||
local IFS= LC_CTYPE=C tt len type hextype
|
||||
first=1
|
||||
|
||||
while :; do
|
||||
type=$(getbyte) || return 1
|
||||
subtype=$(getbyte) || return 1
|
||||
len=$(getword) || return 1
|
||||
hextype=$(printf "%02x%02x" "$type" "$subtype")
|
||||
case $hextype in
|
||||
030b)
|
||||
# MAC
|
||||
printf "%02x:%02x:%02x:%02x:%02x:%02x" $(getbyte) $(getbyte) $(getbyte) $(getbyte) $(getbyte) $(getbyte)
|
||||
read -r -N 27 tt || return 1
|
||||
;;
|
||||
7fff)
|
||||
# END
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
read -r -N $(($len-4)) tt || return 1
|
||||
;;
|
||||
esac
|
||||
done < $data
|
||||
}
|
||||
|
||||
get_fcoe_boot_vlan()
|
||||
{
|
||||
data=${1:-/sys/firmware/efi/vars/FcoeBootDevice-a0ebca23-5f9c-447a-a268-22b6c158c2ac/data}
|
||||
[ -f $data ] || return 1
|
||||
local IFS= LC_CTYPE=C tt len type hextype
|
||||
first=1
|
||||
|
||||
while :; do
|
||||
type=$(getbyte) || return 1
|
||||
subtype=$(getbyte) || return 1
|
||||
len=$(getword) || return 1
|
||||
hextype=$(printf "%02x%02x" "$type" "$subtype")
|
||||
case $hextype in
|
||||
0314)
|
||||
# VLAN
|
||||
printf "%d" $(getword)
|
||||
;;
|
||||
7fff)
|
||||
# END
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
read -r -N $(($len-4)) tt || return 1
|
||||
;;
|
||||
esac
|
||||
done < $data
|
||||
}
|
@@ -226,6 +226,8 @@ write_fs_tab() {
|
||||
fi
|
||||
|
||||
_rw=0
|
||||
|
||||
CMDLINE=$(getcmdline)
|
||||
for _o in $CMDLINE; do
|
||||
case $_o in
|
||||
rw)
|
||||
|
@@ -82,7 +82,7 @@ test_setup() {
|
||||
inst "$basedir/modules.d/40network/ifup.sh" "/sbin/ifup"
|
||||
inst_multiple grep
|
||||
inst_simple ./fstab /etc/fstab
|
||||
rpm -ql systemd | xargs -r $DRACUT_INSTALL ${initdir+-D "$initdir"} -o -a -l
|
||||
rpm -ql systemd | xargs -r $DRACUT_INSTALL ${initdir:+-D "$initdir"} -o -a -l
|
||||
inst /lib/systemd/system/systemd-remount-fs.service
|
||||
inst /lib/systemd/systemd-remount-fs
|
||||
inst /lib/systemd/system/systemd-journal-flush.service
|
||||
|
@@ -12,7 +12,10 @@ for i in /run/initramfs/net.*.did-setup; do
|
||||
i=${i%.did-setup}
|
||||
IFACES+="${i##*/net.} "
|
||||
done
|
||||
echo "OK $IFACES" > /dev/sda
|
||||
{
|
||||
echo "OK"
|
||||
echo "$IFACES"
|
||||
} > /dev/sda
|
||||
|
||||
strstr "$CMDLINE" "rd.shell" && sh -i
|
||||
poweroff -f
|
||||
|
@@ -20,7 +20,7 @@ run_server() {
|
||||
-display none \
|
||||
-net socket,listen=127.0.0.1:12350 \
|
||||
-net nic,macaddr=52:54:01:12:34:56,model=e1000 \
|
||||
${SERIAL+-serial "$SERIAL"} \
|
||||
${SERIAL:+-serial "$SERIAL"} \
|
||||
-watchdog i6300esb -watchdog-action poweroff \
|
||||
-kernel /boot/vmlinuz-"$KVERSION" \
|
||||
-append "loglevel=7 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0" \
|
||||
@@ -61,15 +61,24 @@ client_test() {
|
||||
-append "$cmdline $DEBUGFAIL rd.retry=5 ro console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.debug systemd.log_target=console loglevel=7" \
|
||||
-initrd "$TESTDIR"/initramfs.testing
|
||||
|
||||
if [[ $? -ne 0 ]] || ! grep -F -m 1 -q OK -- "$TESTDIR"/client.img; then
|
||||
{ read OK; read IFACES; } < "$TESTDIR"/client.img
|
||||
|
||||
if [[ "$OK" != "OK" ]]; then
|
||||
echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
|
||||
return 1
|
||||
fi
|
||||
|
||||
for i in $check; do
|
||||
if [[ " $IFACES " != *\ $i\ * ]]; then
|
||||
echo "$i not in '$IFACES'"
|
||||
echo "CLIENT TEST END: $test_name [FAILED - BAD IF]"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
for i in $check ; do
|
||||
echo $i
|
||||
if ! grep -F -m 1 -q $i -- "$TESTDIR"/client.img; then
|
||||
for i in $IFACES; do
|
||||
if [[ " $check " != *\ $i\ * ]]; then
|
||||
echo "$i in '$IFACES', but should not be"
|
||||
echo "CLIENT TEST END: $test_name [FAILED - BAD IF]"
|
||||
return 1
|
||||
fi
|
||||
@@ -99,6 +108,11 @@ test_client() {
|
||||
"root=nfs:192.168.50.1:/nfs/client BOOTIF=52-54-00-12-34-00" \
|
||||
"ens3" || return 1
|
||||
|
||||
client_test "MULTINIC root=nfs BOOTIF= ip=ens4:dhcp" \
|
||||
00 01 02 \
|
||||
"root=nfs:192.168.50.1:/nfs/client BOOTIF=52-54-00-12-34-00 ip=ens4:dhcp" \
|
||||
"ens3 ens4" || return 1
|
||||
|
||||
# PXE Style BOOTIF= with dhcp root-path
|
||||
client_test "MULTINIC root=dhcp BOOTIF=" \
|
||||
00 01 02 \
|
||||
|
Reference in New Issue
Block a user