Compare commits
331 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6b82776107 | ||
![]() |
57c3103a69 | ||
![]() |
1126a69746 | ||
![]() |
6193b3a6e2 | ||
![]() |
e8a7c2a152 | ||
![]() |
65623826c1 | ||
![]() |
e42ab58a70 | ||
![]() |
937b808a0d | ||
![]() |
2ee1e96e1a | ||
![]() |
c6ccef8827 | ||
![]() |
97dd467e8e | ||
![]() |
fc87cf0e7e | ||
![]() |
75d6e4366a | ||
![]() |
d76ccd07bc | ||
![]() |
e5c337c3b3 | ||
![]() |
e4034dcae3 | ||
![]() |
da6411f59c | ||
![]() |
af97814e42 | ||
![]() |
ecd196732f | ||
![]() |
5f381a151f | ||
![]() |
8df75b1573 | ||
![]() |
013030d947 | ||
![]() |
f055e5126f | ||
![]() |
c9e0ee2c91 | ||
![]() |
f421aa0f16 | ||
![]() |
125bb747c3 | ||
![]() |
903d6fc2fc | ||
![]() |
249dcc61ea | ||
![]() |
26273649dc | ||
![]() |
15384bcedb | ||
![]() |
dd235965dd | ||
![]() |
388c771a28 | ||
![]() |
f264cfbe8a | ||
![]() |
de688a407c | ||
![]() |
58a5434f75 | ||
![]() |
9dfcc5f066 | ||
![]() |
014a78261d | ||
![]() |
e8ffd4b3d4 | ||
![]() |
19da2dda22 | ||
![]() |
5aadb10791 | ||
![]() |
7812b7a7b0 | ||
![]() |
69a889ee67 | ||
![]() |
9b1d79993d | ||
![]() |
a0e7bc11c8 | ||
![]() |
f93c34935f | ||
![]() |
e076279d38 | ||
![]() |
43d6b9d008 | ||
![]() |
69b5de6251 | ||
![]() |
0259f1c246 | ||
![]() |
240c2fea10 | ||
![]() |
75bf5df420 | ||
![]() |
50c3405ce0 | ||
![]() |
50d75a50fb | ||
![]() |
3d1c9a76e7 | ||
![]() |
0fe8ed5ccb | ||
![]() |
fe89c8f9df | ||
![]() |
6ef3173e86 | ||
![]() |
015d5aee92 | ||
![]() |
0489607bf6 | ||
![]() |
e2afcc958b | ||
![]() |
0e842c4b8b | ||
![]() |
063d6acb7b | ||
![]() |
8131fd3c11 | ||
![]() |
744afe7531 | ||
![]() |
17092b128c | ||
![]() |
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 | ||
![]() |
d2380720db | ||
![]() |
19912dd3c5 | ||
![]() |
3dd6a30ec8 | ||
![]() |
50a0070773 | ||
![]() |
32398e1525 | ||
![]() |
e658251173 | ||
![]() |
3bce34dfd7 | ||
![]() |
d1f7f2ac04 | ||
![]() |
7de064b57c | ||
![]() |
5f24e43401 | ||
![]() |
a594b4e357 | ||
![]() |
5263556ff3 | ||
![]() |
fe74a7069b | ||
![]() |
f059985b14 | ||
![]() |
327d765512 | ||
![]() |
7fd112f20e | ||
![]() |
bcc2132dab | ||
![]() |
13b5c1d09e | ||
![]() |
34b551a1c4 | ||
![]() |
7c0b1d864d | ||
![]() |
fd3eddf069 | ||
![]() |
17cee31b11 | ||
![]() |
7cddfbbadb | ||
![]() |
63e75dc4cd | ||
![]() |
52845b168d | ||
![]() |
c850879b86 | ||
![]() |
b334c83e4a | ||
![]() |
eb87dc91d0 | ||
![]() |
b813b1b306 | ||
![]() |
2182945a9e | ||
![]() |
7316d68353 | ||
![]() |
a4c47ce0dd | ||
![]() |
d8572e0bf4 | ||
![]() |
70f3c07846 | ||
![]() |
0852c38b7a | ||
![]() |
3d1bd59eb0 | ||
![]() |
7c24815034 | ||
![]() |
53537f4d23 | ||
![]() |
b4006781e8 | ||
![]() |
a6befb52eb | ||
![]() |
7f59cbd318 | ||
![]() |
197e4c90b9 | ||
![]() |
3bd3bbec31 | ||
![]() |
35f40b75e4 | ||
![]() |
d3f61fb5cd | ||
![]() |
310574f7ea | ||
![]() |
b70b81f1c4 | ||
![]() |
32770ca79a | ||
![]() |
77f46adf5e | ||
![]() |
d9b5a98532 | ||
![]() |
65977ef1d1 | ||
![]() |
80153acc0f | ||
![]() |
d6bfa7052a | ||
![]() |
942d60d8af | ||
![]() |
69c437dd1c | ||
![]() |
0c0abf97cc | ||
![]() |
2eb3b00133 | ||
![]() |
38180271c5 | ||
![]() |
fb2d643a38 | ||
![]() |
93a5a3d3ca | ||
![]() |
ad565584a3 | ||
![]() |
bfe65f913a | ||
![]() |
415d0c68ab | ||
![]() |
836ca3f47e | ||
![]() |
f74b0a9f38 | ||
![]() |
88329f6b4f | ||
![]() |
1a2c9bbd2d | ||
![]() |
99b9b4896e | ||
![]() |
543a6d5cab | ||
![]() |
d9b00731c8 | ||
![]() |
a9a38f9f60 | ||
![]() |
e25c3dbb6f | ||
![]() |
d544733084 | ||
![]() |
fc0ead21c9 | ||
![]() |
53ecce179b | ||
![]() |
2bb564073b | ||
![]() |
c643f4e8ab | ||
![]() |
1db0d1f78b | ||
![]() |
a6470f332f | ||
![]() |
89948e58fd | ||
![]() |
77ffc465b9 | ||
![]() |
28be8992c3 | ||
![]() |
968c66b609 | ||
![]() |
3cf4ec08e5 | ||
![]() |
77c0b30825 | ||
![]() |
f11d7a81e2 | ||
![]() |
34b49be882 | ||
![]() |
ccebb4c045 | ||
![]() |
2af6708641 | ||
![]() |
900550c4e0 | ||
![]() |
589b4e61e2 | ||
![]() |
7b3178d9ad | ||
![]() |
e5f4bbd804 | ||
![]() |
34203d03c0 | ||
![]() |
4031a2fa64 | ||
![]() |
d02f522089 | ||
![]() |
d8ad687e1a | ||
![]() |
b34bd60c3b | ||
![]() |
afbff20e51 | ||
![]() |
55473e86b6 | ||
![]() |
70b7ec9492 | ||
![]() |
23e3c7f95f | ||
![]() |
db1e692c13 | ||
![]() |
b9c6d2b2af | ||
![]() |
1211a10b95 | ||
![]() |
4350c73199 | ||
![]() |
a218f3253c | ||
![]() |
fe15c6b6cb | ||
![]() |
00c118a93a | ||
![]() |
4ec362ce0b | ||
![]() |
efe5301ab9 | ||
![]() |
da3dacfa5e | ||
![]() |
e2b5b450e7 | ||
![]() |
bd98c4def1 | ||
![]() |
90b5b48734 | ||
![]() |
1ad2884d82 | ||
![]() |
e863891c15 | ||
![]() |
10e5b14705 | ||
![]() |
a503d1dda9 | ||
![]() |
8f1febc874 | ||
![]() |
cf3098064c | ||
![]() |
9eb6db5b9a |
32
Makefile
32
Makefile
@@ -1,6 +1,6 @@
|
||||
-include dracut-version.sh
|
||||
|
||||
VERSION = $(shell [ -d .git ] && git describe --abbrev=0 --tags 2>/dev/null || echo $(DRACUT_VERSION))
|
||||
VERSION = $(shell [ -d .git ] && git describe --abbrev=0 2>/dev/null || echo $(DRACUT_VERSION))
|
||||
GITVERSION = $(shell [ -d .git ] && { v=$$(git describe --tags 2>/dev/null); [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
|
||||
|
||||
-include Makefile.inc
|
||||
@@ -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
|
||||
|
||||
@@ -38,9 +39,9 @@ man8pages = dracut.8 \
|
||||
|
||||
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
|
||||
|
||||
.PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh
|
||||
.PHONY: install clean archive rpm srpm 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)
|
||||
@@ -106,6 +115,7 @@ install: dracut-version.sh
|
||||
install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
|
||||
mkdir -p $(DESTDIR)$(pkglibdir)/dracut.conf.d
|
||||
install -m 0755 dracut-init.sh $(DESTDIR)$(pkglibdir)/dracut-init.sh
|
||||
install -m 0755 dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions.sh
|
||||
install -m 0755 dracut-version.sh $(DESTDIR)$(pkglibdir)/dracut-version.sh
|
||||
ln -fs dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions
|
||||
@@ -152,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
|
||||
@@ -188,7 +200,17 @@ 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 )
|
||||
|
||||
srpm: dracut-$(VERSION).tar.bz2 syncheck
|
||||
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
|
||||
cp dracut-$(VERSION).tar.bz2 "$$rpmbuild"; \
|
||||
LC_MESSAGES=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
|
||||
(cd "$$rpmbuild"; \
|
||||
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
|
||||
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
|
||||
--define "_rpmdir $$PWD" -bs dracut.spec; ) && \
|
||||
( 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/)
|
@@ -1,14 +1,16 @@
|
||||
For the testsuite to work, you will have to install at least the following software packages:
|
||||
dash
|
||||
asciidoc
|
||||
mdadm
|
||||
lvm2
|
||||
cryptsetup
|
||||
nfs-utils
|
||||
netbsd-iscsi
|
||||
nbd
|
||||
dhcp (dhcp-server on openSUSE)
|
||||
dash \
|
||||
bridge-utils \
|
||||
asciidoc \
|
||||
mdadm \
|
||||
lvm2 \
|
||||
cryptsetup \
|
||||
nfs-utils \
|
||||
nbd \
|
||||
dhcp-server \
|
||||
scsi-target-utils \
|
||||
iscsi-initiator-utils
|
||||
|
||||
TEST-04-FULL-SYSTEMD: systemd >= 187
|
||||
|
||||
How to run the testsuite:
|
||||
|
@@ -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
|
||||
;;
|
||||
|
@@ -22,18 +22,62 @@
|
||||
export LC_MESSAGES=C
|
||||
|
||||
if [[ $DRACUT_KERNEL_LAZY ]] && ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then
|
||||
if ! [[ -d "$initdir/.kernelmodseen" ]]; then
|
||||
mkdir -p "$initdir/.kernelmodseen"
|
||||
if [[ -d "$initdir/.kernelmodseen" ]]; then
|
||||
DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen"
|
||||
fi
|
||||
DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen"
|
||||
fi
|
||||
|
||||
if [[ $initdir ]] && ! [[ -d $initdir ]]; then
|
||||
mkdir -p "$initdir"
|
||||
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
|
||||
# issues a standardized warning message
|
||||
require_binaries() {
|
||||
local _module_name="${moddir##*/}"
|
||||
local _ret=0
|
||||
|
||||
if [[ "$1" = "-m" ]]; then
|
||||
_module_name="$2"
|
||||
shift 2
|
||||
fi
|
||||
|
||||
for cmd in "$@"; do
|
||||
if ! find_binary "$cmd" &>/dev/null; then
|
||||
dinfo "dracut module '${_module_name#[0-9][0-9]}' will not be installed, because command '$cmd' could not be found!"
|
||||
((_ret++))
|
||||
fi
|
||||
done
|
||||
return $_ret
|
||||
}
|
||||
|
||||
require_any_binary() {
|
||||
local _module_name="${moddir##*/}"
|
||||
local _ret=1
|
||||
|
||||
if [[ "$1" = "-m" ]]; then
|
||||
_module_name="$2"
|
||||
shift 2
|
||||
fi
|
||||
|
||||
for cmd in "$@"; do
|
||||
if find_binary "$cmd" &>/dev/null; then
|
||||
_ret=0
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if (( $_ret != 0 )); then
|
||||
dinfo "$_module_name: Could not find any command of '$@'!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# find a binary. If we were not passed the full path directly,
|
||||
# search in the usual places to find the binary.
|
||||
@@ -57,17 +101,7 @@ fi
|
||||
|
||||
ldconfig_paths()
|
||||
{
|
||||
local a i
|
||||
declare -A a
|
||||
for i in $(
|
||||
ldconfig -pN 2>/dev/null | grep -F '=>' | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | while read a b c d; do
|
||||
d=${d%/*}
|
||||
printf "%s\n" "$d";
|
||||
done
|
||||
); do
|
||||
a["$i"]=1;
|
||||
done;
|
||||
printf "%s\n" ${!a[@]}
|
||||
ldconfig -pN 2>/dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq
|
||||
}
|
||||
|
||||
# Detect lib paths
|
||||
@@ -129,7 +163,13 @@ srcmods="/lib/modules/$kernel/"
|
||||
}
|
||||
export srcmods
|
||||
|
||||
if ! type dinfo >/dev/null 2>&1; then
|
||||
# is_func <command>
|
||||
# Check whether $1 is a function.
|
||||
is_func() {
|
||||
[[ "$(type -t "$1")" = "function" ]]
|
||||
}
|
||||
|
||||
if ! is_func dinfo >/dev/null 2>&1; then
|
||||
. "$dracutbasedir/dracut-logger.sh"
|
||||
dlog_init
|
||||
fi
|
||||
@@ -162,12 +202,6 @@ mksubdirs() {
|
||||
[[ -e ${1%/*} ]] || mkdir -m 0755 -p -- "${1%/*}"
|
||||
}
|
||||
|
||||
# is_func <command>
|
||||
# Check whether $1 is a function.
|
||||
is_func() {
|
||||
[[ "$(type -t "$1")" = "function" ]]
|
||||
}
|
||||
|
||||
# Function prints global variables in format name=value line by line.
|
||||
# $@ = list of global variables' name
|
||||
print_vars() {
|
||||
@@ -392,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/. ]]
|
||||
@@ -559,7 +593,8 @@ for_each_host_dev_fs()
|
||||
local _dev
|
||||
local _ret=1
|
||||
|
||||
[[ "${!host_fs_types[@]}" ]] || return 0
|
||||
[[ "${#host_fs_types[@]}" ]] || return 2
|
||||
|
||||
|
||||
for _dev in "${!host_fs_types[@]}"; do
|
||||
$_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0
|
||||
@@ -581,13 +616,14 @@ check_block_and_slaves() {
|
||||
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
|
||||
if ! lvm_internal_dev $2; then "$1" $2 && return; fi
|
||||
check_vol_slaves "$@" && return 0
|
||||
if [[ -f /sys/dev/block/$2/../dev ]]; then
|
||||
if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then
|
||||
check_block_and_slaves $1 $(<"/sys/dev/block/$2/../dev") && return 0
|
||||
fi
|
||||
[[ -d /sys/dev/block/$2/slaves ]] || return 1
|
||||
for _x in /sys/dev/block/$2/slaves/*/dev; do
|
||||
[[ -f $_x ]] || continue
|
||||
check_block_and_slaves $1 $(<"$_x") && return 0
|
||||
for _x in /sys/dev/block/$2/slaves/*; do
|
||||
[[ -f $_x/dev ]] || continue
|
||||
[[ $_x/subsystem -ef /sys/class/block ]] || continue
|
||||
check_block_and_slaves $1 $(<"$_x/dev") && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
@@ -598,14 +634,15 @@ check_block_and_slaves_all() {
|
||||
if ! lvm_internal_dev $2 && "$1" $2; then
|
||||
_ret=0
|
||||
fi
|
||||
check_vol_slaves "$@" && return 0
|
||||
if [[ -f /sys/dev/block/$2/../dev ]]; then
|
||||
check_vol_slaves_all "$@" && return 0
|
||||
if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then
|
||||
check_block_and_slaves_all $1 $(<"/sys/dev/block/$2/../dev") && _ret=0
|
||||
fi
|
||||
[[ -d /sys/dev/block/$2/slaves ]] || return 1
|
||||
for _x in /sys/dev/block/$2/slaves/*/dev; do
|
||||
[[ -f $_x ]] || continue
|
||||
check_block_and_slaves_all $1 $(<"$_x") && _ret=0
|
||||
for _x in /sys/dev/block/$2/slaves/*; do
|
||||
[[ -f $_x/dev ]] || continue
|
||||
[[ $_x/subsystem -ef /sys/class/block ]] || continue
|
||||
check_block_and_slaves_all $1 $(<"$_x/dev") && _ret=0
|
||||
done
|
||||
return $_ret
|
||||
}
|
||||
@@ -618,9 +655,9 @@ for_each_host_dev_and_slaves_all()
|
||||
local _dev
|
||||
local _ret=1
|
||||
|
||||
[[ "${host_devs[@]}" ]] || return 0
|
||||
[[ "${host_devs[@]}" ]] || return 2
|
||||
|
||||
for _dev in ${host_devs[@]}; do
|
||||
for _dev in "${host_devs[@]}"; do
|
||||
[[ -b "$_dev" ]] || continue
|
||||
if check_block_and_slaves_all $_func $(get_maj_min $_dev); then
|
||||
_ret=0
|
||||
@@ -634,9 +671,9 @@ for_each_host_dev_and_slaves()
|
||||
local _func="$1"
|
||||
local _dev
|
||||
|
||||
[[ "${host_devs[@]}" ]] || return 0
|
||||
[[ "${host_devs[@]}" ]] || return 2
|
||||
|
||||
for _dev in ${host_devs[@]}; do
|
||||
for _dev in "${host_devs[@]}"; do
|
||||
[[ -b "$_dev" ]] || continue
|
||||
check_block_and_slaves $_func $(get_maj_min $_dev) && return 0
|
||||
done
|
||||
@@ -650,25 +687,44 @@ for_each_host_dev_and_slaves()
|
||||
# but you cannot create the logical volume without the volume group.
|
||||
# And the volume group might be bigger than the devices the LV needs.
|
||||
check_vol_slaves() {
|
||||
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=$(printf "%s\n" "$_vg")
|
||||
if [[ $_vg ]]; then
|
||||
for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
|
||||
do
|
||||
check_block_and_slaves $1 $(get_maj_min $_pv) && return 0
|
||||
done
|
||||
fi
|
||||
fi
|
||||
done
|
||||
local _lv _vg _pv _dm _majmin
|
||||
_majmin="$2"
|
||||
_lv="/dev/block/$_majmin"
|
||||
_dm=/sys/dev/block/$_majmin/dm
|
||||
[[ -f $_dm/uuid && $(<$_dm/uuid) =~ LVM-* ]] || return 1
|
||||
_vg=$(dmsetup splitname --noheadings -o vg_name $(<"$_dm/name") )
|
||||
# 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 $1 $(get_maj_min $_pv) && return 0
|
||||
done
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
check_vol_slaves_all() {
|
||||
local _lv _vg _pv _majmin
|
||||
_majmin="$2"
|
||||
_lv="/dev/block/$_majmin"
|
||||
_dm="/sys/dev/block/$_majmin/dm"
|
||||
[[ -f $_dm/uuid && $(<$_dm/uuid) =~ LVM-* ]] || return 1
|
||||
_vg=$(dmsetup splitname --noheadings -o vg_name $(<"$_dm/name") )
|
||||
# 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
|
||||
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
|
||||
@@ -1055,7 +1111,7 @@ module_check() {
|
||||
. $_moddir/module-setup.sh
|
||||
is_func check || return 0
|
||||
[ $_forced -ne 0 ] && unset hostonly
|
||||
check $hostonly
|
||||
moddir=$_moddir check $hostonly
|
||||
_ret=$?
|
||||
unset check depends cmdline install installkernel
|
||||
fi
|
||||
@@ -1081,7 +1137,7 @@ module_check_mount() {
|
||||
unset check depends cmdline install installkernel
|
||||
check() { false; }
|
||||
. $_moddir/module-setup.sh
|
||||
check 0
|
||||
moddir=$_moddir check 0
|
||||
_ret=$?
|
||||
unset check depends cmdline install installkernel
|
||||
fi
|
||||
@@ -1105,7 +1161,7 @@ module_depends() {
|
||||
unset check depends cmdline install installkernel
|
||||
depends() { true; }
|
||||
. $_moddir/module-setup.sh
|
||||
depends
|
||||
moddir=$_moddir depends
|
||||
_ret=$?
|
||||
unset check depends cmdline install installkernel
|
||||
return $_ret
|
||||
@@ -1126,7 +1182,7 @@ module_cmdline() {
|
||||
unset check depends cmdline install installkernel
|
||||
cmdline() { true; }
|
||||
. $_moddir/module-setup.sh
|
||||
cmdline
|
||||
moddir=$_moddir cmdline
|
||||
_ret=$?
|
||||
unset check depends cmdline install installkernel
|
||||
return $_ret
|
||||
@@ -1147,7 +1203,7 @@ module_install() {
|
||||
unset check depends cmdline install installkernel
|
||||
install() { true; }
|
||||
. $_moddir/module-setup.sh
|
||||
install
|
||||
moddir=$_moddir install
|
||||
_ret=$?
|
||||
unset check depends cmdline install installkernel
|
||||
return $_ret
|
||||
@@ -1168,7 +1224,7 @@ module_installkernel() {
|
||||
unset check depends cmdline install installkernel
|
||||
installkernel() { true; }
|
||||
. $_moddir/module-setup.sh
|
||||
installkernel
|
||||
moddir=$_moddir installkernel
|
||||
_ret=$?
|
||||
unset check depends cmdline install installkernel
|
||||
return $_ret
|
||||
@@ -1184,7 +1240,7 @@ check_mount() {
|
||||
local _ret
|
||||
local _moddep
|
||||
|
||||
[ "${#host_fs_types[*]}" -le 0 ] && return 1
|
||||
[ "${#host_fs_types[@]}" -le 0 ] && return 1
|
||||
|
||||
# If we are already scheduled to be loaded, no need to check again.
|
||||
[[ " $mods_to_load " == *\ $_mod\ * ]] && return 0
|
||||
@@ -1680,9 +1736,8 @@ get_ucode_file ()
|
||||
local stepping=`grep -E "stepping" /proc/cpuinfo | head -1 | sed s/.*:\ //`
|
||||
|
||||
if [[ "$(get_cpu_vendor)" == "AMD" ]]; then
|
||||
# If family greater or equal than 0x15
|
||||
if [[ $family -ge 21 ]]; then
|
||||
printf "microcode_amd_fam15h.bin"
|
||||
printf "microcode_amd_fam%xh.bin" $family
|
||||
else
|
||||
printf "microcode_amd.bin"
|
||||
fi
|
||||
@@ -1693,6 +1748,17 @@ get_ucode_file ()
|
||||
fi
|
||||
}
|
||||
|
||||
# Get currently loaded modules
|
||||
# sorted, and delimited by newline
|
||||
get_loaded_kernel_modules ()
|
||||
{
|
||||
local modules=( )
|
||||
while read _module _size _used _used_by; do
|
||||
modules+=( "$_module" )
|
||||
done <<< "$(lsmod | sed -n '1!p')"
|
||||
printf '%s\n' "${modules[@]}" | sort
|
||||
}
|
||||
|
||||
# Not every device in /dev/mapper should be examined.
|
||||
# If it is an LVM device, touch only devices which have /dev/VG/LV symlink.
|
||||
lvm_internal_dev() {
|
||||
@@ -1704,3 +1770,14 @@ lvm_internal_dev() {
|
||||
[[ ${DM_LV_LAYER} ]] || [[ ! -L /dev/${DM_VG_NAME}/${DM_LV_NAME} ]]
|
||||
}
|
||||
|
||||
# Use with form hostonly="$(optional_hostonly)" inst_xxxx <args>
|
||||
# If hosotnly mode is set to "strict", hostonly restrictions will still
|
||||
# be applied, else will ignore hostonly mode and try to install all
|
||||
# given modules.
|
||||
optional_hostonly() {
|
||||
if [[ $hostonly_mode = "strict" ]]; then
|
||||
printf -- "$hostonly"
|
||||
else
|
||||
printf ""
|
||||
fi
|
||||
}
|
||||
|
34
dracut-init.sh
Normal file
34
dracut-init.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# functions used by dracut and other tools.
|
||||
#
|
||||
# Copyright 2005-2009 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
export LC_MESSAGES=C
|
||||
|
||||
if [[ $DRACUT_KERNEL_LAZY ]] && ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then
|
||||
if ! [[ -d "$initdir/.kernelmodseen" ]]; then
|
||||
mkdir -p "$initdir/.kernelmodseen"
|
||||
fi
|
||||
DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen"
|
||||
fi
|
||||
|
||||
if [[ $initdir ]] && ! [[ -d $initdir ]]; then
|
||||
mkdir -p "$initdir"
|
||||
fi
|
||||
|
||||
[[ $dracutbasedir ]] || export dracutbasedir=${BASH_SOURCE%/*}
|
||||
. $dracutbasedir/dracut-functions.sh
|
@@ -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" &
|
||||
@@ -367,7 +366,7 @@ dlog() {
|
||||
if (( $# > 1 )); then
|
||||
_do_dlog "$@"
|
||||
else
|
||||
while read line; do
|
||||
while read line || [ -n "$line" ]; do
|
||||
_do_dlog "$1" "$line"
|
||||
done
|
||||
fi
|
||||
|
26
dracut.8.asc
26
dracut.8.asc
@@ -136,6 +136,19 @@ example:
|
||||
----
|
||||
===============================
|
||||
|
||||
**--force-drivers** _<list of kernel modules>_::
|
||||
See add-drivers above. But in this case it is ensured that the drivers
|
||||
are tried to be loaded early via modprobe.
|
||||
+
|
||||
[NOTE]
|
||||
===============================
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes. For
|
||||
example:
|
||||
----
|
||||
# dracut --force-drivers "kmodule1 kmodule2" ...
|
||||
----
|
||||
===============================
|
||||
|
||||
**--omit-drivers** _<list of kernel modules>_::
|
||||
specify a space-separated list of kernel modules not to add to the
|
||||
initramfs.
|
||||
@@ -306,6 +319,16 @@ provide a valid _/etc/fstab_.
|
||||
**--no-hostonly-cmdline**:
|
||||
Do not store kernel command line arguments needed in the initramfs
|
||||
|
||||
**--no-hostonly-default-device**:
|
||||
Do not generate implicit host devices like root, swap, fstab, etc.
|
||||
Use "--mount" or "--add-device" to explicitly add devices as needed.
|
||||
|
||||
**--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 +372,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**::
|
||||
@@ -441,7 +449,7 @@ USB Android phone::
|
||||
* enp0s29u1u2
|
||||
=====================
|
||||
|
||||
**ip=**__{dhcp|on|any|dhcp6|auto6}__::
|
||||
**ip=**__{dhcp|on|any|dhcp6|auto6|either6}__::
|
||||
dhcp|on|any::: get ip from dhcp server from all interfaces. If root=dhcp,
|
||||
loop sequentially through all interfaces (eth0, eth1, ...) and use the first
|
||||
with a valid DHCP root-path.
|
||||
@@ -450,6 +458,8 @@ USB Android phone::
|
||||
|
||||
dhcp6::: IPv6 DHCP
|
||||
|
||||
either6::: if auto6 fails, then dhcp6
|
||||
|
||||
**ip=**__<interface>__:__{dhcp|on|any|dhcp6|auto6}__[:[__<mtu>__][:__<macaddr>__]]::
|
||||
This parameter can be specified multiple times.
|
||||
+
|
||||
@@ -461,7 +471,7 @@ cannot be used in conjunction with the **ifname** argument for the
|
||||
same <interface>.
|
||||
=====================
|
||||
|
||||
**ip=**__<client-IP>__:[__<peer>__]:__<gateway-IP>__:__<netmask>__:__<client_hostname>__:__<interface>__:__{none|off|dhcp|on|any|dhcp6|auto6|ibft}__:[:[__<mtu>__][:__<macaddr>__]]::
|
||||
**ip=**__<client-IP>__:[__<peer>__]:__<gateway-IP>__:__<netmask>__:__<client_hostname>__:__<interface>__:__{none|off|dhcp|on|any|dhcp6|auto6|ibft}__[:[__<mtu>__][:__<macaddr>__]]::
|
||||
explicit network configuration. If you want do define a IPv6 address, put it
|
||||
in brackets (e.g. [2001:DB8::1]). This parameter can be specified multiple
|
||||
times. __<peer>__ is optional and is the address of the remote endpoint
|
||||
@@ -572,6 +582,31 @@ NFS
|
||||
**rd.nfs.domain=**__<NFSv4 domain name>__::
|
||||
Set the NFSv4 domain name. Will overwrite the settings in _/etc/idmap.conf_.
|
||||
|
||||
**rd.net.dhcp.retry=**__<cnt>__::
|
||||
If this option is set, dracut will try to connect via dhcp <cnt> times before failing.
|
||||
Default is 1.
|
||||
|
||||
**rd.net.timeout.dhcp=**__<arg>__::
|
||||
If this option is set, dhclient is called with "-timeout <arg>".
|
||||
|
||||
**rd.net.timeout.iflink=**__<seconds>__::
|
||||
Wait <seconds> until link shows up. Default is 60 seconds.
|
||||
|
||||
**rd.net.timeout.ifup=**__<seconds>__::
|
||||
Wait <seconds> until link has state "UP". Default is 20 seconds.
|
||||
|
||||
**rd.net.timeout.route=**__<seconds>__::
|
||||
Wait <seconds> until route shows up. Default is 20 seconds.
|
||||
|
||||
**rd.net.timeout.ipv6dad=**__<seconds>__::
|
||||
Wait <seconds> until IPv6 DAD is finished. Default is 50 seconds.
|
||||
|
||||
**rd.net.timeout.ipv6auto=**__<seconds>__::
|
||||
Wait <seconds> until IPv6 automatic addresses are assigned. Default is 40 seconds.
|
||||
|
||||
**rd.net.timeout.carrier=**__<seconds>__::
|
||||
Wait <seconds> until carrier is recognized. Default is 5 seconds.
|
||||
|
||||
CIFS
|
||||
~~~
|
||||
**root=**cifs://[__<username>__[:__<password>__]@]__<server-ip>__:__<root-dir>__::
|
||||
@@ -679,6 +714,12 @@ iscsistart -b --param node.session.timeo.replacement_timeout=30
|
||||
**rd.iscsi.ibft** **rd.iscsi.ibft=1**:
|
||||
Turn on iBFT autoconfiguration for the interfaces
|
||||
|
||||
**rd.iscsi.waitnet=0**:
|
||||
Turn off waiting for all interfaces to be up before trying to login to the iSCSI targets.
|
||||
|
||||
**rd.iscsi.testroute=0**:
|
||||
Turn off checking, if the route to the iSCSI target IP is possible before trying to login.
|
||||
|
||||
FCoE
|
||||
~~~~
|
||||
**fcoe=**__<edd|interface|MAC>__:__{dcb|nodcb}__::
|
||||
@@ -729,10 +770,118 @@ rd.znet=qeth,0.0.0600,0.0.0601,0.0.0602,layer2=1,portname=foo
|
||||
rd.znet=ctc,0.0.0600,0.0.0601,protocol=bar
|
||||
--
|
||||
|
||||
Booting live images
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
Dracut offers multiple options for live booted images:
|
||||
|
||||
=====================
|
||||
squashfs with read-only filesystem image::: The system will boot with a read
|
||||
only filesystem from the squashfs and apply a writable device mapper snapshot
|
||||
over the read only filesystem. Using this method ensures a relatively fast
|
||||
boot and lower RAM usage. Users **must be careful** to avoid writing too many
|
||||
blocks to the snapshot volume. Once the blocks of the snapshot are exhaused,
|
||||
the live filesystem becomes unusable and requires a reboot.
|
||||
+
|
||||
The filesystem structure is expected to be:
|
||||
+
|
||||
[listing]
|
||||
--
|
||||
squashfs.img | Squashfs downloaded via network
|
||||
!(mount)
|
||||
/LiveOS
|
||||
|- ext3fs.img | Filesystem image to mount read-only
|
||||
!(mount)
|
||||
/bin | Live filesystem
|
||||
/boot |
|
||||
/dev |
|
||||
... |
|
||||
--
|
||||
+
|
||||
Dracut uses this method of live booting by default. No additional command line
|
||||
options are required other than **root=live:<URL>** to specify the location
|
||||
of your squashed filesystem.
|
||||
+
|
||||
writable filesystem image::: The system will retrieve a compressed filesystem
|
||||
image, connect it to a loopback device, and mount it as a writable volume. More
|
||||
RAM is required during boot but the live filesystem is easier to manage if it
|
||||
becomes full. Users can make a filesystem image of any size and that size will
|
||||
be maintained when the system boots.
|
||||
+
|
||||
The filesystem structure is expected to be:
|
||||
+
|
||||
[listing]
|
||||
--
|
||||
rootfs.tgz | Compressed tarball containing fileystem image
|
||||
!(unpack)
|
||||
/rootfs.img | Filesystem image
|
||||
!(mount)
|
||||
/bin | Live filesystem
|
||||
/boot |
|
||||
/dev |
|
||||
... |
|
||||
--
|
||||
+
|
||||
To use this boot option, ensure that **rd.writable_fsimg=1** is in your kernel
|
||||
command line and add the **root=live:<URL>** to specify the location
|
||||
of your compressed filesystem image tarball.
|
||||
=====================
|
||||
|
||||
**root=**live:__<url>__::
|
||||
Boots a live image retrieved from __<url>__. Valid handlers: __http, httpd, ftp, tftp__.
|
||||
+
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
root=live:http://example.com/liveboot.img
|
||||
root=live:ftp://ftp.example.com/liveboot.img
|
||||
--
|
||||
|
||||
**rd.live.debug=**1::
|
||||
Enables debug output from the live boot process.
|
||||
|
||||
**rd.live.dir=**__<path>__::
|
||||
Specifies the directory within the squashfs where the ext3fs.img or rootfs.img
|
||||
can be found. By default, this is __LiveOS__.
|
||||
|
||||
**rd.live.ram=**1::
|
||||
Copy the complete image to RAM and use this for booting. This is useful
|
||||
when the image resides on i.e. a DVD which needs to be ejected later on.
|
||||
|
||||
**rd.live.overlay=**_<devspec>_:_(<pathspec>|auto)__
|
||||
Allow the usage of a permanent overlay.
|
||||
_<devspec>_ specifies the path to a device with a mountable filesystem.
|
||||
_<pathspec>_ is the path to a file within that filesystem, which shall be used to
|
||||
persist the changes made to the device specified by **root=live:__<url>__** option.
|
||||
+
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
rd.live.overlay=/dev/sdb1:persistent-overlay.img
|
||||
--
|
||||
|
||||
**rd.live.overlay.thin=**1::
|
||||
Enables the usage of thin snapshots instead of classic dm snapshots.
|
||||
The advantage of thin snapshots is, that they support discards, and will free
|
||||
blocks which are not claimed by the filesystem. In this use case this means,
|
||||
that memory is given back to the kernel, when the filesystem does not claim it
|
||||
anymore.
|
||||
|
||||
**rd.writable.fsimg=**1::
|
||||
Enables writable filesystem support. The system will boot with a fully
|
||||
writable filesystem without snapshots __(see notes above about available live boot options)__.
|
||||
You can use the **rootflags** option to set mount options for the live
|
||||
filesystem as well __(see documentation about rootflags in the **Standard** section above)__.
|
||||
This implies that the whole image is copied to RAM before the boot continues.
|
||||
+
|
||||
NOTE: There must be enough free RAM available to hold the complete image.
|
||||
+
|
||||
This method is very suitable for diskless boots.
|
||||
|
||||
|
||||
Plymouth Boot Splash
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
**plymouth.enable=0**::
|
||||
disable the plymouth bootsplash completly.
|
||||
disable the plymouth bootsplash completely.
|
||||
|
||||
**rd.plymouth=0**::
|
||||
disable the plymouth bootsplash only for the initramfs.
|
||||
|
@@ -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_.
|
||||
@@ -49,6 +54,10 @@ Configuration files must have the extension .conf; other extensions are ignored.
|
||||
Specify a space-separated list of kernel modules to add to the initramfs.
|
||||
The kernel modules have to be specified without the ".ko" suffix.
|
||||
|
||||
*force_drivers+=*" __<list of kernel modules>__ "::
|
||||
See add_drivers above. But in this case it is ensured that the drivers
|
||||
are tried to be loaded early via modprobe.
|
||||
|
||||
*omit_drivers+=*" __<kernel modules>__ "::
|
||||
Specify a space-separated list of kernel modules not to add to the
|
||||
initramfs. The kernel modules have to be specified without the ".ko" suffix.
|
||||
@@ -66,6 +75,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 +92,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
|
||||
|
316
dracut.sh
316
dracut.sh
@@ -23,6 +23,8 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
unset BASH_ENV
|
||||
|
||||
# store for logging
|
||||
dracut_args=( "$@" )
|
||||
|
||||
@@ -81,6 +83,10 @@ Creates initial ramdisk images for preloading modules
|
||||
exclusively include in the initramfs.
|
||||
--add-drivers [LIST] Specify a space-separated list of kernel
|
||||
modules to add to the initramfs.
|
||||
--force-drivers [LIST] Specify a space-separated list of kernel
|
||||
modules to add to the initramfs and make sure they
|
||||
are tried to be loaded via modprobe same as passing
|
||||
rd.driver.pre=DRIVER kernel parameter.
|
||||
--omit-drivers [LIST] Specify a space-separated list of kernel
|
||||
modules not to add to the initramfs.
|
||||
--filesystems [LIST] Specify a space-separated list of kernel filesystem
|
||||
@@ -137,10 +143,32 @@ Creates initial ramdisk images for preloading modules
|
||||
-H, --hostonly Host-Only mode: Install only what is needed for
|
||||
booting the local host instead of a generic host.
|
||||
-N, --no-hostonly Disables Host-Only mode
|
||||
--hostonly-mode <mode>
|
||||
Specify the hostonly mode to use. <mode> could be
|
||||
one of "sloppy" or "strict". "sloppy" mode is used
|
||||
by default.
|
||||
In "sloppy" hostonly mode, extra drivers and modules
|
||||
will be installed, so minor hardware change won't make
|
||||
the image unbootable (eg. changed keyboard), and the
|
||||
image is still portable among similar hosts.
|
||||
With "strict" mode enabled, anything not necessary
|
||||
for booting the local host in its current state will
|
||||
not be included, and modules may do some extra job
|
||||
to save more space. Minor change of hardware or
|
||||
environment could make the image unbootable.
|
||||
DO NOT use "strict" mode unless you know what you
|
||||
are doing.
|
||||
--hostonly-cmdline Store kernel command line arguments needed
|
||||
in the initramfs
|
||||
--no-hostonly-cmdline Do not store kernel command line arguments needed
|
||||
in the initramfs
|
||||
--no-hostonly-default-device
|
||||
Do not generate implicit host devices like root,
|
||||
swap, fstab, etc. Use "--mount" or "--add-device"
|
||||
to explicitly add devices as needed.
|
||||
--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 +186,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.
|
||||
@@ -299,12 +329,14 @@ rearrange_params()
|
||||
--long add: \
|
||||
--long force-add: \
|
||||
--long add-drivers: \
|
||||
--long force-drivers: \
|
||||
--long omit-drivers: \
|
||||
--long modules: \
|
||||
--long omit: \
|
||||
--long drivers: \
|
||||
--long filesystems: \
|
||||
--long install: \
|
||||
--long install-optional: \
|
||||
--long fwdir: \
|
||||
--long libdirs: \
|
||||
--long fscks: \
|
||||
@@ -349,8 +381,10 @@ rearrange_params()
|
||||
--long host-only \
|
||||
--long no-hostonly \
|
||||
--long no-host-only \
|
||||
--long hostonly-mode: \
|
||||
--long hostonly-cmdline \
|
||||
--long no-hostonly-cmdline \
|
||||
--long no-hostonly-default-device \
|
||||
--long persistent-policy: \
|
||||
--long fstab \
|
||||
--long help \
|
||||
@@ -369,6 +403,8 @@ rearrange_params()
|
||||
--long noimageifnotneeded \
|
||||
--long early-microcode \
|
||||
--long no-early-microcode \
|
||||
--long no-hostonly-i18n \
|
||||
--long hostonly-i18n \
|
||||
-- "$@")
|
||||
|
||||
if (( $? != 0 )); then
|
||||
@@ -463,12 +499,16 @@ while :; do
|
||||
-a|--add) push add_dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--force-add) push force_add_dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--add-drivers) push add_drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--force-drivers) push force_drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--omit-drivers) push omit_drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
-m|--modules) push dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
-o|--omit) push omit_dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
-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;;
|
||||
@@ -519,17 +559,25 @@ while :; do
|
||||
-q|--quiet) ((verbosity_mod_l--));;
|
||||
-l|--local)
|
||||
allowlocal="yes"
|
||||
[[ -f "$(readlink -f "${0%/*}")/dracut-functions.sh" ]] \
|
||||
[[ -f "$(readlink -f "${0%/*}")/dracut-init.sh" ]] \
|
||||
&& dracutbasedir="$(readlink -f "${0%/*}")"
|
||||
;;
|
||||
-H|--hostonly|--host-only)
|
||||
hostonly_l="yes" ;;
|
||||
-N|--no-hostonly|--no-host-only)
|
||||
hostonly_l="no" ;;
|
||||
--hostonly-mode)
|
||||
hostonly_mode_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--hostonly-cmdline)
|
||||
hostonly_cmdline_l="yes" ;;
|
||||
--hostonly-i18n)
|
||||
i18n_install_all_l="no" ;;
|
||||
--no-hostonly-i18n)
|
||||
i18n_install_all_l="yes" ;;
|
||||
--no-hostonly-cmdline)
|
||||
hostonly_cmdline_l="no" ;;
|
||||
--no-hostonly-default-device)
|
||||
hostonly_default_device="no" ;;
|
||||
--persistent-policy)
|
||||
persistent_policy_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--fstab) use_fstab_l="yes" ;;
|
||||
@@ -716,6 +764,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=''
|
||||
@@ -769,12 +823,14 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||
[[ $prefix = "/" ]] && unset prefix
|
||||
[[ $hostonly_l ]] && hostonly=$hostonly_l
|
||||
[[ $hostonly_cmdline_l ]] && hostonly_cmdline=$hostonly_cmdline_l
|
||||
[[ $hostonly_mode_l ]] && hostonly_mode=$hostonly_mode_l
|
||||
[[ $i18n_install_all_l ]] && i18n_install_all=$i18n_install_all_l
|
||||
[[ $persistent_policy_l ]] && persistent_policy=$persistent_policy_l
|
||||
[[ $use_fstab_l ]] && use_fstab=$use_fstab_l
|
||||
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
|
||||
[[ $lvmconf_l ]] && lvmconf=$lvmconf_l
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
[[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware"
|
||||
[[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware /lib/firmware/$kernel"
|
||||
[[ $tmpdir_l ]] && tmpdir="$tmpdir_l"
|
||||
[[ $tmpdir ]] || tmpdir=/var/tmp
|
||||
[[ $INITRD_COMPRESS ]] && compress=$INITRD_COMPRESS
|
||||
@@ -805,32 +861,41 @@ fi
|
||||
[[ $hostonly = yes ]] && hostonly="-h"
|
||||
[[ $hostonly != "-h" ]] && unset hostonly
|
||||
|
||||
case $hostonly_mode in
|
||||
'')
|
||||
[[ $hostonly ]] && hostonly_mode="sloppy" ;;
|
||||
sloppy|strict)
|
||||
if [[ ! $hostonly ]]; then
|
||||
unset hostonly_mode
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
printf "%s\n" "dracut: Invalid hostonly mode '$hostonly_mode'." >&2
|
||||
exit 1
|
||||
esac
|
||||
|
||||
|
||||
|
||||
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"
|
||||
|
||||
@@ -841,10 +906,14 @@ if [[ $print_cmdline ]]; then
|
||||
kmsgloglvl=0
|
||||
fi
|
||||
|
||||
if [[ -f $dracutbasedir/dracut-functions.sh ]]; then
|
||||
. $dracutbasedir/dracut-functions.sh
|
||||
if [[ -f $dracutbasedir/dracut-version.sh ]]; then
|
||||
. $dracutbasedir/dracut-version.sh
|
||||
fi
|
||||
|
||||
if [[ -f $dracutbasedir/dracut-init.sh ]]; then
|
||||
. $dracutbasedir/dracut-init.sh
|
||||
else
|
||||
printf "%s\n" "dracut: Cannot find $dracutbasedir/dracut-functions.sh." >&2
|
||||
printf "%s\n" "dracut: Cannot find $dracutbasedir/dracut-init.sh." >&2
|
||||
printf "%s\n" "dracut: Are you running from a git checkout?" >&2
|
||||
printf "%s\n" "dracut: Try passing -l as an argument to $0" >&2
|
||||
exit 1
|
||||
@@ -859,10 +928,6 @@ if ! [[ $print_cmdline ]]; then
|
||||
rm -fr -- ${initdir}/*
|
||||
fi
|
||||
|
||||
if [[ -f $dracutbasedir/dracut-version.sh ]]; then
|
||||
. $dracutbasedir/dracut-version.sh
|
||||
fi
|
||||
|
||||
# Verify bash version, current minimum is 3.1
|
||||
if (( BASH_VERSINFO[0] < 4 )); then
|
||||
dfatal 'You need at least Bash 4 to use dracut, sorry.'
|
||||
@@ -872,6 +937,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
|
||||
@@ -887,6 +970,13 @@ if (( ${#add_drivers_l[@]} )); then
|
||||
fi
|
||||
add_drivers=${add_drivers/-/_}
|
||||
|
||||
if (( ${#force_drivers_l[@]} )); then
|
||||
while pop force_drivers_l val; do
|
||||
force_drivers+=" $val "
|
||||
done
|
||||
fi
|
||||
force_drivers=${force_drivers/-/_}
|
||||
|
||||
if (( ${#omit_drivers_l[@]} )); then
|
||||
while pop omit_drivers_l val; do
|
||||
omit_drivers+=" $val "
|
||||
@@ -903,6 +993,7 @@ fi
|
||||
omit_drivers_corrected=""
|
||||
for d in $omit_drivers; do
|
||||
[[ " $drivers $add_drivers " == *\ $d\ * ]] && continue
|
||||
[[ " $drivers $force_drivers " == *\ $d\ * ]] && continue
|
||||
omit_drivers_corrected+="$d|"
|
||||
done
|
||||
omit_drivers="${omit_drivers_corrected%|}"
|
||||
@@ -935,9 +1026,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
|
||||
@@ -1000,7 +1096,7 @@ if (( ${#add_device_l[@]} )); then
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
|
||||
# in hostonly mode, determine all devices, which have to be accessed
|
||||
# and examine them for filesystem types
|
||||
|
||||
@@ -1045,7 +1141,7 @@ if [[ $hostonly ]]; then
|
||||
[[ "$_d" -ef "$dev" ]] || continue
|
||||
|
||||
if [[ -f /etc/crypttab ]]; then
|
||||
while read _mapper _a _p _o; do
|
||||
while read _mapper _a _p _o || [ -n "$_mapper" ]; do
|
||||
[[ $_mapper = \#* ]] && continue
|
||||
[[ "$_d" -ef /dev/mapper/"$_mapper" ]] || continue
|
||||
[[ "$_o" ]] || _o="$_p"
|
||||
@@ -1056,11 +1152,29 @@ if [[ $hostonly ]]; then
|
||||
done < /etc/crypttab
|
||||
fi
|
||||
|
||||
push host_devs "$(readlink -f "$dev")"
|
||||
_dev="$(readlink -f "$dev")"
|
||||
push host_devs "$_dev"
|
||||
push swap_devs "$_dev"
|
||||
break
|
||||
done < /etc/fstab
|
||||
done < /proc/swaps
|
||||
fi
|
||||
|
||||
# collect all "x-initrd.mount" entries from /etc/fstab
|
||||
if [[ -f /etc/fstab ]]; then
|
||||
while read _d _m _t _o _r || [ -n "$_d" ]; do
|
||||
[[ "$_d" == \#* ]] && continue
|
||||
[[ $_d ]] || continue
|
||||
[[ "$_o" != *x-initrd.mount* ]] && continue
|
||||
_dev=$(expand_persistent_dev "$_d")
|
||||
_dev="$(readlink -f "$_dev")"
|
||||
[[ -b $_dev ]] && push host_devs "$_dev"
|
||||
done < /etc/fstab
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
# record all host modaliases
|
||||
declare -A host_modalias
|
||||
find /sys/devices/ -name uevent -print > "$initdir/.modalias"
|
||||
@@ -1081,9 +1195,23 @@ if [[ $hostonly ]]; then
|
||||
|
||||
# check /proc/modules
|
||||
declare -A host_modules
|
||||
while read m rest; do
|
||||
host_modules["$m"]=1
|
||||
done </proc/modules
|
||||
declare new_module_found=1
|
||||
declare tmpmodules=$(mktemp --tmpdir="$TMPDIR/" -t proc_modules.XXXXXX)
|
||||
while [[ $new_module_found ]]; do
|
||||
new_module_found=
|
||||
sleep 0.1
|
||||
#reading from procfs can be broken, so copy the file elsewhere
|
||||
cp -f /proc/modules "$tmpmodules"
|
||||
while read m rest; do
|
||||
[ -z "$m" ] && continue
|
||||
[[ ${host_modules["$m"]} ]] && continue
|
||||
host_modules["$m"]=1
|
||||
new_module_found=1
|
||||
done < "$tmpmodules"
|
||||
done
|
||||
rm "$tmpmodules"
|
||||
unset new_module_found
|
||||
unset tmpmodules
|
||||
fi
|
||||
|
||||
unset m
|
||||
@@ -1106,7 +1234,7 @@ _get_fs_type() {
|
||||
return 1
|
||||
}
|
||||
|
||||
for dev in ${host_devs[@]}; do
|
||||
for dev in "${host_devs[@]}"; do
|
||||
_get_fs_type "$dev"
|
||||
check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")"
|
||||
done
|
||||
@@ -1127,6 +1255,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
|
||||
@@ -1152,6 +1286,14 @@ fi
|
||||
|
||||
[[ -d "$systemdsystemconfdir" ]] || systemdsystemconfdir=/etc/systemd/system
|
||||
|
||||
[[ -d $tmpfilesdir ]] \
|
||||
|| tmpfilesdir=$(pkg-config systemd --variable=tmpfilesdir 2>/dev/null)
|
||||
|
||||
if ! [[ -d "$tmpfilesdir" ]]; then
|
||||
[[ -f /lib/tmpfiles.d ]] && tmpfilesdir=/lib/tmpfiles.d
|
||||
[[ -f /usr/lib/tmpfiles.d ]] && tmpfilesdir=/usr/lib/tmpfiles.d
|
||||
fi
|
||||
|
||||
export initdir dracutbasedir \
|
||||
dracutmodules force_add_dracutmodules add_dracutmodules omit_dracutmodules \
|
||||
mods_to_load \
|
||||
@@ -1159,10 +1301,11 @@ export initdir dracutbasedir \
|
||||
omit_drivers mdadmconf lvmconf root_dev \
|
||||
use_fstab fstab_lines libdirs fscks nofscks ro_mnt \
|
||||
stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
|
||||
debug host_fs_types host_devs sshkey add_fstab \
|
||||
debug host_fs_types host_devs swap_devs sshkey add_fstab \
|
||||
DRACUT_VERSION udevdir prefix filesystems drivers \
|
||||
systemdutildir systemdsystemunitdir systemdsystemconfdir \
|
||||
host_modalias host_modules hostonly_cmdline
|
||||
host_modalias host_modules hostonly_cmdline loginstall \
|
||||
tmpfilesdir
|
||||
|
||||
mods_to_load=""
|
||||
# check all our modules to see if they should be sourced.
|
||||
@@ -1217,7 +1360,6 @@ if [[ $kernel_only != yes ]]; then
|
||||
|
||||
ln -sfn ../run "$initdir/var/run"
|
||||
ln -sfn ../run/lock "$initdir/var/lock"
|
||||
ln -sfn ../run/log "$initdir/var/log"
|
||||
else
|
||||
for d in lib "$libdir"; do
|
||||
[[ -e "${initdir}${prefix}/$d" ]] && continue
|
||||
@@ -1289,6 +1431,9 @@ dinfo "*** Including modules done ***"
|
||||
|
||||
## final stuff that has to happen
|
||||
if [[ $no_kernel != yes ]]; then
|
||||
if [[ $hostonly ]]; then
|
||||
echo "$(get_loaded_kernel_modules)" > $initdir/lib/dracut/loaded-kernel-modules.txt
|
||||
fi
|
||||
|
||||
if [[ $drivers ]]; then
|
||||
hostonly='' instmods $drivers
|
||||
@@ -1297,6 +1442,13 @@ if [[ $no_kernel != yes ]]; then
|
||||
if [[ $add_drivers ]]; then
|
||||
hostonly='' instmods -c $add_drivers
|
||||
fi
|
||||
if [[ $force_drivers ]]; then
|
||||
hostonly='' instmods -c $force_drivers
|
||||
rm -f $initdir/etc/cmdline.d/20-force_driver.conf
|
||||
for mod in $force_drivers; do
|
||||
echo "rd.driver.pre=$mod" >>$initdir/etc/cmdline.d/20-force_drivers.conf
|
||||
done
|
||||
fi
|
||||
if [[ $filesystems ]]; then
|
||||
hostonly='' instmods -c $filesystems
|
||||
fi
|
||||
@@ -1318,6 +1470,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"
|
||||
|
||||
@@ -1326,6 +1479,7 @@ if [[ $kernel_only != yes ]]; then
|
||||
[ -z "${line[3]}" ] && line[3]="defaults"
|
||||
[ -z "${line[4]}" ] && line[4]="0"
|
||||
[ -z "${line[5]}" ] && line[5]="2"
|
||||
strstr "${line[2]}" "nfs" && line[5]="0"
|
||||
echo "${line[@]}" >> "${initdir}/etc/fstab"
|
||||
done
|
||||
|
||||
@@ -1352,26 +1506,29 @@ if [[ $kernel_only != yes ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
while pop include_src src && pop include_target tgt; do
|
||||
if [[ $src && $tgt ]]; then
|
||||
while pop include_src src && pop include_target target; do
|
||||
if [[ $src && $target ]]; then
|
||||
if [[ -f $src ]]; then
|
||||
inst $src $tgt
|
||||
inst $src $target
|
||||
else
|
||||
ddebug "Including directory: $src"
|
||||
mkdir -p "${initdir}/${tgt}"
|
||||
destdir="${initdir}/${target}"
|
||||
mkdir -p "$destdir"
|
||||
# check for preexisting symlinks, so we can cope with the
|
||||
# symlinks to $prefix
|
||||
for i in "$src"/*; do
|
||||
[[ -e "$i" || -h "$i" ]] || continue
|
||||
s=${initdir}/${tgt}/${i#$src/}
|
||||
if [[ -d "$i" ]]; then
|
||||
if ! [[ -e "$s" ]]; then
|
||||
mkdir -m 0755 -p "$s"
|
||||
chmod --reference="$i" "$s"
|
||||
# Objectname is a file or a directory
|
||||
for objectname in "$src"/*; do
|
||||
[[ -e "$objectname" || -h "$objectname" ]] || continue
|
||||
if [[ -d "$objectname" ]]; then
|
||||
# objectname is a directory, let's compute the final directory name
|
||||
object_destdir=${destdir}/${objectname#$src/}
|
||||
if ! [[ -e "$object_destdir" ]]; then
|
||||
mkdir -m 0755 -p "$object_destdir"
|
||||
chmod --reference="$objectname" "$object_destdir"
|
||||
fi
|
||||
cp --reflink=auto --sparse=auto -fa -t "$s" "$i"/*
|
||||
cp --reflink=auto --sparse=auto -fa -t "$object_destdir" "$objectname"/*
|
||||
else
|
||||
cp --reflink=auto --sparse=auto -fa -t "$s" "$i"
|
||||
cp --reflink=auto --sparse=auto -fa -t "$destdir" "$objectname"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
@@ -1438,8 +1595,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"
|
||||
@@ -1457,15 +1615,27 @@ if [[ $early_microcode = yes ]]; then
|
||||
dinfo "*** Constructing ${ucode_dest[$idx]} ****"
|
||||
if [[ $hostonly ]]; then
|
||||
_src=$(get_ucode_file)
|
||||
if ! [[ -r $_fwdir/$_fw/$_src ]];then
|
||||
break;
|
||||
fi
|
||||
[[ $_src ]] || break
|
||||
[[ -r $_fwdir/$_fw/$_src ]] || break
|
||||
fi
|
||||
cat $_fwdir/$_fw/$_src > $_dest_dir/${ucode_dest[$idx]}
|
||||
|
||||
for i in $_fwdir/$_fw/$_src; do
|
||||
[ -e "$i" ] && break
|
||||
break 2
|
||||
done
|
||||
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
|
||||
@@ -1491,23 +1661,53 @@ 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
|
||||
|
||||
|
||||
if ! sync "$outfile" 2> /dev/null; then
|
||||
dinfo "dracut: sync operartion on newly created initramfs $outfile failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
@@ -91,10 +91,11 @@ Requires: gzip xz
|
||||
Requires: kmod
|
||||
Requires: sed
|
||||
Requires: kpartx
|
||||
Requires: tar
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
Requires: util-linux >= 2.21
|
||||
Requires: systemd >= 199
|
||||
Requires: systemd >= 219
|
||||
Requires: procps-ng
|
||||
Conflicts: grubby < 8.23
|
||||
%else
|
||||
@@ -202,6 +203,7 @@ git commit -a -q -m "%{version} baseline."
|
||||
|
||||
# Apply all the patches.
|
||||
git am -p1 %{patches}
|
||||
git tag %{version}
|
||||
%endif
|
||||
|
||||
%build
|
||||
@@ -296,6 +298,7 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%endif
|
||||
%dir %{dracutlibdir}
|
||||
%dir %{dracutlibdir}/modules.d
|
||||
%{dracutlibdir}/dracut-init.sh
|
||||
%{dracutlibdir}/dracut-functions.sh
|
||||
%{dracutlibdir}/dracut-functions
|
||||
%{dracutlibdir}/dracut-version.sh
|
||||
@@ -309,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
|
||||
@@ -342,6 +346,7 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/modules.d/90dm
|
||||
%{dracutlibdir}/modules.d/90dmraid
|
||||
%{dracutlibdir}/modules.d/90dmsquash-live
|
||||
%{dracutlibdir}/modules.d/90dmsquash-live-ntfs
|
||||
%{dracutlibdir}/modules.d/90kernel-modules
|
||||
%{dracutlibdir}/modules.d/90lvm
|
||||
%{dracutlibdir}/modules.d/90mdraid
|
||||
|
@@ -37,10 +37,14 @@ the --hostonly or -H option. Using this option, the resulting image will
|
||||
contain only those dracut modules, kernel modules and filesystems, which are
|
||||
needed to boot this specific machine. This has the drawback, that you can't put
|
||||
the disk on another controller or machine, and that you can't switch to another
|
||||
root filesystem, without recreating the initramfs image. The usage of the
|
||||
--hostonly option is only for experts and you will have to keep the broken
|
||||
pieces. At least keep a copy of a general purpose image (and corresponding
|
||||
kernel) as a fallback to rescue your system.
|
||||
root filesystem, without recreating the initramfs image.
|
||||
|
||||
[NOTE]
|
||||
===============================
|
||||
On RHEL-7 the hostonly mode is the default mode. Generic "non-hostonly" images
|
||||
are created, if the dracut-config-generic rpm is installed. The rescue kernel
|
||||
entry in the bootloader menu is also a generic image.
|
||||
===============================
|
||||
|
||||
=== Inspecting the Contents
|
||||
To see the contents of the image created by dracut, you can use the lsinitrd
|
||||
@@ -99,8 +103,9 @@ raid with encryption and LVM on top), as long as you specify the correct
|
||||
filesystem LABEL or UUID on the kernel command line for your root device, dracut
|
||||
will find it and boot from it.
|
||||
|
||||
The kernel command line usually can be configured in _/boot/grub/grub.conf_, if
|
||||
grub is your bootloader and it also can be edited in the real boot process in
|
||||
The kernel command line usually can be configured in _/boot/grub2/grub.cfg_
|
||||
(or _/boot/efi/EFI/redhat/grub.cfg_ for EFI systems), if
|
||||
grub2 is your bootloader and it also can be edited in the real boot process in
|
||||
the grub menu.
|
||||
|
||||
The kernel command line can also be provided by the dhcp server with the
|
||||
@@ -325,7 +330,8 @@ stick and mount that. Then you can store the output for later inspection.
|
||||
In all cases, the following should be mentioned and attached to your bug report:
|
||||
|
||||
* The exact kernel command-line used. Typically from the bootloader
|
||||
configuration file (e.g. _/etc/grub.conf_) or from _/proc/cmdline_.
|
||||
configuration file (e.g. _/boot/grub2/grub.cfg_ (or _/boot/efi/EFI/redhat/grub.cfg_ for EFI systems))
|
||||
or from _/proc/cmdline_.
|
||||
* A copy of your disk partition information from _/etc/fstab_, which might be
|
||||
obtained booting an old working initramfs or a rescue medium.
|
||||
* Turn on dracut debugging (see _the 'debugging dracut' section_), and attach
|
||||
@@ -359,49 +365,17 @@ Successfully debugging dracut will require some form of console
|
||||
logging during the system boot. This section documents configuring a
|
||||
serial console connection to record boot messages.
|
||||
|
||||
. First, enable serial console output for both the kernel and the bootloader.
|
||||
. Open the file _/etc/grub.conf_ for editing. Below the line ''timeout=5'', add
|
||||
the following:
|
||||
+
|
||||
----
|
||||
serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
----
|
||||
+
|
||||
. Also in _/etc/grub.conf_, add the following boot arguemnts to the ''kernel''
|
||||
. In _/boot/grub2/grub.cfg_ (or _/boot/efi/EFI/redhat/grub.cfg_ for EFI systems),
|
||||
add the following boot arguments to the ''linux16''
|
||||
line:
|
||||
+
|
||||
----
|
||||
console=tty0 console=ttyS0,9600
|
||||
----
|
||||
+
|
||||
. When finished, the _/etc/grub.conf_ file should look similar to the example
|
||||
below.
|
||||
+
|
||||
----
|
||||
default=0
|
||||
timeout=5
|
||||
serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
title Fedora (2.6.29.5-191.fc11.x86_64)
|
||||
root (hd0,0)
|
||||
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 console=ttyS0,9600
|
||||
initrd /dracut-2.6.29.5-191.fc11.x86_64.img
|
||||
----
|
||||
+
|
||||
. More detailed information on how to configure the kernel for console output
|
||||
can be found at
|
||||
http://www.faqs.org/docs/Linux-HOWTO/Remote-Serial-Console-HOWTO.html#CONFIGURE-KERNEL.
|
||||
. Redirecting non-interactive output
|
||||
+
|
||||
--
|
||||
NOTE: You can redirect all non-interactive output to _/dev/kmsg_ and the kernel
|
||||
will put it out on the console when it reaches the kernel buffer by doing
|
||||
|
||||
----
|
||||
# exec >/dev/kmsg 2>&1 </dev/console
|
||||
----
|
||||
--
|
||||
|
||||
[[using-the-dracut-shell]]
|
||||
==== Using the dracut shell
|
||||
@@ -410,20 +384,18 @@ dracut offers a shell for interactive debugging in the event dracut fails to
|
||||
locate your root filesystem. To enable the shell:
|
||||
|
||||
. Add the boot parameter ''rd.shell'' to your bootloader configuration file
|
||||
(e.g. _/etc/grub.conf_)
|
||||
(e.g. _/boot/grub2/grub.cfg_ (or _/boot/efi/EFI/redhat/grub.cfg_ for EFI systems))
|
||||
. Remove the boot arguments ''rhgb'' and ''quiet''
|
||||
+
|
||||
A sample _/etc/grub.conf_ bootloader configuration file is listed below.
|
||||
A sample _grub.cfg_ bootloader configuration file snippet is listed below.
|
||||
+
|
||||
----
|
||||
default=0
|
||||
timeout=5
|
||||
serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
title Fedora (2.6.29.5-191.fc11.x86_64)
|
||||
root (hd0,0)
|
||||
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
|
||||
initrd /dracut-2.6.29.5-191.fc11.x86_64.img
|
||||
menuentry 'Red Hat Enterprise Linux Server (3.10.0-308.el7.x86_64) 7.0 (Maipo)' […] {
|
||||
[…]
|
||||
linux16 /vmlinuz-3.10.0-308.el7.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
|
||||
initrd16 /initramfs-3.10.0-308.el7.x86_64.img
|
||||
[…]
|
||||
}
|
||||
----
|
||||
+
|
||||
. If system boot fails, you will be dropped into a shell as seen in the example
|
||||
|
74
lsinitrd.sh
74
lsinitrd.sh
@@ -113,10 +113,10 @@ fi
|
||||
extract_files()
|
||||
{
|
||||
(( ${#filenames[@]} == 1 )) && nofileinfo=1
|
||||
for f in ${!filenames[@]}; do
|
||||
for f in "${!filenames[@]}"; do
|
||||
[[ $nofileinfo ]] || echo "initramfs:/$f"
|
||||
[[ $nofileinfo ]] || echo "========================================================================"
|
||||
$CAT $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
|
||||
$CAT $image 2>/dev/null | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
|
||||
((ret+=$?))
|
||||
[[ $nofileinfo ]] || echo "========================================================================"
|
||||
[[ $nofileinfo ]] || echo
|
||||
@@ -126,7 +126,7 @@ extract_files()
|
||||
list_modules()
|
||||
{
|
||||
echo "dracut modules:"
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/modules.txt' 'usr/lib/dracut/modules.txt' 2>/dev/null
|
||||
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/modules.txt' 'usr/lib/dracut/modules.txt' 2>/dev/null
|
||||
((ret+=$?))
|
||||
}
|
||||
|
||||
@@ -134,9 +134,9 @@ list_files()
|
||||
{
|
||||
echo "========================================================================"
|
||||
if [ "$sorted" -eq 1 ]; then
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
else
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -k9
|
||||
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -k9
|
||||
fi
|
||||
((ret+=$?))
|
||||
echo "========================================================================"
|
||||
@@ -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()
|
||||
{
|
||||
@@ -220,7 +216,7 @@ ret=0
|
||||
if (( ${#filenames[@]} > 0 )); then
|
||||
extract_files
|
||||
else
|
||||
version=$($CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/dracut-*' 'usr/lib/dracut/dracut-*' 2>/dev/null)
|
||||
version=$($CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/dracut-*' 'usr/lib/dracut/dracut-*' 2>/dev/null)
|
||||
((ret+=$?))
|
||||
echo "Version: $version"
|
||||
echo
|
||||
@@ -229,7 +225,7 @@ else
|
||||
echo "========================================================================"
|
||||
else
|
||||
echo -n "Arguments: "
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/build-parameter.txt' 'usr/lib/dracut/build-parameter.txt' 2>/dev/null
|
||||
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/build-parameter.txt' 'usr/lib/dracut/build-parameter.txt' 2>/dev/null
|
||||
echo
|
||||
list_modules
|
||||
list_files
|
||||
|
@@ -3,7 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
[ -x /bin/bash ]
|
||||
require_binaries /bin/bash
|
||||
}
|
||||
|
||||
depends() {
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
[ -x /sbin/bootchartd ] || return 1
|
||||
require_binaries /sbin/bootchartd || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
[ -x /bin/dash ]
|
||||
require_binaries /bin/dash
|
||||
}
|
||||
|
||||
depends() {
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
[ -x $systemdutildir/systemd-bootchart ] || return 1
|
||||
require_binaries $systemdutildir/systemd-bootchart || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
|
8
modules.d/01fips/fips-load-crypto.sh
Normal file
8
modules.d/01fips/fips-load-crypto.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
|
||||
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
else
|
||||
. /sbin/fips.sh
|
||||
fips_load_crypto || die "FIPS integrity test failed"
|
||||
fi
|
@@ -71,6 +71,34 @@ do_rhevh_check()
|
||||
return 0
|
||||
}
|
||||
|
||||
fips_load_crypto()
|
||||
{
|
||||
FIPSMODULES=$(cat /etc/fipsmodules)
|
||||
|
||||
info "Loading and integrity checking all crypto modules"
|
||||
mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
|
||||
for _module in $FIPSMODULES; do
|
||||
if [ "$_module" != "tcrypt" ]; then
|
||||
if ! modprobe "${_module}" 2>/tmp/fips.modprobe_err; then
|
||||
# check if kernel provides generic algo
|
||||
_found=0
|
||||
while read _k _s _v; do
|
||||
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
|
||||
[ "$_v" != "$_module" ] && [ "crypto-$_v" != "$_module" ] && continue
|
||||
_found=1
|
||||
break
|
||||
done </proc/crypto
|
||||
[ "$_found" = "0" ] && cat /tmp/fips.modprobe_err >&2 && return 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
mv /etc/modprobe.d/fips.conf.bak /etc/modprobe.d/fips.conf
|
||||
|
||||
info "Self testing crypto algorithms"
|
||||
modprobe tcrypt || return 1
|
||||
rmmod tcrypt
|
||||
}
|
||||
|
||||
do_fips()
|
||||
{
|
||||
local _v
|
||||
@@ -80,43 +108,36 @@ do_fips()
|
||||
|
||||
KERNEL=$(uname -r)
|
||||
|
||||
if ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
|
||||
warn "/boot/.vmlinuz-${KERNEL}.hmac does not exist"
|
||||
return 1
|
||||
fi
|
||||
|
||||
FIPSMODULES=$(cat /etc/fipsmodules)
|
||||
|
||||
info "Loading and integrity checking all crypto modules"
|
||||
mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
|
||||
for _module in $FIPSMODULES; do
|
||||
if [ "$_module" != "tcrypt" ]; then
|
||||
if ! modprobe "${_module}"; then
|
||||
# check if kernel provides generic algo
|
||||
_found=0
|
||||
while read _k _s _v; do
|
||||
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
|
||||
[ "$_v" != "$_module" ] && continue
|
||||
_found=1
|
||||
break
|
||||
done </proc/crypto
|
||||
[ "$_found" = "0" ] && return 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
mv /etc/modprobe.d/fips.conf.bak /etc/modprobe.d/fips.conf
|
||||
|
||||
info "Self testing crypto algorithms"
|
||||
modprobe tcrypt || return 1
|
||||
rmmod tcrypt
|
||||
|
||||
info "Checking integrity of kernel"
|
||||
if [ -e "/run/initramfs/live/vmlinuz0" ]; then
|
||||
do_rhevh_check /run/initramfs/live/vmlinuz0 || return 1
|
||||
elif [ -e "/run/initramfs/live/isolinux/vmlinuz0" ]; then
|
||||
do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1
|
||||
else
|
||||
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
|
||||
BOOT_IMAGE="$(getarg BOOT_IMAGE)"
|
||||
BOOT_IMAGE_NAME="${BOOT_IMAGE##*/}"
|
||||
BOOT_IMAGE_PATH="${BOOT_IMAGE%${BOOT_IMAGE_NAME}}"
|
||||
|
||||
if [ -z "$BOOT_IMAGE_NAME" ]; then
|
||||
BOOT_IMAGE_NAME="vmlinuz-${KERNEL}"
|
||||
elif ! [ -e "/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE}" ]; then
|
||||
#if /boot is not a separate partition BOOT_IMAGE might start with /boot
|
||||
BOOT_IMAGE_PATH=${BOOT_IMAGE_PATH#"/boot"}
|
||||
#on some achitectures BOOT_IMAGE does not contain path to kernel
|
||||
#so if we can't find anything, let's treat it in the same way as if it was empty
|
||||
if ! [ -e "/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE_NAME}" ]; then
|
||||
BOOT_IMAGE_NAME="vmlinuz-${KERNEL}"
|
||||
BOOT_IMAGE_PATH=""
|
||||
fi
|
||||
fi
|
||||
|
||||
BOOT_IMAGE_HMAC="/boot/${BOOT_IMAGE_PATH}.${BOOT_IMAGE_NAME}.hmac"
|
||||
if ! [ -e "${BOOT_IMAGE_HMAC}" ]; then
|
||||
warn "${BOOT_IMAGE_HMAC} does not exist"
|
||||
return 1
|
||||
fi
|
||||
|
||||
sha512hmac -c "${BOOT_IMAGE_HMAC}" || return 1
|
||||
fi
|
||||
|
||||
info "All initrd crypto checks done"
|
||||
|
@@ -11,27 +11,48 @@ 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+="sha384 sha512 sha512_generic tcrypt tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib"
|
||||
local _fipsmodules _mod i _bootfstype
|
||||
|
||||
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
|
||||
|
||||
# with hostonly_default_device fs module for /boot is not installed by default
|
||||
if [[ $hostonly ]] && [[ "$hostonly_default_device" == "no" ]]; then
|
||||
_bootfstype=$(find_mp_fstype /boot)
|
||||
if [[ -n "$_bootfstype" ]]; then
|
||||
hostonly='' instmods $_bootfstype
|
||||
else
|
||||
dwarning "Can't determine fs type for /boot, FIPS check may fail."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
install() {
|
||||
local _dir
|
||||
inst_hook pre-trigger 01 "$moddir/fips-boot.sh"
|
||||
inst_hook pre-mount 01 "$moddir/fips-boot.sh"
|
||||
inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
|
||||
inst_hook pre-udev 01 "$moddir/fips-load-crypto.sh"
|
||||
inst_script "$moddir/fips.sh" /sbin/fips.sh
|
||||
|
||||
inst_multiple sha512hmac rmmod insmod mount uname umount fipscheck
|
||||
|
@@ -3,7 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
type -P capsh >/dev/null 2>&1
|
||||
require_binaries capsh
|
||||
}
|
||||
|
||||
depends() {
|
||||
@@ -11,9 +11,13 @@ depends() {
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_hook pre-pivot 00 "$moddir/caps.sh"
|
||||
inst $(type -P capsh 2>/dev/null) /usr/sbin/capsh
|
||||
# capsh wants bash and we need bash also
|
||||
inst /bin/bash
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook pre-pivot 00 "$moddir/caps.sh"
|
||||
inst $(type -P capsh 2>/dev/null) /usr/sbin/capsh
|
||||
# capsh wants bash and we need bash also
|
||||
inst /bin/bash
|
||||
else
|
||||
dwarning "caps: does not work with systemd in the initramfs"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
# Peter Jones <pjones@redhat.com>
|
||||
|
||||
check() {
|
||||
[[ -x /usr/bin/keyctl ]] || return 1
|
||||
require_binaries keyctl || return 1
|
||||
|
||||
# do not include module in hostonly mode,
|
||||
# if no keys are present
|
||||
|
@@ -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
|
||||
|
@@ -3,7 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
type -P busybox >/dev/null || return 1
|
||||
require_binaries busybox || return 1
|
||||
|
||||
return 255
|
||||
}
|
||||
|
@@ -5,9 +5,7 @@
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
|
||||
for i in setfont loadkeys kbd_mode; do
|
||||
type -P "$i" >/dev/null || return 1
|
||||
done
|
||||
require_binaries setfont loadkeys kbd_mode || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -243,7 +241,7 @@ install() {
|
||||
if checks; then
|
||||
install_base
|
||||
|
||||
if [[ ${hostonly} ]] && ! [[ ${i18n_install_all} ]]; then
|
||||
if [[ ${hostonly} ]] && ! [[ ${i18n_install_all} == "yes" ]]; then
|
||||
install_local_i18n || install_all_kbd
|
||||
else
|
||||
install_all_kbd
|
||||
|
@@ -19,24 +19,18 @@ inst_key_val() {
|
||||
unset _value
|
||||
}
|
||||
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.keymap KEYMAP -d KEYTABLE
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.font FONT -d SYSFONT
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.font.map FONT_MAP -d CONTRANS
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.font.unimap FONT_UNIMAP -d UNIMAP
|
||||
inst_key_val 1 /etc/vconsole.conf vconsole.font.unicode UNICODE vconsole.unicode
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.keymap.ext EXT_KEYMAP
|
||||
inst_key_val '' /etc/vconsole.conf rd.vconsole.keymap vconsole.keymap KEYMAP -d KEYTABLE
|
||||
inst_key_val '' /etc/vconsole.conf rd.vconsole.font vconsole.font FONT -d SYSFONT
|
||||
inst_key_val '' /etc/vconsole.conf rd.vconsole.font.map vconsole.font.map FONT_MAP -d CONTRANS
|
||||
inst_key_val '' /etc/vconsole.conf rd.vconsole.font.unimap vconsole.font.unimap FONT_UNIMAP -d UNIMAP
|
||||
inst_key_val 1 /etc/vconsole.conf rd.vconsole.font.unicode vconsole.font.unicode UNICODE vconsole.unicode
|
||||
inst_key_val '' /etc/vconsole.conf rd.vconsole.keymap.ext vconsole.keymap.ext EXT_KEYMAP
|
||||
|
||||
inst_key_val '' /etc/locale.conf locale.LANG LANG
|
||||
inst_key_val '' /etc/locale.conf locale.LC_ALL LC_ALL
|
||||
inst_key_val '' /etc/locale.conf rd.locale.LANG locale.LANG LANG
|
||||
inst_key_val '' /etc/locale.conf rd.locale.LC_ALL locale.LC_ALL LC_ALL
|
||||
|
||||
if [ -f /etc/locale.conf ]; then
|
||||
. /etc/locale.conf
|
||||
export LANG
|
||||
export LC_ALL
|
||||
fi
|
||||
|
||||
if [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
rm -f -- /etc/udev/rules.d/10-console.rules
|
||||
rm -f -- /lib/udev/rules.d/10-console.rules
|
||||
rm -f -- /lib/udev/console_init
|
||||
fi
|
||||
|
@@ -10,9 +10,6 @@ type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
# We already need a set netif here
|
||||
netif=$interface
|
||||
|
||||
# Huh? Interface configured?
|
||||
[ -f "/tmp/net.$netif.up" ] && exit 0
|
||||
|
||||
setup_interface() {
|
||||
ip=$new_ip_address
|
||||
mtu=$new_interface_mtu
|
||||
@@ -23,7 +20,11 @@ setup_interface() {
|
||||
search=$(printf -- "$new_domain_search")
|
||||
namesrv=$new_domain_name_servers
|
||||
hostname=$new_host_name
|
||||
lease_time=$new_dhcp_lease_time
|
||||
|
||||
[ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
|
||||
[ -n "$new_max_life" ] && lease_time=$new_max_life
|
||||
preferred_lft=$lease_time
|
||||
[ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
|
||||
|
||||
[ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override
|
||||
|
||||
@@ -41,11 +42,17 @@ setup_interface() {
|
||||
fi
|
||||
fi
|
||||
|
||||
ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} \
|
||||
valid_lft ${lease_time} preferred_lft ${lease_time} \
|
||||
dev $netif
|
||||
ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif \
|
||||
${lease_time:+valid_lft $lease_time} \
|
||||
${preferred_lft:+preferred_lft ${preferred_lft}}
|
||||
|
||||
[ -n "$gw" ] && echo ip route replace default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
if [ -n "$gw" ] ; then
|
||||
if [ "$mask" == "255.255.255.255" ] ; then
|
||||
# point-to-point connection => set explicit route to gateway
|
||||
echo ip route add $gw dev $netif > /tmp/net.$netif.gw
|
||||
fi
|
||||
echo ip route replace default via $gw dev $netif >> /tmp/net.$netif.gw
|
||||
fi
|
||||
|
||||
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
|
||||
if [ -n "$namesrv" ] ; then
|
||||
@@ -88,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"
|
||||
@@ -95,8 +147,9 @@ case $reason in
|
||||
;;
|
||||
|
||||
PREINIT6)
|
||||
echo "dhcp: PREINIT $netif up"
|
||||
echo "dhcp: PREINIT6 $netif up"
|
||||
linkup $netif
|
||||
wait_for_ipv6_dad_link $netif
|
||||
;;
|
||||
|
||||
BOUND)
|
||||
@@ -106,7 +159,7 @@ case $reason in
|
||||
read layer2 < /sys/class/net/$netif/device/layer2
|
||||
fi
|
||||
if [ "$layer2" != "0" ]; then
|
||||
if ! arping -q -D -c 2 -I $netif $new_ip_address ; then
|
||||
if ! arping -f -q -D -c 2 -I $netif $new_ip_address ; then
|
||||
warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
|
||||
exit 1
|
||||
fi
|
||||
@@ -121,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"
|
||||
@@ -128,6 +184,21 @@ case $reason in
|
||||
|
||||
echo "[ -f /tmp/net.$netif.did-setup ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
|
||||
>/tmp/net.$netif.up
|
||||
if [ -e /sys/class/net/${netif}/address ]; then
|
||||
> /tmp/net.$(cat /sys/class/net/${netif}/address).up
|
||||
fi
|
||||
|
||||
;;
|
||||
|
||||
RENEW|REBIND)
|
||||
unset lease_time
|
||||
[ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
|
||||
[ -n "$new_max_life" ] && lease_time=$new_max_life
|
||||
preferred_lft=$lease_time
|
||||
[ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
|
||||
ip -4 addr change ${new_ip_address}/${new_subnet_mask} broadcast ${new_broadcast_address} dev ${interface} \
|
||||
${lease_time:+valid_lft $lease_time} ${preferred_lft:+preferred_lft ${preferred_lft}} \
|
||||
>/dev/null 2>&1
|
||||
;;
|
||||
|
||||
BOUND6)
|
||||
@@ -149,7 +220,22 @@ case $reason in
|
||||
|
||||
echo "[ -f /tmp/net.$netif.did-setup ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
|
||||
>/tmp/net.$netif.up
|
||||
if [ -e /sys/class/net/${netif}/address ]; then
|
||||
> /tmp/net.$(cat /sys/class/net/${netif}/address).up
|
||||
fi
|
||||
;;
|
||||
|
||||
RENEW6|REBIND6)
|
||||
unset lease_time
|
||||
[ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
|
||||
[ -n "$new_max_life" ] && lease_time=$new_max_life
|
||||
preferred_lft=$lease_time
|
||||
[ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
|
||||
ip -6 addr change ${new_ip6_address}/${new_ip6_prefixlen} dev ${interface} scope global \
|
||||
${lease_time:+valid_lft $lease_time} ${preferred_lft:+preferred_lft ${preferred_lft}} \
|
||||
>/dev/null 2>&1
|
||||
;;
|
||||
|
||||
*) echo "dhcp: $reason";;
|
||||
esac
|
||||
|
||||
|
@@ -1,3 +1,6 @@
|
||||
|
||||
option classless-static-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-static-routes;
|
||||
|
@@ -17,78 +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"
|
||||
[ -z "$netroot" ] && [ -z "$manualup" ] && exit 0
|
||||
if [ -n "$manualup" ]; then
|
||||
>/tmp/net.$netif.manualup
|
||||
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
|
||||
@@ -97,15 +31,37 @@ do_dhcp() {
|
||||
# event for nfsroot
|
||||
# XXX add -V vendor class and option parsing per kernel
|
||||
|
||||
local _COUNT=0
|
||||
local _timeout=$(getargs rd.net.timeout.dhcp=)
|
||||
local _DHCPRETRY=$(getargs rd.net.dhcp.retry=)
|
||||
_DHCPRETRY=${_DHCPRETRY:-1}
|
||||
|
||||
[ -e /tmp/dhclient.$netif.pid ] && return 0
|
||||
|
||||
if ! iface_has_link $netif; then
|
||||
echo "No carrier detected"
|
||||
if ! iface_has_carrier $netif; then
|
||||
warn "No carrier detected on interface $netif"
|
||||
return 1
|
||||
fi
|
||||
echo "Starting dhcp for interface $netif"
|
||||
dhclient "$@" -1 -q -cf /etc/dhclient.conf -pf /tmp/dhclient.$netif.pid -lf /tmp/dhclient.$netif.lease $netif \
|
||||
|| echo "dhcp failed"
|
||||
|
||||
[ -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 "$@" \
|
||||
${_timeout:+-timeout $_timeout} \
|
||||
-q \
|
||||
-cf /etc/dhclient.conf \
|
||||
-pf /tmp/dhclient.$netif.pid \
|
||||
-lf /tmp/dhclient.$netif.lease \
|
||||
$netif \
|
||||
&& return 0
|
||||
_COUNT=$(($_COUNT+1))
|
||||
[ $_COUNT -lt $_DHCPRETRY ] && sleep 1
|
||||
done
|
||||
warn "dhcp for interface $netif failed"
|
||||
return 1
|
||||
}
|
||||
|
||||
load_ipv6() {
|
||||
@@ -120,23 +76,43 @@ load_ipv6() {
|
||||
}
|
||||
|
||||
do_ipv6auto() {
|
||||
local ret
|
||||
load_ipv6
|
||||
echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
|
||||
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
|
||||
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
|
||||
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
|
||||
ret=$?
|
||||
|
||||
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
|
||||
return 0
|
||||
return $ret
|
||||
}
|
||||
|
||||
# Handle static ip configuration
|
||||
do_static() {
|
||||
strstr $ip '*:*:*' && load_ipv6
|
||||
|
||||
linkup $netif
|
||||
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
|
||||
|
||||
ip route get "$ip" | {
|
||||
read a rest
|
||||
if [ "$a" = "local" ]; then
|
||||
warn "Not assigning $ip to interface $netif, cause it is already assigned!"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
} || return 1
|
||||
|
||||
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
|
||||
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
|
||||
if strstr $ip '*:*:*'; then
|
||||
@@ -144,7 +120,13 @@ do_static() {
|
||||
ip addr add $ip/$mask ${srv:+peer $srv} dev $netif
|
||||
wait_for_ipv6_dad $netif
|
||||
else
|
||||
ip addr flush dev $netif
|
||||
if [ -z "$srv" ]; then
|
||||
if ! arping -f -q -D -c 2 -I $netif $ip; then
|
||||
warn "Duplicate address detected for $ip for interface $netif."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
ip -4 addr flush dev $netif
|
||||
ip addr add $ip/$mask ${srv:+peer $srv} brd + dev $netif
|
||||
fi
|
||||
|
||||
@@ -154,124 +136,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*)
|
||||
@@ -283,33 +147,214 @@ 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
|
||||
|
||||
# Set mtu on bond master
|
||||
[ -n "$bondmtu" ] && ip link set mtu $bondmtu dev $bondname
|
||||
|
||||
# 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
|
||||
namesrv=$(getargs nameserver)
|
||||
for s in $namesrv; do
|
||||
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
|
||||
|
||||
|
||||
@@ -332,18 +377,15 @@ for p in $(getargs ip=); do
|
||||
esac
|
||||
|
||||
# If this option isn't directed at our interface, skip it
|
||||
[ -n "$dev" ] && [ "$dev" != "$netif" ] && \
|
||||
[ "$use_bridge" != 'true' ] && \
|
||||
[ "$use_vlan" != 'true' ] && continue
|
||||
|
||||
# setup nameserver
|
||||
namesrv="$dns1 $dns2 $(getargs nameserver)"
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
||||
done
|
||||
|
||||
if [ -n "$dev" ]; then
|
||||
[ "$dev" != "$netif" ] && \
|
||||
[ "$use_bridge" != 'true' ] && \
|
||||
[ "$use_vlan" != 'true' ] && continue
|
||||
else
|
||||
iface_is_enslaved "$netif" && continue
|
||||
fi
|
||||
# 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
|
||||
|
||||
@@ -356,28 +398,42 @@ for p in $(getargs ip=); do
|
||||
do_dhcp -6 ;;
|
||||
auto6)
|
||||
do_ipv6auto ;;
|
||||
either6)
|
||||
do_ipv6auto || do_dhcp -6 ;;
|
||||
*)
|
||||
do_static ;;
|
||||
esac
|
||||
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
|
||||
|
||||
case $autoconf in
|
||||
dhcp|on|any|dhcp6)
|
||||
if [ $ret -eq 0 ]; then
|
||||
> /tmp/net.${netif}.up
|
||||
|
||||
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 [ $? -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.
|
||||
@@ -388,12 +444,21 @@ 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 getargs 'ip=dhcp6'; then
|
||||
load_ipv6
|
||||
do_dhcp -6
|
||||
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
|
||||
load_ipv6
|
||||
do_dhcp
|
||||
fi
|
||||
else
|
||||
do_dhcp -4
|
||||
if getargs 'ip=dhcp6'; then
|
||||
load_ipv6
|
||||
do_dhcp -6
|
||||
fi
|
||||
if getargs 'ip=dhcp'; then
|
||||
do_dhcp -4
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@@ -5,12 +5,7 @@
|
||||
check() {
|
||||
local _program
|
||||
|
||||
for _program in ip arping dhclient ; do
|
||||
if ! type -P $_program >/dev/null; then
|
||||
derror "Could not find program \"$_program\" required by network."
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
require_binaries ip arping dhclient || return 1
|
||||
|
||||
return 255
|
||||
}
|
||||
@@ -69,11 +64,12 @@ installkernel() {
|
||||
=drivers/net/team \
|
||||
=drivers/net/ethernet \
|
||||
ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net
|
||||
hostonly="" instmods iscsi_ibft crc32c iscsi_boot_sysfs
|
||||
}
|
||||
|
||||
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
|
||||
@@ -95,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
|
||||
@@ -55,15 +66,14 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
fi
|
||||
|
||||
ifup='/sbin/ifup $env{INTERFACE}'
|
||||
[ -z "$netroot" ] && ifup="$ifup -m"
|
||||
|
||||
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\""
|
||||
@@ -84,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
|
||||
@@ -98,7 +102,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
# Default: We don't know the interface to use, handle all
|
||||
# Fixme: waiting for the interface as well.
|
||||
else
|
||||
cond='ACTION=="add", SUBSYSTEM=="net"'
|
||||
cond='ACTION=="add", SUBSYSTEM=="net", ENV{DEVTYPE}!="wlan|wwan"'
|
||||
# if you change the name of "91-default-net.rules", also change modules.d/80cms/cmssetup.sh
|
||||
echo "$cond, $runcmd" > /etc/udev/rules.d/91-default-net.rules
|
||||
fi
|
||||
|
@@ -2,6 +2,18 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
is_ip() {
|
||||
echo "$1" | {
|
||||
IFS=. read a b c d
|
||||
test "$a" -ge 0 -a "$a" -le 255 \
|
||||
-a "$b" -ge 0 -a "$b" -le 255 \
|
||||
-a "$c" -ge 0 -a "$c" -le 255 \
|
||||
-a "$d" -ge 0 -a "$d" -le 255 \
|
||||
2> /dev/null
|
||||
} && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
get_ip() {
|
||||
local iface="$1" ip=""
|
||||
ip=$(ip -o -f inet addr show $iface)
|
||||
@@ -62,6 +74,14 @@ all_ifaces_up() {
|
||||
done
|
||||
}
|
||||
|
||||
all_ifaces_setup() {
|
||||
local iface="" IFACES=""
|
||||
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
|
||||
for iface in $IFACES; do
|
||||
[ -e /tmp/net.$iface.did-setup ] || return 1
|
||||
done
|
||||
}
|
||||
|
||||
get_netroot_ip() {
|
||||
local prefix="" server="" rest=""
|
||||
splitsep "$1" ":" prefix server rest
|
||||
@@ -82,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?
|
||||
}
|
||||
@@ -91,25 +112,26 @@ 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"
|
||||
# run the scripts written by ifup
|
||||
[ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw
|
||||
[ -e /tmp/net.$netif.hostname ] && . /tmp/net.$netif.hostname
|
||||
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
|
||||
[ -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
|
||||
for _p in $(getargs rd.route); do
|
||||
route_to_var "$_p" || continue
|
||||
[ -n "$route_dev" ] && [ "$route_dev" != "$netif" ] && continue
|
||||
ip route add "$route_mask" ${route_gw:+via "$route_gw"} ${route_dev:+dev "$route_dev"}
|
||||
if strstr ":" "$route_mask"; then
|
||||
if strstr "$route_mask" ":"; then
|
||||
printf -- "%s\n" "$route_mask ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}" \
|
||||
> /tmp/net.route6."$netif"
|
||||
else
|
||||
@@ -148,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
|
||||
}
|
||||
|
||||
@@ -191,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#??:}
|
||||
@@ -215,19 +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
|
||||
@@ -383,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|either6}
|
||||
# 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" -o "$2" = "either6" ]; 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() {
|
||||
@@ -466,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
|
||||
|
||||
@@ -476,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
|
||||
|
||||
@@ -486,7 +580,11 @@ parse_ifname_opts() {
|
||||
wait_for_if_link() {
|
||||
local cnt=0
|
||||
local li
|
||||
while [ $cnt -lt 600 ]; do
|
||||
local timeout="$(getargs rd.net.timeout.iflink=)"
|
||||
timeout=${timeout:-60}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
li=$(ip -o link show dev $1 2>/dev/null)
|
||||
[ -n "$li" ] && return 0
|
||||
sleep 0.1
|
||||
@@ -498,9 +596,27 @@ wait_for_if_link() {
|
||||
wait_for_if_up() {
|
||||
local cnt=0
|
||||
local li
|
||||
while [ $cnt -lt 200 ]; do
|
||||
local timeout="$(getargs rd.net.timeout.ifup=)"
|
||||
timeout=${timeout:-20}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
li=$(ip -o link show up dev $1)
|
||||
[ -n "$li" ] && [ -z "${li##*state UP*}" ] && return 0
|
||||
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))
|
||||
done
|
||||
@@ -509,7 +625,11 @@ wait_for_if_up() {
|
||||
|
||||
wait_for_route_ok() {
|
||||
local cnt=0
|
||||
while [ $cnt -lt 200 ]; do
|
||||
local timeout="$(getargs rd.net.timeout.route=)"
|
||||
timeout=${timeout:-20}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
li=$(ip route show)
|
||||
[ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
|
||||
sleep 0.1
|
||||
@@ -518,12 +638,36 @@ wait_for_route_ok() {
|
||||
return 1
|
||||
}
|
||||
|
||||
wait_for_ipv6_dad_link() {
|
||||
local cnt=0
|
||||
local timeout="$(getargs rd.net.timeout.ipv6dad=)"
|
||||
timeout=${timeout:-50}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ -n "$(ip -6 addr show dev "$1" scope link)" ] \
|
||||
[ -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 li
|
||||
while [ $cnt -lt 500 ]; do
|
||||
li=$(ip -6 addr show dev $1)
|
||||
strstr "$li" "tentative" || return 0
|
||||
local timeout="$(getargs rd.net.timeout.ipv6dad=)"
|
||||
timeout=${timeout:-50}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ -n "$(ip -6 addr show dev "$1")" ] \
|
||||
[ -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
|
||||
@@ -532,12 +676,14 @@ wait_for_ipv6_dad() {
|
||||
|
||||
wait_for_ipv6_auto() {
|
||||
local cnt=0
|
||||
local li
|
||||
while [ $cnt -lt 400 ]; do
|
||||
li=$(ip -6 addr show dev $1)
|
||||
if ! strstr "$li" "tentative"; then
|
||||
strstr "$li" "dynamic" && return 0
|
||||
fi
|
||||
local timeout="$(getargs rd.net.timeout.ipv6auto=)"
|
||||
timeout=${timeout:-40}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ -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
|
||||
@@ -555,14 +701,43 @@ hostname() {
|
||||
cat /proc/sys/kernel/hostname
|
||||
}
|
||||
|
||||
iface_has_link() {
|
||||
iface_has_carrier() {
|
||||
local cnt=0
|
||||
local interface="$1" flags=""
|
||||
[ -n "$interface" ] || return 2
|
||||
interface="/sys/class/net/$interface"
|
||||
[ -d "$interface" ] || return 2
|
||||
local timeout="$(getargs rd.net.timeout.carrier=)"
|
||||
timeout=${timeout:-15}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
linkup "$1"
|
||||
[ "$(cat $interface/carrier)" = 1 ] || return 1
|
||||
# XXX Do we need to reset the flags here? anaconda never bothered..
|
||||
|
||||
li=$(ip -o link show up dev $1)
|
||||
strstr "$li" "NO-CARRIER" && _no_carrier_flag=1
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
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 "$@"
|
||||
}
|
||||
|
||||
iface_is_enslaved() {
|
||||
local _li
|
||||
_li=$(ip -o link show dev $1)
|
||||
strstr "$li" " master " || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
find_iface_with_link() {
|
||||
|
@@ -14,6 +14,11 @@ command -v setup_net >/dev/null || . /lib/net-lib.sh
|
||||
# no sense in doing something if no (net)root info is available
|
||||
# or root is already there
|
||||
[ -d $NEWROOT/proc ] && exit 0
|
||||
|
||||
if [ -z "$netroot" ]; then
|
||||
netroot=$(getarg netroot=)
|
||||
fi
|
||||
|
||||
[ -z "$netroot" ] && exit 1
|
||||
|
||||
# Set or override primary interface
|
||||
@@ -35,7 +40,7 @@ esac
|
||||
# Figure out the handler for root=dhcp by recalling all netroot cmdline
|
||||
# handlers when this is not called from manually network bringing up.
|
||||
if [ -z "$2" ]; then
|
||||
if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then
|
||||
if getarg "root=dhcp" || getarg "netroot=dhcp" || getarg "root=dhcp6" || getarg "netroot=dhcp6"; then
|
||||
# Load dhcp options
|
||||
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
|
||||
|
||||
@@ -47,6 +52,8 @@ if [ -z "$2" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -f -- $hookdir/initqueue/finished/dhcp.sh
|
||||
|
||||
# Set netroot to new_root_path, so cmdline parsers don't call
|
||||
netroot=$new_root_path
|
||||
|
||||
@@ -76,9 +83,7 @@ source_hook netroot $netif
|
||||
|
||||
# Run the handler; don't store the root, it may change from device to device
|
||||
# XXX other variables to export?
|
||||
if $handler $netif $netroot $NEWROOT; then
|
||||
rm -f -- $hookdir/initqueue/finished/dhcp.sh
|
||||
# Network rootfs mount successful - save interface info for ifcfg etc.
|
||||
save_netinfo $netif
|
||||
fi
|
||||
[ -n "$handler" ] && "$handler" "$netif" "$netroot" "$NEWROOT"
|
||||
save_netinfo $netif
|
||||
|
||||
exit 0
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Format:
|
||||
# bond=<bondname>[:<bondslaves>:[:<options>]]
|
||||
# bond=<bondname>[:<bondslaves>:[:<options>[:<mtu>]]]
|
||||
#
|
||||
# bondslaves is a comma-separated list of physical (ethernet) interfaces
|
||||
# options is a comma-separated list on bonding options (modinfo bonding for details) in format compatible with initscripts
|
||||
@@ -9,14 +9,8 @@
|
||||
#
|
||||
# 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
|
||||
# if the mtu is specified, it will be set on the bond master
|
||||
#
|
||||
|
||||
# We translate list of slaves to space-separated here to mwke it easier to loop over them in ifup
|
||||
# Ditto for bonding options
|
||||
@@ -28,24 +22,24 @@ parsebond() {
|
||||
v=${v#*:}
|
||||
done
|
||||
|
||||
unset bondname bondslaves bondoptions
|
||||
case $# in
|
||||
0) bondname=bond0; bondslaves="eth0 eth1" ;;
|
||||
1) bondname=$1; bondslaves="eth0 eth1" ;;
|
||||
2) bondname=$1; bondslaves=$(str_replace "$2" "," " ") ;;
|
||||
3) bondname=$1; bondslaves=$(str_replace "$2" "," " "); bondoptions=$(str_replace "$3" "," " ") ;;
|
||||
4) bondname=$1; bondslaves=$(str_replace "$2" "," " "); bondoptions=$(str_replace "$3" "," " "); bondmtu=$4;;
|
||||
*) die "bond= requires zero to four parameters" ;;
|
||||
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=)"
|
||||
# Parse bond for bondname, bondslaves, bondmode, bondoptions and bondmtu
|
||||
for bond in $(getargs bond=); do
|
||||
unset bondname
|
||||
unset bondslaves
|
||||
unset bondoptions
|
||||
unset bondmtu
|
||||
if [ "$bond" != "bond" ]; then
|
||||
parsebond "$bond"
|
||||
fi
|
||||
# Simple default bond
|
||||
if [ -z "$bondname" ]; then
|
||||
@@ -57,5 +51,5 @@ 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
|
||||
echo "bondmtu=\"$bondmtu\"" >> /tmp/bond.${bondname}.info
|
||||
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
|
||||
|
@@ -6,5 +6,7 @@ command -v getarg >/dev/null || . /lib/dracut-lib.sh
|
||||
command -v ibft_to_cmdline >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
if getargbool 0 rd.iscsi.ibft -d "ip=ibft"; then
|
||||
modprobe -b -q iscsi_boot_sysfs 2>/dev/null
|
||||
modprobe -b -q iscsi_ibft
|
||||
ibft_to_cmdline
|
||||
fi
|
||||
|
@@ -38,8 +38,12 @@ unset count
|
||||
# If needed, check if bootdev= contains anything usable
|
||||
BOOTDEV=$(getarg bootdev=)
|
||||
|
||||
if [ -n "$NEEDBOOTDEV" ] ; then
|
||||
[ -z "$BOOTDEV" ] && warn "Please supply bootdev argument for multiple ip= lines"
|
||||
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
|
||||
@@ -48,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" ] && warn "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"
|
||||
@@ -77,9 +78,10 @@ for p in $(getargs ip=); do
|
||||
die "Sorry, automatic calculation of netmask is not yet supported"
|
||||
;;
|
||||
auto6);;
|
||||
either6);;
|
||||
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'"
|
||||
;;
|
||||
@@ -111,6 +113,16 @@ for p in $(getargs ip=); do
|
||||
die "Server-ip or dhcp for netboot needed, but current arguments say otherwise"
|
||||
fi
|
||||
|
||||
if str_starts "$dev" "enx" && [ ${#dev} -eq 15 ]; then
|
||||
printf -- "ifname=%s:%s:%s:%s:%s:%s:%s\n" \
|
||||
"$dev" \
|
||||
"${dev:3:2}" \
|
||||
"${dev:5:2}" \
|
||||
"${dev:7:2}" \
|
||||
"${dev:9:2}" \
|
||||
"${dev:11:2}" \
|
||||
"${dev:13:2}" >> /etc/cmdline.d/80-enx.conf
|
||||
fi
|
||||
done
|
||||
|
||||
# put BOOTIF in IFACES to make sure it comes up
|
||||
|
@@ -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
|
||||
@@ -140,8 +134,13 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
unset macaddr
|
||||
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
|
||||
@@ -149,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
|
||||
@@ -162,7 +167,7 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "NAME=\"$netif\""
|
||||
interface_bind "$netif" "$macaddr"
|
||||
[ -z "$vlan" ] && interface_bind "$netif" "$macaddr"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "UUID=\"$uuid\""
|
||||
@@ -176,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"
|
||||
@@ -207,16 +210,13 @@ 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
|
||||
{
|
||||
echo "TYPE=Vlan"
|
||||
echo "NAME=\"$netif\""
|
||||
echo "DEVICE=\"$netif\""
|
||||
echo "VLAN=yes"
|
||||
echo "PHYSDEV=\"$phydevice\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
@@ -243,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
|
||||
@@ -266,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
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# module-setup for url-lib
|
||||
|
||||
check() {
|
||||
command -v curl >/dev/null || return 1
|
||||
require_binaries curl || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
@@ -48,6 +48,8 @@ installkernel() {
|
||||
return 0
|
||||
}
|
||||
|
||||
instmods amdkfd hyperv_fb
|
||||
|
||||
for _modname in $(find_kernel_modules_by_path drivers/gpu/drm \
|
||||
| drm_module_filter) ; do
|
||||
# if the hardware is present, include module even if it is not currently loaded,
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
type -P plymouthd >/dev/null && type -P plymouth >/dev/null
|
||||
require_binaries plymouthd plymouth
|
||||
}
|
||||
|
||||
depends() {
|
||||
|
@@ -37,4 +37,4 @@ fi
|
||||
IFACES="$IFACES $DEVICE"
|
||||
echo "$IFACES" >> /tmp/net.ifaces
|
||||
|
||||
ifup $DEVICE -m
|
||||
exec ifup "$DEVICE"
|
||||
|
@@ -6,10 +6,10 @@ check() {
|
||||
local _rootdev
|
||||
# if we don't have btrfs installed on the host system,
|
||||
# no point in trying to support it in the initramfs.
|
||||
type -P btrfs >/dev/null || return 1
|
||||
require_binaries btrfs || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in ${host_fs_types[@]}; do
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ "$fs" == "btrfs" ]] && return 0
|
||||
done
|
||||
return 255
|
||||
|
@@ -5,7 +5,7 @@
|
||||
check() {
|
||||
local _rootdev
|
||||
# if cryptsetup is not installed, then we cannot support encrypted devices.
|
||||
type -P cryptsetup >/dev/null || return 1
|
||||
require_binaries cryptsetup || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
@@ -24,6 +24,7 @@ depends() {
|
||||
|
||||
installkernel() {
|
||||
instmods dm_crypt =crypto
|
||||
hostonly="" instmods drbg
|
||||
}
|
||||
|
||||
cmdline() {
|
||||
@@ -62,7 +63,7 @@ install() {
|
||||
|
||||
if [[ $hostonly ]] && [[ -f /etc/crypttab ]]; then
|
||||
# filter /etc/crypttab for the devices we need
|
||||
while read _mapper _dev _rest; do
|
||||
while read _mapper _dev _rest || [ -n "$_mapper" ]; do
|
||||
[[ $_mapper = \#* ]] && continue
|
||||
[[ $_dev ]] || continue
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
type -P dmsetup >/dev/null || return 1
|
||||
require_binaries dmsetup || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,6 @@ PROGRAM=="/bin/sh -c 'for i in $sys/$devpath/holders/dm-[0-9]*; do [ -e $$i ] &&
|
||||
ENV{DEVTYPE}!="partition", \
|
||||
RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
|
||||
|
||||
RUN+="/sbin/initqueue --onetime --unique --settled /sbin/dmraid_scan"
|
||||
RUN+="/sbin/initqueue --onetime --unique --settled /sbin/dmraid_scan $env{DEVNAME}"
|
||||
|
||||
LABEL="dm_end"
|
||||
|
@@ -4,6 +4,13 @@
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
dev="$1"
|
||||
devenc=$(str_replace "$1" '/' '\2f')
|
||||
|
||||
[ -e /tmp/dmraid.$devenc ] && exit 0
|
||||
|
||||
>/tmp/dmraid.$devenc
|
||||
|
||||
DM_RAIDS=$(getargs rd.dm.uuid -d rd_DM_UUID=)
|
||||
|
||||
if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then
|
||||
|
@@ -6,7 +6,7 @@ check() {
|
||||
local _rootdev
|
||||
# if we don't have dmraid installed on the host system, no point
|
||||
# in trying to support it in the initramfs.
|
||||
type -P dmraid >/dev/null || return 1
|
||||
require_binaries dmraid || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
|
22
modules.d/90dmsquash-live-ntfs/module-setup.sh
Executable file
22
modules.d/90dmsquash-live-ntfs/module-setup.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
command -v
|
||||
|
||||
check() {
|
||||
require_binaries ntfs-3g || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
echo dmsquash-live
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_multiple fusermount ulockmgr_server mount.fuse ntfs-3g
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
hostonly='' instmods fuse
|
||||
}
|
@@ -11,3 +11,4 @@ StandardInput=tty-force
|
||||
StandardOutput=inherit
|
||||
StandardError=inherit
|
||||
TimeoutSec=0
|
||||
SuccessExitStatus=2
|
||||
|
@@ -4,6 +4,8 @@
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
command -v unpack_archive >/dev/null || . /lib/img-lib.sh
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
if getargbool 0 rd.live.debug -n -y rdlivedebug; then
|
||||
@@ -26,6 +28,11 @@ getargbool 0 rd.live.ram -d -y live_ram && live_ram="yes"
|
||||
getargbool 0 rd.live.overlay.reset -d -y reset_overlay && reset_overlay="yes"
|
||||
getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
|
||||
overlay=$(getarg rd.live.overlay -d overlay)
|
||||
getargbool 0 rd.writable.fsimg -d -y writable_fsimg && writable_fsimg="yes"
|
||||
overlay_size=$(getarg rd.live.overlay.size=)
|
||||
[ -z "$overlay_size" ] && overlay_size=512
|
||||
|
||||
getargbool 0 rd.live.overlay.thin && thin_snapshot="yes"
|
||||
|
||||
# CD/DVD media check
|
||||
[ -b $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
|
||||
@@ -41,7 +48,7 @@ if [ -n "$check" ]; then
|
||||
else
|
||||
checkisomd5 --verbose $livedev
|
||||
fi
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ $? -eq 1 ]; then
|
||||
die "CD check failed!"
|
||||
exit 1
|
||||
fi
|
||||
@@ -72,7 +79,20 @@ if [ -f $livedev ]; then
|
||||
esac
|
||||
[ -e /sys/fs/$fstype ] || modprobe $fstype
|
||||
else
|
||||
mount -n -t $fstype -o ${liverw:-ro} $livedev /run/initramfs/live
|
||||
if [ "$(blkid -o value -s TYPE $livedev)" != "ntfs" ]; then
|
||||
mount -n -t $fstype -o ${liverw:-ro} $livedev /run/initramfs/live
|
||||
else
|
||||
# Symlinking /usr/bin/ntfs-3g as /sbin/mount.ntfs seems to boot
|
||||
# at the first glance, but ends with lots and lots of squashfs
|
||||
# errors, because systemd attempts to kill the ntfs-3g process?!
|
||||
if [ -x "/usr/bin/ntfs-3g" ]; then
|
||||
( exec -a @ntfs-3g ntfs-3g -o ${liverw:-ro} $livedev /run/initramfs/live ) | vwarn
|
||||
else
|
||||
die "Failed to mount block device of live image: Missing NTFS support"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$?" != "0" ]; then
|
||||
die "Failed to mount block device of live image"
|
||||
exit 1
|
||||
@@ -124,7 +144,7 @@ do_live_overlay() {
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((512*1024)) 2> /dev/null
|
||||
dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((overlay_size*1024)) 2> /dev/null
|
||||
if [ -n "$setup" -a -n "$readonly_overlay" ]; then
|
||||
RO_OVERLAY_LOOPDEV=$( losetup -f )
|
||||
losetup $RO_OVERLAY_LOOPDEV /overlay
|
||||
@@ -143,7 +163,31 @@ do_live_overlay() {
|
||||
base=$BASE_LOOPDEV
|
||||
over=$OVERLAY_LOOPDEV
|
||||
fi
|
||||
echo 0 $sz snapshot $base $over p 8 | dmsetup create live-rw
|
||||
|
||||
if [ -n "$thin_snapshot" ]; then
|
||||
modprobe dm_thin_pool
|
||||
mkdir /run/initramfs/thin-overlay
|
||||
|
||||
# In block units (512b)
|
||||
thin_data_sz=$(( $overlay_size * 1024 * 1024 / 512 ))
|
||||
thin_meta_sz=$(( $thin_data_sz / 10 ))
|
||||
|
||||
# It is important to have the backing file on a tmpfs
|
||||
# this is needed to let the loopdevice support TRIM
|
||||
dd if=/dev/null of=/run/initramfs/thin-overlay/meta bs=1b count=1 seek=$((thin_meta_sz)) 2> /dev/null
|
||||
dd if=/dev/null of=/run/initramfs/thin-overlay/data bs=1b count=1 seek=$((thin_data_sz)) 2> /dev/null
|
||||
|
||||
THIN_META_LOOPDEV=$( losetup --show -f /run/initramfs/thin-overlay/meta )
|
||||
THIN_DATA_LOOPDEV=$( losetup --show -f /run/initramfs/thin-overlay/data )
|
||||
|
||||
echo 0 $thin_data_sz thin-pool $THIN_META_LOOPDEV $THIN_DATA_LOOPDEV 1024 1024 | dmsetup create live-overlay-pool
|
||||
dmsetup message /dev/mapper/live-overlay-pool 0 "create_thin 0"
|
||||
|
||||
# Create a snapshot of the base image
|
||||
echo 0 $sz thin /dev/mapper/live-overlay-pool 0 $base | dmsetup create live-rw
|
||||
else
|
||||
echo 0 $sz snapshot $base $over p 8 | dmsetup create live-rw
|
||||
fi
|
||||
|
||||
# Create a device that always points to a ro base image
|
||||
echo 0 $sz linear $base 0 | dmsetup create --readonly live-base
|
||||
@@ -161,9 +205,9 @@ fi
|
||||
|
||||
if [ -n "$OSMINSQFS" ]; then
|
||||
# decompress the delta data
|
||||
dd if=$OSMINSQFS of=/osmin.img 2> /dev/null
|
||||
dd if=$OSMINSQFS of=/run/initramfs/osmin.img 2> /dev/null
|
||||
OSMIN_SQUASHED_LOOPDEV=$( losetup -f )
|
||||
losetup -r $OSMIN_SQUASHED_LOOPDEV /osmin.img
|
||||
losetup -r $OSMIN_SQUASHED_LOOPDEV /run/initramfs/osmin.img
|
||||
mkdir -m 0755 -p /run/initramfs/squashfs.osmin
|
||||
mount -n -t squashfs -o ro $OSMIN_SQUASHED_LOOPDEV /run/initramfs/squashfs.osmin
|
||||
OSMIN_LOOPDEV=$( losetup -f )
|
||||
@@ -171,20 +215,6 @@ if [ -n "$OSMINSQFS" ]; then
|
||||
umount -l /run/initramfs/squashfs.osmin
|
||||
fi
|
||||
|
||||
# we might have an embedded fs image to use as rootfs (uncompressed live)
|
||||
if [ -e /run/initramfs/live/${live_dir}/ext3fs.img ]; then
|
||||
FSIMG="/run/initramfs/live/${live_dir}/ext3fs.img"
|
||||
elif [ -e /run/initramfs/live/${live_dir}/rootfs.img ]; then
|
||||
FSIMG="/run/initramfs/live/${live_dir}/rootfs.img"
|
||||
fi
|
||||
|
||||
if [ -n "$FSIMG" ] ; then
|
||||
BASE_LOOPDEV=$( losetup -f )
|
||||
losetup -r $BASE_LOOPDEV $FSIMG
|
||||
|
||||
do_live_from_base_loop
|
||||
fi
|
||||
|
||||
# we might have an embedded fs image on squashfs (compressed live)
|
||||
if [ -e /run/initramfs/live/${live_dir}/${squash_image} ]; then
|
||||
SQUASHED="/run/initramfs/live/${live_dir}/${squash_image}"
|
||||
@@ -194,10 +224,10 @@ if [ -e "$SQUASHED" ] ; then
|
||||
if [ -n "$live_ram" ] ; then
|
||||
echo "Copying live image to RAM..."
|
||||
echo "(this may take a few minutes)"
|
||||
dd if=$SQUASHED of=/squashed.img bs=512 2> /dev/null
|
||||
dd if=$SQUASHED of=/run/initramfs/squashed.img bs=512 2> /dev/null
|
||||
umount -n /run/initramfs/live
|
||||
echo "Done copying live image to RAM."
|
||||
SQUASHED="/squashed.img"
|
||||
SQUASHED="/run/initramfs/squashed.img"
|
||||
fi
|
||||
|
||||
SQUASHED_LOOPDEV=$( losetup -f )
|
||||
@@ -205,18 +235,42 @@ if [ -e "$SQUASHED" ] ; then
|
||||
mkdir -m 0755 -p /run/initramfs/squashfs
|
||||
mount -n -t squashfs -o ro $SQUASHED_LOOPDEV /run/initramfs/squashfs
|
||||
|
||||
BASE_LOOPDEV=$( losetup -f )
|
||||
if [ -f /run/initramfs/squashfs/LiveOS/ext3fs.img ]; then
|
||||
losetup -r $BASE_LOOPDEV /run/initramfs/squashfs/LiveOS/ext3fs.img
|
||||
elif [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
|
||||
losetup -r $BASE_LOOPDEV /run/initramfs/squashfs/LiveOS/rootfs.img
|
||||
fi
|
||||
|
||||
umount -l /run/initramfs/squashfs
|
||||
|
||||
do_live_from_base_loop
|
||||
fi
|
||||
|
||||
# we might have an embedded fs image to use as rootfs (uncompressed live)
|
||||
if [ -e /run/initramfs/live/${live_dir}/ext3fs.img ]; then
|
||||
FSIMG="/run/initramfs/live/${live_dir}/ext3fs.img"
|
||||
elif [ -e /run/initramfs/live/${live_dir}/rootfs.img ]; then
|
||||
FSIMG="/run/initramfs/live/${live_dir}/rootfs.img"
|
||||
elif [ -f /run/initramfs/squashfs/LiveOS/ext3fs.img ]; then
|
||||
FSIMG="/run/initramfs/squashfs/LiveOS/ext3fs.img"
|
||||
elif [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
|
||||
FSIMG="/run/initramfs/squashfs/LiveOS/rootfs.img"
|
||||
fi
|
||||
|
||||
if [ -n "$FSIMG" ] ; then
|
||||
BASE_LOOPDEV=$( losetup -f )
|
||||
|
||||
if [ -n "$writable_fsimg" ] ; then
|
||||
# mount the provided fileysstem read/write
|
||||
echo "Unpacking live filesystem (may take some time)"
|
||||
mkdir /run/initramfs/fsimg/
|
||||
if [ -n "$SQUASHED" ]; then
|
||||
cp -v $FSIMG /run/initramfs/fsimg/rootfs.img
|
||||
else
|
||||
unpack_archive $FSIMG /run/initramfs/fsimg/
|
||||
fi
|
||||
losetup $BASE_LOOPDEV /run/initramfs/fsimg/rootfs.img
|
||||
echo "0 $( blockdev --getsize $BASE_LOOPDEV ) linear $BASE_LOOPDEV 0" | dmsetup create live-rw
|
||||
else
|
||||
# mount the filesystem read-only and add a dm snapshot for writes
|
||||
losetup -r $BASE_LOOPDEV $FSIMG
|
||||
do_live_from_base_loop
|
||||
fi
|
||||
fi
|
||||
|
||||
[ -e "$SQUASHED" ] && umount -l /run/initramfs/squashfs
|
||||
|
||||
if [ -b "$OSMIN_LOOPDEV" ]; then
|
||||
# set up the devicemapper snapshot device, which will merge
|
||||
# the normal live fs image, and the delta, into a minimzied fs image
|
||||
|
@@ -11,7 +11,7 @@ check() {
|
||||
depends() {
|
||||
# if dmsetup is not installed, then we cannot support fedora/red hat
|
||||
# style live images
|
||||
echo dm rootfs-block
|
||||
echo dm rootfs-block img-lib
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@@ -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() {
|
||||
@@ -40,20 +40,33 @@ installkernel() {
|
||||
ehci-hcd ehci-pci ehci-platform \
|
||||
ohci-hcd ohci-pci \
|
||||
uhci-hcd \
|
||||
xhci-hcd
|
||||
xhci-hcd xhci-pci xhci-plat-hcd
|
||||
|
||||
instmods yenta_socket scsi_dh_rdac scsi_dh_emc \
|
||||
atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech \
|
||||
hid-logitech-dj hid-microsoft firewire-ohci \
|
||||
pcmcia usb_storage nvme hid-hyperv hv-vmbus \
|
||||
sdhci_acpi
|
||||
instmods yenta_socket scsi_dh_rdac scsi_dh_emc scsi_dh_alua \
|
||||
atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus \
|
||||
atkbd i8042 usbhid firewire-ohci pcmcia usb_storage \
|
||||
nvme hv-vmbus sdhci_acpi nfit
|
||||
|
||||
if [[ "$(uname -p)" == arm* ]]; then
|
||||
# arm specific modules
|
||||
instmods \
|
||||
"=drivers/hid" \
|
||||
"=drivers/input/serio" \
|
||||
"=drivers/input/keyboard"
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
# install virtual machine support
|
||||
@@ -70,7 +83,7 @@ installkernel() {
|
||||
instmods '=fs'
|
||||
fi
|
||||
else
|
||||
for i in $(host_fs_all); do
|
||||
for i in "${host_fs_types[@]}"; do
|
||||
hostonly='' instmods $i
|
||||
done
|
||||
fi
|
||||
|
@@ -7,12 +7,20 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
[ -e /tmp/livenet.downloaded ] && exit 0
|
||||
|
||||
# args get passed from 40network/netroot
|
||||
netroot="$2"
|
||||
liveurl="${netroot#livenet:}"
|
||||
info "fetching $liveurl"
|
||||
imgfile=$(fetch_url "$liveurl")
|
||||
[ $? = 0 ] || die "failed to download live image: error $?"
|
||||
|
||||
if [ $? != 0 ]; then
|
||||
warn "failed to download live image: error $?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
> /tmp/livenet.downloaded
|
||||
|
||||
# TODO: couldn't dmsquash-live-root handle this?
|
||||
if [ ${imgfile##*.} = "iso" ]; then
|
||||
|
@@ -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;
|
||||
@@ -109,9 +109,9 @@ if [ -n "$LVS" ] ; then
|
||||
lvm lvscan --ignorelockingfailure 2>&1 | vinfo
|
||||
for LV in $LVS; do
|
||||
if [ -z "$sysinit" ]; then
|
||||
lvm lvchange --yes -ay --ignorelockingfailure $nopoll --ignoremonitoring $LV 2>&1 | vinfo
|
||||
lvm lvchange --yes -K -ay --ignorelockingfailure $nopoll --ignoremonitoring $LV 2>&1 | vinfo
|
||||
else
|
||||
lvm lvchange --yes -ay $sysinit $LV 2>&1 | vinfo
|
||||
lvm lvchange --yes -K -ay $sysinit $LV 2>&1 | vinfo
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
check() {
|
||||
# No point trying to support lvm if the binaries are missing
|
||||
type -P lvm >/dev/null || return 1
|
||||
require_binaries lvm || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
@@ -42,6 +42,10 @@ cmdline() {
|
||||
done
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
hostonly='' 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
|
||||
@@ -107,12 +114,19 @@ install() {
|
||||
dev=$(</sys/block/${dev#/dev/}/dm/name)
|
||||
eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2>/dev/null)
|
||||
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || continue
|
||||
if [[ "$(lvs --noheadings -o segtype ${DM_VG_NAME} 2>/dev/null)" == *thin* ]] ; then
|
||||
inst_multiple -o thin_dump thin_restore thin_check thin_repair
|
||||
break
|
||||
fi
|
||||
case "$(lvs --noheadings -o segtype ${DM_VG_NAME} 2>/dev/null)" in
|
||||
*thin*|*cache*|*era*)
|
||||
inst_multiple -o thin_dump thin_restore thin_check thin_repair \
|
||||
cache_dump cache_restore cache_check cache_repair \
|
||||
era_check era_dump era_invalidate era_restore
|
||||
break;;
|
||||
esac
|
||||
done
|
||||
else
|
||||
inst_multiple -o thin_dump thin_restore thin_check thin_repair
|
||||
fi
|
||||
|
||||
if ! [[ $hostonly ]]; then
|
||||
inst_multiple -o thin_dump thin_restore thin_check thin_repair \
|
||||
cache_dump cache_restore cache_check cache_repair \
|
||||
era_check era_dump era_invalidate era_restore
|
||||
fi
|
||||
}
|
||||
|
@@ -2,34 +2,69 @@
|
||||
# -*- 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
|
||||
_md_force_run() {
|
||||
type getargs >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
_md_start() {
|
||||
local _udevinfo
|
||||
local _path_s
|
||||
local _path_d
|
||||
local _md="$1"
|
||||
local _offroot="$2"
|
||||
|
||||
_udevinfo="$(udevadm info --query=env --name="${_md}")"
|
||||
strstr "$_udevinfo" "MD_LEVEL=container" && continue
|
||||
strstr "$_udevinfo" "DEVTYPE=partition" && continue
|
||||
|
||||
_path_s="/sys/$(udevadm info -q path -n "${_md}")/md/array_state"
|
||||
[ ! -r "$_path_s" ] && continue
|
||||
|
||||
# inactive ?
|
||||
[ "$(cat "$_path_s")" != "inactive" ] && continue
|
||||
|
||||
mdadm $_offroot -R "${_md}" 2>&1 | vinfo
|
||||
|
||||
# still inactive ?
|
||||
[ "$(cat "$_path_s")" = "inactive" ] && continue
|
||||
|
||||
_path_d="${_path_s%/*}/degraded"
|
||||
[ ! -r "$_path_d" ] && continue
|
||||
> $hookdir/initqueue/work
|
||||
}
|
||||
|
||||
_md_force_run() {
|
||||
local _offroot
|
||||
local _md
|
||||
local _UUID
|
||||
local _MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)
|
||||
[ -n "$_MD_UUID" ] || getargbool 0 rd.auto || return
|
||||
|
||||
_offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
|
||||
# try to force-run anything not running yet
|
||||
for md in /dev/md[0-9_]*; do
|
||||
[ -b "$md" ] || continue
|
||||
_udevinfo="$(udevadm info --query=env --name="$md")"
|
||||
strstr "$_udevinfo" "MD_LEVEL=container" && continue
|
||||
strstr "$_udevinfo" "DEVTYPE=partition" && continue
|
||||
|
||||
_path_s="/sys/$(udevadm info -q path -n "$md")/md/array_state"
|
||||
[ ! -r "$_path_s" ] && continue
|
||||
if [ -n "$_MD_UUID" ]; then
|
||||
for _md in /dev/md[0-9_]*; do
|
||||
[ -b "$_md" ] || continue
|
||||
_UUID=$(
|
||||
/sbin/mdadm -D --export "$_md" \
|
||||
| while read line || [ -n "$line" ]; do
|
||||
str_starts "$line" "MD_UUID=" || continue
|
||||
printf "%s" "${line#MD_UUID=}"
|
||||
done
|
||||
)
|
||||
|
||||
# inactive ?
|
||||
[ "$(cat "$_path_s")" != "inactive" ] && continue
|
||||
[ -z "$_UUID" ] && continue
|
||||
|
||||
mdadm $_offroot -R "$md" 2>&1 | vinfo
|
||||
# check if we should handle this device
|
||||
strstr " $_MD_UUID " " $_UUID " || continue
|
||||
|
||||
# still inactive ?
|
||||
[ "$(cat "$_path_s")" = "inactive" ] && continue
|
||||
|
||||
_path_d="${_path_s%/*}/degraded"
|
||||
[ ! -r "$_path_d" ] && continue
|
||||
done
|
||||
_md_start "${_md}" "${_offroot}"
|
||||
done
|
||||
else
|
||||
# try to force-run anything not running yet
|
||||
for _md in /dev/md[0-9_]*; do
|
||||
[ -b "$_md" ] || continue
|
||||
_md_start "${_md}" "${_offroot}"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
_md_force_run
|
||||
|
@@ -5,7 +5,7 @@
|
||||
check() {
|
||||
local _rootdev
|
||||
# No mdadm? No mdraid support.
|
||||
type -P mdadm >/dev/null || return 1
|
||||
require_binaries mdadm || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
|
@@ -26,6 +26,9 @@ else
|
||||
done < "${f}" > "${f}.new"
|
||||
mv "${f}.new" "$f"
|
||||
done
|
||||
for uuid in $MD_UUID; do
|
||||
wait_for_dev "/dev/disk/by-id/md-uuid-${uuid}"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@@ -2,17 +2,29 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
is_mpath() {
|
||||
local _dev=$1
|
||||
[ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
|
||||
[[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
majmin_to_mpath_dev() {
|
||||
local _dev
|
||||
for i in /dev/mapper/*; do
|
||||
[[ $i == /dev/mapper/control ]] && continue
|
||||
_dev=$(get_maj_min $i)
|
||||
if [ "$_dev" = "$1" ]; then
|
||||
echo $i
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
check() {
|
||||
local _rootdev
|
||||
# if there's no multipath binary, no go.
|
||||
type -P multipath >/dev/null || return 1
|
||||
|
||||
is_mpath() {
|
||||
local _dev=$1
|
||||
[ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
|
||||
[[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
|
||||
return 1
|
||||
}
|
||||
require_binaries multipath || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_and_slaves is_mpath || return 255
|
||||
@@ -64,11 +76,22 @@ installkernel() {
|
||||
}
|
||||
|
||||
( find_kernel_modules_by_path drivers/scsi; if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then find_kernel_modules_by_path drivers/s390/scsi; fi;
|
||||
find_kernel_modules_by_path drivers/md ) | mp_mod_filter | instmods
|
||||
find_kernel_modules_by_path drivers/md ) | mp_mod_filter | hostonly='' instmods
|
||||
}
|
||||
|
||||
install() {
|
||||
local _f
|
||||
local _f _allow
|
||||
add_hostonly_mpath_conf() {
|
||||
is_mpath $1 && {
|
||||
local _dev
|
||||
|
||||
_dev=$(majmin_to_mpath_dev $1)
|
||||
[ -z "$_dev" ] && return
|
||||
strstr "$_allow" "$_dev" && return
|
||||
_allow="$_allow --allow $_dev"
|
||||
}
|
||||
}
|
||||
|
||||
inst_multiple -o \
|
||||
dmsetup \
|
||||
kpartx \
|
||||
@@ -82,6 +105,11 @@ install() {
|
||||
/etc/multipath.conf \
|
||||
/etc/multipath/*
|
||||
|
||||
[[ $hostonly ]] && [[ $hostonly_mode = "strict" ]] && {
|
||||
for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
|
||||
[ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
|
||||
}
|
||||
|
||||
inst $(command -v partx) /sbin/partx
|
||||
|
||||
inst_libdir_file "libmultipath*" "multipath/*"
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
check() {
|
||||
if type -P systemd-detect-virt >/dev/null 2>&1; then
|
||||
vm=$(systemd-detect-virt --vm >/dev/null 2>&1)
|
||||
vm=$(systemd-detect-virt --vm 2>/dev/null)
|
||||
(($? != 0)) && return 255
|
||||
[[ $vm = "qemu" ]] && return 0
|
||||
[[ $vm = "kvm" ]] && return 0
|
||||
@@ -14,8 +14,9 @@ check() {
|
||||
for i in /sys/class/dmi/id/*_vendor; do
|
||||
[[ -f $i ]] || continue
|
||||
read vendor < $i
|
||||
[[ "$vendor" == "QEMU" ]] && return 0
|
||||
[[ "$vendor" == "Bochs" ]] && return 0
|
||||
[[ "$vendor" == "QEMU" ]] && return 0
|
||||
[[ "$vendor" == "Red Hat" ]] && return 0
|
||||
[[ "$vendor" == "Bochs" ]] && return 0
|
||||
done
|
||||
return 255
|
||||
}
|
||||
@@ -25,5 +26,5 @@ installkernel() {
|
||||
hostonly='' instmods \
|
||||
ata_piix ata_generic pata_acpi cdrom sr_mod ahci \
|
||||
virtio_blk virtio virtio_ring virtio_pci \
|
||||
virtio_scsi virtio_console
|
||||
virtio_scsi virtio_console spapr-vscsi ibmvscsi
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
# GPG support is optional
|
||||
check() {
|
||||
type -P gpg >/dev/null || return 1
|
||||
require_binaries gpg || return 1
|
||||
|
||||
return 255
|
||||
}
|
||||
|
@@ -1,19 +1,24 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
type -P losetup >/dev/null || return 1
|
||||
|
||||
return 255
|
||||
require_binaries losetup || return 1
|
||||
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
echo crypt
|
||||
echo crypt
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods loop
|
||||
instmods loop
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_multiple losetup
|
||||
inst "$moddir/crypt-loop-lib.sh" "/lib/dracut-crypt-loop-lib.sh"
|
||||
dracut_need_initqueue
|
||||
inst_multiple losetup
|
||||
inst "$moddir/crypt-loop-lib.sh" "/lib/dracut-crypt-loop-lib.sh"
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
@@ -4,10 +4,10 @@
|
||||
|
||||
check() {
|
||||
# If our prerequisites are not met, fail anyways.
|
||||
type -P mount.cifs >/dev/null || return 1
|
||||
require_binaries mount.cifs || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in ${host_fs_types[@]}; do
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ "$fs" == "cifs" ]] && return 0
|
||||
done
|
||||
return 255
|
||||
|
@@ -5,6 +5,7 @@
|
||||
check() {
|
||||
local _arch=$(uname -m)
|
||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
||||
require_binaries normalize_dasd_arg || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@@ -5,6 +5,7 @@
|
||||
check() {
|
||||
local _arch=$(uname -m)
|
||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
||||
require_binaries grep sed seq
|
||||
|
||||
return 0
|
||||
}
|
||||
|
@@ -4,9 +4,18 @@
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
for i in dcbtool fipvlan lldpad ip readlink; do
|
||||
type -P $i >/dev/null || return 1
|
||||
done
|
||||
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
|
||||
}
|
||||
require_binaries dcbtool fipvlan lldpad ip readlink || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
|
10
modules.d/95fcoe/cleanup-fcoe.sh
Normal file
10
modules.d/95fcoe/cleanup-fcoe.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if [ -e /var/run/lldpad.pid ]; then
|
||||
lldpad -k
|
||||
mkdir -m 0755 -p /run/initramfs/state/dev/shm
|
||||
cp /dev/shm/lldpad.state /run/initramfs/state/dev/shm/ > /dev/null 2>&1
|
||||
echo "files /dev/shm/lldpad.state" >> /run/initramfs/rwtab
|
||||
fi
|
@@ -2,24 +2,55 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
dcb=$1
|
||||
dcb="$1"
|
||||
|
||||
if ! [ -d /sys/firmware/edd ]; then
|
||||
modprobe edd
|
||||
while ! [ -d /sys/firmware/edd ]; do sleep 0.1; done
|
||||
fi
|
||||
_modprobe_r_edd="0"
|
||||
|
||||
check_edd() {
|
||||
local cnt=0
|
||||
|
||||
[ -d /sys/firmware/edd ] && return 0
|
||||
|
||||
_modprobe_r_edd="1"
|
||||
modprobe edd || return $?
|
||||
|
||||
while [ $cnt -lt 600 ]; do
|
||||
[ -d /sys/firmware/edd ] && return 0
|
||||
cnt=$(($cnt+1))
|
||||
sleep 0.1
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
check_edd || exit 1
|
||||
|
||||
for disk in /sys/firmware/edd/int13_*; do
|
||||
[ -d $disk ] || continue
|
||||
for nic in ${disk}/pci_dev/net/*; do
|
||||
[ -d $nic ] || continue
|
||||
[ -d "$disk" ] || continue
|
||||
if [ -e "${disk}/pci_dev/driver" ]; then
|
||||
driver=$(readlink "${disk}/pci_dev/driver")
|
||||
driver=${driver##*/}
|
||||
fi
|
||||
# i40e uses dev_port 1 for a virtual fcoe function
|
||||
if [ "${driver}" == "i40e" ]; then
|
||||
dev_port=1
|
||||
fi
|
||||
for nic in "${disk}"/pci_dev/net/*; do
|
||||
[ -d "$nic" ] || continue
|
||||
if [ -n "${dev_port}" -a -e "${nic}/dev_port" ]; then
|
||||
if [ "$(cat ${nic}/dev_port)" -ne "${dev_port}" ]; then
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
if [ -e ${nic}/address ]; then
|
||||
fcoe_interface=${nic##*/}
|
||||
if ! [ -e "/tmp/.fcoe-$fcoe_interface" ]; then
|
||||
/sbin/fcoe-up $fcoe_interface $dcb
|
||||
/sbin/fcoe-up "$fcoe_interface" "$dcb"
|
||||
> "/tmp/.fcoe-$fcoe_interface"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
modprobe -r edd
|
||||
|
||||
[ "$_modprobe_r_edd" = "1" ] && modprobe -r edd
|
||||
|
||||
unset _modprobe_r_edd
|
||||
|
@@ -13,24 +13,42 @@ 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
|
||||
|
||||
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)
|
||||
netdriver=${netdriver##*/}
|
||||
|
||||
write_fcoemon_cfg() {
|
||||
echo FCOE_ENABLE=\"yes\" > /etc/fcoe/cfg-$netif
|
||||
if [ "$dcb" = "dcb" ]; then
|
||||
echo DCB_REQUIRED=\"yes\" >> /etc/fcoe/cfg-$netif
|
||||
else
|
||||
echo DCB_REQUIRED=\"no\" >> /etc/fcoe/cfg-$netif
|
||||
fi
|
||||
if [ "$vlan" = "yes" ]; then
|
||||
echo AUTO_VLAN=\"yes\" >> /etc/fcoe/cfg-$netif
|
||||
else
|
||||
echo AUTO_VLAN=\"no\" >> /etc/fcoe/cfg-$netif
|
||||
fi
|
||||
echo MODE=\"fabric\" >> /etc/fcoe/cfg-$netif
|
||||
}
|
||||
|
||||
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
|
||||
@@ -40,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"
|
||||
@@ -51,6 +65,13 @@ if [ "$dcb" = "dcb" ]; then
|
||||
i=$(($i+1))
|
||||
done
|
||||
|
||||
while [ $i -lt 60 ]; do
|
||||
dcbtool sc "$netif" pfc e:1 a:1 w:1 && break
|
||||
info "Retrying to turn dcb on"
|
||||
sleep 1
|
||||
i=$(($i+1))
|
||||
done
|
||||
|
||||
while [ $i -lt 60 ]; do
|
||||
dcbtool sc "$netif" app:fcoe e:1 a:1 w:1 && break
|
||||
info "Retrying to turn fcoe on"
|
||||
@@ -60,16 +81,19 @@ if [ "$dcb" = "dcb" ]; then
|
||||
|
||||
sleep 1
|
||||
|
||||
fipvlan "$netif" -c -s
|
||||
write_fcoemon_cfg
|
||||
fcoemon --syslog
|
||||
elif [ "$netdriver" = "bnx2x" ]; then
|
||||
# If driver is bnx2x, do not use /sys/module/fcoe/parameters/create but fipvlan
|
||||
modprobe 8021q
|
||||
udevadm settle --timeout=30
|
||||
# Sleep for 3 s to allow dcb negotiation
|
||||
sleep 3
|
||||
# Sleep for 13 s to allow dcb negotiation
|
||||
sleep 13
|
||||
fipvlan "$netif" -c -s
|
||||
else
|
||||
echo -n "$netif" > /sys/module/fcoe/parameters/create
|
||||
vlan="no"
|
||||
write_fcoemon_cfg
|
||||
fcoemon --syslog
|
||||
fi
|
||||
|
||||
need_shutdown
|
||||
|
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,9 +3,16 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
for i in dcbtool fipvlan lldpad ip readlink; do
|
||||
type -P $i >/dev/null || return 1
|
||||
done
|
||||
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
|
||||
}
|
||||
@@ -19,15 +26,78 @@ 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
|
||||
|
||||
# Some Combined Network Adapters(CNAs) implement DCB in firmware.
|
||||
# Do not run software-based DCB or LLDP on CNAs that implement DCB.
|
||||
# If the network interface provides hardware DCB/DCBX capabilities,
|
||||
# DCB_REQUIRED in "/etc/fcoe/cfg-xxx" is expected to set to "no".
|
||||
#
|
||||
# Force "nodcb" if there's any DCB_REQUIRED="no"(child or vlan parent).
|
||||
grep -q "^[[:blank:]]*DCB_REQUIRED=\"no\"" /etc/fcoe/cfg-${i##*/} &>/dev/null
|
||||
[ $? -eq 0 ] && dcb="nodcb"
|
||||
if [ "$p" ] ; then
|
||||
grep -q "^[[:blank:]]*DCB_REQUIRED=\"no\"" /etc/fcoe/cfg-${p} &>/dev/null
|
||||
[ $? -eq 0 ] && dcb="nodcb"
|
||||
fi
|
||||
|
||||
echo "fcoe=${mac}:${dcb}"
|
||||
done
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple ip dcbtool fipvlan lldpad readlink lldptool
|
||||
inst_multiple ip dcbtool fipvlan lldpad readlink lldptool fcoemon fcoeadm
|
||||
inst_libdir_file 'libhbalinux.so*'
|
||||
[[ -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/module/fcoe/parameters/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/module/fcoe/parameters/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)
|
||||
|
@@ -2,5 +2,5 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
[ -e /sys/module/bnx2i ] && killproc iscsiuio
|
||||
[ -z "${DRACUT_SYSTEMD}" ] && [ -e /sys/module/bnx2i ] && killproc iscsiuio
|
||||
|
||||
|
@@ -38,36 +38,31 @@ iroot=${iroot#:}
|
||||
# figured out a way how to check whether this is built-in or not
|
||||
modprobe crc32c 2>/dev/null
|
||||
|
||||
if [ -e /sys/module/bnx2i ] && ! [ -e /tmp/iscsiuio-started ]; then
|
||||
if [ -z "${DRACUT_SYSTEMD}" ] && [ -e /sys/module/bnx2i ] && ! [ -e /tmp/iscsiuio-started ]; then
|
||||
iscsiuio
|
||||
> /tmp/iscsiuio-started
|
||||
fi
|
||||
|
||||
handle_firmware()
|
||||
{
|
||||
if ! [ -e /tmp/iscsistarted-firmware ]; then
|
||||
if ! iscsistart -f; then
|
||||
warn "iscistart: Could not get list of targets from firmware."
|
||||
return 1
|
||||
fi
|
||||
|
||||
for p in $(getargs rd.iscsi.param -d iscsi_param); do
|
||||
iscsi_param="$iscsi_param --param $p"
|
||||
done
|
||||
|
||||
if ! iscsistart -b $iscsi_param; then
|
||||
warn "'iscsistart -b $iscsi_param' failed"
|
||||
fi
|
||||
|
||||
if [ -d /sys/class/iscsi_session ]; then
|
||||
echo 'started' > "/tmp/iscsistarted-iscsi:"
|
||||
echo 'started' > "/tmp/iscsistarted-firmware"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
|
||||
need_shutdown
|
||||
if ! iscsistart -f; then
|
||||
warn "iscistart: Could not get list of targets from firmware. Skipping."
|
||||
echo 'skipped' > "/tmp/iscsistarted-firmware"
|
||||
return 0
|
||||
fi
|
||||
|
||||
for p in $(getargs rd.iscsi.param -d iscsi_param); do
|
||||
iscsi_param="$iscsi_param --param $p"
|
||||
done
|
||||
|
||||
if ! iscsistart -b $iscsi_param; then
|
||||
warn "'iscsistart -b $iscsi_param' failed with return code $?"
|
||||
fi
|
||||
|
||||
echo 'started' > "/tmp/iscsistarted-iscsi:"
|
||||
echo 'started' > "/tmp/iscsistarted-firmware"
|
||||
|
||||
need_shutdown
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -84,51 +79,70 @@ 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
|
||||
|
||||
parse_iscsi_root "$1" || return 1
|
||||
|
||||
# Bail out early, if there is no route to the destination
|
||||
if is_ip "$iscsi_target_ip" && [ "$netif" != "timeout" ] && ! all_ifaces_setup && getargbool 1 rd.iscsi.testroute; then
|
||||
ip route get "$iscsi_target_ip" >/dev/null 2>&1 || return 0
|
||||
fi
|
||||
|
||||
# XXX is this needed?
|
||||
getarg ro && iscsirw=ro
|
||||
getarg rw && iscsirw=rw
|
||||
fsopts=${fsopts:+$fsopts,}${iscsirw}
|
||||
fsopts="${fsopts:+$fsopts,}${iscsirw}"
|
||||
|
||||
if [ -z $iscsi_initiator ]; then
|
||||
# XXX Where are these from?
|
||||
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
|
||||
mkdir -p /etc/iscsi
|
||||
ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
|
||||
systemctl restart iscsid
|
||||
sleep 1
|
||||
> /tmp/iscsi_set_initiator
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
# XXX rfc3720 says 'SCSI Initiator Name: The iSCSI Initiator Name specifies
|
||||
# the worldwide unique name of the initiator.' Could we use hostname/ip
|
||||
# if missing?
|
||||
fi
|
||||
|
||||
if [ -z $iscsi_initiator ]; then
|
||||
if [ -f /sys/firmware/ibft/initiator/initiator-name ]; then
|
||||
iscsi_initiator=$(while read line; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
|
||||
fi
|
||||
if [ -z "$iscsi_initiator" ]; then
|
||||
iscsi_initiator=$(iscsi-iname)
|
||||
echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
|
||||
rm -f /etc/iscsi/initiatorname.iscsi
|
||||
mkdir -p /etc/iscsi
|
||||
ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
|
||||
systemctl restart iscsid
|
||||
> /tmp/iscsi_set_initiator
|
||||
# FIXME: iscsid is not yet ready, when the service is :-/
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
|
||||
if [ -z $iscsi_target_port ]; then
|
||||
iscsi_target_port=3260
|
||||
fi
|
||||
@@ -137,23 +151,21 @@ handle_netroot()
|
||||
iscsi_target_group=1
|
||||
fi
|
||||
|
||||
if [ -z $iscsi_initiator ]; then
|
||||
# XXX is this correct?
|
||||
iscsi_initiator=$(iscsi-iname)
|
||||
fi
|
||||
|
||||
if [ -z $iscsi_lun ]; then
|
||||
iscsi_lun=0
|
||||
fi
|
||||
|
||||
echo "InitiatorName='$iscsi_initiator'" > /run/initiatorname.iscsi
|
||||
echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
|
||||
ln -fs /run/initiatorname.iscsi /dev/.initiatorname.iscsi
|
||||
|
||||
if ! [ -e /etc/iscsi/initiatorname.iscsi ]; then
|
||||
mkdir -p /etc/iscsi
|
||||
ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
|
||||
fi
|
||||
# FIXME $iscsi_protocol??
|
||||
|
||||
if [ "$root" = "dhcp" ]; then
|
||||
if [ "$root" = "dhcp" ] || [ "$netroot" = "dhcp" ]; then
|
||||
# if root is not specified try to mount the whole iSCSI LUN
|
||||
printf 'SYMLINK=="disk/by-path/*-iscsi-*-%s", SYMLINK+="root"\n' $iscsi_lun >> /etc/udev/rules.d/99-iscsi-root.rules
|
||||
printf 'SYMLINK=="disk/by-path/*-iscsi-*-%s", SYMLINK+="root"\n' "$iscsi_lun" >> /etc/udev/rules.d/99-iscsi-root.rules
|
||||
udevadm control --reload
|
||||
write_fs_tab /dev/root
|
||||
wait_for_dev -n /dev/root
|
||||
@@ -163,48 +175,91 @@ handle_netroot()
|
||||
echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh
|
||||
fi
|
||||
|
||||
# force udevsettle to break
|
||||
> $hookdir/initqueue/work
|
||||
|
||||
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} \
|
||||
|| :
|
||||
|
||||
if [ -n "$DRACUT_SYSTEMD" ] && command -v systemd-run >/dev/null 2>&1; then
|
||||
netroot_enc=$(systemd-escape "iscsistart_${1}")
|
||||
status=$(systemctl is-active "$netroot_enc" 2>/dev/null)
|
||||
is_active=$?
|
||||
if [ $is_active -ne 0 ]; then
|
||||
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"} \
|
||||
${iscsi_param} >/dev/null 2>&1 \
|
||||
&& { > $hookdir/initqueue/work ; }
|
||||
while : ; do
|
||||
status=$(systemctl is-active "$netroot_enc" 2>/dev/null)
|
||||
[ "$status" != "activating" ] && break
|
||||
sleep 1
|
||||
done
|
||||
else
|
||||
systemctl --no-block restart "$netroot_enc" >/dev/null 2>&1 \
|
||||
&& { > $hookdir/initqueue/work ; }
|
||||
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"} \
|
||||
${iscsi_param} \
|
||||
&& { > $hookdir/initqueue/work ; }
|
||||
fi
|
||||
netroot_enc=$(str_replace "$1" '/' '\2f')
|
||||
echo 'started' > "/tmp/iscsistarted-iscsi:${netroot_enc}"
|
||||
return 0
|
||||
}
|
||||
|
||||
ret=0
|
||||
|
||||
# loop over all netroot parameter
|
||||
if getarg netroot; then
|
||||
for nroot in $(getargs netroot); do
|
||||
[ "${nroot%%:*}" = "iscsi" ] || continue
|
||||
nroot="${nroot##iscsi:}"
|
||||
if [ -n "$nroot" ]; then
|
||||
handle_netroot "$nroot"
|
||||
ret=$(($ret + $?))
|
||||
fi
|
||||
done
|
||||
if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
|
||||
if [ "$netif" != "timeout" ] && getargbool 1 rd.iscsi.waitnet; then
|
||||
all_ifaces_setup || exit 0
|
||||
fi
|
||||
|
||||
if [ "$netif" = "timeout" ] && all_ifaces_setup; then
|
||||
# s.th. went wrong and the timeout script hits
|
||||
# restart
|
||||
systemctl restart iscsid
|
||||
# damn iscsid is not ready after unit says it's ready
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
|
||||
if [ "$netif" = "timeout" ] || [ "$netif" = "online" ]; then
|
||||
handle_firmware
|
||||
ret=$(($ret + $?))
|
||||
fi
|
||||
else
|
||||
if [ -n "$iroot" ]; then
|
||||
handle_netroot "$iroot"
|
||||
ret=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! [ "$netif" = "online" ]; then
|
||||
# loop over all netroot parameter
|
||||
if nroot=$(getarg netroot) && [ "$nroot" != "dhcp" ]; then
|
||||
for nroot in $(getargs netroot); do
|
||||
[ "${nroot%%:*}" = "iscsi" ] || continue
|
||||
nroot="${nroot##iscsi:}"
|
||||
if [ -n "$nroot" ]; then
|
||||
handle_netroot "$nroot"
|
||||
ret=$(($ret + $?))
|
||||
fi
|
||||
done
|
||||
else
|
||||
if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
|
||||
handle_firmware
|
||||
if [ -n "$iroot" ]; then
|
||||
handle_netroot "$iroot"
|
||||
ret=$?
|
||||
fi
|
||||
fi
|
||||
@@ -212,6 +267,6 @@ fi
|
||||
|
||||
need_shutdown
|
||||
|
||||
# now we have a root filesystem somewhere in /dev/sda*
|
||||
# now we have a root filesystem somewhere in /dev/sd*
|
||||
# let the normal block handler handle root=
|
||||
exit $ret
|
||||
|
@@ -5,7 +5,7 @@
|
||||
check() {
|
||||
local _rootdev
|
||||
# If our prerequisites are not met, fail anyways.
|
||||
type -P iscsistart hostname iscsi-iname >/dev/null || return 1
|
||||
require_binaries iscsistart hostname iscsi-iname || return 1
|
||||
|
||||
# If hostonly was requested, fail the check if we are not actually
|
||||
# booting from root.
|
||||
@@ -23,12 +23,54 @@ check() {
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
pushd . >/dev/null
|
||||
for_each_host_dev_and_slaves is_iscsi || return 255
|
||||
for_each_host_dev_and_slaves is_iscsi
|
||||
local _is_iscsi=$?
|
||||
popd >/dev/null
|
||||
[[ $_is_iscsi == 0 ]] || return 255
|
||||
}
|
||||
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,14 +117,58 @@ 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"
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"
|
||||
else
|
||||
inst_multiple -o \
|
||||
$systemdsystemunitdir/iscsi.service \
|
||||
$systemdsystemunitdir/iscsid.service \
|
||||
$systemdsystemunitdir/iscsid.socket \
|
||||
$systemdsystemunitdir/iscsiuio.service \
|
||||
$systemdsystemunitdir/iscsiuio.socket \
|
||||
iscsiadm iscsid
|
||||
|
||||
mkdir -p "${initdir}/$systemdsystemunitdir/sockets.target.wants"
|
||||
for i in \
|
||||
iscsiuio.socket \
|
||||
; do
|
||||
ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/sockets.target.wants/${i}"
|
||||
done
|
||||
|
||||
mkdir -p "${initdir}/$systemdsystemunitdir/basic.target.wants"
|
||||
for i in \
|
||||
iscsid.service \
|
||||
; do
|
||||
ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/basic.target.wants/${i}"
|
||||
done
|
||||
|
||||
# Make sure iscsid is started after dracut-cmdline and ready for the initqueue
|
||||
mkdir -p "${initdir}/$systemdsystemunitdir/iscsid.service.d"
|
||||
(
|
||||
echo "[Unit]"
|
||||
echo "After=dracut-cmdline.service"
|
||||
echo "Before=dracut-initqueue.service"
|
||||
) > "${initdir}/$systemdsystemunitdir/iscsid.service.d/dracut.conf"
|
||||
fi
|
||||
inst_dir /var/lib/iscsi
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
@@ -16,10 +16,17 @@
|
||||
# This script is sourced, so root should be set. But let's be paranoid
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
if [ -z "$netroot" ]; then
|
||||
for netroot in $(getargs netroot=); do
|
||||
[ "${netroot%%:*}" = "iscsi" ] && break
|
||||
for nroot in $(getargs netroot=); do
|
||||
[ "${nroot%%:*}" = "iscsi" ] && break
|
||||
done
|
||||
[ "${netroot%%:*}" = "iscsi" ] || unset netroot
|
||||
if [ "${nroot%%:*}" = "iscsi" ]; then
|
||||
netroot="$nroot"
|
||||
else
|
||||
for nroot in $(getargs netroot=); do
|
||||
[ "${nroot%%:*}" = "dhcp" ] && break
|
||||
done
|
||||
netroot="$nroot"
|
||||
fi
|
||||
fi
|
||||
[ -z "$iscsiroot" ] && iscsiroot=$(getarg iscsiroot=)
|
||||
[ -z "$iscsi_firmware" ] && getargbool 0 rd.iscsi.firmware -y iscsi_firmware && iscsi_firmware="1"
|
||||
@@ -42,7 +49,11 @@ if [ "${root%%:*}" = "iscsi" ] ; then
|
||||
fi
|
||||
|
||||
# If it's not empty or iscsi we don't continue
|
||||
[ -z "$netroot" ] || [ "${netroot%%:*}" = "iscsi" ] || return
|
||||
for nroot in $(getargs netroot); do
|
||||
[ "${nroot%%:*}" = "iscsi" ] || continue
|
||||
netroot="$nroot"
|
||||
break
|
||||
done
|
||||
|
||||
if [ -n "$iscsiroot" ] ; then
|
||||
[ -z "$netroot" ] && netroot=$root
|
||||
@@ -60,40 +71,68 @@ if [ -n "$iscsiroot" ] ; then
|
||||
fi
|
||||
|
||||
# iscsi_firmware does not need argument checking
|
||||
if [ -n "$iscsi_firmware" ] ; then
|
||||
netroot=${netroot:-iscsi:}
|
||||
modprobe -q iscsi_boot_sysfs 2>/dev/null
|
||||
modprobe -q iscsi_ibft
|
||||
initqueue --onetime --timeout /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
|
||||
if [ -n "$iscsi_firmware" ]; then
|
||||
if [ "$root" != "dhcp" ] && [ "$netroot" != "dhcp" ]; then
|
||||
[ -z "$netroot" ] && netroot=iscsi:
|
||||
fi
|
||||
modprobe -b -q iscsi_boot_sysfs 2>/dev/null
|
||||
modprobe -b -q iscsi_ibft
|
||||
# if no ip= is given, but firmware
|
||||
echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh
|
||||
initqueue --unique --online /sbin/iscsiroot online "iscsi:" "$NEWROOT"
|
||||
initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "iscsi:" "$NEWROOT"
|
||||
initqueue --unique --onetime --settled /sbin/iscsiroot online "iscsi:" "'$NEWROOT'"
|
||||
fi
|
||||
|
||||
# If it's not iscsi we don't continue
|
||||
[ "${netroot%%:*}" = "iscsi" ] || return
|
||||
|
||||
modprobe -q qla4xxx
|
||||
modprobe -q cxgb3i
|
||||
modprobe -q cxgb4i
|
||||
modprobe -q bnx2i
|
||||
modprobe -q be2iscsi
|
||||
|
||||
if [ -z "$iscsi_firmware" ] ; then
|
||||
type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
parse_iscsi_root "$netroot" || return
|
||||
if [ -z "$netroot" ] || ! [ "${netroot%%:*}" = "iscsi" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT"
|
||||
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
|
||||
if ! getargbool 1 rd.neednet >/dev/null || ! getarg "ip="; then
|
||||
initqueue --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
|
||||
initqueue --unique --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
|
||||
fi
|
||||
fi
|
||||
|
||||
netroot_enc=$(str_replace "$netroot" '/' '\2f')
|
||||
echo "[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
|
||||
if arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) && [ -n "$arg" ] && ! [ -f /run/initiatorname.iscsi ] ; then
|
||||
iscsi_initiator=$arg
|
||||
echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
|
||||
ln -fs /run/initiatorname.iscsi /dev/.initiatorname.iscsi
|
||||
if ! [ -e /etc/iscsi/initiatorname.iscsi ]; then
|
||||
mkdir -p /etc/iscsi
|
||||
ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
|
||||
fi
|
||||
fi
|
||||
|
||||
# If not given on the cmdline and initiator-name available via iBFT
|
||||
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)
|
||||
if [ -n "$iscsi_initiator" ]; then
|
||||
echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
|
||||
rm -f /etc/iscsi/initiatorname.iscsi
|
||||
mkdir -p /etc/iscsi
|
||||
ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
|
||||
> /tmp/iscsi_set_initiator
|
||||
systemctl try-restart iscsid && sleep 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
for nroot in $(getargs netroot); do
|
||||
[ "${nroot%%:*}" = "iscsi" ] || continue
|
||||
type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
parse_iscsi_root "$nroot" || return 1
|
||||
netroot_enc=$(str_replace "$nroot" '/' '\2f')
|
||||
echo "[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
|
||||
done
|
||||
|
||||
# Done, all good!
|
||||
rootok=1
|
||||
|
@@ -4,8 +4,6 @@
|
||||
|
||||
check() {
|
||||
local _rootdev
|
||||
# If our prerequisites are not met, fail.
|
||||
type -P nbd-client >/dev/null || return 1
|
||||
|
||||
# if an nbd device is not somewhere in the chain of devices root is
|
||||
# mounted on, fail the hostonly check.
|
||||
@@ -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
|
||||
}
|
||||
|
@@ -4,11 +4,11 @@
|
||||
|
||||
check() {
|
||||
# If our prerequisites are not met, fail anyways.
|
||||
type -P rpcbind >/dev/null || type -P portmap >/dev/null || return 1
|
||||
type -P rpc.statd mount.nfs mount.nfs4 umount >/dev/null || return 1
|
||||
require_any_binary rpcbind portmap || return 1
|
||||
require_binaries rpc.statd mount.nfs mount.nfs4 umount || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in ${host_fs_types[@]}; do
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ "$fs" == "nfs" ]] && return 0
|
||||
[[ "$fs" == "nfs3" ]] && return 0
|
||||
[[ "$fs" == "nfs4" ]] && 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() {
|
||||
|
@@ -17,6 +17,7 @@ nfs_to_var() {
|
||||
# FIXME: local netif=${2:-$netif}?
|
||||
case "$1" in
|
||||
nfs://*) rfc2224_nfs_to_var "$1" ;;
|
||||
nfs:*[*) anaconda_nfsv6_to_var "$1" ;;
|
||||
nfs:*:*:/*) anaconda_nfs_to_var "$1" ;;
|
||||
*) nfsroot_to_var "$1" ;;
|
||||
esac
|
||||
@@ -86,6 +87,23 @@ anaconda_nfs_to_var() {
|
||||
path="/${1##*:/}"
|
||||
}
|
||||
|
||||
# IPv6 nfs path will be treated separately
|
||||
anaconda_nfsv6_to_var() {
|
||||
nfs="nfs"
|
||||
path="$1:"
|
||||
options="${path#*:/}"
|
||||
path="/${options%%:*}"
|
||||
server="${1#*nfs:}"
|
||||
if str_starts $server '['; then
|
||||
server="${server%:/*}"
|
||||
options="${options#*:*}"
|
||||
else
|
||||
server="${server%:/*}"
|
||||
options="${server%%:*}"
|
||||
server="${server#*:}"
|
||||
fi
|
||||
}
|
||||
|
||||
# nfsroot_from_dhcp NETIF
|
||||
# fill in missing server/path from DHCP options.
|
||||
nfsroot_from_dhcp() {
|
||||
|
@@ -40,7 +40,7 @@ if [ -n "$netroot" ] ; then
|
||||
[ "$n" = "$netroot" ] && break
|
||||
done
|
||||
if [ "$n" = "$netroot" ]; then
|
||||
warn "Ignoring netroot argument for NFS"
|
||||
#warn "Ignoring netroot argument for NFS"
|
||||
netroot=$root
|
||||
fi
|
||||
else
|
||||
@@ -59,7 +59,14 @@ fi
|
||||
|
||||
case "$netroot" in
|
||||
/dev/nfs) netroot=nfs;;
|
||||
/dev/*) unset netroot; return;;
|
||||
/dev/*)
|
||||
if [ -n "$oldnetroot" ]; then
|
||||
netroot="$oldnetroot"
|
||||
else
|
||||
unset netroot
|
||||
fi
|
||||
return
|
||||
;;
|
||||
# LEGACY: root=<server-ip>:/<path
|
||||
[0-9]*:/*|[0-9]*\.[0-9]*\.[0-9]*[!:]|/*)
|
||||
netroot=nfs:$netroot;;
|
||||
|
@@ -32,7 +32,7 @@ cmdline_journal() {
|
||||
|
||||
cmdline() {
|
||||
local dev=/dev/block/$(find_root_block_device)
|
||||
if [ -e $dev ]; then
|
||||
if [ -e $dev ] && [ -n "$root_dev" ] ; then
|
||||
printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")"
|
||||
printf " rootflags=%s" "$(find_mp_fsopts /)"
|
||||
printf " rootfstype=%s" "$(find_mp_fstype /)"
|
||||
|
@@ -5,11 +5,11 @@
|
||||
# fixme: assume user is root
|
||||
|
||||
check() {
|
||||
# If our prerequisites are not met, fail.
|
||||
type -P ssh >/dev/null || return 1
|
||||
type -P scp >/dev/null || return 1
|
||||
[[ $mount_needs ]] && return 1
|
||||
|
||||
# If our prerequisites are not met, fail.
|
||||
require_binaries ssh scp || return 1
|
||||
|
||||
if [[ $sshkey ]]; then
|
||||
[ ! -f $sshkey ] && {
|
||||
derror "ssh key: $sshkey is not found!"
|
||||
@@ -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
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
install() {
|
||||
local _i
|
||||
|
||||
# Fixme: would be nice if we didn't have to know which rules to grab....
|
||||
# Fixme: would be nice if we didn't have to guess, which rules to grab....
|
||||
# ultimately, /lib/initramfs/rules.d or somesuch which includes links/copies
|
||||
# of the rules we want so that we just copy those in would be best
|
||||
inst_multiple udevadm cat uname blkid \
|
||||
@@ -26,15 +26,27 @@ install() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
inst_rules 50-udev-default.rules 60-persistent-storage.rules \
|
||||
61-persistent-storage-edd.rules 80-drivers.rules 95-udev-late.rules \
|
||||
60-pcmcia.rules \
|
||||
50-udev.rules 95-late.rules \
|
||||
inst_rules \
|
||||
40-redhat-cpu-hotplug.rules \
|
||||
40-redhat.rules \
|
||||
50-firmware.rules \
|
||||
70-uaccess.rules 71-seat.rules 73-seat-late.rules \
|
||||
75-net-description.rules 80-net-name-slot.rules \
|
||||
50-udev-default.rules \
|
||||
50-udev.rules \
|
||||
"$moddir/59-persistent-storage.rules" \
|
||||
"$moddir/61-persistent-storage.rules"
|
||||
/59-persistent-storage.rules \
|
||||
60-pcmcia.rules \
|
||||
60-persistent-storage.rules \
|
||||
61-persistent-storage-edd.rules \
|
||||
"$moddir/61-persistent-storage.rules" \
|
||||
70-uaccess.rules \
|
||||
71-seat.rules \
|
||||
73-seat-late.rules \
|
||||
75-net-description.rules \
|
||||
80-drivers.rules \
|
||||
80-net-name-slot.rules \
|
||||
95-late.rules \
|
||||
95-udev-late.rules \
|
||||
${NULL}
|
||||
|
||||
prepare_udev_rules 59-persistent-storage.rules 61-persistent-storage.rules
|
||||
# debian udev rules
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
check() {
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in ${host_fs_types[@]}; do
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ "$fs" == "9p" ]] && return 0
|
||||
done
|
||||
return 255
|
||||
@@ -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
|
@@ -6,6 +6,8 @@ check() {
|
||||
arch=$(uname -m)
|
||||
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
|
||||
|
||||
require_binaries zfcp_cio_free grep sed seq || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@@ -6,6 +6,8 @@ check() {
|
||||
arch=$(uname -m)
|
||||
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
|
||||
|
||||
require_binaries znet_cio_free grep sed seq readlink || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
type -P biosdevname >/dev/null || return 1
|
||||
require_binaries biosdevname || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
check() {
|
||||
[[ $hostonly ]] && {
|
||||
[ -x "/bin/keyctl" ] || return 1
|
||||
require_binaries keyctl uname || return 1
|
||||
}
|
||||
|
||||
return 255
|
||||
|
@@ -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
|
||||
|
@@ -15,15 +15,19 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
[ -f /etc/initrd-release ] && . /etc/initrd-release
|
||||
[ -n "$VERSION" ] && info "dracut-$VERSION"
|
||||
|
||||
info "Using kernel command line parameters:"
|
||||
getcmdline | vinfo
|
||||
info "Using kernel command line parameters:" $(getcmdline)
|
||||
|
||||
getargbool 0 rd.udev.log-priority=info -d rd.udev.info -d -n -y rdudevinfo && echo 'udev_log="info"' >> /etc/udev/udev.conf
|
||||
getargbool 0 rd.udev.log-priority=debug -d rd.udev.debug -d -n -y rdudevdebug && echo 'udev_log="debug"' >> /etc/udev/udev.conf
|
||||
|
||||
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"
|
||||
@@ -39,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')"
|
||||
@@ -67,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
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user