Compare commits
144 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7b9bbc2a82 | ||
![]() |
994a6cdd88 | ||
![]() |
3674e2e16f | ||
![]() |
436052a84b | ||
![]() |
784c92876b | ||
![]() |
fb008ce665 | ||
![]() |
02d0d0a208 | ||
![]() |
5ae8333947 | ||
![]() |
ea8bef9893 | ||
![]() |
3186abd76e | ||
![]() |
a603e1f3a6 | ||
![]() |
2877acadc0 | ||
![]() |
414834306b | ||
![]() |
01e66d43d8 | ||
![]() |
e186d99780 | ||
![]() |
3ce2235abb | ||
![]() |
9301650e17 | ||
![]() |
d971a570d0 | ||
![]() |
72ae0fd418 | ||
![]() |
fa861e2cbf | ||
![]() |
b120b0c116 | ||
![]() |
1bb76cea72 | ||
![]() |
5fd8d27383 | ||
![]() |
d381343caa | ||
![]() |
11366030aa | ||
![]() |
455f87f41f | ||
![]() |
73cf135d80 | ||
![]() |
0ee8c37f39 | ||
![]() |
968eb46fce | ||
![]() |
904c466cdb | ||
![]() |
ba5efdcffa | ||
![]() |
afeb39aa85 | ||
![]() |
a081e072d8 | ||
![]() |
aa40b82145 | ||
![]() |
81bb61b525 | ||
![]() |
7b4173d698 | ||
![]() |
13a61f82ba | ||
![]() |
d2fd423a8d | ||
![]() |
f432d367fc | ||
![]() |
6dcb4867ae | ||
![]() |
05a38caaf2 | ||
![]() |
443d167a95 | ||
![]() |
33710dfbfc | ||
![]() |
c87d489ca6 | ||
![]() |
99e72a4b1c | ||
![]() |
39c4892772 | ||
![]() |
8c67fb9123 | ||
![]() |
1d267fb82c | ||
![]() |
91896ab68e | ||
![]() |
1b23c6c65c | ||
![]() |
b8e6c051c6 | ||
![]() |
fc77aca7dd | ||
![]() |
7a7b8c1740 | ||
![]() |
8dd6ff8d6a | ||
![]() |
10e6bf0e43 | ||
![]() |
cd6679c716 | ||
![]() |
20171c7519 | ||
![]() |
b7c7b16d4e | ||
![]() |
b077d18963 | ||
![]() |
2f42cfcbeb | ||
![]() |
0eb1afa9ea | ||
![]() |
2c9f267268 | ||
![]() |
038f142ef9 | ||
![]() |
1492490070 | ||
![]() |
0eb1ee3db2 | ||
![]() |
4c83fd10ab | ||
![]() |
f69cd051ab | ||
![]() |
0be17528e5 | ||
![]() |
e5439c9b37 | ||
![]() |
573e508554 | ||
![]() |
7b0ce59233 | ||
![]() |
7a90c8b343 | ||
![]() |
84d845fc7d | ||
![]() |
aea64fe178 | ||
![]() |
271a64bfd1 | ||
![]() |
fd8506b5da | ||
![]() |
4c5f1b3b4a | ||
![]() |
a95fe14581 | ||
![]() |
6efee60f93 | ||
![]() |
22a907b383 | ||
![]() |
ca46c751d1 | ||
![]() |
ca64eeec79 | ||
![]() |
9aa224cc19 | ||
![]() |
13264563a9 | ||
![]() |
cc3f588071 | ||
![]() |
42dd8928a8 | ||
![]() |
6d22a6860e | ||
![]() |
bac74f05e3 | ||
![]() |
a320422588 | ||
![]() |
5bc318633f | ||
![]() |
53310e44c9 | ||
![]() |
a7805d1297 | ||
![]() |
435af39a00 | ||
![]() |
323093b621 | ||
![]() |
61b5ee6d1d | ||
![]() |
55712f46c0 | ||
![]() |
53e4ab7174 | ||
![]() |
b7f5e42c57 | ||
![]() |
603a0fe0a3 | ||
![]() |
f105eaebb8 | ||
![]() |
f501c955e8 | ||
![]() |
b9668f8f00 | ||
![]() |
a4cbfd719b | ||
![]() |
7335bd1e23 | ||
![]() |
26eeb4af8d | ||
![]() |
d6b9aac6d0 | ||
![]() |
3186a0aa15 | ||
![]() |
cc7d2eeb36 | ||
![]() |
b4ad021d34 | ||
![]() |
f45726652f | ||
![]() |
ced0638e2c | ||
![]() |
8175f5eb82 | ||
![]() |
017c16b97a | ||
![]() |
320b8d5c0c | ||
![]() |
0b7c2400c3 | ||
![]() |
fefb96f43f | ||
![]() |
1472b5486b | ||
![]() |
e6ae0c6128 | ||
![]() |
ac422d577c | ||
![]() |
484aba4298 | ||
![]() |
b14e0fb826 | ||
![]() |
863105bce1 | ||
![]() |
15ec719501 | ||
![]() |
249a94ab04 | ||
![]() |
6656e1547f | ||
![]() |
688afe0fc3 | ||
![]() |
8fb06a0562 | ||
![]() |
68021e85c9 | ||
![]() |
12aa314819 | ||
![]() |
bff5416520 | ||
![]() |
9eab750787 | ||
![]() |
f31220ec88 | ||
![]() |
043d61b542 | ||
![]() |
0d7b00a230 | ||
![]() |
a48ea27deb | ||
![]() |
9d030e4ef1 | ||
![]() |
3a39dd027f | ||
![]() |
de8cc25d70 | ||
![]() |
ba977abe63 | ||
![]() |
69762959ae | ||
![]() |
851946468a | ||
![]() |
28665b4fa5 | ||
![]() |
17985b2575 | ||
![]() |
2f20797a40 |
17
Makefile
17
Makefile
@@ -15,6 +15,7 @@ mandir ?= ${prefix}/share/man
|
||||
CFLAGS ?= -O2 -g -Wall
|
||||
CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64
|
||||
bashcompletiondir ?= ${datadir}/bash-completion/completions
|
||||
pkgconfigdatadir ?= $(datadir)/pkgconfig
|
||||
|
||||
man1pages = lsinitrd.1
|
||||
|
||||
@@ -40,7 +41,7 @@ manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
|
||||
|
||||
.PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh
|
||||
|
||||
all: dracut-version.sh dracut-install skipcpio/skipcpio
|
||||
all: dracut-version.sh dracut.pc dracut-install skipcpio/skipcpio
|
||||
|
||||
DRACUT_INSTALL_OBJECTS = \
|
||||
install/dracut-install.o \
|
||||
@@ -93,7 +94,15 @@ dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc
|
||||
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
|
||||
rm -f -- dracut.xml
|
||||
|
||||
install: dracut-version.sh
|
||||
dracut.pc: Makefile.inc Makefile
|
||||
@echo "Name: dracut" > dracut.pc
|
||||
@echo "Description: dracut" >> dracut.pc
|
||||
@echo "Version: $(VERSION)$(GITVERSION)" >> dracut.pc
|
||||
@echo "dracutdir=$(pkglibdir)" >> dracut.pc
|
||||
@echo "dracutmodulesdir=$(pkglibdir)/modules.d" >> dracut.pc
|
||||
@echo "dracutconfdir=$(pkglibdir)/dracut.conf.d" >> dracut.pc
|
||||
|
||||
install: all
|
||||
mkdir -p $(DESTDIR)$(pkglibdir)
|
||||
mkdir -p $(DESTDIR)$(bindir)
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)
|
||||
@@ -153,6 +162,8 @@ endif
|
||||
mkdir -p $(DESTDIR)${bashcompletiondir}
|
||||
install -m 0644 dracut-bash-completion.sh $(DESTDIR)${bashcompletiondir}/dracut
|
||||
install -m 0644 lsinitrd-bash-completion.sh $(DESTDIR)${bashcompletiondir}/lsinitrd
|
||||
mkdir -p $(DESTDIR)${pkgconfigdatadir}
|
||||
install -m 0644 dracut.pc $(DESTDIR)${pkgconfigdatadir}/dracut.pc
|
||||
|
||||
dracut-version.sh:
|
||||
@echo "DRACUT_VERSION=$(VERSION)$(GITVERSION)" > dracut-version.sh
|
||||
@@ -189,7 +200,7 @@ rpm: dracut-$(VERSION).tar.bz2 syncheck
|
||||
(cd "$$rpmbuild"; rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
|
||||
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
|
||||
--define "_rpmdir $$PWD" -ba dracut.spec; ) && \
|
||||
( mv "$$rpmbuild"/$$(arch)/*.rpm .; mv "$$rpmbuild"/*.src.rpm .;rm -fr -- "$$rpmbuild"; ls *.rpm )
|
||||
( mv "$$rpmbuild"/$$(arch)/*.rpm $(DESTDIR).; mv "$$rpmbuild"/*.src.rpm $(DESTDIR).;rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
|
||||
|
||||
syncheck:
|
||||
@ret=0;for i in dracut-initramfs-restore.sh modules.d/*/*.sh; do \
|
||||
|
5
README.md
Normal file
5
README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# dracut RHEL-7 branch
|
||||
|
||||
dracut is an initramfs infrastructure.
|
||||
|
||||
CentOS CI Status: [](https://ci.centos.org/job/dracut-push-rhel-7/)
|
@@ -40,7 +40,7 @@ _dracut() {
|
||||
--omit-drivers --modules --omit --drivers --filesystems --install
|
||||
--fwdir --libdirs --fscks --add-fstab --mount --device --nofscks
|
||||
--kmoddir --conf --confdir --tmpdir --stdlog --compress --prefix
|
||||
--kernel-cmdline --sshkey --persistent-policy'
|
||||
--kernel-cmdline --sshkey --persistent-policy --install-optional'
|
||||
)
|
||||
|
||||
if __contains_word "$prev" ${OPTS[ARG]}; then
|
||||
@@ -49,7 +49,7 @@ _dracut() {
|
||||
comps=$(compgen -d -- "$cur")
|
||||
compopt -o filenames
|
||||
;;
|
||||
-c|--conf|--sshkey|--add-fstab|--add-device|-I|--install)
|
||||
-c|--conf|--sshkey|--add-fstab|--add-device|-I|--install|--install-optional)
|
||||
comps=$(compgen -f -- "$cur")
|
||||
compopt -o filenames
|
||||
;;
|
||||
|
@@ -29,6 +29,10 @@ fi
|
||||
|
||||
# Generic substring function. If $2 is in $1, return 0.
|
||||
strstr() { [[ $1 = *$2* ]]; }
|
||||
# returns OK if $1 contains literal string $2 at the beginning, and isn't empty
|
||||
str_starts() { [ "${1#"$2"*}" != "$1" ]; }
|
||||
# returns OK if $1 contains literal string $2 at the end, and isn't empty
|
||||
str_ends() { [ "${1%*"$2"}" != "$1" ]; }
|
||||
|
||||
# helper function for check() in module-setup.sh
|
||||
# to check for required installed binaries
|
||||
@@ -422,7 +426,7 @@ shorten_persistent_dev() {
|
||||
# $ find_block_device /usr
|
||||
# 8:4
|
||||
find_block_device() {
|
||||
local _majmin _dev _majmin _find_mpt
|
||||
local _dev _majmin _find_mpt
|
||||
_find_mpt="$1"
|
||||
if [[ $use_fstab != yes ]]; then
|
||||
[[ -d $_find_mpt/. ]]
|
||||
@@ -628,7 +632,7 @@ check_block_and_slaves_all() {
|
||||
if ! lvm_internal_dev $2 && "$1" $2; then
|
||||
_ret=0
|
||||
fi
|
||||
check_vol_slaves "$@" && return 0
|
||||
check_vol_slaves_all "$@" && return 0
|
||||
if [[ -f /sys/dev/block/$2/../dev ]]; then
|
||||
check_block_and_slaves_all $1 $(<"/sys/dev/block/$2/../dev") && _ret=0
|
||||
fi
|
||||
@@ -687,7 +691,7 @@ check_vol_slaves() {
|
||||
if [[ $_lv = $2 ]]; then
|
||||
_vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
|
||||
# strip space
|
||||
_vg=$(printf "%s\n" "$_vg")
|
||||
_vg="${_vg//[[:space:]]/}"
|
||||
if [[ $_vg ]]; then
|
||||
for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
|
||||
do
|
||||
@@ -699,6 +703,29 @@ check_vol_slaves() {
|
||||
return 1
|
||||
}
|
||||
|
||||
check_vol_slaves_all() {
|
||||
local _lv _vg _pv
|
||||
for i in /dev/mapper/*; do
|
||||
[[ $i == /dev/mapper/control ]] && continue
|
||||
_lv=$(get_maj_min $i)
|
||||
if [[ $_lv = $2 ]]; then
|
||||
_vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
|
||||
# strip space
|
||||
_vg="${_vg//[[:space:]]/}"
|
||||
if [[ $_vg ]]; then
|
||||
for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
|
||||
do
|
||||
check_block_and_slaves_all $1 $(get_maj_min $_pv)
|
||||
done
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
|
||||
# fs_get_option <filesystem options> <search for option>
|
||||
# search for a specific option in a bunch of filesystem options
|
||||
# and return the value
|
||||
|
@@ -150,8 +150,7 @@ dlog_init() {
|
||||
&& 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"
|
||||
readonly _systemdcatfile="$DRACUT_TMPDIR/systemd-cat"
|
||||
mkfifo "$_systemdcatfile"
|
||||
readonly _dlogfd=15
|
||||
systemd-cat -t 'dracut' --level-prefix=true <"$_systemdcatfile" &
|
||||
|
@@ -306,6 +306,12 @@ provide a valid _/etc/fstab_.
|
||||
**--no-hostonly-cmdline**:
|
||||
Do not store kernel command line arguments needed in the initramfs
|
||||
|
||||
**--hostonly-i18n**:
|
||||
Install only needed keyboard and font files according to the host configuration (default).
|
||||
|
||||
**--no-hostonly-i18n**:
|
||||
Install all keyboard and font files available.
|
||||
|
||||
**--persistent-policy** _<policy>_::
|
||||
Use _<policy>_ to address disks and partitions.
|
||||
_<policy>_ can be any directory name found in /dev/disk.
|
||||
@@ -349,6 +355,9 @@ example:
|
||||
----
|
||||
===============================
|
||||
|
||||
**--install-optional** _<file list>_::
|
||||
install the space separated list of files into the initramfs, if they exist.
|
||||
|
||||
**--gzip**::
|
||||
Compress the generated initramfs using gzip. This will be done by default,
|
||||
unless another compression option or --no-compress is passed. Equivalent to
|
||||
|
@@ -108,6 +108,10 @@ resume=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
||||
|
||||
Misc
|
||||
~~~~
|
||||
**rd.emergency=**__[reboot|poweroff|halt]__::
|
||||
specify, what action to execute in case of a critical failure. rd.shell=0 also
|
||||
be specified.
|
||||
|
||||
**rd.driver.blacklist=**__<drivername>__[,__<drivername>__,...]::
|
||||
do not load kernel module <drivername>. This parameter can be specified
|
||||
multiple times.
|
||||
@@ -157,8 +161,8 @@ It should be attached to any report about dracut problems.
|
||||
_/run/initramfs/init.log_.
|
||||
If "quiet" is set, it also logs to the console.
|
||||
|
||||
**rd.memdebug=[0-3]**::
|
||||
Print memory usage info at various points, set the verbose level from 0 to 3.
|
||||
**rd.memdebug=[0-4]**::
|
||||
Print memory usage info at various points, set the verbose level from 0 to 4.
|
||||
+
|
||||
Higher level means more debugging output:
|
||||
+
|
||||
@@ -167,6 +171,10 @@ It should be attached to any report about dracut problems.
|
||||
1 - partial /proc/meminfo
|
||||
2 - /proc/meminfo
|
||||
3 - /proc/meminfo + /proc/slabinfo
|
||||
4 - /proc/meminfo + /proc/slabinfo + tracekomem
|
||||
NOTE: tracekomem is a shell script utilizing kernel trace to track
|
||||
the rough total memory consumption of kernel modules during
|
||||
loading. It may override other trace configurations.
|
||||
----
|
||||
|
||||
**rd.break**::
|
||||
|
@@ -30,6 +30,11 @@ dracut command line options will overwrite any values set here.
|
||||
|
||||
Configuration files must have the extension .conf; other extensions are ignored.
|
||||
|
||||
[WARNING]
|
||||
====
|
||||
Space-separated lists have to have a leading and trailing space!
|
||||
====
|
||||
|
||||
*dracutmodules+=*" __<dracut modules>__ "::
|
||||
Specify a space-separated list of dracut modules to call when building the
|
||||
initramfs. Modules are located in _/usr/lib/dracut/modules.d_.
|
||||
@@ -66,6 +71,10 @@ Configuration files must have the extension .conf; other extensions are ignored.
|
||||
*install_items+=*" __<file>__[ __<file>__ ...] "::
|
||||
Specify additional files to include in the initramfs, separated by spaces.
|
||||
|
||||
*install_optional_items+=*" __<file>__[ __<file>__ ...] "::
|
||||
Specify additional files to include in the initramfs, separated by spaces,
|
||||
if they exist.
|
||||
|
||||
*do_strip=*"__{yes|no}__"::
|
||||
Strip binaries in the initramfs (default=yes)
|
||||
|
||||
@@ -79,6 +88,9 @@ Configuration files must have the extension .conf; other extensions are ignored.
|
||||
*hostonly_cmdline*"__{yes|no}__"::
|
||||
If set, store the kernel command line arguments needed in the initramfs
|
||||
|
||||
*i18n_install_all=*"__{yes|no}__"::
|
||||
If set to yes, install all available fonts and keyboard files.
|
||||
|
||||
*persistent_policy=*"__<policy>__"::
|
||||
Use _<policy>_ to address disks and partitions.
|
||||
_<policy>_ can be any directory name found in /dev/disk.
|
||||
|
@@ -6,7 +6,7 @@ i18n_default_font="latarcyrheb-sun16"
|
||||
i18n_install_all="yes"
|
||||
stdloglvl=3
|
||||
sysloglvl=5
|
||||
install_items+=" vi /etc/virc ps grep cat rm "
|
||||
install_optional_items+=" vi /etc/virc ps grep cat rm "
|
||||
prefix="/"
|
||||
systemdutildir=/usr/lib/systemd
|
||||
systemdsystemunitdir=/usr/lib/systemd/system
|
||||
|
119
dracut.sh
119
dracut.sh
@@ -141,6 +141,9 @@ Creates initial ramdisk images for preloading modules
|
||||
in the initramfs
|
||||
--no-hostonly-cmdline Do not store kernel command line arguments needed
|
||||
in the initramfs
|
||||
--hostonly-i18n Install only needed keyboard and font files according
|
||||
to the host configuration (default).
|
||||
--no-hostonly-i18n Install all keyboard and font files available.
|
||||
--persistent-policy [POLICY]
|
||||
Use [POLICY] to address disks and partitions.
|
||||
POLICY can be any directory name found in /dev/disk.
|
||||
@@ -158,6 +161,8 @@ Creates initial ramdisk images for preloading modules
|
||||
in the final initramfs.
|
||||
-I, --install [LIST] Install the space separated list of files into the
|
||||
initramfs.
|
||||
--install-optional [LIST] Install the space separated list of files into the
|
||||
initramfs, if they exist.
|
||||
--gzip Compress the generated initramfs using gzip.
|
||||
This will be done by default, unless another
|
||||
compression option or --no-compress is passed.
|
||||
@@ -305,6 +310,7 @@ rearrange_params()
|
||||
--long drivers: \
|
||||
--long filesystems: \
|
||||
--long install: \
|
||||
--long install-optional: \
|
||||
--long fwdir: \
|
||||
--long libdirs: \
|
||||
--long fscks: \
|
||||
@@ -471,6 +477,9 @@ while :; do
|
||||
-d|--drivers) push drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--filesystems) push filesystems_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
-I|--install) push install_items_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--install-optional)
|
||||
push install_optional_items_l \
|
||||
"$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--fwdir) push fw_dir_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--libdirs) push libdirs_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--fscks) push fscks_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
@@ -722,6 +731,12 @@ if (( ${#install_items_l[@]} )); then
|
||||
done
|
||||
fi
|
||||
|
||||
if (( ${#install_optional_items_l[@]} )); then
|
||||
while pop install_optional_items_l val; do
|
||||
install_optional_items+=" $val "
|
||||
done
|
||||
fi
|
||||
|
||||
# these options override the stuff in the config file
|
||||
if (( ${#dracutmodules_l[@]} )); then
|
||||
dracutmodules=''
|
||||
@@ -813,31 +828,25 @@ fi
|
||||
[[ $hostonly != "-h" ]] && unset hostonly
|
||||
|
||||
readonly TMPDIR="$tmpdir"
|
||||
readonly initdir="$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)"
|
||||
[ -d "$initdir" ] || {
|
||||
printf "%s\n" "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t initramfs.XXXXXX failed." >&2
|
||||
readonly DRACUT_TMPDIR="$(mktemp -p "$TMPDIR/" -d -t dracut.XXXXXX)"
|
||||
[ -d "$DRACUT_TMPDIR" ] || {
|
||||
printf "%s\n" "dracut: mktemp -p '$TMPDIR/' -d -t dracut.XXXXXX failed." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ $early_microcode = yes ]] || ( [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]] ); then
|
||||
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
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap '
|
||||
ret=$?;
|
||||
[[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf -- "$initdir"; };
|
||||
[[ $keep ]] && echo "Not removing $early_cpio_dir." >&2 || { [[ $early_cpio_dir ]] && rm -Rf -- "$early_cpio_dir"; };
|
||||
[[ $_dlogdir ]] && rm -Rf -- "$_dlogdir";
|
||||
[[ $keep ]] && echo "Not removing $DRACUT_TMPDIR." >&2 || { [[ $DRACUT_TMPDIR ]] && rm -rf -- "$DRACUT_TMPDIR"; };
|
||||
exit $ret;
|
||||
' EXIT
|
||||
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap 'exit 1;' SIGINT
|
||||
|
||||
readonly initdir="${DRACUT_TMPDIR}/initramfs"
|
||||
mkdir "$initdir"
|
||||
|
||||
export DRACUT_KERNEL_LAZY="1"
|
||||
export DRACUT_RESOLVE_LAZY="1"
|
||||
|
||||
@@ -879,6 +888,24 @@ fi
|
||||
dracutfunctions=$dracutbasedir/dracut-functions.sh
|
||||
export dracutfunctions
|
||||
|
||||
|
||||
|
||||
case "$(arch)" in
|
||||
i686|x86_64)
|
||||
;;
|
||||
*)
|
||||
if [[ $early_microcode = yes ]]; then
|
||||
early_microcode=no
|
||||
dinfo "Disabling early microcode for $(arch)"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ $early_microcode = yes ]] || ( [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]] ); then
|
||||
readonly early_cpio_dir="${DRACUT_TMPDIR}/earlycpio"
|
||||
mkdir "$early_cpio_dir"
|
||||
fi
|
||||
|
||||
if (( ${#drivers_l[@]} )); then
|
||||
drivers=''
|
||||
while pop drivers_l val; do
|
||||
@@ -942,9 +969,14 @@ esac
|
||||
abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
|
||||
|
||||
if [[ -d $srcmods ]]; then
|
||||
[[ -f $srcmods/modules.dep ]] || {
|
||||
dwarn "$srcmods/modules.dep is missing. Did you run depmod?"
|
||||
}
|
||||
if ! [[ -f $srcmods/modules.dep ]]; then
|
||||
if [[ -n "$(find "$srcmods" -name '*.ko*')" ]]; then
|
||||
dfatal "$srcmods/modules.dep is missing. Did you run depmod?"
|
||||
exit 1
|
||||
else
|
||||
dwarn "$srcmods/modules.dep is missing. Did you run depmod?"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! $print_cmdline ]]; then
|
||||
@@ -1105,6 +1137,7 @@ if [[ $hostonly ]]; then
|
||||
# check /proc/modules
|
||||
declare -A host_modules
|
||||
while read m rest; do
|
||||
[ -z "$m" ] && continue
|
||||
host_modules["$m"]=1
|
||||
done </proc/modules
|
||||
fi
|
||||
@@ -1150,6 +1183,12 @@ for dev in "${!host_fs_types[@]}"; do
|
||||
fi
|
||||
done
|
||||
|
||||
# also put the additional filesystems in host_fs_types
|
||||
# so that the according modules are installed.
|
||||
for fs in $filesystems; do
|
||||
host_fs_types[$fs]="$fs"
|
||||
done
|
||||
|
||||
[[ -d $udevdir ]] \
|
||||
|| udevdir="$(pkg-config udev --variable=udevdir 2>/dev/null)"
|
||||
if ! [[ -d "$udevdir" ]]; then
|
||||
@@ -1349,6 +1388,7 @@ fi
|
||||
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
(( ${#install_items[@]} > 0 )) && inst_multiple ${install_items[@]}
|
||||
(( ${#install_optional_items[@]} > 0 )) && inst_multiple -o ${install_optional_items[@]}
|
||||
|
||||
[[ $kernel_cmdline ]] && printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
|
||||
|
||||
@@ -1470,8 +1510,9 @@ if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
|
||||
|
||||
dinfo "*** Stripping files done ***"
|
||||
fi
|
||||
|
||||
if [[ $early_microcode = yes ]]; then
|
||||
dinfo "*** Generating early-microcode cpio image ***"
|
||||
dinfo "*** Generating early-microcode cpio image contents ***"
|
||||
ucode_dir=(amd-ucode intel-ucode)
|
||||
ucode_dest=(AuthenticAMD.bin GenuineIntel.bin)
|
||||
_dest_dir="$early_cpio_dir/d/kernel/x86/microcode"
|
||||
@@ -1497,11 +1538,19 @@ if [[ $early_microcode = yes ]]; then
|
||||
[ -e "$i" ] && break
|
||||
break 2
|
||||
done
|
||||
cat $_fwdir/$_fw/$_src > $_dest_dir/${ucode_dest[$idx]}
|
||||
for i in $_fwdir/$_fw/$_src; do
|
||||
[[ -e "$i" ]] || continue
|
||||
# skip gpg files
|
||||
str_ends "$i" ".asc" && continue
|
||||
cat "$i" >> $_dest_dir/${ucode_dest[$idx]}
|
||||
done
|
||||
create_early_cpio="yes"
|
||||
fi
|
||||
done
|
||||
done
|
||||
if ! [[ $create_early_cpio = yes ]]; then
|
||||
dinfo "*** No early-microcode cpio image needed ***"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]]; then
|
||||
@@ -1527,23 +1576,47 @@ dinfo "*** Creating image file ***"
|
||||
[[ "$UID" != 0 ]] && cpio_owner_root="-R 0:0"
|
||||
|
||||
if [[ $create_early_cpio = yes ]]; then
|
||||
dinfo "*** Creating microcode section ***"
|
||||
echo 1 > "$early_cpio_dir/d/early_cpio"
|
||||
# The microcode blob is _before_ the initramfs blob, not after
|
||||
(cd "$early_cpio_dir/d"; find . -print0 | cpio --null $cpio_owner_root -H newc -o --quiet > $outfile)
|
||||
if ! (
|
||||
umask 077
|
||||
cd "$early_cpio_dir/d"
|
||||
find . -print0 | cpio --null $cpio_owner_root -H newc -o --quiet > "${DRACUT_TMPDIR}/initramfs.img"
|
||||
); then
|
||||
dfatal "dracut: creation of $outfile failed"
|
||||
exit 1
|
||||
else
|
||||
dinfo "*** Created microcode section ***"
|
||||
fi
|
||||
fi
|
||||
if ! ( umask 077; cd "$initdir"; find . -print0 | cpio --null $cpio_owner_root -H newc -o --quiet | \
|
||||
$compress >> "$outfile"; ); then
|
||||
|
||||
if ! (
|
||||
umask 077
|
||||
cd "$initdir"
|
||||
find . -print0 | cpio --null $cpio_owner_root -H newc -o --quiet | \
|
||||
$compress >> "${DRACUT_TMPDIR}/initramfs.img";
|
||||
); then
|
||||
dfatal "dracut: creation of $outfile failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dinfo "*** Creating image file done ***"
|
||||
|
||||
if (( maxloglvl >= 5 )); then
|
||||
if [[ $allowlocal ]]; then
|
||||
"$dracutbasedir/lsinitrd.sh" "$outfile"| ddebug
|
||||
"$dracutbasedir/lsinitrd.sh" "${DRACUT_TMPDIR}/initramfs.img" | ddebug
|
||||
else
|
||||
lsinitrd "$outfile"| ddebug
|
||||
lsinitrd "${DRACUT_TMPDIR}/initramfs.img" | ddebug
|
||||
fi
|
||||
fi
|
||||
|
||||
if cp --reflink=auto "${DRACUT_TMPDIR}/initramfs.img" "$outfile" |& derror ; then
|
||||
dinfo "*** Creating initramfs image file '$outfile' done ***"
|
||||
else
|
||||
rm -f -- "$outfile"
|
||||
dfatal "dracut: creation of $outfile failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
@@ -91,6 +91,7 @@ Requires: gzip xz
|
||||
Requires: kmod
|
||||
Requires: sed
|
||||
Requires: kpartx
|
||||
Requires: tar
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
Requires: util-linux >= 2.21
|
||||
@@ -202,6 +203,7 @@ git commit -a -q -m "%{version} baseline."
|
||||
|
||||
# Apply all the patches.
|
||||
git am -p1 %{patches}
|
||||
git tag %{version}
|
||||
%endif
|
||||
|
||||
%build
|
||||
@@ -310,6 +312,7 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%endif
|
||||
%dir %{_sysconfdir}/dracut.conf.d
|
||||
%dir %{dracutlibdir}/dracut.conf.d
|
||||
%{_datadir}/pkgconfig/dracut.pc
|
||||
%{_mandir}/man8/dracut.8*
|
||||
%{_mandir}/man8/*service.8*
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
|
||||
|
60
lsinitrd.sh
60
lsinitrd.sh
@@ -171,39 +171,35 @@ case $bin in
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
CAT=$({
|
||||
if [[ $SKIP ]]; then
|
||||
$SKIP "$image"
|
||||
if [[ $SKIP ]] ; then
|
||||
bin="$($SKIP "$image" | { read -N 6 bin && echo "$bin" ; })"
|
||||
else
|
||||
read -N 6 bin < "$image"
|
||||
fi
|
||||
case $bin in
|
||||
$'\x1f\x8b'*)
|
||||
CAT="zcat --"
|
||||
;;
|
||||
BZh*)
|
||||
CAT="bzcat --"
|
||||
;;
|
||||
$'\x71\xc7'*|070701)
|
||||
CAT="cat --"
|
||||
;;
|
||||
$'\x02\x21'*)
|
||||
CAT="lz4 -d -c"
|
||||
;;
|
||||
$'\x89'LZO$'\0'*)
|
||||
CAT="lzop -d -c"
|
||||
;;
|
||||
*)
|
||||
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
|
||||
CAT="xzcat --single-stream --"
|
||||
else
|
||||
cat "$image"
|
||||
fi } | {
|
||||
read -N 6 bin
|
||||
case $bin in
|
||||
$'\x1f\x8b'*)
|
||||
echo "zcat --"
|
||||
;;
|
||||
BZh*)
|
||||
echo "bzcat --"
|
||||
;;
|
||||
$'\x71\xc7'*|070701)
|
||||
echo "cat --"
|
||||
;;
|
||||
$'\x02\x21'*)
|
||||
echo "lz4 -d -c"
|
||||
;;
|
||||
$'\x89'LZO$'\0'*)
|
||||
echo "lzop -d -c"
|
||||
;;
|
||||
*)
|
||||
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
|
||||
echo "xzcat --single-stream --"
|
||||
else
|
||||
echo "xzcat --"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
})
|
||||
CAT="xzcat --"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
skipcpio()
|
||||
{
|
||||
|
@@ -96,7 +96,7 @@ do_fips()
|
||||
_found=0
|
||||
while read _k _s _v; do
|
||||
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
|
||||
[ "$_v" != "$_module" ] && continue
|
||||
[ "$_v" != "$_module" ] && [ "crypto-$_v" != "$_module" ] && continue
|
||||
_found=1
|
||||
break
|
||||
done </proc/crypto
|
||||
|
@@ -11,20 +11,29 @@ depends() {
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
local _fipsmodules _mod
|
||||
_fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 blowfish camellia cast6 cbc ccm "
|
||||
_fipsmodules+="chainiv crc32c crct10dif_generic cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod drbg "
|
||||
_fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 "
|
||||
_fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic "
|
||||
_fipsmodules+="aes_s390 des_s390 prng sha256_s390 sha_common des_check_key sha1_s390 sha512_s390"
|
||||
_fipsmodules+="sha384 sha512 sha512_generic tcrypt tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib"
|
||||
local _fipsmodules _mod i
|
||||
|
||||
if [[ -f "${srcmods}/modules.fips" ]]; then
|
||||
_fipsmodules="$(cat "${srcmods}/modules.fips")"
|
||||
else
|
||||
_fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 blowfish camellia cast6 cbc ccm "
|
||||
_fipsmodules+="chainiv crc32c crct10dif_generic cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod drbg "
|
||||
_fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 "
|
||||
_fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic "
|
||||
_fipsmodules+="aes_s390 des_s390 prng sha256_s390 sha_common des_check_key sha1_s390 sha512_s390 "
|
||||
_fipsmodules+="sha384 sha512 sha512_generic tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib cmac authenc "
|
||||
fi
|
||||
|
||||
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
|
||||
|
||||
for _mod in $_fipsmodules; do
|
||||
for _mod in $_fipsmodules tcrypt; do
|
||||
if hostonly='' instmods -c -s $_mod; then
|
||||
echo $_mod >> "${initdir}/etc/fipsmodules"
|
||||
echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
|
||||
for i in $(modprobe --resolve-alias $_mod 2>/dev/null); do
|
||||
[[ $i == $_mod ]] && continue
|
||||
echo "blacklist $i" >> "${initdir}/etc/modprobe.d/fips.conf"
|
||||
done
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@@ -11,18 +11,68 @@ depends() {
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_hook cmdline 00 "$moddir/watchdog.sh"
|
||||
inst_hook cmdline 50 "$moddir/watchdog.sh"
|
||||
inst_hook pre-trigger 00 "$moddir/watchdog.sh"
|
||||
inst_hook initqueue 00 "$moddir/watchdog.sh"
|
||||
inst_hook mount 00 "$moddir/watchdog.sh"
|
||||
inst_hook mount 50 "$moddir/watchdog.sh"
|
||||
inst_hook mount 99 "$moddir/watchdog.sh"
|
||||
inst_hook pre-pivot 00 "$moddir/watchdog.sh"
|
||||
inst_hook pre-pivot 99 "$moddir/watchdog.sh"
|
||||
inst_hook cleanup 00 "$moddir/watchdog.sh"
|
||||
inst_hook cleanup 99 "$moddir/watchdog.sh"
|
||||
# Do not add watchdog hooks if systemd module is included
|
||||
# In that case, systemd will manage watchdog kick
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook cmdline 00 "$moddir/watchdog.sh"
|
||||
inst_hook cmdline 50 "$moddir/watchdog.sh"
|
||||
inst_hook pre-trigger 00 "$moddir/watchdog.sh"
|
||||
inst_hook initqueue 00 "$moddir/watchdog.sh"
|
||||
inst_hook mount 00 "$moddir/watchdog.sh"
|
||||
inst_hook mount 50 "$moddir/watchdog.sh"
|
||||
inst_hook mount 99 "$moddir/watchdog.sh"
|
||||
inst_hook pre-pivot 00 "$moddir/watchdog.sh"
|
||||
inst_hook pre-pivot 99 "$moddir/watchdog.sh"
|
||||
inst_hook cleanup 00 "$moddir/watchdog.sh"
|
||||
inst_hook cleanup 99 "$moddir/watchdog.sh"
|
||||
fi
|
||||
inst_hook emergency 02 "$moddir/watchdog-stop.sh"
|
||||
inst_multiple -o wdctl
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
local -A _drivers
|
||||
local _alldrivers _active _wdtdrv _wdtppath _dir
|
||||
[[ -d /sys/class/watchdog/ ]] || return
|
||||
for _dir in /sys/class/watchdog/*; do
|
||||
[[ -d "$_dir" ]] || continue
|
||||
[[ -f "$_dir/state" ]] || continue
|
||||
_active=$(< "$_dir/state")
|
||||
! [[ $hostonly ]] || [[ "$_active" = "active" ]] || continue
|
||||
# device/modalias will return driver of this device
|
||||
_wdtdrv=$(< "$_dir/device/modalias")
|
||||
# There can be more than one module represented by same
|
||||
# modalias. Currently load all of them.
|
||||
# TODO: Need to find a way to avoid any unwanted module
|
||||
# represented by modalias
|
||||
_wdtdrv=$(modprobe --set-version "$kernel" -R $_wdtdrv 2>/dev/null)
|
||||
if [[ $_wdtdrv ]]; then
|
||||
instmods $_wdtdrv
|
||||
for i in $_wdtdrv; do
|
||||
_drivers[$i]=1
|
||||
done
|
||||
fi
|
||||
# however in some cases, we also need to check that if there is
|
||||
# a specific driver for the parent bus/device. In such cases
|
||||
# we also need to enable driver for parent bus/device.
|
||||
_wdtppath=$(readlink -f "$_dir/device")
|
||||
while [[ -d "$_wdtppath" ]] && [[ "$_wdtppath" != "/sys" ]]; do
|
||||
_wdtppath=$(readlink -f "$_wdtppath/..")
|
||||
[[ -f "$_wdtppath/modalias" ]] || continue
|
||||
|
||||
_wdtdrv=$(< "$_wdtppath/modalias")
|
||||
_wdtdrv=$(modprobe --set-version "$kernel" -R $_wdtdrv 2>/dev/null)
|
||||
if [[ $_wdtdrv ]]; then
|
||||
instmods $_wdtdrv
|
||||
for i in $_wdtdrv; do
|
||||
_drivers[$i]=1
|
||||
done
|
||||
fi
|
||||
done
|
||||
done
|
||||
# ensure that watchdog module is loaded as early as possible
|
||||
_alldrivers="${!_drivers[*]}"
|
||||
[[ $_alldrivers ]] && echo "rd.driver.pre=${_alldrivers// /,}" > ${initdir}/etc/cmdline.d/00-watchdog.conf
|
||||
|
||||
return 0
|
||||
}
|
||||
|
@@ -1,2 +1,2 @@
|
||||
#!/bin/sh
|
||||
[ -c /dev/watchdog ] && echo -n 'V' > /dev/watchdog
|
||||
[ -c /dev/watchdog ] && printf 'V' > /dev/watchdog
|
||||
|
@@ -95,6 +95,51 @@ setup_interface6() {
|
||||
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
}
|
||||
|
||||
function parse_option_121() {
|
||||
while [ $# -ne 0 ]; do
|
||||
mask="$1"
|
||||
shift
|
||||
|
||||
# Is the destination a multicast group?
|
||||
if [ $1 -ge 224 -a $1 -lt 240 ]; then
|
||||
multicast=1
|
||||
else
|
||||
multicast=0
|
||||
fi
|
||||
|
||||
# Parse the arguments into a CIDR net/mask string
|
||||
if [ $mask -gt 24 ]; then
|
||||
destination="$1.$2.$3.$4/$mask"
|
||||
shift; shift; shift; shift
|
||||
elif [ $mask -gt 16 ]; then
|
||||
destination="$1.$2.$3.0/$mask"
|
||||
shift; shift; shift
|
||||
elif [ $mask -gt 8 ]; then
|
||||
destination="$1.$2.0.0/$mask"
|
||||
shift; shift
|
||||
else
|
||||
destination="$1.0.0.0/$mask"
|
||||
shift
|
||||
fi
|
||||
|
||||
# Read the gateway
|
||||
gateway="$1.$2.$3.$4"
|
||||
shift; shift; shift; shift
|
||||
|
||||
# Multicast routing on Linux
|
||||
# - If you set a next-hop address for a multicast group, this breaks with Cisco switches
|
||||
# - If you simply leave it link-local and attach it to an interface, it works fine.
|
||||
if [ $multicast -eq 1 ]; then
|
||||
temp_result="$destination dev $interface"
|
||||
else
|
||||
temp_result="$destination via $gateway dev $interface"
|
||||
fi
|
||||
|
||||
echo "/sbin/ip route add $temp_result"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
case $reason in
|
||||
PREINIT)
|
||||
echo "dhcp: PREINIT $netif up"
|
||||
@@ -104,7 +149,7 @@ case $reason in
|
||||
PREINIT6)
|
||||
echo "dhcp: PREINIT6 $netif up"
|
||||
linkup $netif
|
||||
wait_for_ipv6_dad $netif
|
||||
wait_for_ipv6_dad_link $netif
|
||||
;;
|
||||
|
||||
BOUND)
|
||||
@@ -129,6 +174,9 @@ case $reason in
|
||||
{
|
||||
echo '. /lib/net-lib.sh'
|
||||
echo "setup_net $netif"
|
||||
if [ -n "$new_classless_static_routes" ]; then
|
||||
parse_option_121 $new_classless_static_routes
|
||||
fi
|
||||
echo "source_hook initqueue/online $netif"
|
||||
[ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
|
||||
echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh"
|
||||
|
@@ -1,3 +1,6 @@
|
||||
|
||||
option classless-routes code 121 = array of unsigned integer 8;
|
||||
|
||||
request subnet-mask, broadcast-address, time-offset, routers,
|
||||
domain-name, domain-name-servers, domain-search, host-name,
|
||||
root-path, interface-mtu;
|
||||
root-path, interface-mtu, classless-routes;
|
||||
|
@@ -17,79 +17,12 @@ type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
|
||||
# $netif reads easier than $1
|
||||
netif=$1
|
||||
use_bridge='false'
|
||||
use_vlan='false'
|
||||
|
||||
# enslave this interface to bond?
|
||||
for i in /tmp/bond.*.info; do
|
||||
[ -e "$i" ] || continue
|
||||
unset bondslaves
|
||||
unset bondname
|
||||
. "$i"
|
||||
for slave in $bondslaves ; do
|
||||
if [ "$netif" = "$slave" ] ; then
|
||||
netif=$bondname
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
for i in /tmp/team.*.info; do
|
||||
[ -e "$i" ] || continue
|
||||
unset teamslaves
|
||||
unset teammaster
|
||||
. "$i"
|
||||
for slave in $teamslaves ; do
|
||||
if [ "$netif" = "$slave" ] ; then
|
||||
netif=$teammaster
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
if [ -e /tmp/vlan.info ]; then
|
||||
. /tmp/vlan.info
|
||||
if [ "$netif" = "$phydevice" ]; then
|
||||
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
|
||||
: # We need to really setup bond (recursive call)
|
||||
elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then
|
||||
: # We need to really setup team (recursive call)
|
||||
else
|
||||
netif="$vlanname"
|
||||
use_vlan='true'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# bridge this interface?
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
for ethname in $bridgeslaves ; do
|
||||
if [ "$netif" = "$ethname" ]; then
|
||||
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
|
||||
: # We need to really setup bond (recursive call)
|
||||
elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then
|
||||
: # We need to really setup team (recursive call)
|
||||
elif [ "$netif" = "$vlanname" ] && [ -n "$DO_VLAN_SETUP" ]; then
|
||||
: # We need to really setup vlan (recursive call)
|
||||
else
|
||||
netif="$bridgename"
|
||||
use_bridge='true'
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# disable manual ifup while netroot is set for simplifying our logic
|
||||
# in netroot case we prefer netroot to bringup $netif automaticlly
|
||||
[ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2"
|
||||
|
||||
if [ -n "$manualup" ]; then
|
||||
>/tmp/net.$netif.manualup
|
||||
rm -f /tmp/net.${netif}.did-setup
|
||||
else
|
||||
[ -e /tmp/net.${netif}.did-setup ] && exit 0
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
[ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && exit 0
|
||||
# loopback is always handled the same way
|
||||
if [ "$netif" = "lo" ] ; then
|
||||
ip link set lo up
|
||||
ip addr add 127.0.0.1/8 dev lo
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Run dhclient
|
||||
@@ -105,11 +38,15 @@ do_dhcp() {
|
||||
|
||||
[ -e /tmp/dhclient.$netif.pid ] && return 0
|
||||
|
||||
if ! iface_has_link $netif; then
|
||||
if ! iface_has_carrier $netif; then
|
||||
warn "No carrier detected on interface $netif"
|
||||
return 1
|
||||
fi
|
||||
|
||||
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
|
||||
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
|
||||
ip -4 addr flush dev $netif
|
||||
|
||||
while [ $_COUNT -lt $_DHCPRETRY ]; do
|
||||
info "Starting dhcp for interface $netif"
|
||||
dhclient "$@" \
|
||||
@@ -144,6 +81,8 @@ do_ipv6auto() {
|
||||
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
|
||||
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
|
||||
linkup $netif
|
||||
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
|
||||
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
|
||||
wait_for_ipv6_auto $netif
|
||||
|
||||
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
@@ -155,7 +94,10 @@ do_ipv6auto() {
|
||||
do_static() {
|
||||
strstr $ip '*:*:*' && load_ipv6
|
||||
|
||||
if ! linkup $netif; then
|
||||
if [ -z "$dev" ] && ! iface_has_carrier "$netif"; then
|
||||
warn "No carrier detected on interface $netif"
|
||||
return 1
|
||||
elif ! linkup "$netif"; then
|
||||
warn "Could not bring interface $netif up!"
|
||||
return 1
|
||||
fi
|
||||
@@ -180,7 +122,7 @@ do_static() {
|
||||
warn "Duplicate address detected for $ip for interface $netif."
|
||||
return 1
|
||||
fi
|
||||
ip addr flush dev $netif
|
||||
ip -4 addr flush dev $netif
|
||||
ip addr add $ip/$mask ${srv:+peer $srv} brd + dev $netif
|
||||
fi
|
||||
|
||||
@@ -190,124 +132,6 @@ do_static() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# loopback is always handled the same way
|
||||
if [ "$netif" = "lo" ] ; then
|
||||
ip link set lo up
|
||||
ip addr add 127.0.0.1/8 dev lo
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# start bond if needed
|
||||
if [ -e /tmp/bond.${netif}.info ]; then
|
||||
. /tmp/bond.${netif}.info
|
||||
|
||||
if [ "$netif" = "$bondname" ] && [ ! -e /tmp/net.$bondname.up ] ; then # We are master bond device
|
||||
modprobe bonding
|
||||
echo "+$netif" > /sys/class/net/bonding_masters
|
||||
ip link set $netif down
|
||||
|
||||
# Stolen from ifup-eth
|
||||
# add the bits to setup driver parameters here
|
||||
for arg in $bondoptions ; do
|
||||
key=${arg%%=*};
|
||||
value=${arg##*=};
|
||||
# %{value:0:1} is replaced with non-bash specific construct
|
||||
if [ "${key}" = "arp_ip_target" -a "${#value}" != "0" -a "+${value%%+*}" != "+" ]; then
|
||||
OLDIFS=$IFS;
|
||||
IFS=',';
|
||||
for arp_ip in $value; do
|
||||
echo +$arp_ip > /sys/class/net/${netif}/bonding/$key
|
||||
done
|
||||
IFS=$OLDIFS;
|
||||
else
|
||||
echo $value > /sys/class/net/${netif}/bonding/$key
|
||||
fi
|
||||
done
|
||||
|
||||
linkup $netif
|
||||
|
||||
for slave in $bondslaves ; do
|
||||
ip link set $slave down
|
||||
cat /sys/class/net/$slave/address > /tmp/net.${netif}.${slave}.hwaddr
|
||||
echo "+$slave" > /sys/class/net/$bondname/bonding/slaves
|
||||
linkup $slave
|
||||
done
|
||||
|
||||
# add the bits to setup the needed post enslavement parameters
|
||||
for arg in $BONDING_OPTS ; do
|
||||
key=${arg%%=*};
|
||||
value=${arg##*=};
|
||||
if [ "${key}" = "primary" ]; then
|
||||
echo $value > /sys/class/net/${netif}/bonding/$key
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e /tmp/team.${netif}.info ]; then
|
||||
. /tmp/team.${netif}.info
|
||||
if [ "$netif" = "$teammaster" ] && [ ! -e /tmp/net.$teammaster.up ] ; then
|
||||
# We shall only bring up those _can_ come up
|
||||
# in case of some slave is gone in active-backup mode
|
||||
working_slaves=""
|
||||
for slave in $teamslaves ; do
|
||||
teamdctl ${teammaster} port present ${slave} 2>/dev/null \
|
||||
&& continue
|
||||
ip link set dev $slave up 2>/dev/null
|
||||
if wait_for_if_up $slave; then
|
||||
working_slaves+="$slave "
|
||||
fi
|
||||
done
|
||||
# Do not add slaves now
|
||||
teamd -d -U -n -N -t $teammaster -f /etc/teamd/$teammaster.conf
|
||||
for slave in $working_slaves; do
|
||||
# team requires the slaves to be down before joining team
|
||||
ip link set dev $slave down
|
||||
(
|
||||
unset TEAM_PORT_CONFIG
|
||||
_hwaddr=$(cat /sys/class/net/$slave/address)
|
||||
_subchannels=$(iface_get_subchannels "$slave")
|
||||
if [ -n "$_hwaddr" ] && [ -e "/etc/sysconfig/network-scripts/mac-${_hwaddr}.conf" ]; then
|
||||
. "/etc/sysconfig/network-scripts/mac-${_hwaddr}.conf"
|
||||
elif [ -n "$_subchannels" ] && [ -e "/etc/sysconfig/network-scripts/ccw-${_subchannels}.conf" ]; then
|
||||
. "/etc/sysconfig/network-scripts/ccw-${_subchannels}.conf"
|
||||
elif [ -e "/etc/sysconfig/network-scripts/ifcfg-${slave}" ]; then
|
||||
. "/etc/sysconfig/network-scripts/ifcfg-${slave}"
|
||||
fi
|
||||
|
||||
if [ -n "${TEAM_PORT_CONFIG}" ]; then
|
||||
/usr/bin/teamdctl ${teammaster} port config update ${slave} "${TEAM_PORT_CONFIG}"
|
||||
fi
|
||||
)
|
||||
teamdctl $teammaster port add $slave
|
||||
done
|
||||
ip link set dev $teammaster up
|
||||
fi
|
||||
fi
|
||||
|
||||
# XXX need error handling like dhclient-script
|
||||
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
# start bridge if necessary
|
||||
if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
|
||||
brctl addbr $bridgename
|
||||
brctl setfd $bridgename 0
|
||||
for ethname in $bridgeslaves ; do
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
DO_BOND_SETUP=yes ifup $bondname -m
|
||||
elif [ "$ethname" = "$teammaster" ] ; then
|
||||
DO_TEAM_SETUP=yes ifup $teammaster -m
|
||||
elif [ "$ethname" = "$vlanname" ]; then
|
||||
DO_VLAN_SETUP=yes ifup $vlanname -m
|
||||
else
|
||||
linkup $ethname
|
||||
fi
|
||||
brctl addif $bridgename $ethname
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
get_vid() {
|
||||
case "$1" in
|
||||
vlan*)
|
||||
@@ -319,33 +143,211 @@ get_vid() {
|
||||
esac
|
||||
}
|
||||
|
||||
if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
|
||||
modprobe 8021q
|
||||
if [ "$phydevice" = "$bondname" ] ; then
|
||||
DO_BOND_SETUP=yes ifup $phydevice -m
|
||||
elif [ "$phydevice" = "$teammaster" ] ; then
|
||||
DO_TEAM_SETUP=yes ifup $phydevice -m
|
||||
else
|
||||
linkup "$phydevice"
|
||||
fi
|
||||
ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname)"
|
||||
ip link set "$vlanname" up
|
||||
# check, if we need VLAN's for this interface
|
||||
if [ -z "$DO_VLAN_PHY" ] && [ -e /tmp/vlan.${netif}.phy ]; then
|
||||
unset DO_VLAN
|
||||
NO_AUTO_DHCP=yes DO_VLAN_PHY=yes ifup "$netif"
|
||||
modprobe -b -q 8021q
|
||||
|
||||
for i in /tmp/vlan.*.${netif}; do
|
||||
[ -e "$i" ] || continue
|
||||
read vlanname < "$i"
|
||||
if [ -n "$vlanname" ]; then
|
||||
linkup "$netif"
|
||||
ip link add dev "$vlanname" link "$netif" type vlan id "$(get_vid $vlanname)"
|
||||
ifup "$vlanname"
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check, if interface is VLAN interface
|
||||
if ! [ -e /tmp/vlan.${netif}.phy ]; then
|
||||
for i in /tmp/vlan.${netif}.*; do
|
||||
[ -e "$i" ] || continue
|
||||
export DO_VLAN=yes
|
||||
break
|
||||
done
|
||||
fi
|
||||
|
||||
# bridge this interface?
|
||||
if [ -z "$NO_BRIDGE_MASTER" ]; then
|
||||
for i in /tmp/bridge.*.info; do
|
||||
[ -e "$i" ] || continue
|
||||
unset bridgeslaves
|
||||
unset bridgename
|
||||
. "$i"
|
||||
for ethname in $bridgeslaves ; do
|
||||
[ "$netif" != "$ethname" ] && continue
|
||||
|
||||
NO_BRIDGE_MASTER=yes NO_AUTO_DHCP=yes ifup $ethname
|
||||
linkup $ethname
|
||||
if [ ! -e /tmp/bridge.$bridgename.up ]; then
|
||||
brctl addbr $bridgename
|
||||
brctl setfd $bridgename 0
|
||||
> /tmp/bridge.$bridgename.up
|
||||
fi
|
||||
brctl addif $bridgename $ethname
|
||||
ifup $bridgename
|
||||
exit 0
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
# enslave this interface to bond?
|
||||
if [ -z "$NO_BOND_MASTER" ]; then
|
||||
for i in /tmp/bond.*.info; do
|
||||
[ -e "$i" ] || continue
|
||||
unset bondslaves
|
||||
unset bondname
|
||||
. "$i"
|
||||
for slave in $bondslaves ; do
|
||||
[ "$netif" != "$slave" ] && continue
|
||||
|
||||
# already setup
|
||||
[ -e /tmp/bond.$bondname.up ] && exit 0
|
||||
|
||||
# wait for all slaves to show up
|
||||
for slave in $bondslaves ; do
|
||||
# try to create the slave (maybe vlan or bridge)
|
||||
NO_BOND_MASTER=yes NO_AUTO_DHCP=yes ifup $slave
|
||||
|
||||
if ! ip link show dev $slave >/dev/null 2>&1; then
|
||||
# wait for the last slave to show up
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
modprobe -q -b bonding
|
||||
echo "+$bondname" > /sys/class/net/bonding_masters 2>/dev/null
|
||||
ip link set $bondname down
|
||||
|
||||
# Stolen from ifup-eth
|
||||
# add the bits to setup driver parameters here
|
||||
for arg in $bondoptions ; do
|
||||
key=${arg%%=*};
|
||||
value=${arg##*=};
|
||||
# %{value:0:1} is replaced with non-bash specific construct
|
||||
if [ "${key}" = "arp_ip_target" -a "${#value}" != "0" -a "+${value%%+*}" != "+" ]; then
|
||||
OLDIFS=$IFS;
|
||||
IFS=',';
|
||||
for arp_ip in $value; do
|
||||
echo +$arp_ip > /sys/class/net/${bondname}/bonding/$key
|
||||
done
|
||||
IFS=$OLDIFS;
|
||||
else
|
||||
echo $value > /sys/class/net/${bondname}/bonding/$key
|
||||
fi
|
||||
done
|
||||
|
||||
linkup $bondname
|
||||
|
||||
for slave in $bondslaves ; do
|
||||
cat /sys/class/net/$slave/address > /tmp/net.${bondname}.${slave}.hwaddr
|
||||
ip link set $slave down
|
||||
echo "+$slave" > /sys/class/net/$bondname/bonding/slaves
|
||||
linkup $slave
|
||||
done
|
||||
|
||||
# add the bits to setup the needed post enslavement parameters
|
||||
for arg in $bondoptions ; do
|
||||
key=${arg%%=*};
|
||||
value=${arg##*=};
|
||||
if [ "${key}" = "primary" ]; then
|
||||
echo $value > /sys/class/net/${bondname}/bonding/$key
|
||||
fi
|
||||
done
|
||||
|
||||
> /tmp/bond.$bondname.up
|
||||
|
||||
NO_BOND_MASTER=yes ifup $bondname
|
||||
exit $?
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -z "$NO_TEAM_MASTER" ]; then
|
||||
for i in /tmp/team.*.info; do
|
||||
[ -e "$i" ] || continue
|
||||
unset teammaster
|
||||
unset teamslaves
|
||||
. "$i"
|
||||
for slave in $teamslaves ; do
|
||||
[ "$netif" != "$slave" ] && continue
|
||||
|
||||
[ -e /tmp/team.$teammaster.up ] && exit 0
|
||||
|
||||
# wait for all slaves to show up
|
||||
for slave in $teamslaves ; do
|
||||
# try to create the slave (maybe vlan or bridge)
|
||||
NO_TEAM_MASTER=yes NO_AUTO_DHCP=yes ifup $slave
|
||||
|
||||
if ! ip link show dev $slave >/dev/null 2>&1; then
|
||||
# wait for the last slave to show up
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -e /tmp/team.$teammaster.up ] ; then
|
||||
# We shall only bring up those _can_ come up
|
||||
# in case of some slave is gone in active-backup mode
|
||||
working_slaves=""
|
||||
for slave in $teamslaves ; do
|
||||
ip link set $slave up 2>/dev/null
|
||||
if wait_for_if_up $slave; then
|
||||
working_slaves="$working_slaves$slave "
|
||||
fi
|
||||
done
|
||||
# Do not add slaves now
|
||||
teamd -d -U -n -N -t $teammaster -f /etc/teamd/$teammaster.conf
|
||||
for slave in $working_slaves; do
|
||||
# team requires the slaves to be down before joining team
|
||||
ip link set $slave down
|
||||
teamdctl $teammaster port add $slave
|
||||
done
|
||||
|
||||
ip link set $teammaster up
|
||||
|
||||
> /tmp/team.$teammaster.up
|
||||
NO_TEAM_MASTER=yes ifup $teammaster
|
||||
exit $?
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
# all synthetic interfaces done.. now check if the interface is available
|
||||
if ! ip link show dev $netif >/dev/null 2>&1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# disable manual ifup while netroot is set for simplifying our logic
|
||||
# in netroot case we prefer netroot to bringup $netif automaticlly
|
||||
[ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2"
|
||||
|
||||
if [ -n "$manualup" ]; then
|
||||
>/tmp/net.$netif.manualup
|
||||
rm -f /tmp/net.${netif}.did-setup
|
||||
else
|
||||
[ -e /tmp/net.${netif}.did-setup ] && exit 0
|
||||
[ -z "$DO_VLAN" ] && \
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
[ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && exit 0
|
||||
fi
|
||||
|
||||
# No ip lines default to dhcp
|
||||
ip=$(getarg ip)
|
||||
|
||||
if [ -z "$ip" ]; then
|
||||
for s in $(getargs nameserver); do
|
||||
[ -n "$s" ] || continue
|
||||
echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
||||
done
|
||||
|
||||
if [ -z "$NO_AUTO_DHCP" ] && [ -z "$ip" ]; then
|
||||
if [ "$netroot" = "dhcp6" ]; then
|
||||
do_dhcp -6
|
||||
else
|
||||
do_dhcp -4
|
||||
fi
|
||||
for s in $(getargs nameserver); do
|
||||
[ -n "$s" ] || continue
|
||||
echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
@@ -372,14 +374,8 @@ for p in $(getargs ip=); do
|
||||
[ "$use_bridge" != 'true' ] && \
|
||||
[ "$use_vlan" != 'true' ] && continue
|
||||
|
||||
# setup nameserver
|
||||
for s in "$dns1" "$dns2" $(getargs nameserver); do
|
||||
[ -n "$s" ] || continue
|
||||
echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
||||
done
|
||||
|
||||
# Store config for later use
|
||||
for i in ip srv gw mask hostname macaddr dns1 dns2; do
|
||||
for i in ip srv gw mask hostname macaddr mtu dns1 dns2; do
|
||||
eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
|
||||
done > /tmp/net.$netif.override
|
||||
|
||||
@@ -398,27 +394,34 @@ for p in $(getargs ip=); do
|
||||
done
|
||||
ret=$?
|
||||
|
||||
> /tmp/net.${netif}.up
|
||||
# setup nameserver
|
||||
for s in "$dns1" "$dns2" $(getargs nameserver); do
|
||||
[ -n "$s" ] || continue
|
||||
echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
||||
done
|
||||
|
||||
if [ -e /sys/class/net/${netif}/address ]; then
|
||||
> /tmp/net.$(cat /sys/class/net/${netif}/address).up
|
||||
fi
|
||||
if [ $ret -eq 0 ]; then
|
||||
> /tmp/net.${netif}.up
|
||||
|
||||
case $autoconf in
|
||||
dhcp|on|any|dhcp6)
|
||||
if [ -z "$DO_VLAN" ] && [ -e /sys/class/net/${netif}/address ]; then
|
||||
> /tmp/net.$(cat /sys/class/net/${netif}/address).up
|
||||
fi
|
||||
|
||||
case $autoconf in
|
||||
dhcp|on|any|dhcp6)
|
||||
;;
|
||||
*)
|
||||
if [ $ret -eq 0 ]; then
|
||||
setup_net $netif
|
||||
source_hook initqueue/online $netif
|
||||
if [ -z "$manualup" ]; then
|
||||
/sbin/netroot $netif
|
||||
*)
|
||||
if [ $ret -eq 0 ]; then
|
||||
setup_net $netif
|
||||
source_hook initqueue/online $netif
|
||||
if [ -z "$manualup" ]; then
|
||||
/sbin/netroot $netif
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
exit $ret
|
||||
fi
|
||||
done
|
||||
|
||||
# netif isn't the top stack? Then we should exit here.
|
||||
@@ -429,7 +432,7 @@ if [ -n "$DO_BOND_SETUP" -o -n "$DO_TEAM_SETUP" -o -n "$DO_VLAN_SETUP" ]; then
|
||||
fi
|
||||
|
||||
# no ip option directed at our interface?
|
||||
if [ ! -e /tmp/net.${netif}.up ]; then
|
||||
if [ -z "$NO_AUTO_DHCP" ] && [ ! -e /tmp/net.${netif}.up ]; then
|
||||
if [ -e /tmp/net.bootdev ]; then
|
||||
BOOTDEV=$(cat /tmp/net.bootdev)
|
||||
if [ "$netif" = "$BOOTDEV" ] || [ "$BOOTDEV" = "$(cat /sys/class/net/${netif}/address)" ]; then
|
||||
|
@@ -69,7 +69,7 @@ installkernel() {
|
||||
|
||||
install() {
|
||||
local _arch _i _dir
|
||||
inst_multiple ip arping dhclient sed
|
||||
inst_multiple ip arping dhclient sed awk
|
||||
inst_multiple -o ping ping6
|
||||
inst_multiple -o brctl
|
||||
inst_multiple -o teamd teamdctl teamnl
|
||||
@@ -91,6 +91,9 @@ install() {
|
||||
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
|
||||
inst_hook cleanup 10 "$moddir/kill-dhclient.sh"
|
||||
|
||||
# Special network nameing for idrac USB devs
|
||||
inst_rules 73-idrac.rules
|
||||
|
||||
# install all config files for teaming
|
||||
unset TEAM_MASTER
|
||||
unset TEAM_CONFIG
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
getargbool 0 rd.neednet && NEEDNET=1
|
||||
|
||||
@@ -14,11 +12,14 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
# Write udev rules
|
||||
{
|
||||
# bridge: attempt only the defined interface
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
IFACES="$IFACES ${bridgeslaves%% *}"
|
||||
for i in /tmp/bridge.*.info; do
|
||||
[ -e "$i" ] || continue
|
||||
unset bridgeslaves
|
||||
unset bridgename
|
||||
. "$i"
|
||||
RAW_IFACES="$RAW_IFACES $bridgeslaves"
|
||||
MASTER_IFACES="$MASTER_IFACES $bridgename"
|
||||
fi
|
||||
done
|
||||
|
||||
# bond: attempt only the defined interface (override bridge defines)
|
||||
for i in /tmp/bond.*.info; do
|
||||
@@ -27,7 +28,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
unset bondname
|
||||
. "$i"
|
||||
# It is enough to fire up only one
|
||||
IFACES="$IFACES ${bondslaves%% *}"
|
||||
RAW_IFACES="$RAW_IFACES $bondslaves"
|
||||
MASTER_IFACES="$MASTER_IFACES ${bondname}"
|
||||
done
|
||||
|
||||
@@ -36,15 +37,25 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
unset teamslaves
|
||||
unset teammaster
|
||||
. "$i"
|
||||
IFACES="$IFACES ${teamslaves}"
|
||||
RAW_IFACES="$RAW_IFACES ${teamslaves}"
|
||||
MASTER_IFACES="$MASTER_IFACES ${teammaster}"
|
||||
done
|
||||
|
||||
if [ -e /tmp/vlan.info ]; then
|
||||
. /tmp/vlan.info
|
||||
IFACES="$IFACES $phydevice"
|
||||
MASTER_IFACES="$MASTER_IFACES ${vlanname}"
|
||||
fi
|
||||
for j in /tmp/vlan.*.phy; do
|
||||
[ -e "$j" ] || continue
|
||||
unset phydevice
|
||||
read phydevice < "$j"
|
||||
RAW_IFACES="$RAW_IFACES $phydevice"
|
||||
for i in /tmp/vlan.*.${phydevice}; do
|
||||
[ -e "$i" ] || continue
|
||||
unset vlanname
|
||||
read vlanname < "$i"
|
||||
MASTER_IFACES="$MASTER_IFACES ${vlanname}"
|
||||
done
|
||||
done
|
||||
|
||||
MASTER_IFACES="$(trim "$MASTER_IFACES")"
|
||||
RAW_IFACES="$(trim "$RAW_IFACES")"
|
||||
|
||||
if [ -z "$IFACES" ]; then
|
||||
[ -e /tmp/net.ifaces ] && read IFACES < /tmp/net.ifaces
|
||||
@@ -59,10 +70,10 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
runcmd="RUN+=\"/sbin/initqueue --name ifup-\$env{INTERFACE} --unique --onetime $ifup\""
|
||||
|
||||
# We have some specific interfaces to handle
|
||||
if [ -n "$IFACES" ]; then
|
||||
if [ -n "${RAW_IFACES}${IFACES}" ]; then
|
||||
echo 'SUBSYSTEM!="net", GOTO="net_end"'
|
||||
echo 'ACTION!="add|change|move", GOTO="net_end"'
|
||||
for iface in $IFACES; do
|
||||
for iface in $IFACES $RAW_IFACES; do
|
||||
case "$iface" in
|
||||
??:??:??:??:??:??) # MAC address
|
||||
cond="ATTR{address}==\"$iface\""
|
||||
@@ -83,13 +94,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
done
|
||||
echo 'LABEL="net_end"'
|
||||
|
||||
if [ -n "$MASTER_IFACES" ]; then
|
||||
wait_ifaces=$MASTER_IFACES
|
||||
else
|
||||
wait_ifaces=$IFACES
|
||||
fi
|
||||
|
||||
for iface in $wait_ifaces; do
|
||||
for iface in $IFACES; do
|
||||
if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
|
||||
echo "[ -f /tmp/net.${iface}.did-setup ]" >$hookdir/initqueue/finished/wait-$iface.sh
|
||||
fi
|
||||
|
@@ -102,7 +102,8 @@ ifdown() {
|
||||
ip addr flush dev $netif
|
||||
echo "#empty" > /etc/resolv.conf
|
||||
rm -f -- /tmp/net.$netif.did-setup
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
[ -z "$DO_VLAN" ] && \
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
rm -f -- /tmp/net.$(cat /sys/class/net/$netif/address).did-setup
|
||||
# TODO: send "offline" uevent?
|
||||
}
|
||||
@@ -111,7 +112,8 @@ setup_net() {
|
||||
local netif="$1" f="" gw_ip="" netroot_ip="" iface="" IFACES=""
|
||||
local _p
|
||||
[ -e /tmp/net.$netif.did-setup ] && return
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
[ -z "$DO_VLAN" ] && \
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
[ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && return
|
||||
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
|
||||
[ -z "$IFACES" ] && IFACES="$netif"
|
||||
@@ -121,7 +123,7 @@ setup_net() {
|
||||
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
|
||||
# set up resolv.conf
|
||||
[ -e /tmp/net.$netif.resolv.conf ] && \
|
||||
cp -f /tmp/net.$netif.resolv.conf /etc/resolv.conf
|
||||
awk '!array[$0]++' /tmp/net.$netif.resolv.conf > /etc/resolv.conf
|
||||
[ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw
|
||||
|
||||
# add static route
|
||||
@@ -168,7 +170,8 @@ setup_net() {
|
||||
unset layer2
|
||||
|
||||
> /tmp/net.$netif.did-setup
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
[ -z "$DO_VLAN" ] && \
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
> /tmp/net.$(cat /sys/class/net/$netif/address).did-setup
|
||||
}
|
||||
|
||||
@@ -211,7 +214,7 @@ set_ifname() {
|
||||
fix_bootif() {
|
||||
local macaddr=${1}
|
||||
local IFS='-'
|
||||
macaddr=$(for i in ${macaddr} ; do echo -n $i:; done)
|
||||
macaddr=$(printf '%s:' ${macaddr})
|
||||
macaddr=${macaddr%:}
|
||||
# strip hardware type field from pxelinux
|
||||
[ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
|
||||
@@ -235,22 +238,51 @@ ibft_to_cmdline() {
|
||||
|
||||
[ -e /tmp/net.${dev}.has_ibft_config ] && continue
|
||||
|
||||
[ -e ${iface}/flags ] && flags=$(read a < ${iface}/flags; echo $a)
|
||||
# Skip invalid interfaces
|
||||
(( $flags & 1 )) || continue
|
||||
[ -e ${iface}/dhcp ] && dhcp=$(read a < ${iface}/dhcp; echo $a)
|
||||
[ -e ${iface}/origin ] && origin=$(read a < ${iface}/origin; echo $a)
|
||||
[ -e ${iface}/ip-addr ] && ip=$(read a < ${iface}/ip-addr; echo $a)
|
||||
|
||||
if [ -n "$dhcp" ]; then
|
||||
echo "ip=$dev:dhcp"
|
||||
if [ -n "$ip" ] ; then
|
||||
case "$ip" in
|
||||
*.*.*.*)
|
||||
family=ipv4
|
||||
;;
|
||||
*:*)
|
||||
family=ipv6
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ -n "$dhcp" ] || [ "$origin" -eq 3 ]; then
|
||||
if [ "$family" = "ipv6" ] ; then
|
||||
echo "ip=$dev:dhcp6"
|
||||
else
|
||||
echo "ip=$dev:dhcp"
|
||||
fi
|
||||
elif [ -e ${iface}/ip-addr ]; then
|
||||
[ -e ${iface}/ip-addr ] && ip=$(read a < ${iface}/ip-addr; echo $a)
|
||||
# skip not assigned ip adresses
|
||||
[ "$ip" = "0.0.0.0" ] && continue
|
||||
[ -e ${iface}/gateway ] && gw=$(read a < ${iface}/gateway; echo $a)
|
||||
[ "$gateway" = "0.0.0.0" ] && unset $gateway
|
||||
[ -e ${iface}/subnet-mask ] && mask=$(read a < ${iface}/subnet-mask; echo $a)
|
||||
[ -e ${iface}/prefix-len ] && prefix=$(read a < ${iface}/prefix-len; echo $a)
|
||||
[ -e ${iface}/primary-dns ] && dns1=$(read a < ${iface}/primary-dns; echo $a)
|
||||
[ "$dns1" = "0.0.0.0" ] && unset $dns1
|
||||
[ -e ${iface}/secondary-dns ] && dns2=$(read a < ${iface}/secondary-dns; echo $a)
|
||||
[ "$dns2" = "0.0.0.0" ] && unset $dns2
|
||||
[ -e ${iface}/hostname ] && hostname=$(read a < ${iface}/hostname; echo $a)
|
||||
if [ "$family" = "ipv6" ] ; then
|
||||
if [ -n "$ip" ] ; then
|
||||
ip="[$ip]"
|
||||
[ -n "$prefix" ] || prefix=64
|
||||
mask="$prefix"
|
||||
fi
|
||||
if [ -n "$gw" ] ; then
|
||||
gw="[${gw}]"
|
||||
fi
|
||||
fi
|
||||
if [ -n "$ip" ] && [ -n "$mask" ]; then
|
||||
echo "ip=$ip::$gw:$mask:$hostname:$dev:none${dns1:+:$dns1}${dns2:+:$dns2}"
|
||||
else
|
||||
@@ -406,50 +438,84 @@ ip_to_var() {
|
||||
done
|
||||
|
||||
unset ip srv gw mask hostname dev autoconf macaddr mtu dns1 dns2
|
||||
case $# in
|
||||
0) autoconf="error" ;;
|
||||
1) autoconf=$1 ;;
|
||||
2) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2 ;;
|
||||
3) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2; [ -n "$3" ] && mtu=$3 ;;
|
||||
4) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2; [ -n "$3" ] && mtu=$3; [ -n "$4" ] && macaddr=$4 ;;
|
||||
*) [ -n "$1" ] && ip=$1; [ -n "$2" ] && srv=$2; [ -n "$3" ] && gw=$3; [ -n "$4" ] && mask=$4;
|
||||
[ -n "$5" ] && hostname=$5; [ -n "$6" ] && dev=$6; [ -n "$7" ] && autoconf=$7;
|
||||
case "$8" in
|
||||
[0-9]*:*|[0-9]*.[0-9]*.[0-9]*.[0-9]*)
|
||||
dns1="$8"
|
||||
[ -n "$9" ] && dns2="$9"
|
||||
;;
|
||||
[0-9]*)
|
||||
mtu="$8"
|
||||
;;
|
||||
*)
|
||||
if [ -n "${9}" -a -n "${10}" -a -n "${11}" -a -n "${12}" -a -n "${13}" -a -n "${14}" ]; then
|
||||
macaddr="${9}:${10}:${11}:${12}:${13}:${14}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
# ip=<ipv4-address> means anaconda-style static config argument cluster:
|
||||
# ip=<ip> gateway=<gw> netmask=<nm> hostname=<host> mtu=<mtu>
|
||||
# ksdevice={link|bootif|ibft|<MAC>|<ifname>}
|
||||
if strstr "$autoconf" "*.*.*.*"; then
|
||||
ip="$autoconf"
|
||||
gw=$(getarg gateway=)
|
||||
mask=$(getarg netmask=)
|
||||
hostname=$(getarg hostname=)
|
||||
dev=$(getarg ksdevice=)
|
||||
autoconf="none"
|
||||
mtu=$(getarg mtu=)
|
||||
|
||||
# handle special values for ksdevice
|
||||
case "$dev" in
|
||||
bootif|BOOTIF) dev=$(fix_bootif $(getarg BOOTIF=)) ;;
|
||||
link) dev="" ;; # FIXME: do something useful with this
|
||||
ibft) dev="" ;; # ignore - ibft is handled elsewhere
|
||||
esac
|
||||
if [ $# -eq 0 ]; then
|
||||
autoconf="error"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ $# -eq 1 ]; then
|
||||
# format: ip={dhcp|on|any|dhcp6|auto6}
|
||||
# or
|
||||
# ip=<ipv4-address> means anaconda-style static config argument cluster
|
||||
autoconf="$1"
|
||||
|
||||
if strstr "$autoconf" "*.*.*.*"; then
|
||||
# ip=<ipv4-address> means anaconda-style static config argument cluster:
|
||||
# ip=<ip> gateway=<gw> netmask=<nm> hostname=<host> mtu=<mtu>
|
||||
# ksdevice={link|bootif|ibft|<MAC>|<ifname>}
|
||||
ip="$autoconf"
|
||||
gw=$(getarg gateway=)
|
||||
mask=$(getarg netmask=)
|
||||
hostname=$(getarg hostname=)
|
||||
dev=$(getarg ksdevice=)
|
||||
autoconf="none"
|
||||
mtu=$(getarg mtu=)
|
||||
|
||||
# handle special values for ksdevice
|
||||
case "$dev" in
|
||||
bootif|BOOTIF) dev=$(fix_bootif $(getarg BOOTIF=)) ;;
|
||||
link) dev="" ;; # FIXME: do something useful with this
|
||||
ibft) dev="" ;; # ignore - ibft is handled elsewhere
|
||||
esac
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "$2" = "dhcp" -o "$2" = "on" -o "$2" = "any" -o "$2" = "dhcp6" -o "$2" = "auto6" ]; then
|
||||
# format: ip=<interface>:{dhcp|on|any|dhcp6|auto6}[:[<mtu>][:<macaddr>]]
|
||||
[ -n "$1" ] && dev="$1"
|
||||
[ -n "$2" ] && autoconf="$2"
|
||||
[ -n "$3" ] && mtu=$3
|
||||
if [ -z "$5" ]; then
|
||||
macaddr="$4"
|
||||
else
|
||||
macaddr="${4}:${5}:${6}:${7}:${8}:${9}"
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
# format: ip=<client-IP>:[<peer>]:<gateway-IP>:<netmask>:<client_hostname>:<interface>:{none|off|dhcp|on|any|dhcp6|auto6|ibft}:[:[<mtu>][:<macaddr>]]
|
||||
|
||||
[ -n "$1" ] && ip=$1
|
||||
[ -n "$2" ] && srv=$2
|
||||
[ -n "$3" ] && gw=$3
|
||||
[ -n "$4" ] && mask=$4
|
||||
[ -n "$5" ] && hostname=$5
|
||||
[ -n "$6" ] && dev=$6
|
||||
[ -n "$7" ] && autoconf=$7
|
||||
case "$8" in
|
||||
[0-9]*:*|[0-9]*.[0-9]*.[0-9]*.[0-9]*)
|
||||
dns1="$8"
|
||||
[ -n "$9" ] && dns2="$9"
|
||||
;;
|
||||
[0-9]*)
|
||||
mtu="$8"
|
||||
if [ -n "${9}" -a -z "${10}" ]; then
|
||||
macaddr="${9}"
|
||||
elif [ -n "${9}" -a -n "${10}" -a -n "${11}" -a -n "${12}" -a -n "${13}" -a -n "${14}" ]; then
|
||||
macaddr="${9}:${10}:${11}:${12}:${13}:${14}"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if [ -n "${9}" -a -z "${10}" ]; then
|
||||
macaddr="${9}"
|
||||
elif [ -n "${9}" -a -n "${10}" -a -n "${11}" -a -n "${12}" -a -n "${13}" -a -n "${14}" ]; then
|
||||
macaddr="${9}:${10}:${11}:${12}:${13}:${14}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
|
||||
route_to_var() {
|
||||
@@ -489,8 +555,13 @@ parse_ifname_opts() {
|
||||
# udev requires MAC addresses to be lower case
|
||||
ifname_mac=$(echo $2:$3:$4:$5:$6:$7 | sed 'y/ABCDEF/abcdef/')
|
||||
;;
|
||||
21)
|
||||
# infiniband MAC addrs are 20 bytes long not 6
|
||||
ifname_if=$1
|
||||
ifname_mac=$(echo $2:$3:$4:$5:$6:$7:$8:$9:$10:$11:$12:13:$14:$15$16:$17:$18:$19:$20:$21 | sed 'y/ABCDEF/abcdef/')
|
||||
;;
|
||||
*)
|
||||
die "Invalid arguments for ifname="
|
||||
die "Invalid arguments for ifname=$1"
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -499,7 +570,7 @@ parse_ifname_opts() {
|
||||
warn "ifname=$ifname_if uses the kernel name space for interfaces"
|
||||
warn "This can fail for multiple network interfaces and is discouraged!"
|
||||
warn "Please use a custom name like \"netboot\" or \"bluesocket\""
|
||||
warn "or use biosdevname and no ifname= at all."
|
||||
warn "or use the persistent interface names from udev or biosdevname and no ifname= at all."
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -531,22 +602,20 @@ wait_for_if_up() {
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
li=$(ip -o link show up dev $1)
|
||||
if ! strstr "$li" "NO-CARRIER"; then
|
||||
if [ -n "$li" ]; then
|
||||
case "$li" in
|
||||
*\<UP*)
|
||||
return 0;;
|
||||
*\<*,UP\>*)
|
||||
return 0;;
|
||||
*\<*,UP,*\>*)
|
||||
return 0;;
|
||||
esac
|
||||
fi
|
||||
if strstr "$li" "LOWER_UP" \
|
||||
&& strstr "$li" "state UNKNOWN" \
|
||||
&& ! strstr "$li" "DORMANT"; then
|
||||
return 0
|
||||
fi
|
||||
if [ -n "$li" ]; then
|
||||
case "$li" in
|
||||
*\<UP*)
|
||||
return 0;;
|
||||
*\<*,UP\>*)
|
||||
return 0;;
|
||||
*\<*,UP,*\>*)
|
||||
return 0;;
|
||||
esac
|
||||
fi
|
||||
if strstr "$li" "LOWER_UP" \
|
||||
&& strstr "$li" "state UNKNOWN" \
|
||||
&& ! strstr "$li" "DORMANT"; then
|
||||
return 0
|
||||
fi
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
@@ -569,16 +638,34 @@ wait_for_route_ok() {
|
||||
return 1
|
||||
}
|
||||
|
||||
wait_for_ipv6_dad() {
|
||||
wait_for_ipv6_dad_link() {
|
||||
local cnt=0
|
||||
local li
|
||||
local timeout="$(getargs rd.net.timeout.ipv6dad=)"
|
||||
timeout=${timeout:-50}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
li=$(ip -6 addr show dev $1 scope link)
|
||||
strstr "$li" "tentative" || return 0
|
||||
[ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \
|
||||
&& return 0
|
||||
[ -n "$(ip -6 addr show dev "$1" scope link dadfailed)" ] \
|
||||
&& return 1
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
wait_for_ipv6_dad() {
|
||||
local cnt=0
|
||||
local timeout="$(getargs rd.net.timeout.ipv6dad=)"
|
||||
timeout=${timeout:-50}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ -z "$(ip -6 addr show dev "$1" tentative)" ] \
|
||||
&& return 0
|
||||
[ -n "$(ip -6 addr show dev "$1" dadfailed)" ] \
|
||||
&& return 1
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
@@ -587,16 +674,14 @@ wait_for_ipv6_dad() {
|
||||
|
||||
wait_for_ipv6_auto() {
|
||||
local cnt=0
|
||||
local li
|
||||
local timeout="$(getargs rd.net.timeout.ipv6auto=)"
|
||||
timeout=${timeout:-40}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
li=$(ip -6 addr show dev $1)
|
||||
if ! strstr "$li" "tentative"; then
|
||||
strstr "$li" "dynamic" && return 0
|
||||
fi
|
||||
[ -z "$(ip -6 addr show dev "$1" tentative)" ] \
|
||||
&& [ -n "$(ip -6 route list proto ra dev "$1")" ] \
|
||||
&& return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
@@ -614,7 +699,7 @@ hostname() {
|
||||
cat /proc/sys/kernel/hostname
|
||||
}
|
||||
|
||||
iface_has_link() {
|
||||
iface_has_carrier() {
|
||||
local cnt=0
|
||||
local interface="$1" flags=""
|
||||
[ -n "$interface" ] || return 2
|
||||
@@ -625,14 +710,27 @@ iface_has_link() {
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
linkup "$1"
|
||||
|
||||
li=$(ip -o link show up dev $1)
|
||||
strstr "$li" "NO-CARRIER" && _no_carrier_flag=1
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ "$(cat $interface/carrier)" = 1 ] && return 0
|
||||
if [ -n "$_no_carrier_flag" ]; then
|
||||
# NO-CARRIER flag was cleared
|
||||
strstr "$li" "NO-CARRIER" || return 0
|
||||
fi
|
||||
# double check the syscfs carrier flag
|
||||
[ -e "$interface/carrier" ] && [ "$(cat $interface/carrier)" = 1 ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
iface_has_link() {
|
||||
iface_has_carrier "$@"
|
||||
}
|
||||
|
||||
find_iface_with_link() {
|
||||
local iface_path="" iface=""
|
||||
for iface_path in /sys/class/net/*; do
|
||||
|
@@ -10,14 +10,6 @@
|
||||
# bond without parameters assumes bond=bond0:eth0,eth1:mode=balance-rr
|
||||
#
|
||||
|
||||
# return if bond already parsed
|
||||
[ -n "$bondname" ] && return
|
||||
|
||||
# Check if bond parameter is valid
|
||||
if getarg bond= >/dev/null ; then
|
||||
:
|
||||
fi
|
||||
|
||||
# We translate list of slaves to space-separated here to mwke it easier to loop over them in ifup
|
||||
# Ditto for bonding options
|
||||
parsebond() {
|
||||
@@ -28,7 +20,6 @@ parsebond() {
|
||||
v=${v#*:}
|
||||
done
|
||||
|
||||
unset bondname bondslaves bondoptions
|
||||
case $# in
|
||||
0) bondname=bond0; bondslaves="eth0 eth1" ;;
|
||||
1) bondname=$1; bondslaves="eth0 eth1" ;;
|
||||
@@ -38,14 +29,13 @@ parsebond() {
|
||||
esac
|
||||
}
|
||||
|
||||
unset bondname bondslaves bondoptions
|
||||
|
||||
# Parse bond for bondname, bondslaves, bondmode and bondoptions
|
||||
if getarg bond >/dev/null; then
|
||||
# Read bond= parameters if they exist
|
||||
bond="$(getarg bond=)"
|
||||
if [ ! "$bond" = "bond" ]; then
|
||||
parsebond "$(getarg bond=)"
|
||||
for bond in $(getargs bond=); do
|
||||
unset bondname
|
||||
unset bondslaves
|
||||
unset bondoptions
|
||||
if [ "$bond" != "bond" ]; then
|
||||
parsebond "$bond"
|
||||
fi
|
||||
# Simple default bond
|
||||
if [ -z "$bondname" ]; then
|
||||
@@ -57,5 +47,4 @@ if getarg bond >/dev/null; then
|
||||
echo "bondname=$bondname" > /tmp/bond.${bondname}.info
|
||||
echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.${bondname}.info
|
||||
echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.${bondname}.info
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Format:
|
||||
# bridge=<bridgename>:<bridgeslaves>
|
||||
@@ -9,14 +7,6 @@
|
||||
# bridge without parameters assumes bridge=br0:eth0
|
||||
#
|
||||
|
||||
# return if bridge already parsed
|
||||
[ -n "$bridgename" ] && return
|
||||
|
||||
# Check if bridge parameter is valid
|
||||
if getarg bridge= >/dev/null ; then
|
||||
command -v brctl >/dev/null 2>&1 || die "No 'brctl' installed"
|
||||
fi
|
||||
|
||||
parsebridge() {
|
||||
local v=${1}:
|
||||
set --
|
||||
@@ -24,8 +14,6 @@ parsebridge() {
|
||||
set -- "$@" "${v%%:*}"
|
||||
v=${v#*:}
|
||||
done
|
||||
|
||||
unset bridgename bridgeslaves
|
||||
case $# in
|
||||
0) bridgename=br0; bridgeslaves=$iface ;;
|
||||
1) die "bridge= requires two parameters" ;;
|
||||
@@ -34,14 +22,13 @@ parsebridge() {
|
||||
esac
|
||||
}
|
||||
|
||||
unset bridgename bridgeslaves
|
||||
|
||||
iface=eth0
|
||||
|
||||
# Parse bridge for bridgename and bridgeslaves
|
||||
if bridge="$(getarg bridge)"; then
|
||||
for bridge in $(getargs bridge=); do
|
||||
unset bridgename
|
||||
unset bridgeslaves
|
||||
iface=eth0
|
||||
# Read bridge= parameters if they exist
|
||||
if [ -n "$bridge" ]; then
|
||||
if [ "$bridge" != "bridge" ]; then
|
||||
parsebridge $bridge
|
||||
fi
|
||||
# Simple default bridge
|
||||
@@ -49,7 +36,6 @@ if bridge="$(getarg bridge)"; then
|
||||
bridgename=br0
|
||||
bridgeslaves=$iface
|
||||
fi
|
||||
echo "bridgename=$bridgename" > /tmp/bridge.info
|
||||
echo "bridgeslaves=\"$bridgeslaves\"" >> /tmp/bridge.info
|
||||
return
|
||||
fi
|
||||
echo "bridgename=$bridgename" > /tmp/bridge.${bridgename}.info
|
||||
echo "bridgeslaves=\"$bridgeslaves\"" >> /tmp/bridge.${bridgename}.info
|
||||
done
|
||||
|
@@ -38,10 +38,12 @@ unset count
|
||||
# If needed, check if bootdev= contains anything usable
|
||||
BOOTDEV=$(getarg bootdev=)
|
||||
|
||||
if [ -n "$NEEDBOOTDEV" ] && getargbool 1 rd.neednet; then
|
||||
if [ -n "$NEEDBOOTDEV" ] && ! getargbool 0 rd.neednet; then
|
||||
#[ -z "$BOOTDEV" ] && warn "Please supply bootdev argument for multiple ip= lines"
|
||||
echo "rd.neednet=1" > /etc/cmdline.d/dracut-neednet.conf
|
||||
info "Multiple ip= arguments: assuming rd.neednet=1"
|
||||
else
|
||||
unset NEEDBOOTDEV
|
||||
fi
|
||||
|
||||
# Check ip= lines
|
||||
@@ -50,17 +52,14 @@ for p in $(getargs ip=); do
|
||||
ip_to_var $p
|
||||
|
||||
# make first device specified the BOOTDEV
|
||||
if [ -z "$BOOTDEV" ] && [ -n "$dev" ]; then
|
||||
if [ -n "$NEEDBOOTDEV" ] && [ -z "$BOOTDEV" ] && [ -n "$dev" ]; then
|
||||
BOOTDEV="$dev"
|
||||
[ -n "$NEEDBOOTDEV" ] && info "Setting bootdev to '$BOOTDEV'"
|
||||
info "Setting bootdev to '$BOOTDEV'"
|
||||
fi
|
||||
|
||||
# skip ibft since we did it above
|
||||
[ "$autoconf" = "ibft" ] && continue
|
||||
|
||||
# We need to have an ip= line for the specified bootdev
|
||||
[ -n "$NEEDBOOTDEV" ] && [ "$dev" = "$BOOTDEV" ] && BOOTDEVOK=1
|
||||
|
||||
# Empty autoconf defaults to 'dhcp'
|
||||
if [ -z "$autoconf" ] ; then
|
||||
warn "Empty autoconf values default to dhcp"
|
||||
@@ -80,8 +79,8 @@ for p in $(getargs ip=); do
|
||||
;;
|
||||
auto6);;
|
||||
dhcp|dhcp6|on|any) \
|
||||
[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
|
||||
die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
|
||||
#[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
|
||||
# die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
|
||||
[ -n "$ip" ] && \
|
||||
die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoopt'"
|
||||
;;
|
||||
|
@@ -6,14 +6,6 @@
|
||||
# teamslaves is a comma-separated list of physical (ethernet) interfaces
|
||||
#
|
||||
|
||||
# return if team already parsed
|
||||
[ -n "$teammaster" ] && return
|
||||
|
||||
# Check if team parameter is valid
|
||||
if getarg team= >/dev/null ; then
|
||||
:
|
||||
fi
|
||||
|
||||
parseteam() {
|
||||
local v=${1}:
|
||||
set --
|
||||
@@ -22,33 +14,22 @@ parseteam() {
|
||||
v=${v#*:}
|
||||
done
|
||||
|
||||
unset teammaster teamslaves
|
||||
case $# in
|
||||
2) teammaster=$1; teamslaves=$(str_replace "$2" "," " ") ;;
|
||||
*) warn "team= requires two parameters"; return 1;;
|
||||
2) teammaster=$1; teamslaves=$(str_replace "$2" "," " ") ;;
|
||||
*) die "team= requires two parameters" ;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
|
||||
unset teammaster teamslaves
|
||||
|
||||
if getarg team>/dev/null; then
|
||||
# Read team= parameters if they exist
|
||||
for team in $(getargs team); do
|
||||
[ "$team" = "team" ] && continue
|
||||
for team in $(getargs team=); do
|
||||
unset teammaster teamslaves
|
||||
parseteam "$(getarg team=)"
|
||||
|
||||
unset teammaster
|
||||
unset teamslaves
|
||||
|
||||
parseteam "$team" || continue
|
||||
|
||||
echo "teammaster=$teammaster" > /tmp/team.${teammaster}.info
|
||||
echo "teamslaves=\"$teamslaves\"" >> /tmp/team.${teammaster}.info
|
||||
|
||||
if ! [ -e /etc/teamd/${teammaster}.conf ]; then
|
||||
warn "Team master $teammaster specified, but no /etc/teamd/$teammaster.conf present. Using activebackup."
|
||||
mkdir -p /etc/teamd
|
||||
printf -- "%s" '{"runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}}' > "/etc/teamd/${teammaster}.conf"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
echo "teammaster=$teammaster" > /tmp/team.${teammaster}.info
|
||||
echo "teamslaves=\"$teamslaves\"" >> /tmp/team.${teammaster}.info
|
||||
if ! [ -e /etc/teamd/${teammaster}.conf ]; then
|
||||
warn "Team master $teammaster specified, but no /etc/teamd/$teammaster.conf present. Using activebackup."
|
||||
mkdir -p /etc/teamd
|
||||
printf -- "%s" '{"runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}}' > "/etc/teamd/${teammaster}.conf"
|
||||
fi
|
||||
done
|
||||
|
@@ -4,14 +4,6 @@
|
||||
# vlan=<vlanname>:<phydevice>
|
||||
#
|
||||
|
||||
# return if vlan already parsed
|
||||
[ -n "$vlanname" ] && return
|
||||
|
||||
# Check if vlan parameter is valid
|
||||
if getarg vlan= >/dev/null ; then
|
||||
:
|
||||
fi
|
||||
|
||||
parsevlan() {
|
||||
local v=${1}:
|
||||
set --
|
||||
@@ -27,16 +19,11 @@ parsevlan() {
|
||||
esac
|
||||
}
|
||||
|
||||
unset vlanname phydevice
|
||||
for vlan in $(getargs vlan=); do
|
||||
unset vlanname
|
||||
unset phydevice
|
||||
parsevlan "$vlan"
|
||||
|
||||
if getarg vlan >/dev/null; then
|
||||
# Read vlan= parameters if they exist
|
||||
vlan="$(getarg vlan=)"
|
||||
if [ ! "$vlan" = "vlan" ]; then
|
||||
parsevlan "$(getarg vlan=)"
|
||||
fi
|
||||
|
||||
echo "vlanname=\"$vlanname\"" > /tmp/vlan.info
|
||||
echo "phydevice=\"$phydevice\"" >> /tmp/vlan.info
|
||||
return
|
||||
fi
|
||||
echo "$phydevice" > /tmp/vlan.${phydevice}.phy
|
||||
echo "$vlanname" > /tmp/vlan.${vlanname}.${phydevice}
|
||||
done
|
||||
|
@@ -7,14 +7,6 @@ type is_persistent_ethernet_name >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
|
||||
udevadm settle --timeout=30
|
||||
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
fi
|
||||
|
||||
if [ -e /tmp/vlan.info ]; then
|
||||
. /tmp/vlan.info
|
||||
fi
|
||||
|
||||
mkdir -m 0755 -p /tmp/ifcfg/
|
||||
mkdir -m 0755 -p /tmp/ifcfg-leases/
|
||||
|
||||
@@ -24,7 +16,7 @@ get_config_line_by_subchannel()
|
||||
local line
|
||||
|
||||
CHANNELS="$1"
|
||||
while read line; do
|
||||
while read line || [ -n "$line" ]; do
|
||||
if strstr "$line" "$CHANNELS"; then
|
||||
echo $line
|
||||
return 0
|
||||
@@ -50,7 +42,7 @@ print_s390() {
|
||||
for i in /sys/class/net/$_netif/device/cdev[0-9]*; do
|
||||
[ -e $i ] || continue
|
||||
channel=$(readlink -f $i)
|
||||
echo -n "${channel##*/},"
|
||||
printf '%s' "${channel##*/},"
|
||||
done
|
||||
})
|
||||
[ -n "$SUBCHANNELS" ] || return 1
|
||||
@@ -132,6 +124,8 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
unset bondslaves
|
||||
unset bondname
|
||||
unset bondoptions
|
||||
unset bridgename
|
||||
unset bridgeslaves
|
||||
unset uuid
|
||||
unset ip
|
||||
unset gw
|
||||
@@ -141,9 +135,12 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
unset slave
|
||||
unset ethname
|
||||
unset vlan
|
||||
unset phydevice
|
||||
|
||||
[ -e /tmp/bond.${netif}.info ] && . /tmp/bond.${netif}.info
|
||||
[ -e /tmp/bridge.${netif}.info ] && . /tmp/bridge.${netif}.info
|
||||
[ -e /tmp/team.${netif}.info ] && . /tmp/team.${netif}.info
|
||||
[ -e /tmp/net.${netif}.override ] && . /tmp/net.${netif}.override
|
||||
|
||||
uuid=$(cat /proc/sys/kernel/random/uuid)
|
||||
if [ "$netif" = "$bridgename" ]; then
|
||||
@@ -151,11 +148,17 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
elif [ "$netif" = "$teammaster" ]; then
|
||||
team=yes
|
||||
elif [ "$netif" = "$bondname" ]; then
|
||||
# $netif can't be bridge and bond at the same time
|
||||
# $netif can't be bridge and bond at the same time
|
||||
bond=yes
|
||||
fi
|
||||
if [ "$netif" = "$vlanname" ]; then
|
||||
vlan=yes
|
||||
|
||||
if ! [ -e /tmp/vlan.${netif}.phy ]; then
|
||||
for i in /tmp/vlan.${netif}.*; do
|
||||
[ ! -e "$i" ] && continue
|
||||
phydevice=${i##/tmp/vlan.${netif}.}
|
||||
vlan=yes
|
||||
break
|
||||
done
|
||||
fi
|
||||
|
||||
# skip team interfaces for now, the host config must be in sync
|
||||
@@ -178,8 +181,6 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
fi
|
||||
cp /tmp/dhclient.$netif.lease /tmp/ifcfg-leases/dhclient-$uuid-$netif.lease
|
||||
else
|
||||
# If we've booted with static ip= lines, the override file is there
|
||||
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
|
||||
if strstr "$ip" '*:*:*'; then
|
||||
echo "IPV6INIT=yes"
|
||||
echo "IPV6_AUTOCONF=no"
|
||||
@@ -209,10 +210,7 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
# bridge needs different things written to ifcfg
|
||||
if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ] && [ -z "$team" ]; then
|
||||
# standard interface
|
||||
{
|
||||
echo "TYPE=Ethernet"
|
||||
[ -n "$mtu" ] && echo "MTU=\"$mtu\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
echo "TYPE=Ethernet" >> /tmp/ifcfg/ifcfg-$netif
|
||||
fi
|
||||
|
||||
if [ -n "$vlan" ] ; then
|
||||
@@ -245,7 +243,7 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
echo "MASTER=\"$netif\""
|
||||
echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
|
||||
unset macaddr
|
||||
[ -e /tmp/net.$slave.override ] && . /tmp/net.$slave.override
|
||||
[ -e /tmp/net.${slave}.override ] && . /tmp/net.${slave}.override
|
||||
interface_bind "$slave" "$macaddr"
|
||||
) >> /tmp/ifcfg/ifcfg-$slave
|
||||
done
|
||||
@@ -268,7 +266,7 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
echo "BRIDGE=\"$bridgename\""
|
||||
echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
|
||||
unset macaddr
|
||||
[ -e /tmp/net.$slave.override ] && . /tmp/net.$slave.override
|
||||
[ -e /tmp/net.${slave}.override ] && . /tmp/net.${slave}.override
|
||||
interface_bind "$slave" "$macaddr"
|
||||
) >> /tmp/ifcfg/ifcfg-$slave
|
||||
done
|
||||
|
@@ -28,7 +28,7 @@ install() {
|
||||
_crt=$(grep -F --binary-files=text -z .crt $_lib)
|
||||
[[ $_crt ]] || continue
|
||||
[[ $_crt == /*/* ]] || continue
|
||||
if ! inst_simple "$_crt"; then
|
||||
if ! inst "$_crt"; then
|
||||
dwarn "Couldn't install '$_crt' SSL CA cert bundle; HTTPS might not work."
|
||||
continue
|
||||
fi
|
||||
|
@@ -106,7 +106,7 @@ nfs_fetch_url() {
|
||||
local filepath="${path%/*}" filename="${path##*/}" mntdir=""
|
||||
|
||||
# skip mount if server:/filepath is already mounted
|
||||
mntdir=$(nfs_already_mounted "$server" "$path")
|
||||
mntdir=$(nfs_already_mounted "$server" "$filepath")
|
||||
if [ -z "$mntdir" ]; then
|
||||
local mntdir="$(mkuniqdir /run nfs_mnt)"
|
||||
mount_nfs "$nfs:$server:$filepath${options:+:$options}" "$mntdir"
|
||||
|
@@ -5,7 +5,7 @@
|
||||
installkernel() {
|
||||
if [[ -z $drivers ]]; then
|
||||
block_module_filter() {
|
||||
local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_pltfm_init'
|
||||
local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host'
|
||||
# subfunctions inherit following FDs
|
||||
local _merge=8 _side2=9
|
||||
function bmf1() {
|
||||
@@ -52,18 +52,20 @@ installkernel() {
|
||||
"=drivers/input/serio" \
|
||||
"=drivers/input/keyboard"
|
||||
|
||||
if [[ "$(uname -p)" == arm* ]]; then
|
||||
# arm specific modules
|
||||
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then
|
||||
# arm/aarch64 specific modules
|
||||
hostonly='' instmods \
|
||||
connector-hdmi connector-dvi encoder-tfp410 \
|
||||
encoder-tpd12s015 i2c-tegra gpio-regulator \
|
||||
as3722-regulator orion-ehci ehci-tegra
|
||||
instmods \
|
||||
"=drivers/dma" \
|
||||
"=drivers/i2c/busses" \
|
||||
"=drivers/regulator" \
|
||||
"=drivers/rtc" \
|
||||
"=drivers/usb/host" \
|
||||
"=drivers/usb/phy" \
|
||||
"=drivers/scsi/hisi_sas" \
|
||||
${NULL}
|
||||
fi
|
||||
|
||||
|
@@ -17,14 +17,14 @@ SNAPSIZE=$(getargs rd.lvm.snapsize -d rd_LVM_SNAPSIZE=)
|
||||
lvmdevs=$(
|
||||
for f in /tmp/.lvm_scan-*; do
|
||||
[ -e "$f" ] || continue
|
||||
echo -n "${f##/tmp/.lvm_scan-} "
|
||||
printf '%s' "${f##/tmp/.lvm_scan-} "
|
||||
done
|
||||
)
|
||||
|
||||
if [ ! -e /etc/lvm/lvm.conf ]; then
|
||||
{
|
||||
echo 'devices {';
|
||||
echo -n ' filter = [ '
|
||||
printf ' filter = [ '
|
||||
for dev in $lvmdevs; do
|
||||
printf '"a|^/dev/%s$|", ' $dev;
|
||||
done;
|
||||
|
@@ -42,6 +42,10 @@ cmdline() {
|
||||
done
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods dm-snapshot
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _i
|
||||
@@ -56,13 +60,16 @@ install() {
|
||||
inst_rules "$moddir/64-lvm.rules"
|
||||
|
||||
if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
|
||||
if [ -f /etc/lvm/lvm.conf ]; then
|
||||
inst_simple /etc/lvm/lvm.conf
|
||||
# FIXME: near-term hack to establish read-only locking;
|
||||
# use command-line lvm.conf editor once it is available
|
||||
sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 4/' ${initdir}/etc/lvm/lvm.conf
|
||||
sed -i -e 's/\(^[[:space:]]*\)use_lvmetad[[:space:]]*=[[:space:]]*[[:digit:]]/\1use_lvmetad = 0/' ${initdir}/etc/lvm/lvm.conf
|
||||
fi
|
||||
for f in /etc/lvm/lvm.conf /etc/lvm/lvm_*.conf; do
|
||||
[ -e "$f" ] || continue
|
||||
inst_simple "$f"
|
||||
if [ -f "${initdir}/$f" ]; then
|
||||
# FIXME: near-term hack to establish read-only locking;
|
||||
# use command-line lvm.conf editor once it is available
|
||||
sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 4/' "${initdir}/$f"
|
||||
sed -i -e 's/\(^[[:space:]]*\)use_lvmetad[[:space:]]*=[[:space:]]*[[:digit:]]/\1use_lvmetad = 0/' "${initdir}/$f"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if ! [[ -e ${initdir}/etc/lvm/lvm.conf ]]; then
|
||||
|
@@ -11,9 +11,10 @@ is_mpath() {
|
||||
|
||||
majmin_to_mpath_dev() {
|
||||
local _dev
|
||||
for i in `ls -1 /dev/mapper/mpath*`; do
|
||||
dev=$(get_maj_min $i)
|
||||
if [ "$dev" = "$1" ]; then
|
||||
for i in /dev/mapper/*; do
|
||||
[[ $i == /dev/mapper/control ]] && continue
|
||||
_dev=$(get_maj_min $i)
|
||||
if [ "$_dev" = "$1" ]; then
|
||||
echo $i
|
||||
return
|
||||
fi
|
||||
|
@@ -4,6 +4,14 @@
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
local _fcoe_ctlr
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for c in /sys/bus/fcoe/devices/ctlr_* ; do
|
||||
[ -L $c ] || continue
|
||||
_fcoe_ctlr=$c
|
||||
done
|
||||
[ -z "$_fcoe_ctlr" ] && return 255
|
||||
}
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
[ -d /sys/firmware/efi ] || return 255
|
||||
}
|
||||
|
@@ -13,8 +13,6 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
# Huh? Missing arguments ??
|
||||
[ -z "$1" -o -z "$2" ] && exit 1
|
||||
|
||||
export PS4="fcoe-up.$1.$$ + "
|
||||
exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
|
||||
@@ -22,6 +20,14 @@ netif=$1
|
||||
dcb=$2
|
||||
vlan="yes"
|
||||
|
||||
iflink=$(cat /sys/class/net/$netif/iflink)
|
||||
ifindex=$(cat /sys/class/net/$netif/ifindex)
|
||||
if [ "$iflink" != "$ifindex" ] ; then
|
||||
# Skip VLAN devices
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ip link set dev $netif up
|
||||
linkup "$netif"
|
||||
|
||||
netdriver=$(readlink -f /sys/class/net/$netif/device/driver)
|
||||
@@ -43,10 +49,6 @@ write_fcoemon_cfg() {
|
||||
}
|
||||
|
||||
if [ "$dcb" = "dcb" ]; then
|
||||
# Note lldpad will stay running after switchroot, the system initscripts
|
||||
# are to kill it and start a new lldpad to take over. Data is transfered
|
||||
# between the 2 using a shm segment
|
||||
lldpad -d
|
||||
# wait for lldpad to be ready
|
||||
i=0
|
||||
while [ $i -lt 60 ]; do
|
||||
@@ -56,10 +58,6 @@ if [ "$dcb" = "dcb" ]; then
|
||||
i=$(($i+1))
|
||||
done
|
||||
|
||||
# on some systems lldpad needs some time
|
||||
# sleep until we find a better solution
|
||||
sleep 30
|
||||
|
||||
while [ $i -lt 60 ]; do
|
||||
dcbtool sc "$netif" dcb on && break
|
||||
info "Retrying to turn dcb on"
|
||||
|
14
modules.d/95fcoe/lldpad.sh
Normal file
14
modules.d/95fcoe/lldpad.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Note lldpad will stay running after switchroot, the system initscripts
|
||||
# are to kill it and start a new lldpad to take over. Data is transfered
|
||||
# between the 2 using a shm segment
|
||||
lldpad -d
|
||||
# wait for lldpad to be ready
|
||||
i=0
|
||||
while [ $i -lt 60 ]; do
|
||||
lldptool -p && break
|
||||
info "Waiting for lldpad to be ready"
|
||||
sleep 1
|
||||
i=$(($i+1))
|
||||
done
|
@@ -3,7 +3,17 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
local _fcoe_ctlr
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for c in /sys/bus/fcoe/devices/ctlr_* ; do
|
||||
[ -L $c ] || continue
|
||||
_fcoe_ctlr=$c
|
||||
done
|
||||
[ -z "$_fcoe_ctlr" ] && return 255
|
||||
}
|
||||
|
||||
require_binaries dcbtool fipvlan lldpad ip readlink fcoemon fcoeadm || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -16,17 +26,62 @@ installkernel() {
|
||||
instmods fcoe 8021q edd
|
||||
}
|
||||
|
||||
get_vlan_parent() {
|
||||
local link=$1
|
||||
|
||||
[ -d $link ] || return
|
||||
read iflink < $link/iflink
|
||||
for if in /sys/class/net/* ; do
|
||||
read idx < $if/ifindex
|
||||
if [ $idx -eq $iflink ] ; then
|
||||
echo ${if##*/}
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
cmdline() {
|
||||
|
||||
for c in /sys/bus/fcoe/devices/ctlr_* ; do
|
||||
[ -L $c ] || continue
|
||||
read enabled < $c/enabled
|
||||
[ $enabled -eq 0 ] && continue
|
||||
d=$(cd -P $c; echo $PWD)
|
||||
i=${d%/*}
|
||||
read mac < ${i}/address
|
||||
s=$(dcbtool gc ${i##*/} dcb | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
|
||||
if [ -z "$s" ] ; then
|
||||
p=$(get_vlan_parent ${i})
|
||||
if [ "$p" ] ; then
|
||||
s=$(dcbtool gc ${p} dcb | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
|
||||
fi
|
||||
fi
|
||||
if [ "$s" = "on" ] ; then
|
||||
dcb="dcb"
|
||||
else
|
||||
dcb="nodcb"
|
||||
fi
|
||||
echo "fcoe=${mac}:${dcb}"
|
||||
done
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple ip dcbtool fipvlan lldpad readlink lldptool fcoemon fcoeadm
|
||||
inst_libdir_file 'libhbalinux.so*'
|
||||
inst "/etc/hba.conf" "/etc/hba.conf"
|
||||
[[ -e /etc/hba.conf ]] && inst "/etc/hba.conf" "/etc/hba.conf"
|
||||
|
||||
mkdir -m 0755 -p "$initdir/var/lib/lldpad"
|
||||
mkdir -m 0755 -p "$initdir/etc/fcoe"
|
||||
|
||||
if [[ $hostonly_cmdline == "yes" ]] ; then
|
||||
local _fcoeconf=$(cmdline)
|
||||
[[ $_fcoeconf ]] && printf "%s\n" "$_fcoeconf" >> "${initdir}/etc/cmdline.d/95fcoe.conf"
|
||||
fi
|
||||
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 pre-trigger 03 "$moddir/lldpad.sh"
|
||||
inst_hook cmdline 99 "$moddir/parse-fcoe.sh"
|
||||
inst_hook cleanup 90 "$moddir/cleanup-fcoe.sh"
|
||||
dracut_need_initqueue
|
||||
|
@@ -22,17 +22,15 @@
|
||||
|
||||
|
||||
# BRCM: Later, should check whether bnx2x is loaded first before loading bnx2fc so do not load bnx2fc when there are no Broadcom adapters
|
||||
[ -e /sys/bus/fcoe/ctlr_create ] || modprobe -a fcoe || die "FCoE requested but kernel/initrd does not support FCoE"
|
||||
[ -e /sys/bus/fcoe/ctlr_create ] || modprobe -b -a fcoe || die "FCoE requested but kernel/initrd does not support FCoE"
|
||||
|
||||
modprobe bnx2fc >/dev/null 2>&1
|
||||
udevadm settle --timeout=30
|
||||
|
||||
# FCoE actually supported?
|
||||
[ -e /sys/bus/fcoe/ctlr_create ] || modprobe fcoe || die "FCoE requested but kernel/initrd does not support FCoE"
|
||||
initqueue --onetime modprobe -b -q bnx2fc
|
||||
|
||||
parse_fcoe_opts() {
|
||||
local OLDIFS="$IFS"
|
||||
local IFS=:
|
||||
set $fcoe
|
||||
IFS="$OLDIFS"
|
||||
|
||||
case $# in
|
||||
2)
|
||||
|
@@ -78,23 +78,23 @@ handle_netroot()
|
||||
|
||||
# override conf settings by command line options
|
||||
arg=$(getargs rd.iscsi.initiator -d iscsi_initiator=)
|
||||
[ -n "$arg" ] && iscsi_initiator=$arg
|
||||
[ -n "$arg" ] && iscsi_initiator="$arg"
|
||||
arg=$(getargs rd.iscsi.target.name -d iscsi_target_name=)
|
||||
[ -n "$arg" ] && iscsi_target_name=$arg
|
||||
[ -n "$arg" ] && iscsi_target_name="$arg"
|
||||
arg=$(getargs rd.iscsi.target.ip -d iscsi_target_ip)
|
||||
[ -n "$arg" ] && iscsi_target_ip=$arg
|
||||
[ -n "$arg" ] && iscsi_target_ip="$arg"
|
||||
arg=$(getargs rd.iscsi.target.port -d iscsi_target_port=)
|
||||
[ -n "$arg" ] && iscsi_target_port=$arg
|
||||
[ -n "$arg" ] && iscsi_target_port="$arg"
|
||||
arg=$(getargs rd.iscsi.target.group -d iscsi_target_group=)
|
||||
[ -n "$arg" ] && iscsi_target_group=$arg
|
||||
[ -n "$arg" ] && iscsi_target_group="$arg"
|
||||
arg=$(getargs rd.iscsi.username -d iscsi_username=)
|
||||
[ -n "$arg" ] && iscsi_username=$arg
|
||||
[ -n "$arg" ] && iscsi_username="$arg"
|
||||
arg=$(getargs rd.iscsi.password -d iscsi_password)
|
||||
[ -n "$arg" ] && iscsi_password=$arg
|
||||
[ -n "$arg" ] && iscsi_password="$arg"
|
||||
arg=$(getargs rd.iscsi.in.username -d iscsi_in_username=)
|
||||
[ -n "$arg" ] && iscsi_in_username=$arg
|
||||
[ -n "$arg" ] && iscsi_in_username="$arg"
|
||||
arg=$(getargs rd.iscsi.in.password -d iscsi_in_password=)
|
||||
[ -n "$arg" ] && iscsi_in_password=$arg
|
||||
[ -n "$arg" ] && iscsi_in_password="$arg"
|
||||
for p in $(getargs rd.iscsi.param -d iscsi_param); do
|
||||
iscsi_param="$iscsi_param --param $p"
|
||||
done
|
||||
@@ -109,9 +109,9 @@ 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 ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then
|
||||
if [ -z "$iscsi_initiator" ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then
|
||||
iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
|
||||
echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
|
||||
rm -f /etc/iscsi/initiatorname.iscsi
|
||||
@@ -122,14 +122,14 @@ handle_netroot()
|
||||
> /tmp/iscsi_set_initiator
|
||||
fi
|
||||
|
||||
if [ -z $iscsi_initiator ]; then
|
||||
if [ -z "$iscsi_initiator" ]; then
|
||||
[ -f /run/initiatorname.iscsi ] && . /run/initiatorname.iscsi
|
||||
[ -f /etc/initiatorname.iscsi ] && . /etc/initiatorname.iscsi
|
||||
[ -f /etc/iscsi/initiatorname.iscsi ] && . /etc/iscsi/initiatorname.iscsi
|
||||
iscsi_initiator=$InitiatorName
|
||||
fi
|
||||
|
||||
if [ -z $iscsi_initiator ]; then
|
||||
if [ -z "$iscsi_initiator" ]; then
|
||||
iscsi_initiator=$(iscsi-iname)
|
||||
echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
|
||||
rm -f /etc/iscsi/initiatorname.iscsi
|
||||
@@ -182,17 +182,18 @@ handle_netroot()
|
||||
if [ "$status" != "activating" ] && ! systemctl is-failed "$netroot_enc" >/dev/null 2>&1; then
|
||||
systemd-run --service-type=oneshot --remain-after-exit --quiet \
|
||||
--description="Login iSCSI Target $iscsi_target_name" \
|
||||
-p 'DefaultDependencies=no' \
|
||||
--unit="$netroot_enc" -- \
|
||||
$(command -v 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} \
|
||||
-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_param} >/dev/null 2>&1 \
|
||||
&& { > $hookdir/initqueue/work ; }
|
||||
else
|
||||
@@ -201,15 +202,15 @@ handle_netroot()
|
||||
fi
|
||||
fi
|
||||
else
|
||||
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} \
|
||||
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_param} \
|
||||
&& { > $hookdir/initqueue/work ; }
|
||||
fi
|
||||
|
@@ -29,6 +29,46 @@ check() {
|
||||
return 0
|
||||
}
|
||||
|
||||
get_ibft_mod() {
|
||||
local ibft_mac=$1
|
||||
local iface_mac iface_mod
|
||||
# Return the iSCSI offload module for a given MAC address
|
||||
for iface_desc in $(iscsiadm -m iface | cut -f 2 -d ' '); do
|
||||
iface_mod=${iface_desc%%,*}
|
||||
iface_mac=${iface_desc#*,}
|
||||
iface_mac=${iface_mac%%,*}
|
||||
if [ "$ibft_mac" = "$iface_mac" ] ; then
|
||||
echo $iface_mod
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
install_ibft() {
|
||||
# When iBFT / iscsi_boot is detected:
|
||||
# - Use 'ip=ibft' to set up iBFT network interface
|
||||
# Note: bnx2i is using a different MAC address of iSCSI offloading
|
||||
# so the 'ip=ibft' parameter must not be set
|
||||
# - specify firmware booting cmdline parameter
|
||||
|
||||
for d in /sys/firmware/* ; do
|
||||
if [ -d ${d}/ethernet0 ] ; then
|
||||
read ibft_mac < ${d}/ethernet0/mac
|
||||
ibft_mod=$(get_ibft_mod $ibft_mac)
|
||||
fi
|
||||
if [ -z "$ibft_mod" ] && [ -d ${d}/ethernet1 ] ; then
|
||||
read ibft_mac < ${d}/ethernet1/mac
|
||||
ibft_mod=$(get_ibft_mod $ibft_mac)
|
||||
fi
|
||||
if [ -d ${d}/initiator ] ; then
|
||||
if [ ${d##*/} = "ibft" ] && [ "$ibft_mod" != "bnx2i" ] ; then
|
||||
echo -n "ip=ibft "
|
||||
fi
|
||||
echo -n "rd.iscsi.firmware=1"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
depends() {
|
||||
echo network rootfs-block
|
||||
}
|
||||
@@ -75,9 +115,22 @@ installkernel() {
|
||||
| iscsi_module_filter | instmods
|
||||
}
|
||||
|
||||
cmdline() {
|
||||
install_ibft
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple umount iscsistart hostname iscsi-iname
|
||||
inst_multiple -o iscsiuio
|
||||
inst_libdir_file 'libgcc_s.so*'
|
||||
|
||||
# Detect iBFT and perform mandatory steps
|
||||
if [[ $hostonly_cmdline == "yes" ]] ; then
|
||||
local _ibftconf=$(install_ibft)
|
||||
[[ $_ibftconf ]] && printf "%s\n" "$_ibftconf" >> "${initdir}/etc/cmdline.d/95iscsi.conf"
|
||||
fi
|
||||
|
||||
inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
|
||||
inst_hook cleanup 90 "$moddir/cleanup-iscsi.sh"
|
||||
inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"
|
||||
|
@@ -89,16 +89,11 @@ if [ -z "$netroot" ] || ! [ "${netroot%%:*}" = "iscsi" ]; then
|
||||
fi
|
||||
|
||||
initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT"
|
||||
|
||||
modprobe -b -q qla4xxx
|
||||
modprobe -b -q cxgb3i
|
||||
modprobe -b -q cxgb4i
|
||||
modprobe -b -q bnx2i
|
||||
modprobe -b -q be2iscsi
|
||||
initqueue --onetime modprobe --all -b -q qla4xxx cxgb3i cxgb4i bnx2i be2iscsi
|
||||
|
||||
# ISCSI actually supported?
|
||||
if ! [ -e /sys/module/iscsi_tcp ]; then
|
||||
modprobe -q iscsi_tcp || die "iscsiroot requested but kernel/initrd does not support iscsi"
|
||||
modprobe -b -q iscsi_tcp || die "iscsiroot requested but kernel/initrd does not support iscsi"
|
||||
fi
|
||||
|
||||
if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; then
|
||||
|
@@ -4,8 +4,6 @@
|
||||
|
||||
check() {
|
||||
local _rootdev
|
||||
# If our prerequisites are not met, fail.
|
||||
require_binaries nbd-client || return 1
|
||||
|
||||
# if an nbd device is not somewhere in the chain of devices root is
|
||||
# mounted on, fail the hostonly check.
|
||||
@@ -16,6 +14,7 @@ check() {
|
||||
[[ -b /dev/block/$_rootdev ]] || return 1
|
||||
check_block_and_slaves is_nbd "$_rootdev" || return 255
|
||||
}
|
||||
require_binaries nbd-client || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ depends() {
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods nfs sunrpc ipv6 nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files
|
||||
hostonly='' instmods =net/sunrpc =fs/nfs ipv6 nfs_acl nfs_layout_nfsv41_files
|
||||
}
|
||||
|
||||
install() {
|
||||
|
@@ -44,10 +44,17 @@ inst_sshenv()
|
||||
if [[ -f /etc/ssh/ssh_config ]]; then
|
||||
inst_simple /etc/ssh/ssh_config
|
||||
sed -i -e 's/\(^[[:space:]]*\)ProxyCommand/\1# ProxyCommand/' ${initdir}/etc/ssh/ssh_config
|
||||
while read key val; do
|
||||
[[ $key != "GlobalKnownHostsFile" ]] && continue
|
||||
inst_simple "$val"
|
||||
break
|
||||
while read key val || [ -n "$key" ]; do
|
||||
if [[ $key == "GlobalKnownHostsFile" ]]; then
|
||||
inst_simple "$val"
|
||||
# Copy customized UserKnowHostsFile
|
||||
elif [[ $key == "UserKnownHostsFile" ]]; then
|
||||
# Make sure that ~/foo will be copied as /root/foo in kdump's initramfs
|
||||
if str_starts "$val" "~/"; then
|
||||
val="/root/${val#"~/"}"
|
||||
fi
|
||||
inst_simple "$val"
|
||||
fi
|
||||
done < /etc/ssh/ssh_config
|
||||
fi
|
||||
|
||||
|
@@ -27,6 +27,7 @@ install() {
|
||||
fi
|
||||
|
||||
inst_rules \
|
||||
40-redhat-cpu-hotplug.rules \
|
||||
40-redhat.rules \
|
||||
50-firmware.rules \
|
||||
50-udev-default.rules \
|
||||
|
@@ -37,5 +37,10 @@ installkernel() {
|
||||
|
||||
install() {
|
||||
inst_hook cmdline 95 "$moddir/parse-virtfs.sh"
|
||||
inst_hook mount 99 "$moddir/mount-virtfs.sh"
|
||||
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook mount 99 "$moddir/mount-virtfs.sh"
|
||||
else
|
||||
inst_script "$moddir/virtfs-generator.sh" $systemdutildir/system-generators/dracut-virtfs-generator
|
||||
fi
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if [ "${root%%:*}" = "virtfs" ] ; then
|
||||
modprobe 9pnet_virtio
|
||||
initqueue --onetime modprobe -b -q 9pnet_virtio
|
||||
|
||||
rootok=1
|
||||
fi
|
||||
|
39
modules.d/95virtfs/virtfs-generator.sh
Executable file
39
modules.d/95virtfs/virtfs-generator.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/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
|
||||
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
|
||||
[ "${root%%:*}" = "virtfs" ] || exit 0
|
||||
|
||||
GENERATOR_DIR="$2"
|
||||
[ -z "$GENERATOR_DIR" ] && exit 1
|
||||
|
||||
[ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR"
|
||||
|
||||
ROOTFLAGS=$(getarg rootflags=) || ROOTFLAGS="trans=virtio,version=9p2000.L"
|
||||
ROOTFSTYPE=$(getarg rootfstype=) || ROOTFSTYPE="9p"
|
||||
|
||||
root=${root#virtfs:}
|
||||
|
||||
if getarg "ro"; then
|
||||
if [ -n "$ROOTFLAGS" ]; then
|
||||
ROOTFLAGS="$ROOTFLAGS,ro"
|
||||
else
|
||||
ROOTFLAGS="ro"
|
||||
fi
|
||||
fi
|
||||
|
||||
{
|
||||
echo "[Unit]"
|
||||
echo "Before=initrd-root-fs.target"
|
||||
echo "[Mount]"
|
||||
echo "Where=/sysroot"
|
||||
echo "What=${root}"
|
||||
[ -n "$ROOTFSTYPE" ] && echo "Type=${ROOTFSTYPE}"
|
||||
[ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}"
|
||||
} > "$GENERATOR_DIR"/sysroot.mount
|
||||
|
||||
exit 0
|
@@ -15,6 +15,7 @@ After=systemd-journald.socket
|
||||
Wants=systemd-journald.socket
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
ConditionKernelCommandLine=rd.cmdline=ask
|
||||
Conflicts=shutdown.target emergency.target
|
||||
|
||||
[Service]
|
||||
Environment=DRACUT_SYSTEMD=1
|
||||
|
@@ -20,6 +20,7 @@ ConditionDirectoryNotEmpty=|/lib/dracut/hooks/cmdline
|
||||
ConditionKernelCommandLine=|rd.break=cmdline
|
||||
ConditionKernelCommandLine=|resume
|
||||
ConditionKernelCommandLine=|noresume
|
||||
Conflicts=shutdown.target emergency.target
|
||||
|
||||
[Service]
|
||||
Environment=DRACUT_SYSTEMD=1
|
||||
|
@@ -22,7 +22,12 @@ getargbool 0 rd.udev.log-priority=debug -d rd.udev.debug -d -n -y rdudevdebug &&
|
||||
|
||||
source_conf /etc/conf.d
|
||||
|
||||
root=$(getarg root=)
|
||||
# Get the "root=" parameter from the kernel command line, but differentiate
|
||||
# between the case where it was set to the empty string and the case where it
|
||||
# wasn't specified at all.
|
||||
if ! root="$(getarg root=)"; then
|
||||
root_unset='UNSET'
|
||||
fi
|
||||
|
||||
rflags="$(getarg rootflags=)"
|
||||
getargbool 0 ro && rflags="${rflags},ro"
|
||||
@@ -38,14 +43,14 @@ export root
|
||||
export rflags
|
||||
export fstype
|
||||
|
||||
make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab'
|
||||
make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab' '4+:komem'
|
||||
# run scriptlets to parse the command line
|
||||
getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline"
|
||||
source_hook cmdline
|
||||
|
||||
[ -f /lib/dracut/parse-resume.sh ] && . /lib/dracut/parse-resume.sh
|
||||
|
||||
case "$root" in
|
||||
case "${root}${root_unset}" in
|
||||
block:LABEL=*|LABEL=*)
|
||||
root="${root#block:}"
|
||||
root="$(echo $root | sed 's,/,\\x2f,g')"
|
||||
@@ -66,11 +71,16 @@ case "$root" in
|
||||
/dev/*)
|
||||
root="block:${root}"
|
||||
rootok=1 ;;
|
||||
UNSET|gpt-auto)
|
||||
# systemd's gpt-auto-generator handles this case.
|
||||
rootok=1 ;;
|
||||
esac
|
||||
|
||||
[ -z "$root" ] && die "No or empty root= argument"
|
||||
[ -z "${root}${root_unset}" ] && die "Empty root= argument"
|
||||
[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"
|
||||
|
||||
[ "$root" = "UNSET" ] && unset root
|
||||
|
||||
export root rflags fstype netroot NEWROOT
|
||||
|
||||
export -p > /dracut-state.sh
|
||||
|
@@ -12,8 +12,8 @@ Description=Dracut Emergency Shell
|
||||
DefaultDependencies=no
|
||||
After=systemd-vconsole-setup.service
|
||||
Wants=systemd-vconsole-setup.service
|
||||
Conflicts=emergency.service emergency.target
|
||||
ConditionPathExists=!/lib/dracut/no-emergency-shell
|
||||
Conflicts=shutdown.target emergency.target
|
||||
|
||||
[Service]
|
||||
Environment=HOME=/
|
||||
|
@@ -16,6 +16,7 @@ export _rdshell_name="dracut" action="Boot" hook="emergency"
|
||||
|
||||
source_hook "$hook"
|
||||
|
||||
_emergency_action=$(getarg rd.emergency)
|
||||
|
||||
if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
|
||||
echo
|
||||
@@ -33,9 +34,18 @@ if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
|
||||
exec sh -i -l
|
||||
else
|
||||
warn "$action has failed. To debug this issue add \"rd.shell rd.debug\" to the kernel command line."
|
||||
exit 1
|
||||
[ -z "$_emergency_action" ] && _emergency_action=halt
|
||||
fi
|
||||
|
||||
/bin/rm -f -- /.console_lock
|
||||
|
||||
case "$_emergency_action" in
|
||||
reboot)
|
||||
reboot || exit 1;;
|
||||
poweroff)
|
||||
poweroff || exit 1;;
|
||||
halt)
|
||||
halt || exit 1;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
@@ -23,6 +23,7 @@ ConditionPathExistsGlob=|/lib/dracut/hooks/initqueue/finished/*.sh
|
||||
ConditionPathExistsGlob=|/lib/dracut/hooks/initqueue/online/*.sh
|
||||
ConditionPathExistsGlob=|/lib/dracut/hooks/initqueue/timeout/*.sh
|
||||
ConditionKernelCommandLine=|rd.break=initqueue
|
||||
Conflicts=shutdown.target emergency.target
|
||||
|
||||
[Service]
|
||||
Environment=DRACUT_SYSTEMD=1
|
||||
|
@@ -15,6 +15,7 @@ After=dracut-initqueue.service dracut-pre-mount.service
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/mount
|
||||
ConditionKernelCommandLine=|rd.break=mount
|
||||
Conflicts=shutdown.target emergency.target
|
||||
|
||||
[Service]
|
||||
Environment=DRACUT_SYSTEMD=1
|
||||
|
@@ -17,6 +17,7 @@ After=cryptsetup.target
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-mount
|
||||
ConditionKernelCommandLine=|rd.break=pre-mount
|
||||
Conflicts=shutdown.target emergency.target
|
||||
|
||||
[Service]
|
||||
Environment=DRACUT_SYSTEMD=1
|
||||
|
@@ -9,7 +9,7 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
source_conf /etc/conf.d
|
||||
|
||||
make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab'
|
||||
make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab' '4+:komem'
|
||||
# pre pivot scripts are sourced just before we doing cleanup and switch over
|
||||
# to the new root.
|
||||
getarg 'rd.break=pre-mount' 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
|
||||
|
@@ -16,6 +16,7 @@ Before=initrd-cleanup.service
|
||||
Wants=remote-fs.target
|
||||
After=remote-fs.target
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
Conflicts=shutdown.target emergency.target
|
||||
|
||||
[Service]
|
||||
Environment=DRACUT_SYSTEMD=1
|
||||
|
@@ -10,12 +10,13 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
source_conf /etc/conf.d
|
||||
|
||||
make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab'
|
||||
make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab' '4+:komem'
|
||||
# pre pivot scripts are sourced just before we doing cleanup and switch over
|
||||
# to the new root.
|
||||
getarg 'rd.break=pre-pivot' 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot"
|
||||
source_hook pre-pivot
|
||||
|
||||
cleanup_trace_mem
|
||||
# pre pivot cleanup scripts are sourced just before we switch over to the new root.
|
||||
getarg 'rd.break=cleanup' 'rdbreak=cleanup' && emergency_shell -n cleanup "Break cleanup"
|
||||
source_hook cleanup
|
||||
|
@@ -17,6 +17,7 @@ Wants=dracut-pre-udev.service systemd-udevd.service
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-trigger
|
||||
ConditionKernelCommandLine=|rd.break=pre-trigger
|
||||
Conflicts=shutdown.target emergency.target
|
||||
|
||||
[Service]
|
||||
Environment=DRACUT_SYSTEMD=1
|
||||
|
@@ -10,7 +10,7 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
source_conf /etc/conf.d
|
||||
|
||||
make_trace_mem "hook pre-trigger" "1:shortmem" "2+:mem" "3+:slab"
|
||||
make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab' '4+:komem'
|
||||
|
||||
source_hook pre-trigger
|
||||
|
||||
|
@@ -20,6 +20,7 @@ ConditionKernelCommandLine=|rd.break=pre-udev
|
||||
ConditionKernelCommandLine=|rd.driver.blacklist
|
||||
ConditionKernelCommandLine=|rd.driver.pre
|
||||
ConditionKernelCommandLine=|rd.driver.post
|
||||
Conflicts=shutdown.target emergency.target
|
||||
|
||||
[Service]
|
||||
Environment=DRACUT_SYSTEMD=1
|
||||
|
@@ -13,20 +13,21 @@ DefaultDependencies=no
|
||||
After=systemd-vconsole-setup.service
|
||||
Wants=systemd-vconsole-setup.service
|
||||
ConditionPathExists=!/lib/dracut/no-emergency-shell
|
||||
Conflicts=shutdown.target
|
||||
|
||||
[Service]
|
||||
Environment=HOME=/
|
||||
Environment=DRACUT_SYSTEMD=1
|
||||
Environment=NEWROOT=/sysroot
|
||||
WorkingDirectory=/
|
||||
ExecStart=/bin/dracut-emergency
|
||||
ExecStopPost=-/usr/bin/systemctl --fail --no-block default
|
||||
Type=oneshot
|
||||
ExecStart=-/bin/dracut-emergency
|
||||
ExecStopPost=-/usr/bin/systemctl --no-block isolate default.target
|
||||
StandardInput=tty-force
|
||||
StandardOutput=inherit
|
||||
StandardError=inherit
|
||||
KillMode=process
|
||||
IgnoreSIGPIPE=no
|
||||
TimeoutStartSec=0
|
||||
|
||||
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
|
||||
# terminates cleanly.
|
||||
|
@@ -22,6 +22,17 @@ installkernel() {
|
||||
instmods -s efivarfs
|
||||
}
|
||||
|
||||
|
||||
ug_check_and_add() {
|
||||
local name="$1"
|
||||
local file="$2"
|
||||
|
||||
if egrep -q "^$name:" "$file" 2>/dev/null \
|
||||
&& ! egrep -q "^$name:" "$initdir$file" 2>/dev/null; then
|
||||
egrep "^$name:" "$file" 2>/dev/null >> "$initdir$file"
|
||||
fi
|
||||
}
|
||||
|
||||
install() {
|
||||
local _mods
|
||||
|
||||
@@ -30,6 +41,12 @@ install() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ug_check_and_add "wheel" "/etc/passwd"
|
||||
ug_check_and_add "wheel" "/etc/group"
|
||||
|
||||
ug_check_and_add "adm" "/etc/passwd"
|
||||
ug_check_and_add "adm" "/etc/group"
|
||||
|
||||
inst_multiple -o \
|
||||
$systemdutildir/systemd \
|
||||
$systemdutildir/systemd-cgroups-agent \
|
||||
@@ -120,6 +137,7 @@ install() {
|
||||
\
|
||||
$systemdsystemunitdir/slices.target \
|
||||
$systemdsystemunitdir/system.slice \
|
||||
$systemdsystemunitdir/-.slice \
|
||||
\
|
||||
$tmpfilesdir/systemd.conf \
|
||||
\
|
||||
@@ -237,9 +255,10 @@ install() {
|
||||
|
||||
|
||||
mkdir -p "$initdir/etc/systemd"
|
||||
# turn off RateLimit for journal
|
||||
# We must use a volatile journal, and we don't want rate-limiting
|
||||
{
|
||||
echo "[Journal]"
|
||||
echo "Storage=volatile"
|
||||
echo "RateLimitInterval=0"
|
||||
echo "RateLimitBurst=0"
|
||||
} >> "$initdir/etc/systemd/journald.conf"
|
||||
|
@@ -7,6 +7,7 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
generator_wait_for_dev()
|
||||
{
|
||||
local _name
|
||||
local _timeout
|
||||
|
||||
_name="$(str_replace "$1" '/' '\x2f')"
|
||||
|
||||
@@ -26,10 +27,11 @@ generator_wait_for_dev()
|
||||
fi
|
||||
|
||||
if ! [ -f /run/systemd/generator/${_name}.device.d/timeout.conf ]; then
|
||||
_timeout=$(getarg rd.device.timeout || printf "0")
|
||||
mkdir -p /run/systemd/generator/${_name}.device.d
|
||||
{
|
||||
echo "[Unit]"
|
||||
echo "JobTimeoutSec=0"
|
||||
echo "JobTimeoutSec=$_timeout"
|
||||
} > /run/systemd/generator/${_name}.device.d/timeout.conf
|
||||
fi
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ filtersubvol() {
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
subvol\=*) :;;
|
||||
*) echo -n "${1}," ;;
|
||||
*) printf '%s' "${1}," ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
@@ -39,6 +39,13 @@ str_ends() {
|
||||
[ "${1%*$2}" != "$1" ]
|
||||
}
|
||||
|
||||
trim() {
|
||||
local var="$*"
|
||||
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
|
||||
var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
|
||||
echo -n "$var"
|
||||
}
|
||||
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
|
||||
warn() {
|
||||
@@ -288,7 +295,7 @@ _dogetargs() {
|
||||
fi
|
||||
done
|
||||
if [ -n "$_found" ]; then
|
||||
[ $# -gt 0 ] && echo -n "$@"
|
||||
[ $# -gt 0 ] && printf '%s' "$*"
|
||||
return 0
|
||||
fi
|
||||
return 1;
|
||||
@@ -319,7 +326,9 @@ getargs() {
|
||||
done
|
||||
if [ -n "$_gfound" ]; then
|
||||
if [ $# -gt 0 ]; then
|
||||
echo -n "$@"
|
||||
printf '%s' "$*"
|
||||
else
|
||||
printf 1
|
||||
fi
|
||||
debug_on
|
||||
return 0
|
||||
@@ -878,6 +887,7 @@ wait_for_dev()
|
||||
local _name
|
||||
local _needreload
|
||||
local _noreload
|
||||
local _timeout
|
||||
|
||||
if [ "$1" = "-n" ]; then
|
||||
_noreload=1
|
||||
@@ -904,10 +914,11 @@ wait_for_dev()
|
||||
fi
|
||||
|
||||
if ! [ -f ${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf ]; then
|
||||
_timeout=$(getarg rd.device.timeout || printf "0")
|
||||
mkdir -p ${PREFIX}/etc/systemd/system/${_name}.device.d
|
||||
{
|
||||
echo "[Unit]"
|
||||
echo "JobTimeoutSec=0"
|
||||
echo "JobTimeoutSec=$_timeout"
|
||||
} > ${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf
|
||||
_needreload=1
|
||||
fi
|
||||
@@ -1057,6 +1068,8 @@ emergency_shell()
|
||||
local _ctty
|
||||
set +e
|
||||
local _rdshell_name="dracut" action="Boot" hook="emergency"
|
||||
local _emergency_action
|
||||
|
||||
if [ "$1" = "-n" ]; then
|
||||
_rdshell_name=$2
|
||||
shift 2
|
||||
@@ -1075,20 +1088,26 @@ emergency_shell()
|
||||
source_hook "$hook"
|
||||
echo
|
||||
|
||||
_emergency_action=$(getarg rd.emergency)
|
||||
[ -z "$_emergency_action" ] \
|
||||
&& [ -e /run/initramfs/.die ] \
|
||||
&& _emergency_action=halt
|
||||
|
||||
if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
|
||||
_emergency_shell $_rdshell_name
|
||||
else
|
||||
warn "$action has failed. To debug this issue add \"rd.shell rd.debug\" to the kernel command line."
|
||||
# cause a kernel panic
|
||||
exit 1
|
||||
[ -z "$_emergency_action" ] && _emergency_action=halt
|
||||
fi
|
||||
|
||||
if [ -e /run/initramfs/.die ]; then
|
||||
if [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
systemctl --no-block --force halt
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
case "$_emergency_action" in
|
||||
reboot)
|
||||
reboot || exit 1;;
|
||||
poweroff)
|
||||
poweroff || exit 1;;
|
||||
halt)
|
||||
halt || exit 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
action_on_fail()
|
||||
@@ -1158,12 +1177,20 @@ are_lists_eq() {
|
||||
|
||||
setmemdebug() {
|
||||
if [ -z "$DEBUG_MEM_LEVEL" ]; then
|
||||
export DEBUG_MEM_LEVEL=$(getargnum 0 0 3 rd.memdebug)
|
||||
export DEBUG_MEM_LEVEL=$(getargnum 0 0 4 rd.memdebug)
|
||||
fi
|
||||
}
|
||||
|
||||
setmemdebug
|
||||
|
||||
cleanup_trace_mem()
|
||||
{
|
||||
# tracekomem based on kernel trace needs cleanup after use.
|
||||
if [ "$DEBUG_MEM_LEVEL" -eq 4 ]; then
|
||||
tracekomem --cleanup
|
||||
fi
|
||||
}
|
||||
|
||||
# parameters: msg [trace_level:trace]...
|
||||
make_trace_mem()
|
||||
{
|
||||
@@ -1248,5 +1275,8 @@ show_memstats()
|
||||
iomem)
|
||||
cat /proc/iomem
|
||||
;;
|
||||
komem)
|
||||
tracekomem
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
@@ -124,7 +124,7 @@ if getarg "rd.cmdline=ask"; then
|
||||
fi
|
||||
|
||||
# run scriptlets to parse the command line
|
||||
make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab'
|
||||
make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab' '4+:komem'
|
||||
getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline"
|
||||
source_hook cmdline
|
||||
|
||||
@@ -153,7 +153,7 @@ getargbool 0 rd.udev.info -d -y rdudevinfo && udevadm control "$UDEV_LOG_PRIO_AR
|
||||
getargbool 0 rd.udev.debug -d -y rdudevdebug && udevadm control "$UDEV_LOG_PRIO_ARG=debug"
|
||||
udevproperty "hookdir=$hookdir"
|
||||
|
||||
make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab'
|
||||
make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab' '4+:komem'
|
||||
getarg 'rd.break=pre-trigger' -d 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break before pre-trigger"
|
||||
source_hook pre-trigger
|
||||
|
||||
@@ -214,7 +214,8 @@ while :; do
|
||||
|
||||
main_loop=$(($main_loop+1))
|
||||
[ $main_loop -gt $RDRETRY ] \
|
||||
&& { flock -s 9 ; action_on_fail "Could not boot." && break; } 9>/.console_lock
|
||||
&& { flock -s 9 ; action_on_fail "Could not boot."; } 9>/.console_lock \
|
||||
&& break
|
||||
done
|
||||
unset job
|
||||
unset queuetriggered
|
||||
@@ -223,7 +224,7 @@ unset RDRETRY
|
||||
|
||||
# pre-mount happens before we try to mount the root filesystem,
|
||||
# and happens once.
|
||||
make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab'
|
||||
make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab' '4+:komem'
|
||||
getarg 'rd.break=pre-mount' -d 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
|
||||
source_hook pre-mount
|
||||
|
||||
@@ -253,17 +254,18 @@ while :; do
|
||||
done
|
||||
|
||||
{
|
||||
echo -n "Mounted root filesystem "
|
||||
while read dev mp rest; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
|
||||
printf "Mounted root filesystem "
|
||||
while read dev mp rest || [ -n "$dev" ]; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
|
||||
} | vinfo
|
||||
|
||||
# pre pivot scripts are sourced just before we doing cleanup and switch over
|
||||
# to the new root.
|
||||
make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab'
|
||||
make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab' '4+:komem'
|
||||
getarg 'rd.break=pre-pivot' -d 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot"
|
||||
source_hook pre-pivot
|
||||
|
||||
make_trace_mem "hook cleanup" '1:shortmem' '2+:mem' '3+:slab'
|
||||
cleanup_trace_mem
|
||||
# pre pivot cleanup scripts are sourced just before we switch over to the new root.
|
||||
getarg 'rd.break=cleanup' -d 'rdbreak=cleanup' && emergency_shell -n cleanup "Break cleanup"
|
||||
source_hook cleanup
|
||||
|
191
modules.d/99base/memtrace-ko.sh
Executable file
191
modules.d/99base/memtrace-ko.sh
Executable file
@@ -0,0 +1,191 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Try to find out kernel modules with large total memory allocation during loading.
|
||||
# For large slab allocation, it will fall into buddy, also not trace "mm_page_free"
|
||||
# considering large free is quite rare for module_init, thus saving tons of events
|
||||
# to avoid trace data overwritten.
|
||||
#
|
||||
# Therefore, tracing "mm_page_alloc"alone should be enough for the purpose.
|
||||
|
||||
# "sys/kernel/tracing" has the priority if exists.
|
||||
get_trace_base() {
|
||||
# trace access through debugfs would be obsolete if "/sys/kernel/tracing" is available.
|
||||
if [ -d "/sys/kernel/tracing" ]; then
|
||||
echo "/sys/kernel"
|
||||
else
|
||||
echo "/sys/kernel/debug"
|
||||
fi
|
||||
}
|
||||
|
||||
# We want to enable these trace events.
|
||||
get_want_events() {
|
||||
echo "module:module_put module:module_load kmem:mm_page_alloc"
|
||||
}
|
||||
|
||||
get_event_filter() {
|
||||
echo "comm == systemd-udevd || comm == modprobe || comm == insmod"
|
||||
}
|
||||
|
||||
is_trace_ready() {
|
||||
local trace_base want_events current_events
|
||||
|
||||
trace_base=$(get_trace_base)
|
||||
! [ -f "$trace_base/tracing/trace" ] && return 1
|
||||
|
||||
[ "$(cat $trace_base/tracing/tracing_on)" -eq 0 ] && return 1
|
||||
|
||||
# Also check if trace events were properly setup.
|
||||
want_events=$(get_want_events)
|
||||
current_events=$(echo $(cat $trace_base/tracing/set_event))
|
||||
[ "$current_events" != "$want_events" ] && return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
prepare_trace() {
|
||||
local trace_base
|
||||
|
||||
trace_base=$(get_trace_base)
|
||||
# old debugfs interface case.
|
||||
if ! [ -d "$trace_base/tracing" ]; then
|
||||
mount none -t debugfs $trace_base
|
||||
# new tracefs interface case.
|
||||
elif ! [ -f "$trace_base/tracing/trace" ]; then
|
||||
mount none -t tracefs "$trace_base/tracing"
|
||||
fi
|
||||
|
||||
if ! [ -f "$trace_base/tracing/trace" ]; then
|
||||
echo "WARN: Mount trace failed for kernel module memory analyzing."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Active all the wanted trace events.
|
||||
echo "$(get_want_events)" > $trace_base/tracing/set_event
|
||||
|
||||
# There are three kinds of known applications for module loading:
|
||||
# "systemd-udevd", "modprobe" and "insmod".
|
||||
# Set them as the global events filter.
|
||||
# NOTE: Some kernel may not support this format of filter, anyway
|
||||
# the operation will fail and it doesn't matter.
|
||||
echo "$(get_event_filter)" > $trace_base/tracing/events/kmem/filter 2>&1
|
||||
echo "$(get_event_filter)" > $trace_base/tracing/events/module/filter 2>&1
|
||||
|
||||
# Set the number of comm-pid if supported.
|
||||
if [ -f "$trace_base/tracing/saved_cmdlines_size" ]; then
|
||||
# Thanks to filters, 4096 is big enough(also well supported).
|
||||
echo 4096 > $trace_base/tracing/saved_cmdlines_size
|
||||
fi
|
||||
|
||||
# Enable and clear trace data for the first time.
|
||||
echo 1 > $trace_base/tracing/tracing_on
|
||||
echo > $trace_base/tracing/trace
|
||||
echo "Prepare trace success."
|
||||
return 0
|
||||
}
|
||||
|
||||
order_to_pages()
|
||||
{
|
||||
local pages=1
|
||||
local order=$1
|
||||
|
||||
while [ "$order" != 0 ]; do
|
||||
order=$((order-1))
|
||||
pages=$(($pages*2))
|
||||
done
|
||||
|
||||
echo $pages
|
||||
}
|
||||
|
||||
parse_trace_data() {
|
||||
local module_name tmp_eval pages
|
||||
|
||||
cat "$(get_trace_base)/tracing/trace" | while read pid cpu flags ts function args
|
||||
do
|
||||
# Skip comment lines
|
||||
if [ "$pid" = "#" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
pid=${pid##*-}
|
||||
function=${function%:}
|
||||
if [ "$function" = "module_load" ]; then
|
||||
# One module is being loaded, save the task pid for tracking.
|
||||
# Remove the trailing after whitespace, there may be the module flags.
|
||||
module_name=${args%% *}
|
||||
# Mark current_module to track the task.
|
||||
eval current_module_$pid="$module_name"
|
||||
tmp_eval=$(eval echo '${module_loaded_'${module_name}'}')
|
||||
if [ -n "$tmp_eval" ]; then
|
||||
echo "WARN: \"$module_name\" was loaded multiple times!"
|
||||
fi
|
||||
eval unset module_loaded_$module_name
|
||||
eval nr_alloc_pages_$module_name=0
|
||||
continue
|
||||
fi
|
||||
|
||||
module_name=$(eval echo '${current_module_'${pid}'}')
|
||||
if [ -z "$module_name" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Once we get here, the task is being tracked(is loading a module).
|
||||
if [ "$function" = "module_put" ]; then
|
||||
# Mark the module as loaded when the first module_put event happens after module_load.
|
||||
tmp_eval=$(eval echo '${nr_alloc_pages_'${module_name}'}')
|
||||
echo "$tmp_eval pages consumed by \"$module_name\""
|
||||
eval module_loaded_$module_name=1
|
||||
# Module loading finished, so untrack the task.
|
||||
eval unset current_module_$pid
|
||||
eval unset nr_alloc_pages_$module_name
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ "$function" = "mm_page_alloc" ]; then
|
||||
# Get order first, then convert to actual pages.
|
||||
pages=$(echo $args | sed -e 's/.*order=\([0-9]*\) .*/\1/')
|
||||
pages=$(order_to_pages "$pages")
|
||||
tmp_eval=$(eval echo '${nr_alloc_pages_'${module_name}'}')
|
||||
eval nr_alloc_pages_$module_name="$(($tmp_eval+$pages))"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
cleanup_trace() {
|
||||
local trace_base
|
||||
|
||||
if is_trace_ready; then
|
||||
trace_base=$(get_trace_base)
|
||||
echo 0 > $trace_base/tracing/tracing_on
|
||||
echo > $trace_base/tracing/trace
|
||||
echo > $trace_base/tracing/set_event
|
||||
echo 0 > $trace_base/tracing/events/kmem/filter
|
||||
echo 0 > $trace_base/tracing/events/module/filter
|
||||
fi
|
||||
}
|
||||
|
||||
show_usage() {
|
||||
echo "Find out kernel modules with large memory consumption during loading based on trace."
|
||||
echo "Usage:"
|
||||
echo "1) run it first to setup trace."
|
||||
echo "2) run again to parse the trace data if any."
|
||||
echo "3) run with \"--cleanup\" option to cleanup trace after use."
|
||||
}
|
||||
|
||||
if [ "$1" = "--help" ]; then
|
||||
show_usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "--cleanup" ]; then
|
||||
cleanup_trace
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if is_trace_ready ; then
|
||||
echo "tracekomem - Rough memory consumption by loading kernel modules (larger value with better accuracy)"
|
||||
parse_trace_data
|
||||
else
|
||||
prepare_trace
|
||||
fi
|
||||
|
||||
exit $?
|
@@ -34,6 +34,7 @@ install() {
|
||||
inst_script "$moddir/initqueue.sh" "/sbin/initqueue"
|
||||
inst_script "$moddir/loginit.sh" "/sbin/loginit"
|
||||
inst_script "$moddir/rdsosreport.sh" "/sbin/rdsosreport"
|
||||
inst_script "$moddir/memtrace-ko.sh" "/sbin/tracekomem"
|
||||
|
||||
[ -e "${initdir}/lib" ] || mkdir -m 0755 -p ${initdir}/lib
|
||||
mkdir -m 0755 -p ${initdir}/lib/dracut
|
||||
|
@@ -13,7 +13,7 @@ depends() {
|
||||
|
||||
install() {
|
||||
local _d
|
||||
inst_multiple umount poweroff reboot halt losetup
|
||||
inst_multiple umount poweroff reboot halt losetup stat
|
||||
inst_multiple -o kexec
|
||||
inst "$moddir/shutdown.sh" "$prefix/shutdown"
|
||||
[ -e "${initdir}/lib" ] || mkdir -m 0755 -p ${initdir}/lib
|
||||
|
@@ -14,6 +14,10 @@ export TERM=linux
|
||||
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
if [ "$(stat -c '%T' -f /)" = "tmpfs" ]; then
|
||||
mount -o remount,rw /
|
||||
fi
|
||||
|
||||
mkdir /oldsys
|
||||
for i in sys proc run dev; do
|
||||
mkdir /oldsys/$i
|
||||
|
@@ -2,13 +2,14 @@
|
||||
|
||||
check:
|
||||
@[ "$$EUID" == "0" ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; }
|
||||
@for i in TEST-[0-9]*; do \
|
||||
@{ ret=0; \
|
||||
for i in TEST-[0-9]*; do \
|
||||
[ -d $$i ] || continue ; \
|
||||
[ -f $$i/Makefile ] || continue ; \
|
||||
if [ -n "$$TESTS" ]; then t=$${i##TEST-}; t=$${t%%-*}; [ "$${TESTS#*$$t*}" != "$$TESTS" ] || continue; fi; \
|
||||
if [ -n "$$SKIP" ]; then t=$${i##TEST-}; t=$${t%%-*}; [ "$${SKIP#*$$t*}" != "$$SKIP" ] && continue; fi; \
|
||||
$(MAKE) -C $$i all ; \
|
||||
done
|
||||
$(MAKE) -C $$i all ; ret=$$((ret + $$?)); \
|
||||
done; exit $$ret; }
|
||||
|
||||
clean:
|
||||
@for i in TEST-[0-9]*; do \
|
||||
|
@@ -14,7 +14,8 @@ test_run() {
|
||||
-m 256M -smp 2 -nographic \
|
||||
-net none -kernel /boot/vmlinuz-$KVERSION \
|
||||
-watchdog i6300esb -watchdog-action poweroff \
|
||||
-append "root=LABEL=dracut rw systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.debug console=ttyS0,115200n81 $DEBUGFAIL" \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=LABEL=dracut rw systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.debug console=ttyS0,115200n81 $DEBUGFAIL rd.memdebug=4" \
|
||||
-initrd $TESTDIR/initramfs.testing || return 1
|
||||
grep -F -m 1 -q dracut-root-block-success $TESTDIR/result || return 1
|
||||
}
|
||||
@@ -45,7 +46,7 @@ test_setup() {
|
||||
find_binary plymouth >/dev/null && inst_multiple plymouth
|
||||
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
ldconfig -r "$initdir"
|
||||
)
|
||||
|
||||
# second, install the files needed to make the root filesystem
|
||||
@@ -62,7 +63,7 @@ test_setup() {
|
||||
# We do it this way so that we do not risk trashing the host mdraid
|
||||
# devices, volume groups, encrypted partitions, etc.
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "dash udev-rules base rootfs-block fs-lib kernel-modules fs-lib" \
|
||||
-m "udev-rules base rootfs-block fs-lib kernel-modules fs-lib" \
|
||||
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
|
||||
--nomdadmconf \
|
||||
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
||||
@@ -85,7 +86,7 @@ test_setup() {
|
||||
inst_hook emergency 000 ./hard-off.sh
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
)
|
||||
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-a "debug watchdog" \
|
||||
-o "plymouth" \
|
||||
-d "piix ide-gd_mod ata_piix ext3 sd_mod i6300esb ib700wdt" \
|
||||
|
@@ -4,7 +4,7 @@ strstr() { [ "${1#*$2*}" != "$1" ]; }
|
||||
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
|
||||
plymouth --quit
|
||||
exec </dev/console >/dev/console 2>&1
|
||||
echo "dracut-root-block-success" >/dev/sda1
|
||||
echo "dracut-root-block-success" >/dev/sdb
|
||||
export TERM=linux
|
||||
export PS1='initramfs-test:\w\$ '
|
||||
[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
|
||||
|
@@ -4,19 +4,24 @@ TEST_DESCRIPTION="root filesystem on a ext3 filesystem"
|
||||
KVERSION="${KVERSION-$(uname -r)}"
|
||||
|
||||
# Uncomment this to debug failures
|
||||
#DEBUGFAIL="rd.shell"
|
||||
#DEBUGFAIL="rd.shell loglevel=77 systemd.log_level=debug systemd.log_target=console"
|
||||
#DEBUGFAIL="rd.shell rd.break=initqueue"
|
||||
test_run() {
|
||||
dd if=/dev/zero of=$TESTDIR/marker.disk bs=1M count=80
|
||||
$testdir/run-qemu \
|
||||
-hda $TESTDIR/root.ext3 \
|
||||
-hdb $TESTDIR/marker.disk \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-net none -kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "root=LABEL=dracut rw loglevel=77 systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug init=/sbin/init $DEBUGFAIL" \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=LABEL=dracut rw loglevel=77 rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 init=/sbin/init $DEBUGFAIL" \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext3 || return 1
|
||||
grep -F -m 1 -q dracut-root-block-success $TESTDIR/marker.disk || return 1
|
||||
}
|
||||
|
||||
test_setup() {
|
||||
rm -f -- $TESTDIR/root.ext3
|
||||
rm -f -- $TESTDIR/marker.disk
|
||||
# Create the blank file to use as a root filesystem
|
||||
dd if=/dev/null of=$TESTDIR/root.ext3 bs=1M seek=80
|
||||
|
||||
@@ -41,7 +46,7 @@ test_setup() {
|
||||
find_binary plymouth >/dev/null && inst_multiple plymouth
|
||||
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
ldconfig -r "$initdir"
|
||||
)
|
||||
|
||||
# second, install the files needed to make the root filesystem
|
||||
@@ -58,7 +63,7 @@ test_setup() {
|
||||
# We do it this way so that we do not risk trashing the host mdraid
|
||||
# devices, volume groups, encrypted partitions, etc.
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "dash udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-m "udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
|
||||
--nomdadmconf \
|
||||
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
||||
@@ -81,7 +86,7 @@ test_setup() {
|
||||
inst_hook emergency 000 ./hard-off.sh
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
)
|
||||
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-a "debug systemd" \
|
||||
-o "network plymouth" \
|
||||
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
|
||||
|
@@ -20,7 +20,8 @@ client_run() {
|
||||
-hdc $TESTDIR/result \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-net none -kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "root=LABEL=dracut $client_opts rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=LABEL=dracut $client_opts rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
|
||||
if (($? != 0)); then
|
||||
@@ -72,7 +73,7 @@ test_setup() {
|
||||
find_binary plymouth >/dev/null && inst_multiple plymouth
|
||||
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
ldconfig -r "$initdir"
|
||||
)
|
||||
|
||||
# second, install the files needed to make the root filesystem
|
||||
@@ -89,7 +90,7 @@ test_setup() {
|
||||
# We do it this way so that we do not risk trashing the host mdraid
|
||||
# devices, volume groups, encrypted partitions, etc.
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "dash udev-rules btrfs base rootfs-block fs-lib kernel-modules" \
|
||||
-m "udev-rules btrfs base rootfs-block fs-lib kernel-modules" \
|
||||
-d "piix ide-gd_mod ata_piix btrfs sd_mod" \
|
||||
--nomdadmconf \
|
||||
--nohardlink \
|
||||
@@ -119,7 +120,7 @@ test_setup() {
|
||||
inst_hook emergency 000 ./hard-off.sh
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
)
|
||||
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-a "debug" \
|
||||
-o "network plymouth" \
|
||||
-d "piix ide-gd_mod ata_piix btrfs sd_mod i6300esb ib700wdt" \
|
||||
|
@@ -19,7 +19,7 @@ if ismounted /usr && [ ! -s /failed ]; then
|
||||
echo "dracut-root-block-success" >/dev/sdc
|
||||
fi
|
||||
|
||||
journalctl --full --no-pager -o short-monotonic
|
||||
#journalctl --full --no-pager -o short-monotonic
|
||||
|
||||
if [ -s /failed ]; then
|
||||
echo "**************************FAILED**************************"
|
||||
|
@@ -22,7 +22,8 @@ client_run() {
|
||||
-hdc $TESTDIR/result \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-net none \
|
||||
-append "root=LABEL=dracut $client_opts rd.retry=3 console=ttyS0,115200n81 selinux=0 $DEBUGOUT $DEBUGFAIL" \
|
||||
-no-reboot \
|
||||
-append "panic=1 $client_opts rd.device.timeout=20 rd.retry=3 console=ttyS0,115200n81 selinux=0 $DEBUGOUT $DEBUGFAIL" \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
|
||||
if (($? != 0)); then
|
||||
@@ -39,9 +40,11 @@ client_run() {
|
||||
}
|
||||
|
||||
test_run() {
|
||||
client_run "no option specified" || return 1
|
||||
client_run "readonly root" "ro" || return 1
|
||||
client_run "writeable root" "rw" || return 1
|
||||
client_run "no root specified (failme)" "failme" && return 1
|
||||
client_run "wrong root specified (failme)" "root=LABEL=dracut1" "failme" && return 1
|
||||
client_run "no option specified" "root=LABEL=dracut" || return 1
|
||||
client_run "readonly root" "root=LABEL=dracut" "ro" || return 1
|
||||
client_run "writeable root" "root=LABEL=dracut" "rw" || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -70,7 +73,7 @@ test_setup() {
|
||||
ln -sfn /run "$initdir/var/run"
|
||||
ln -sfn /run/lock "$initdir/var/lock"
|
||||
|
||||
inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip route \
|
||||
inst_multiple -o sh df free ls shutdown poweroff stty cat ps ln ip route \
|
||||
mount dmesg ifconfig dhclient mkdir cp ping dhclient \
|
||||
umount strace less setsid tree systemctl reset
|
||||
|
||||
@@ -163,7 +166,7 @@ EOF
|
||||
/etc/security \
|
||||
/lib64/security \
|
||||
/lib/security -xtype f \
|
||||
| while read file; do
|
||||
2>/dev/null | while read file; do
|
||||
inst_multiple -o $file
|
||||
done
|
||||
|
||||
@@ -204,7 +207,7 @@ EOF
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
ldconfig -r "$initdir"
|
||||
ddebug "Strip binaeries"
|
||||
find "$initdir" -perm +111 -type f | xargs -r strip --strip-unneeded | ddebug
|
||||
find "$initdir" -perm /111 -type f | xargs -r strip --strip-unneeded | ddebug
|
||||
|
||||
# copy depmod files
|
||||
inst /lib/modules/$kernel/modules.order
|
||||
@@ -232,7 +235,7 @@ EOF
|
||||
# We do it this way so that we do not risk trashing the host mdraid
|
||||
# devices, volume groups, encrypted partitions, etc.
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "dash udev-rules btrfs base rootfs-block fs-lib kernel-modules" \
|
||||
-m "udev-rules btrfs base rootfs-block fs-lib kernel-modules" \
|
||||
-d "piix ide-gd_mod ata_piix btrfs sd_mod" \
|
||||
--nomdadmconf \
|
||||
--nohardlink \
|
||||
@@ -261,10 +264,10 @@ EOF
|
||||
inst_hook emergency 000 ./hard-off.sh
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
)
|
||||
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-a "debug systemd" \
|
||||
-I "/etc/machine-id /etc/hostname" \
|
||||
-o "dash network plymouth lvm mdraid resume crypt i18n caps dm terminfo usrmount" \
|
||||
-o "network plymouth lvm mdraid resume crypt i18n caps dm terminfo usrmount" \
|
||||
-d "piix ide-gd_mod ata_piix btrfs sd_mod i6300esb ib700wdt" \
|
||||
-f $TESTDIR/initramfs.testing $KVERSION || return 1
|
||||
|
||||
|
@@ -18,7 +18,7 @@ mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/sda2 /d
|
||||
# randomly.
|
||||
mdadm -W /dev/md0
|
||||
set -e
|
||||
echo -n test >keyfile
|
||||
printf test >keyfile
|
||||
cryptsetup -q luksFormat /dev/md0 /keyfile
|
||||
echo "The passphrase is test"
|
||||
cryptsetup luksOpen /dev/md0 dracut_crypt_test </keyfile
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -b "/dev/mapper/$2" ] && exit 0
|
||||
echo -n test >/keyfile
|
||||
printf test >/keyfile
|
||||
/sbin/cryptsetup luksOpen "$1" "$2" </keyfile
|
||||
|
@@ -12,7 +12,8 @@ test_run() {
|
||||
-hda $DISKIMAGE \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-net none -kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "root=/dev/dracut/root rd.auto rw rd.retry=10 console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=/dev/dracut/root rd.auto rw rd.retry=10 console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
grep -F -m 1 -q dracut-root-block-success $DISKIMAGE || return 1
|
||||
}
|
||||
@@ -43,7 +44,7 @@ test_setup() {
|
||||
inst_multiple -o /lib/systemd/systemd-shutdown
|
||||
find_binary plymouth >/dev/null && inst_multiple plymouth
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
ldconfig -r "$initdir"
|
||||
)
|
||||
|
||||
# second, install the files needed to make the root filesystem
|
||||
@@ -60,7 +61,7 @@ test_setup() {
|
||||
# We do it this way so that we do not risk trashing the host mdraid
|
||||
# devices, volume groups, encrypted partitions, etc.
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-m "crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
|
||||
--nomdadmconf \
|
||||
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
||||
@@ -88,7 +89,7 @@ test_setup() {
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
)
|
||||
|
||||
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-o "plymouth network" \
|
||||
-a "debug" \
|
||||
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
|
||||
|
@@ -11,7 +11,8 @@ test_run() {
|
||||
-hda $TESTDIR/root.ext2 \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-net none -kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext2 || return 1
|
||||
}
|
||||
@@ -40,7 +41,7 @@ test_setup() {
|
||||
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
mkdir $initdir/run
|
||||
sudo ldconfig -r "$initdir"
|
||||
ldconfig -r "$initdir"
|
||||
)
|
||||
|
||||
# second, install the files needed to make the root filesystem
|
||||
@@ -57,7 +58,7 @@ test_setup() {
|
||||
# We do it this way so that we do not risk trashing the host mdraid
|
||||
# devices, volume groups, encrypted partitions, etc.
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "dash lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-m "lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
|
||||
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
||||
rm -rf -- $TESTDIR/overlay
|
||||
@@ -74,7 +75,7 @@ test_setup() {
|
||||
inst_hook emergency 000 ./hard-off.sh
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
)
|
||||
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-o "plymouth network" \
|
||||
-a "debug" \
|
||||
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
|
||||
|
@@ -20,7 +20,7 @@ mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/sdb /de
|
||||
# wait for the array to finish initailizing, otherwise this sometimes fails
|
||||
# randomly.
|
||||
mdadm -W /dev/md0
|
||||
echo -n test >keyfile
|
||||
printf test >keyfile
|
||||
cryptsetup -q luksFormat /dev/md0 /keyfile
|
||||
echo "The passphrase is test"
|
||||
set -e
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -b /dev/mapper/$2 ] && exit 0
|
||||
echo -n test >/keyfile
|
||||
printf test >/keyfile
|
||||
/sbin/cryptsetup luksOpen $1 $2 </keyfile
|
||||
|
||||
|
@@ -19,7 +19,8 @@ client_run() {
|
||||
-hdc $TESTDIR/disk2.img.new \
|
||||
-hdd $TESTDIR/disk3.img.new \
|
||||
-net none -kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "$* root=LABEL=root rw rd.retry=20 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL " \
|
||||
-no-reboot \
|
||||
-append "panic=1 $* root=LABEL=root rw rd.retry=20 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL " \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
if ! grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext2; then
|
||||
echo "CLIENT TEST END: $@ [FAIL]"
|
||||
@@ -36,19 +37,19 @@ test_run() {
|
||||
echo "MD_UUID=$MD_UUID"
|
||||
read LUKS_UUID < $TESTDIR/luksuuid
|
||||
|
||||
client_run failme && return 1
|
||||
client_run rd.auto || return 1
|
||||
client_run rd.device.timeout=60 failme && return 1
|
||||
client_run rd.device.timeout=60 rd.auto || return 1
|
||||
|
||||
|
||||
client_run rd.luks.uuid=$LUKS_UUID rd.md.uuid=$MD_UUID rd.md.conf=0 rd.lvm.vg=dracut || return 1
|
||||
client_run rd.device.timeout=60 rd.luks.uuid=$LUKS_UUID rd.md.uuid=$MD_UUID rd.md.conf=0 rd.lvm.vg=dracut || return 1
|
||||
|
||||
client_run rd.luks.uuid=$LUKS_UUID rd.md.uuid=failme rd.md.conf=0 rd.lvm.vg=dracut failme && return 1
|
||||
client_run rd.device.timeout=60 rd.luks.uuid=$LUKS_UUID rd.md.uuid=failme rd.md.conf=0 rd.lvm.vg=dracut failme && return 1
|
||||
|
||||
client_run rd.luks.uuid=$LUKS_UUID rd.md.uuid=$MD_UUID rd.lvm=0 failme && return 1
|
||||
client_run rd.luks.uuid=$LUKS_UUID rd.md.uuid=$MD_UUID rd.lvm=0 rd.auto=1 failme && return 1
|
||||
client_run rd.luks.uuid=$LUKS_UUID rd.md.uuid=$MD_UUID rd.lvm.vg=failme failme && return 1
|
||||
client_run rd.device.timeout=60 rd.luks.uuid=$LUKS_UUID rd.md.uuid=$MD_UUID rd.lvm=0 failme && return 1
|
||||
client_run rd.device.timeout=60 rd.luks.uuid=$LUKS_UUID rd.md.uuid=$MD_UUID rd.lvm=0 rd.auto=1 failme && return 1
|
||||
client_run rd.device.timeout=60 rd.luks.uuid=$LUKS_UUID rd.md.uuid=$MD_UUID rd.lvm.vg=failme failme && return 1
|
||||
client_run rd.luks.uuid=$LUKS_UUID rd.md.uuid=$MD_UUID rd.lvm.vg=dracut || return 1
|
||||
client_run rd.luks.uuid=$LUKS_UUID rd.md.uuid=$MD_UUID rd.lvm.lv=dracut/failme failme && return 1
|
||||
client_run rd.device.timeout=60 rd.luks.uuid=$LUKS_UUID rd.md.uuid=$MD_UUID rd.lvm.lv=dracut/failme failme && return 1
|
||||
client_run rd.luks.uuid=$LUKS_UUID rd.md.uuid=$MD_UUID rd.lvm.lv=dracut/root || return 1
|
||||
|
||||
return 0
|
||||
@@ -81,7 +82,7 @@ test_setup() {
|
||||
find_binary plymouth >/dev/null && inst_multiple plymouth
|
||||
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
ldconfig -r "$initdir"
|
||||
)
|
||||
|
||||
# second, install the files needed to make the root filesystem
|
||||
@@ -98,7 +99,7 @@ test_setup() {
|
||||
# We do it this way so that we do not risk trashing the host mdraid
|
||||
# devices, volume groups, encrypted partitions, etc.
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-m "crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
|
||||
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
||||
rm -rf -- $TESTDIR/overlay
|
||||
@@ -131,7 +132,7 @@ test_setup() {
|
||||
echo -n test > $initdir/etc/key
|
||||
)
|
||||
|
||||
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-o "plymouth network" \
|
||||
-a "debug" \
|
||||
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
|
||||
|
@@ -14,7 +14,7 @@ sfdisk -C 2560 -H 2 -S 32 -L /dev/sda <<EOF
|
||||
,800
|
||||
EOF
|
||||
udevadm settle
|
||||
echo -n test >keyfile
|
||||
printf test >keyfile
|
||||
cryptsetup -q luksFormat /dev/sda2 /keyfile
|
||||
cryptsetup -q luksFormat /dev/sda3 /keyfile
|
||||
cryptsetup -q luksFormat /dev/sda4 /keyfile
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -b /dev/mapper/$2 ] && exit 0
|
||||
echo -n test >/keyfile
|
||||
printf test >/keyfile
|
||||
/sbin/cryptsetup luksOpen $1 $2 </keyfile
|
||||
|
||||
|
@@ -19,7 +19,8 @@ test_run() {
|
||||
-hdb $TESTDIR/check-success.img \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-net none -kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "root=/dev/dracut/root rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 rd.debug rootwait $LUKSARGS $DEBUGFAIL" \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=/dev/dracut/root rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 $LUKSARGS rd.device.timeout=40 $DEBUGFAIL" \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
grep -F -m 1 -q dracut-root-block-success $TESTDIR/check-success.img || return 1
|
||||
echo "CLIENT TEST END: [OK]"
|
||||
@@ -32,7 +33,8 @@ test_run() {
|
||||
-hdb $TESTDIR/check-success.img \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-net none -kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "root=/dev/dracut/root rw quiet rd.auto rd.retry=20 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=/dev/dracut/root rw quiet rd.auto rd.retry=20 rd.info console=ttyS0,115200n81 selinux=0 rd.device.timeout=40 $DEBUGFAIL" \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
grep -F -m 1 -q dracut-root-block-success $TESTDIR/check-success.img || return 1
|
||||
echo "CLIENT TEST END: [OK]"
|
||||
@@ -45,7 +47,8 @@ test_run() {
|
||||
-hdb $TESTDIR/check-success.img \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-net none -kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "root=/dev/dracut/root rw quiet rd.auto rd.retry=10 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL rd.luks.uuid=failme" \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=/dev/dracut/root rw quiet rd.auto rd.retry=10 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.luks.uuid=failme rd.device.timeout=40 $DEBUGFAIL" \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
grep -F -m 1 -q dracut-root-block-success $TESTDIR/check-success.img && return 1
|
||||
echo "CLIENT TEST END: [OK]"
|
||||
@@ -77,7 +80,7 @@ test_setup() {
|
||||
find_binary plymouth >/dev/null && inst_multiple plymouth
|
||||
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
ldconfig -r "$initdir"
|
||||
)
|
||||
|
||||
# second, install the files needed to make the root filesystem
|
||||
@@ -94,7 +97,7 @@ test_setup() {
|
||||
# We do it this way so that we do not risk trashing the host mdraid
|
||||
# devices, volume groups, encrypted partitions, etc.
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-m "crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
|
||||
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
||||
rm -rf -- $TESTDIR/overlay
|
||||
@@ -127,7 +130,7 @@ test_setup() {
|
||||
done > $initdir/etc/crypttab
|
||||
echo -n test > $initdir/etc/key
|
||||
)
|
||||
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-o "plymouth network" \
|
||||
-a "debug" \
|
||||
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -b /dev/mapper/$2 ] && exit 0
|
||||
echo -n test >/keyfile
|
||||
printf test >/keyfile
|
||||
/sbin/cryptsetup luksOpen $1 $2 </keyfile
|
||||
|
||||
|
@@ -15,7 +15,8 @@ client_run() {
|
||||
-hdc $TESTDIR/disk2 \
|
||||
-m 256M -nographic \
|
||||
-net none -kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "$* root=LABEL=root rw debug rd.retry=20 rd.debug console=ttyS0,115200n81 selinux=0 rd.info $DEBUGFAIL" \
|
||||
-no-reboot \
|
||||
-append "panic=1 $* root=LABEL=root rw debug rd.retry=20 rd.debug console=ttyS0,115200n81 selinux=0 rd.info $DEBUGFAIL" \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
if ! grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext2; then
|
||||
echo "CLIENT TEST END: $@ [FAIL]"
|
||||
@@ -33,8 +34,8 @@ test_run() {
|
||||
client_run rd.auto rd.md.uuid=$MD_UUID rd.dm=0 || return 1
|
||||
# This test succeeds, because the mirror parts are found without
|
||||
# assembling the mirror itsself, which is what we want
|
||||
client_run rd.auto rd.md.uuid=$MD_UUID rd.md=0 rd.md.imsm failme && return 1
|
||||
client_run rd.auto rd.md.uuid=$MD_UUID rd.md=0 failme && return 1
|
||||
client_run rd.auto rd.md.uuid=$MD_UUID rd.md=0 rd.md.imsm failme rd.device.timeout=40 && return 1
|
||||
client_run rd.auto rd.md.uuid=$MD_UUID rd.md=0 failme rd.device.timeout=40 && return 1
|
||||
# the following test hangs on newer md
|
||||
client_run rd.auto rd.md.uuid=$MD_UUID rd.dm=0 rd.md.imsm rd.md.conf=0 || return 1
|
||||
return 0
|
||||
@@ -70,7 +71,7 @@ test_setup() {
|
||||
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
mkdir $initdir/run
|
||||
sudo ldconfig -r "$initdir"
|
||||
ldconfig -r "$initdir"
|
||||
)
|
||||
|
||||
# second, install the files needed to make the root filesystem
|
||||
@@ -86,7 +87,7 @@ test_setup() {
|
||||
# We do it this way so that we do not risk trashing the host mdraid
|
||||
# devices, volume groups, encrypted partitions, etc.
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "dash lvm mdraid dmraid udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-m "lvm mdraid dmraid udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-d "piix ide-gd_mod ata_piix ext2 sd_mod dm-multipath dm-crypt dm-round-robin faulty linear multipath raid0 raid10 raid1 raid456" \
|
||||
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
||||
rm -rf -- $TESTDIR/overlay
|
||||
@@ -109,7 +110,7 @@ test_setup() {
|
||||
inst_hook emergency 000 ./hard-off.sh
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
)
|
||||
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-o "plymouth network" \
|
||||
-a "debug" \
|
||||
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
|
||||
|
@@ -11,7 +11,8 @@ test_run() {
|
||||
-hda $DISKIMAGE \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-net none -kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "root=LABEL=root rw rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=LABEL=root rw rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
dd if=$DISKIMAGE bs=512 count=2 | grep -F -m 1 -q dracut-root-block-success $DISKIMAGE || return 1
|
||||
}
|
||||
@@ -41,7 +42,7 @@ test_setup() {
|
||||
find_binary plymouth >/dev/null && inst_multiple plymouth
|
||||
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
ldconfig -r "$initdir"
|
||||
)
|
||||
|
||||
# second, install the files needed to make the root filesystem
|
||||
@@ -58,7 +59,7 @@ test_setup() {
|
||||
# We do it this way so that we do not risk trashing the host mdraid
|
||||
# devices, volume groups, encrypted partitions, etc.
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "dash btrfs udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-m "btrfs udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-d "piix ide-gd_mod ata_piix btrfs sd_mod" \
|
||||
--nomdadmconf \
|
||||
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
||||
@@ -82,7 +83,7 @@ test_setup() {
|
||||
inst_hook emergency 000 ./hard-off.sh
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
)
|
||||
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-o "plymouth network" \
|
||||
-a "debug" \
|
||||
-d "piix ide-gd_mod ata_piix btrfs sd_mod" \
|
||||
|
@@ -21,7 +21,8 @@ test_run() {
|
||||
-hda "$TESTDIR"/root.img \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-net none -kernel /boot/vmlinuz-"$KVERSION" \
|
||||
-append "root=live:CDLABEL=LiveCD live rw quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=live:CDLABEL=LiveCD live rw quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \
|
||||
-initrd "$TESTDIR"/initramfs.testing
|
||||
grep -F -m 1 -q dracut-root-block-success -- "$TESTDIR"/root.img || return 1
|
||||
}
|
||||
@@ -38,9 +39,9 @@ test_setup() {
|
||||
|
||||
dd if=/dev/zero of="$TESTDIR"/root.img count=100
|
||||
|
||||
sudo $basedir/dracut.sh -l -i "$TESTDIR"/overlay / \
|
||||
$basedir/dracut.sh -l -i "$TESTDIR"/overlay / \
|
||||
-a "debug dmsquash-live" \
|
||||
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
|
||||
-d "piix ide-gd_mod ata_piix ext3 sd_mod sr_mod" \
|
||||
-f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1
|
||||
|
||||
mkdir -p -- "$TESTDIR"/root-source
|
||||
@@ -69,7 +70,7 @@ test_setup() {
|
||||
find_binary plymouth >/dev/null && inst_multiple plymouth
|
||||
(cd "$initdir"; mkdir -p -- dev sys proc etc var/run tmp )
|
||||
cp -a -- /etc/ld.so.conf* "$initdir"/etc
|
||||
sudo ldconfig -r -- "$initdir"
|
||||
ldconfig -r "$initdir"
|
||||
)
|
||||
python create.py -d -c livecd-fedora-minimal.ks
|
||||
return 0
|
||||
|
@@ -11,7 +11,8 @@ test_run() {
|
||||
-hda $TESTDIR/root.ext2 \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-net none -kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext2 || return 1
|
||||
}
|
||||
@@ -40,7 +41,7 @@ test_setup() {
|
||||
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
mkdir $initdir/run
|
||||
sudo ldconfig -r "$initdir"
|
||||
ldconfig -r "$initdir"
|
||||
)
|
||||
|
||||
# second, install the files needed to make the root filesystem
|
||||
@@ -57,7 +58,7 @@ test_setup() {
|
||||
# We do it this way so that we do not risk trashing the host mdraid
|
||||
# devices, volume groups, encrypted partitions, etc.
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "dash lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-m "lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
|
||||
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
||||
rm -rf -- $TESTDIR/overlay
|
||||
@@ -74,7 +75,7 @@ test_setup() {
|
||||
inst_hook emergency 000 ./hard-off.sh
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
)
|
||||
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-o "plymouth network" \
|
||||
-a "debug" -I lvs \
|
||||
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
|
||||
|
@@ -23,10 +23,11 @@ run_server() {
|
||||
-serial ${SERIAL:-null} \
|
||||
-watchdog i6300esb -watchdog-action poweroff \
|
||||
-kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "rd.debug loglevel=77 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0" \
|
||||
-no-reboot \
|
||||
-append "panic=1 rd.debug loglevel=77 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd $TESTDIR/initramfs.server \
|
||||
-pidfile $TESTDIR/server.pid -daemonize || return 1
|
||||
sudo chmod 644 $TESTDIR/server.pid || return 1
|
||||
chmod 644 $TESTDIR/server.pid || return 1
|
||||
|
||||
# Cleanup the terminal if we have one
|
||||
tty -s && stty sane
|
||||
@@ -58,7 +59,8 @@ client_test() {
|
||||
-net socket,connect=127.0.0.1:12320 \
|
||||
-kernel /boot/vmlinuz-$KVERSION \
|
||||
-watchdog i6300esb -watchdog-action poweroff \
|
||||
-append "$cmdline $DEBUGFAIL rd.debug rd.retry=10 rd.info quiet ro console=ttyS0,115200n81 selinux=0" \
|
||||
-no-reboot \
|
||||
-append "panic=1 $cmdline $DEBUGFAIL rd.debug rd.retry=10 rd.info quiet ro console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
|
||||
if [[ $? -ne 0 ]] || ! grep -F -m 1 -q nfs-OK $TESTDIR/client.img; then
|
||||
@@ -185,7 +187,7 @@ test_nfsv4() {
|
||||
|
||||
test_run() {
|
||||
if [[ -s server.pid ]]; then
|
||||
sudo kill -TERM $(cat $TESTDIR/server.pid)
|
||||
kill -TERM $(cat $TESTDIR/server.pid)
|
||||
rm -f -- $TESTDIR/server.pid
|
||||
fi
|
||||
|
||||
@@ -200,7 +202,7 @@ test_run() {
|
||||
ret=$?
|
||||
|
||||
if [[ -s $TESTDIR/server.pid ]]; then
|
||||
sudo kill -TERM $(cat $TESTDIR/server.pid)
|
||||
kill -TERM $(cat $TESTDIR/server.pid)
|
||||
rm -f -- $TESTDIR/server.pid
|
||||
fi
|
||||
|
||||
@@ -212,7 +214,7 @@ test_setup() {
|
||||
dd if=/dev/null of=$TESTDIR/server.ext3 bs=1M seek=60
|
||||
mke2fs -j -F $TESTDIR/server.ext3
|
||||
mkdir $TESTDIR/mnt
|
||||
sudo mount -o loop $TESTDIR/server.ext3 $TESTDIR/mnt
|
||||
mount -o loop $TESTDIR/server.ext3 $TESTDIR/mnt
|
||||
|
||||
|
||||
export kernel=$KVERSION
|
||||
@@ -279,7 +281,7 @@ test_setup() {
|
||||
inst /etc/group /etc/group
|
||||
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
ldconfig -r "$initdir"
|
||||
dracut_kernel_post
|
||||
)
|
||||
|
||||
@@ -318,14 +320,14 @@ test_setup() {
|
||||
inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'
|
||||
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
ldconfig -r "$initdir"
|
||||
)
|
||||
|
||||
mkdir -p $TESTDIR/mnt/nfs/nfs3-5
|
||||
mkdir -p $TESTDIR/mnt/nfs/ip/192.168.50.101
|
||||
mkdir -p $TESTDIR/mnt/nfs/tftpboot/nfs4-5
|
||||
|
||||
sudo umount $TESTDIR/mnt
|
||||
umount $TESTDIR/mnt
|
||||
rm -fr -- $TESTDIR/mnt
|
||||
|
||||
# Make an overlay with needed tools for the test harness
|
||||
@@ -340,13 +342,13 @@ test_setup() {
|
||||
|
||||
# Make server's dracut image
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "dash udev-rules base rootfs-block fs-lib debug kernel-modules watchdog" \
|
||||
-m "udev-rules base rootfs-block fs-lib debug kernel-modules watchdog" \
|
||||
-d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod e1000 i6300esb" \
|
||||
-f $TESTDIR/initramfs.server $KVERSION || return 1
|
||||
|
||||
# Make client's dracut image
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-o "plymouth dash" \
|
||||
-o "plymouth" \
|
||||
-a "debug watchdog" \
|
||||
-d "af_packet piix ide-gd_mod ata_piix sd_mod e1000 nfs sunrpc i6300esb" \
|
||||
-f $TESTDIR/initramfs.testing $KVERSION || return 1
|
||||
@@ -354,7 +356,7 @@ test_setup() {
|
||||
|
||||
test_cleanup() {
|
||||
if [[ -s $TESTDIR/server.pid ]]; then
|
||||
sudo kill -TERM $(cat $TESTDIR/server.pid)
|
||||
kill -TERM $(cat $TESTDIR/server.pid)
|
||||
rm -f -- $TESTDIR/server.pid
|
||||
fi
|
||||
}
|
||||
|
@@ -25,10 +25,11 @@ run_server() {
|
||||
-net nic,macaddr=52:54:00:12:34:56,model=e1000 \
|
||||
-net nic,macaddr=52:54:00:12:34:57,model=e1000 \
|
||||
-net socket,listen=127.0.0.1:12330 \
|
||||
-append "root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \
|
||||
-initrd $TESTDIR/initramfs.server \
|
||||
-pidfile $TESTDIR/server.pid -daemonize || return 1
|
||||
sudo chmod 644 $TESTDIR/server.pid || return 1
|
||||
chmod 644 $TESTDIR/server.pid || return 1
|
||||
|
||||
# Cleanup the terminal if we have one
|
||||
tty -s && stty sane
|
||||
@@ -49,7 +50,8 @@ run_client() {
|
||||
-net nic,macaddr=52:54:00:12:34:00,model=e1000 \
|
||||
-net nic,macaddr=52:54:00:12:34:01,model=e1000 \
|
||||
-net socket,connect=127.0.0.1:12330 \
|
||||
-append "rw rd.auto rd.retry=50 console=ttyS0,115200n81 selinux=0 rd.debug=0 $DEBUGFAIL $*" \
|
||||
-no-reboot \
|
||||
-append "panic=1 rw rd.auto rd.device.timeout=300 rd.retry=50 console=ttyS0,115200n81 selinux=0 rd.debug=0 $DEBUGFAIL $*" \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
if ! grep -F -m 1 -q iscsi-OK $TESTDIR/client.img; then
|
||||
echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
|
||||
@@ -129,15 +131,15 @@ test_run() {
|
||||
do_test_run
|
||||
ret=$?
|
||||
if [[ -s $TESTDIR/server.pid ]]; then
|
||||
sudo kill -TERM $(cat $TESTDIR/server.pid)
|
||||
kill -TERM $(cat $TESTDIR/server.pid)
|
||||
rm -f -- $TESTDIR/server.pid
|
||||
fi
|
||||
return $ret
|
||||
}
|
||||
|
||||
test_setup() {
|
||||
if [ ! -x /usr/sbin/iscsi-target ]; then
|
||||
echo "Need iscsi-target from netbsd-iscsi"
|
||||
if ! command -v tgtd &>/dev/null || ! command -v tgtadm &>/dev/null; then
|
||||
echo "Need tgtd and tgtadm from scsi-target-utils"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -169,7 +171,7 @@ test_setup() {
|
||||
inst_simple /etc/os-release
|
||||
inst ./client-init.sh /sbin/init
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
ldconfig -r "$initdir"
|
||||
)
|
||||
|
||||
# second, install the files needed to make the root filesystem
|
||||
@@ -186,7 +188,7 @@ test_setup() {
|
||||
# We do it this way so that we do not risk trashing the host mdraid
|
||||
# devices, volume groups, encrypted partitions, etc.
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-m "crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
||||
@@ -216,8 +218,8 @@ test_setup() {
|
||||
inst_hook emergency 000 ./hard-off.sh
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
)
|
||||
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-o "dash plymouth dmraid nfs" \
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-o "plymouth dmraid nfs" \
|
||||
-a "debug" \
|
||||
-d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod" \
|
||||
--no-hostonly-cmdline -N \
|
||||
@@ -227,7 +229,7 @@ test_setup() {
|
||||
dd if=/dev/null of=$TESTDIR/server.ext3 bs=1M seek=60
|
||||
mkfs.ext3 -j -F $TESTDIR/server.ext3
|
||||
mkdir $TESTDIR/mnt
|
||||
sudo mount -o loop $TESTDIR/server.ext3 $TESTDIR/mnt
|
||||
mount -o loop $TESTDIR/server.ext3 $TESTDIR/mnt
|
||||
|
||||
kernel=$KVERSION
|
||||
(
|
||||
@@ -259,16 +261,16 @@ test_setup() {
|
||||
inst /etc/group /etc/group
|
||||
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
ldconfig -r "$initdir"
|
||||
dracut_kernel_post
|
||||
)
|
||||
|
||||
sudo umount $TESTDIR/mnt
|
||||
umount $TESTDIR/mnt
|
||||
rm -fr -- $TESTDIR/mnt
|
||||
|
||||
# Make server's dracut image
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-a "dash udev-rules base rootfs-block fs-lib debug kernel-modules" \
|
||||
-a "udev-rules base rootfs-block fs-lib debug kernel-modules" \
|
||||
-d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod e1000 drbg" \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f $TESTDIR/initramfs.server $KVERSION || return 1
|
||||
@@ -277,7 +279,7 @@ test_setup() {
|
||||
|
||||
test_cleanup() {
|
||||
if [[ -s $TESTDIR/server.pid ]]; then
|
||||
sudo kill -TERM $(cat $TESTDIR/server.pid)
|
||||
kill -TERM $(cat $TESTDIR/server.pid)
|
||||
rm -f -- $TESTDIR/server.pid
|
||||
fi
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
|
||||
done
|
||||
rm -f -- /etc/lvm/lvm.conf
|
||||
udevadm control --reload
|
||||
echo -n test >keyfile
|
||||
printf test >keyfile
|
||||
cryptsetup -q luksFormat /dev/sdb /keyfile
|
||||
echo "The passphrase is test"
|
||||
cryptsetup luksOpen /dev/sdb dracut_crypt_test </keyfile && \
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -b /dev/mapper/$2 ] && exit 0
|
||||
echo -n test >/keyfile
|
||||
printf test >/keyfile
|
||||
/sbin/cryptsetup luksOpen $1 $2 </keyfile
|
||||
|
||||
|
@@ -24,9 +24,10 @@ run_server() {
|
||||
-net socket,listen=127.0.0.1:12340 \
|
||||
-serial $SERIAL \
|
||||
-kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "root=/dev/sda rootfstype=ext2 rw quiet console=ttyS0,115200n81 selinux=0" \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=/dev/sda rootfstype=ext2 rw quiet console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd $TESTDIR/initramfs.server -pidfile $TESTDIR/server.pid -daemonize || return 1
|
||||
sudo chmod 644 $TESTDIR/server.pid || return 1
|
||||
chmod 644 $TESTDIR/server.pid || return 1
|
||||
|
||||
# Cleanup the terminal if we have one
|
||||
tty -s && stty sane
|
||||
@@ -61,7 +62,8 @@ client_test() {
|
||||
-net nic,macaddr=$mac,model=e1000 \
|
||||
-net socket,connect=127.0.0.1:12340 \
|
||||
-kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "$cmdline $DEBUGFAIL rd.auto rd.info rd.retry=10 ro console=ttyS0,115200n81 selinux=0 " \
|
||||
-no-reboot \
|
||||
-append "panic=1 $cmdline $DEBUGFAIL rd.auto rd.info rd.retry=10 ro console=ttyS0,115200n81 selinux=0 " \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
|
||||
if [[ $? -ne 0 ]] || ! grep -F -m 1 -q nbd-OK $TESTDIR/flag.img; then
|
||||
@@ -95,7 +97,6 @@ client_test() {
|
||||
}
|
||||
|
||||
test_run() {
|
||||
modinfo nbd &>/dev/null || { echo "Kernel does not support nbd"; exit 1; }
|
||||
if ! run_server; then
|
||||
echo "Failed to start server" 1>&2
|
||||
return 1
|
||||
@@ -180,7 +181,7 @@ client_run() {
|
||||
"root=LABEL=dracut rd.luks.uuid=$ID_FS_UUID rd.lv.vg=dracut netroot=dhcp" || return 1
|
||||
|
||||
if [[ -s server.pid ]]; then
|
||||
sudo kill -TERM $(cat $TESTDIR/server.pid)
|
||||
kill -TERM $(cat $TESTDIR/server.pid)
|
||||
rm -f -- $TESTDIR/server.pid
|
||||
fi
|
||||
|
||||
@@ -208,7 +209,7 @@ make_encrypted_root() {
|
||||
inst_simple /etc/os-release
|
||||
find_binary plymouth >/dev/null && inst_multiple plymouth
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
ldconfig -r "$initdir"
|
||||
)
|
||||
|
||||
# second, install the files needed to make the root filesystem
|
||||
@@ -226,7 +227,7 @@ make_encrypted_root() {
|
||||
# We do it this way so that we do not risk trashing the host mdraid
|
||||
# devices, volume groups, encrypted partitions, etc.
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-m "crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-d "piix ide-gd_mod ata_piix ext2 ext3 sd_mod" \
|
||||
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
||||
rm -rf -- $TESTDIR/overlay
|
||||
@@ -248,7 +249,7 @@ make_client_root() {
|
||||
dd if=/dev/null of=$TESTDIR/nbd.ext2 bs=1M seek=30
|
||||
mke2fs -F -j $TESTDIR/nbd.ext2
|
||||
mkdir $TESTDIR/mnt
|
||||
sudo mount -o loop $TESTDIR/nbd.ext2 $TESTDIR/mnt
|
||||
mount -o loop $TESTDIR/nbd.ext2 $TESTDIR/mnt
|
||||
|
||||
kernel=$KVERSION
|
||||
(
|
||||
@@ -272,10 +273,10 @@ make_client_root() {
|
||||
inst $i
|
||||
done
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
ldconfig -r "$initdir"
|
||||
)
|
||||
|
||||
sudo umount $TESTDIR/mnt
|
||||
umount $TESTDIR/mnt
|
||||
rm -fr -- $TESTDIR/mnt
|
||||
}
|
||||
|
||||
@@ -283,7 +284,7 @@ make_server_root() {
|
||||
dd if=/dev/null of=$TESTDIR/server.ext2 bs=1M seek=30
|
||||
mke2fs -F $TESTDIR/server.ext2
|
||||
mkdir $TESTDIR/mnt
|
||||
sudo mount -o loop $TESTDIR/server.ext2 $TESTDIR/mnt
|
||||
mount -o loop $TESTDIR/server.ext2 $TESTDIR/mnt
|
||||
|
||||
kernel=$KVERSION
|
||||
(
|
||||
@@ -317,17 +318,14 @@ make_server_root() {
|
||||
done
|
||||
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
ldconfig -r "$initdir"
|
||||
)
|
||||
|
||||
sudo umount $TESTDIR/mnt
|
||||
umount $TESTDIR/mnt
|
||||
rm -fr -- $TESTDIR/mnt
|
||||
}
|
||||
|
||||
test_setup() {
|
||||
|
||||
modinfo nbd &>/dev/null || { echo "Kernel does not support nbd"; exit 1; }
|
||||
|
||||
make_encrypted_root || return 1
|
||||
make_client_root || return 1
|
||||
make_server_root || return 1
|
||||
@@ -351,12 +349,12 @@ test_setup() {
|
||||
echo -n test > $initdir/etc/key
|
||||
)
|
||||
|
||||
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "dash udev-rules rootfs-block fs-lib base debug kernel-modules" \
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "udev-rules rootfs-block fs-lib base debug kernel-modules" \
|
||||
-d "af_packet piix ide-gd_mod ata_piix ext2 ext3 sd_mod e1000" \
|
||||
-f $TESTDIR/initramfs.server $KVERSION || return 1
|
||||
|
||||
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-o "plymouth" \
|
||||
-a "debug watchdog" \
|
||||
-d "af_packet piix ide-gd_mod ata_piix ext2 ext3 sd_mod e1000 i6300esb ib700wdt" \
|
||||
@@ -365,11 +363,17 @@ test_setup() {
|
||||
|
||||
kill_server() {
|
||||
if [[ -s $TESTDIR/server.pid ]]; then
|
||||
sudo kill -TERM $(cat $TESTDIR/server.pid)
|
||||
kill -TERM $(cat $TESTDIR/server.pid)
|
||||
rm -f -- $TESTDIR/server.pid
|
||||
fi
|
||||
}
|
||||
|
||||
test_check() {
|
||||
modinfo nbd &>/dev/null || { echo "Kernel does not support nbd"; return 1; }
|
||||
command -v nbd-client &>/dev/null || { echo "No nbd-client available"; return 1; }
|
||||
command -v nbd-server &>/dev/null || { echo "No nbd-server available"; return 1; }
|
||||
}
|
||||
|
||||
test_cleanup() {
|
||||
kill_server
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user