Compare commits
362 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
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 | ||
![]() |
3f7d943141 | ||
![]() |
f2558ddcc1 | ||
![]() |
b9372137fd | ||
![]() |
4f992675ae | ||
![]() |
6914b67545 | ||
![]() |
4c88c2859e | ||
![]() |
c984ddda6a | ||
![]() |
368f08cb7e | ||
![]() |
7bbee6ac49 | ||
![]() |
0b7fad2837 | ||
![]() |
b96ce4a6fd | ||
![]() |
509a3b2c33 | ||
![]() |
20700e3dea | ||
![]() |
8964abbd40 | ||
![]() |
eeb68f0a16 | ||
![]() |
c4c24171bf | ||
![]() |
0630273048 | ||
![]() |
aa5313ca0e | ||
![]() |
815ab93fe9 | ||
![]() |
c5c57f3f19 | ||
![]() |
b44b3ed036 | ||
![]() |
49a23aa426 | ||
![]() |
efaa5b05df | ||
![]() |
4fa660ba8f | ||
![]() |
19bb8937ed | ||
![]() |
17c1f640fa | ||
![]() |
e03b09212a | ||
![]() |
f86fa29cda | ||
![]() |
f2c5c5c961 | ||
![]() |
81a6e87f0f | ||
![]() |
52923f5f2a | ||
![]() |
c46be83492 | ||
![]() |
c2ce987e38 | ||
![]() |
564c0c4577 | ||
![]() |
5648ff27e2 | ||
![]() |
8715aa00a9 | ||
![]() |
828fd83bc1 | ||
![]() |
4de30f02c8 | ||
![]() |
1e03d8eb64 | ||
![]() |
2a1bdab6e8 | ||
![]() |
c504204de5 | ||
![]() |
e502fd3099 | ||
![]() |
1e9926c12d | ||
![]() |
7b8f2e7a7b | ||
![]() |
8bf70609de | ||
![]() |
bb232c88fa | ||
![]() |
0c81abbe79 | ||
![]() |
17e74416c8 | ||
![]() |
932169bc34 | ||
![]() |
b201a3f405 | ||
![]() |
ef6665ec41 | ||
![]() |
9c2daa5d3a | ||
![]() |
f679f53b2a | ||
![]() |
6a9d47ce27 | ||
![]() |
49fe9bc014 | ||
![]() |
491dbfe072 | ||
![]() |
8c1807bc97 | ||
![]() |
7cab5fbf59 | ||
![]() |
6db59a1630 | ||
![]() |
98b104e887 | ||
![]() |
b66bfd5b98 | ||
![]() |
962bb11663 | ||
![]() |
5f5c07eca2 | ||
![]() |
9c45cb9c11 | ||
![]() |
2fed6038bb | ||
![]() |
e23057d537 | ||
![]() |
40a5d2c029 | ||
![]() |
e92a7a2532 | ||
![]() |
1175816c30 | ||
![]() |
2a20064e44 | ||
![]() |
ec158d758b | ||
![]() |
705c84321d | ||
![]() |
d38488e8d5 | ||
![]() |
a2a9a17cc6 | ||
![]() |
e5f6899a55 | ||
![]() |
0506080aee | ||
![]() |
b990775b6f | ||
![]() |
251d5b65e3 | ||
![]() |
915618bc4f | ||
![]() |
f077a20056 | ||
![]() |
e1021bd2c1 | ||
![]() |
f1ea5376ed | ||
![]() |
4b07c26d33 | ||
![]() |
07c4a2fce5 | ||
![]() |
4c2d48d5c4 | ||
![]() |
db1b5a38e9 | ||
![]() |
69acbc4735 | ||
![]() |
7031115695 | ||
![]() |
42896820ba | ||
![]() |
bdb6683d6f | ||
![]() |
c2196a25b7 | ||
![]() |
9d75fd3b62 | ||
![]() |
89f2586ae9 | ||
![]() |
af1154fdce | ||
![]() |
84c66ac857 | ||
![]() |
711030d61d | ||
![]() |
e2e32cd02f | ||
![]() |
dccf47fd55 | ||
![]() |
e96c010011 | ||
![]() |
8482be832c | ||
![]() |
d52c4a761a | ||
![]() |
61bad12d44 | ||
![]() |
853897808a | ||
![]() |
30e2074447 | ||
![]() |
54c9094e2e | ||
![]() |
61fe003168 | ||
![]() |
ea6bc75ccb | ||
![]() |
5a3b267d06 | ||
![]() |
c2c437edba | ||
![]() |
81c9e22482 | ||
![]() |
da41507de9 | ||
![]() |
a367bed836 | ||
![]() |
6381b94459 | ||
![]() |
346fab9500 | ||
![]() |
84dfea4d2a | ||
![]() |
64c88c2f1d | ||
![]() |
9bbea8caf8 | ||
![]() |
361eaeaf07 | ||
![]() |
99ed45c218 | ||
![]() |
80f75fed99 | ||
![]() |
37a09c9cb6 | ||
![]() |
054447fa23 | ||
![]() |
0c0ca2d9bc | ||
![]() |
226004e007 | ||
![]() |
dc662386dc | ||
![]() |
36d3274050 | ||
![]() |
d802e985ae | ||
![]() |
3bb36e4512 | ||
![]() |
c26eb3eb3a | ||
![]() |
8bde20bc65 | ||
![]() |
c127eb8021 | ||
![]() |
5676a6d877 | ||
![]() |
3d47b5124c | ||
![]() |
b397bb7c19 | ||
![]() |
b4b60da8dc | ||
![]() |
c6fe81559e | ||
![]() |
286fbebdaf | ||
![]() |
27acb483e8 | ||
![]() |
657e832da0 | ||
![]() |
40cf35ef4e | ||
![]() |
f812e271cb | ||
![]() |
2f117f4db3 | ||
![]() |
37a18fda11 | ||
![]() |
ade113d75b | ||
![]() |
815b9c16a4 | ||
![]() |
eb7c58eced | ||
![]() |
a3dc6a7218 | ||
![]() |
87862728da | ||
![]() |
0d4bb7ce89 | ||
![]() |
b1cdf7c5d4 | ||
![]() |
a0b85db18e | ||
![]() |
dfaeee7341 | ||
![]() |
74c9df58f2 | ||
![]() |
3c4e663251 | ||
![]() |
56a5975f91 | ||
![]() |
6c7c8d8a07 | ||
![]() |
d110129695 | ||
![]() |
0ab5e8adc8 | ||
![]() |
9d47a90b12 | ||
![]() |
779f980658 | ||
![]() |
9bdbbe90ef | ||
![]() |
5183c9a588 | ||
![]() |
834f33440f | ||
![]() |
254f437848 | ||
![]() |
aa6ab27471 | ||
![]() |
cb97abc7bb | ||
![]() |
d1e9a5e384 | ||
![]() |
81564fcefc | ||
![]() |
82286609c9 | ||
![]() |
ea9b961e8c | ||
![]() |
7faae1264d | ||
![]() |
866e663fbd | ||
![]() |
9a177f8d51 | ||
![]() |
04220f9aff | ||
![]() |
db110a036a | ||
![]() |
937456c65b | ||
![]() |
998f4bb720 | ||
![]() |
a34d3dcaa8 | ||
![]() |
793beab60c | ||
![]() |
be10aecb17 | ||
![]() |
a1e9e9364a | ||
![]() |
53b20afabb | ||
![]() |
5a36d29f8a | ||
![]() |
8d7bd6af19 | ||
![]() |
d014032c62 | ||
![]() |
90441c4476 | ||
![]() |
dac45f997e | ||
![]() |
ff3d291a68 | ||
![]() |
411d2aedd6 | ||
![]() |
7f61e2c895 | ||
![]() |
32c431bb48 | ||
![]() |
7aa989a4fd | ||
![]() |
34397fe702 | ||
![]() |
243b8e14a2 | ||
![]() |
fb67162559 | ||
![]() |
15962471fe | ||
![]() |
e590f5beec | ||
![]() |
05b79aaa9d | ||
![]() |
1dd604efb1 | ||
![]() |
52592ce022 | ||
![]() |
03bf7758aa | ||
![]() |
20ff2d37cc | ||
![]() |
65ba6c44d8 | ||
![]() |
c35826c0e7 | ||
![]() |
ccad388c25 | ||
![]() |
eb27e4cc31 | ||
![]() |
ee916b72cc | ||
![]() |
352a49a21d | ||
![]() |
8eee542b40 | ||
![]() |
37e899aad1 | ||
![]() |
88fc0b8750 | ||
![]() |
9bd3573ddb | ||
![]() |
123feea1fa | ||
![]() |
8e3620568c | ||
![]() |
1a21ed8d1d | ||
![]() |
84fe197fac | ||
![]() |
86fff83927 | ||
![]() |
f0df0f3fcd | ||
![]() |
52d3c1b726 | ||
![]() |
6ea78f9f4e | ||
![]() |
4584826e9a | ||
![]() |
1b827040f8 | ||
![]() |
4fde4d0647 | ||
![]() |
fdaa69db20 | ||
![]() |
31b89c8c2b | ||
![]() |
a5659901e8 | ||
![]() |
32b970339f | ||
![]() |
d87da4c777 | ||
![]() |
cf9f56be9c | ||
![]() |
eaa4d30d5a | ||
![]() |
54011e3591 | ||
![]() |
ebc7f823c0 | ||
![]() |
ff33b57676 | ||
![]() |
4b1aa19fa0 | ||
![]() |
764b520994 | ||
![]() |
96f48da50c | ||
![]() |
72ce014bc7 | ||
![]() |
af34b26047 | ||
![]() |
da63c0de56 | ||
![]() |
ffecc45232 |
2
.dir-locals.el
Normal file
2
.dir-locals.el
Normal file
@@ -0,0 +1,2 @@
|
||||
(setq sh-basic-offset: 4)
|
||||
(setq indent-tabs-mode nil)
|
1
.kateconfig
Normal file
1
.kateconfig
Normal file
@@ -0,0 +1 @@
|
||||
kate: space-indent on; tab-width 4; indent-width 4; replace-tabs on; eol unix;
|
9
.kateproject
Normal file
9
.kateproject
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "Kate"
|
||||
, "files": [ { "git": 1 } ]
|
||||
, "build": {
|
||||
"directory": "build"
|
||||
, "build": "make -j $(getconf _NPROCESSORS_ONLN) all"
|
||||
, "clean": "make clean"
|
||||
}
|
||||
}
|
8
AUTHORS
8
AUTHORS
@@ -14,10 +14,9 @@ Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Peter Jones <pjones@redhat.com>
|
||||
Andreas Thienemann <andreas@bawue.net>
|
||||
Hans de Goede <hdegoede@redhat.com>
|
||||
WANG Chao <chaowang@redhat.com>
|
||||
John Reiser <jreiser@bitwagon.com>
|
||||
Luca Berra <bluca@vodka.it>
|
||||
Thomas Renninger <trenn@suse.de>
|
||||
WANG Chao <chaowang@redhat.com>
|
||||
Daniel Drake <dsd@laptop.org>
|
||||
Dan Horák <dhorak@redhat.com>
|
||||
Baoquan He <bhe@redhat.com>
|
||||
@@ -26,15 +25,14 @@ Brian C. Lane <bcl@redhat.com>
|
||||
Kamil Rytarowski <n54@gmx.com>
|
||||
Marc Grimme <grimme@atix.de>
|
||||
Chao Wang <chaowang@redhat.com>
|
||||
Colin Walters <walters@verbum.org>
|
||||
Frederic Crozat <fcrozat@suse.com>
|
||||
Jesse Keating <jkeating@redhat.com>
|
||||
Milan Broz <mbroz@redhat.com>
|
||||
Peter Rajnoha <prajnoha@redhat.com>
|
||||
Radek Vykydal <rvykydal@redhat.com>
|
||||
Roberto Sassu <roberto.sassu@polito.it>
|
||||
Anton Blanchard <anton@samba.org>
|
||||
Bill Nottingham <notting@redhat.com>
|
||||
Colin Walters <walters@verbum.org>
|
||||
David Cantrell <dcantrell@redhat.com>
|
||||
Dennis Gilmore <dennis@ausil.us>
|
||||
Jon Ander Hernandez <jonan.h@gmail.com>
|
||||
@@ -42,10 +40,10 @@ Juan RP <xtraeme@gmail.com>
|
||||
Lance Albertson <lance@osuosl.org>
|
||||
Marian Ganisin <mganisin@redhat.com>
|
||||
Michael Ploujnikov <plouj@somanetworks.com>
|
||||
Peter Rajnoha <prajnoha@redhat.com>
|
||||
Wim Muskee <wimmuskee@gmail.com>
|
||||
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
||||
Alan Pevec <apevec@redhat.com>
|
||||
Alexander Tsoy <alexander@tsoy.me>
|
||||
Frederick Grose <fgrose@sugarlabs.org>
|
||||
Ian Dall <ian@beware.dropbear.id.au>
|
||||
James Buren <ryuo@frugalware.org>
|
||||
|
24
Makefile
24
Makefile
@@ -27,7 +27,6 @@ man7pages = dracut.cmdline.7 \
|
||||
man8pages = dracut.8 \
|
||||
dracut-catimages.8 \
|
||||
mkinitrd.8 \
|
||||
mkinitrd-suse.8 \
|
||||
modules.d/98systemd/dracut-cmdline.service.8 \
|
||||
modules.d/98systemd/dracut-initqueue.service.8 \
|
||||
modules.d/98systemd/dracut-mount.service.8 \
|
||||
@@ -47,7 +46,6 @@ DRACUT_INSTALL_OBJECTS = \
|
||||
install/dracut-install.o \
|
||||
install/hashmap.o\
|
||||
install/log.o \
|
||||
install/strv.o \
|
||||
install/util.o
|
||||
|
||||
# deps generated with gcc -MM
|
||||
@@ -57,7 +55,6 @@ install/hashmap.o: install/hashmap.c install/util.h install/macro.h install/log.
|
||||
install/hashmap.h
|
||||
install/log.o: install/log.c install/log.h install/macro.h install/util.h
|
||||
install/util.o: install/util.c install/util.h install/macro.h install/log.h
|
||||
install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h install/log.h
|
||||
|
||||
install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
|
||||
|
||||
@@ -109,6 +106,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
|
||||
@@ -165,28 +163,28 @@ clean:
|
||||
$(RM) */*/*~
|
||||
$(RM) $(manpages:%=%.xml) dracut.xml
|
||||
$(RM) test-*.img
|
||||
$(RM) dracut-*.rpm dracut-*.tar.bz2 dracut-*.tar.xz
|
||||
$(RM) dracut-*.rpm dracut-*.tar.bz2
|
||||
$(RM) dracut-version.sh
|
||||
$(RM) dracut-install install/dracut-install $(DRACUT_INSTALL_OBJECTS)
|
||||
$(RM) skipcpio/skipcpio $(SKIPCPIO_OBJECTS)
|
||||
$(RM) $(manpages) dracut.html
|
||||
$(MAKE) -C test clean
|
||||
|
||||
dist: dracut-$(VERSION).tar.xz
|
||||
dist: dracut-$(VERSION).tar.bz2
|
||||
|
||||
dracut-$(VERSION).tar.xz: doc syncheck
|
||||
dracut-$(VERSION).tar.bz2: doc syncheck
|
||||
@echo "DRACUT_VERSION=$(VERSION)" > dracut-version.sh
|
||||
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ > dracut-$(VERSION).tar
|
||||
mkdir -p dracut-$(VERSION)
|
||||
for i in $(manpages) dracut.html dracut-version.sh; do [ "$${i%/*}" != "$$i" ] && mkdir -p "dracut-$(VERSION)/$${i%/*}"; cp "$$i" "dracut-$(VERSION)/$$i"; done
|
||||
tar --owner=root --group=root -rf dracut-$(VERSION).tar $$(find dracut-$(VERSION) -type f)
|
||||
rm -fr -- dracut-$(VERSION).tar.xz dracut-$(VERSION)
|
||||
xz -9 dracut-$(VERSION).tar
|
||||
rm -fr -- dracut-$(VERSION).tar.bz2 dracut-$(VERSION)
|
||||
bzip2 -9 dracut-$(VERSION).tar
|
||||
rm -f -- dracut-$(VERSION).tar
|
||||
|
||||
rpm: dracut-$(VERSION).tar.xz syncheck
|
||||
rpm: dracut-$(VERSION).tar.bz2 syncheck
|
||||
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
|
||||
cp dracut-$(VERSION).tar.xz "$$rpmbuild"; \
|
||||
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" \
|
||||
@@ -226,9 +224,9 @@ hostimage: all
|
||||
AUTHORS:
|
||||
git shortlog --numbered --summary -e |while read a rest; do echo $$rest;done > AUTHORS
|
||||
|
||||
dracut.html.sign: dracut-$(VERSION).tar.xz dracut.html
|
||||
gpg-sign-all dracut-$(VERSION).tar.xz dracut.html
|
||||
dracut.html.sign: dracut-$(VERSION).tar.bz2
|
||||
gpg-sign-all dracut-$(VERSION).tar.bz2 dracut.html
|
||||
|
||||
upload: dracut.html.sign
|
||||
kup put dracut-$(VERSION).tar.xz dracut-$(VERSION).tar.sign /pub/linux/utils/boot/dracut/
|
||||
kup put dracut-$(VERSION).tar.bz2 dracut-$(VERSION).tar.sign /pub/linux/utils/boot/dracut/
|
||||
kup put dracut.html dracut.html.sign /pub/linux/utils/boot/dracut/
|
||||
|
58
NEWS
58
NEWS
@@ -1,55 +1,3 @@
|
||||
dracut-035
|
||||
==========
|
||||
- changed dracut tarball compression to xz
|
||||
- new argument "--rebuild"
|
||||
- add lzo, lz4 compression
|
||||
- install: install all binaries with <name> found in PATH
|
||||
- lsinitrd can now handle initramfs images with an early cpio prepended
|
||||
(microcode, ACPI tables)
|
||||
- mkinitrd-suse added as a compat stub for dracut
|
||||
- lvm: install thin utils for non-hostonly
|
||||
- resume: fix swap detection in hostonly
|
||||
- avoid loading unnecessary 32-bit libraries for 64-bit initrds
|
||||
- crypt: wait for systemd password agents
|
||||
- crypt: skip crypt swaps with password files
|
||||
- network: before doing dhcp, dracut now checks, if the link has a carrier
|
||||
- network: dhclient-script.sh now sets the lease time
|
||||
- network: include usbnet drivers
|
||||
- network: include all ethernet drivers
|
||||
- network: add rd.bootif=0 to ignore BOOTIF
|
||||
- i18n: introduce i18n_install_all, to install everything i18n related
|
||||
- support SuSE DASD configurations
|
||||
- support SuSE zfcp configurations
|
||||
- support SuSE compressed KEYMAP= setting
|
||||
- usrmount: always install the module,
|
||||
so always mount /usr from within the initramfs
|
||||
- test/TEST-17-LVM-THIN: new test case for lvm thin pools
|
||||
- "halt" the machine in systemd mode for die()
|
||||
|
||||
dracut-034
|
||||
==========
|
||||
- do not run dhcp on parts of assembled network interfaces (bond, bridge)
|
||||
- add option to turn on/off prelinking
|
||||
--prelink, --noprelink
|
||||
do_prelink=[yes|no]
|
||||
- add ACPI table overriding
|
||||
- do not log to syslog/kmsg/journal for UID != 0
|
||||
- lvm/mdraid: Fix LVM on MD activation
|
||||
- bcache module removed (now in bcache-tools upstream)
|
||||
- mdadm: also install configs from /etc/mdadm.conf.d
|
||||
- fixes for mdadm-3.2.6+
|
||||
- mkinitrd: better compat support for SUSE
|
||||
- fcoe: add FCoE UEFI boot device support
|
||||
- rootfs-block: add support for the rootfallback= kernel cmdline option
|
||||
|
||||
Contributions from:
|
||||
Thomas Renninger
|
||||
Alexander Tsoy
|
||||
Peter Rajnoha
|
||||
WANG Chao
|
||||
Harald Hoyer
|
||||
|
||||
|
||||
dracut-033
|
||||
==========
|
||||
- improved hostonly device recognition
|
||||
@@ -68,12 +16,6 @@ dracut-033
|
||||
- fixed ifup udev rules
|
||||
- ifup with dhcp, if no "ip=" specified for the interface
|
||||
|
||||
Contributions from:
|
||||
WANG Chao
|
||||
Colin Walters
|
||||
Harald Hoyer
|
||||
|
||||
|
||||
dracut-032
|
||||
==========
|
||||
- add parameter --print-cmdline
|
||||
|
@@ -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:
|
||||
|
5
TODO
5
TODO
@@ -6,10 +6,6 @@ Items are ordered in priority.
|
||||
|
||||
INITRAMFS TODO
|
||||
|
||||
- allow dual stack configuration (IPv4, IPv6) for the same interface
|
||||
- "bind-mount" kernel drivers in real root for the rescue image,
|
||||
if the real root does not have any kernel modules for this kernel
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1046510
|
||||
- use info and warn prefix
|
||||
- generate systemd unit dracut-initramfs-restore in /run/systemd dynamically
|
||||
- put "root=" parsing hooks in separate hook dir
|
||||
@@ -26,7 +22,6 @@ INITRAMFS TODO
|
||||
|
||||
GENERATOR TODO
|
||||
|
||||
- report errors on missing files in check()
|
||||
- remove wait for swap devs, if no "resume=" is given on the kernel command line
|
||||
- add presets (predefined set of modules)
|
||||
- add interpreter/plugin-scripts to be sourced at the beginning or end (can use dracut-functions)
|
||||
|
@@ -22,19 +22,59 @@
|
||||
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* ]]; }
|
||||
|
||||
# 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.
|
||||
find_binary() {
|
||||
@@ -57,18 +97,7 @@ fi
|
||||
|
||||
ldconfig_paths()
|
||||
{
|
||||
local a i
|
||||
declare -A a
|
||||
for i in $(
|
||||
ldconfig -pN 2>/dev/null | while read a b c d; do
|
||||
[[ "$c" != "=>" ]] && continue
|
||||
printf "%s\n" ${d%/*};
|
||||
done
|
||||
); do
|
||||
[[ "$i" = "/lib" || "$i" = "/usr/lib" || "$i" = "/lib64" || "$i" = "/usr/lib64" ]] && continue
|
||||
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
|
||||
@@ -130,7 +159,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
|
||||
@@ -163,12 +198,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() {
|
||||
@@ -176,7 +205,7 @@ print_vars() {
|
||||
|
||||
for _var in "$@"
|
||||
do
|
||||
eval printf -v _value "%s" "\$$_var"
|
||||
eval printf -v _value "%s" \""\$$_var"\"
|
||||
[[ ${_value} ]] && printf '%s="%s"\n' "$_var" "$_value"
|
||||
done
|
||||
}
|
||||
@@ -899,34 +928,6 @@ inst_rules() {
|
||||
done
|
||||
}
|
||||
|
||||
inst_rules_wildcard() {
|
||||
local _target=/etc/udev/rules.d _rule _found
|
||||
|
||||
inst_dir "${udevdir}/rules.d"
|
||||
inst_dir "$_target"
|
||||
for _rule in ${udevdir}/rules.d/$1 ${dracutbasedir}/rules.d/$1 ; do
|
||||
if [[ -e $_rule ]]; then
|
||||
inst_rule_programs "$_rule"
|
||||
inst_rule_group_owner "$_rule"
|
||||
inst_rule_initqueue "$_rule"
|
||||
inst_simple "$_rule"
|
||||
_found=$_rule
|
||||
fi
|
||||
done
|
||||
if [ -n ${hostonly} ] ; then
|
||||
for _rule in ${_target}/$1 ; do
|
||||
if [[ -f $_rule ]]; then
|
||||
inst_rule_programs "$_rule"
|
||||
inst_rule_group_owner "$_rule"
|
||||
inst_rule_initqueue "$_rule"
|
||||
inst_simple "$_rule"
|
||||
_found=$_rule
|
||||
fi
|
||||
done
|
||||
fi
|
||||
[[ $_found ]] || dinfo "Skipping udev rule: $_rule"
|
||||
}
|
||||
|
||||
prepare_udev_rules() {
|
||||
[ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version)
|
||||
|
||||
@@ -1084,7 +1085,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
|
||||
@@ -1110,7 +1111,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
|
||||
@@ -1134,7 +1135,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
|
||||
@@ -1155,7 +1156,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
|
||||
@@ -1176,7 +1177,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
|
||||
@@ -1197,7 +1198,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
|
||||
@@ -1244,13 +1245,17 @@ check_mount() {
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
for _moddep in $(module_depends $_mod); do
|
||||
# handle deps as if they were manually added
|
||||
[[ " $add_dracutmodules " == *\ $_moddep\ * ]] || \
|
||||
add_dracutmodules+=" $_moddep "
|
||||
[[ " $force_add_dracutmodules " == *\ $_moddep\ * ]] || \
|
||||
force_add_dracutmodules+=" $_moddep "
|
||||
[[ " $dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $dracutmodules " != *\ $_moddep\ * ]] \
|
||||
&& dracutmodules+=" $_moddep "
|
||||
[[ " $add_dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $add_dracutmodules " != *\ $_moddep\ * ]] \
|
||||
&& add_dracutmodules+=" $_moddep "
|
||||
[[ " $force_add_dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $force_add_dracutmodules " != *\ $_moddep\ * ]] \
|
||||
&& force_add_dracutmodules+=" $_moddep "
|
||||
# if a module we depend on fail, fail also
|
||||
if ! check_module $_moddep; then
|
||||
derror "dracut module '$_mod' depends on '$_moddep', which can't be installed"
|
||||
@@ -1288,7 +1293,7 @@ check_module() {
|
||||
fi
|
||||
|
||||
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
|
||||
if [[ " $force_add_dracutmodules " == *\ $_mod\ * ]]; then
|
||||
if [[ " $dracutmodules $force_add_dracutmodules " == *\ $_mod\ * ]]; then
|
||||
module_check $_mod 1; ret=$?
|
||||
else
|
||||
module_check $_mod 0; ret=$?
|
||||
@@ -1299,7 +1304,11 @@ check_module() {
|
||||
# module not in our list
|
||||
if [[ $dracutmodules = all ]]; then
|
||||
# check, if we can and should install this module
|
||||
module_check $_mod || return 1
|
||||
module_check $_mod; ret=$?
|
||||
if [[ $ret != 0 ]]; then
|
||||
[[ $2 ]] && return 1
|
||||
[[ $ret != 255 ]] && return 1
|
||||
fi
|
||||
else
|
||||
# skip this module
|
||||
return 1
|
||||
@@ -1308,10 +1317,15 @@ check_module() {
|
||||
|
||||
for _moddep in $(module_depends $_mod); do
|
||||
# handle deps as if they were manually added
|
||||
[[ " $add_dracutmodules " == *\ $_moddep\ * ]] || \
|
||||
add_dracutmodules+=" $_moddep "
|
||||
[[ " $force_add_dracutmodules " == *\ $_moddep\ * ]] || \
|
||||
force_add_dracutmodules+=" $_moddep "
|
||||
[[ " $dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $dracutmodules " != *\ $_moddep\ * ]] \
|
||||
&& dracutmodules+=" $_moddep "
|
||||
[[ " $add_dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $add_dracutmodules " != *\ $_moddep\ * ]] \
|
||||
&& add_dracutmodules+=" $_moddep "
|
||||
[[ " $force_add_dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $force_add_dracutmodules " != *\ $_moddep\ * ]] \
|
||||
&& force_add_dracutmodules+=" $_moddep "
|
||||
# if a module we depend on fail, fail also
|
||||
if ! check_module $_moddep; then
|
||||
derror "dracut module '$_mod' depends on '$_moddep', which can't be installed"
|
||||
@@ -1343,11 +1357,19 @@ for_each_module_dir() {
|
||||
|
||||
# Report any missing dracut modules, the user has specified
|
||||
_modcheck="$add_dracutmodules $force_add_dracutmodules"
|
||||
[[ $dracutmodules != all ]] && _modcheck="$m $dracutmodules"
|
||||
[[ $dracutmodules != all ]] && _modcheck="$_modcheck $dracutmodules"
|
||||
for _mod in $_modcheck; do
|
||||
[[ " $mods_to_load " == *\ $_mod\ * ]] && continue
|
||||
[[ " $omit_dracutmodules " == *\ $_mod\ * ]] && continue
|
||||
|
||||
[[ " $force_add_dracutmodules " != *\ $_mod\ * ]] \
|
||||
&& [[ " $dracutmodules " != *\ $_mod\ * ]] \
|
||||
&& [[ " $omit_dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& continue
|
||||
|
||||
derror "dracut module '$_mod' cannot be found or installed."
|
||||
[[ " $force_add_dracutmodules " == *\ $_mod\ * ]] && exit 1
|
||||
[[ " $dracutmodules " == *\ $_mod\ * ]] && exit 1
|
||||
[[ " $add_dracutmodules " == *\ $_mod\ * ]] && exit 1
|
||||
done
|
||||
}
|
||||
|
||||
@@ -1551,7 +1573,7 @@ find_kernel_modules_by_path () {
|
||||
_OLDIFS=$IFS
|
||||
IFS=:
|
||||
while read a rest; do
|
||||
[[ $a = */$1/* ]] || continue
|
||||
[[ $a = */$1/* ]] || [[ $a = updates/* ]] || [[ $a = extra/* ]] || [[ $a = weak-updates/* ]] ||continue
|
||||
printf "%s\n" "$srcmods/$a"
|
||||
done < "$srcmods/modules.dep"
|
||||
IFS=$_OLDIFS
|
||||
|
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
|
@@ -6,6 +6,10 @@ set -e
|
||||
|
||||
KERNEL_VERSION="$(uname -r)"
|
||||
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
SKIP="$dracutbasedir/skipcpio"
|
||||
[[ -x $SKIP ]] || SKIP=cat
|
||||
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
|
||||
@@ -16,11 +20,11 @@ fi
|
||||
cd /run/initramfs
|
||||
|
||||
[ -f .need_shutdown -a -f "$IMG" ] || exit 1
|
||||
if zcat "$IMG" | cpio -id --quiet >/dev/null; then
|
||||
if $SKIP "$IMG" | zcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
|
||||
rm -f -- .need_shutdown
|
||||
elif xzcat "$IMG" | cpio -id --quiet >/dev/null; then
|
||||
elif $SKIP "$IMG" | xzcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
|
||||
rm -f -- .need_shutdown
|
||||
elif lz4 -d -c "$IMG" | cpio -id --quiet >/dev/null; then
|
||||
elif $SKIP "$IMG" | lz4 -d -c | cpio -id --no-absolute-filenames --quiet >/dev/null; then
|
||||
rm -f -- .need_shutdown
|
||||
else
|
||||
# something failed, so we clean up
|
||||
|
@@ -367,7 +367,7 @@ dlog() {
|
||||
if (( $# > 1 )); then
|
||||
_do_dlog "$@"
|
||||
else
|
||||
while read line; do
|
||||
while read line || [ -n "$line" ]; do
|
||||
_do_dlog "$1" "$line"
|
||||
done
|
||||
fi
|
||||
|
16
dracut.8.asc
16
dracut.8.asc
@@ -300,6 +300,12 @@ provide a valid _/etc/fstab_.
|
||||
**-N, --no-hostonly**::
|
||||
Disable Host-Only mode
|
||||
|
||||
**--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
|
||||
|
||||
**--persistent-policy** _<policy>_::
|
||||
Use _<policy>_ to address disks and partitions.
|
||||
_<policy>_ can be any directory name found in /dev/disk.
|
||||
@@ -311,9 +317,13 @@ provide a valid _/etc/fstab_.
|
||||
**--add-fstab** _<filename>_::
|
||||
Add entries of _<filename>_ to the initramfs /etc/fstab.
|
||||
|
||||
**--mount** "_<device>_ _<mountpoint>_ _<filesystem type>_ _<filesystem options>_"::
|
||||
Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ and _<filesystem
|
||||
options>_ in the initramfs
|
||||
**--mount** "_<device>_ _<mountpoint>_ _<filesystem type>_ [_<filesystem options>_ [_<dump frequency>_ [_<fsck order>_]]]"::
|
||||
Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ in the
|
||||
initramfs. _<filesystem options>_, _<dump options>_ and _<fsck order>_ can
|
||||
be specified, see fstab manpage for the details.
|
||||
The default _<filesystem options>_ is "defaults".
|
||||
The default _<dump frequency>_ is "0".
|
||||
the default _<fsck order>_ is "2".
|
||||
|
||||
**--add-device** _<device>_ ::
|
||||
Bring up _<device>_ in initramfs, _<device>_ should be the device name.
|
||||
|
@@ -81,6 +81,10 @@ rootfstype=ext3
|
||||
enable autoassembly of special devices like cryptoLUKS, dmraid, mdraid or
|
||||
lvm. Default is off as of dracut version >= 024.
|
||||
|
||||
|
||||
**rd.cmdline=ask**::
|
||||
prompts the user for additional kernel command line parameters
|
||||
|
||||
**rd.fstab=0**::
|
||||
do not honor special mount options for the root filesystem found in
|
||||
_/etc/fstab_ of the real root.
|
||||
@@ -437,7 +441,7 @@ USB Android phone::
|
||||
* enp0s29u1u2
|
||||
=====================
|
||||
|
||||
**ip=**__{dhcp|on|any|dhcp6|auto6|ibft}__::
|
||||
**ip=**__{dhcp|on|any|dhcp6|auto6}__::
|
||||
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.
|
||||
@@ -446,8 +450,6 @@ USB Android phone::
|
||||
|
||||
dhcp6::: IPv6 DHCP
|
||||
|
||||
ibft::: iBFT autoconfiguration
|
||||
|
||||
**ip=**__<interface>__:__{dhcp|on|any|dhcp6|auto6}__[:[__<mtu>__][:__<macaddr>__]]::
|
||||
This parameter can be specified multiple times.
|
||||
+
|
||||
@@ -472,6 +474,13 @@ 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}__[:[__<dns1>__][:__<dns2>__]]::
|
||||
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
|
||||
for pointopoint interfaces and it may be followed by a slash and a decimal
|
||||
number, encoding the network prefix length.
|
||||
|
||||
**ifname=**__<interface>__:__<MAC>__::
|
||||
Assign network device name <interface> (ie "bootnet") to the NIC with
|
||||
MAC <MAC>.
|
||||
@@ -480,6 +489,19 @@ WARNING: Do **not** use the default kernel naming scheme for the interface name,
|
||||
as it can conflict with the kernel names. So, don't use "eth[0-9]+" for the
|
||||
interface name. Better name it "bootnet" or "bluesocket".
|
||||
|
||||
**rd.route=**__<net>__/__<netmask>__:__<gateway>__[:__<interface>__]::
|
||||
Add a static route with route options, which are separated by a colon.
|
||||
IPv6 addresses have to be put in brackets.
|
||||
+
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
rd.route=192.168.200.0/24:192.168.100.222:ens10
|
||||
rd.route=192.168.200.0/24:192.168.100.222
|
||||
rd.route=192.168.200.0/24::ens10
|
||||
rd.route=[2001:DB8:3::/8]:[2001:DB8:2::1]:ens10
|
||||
--
|
||||
|
||||
**bootdev=**__<interface>__::
|
||||
specify network interface to use routing and netroot information from.
|
||||
Required if multiple ip= lines are used.
|
||||
@@ -527,7 +549,7 @@ NFS
|
||||
~~~
|
||||
**root=**\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__]::
|
||||
mount nfs share from <server-ip>:/<root-dir>, if no server-ip is given, use
|
||||
dhcp next_server. if server-ip is an IPv6 address it has to be put in
|
||||
dhcp next_server. If server-ip is an IPv6 address it has to be put in
|
||||
brackets, e.g. [2001:DB8::1]. NFS options can be appended with the prefix
|
||||
":" or "," and are seperated by ",".
|
||||
|
||||
@@ -550,6 +572,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>__::
|
||||
@@ -654,6 +701,15 @@ will result in
|
||||
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}__::
|
||||
@@ -704,10 +760,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.
|
||||
|
@@ -76,6 +76,9 @@ Configuration files must have the extension .conf; other extensions are ignored.
|
||||
Host-Only mode: Install only what is needed for booting the local host
|
||||
instead of a generic host and generate host-specific configuration.
|
||||
|
||||
*hostonly_cmdline*"__{yes|no}__"::
|
||||
If set, store the kernel command line arguments needed in the initramfs
|
||||
|
||||
*persistent_policy=*"__<policy>__"::
|
||||
Use _<policy>_ to address disks and partitions.
|
||||
_<policy>_ can be any directory name found in /dev/disk.
|
||||
|
@@ -13,3 +13,5 @@ systemdsystemunitdir=/usr/lib/systemd/system
|
||||
systemdsystemconfdir=/etc/systemd/system
|
||||
udevdir=/usr/lib/udev
|
||||
hostonly="yes"
|
||||
hostonly_cmdline="no"
|
||||
early_microcode="yes"
|
||||
|
146
dracut.sh
146
dracut.sh
@@ -137,6 +137,10 @@ 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-cmdline Store kernel command line arguments needed
|
||||
in the initramfs
|
||||
--no-hostonly-cmdline Do not store kernel command line arguments needed
|
||||
in the initramfs
|
||||
--persistent-policy [POLICY]
|
||||
Use [POLICY] to address disks and partitions.
|
||||
POLICY can be any directory name found in /dev/disk.
|
||||
@@ -345,6 +349,8 @@ rearrange_params()
|
||||
--long host-only \
|
||||
--long no-hostonly \
|
||||
--long no-host-only \
|
||||
--long hostonly-cmdline \
|
||||
--long no-hostonly-cmdline \
|
||||
--long persistent-policy: \
|
||||
--long fstab \
|
||||
--long help \
|
||||
@@ -363,6 +369,8 @@ rearrange_params()
|
||||
--long noimageifnotneeded \
|
||||
--long early-microcode \
|
||||
--long no-early-microcode \
|
||||
--long no-hostonly-i18n \
|
||||
--long hostonly-i18n \
|
||||
-- "$@")
|
||||
|
||||
if (( $? != 0 )); then
|
||||
@@ -488,9 +496,12 @@ while :; do
|
||||
-f|--force) force=yes;;
|
||||
--kernel-only) kernel_only="yes"; no_kernel="no";;
|
||||
--no-kernel) kernel_only="no"; no_kernel="yes";;
|
||||
--print-cmdline) print_cmdline="yes"; hostonly_l="yes"; kernel_only="yes"; no_kernel="yes";;
|
||||
--early-microcode) early_microcode_l="yes";;
|
||||
--no-early-microcode) early_microcode_l="no";;
|
||||
--print-cmdline)
|
||||
print_cmdline="yes"; hostonly_l="yes"; kernel_only="yes"; no_kernel="yes";;
|
||||
--early-microcode)
|
||||
early_microcode_l="yes";;
|
||||
--no-early-microcode)
|
||||
early_microcode_l="no";;
|
||||
--strip) do_strip_l="yes";;
|
||||
--nostrip) do_strip_l="no";;
|
||||
--prelink) do_prelink_l="yes";;
|
||||
@@ -510,13 +521,21 @@ 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-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" ;;
|
||||
--persistent-policy)
|
||||
persistent_policy_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--fstab) use_fstab_l="yes" ;;
|
||||
@@ -755,6 +774,8 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||
[[ $prefix_l ]] && prefix=$prefix_l
|
||||
[[ $prefix = "/" ]] && unset prefix
|
||||
[[ $hostonly_l ]] && hostonly=$hostonly_l
|
||||
[[ $hostonly_cmdline_l ]] && hostonly_cmdline=$hostonly_cmdline_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
|
||||
@@ -782,7 +803,7 @@ case $compress in
|
||||
xz) compress="xz --check=crc32 --lzma2=dict=1MiB -T0";;
|
||||
gzip) compress="gzip -9"; command -v pigz > /dev/null 2>&1 && compress="pigz -9";;
|
||||
lzo) compress="lzop -9";;
|
||||
lz4) compress="lz4 -9";;
|
||||
lz4) compress="lz4 -l -9";;
|
||||
esac
|
||||
if [[ $_no_compress_l = "cat" ]]; then
|
||||
compress="cat"
|
||||
@@ -794,21 +815,20 @@ fi
|
||||
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
|
||||
printf "%s\n" "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t initramfs.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
|
||||
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=$?;
|
||||
[[ $outfile ]] && [[ -f $outfile.$$ ]] && rm -f -- "$outfile.$$";
|
||||
[[ $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";
|
||||
@@ -821,10 +841,17 @@ trap 'exit 1;' SIGINT
|
||||
export DRACUT_KERNEL_LAZY="1"
|
||||
export DRACUT_RESOLVE_LAZY="1"
|
||||
|
||||
if [[ -f $dracutbasedir/dracut-functions.sh ]]; then
|
||||
. $dracutbasedir/dracut-functions.sh
|
||||
if [[ $print_cmdline ]]; then
|
||||
stdloglvl=0
|
||||
sysloglvl=0
|
||||
fileloglvl=0
|
||||
kmsgloglvl=0
|
||||
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
|
||||
@@ -894,6 +921,7 @@ for ((i=0; i < ${#dracut_args[@]}; i++)); do
|
||||
dracut_args[$i]="\"${dracut_args[$i]}\""
|
||||
#" keep vim happy
|
||||
done
|
||||
|
||||
dinfo "Executing: $0 ${dracut_args[@]}"
|
||||
|
||||
[[ $do_list = yes ]] && {
|
||||
@@ -1005,7 +1033,7 @@ if [[ $hostonly ]]; then
|
||||
_bdev=$(readlink -f "/dev/block/$_dev")
|
||||
[[ -b $_bdev ]] && _dev=$_bdev
|
||||
push host_devs $_dev
|
||||
[[ "$_mp" == "/" ]] && root_dev="$_dev"
|
||||
[[ "$mp" == "/" ]] && root_dev="$_dev"
|
||||
push host_devs "$_dev"
|
||||
done
|
||||
|
||||
@@ -1024,7 +1052,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"
|
||||
@@ -1035,11 +1063,27 @@ 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
|
||||
|
||||
|
||||
# record all host modaliases
|
||||
declare -A host_modalias
|
||||
find /sys/devices/ -name uevent -print > "$initdir/.modalias"
|
||||
@@ -1131,15 +1175,26 @@ fi
|
||||
|
||||
[[ -d "$systemdsystemconfdir" ]] || systemdsystemconfdir=/etc/systemd/system
|
||||
|
||||
export initdir dracutbasedir dracutmodules \
|
||||
[[ -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 \
|
||||
fw_dir drivers_dir debug no_kernel kernel_only \
|
||||
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
|
||||
host_modalias host_modules hostonly_cmdline loginstall \
|
||||
tmpfilesdir
|
||||
|
||||
mods_to_load=""
|
||||
# check all our modules to see if they should be sourced.
|
||||
@@ -1194,7 +1249,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
|
||||
@@ -1299,7 +1353,12 @@ if [[ $kernel_only != yes ]]; then
|
||||
[[ $kernel_cmdline ]] && printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
|
||||
|
||||
while pop fstab_lines line; do
|
||||
printf "%s\n" "$line 0 0" >> "${initdir}/etc/fstab"
|
||||
line=($line)
|
||||
[ -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
|
||||
|
||||
for f in $add_fstab; do
|
||||
@@ -1365,20 +1424,18 @@ if [[ $kernel_only != yes ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $do_prelink == yes ]]; then
|
||||
PRELINK_BIN="$(command -v prelink)"
|
||||
if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then
|
||||
if [[ $DRACUT_FIPS_MODE ]]; then
|
||||
dinfo "*** Installing prelink files ***"
|
||||
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache
|
||||
else
|
||||
dinfo "*** Pre-linking files ***"
|
||||
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf
|
||||
chroot "$initdir" "$PRELINK_BIN" -a
|
||||
rm -f -- "$initdir/$PRELINK_BIN"
|
||||
rm -fr -- "$initdir"/etc/prelink.*
|
||||
dinfo "*** Pre-linking files done ***"
|
||||
fi
|
||||
PRELINK_BIN="$(command -v prelink)"
|
||||
if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then
|
||||
if [[ $DRACUT_FIPS_MODE ]]; then
|
||||
dinfo "*** Installing prelink files ***"
|
||||
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache
|
||||
elif [[ $do_prelink == yes ]]; then
|
||||
dinfo "*** Pre-linking files ***"
|
||||
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf
|
||||
chroot "$initdir" "$PRELINK_BIN" -a
|
||||
rm -f -- "$initdir/$PRELINK_BIN"
|
||||
rm -fr -- "$initdir"/etc/prelink.*
|
||||
dinfo "*** Pre-linking files done ***"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1432,10 +1489,14 @@ 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
|
||||
|
||||
for i in $_fwdir/$_fw/$_src; do
|
||||
[ -e "$i" ] && break
|
||||
break 2
|
||||
done
|
||||
cat $_fwdir/$_fw/$_src > $_dest_dir/${ucode_dest[$idx]}
|
||||
create_early_cpio="yes"
|
||||
fi
|
||||
@@ -1462,18 +1523,19 @@ fi
|
||||
|
||||
rm -f -- "$outfile"
|
||||
dinfo "*** Creating image file ***"
|
||||
|
||||
[[ "$UID" != 0 ]] && cpio_owner_root="-R 0:0"
|
||||
|
||||
if [[ $create_early_cpio = yes ]]; then
|
||||
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 -R 0:0 -H newc -o --quiet >../early.cpio)
|
||||
mv $early_cpio_dir/early.cpio $outfile.$$
|
||||
(cd "$early_cpio_dir/d"; find . -print0 | cpio --null $cpio_owner_root -H newc -o --quiet > $outfile)
|
||||
fi
|
||||
if ! ( umask 077; cd "$initdir"; find . -print0 | cpio --null -R 0:0 -H newc -o --quiet | \
|
||||
$compress >> "$outfile.$$"; ); then
|
||||
dfatal "dracut: creation of $outfile.$$ failed"
|
||||
if ! ( umask 077; cd "$initdir"; find . -print0 | cpio --null $cpio_owner_root -H newc -o --quiet | \
|
||||
$compress >> "$outfile"; ); then
|
||||
dfatal "dracut: creation of $outfile failed"
|
||||
exit 1
|
||||
fi
|
||||
mv -- "$outfile.$$" "$outfile"
|
||||
dinfo "*** Creating image file done ***"
|
||||
|
||||
if (( maxloglvl >= 5 )); then
|
||||
|
52
dracut.spec
52
dracut.spec
@@ -1,5 +1,4 @@
|
||||
%define dracutlibdir %{_prefix}/lib/dracut
|
||||
%bcond_without doc
|
||||
|
||||
# Variables must be defined
|
||||
%define with_nbd 1
|
||||
@@ -29,7 +28,7 @@ URL: https://dracut.wiki.kernel.org/
|
||||
|
||||
# Source can be generated by
|
||||
# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{version};sf=tgz
|
||||
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.xz
|
||||
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.bz2
|
||||
|
||||
BuildRequires: bash git
|
||||
|
||||
@@ -46,7 +45,6 @@ BuildRequires: pkgconfig
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%endif
|
||||
|
||||
%if %{with doc}
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
BuildRequires: docbook-style-xsl docbook-dtds libxslt
|
||||
%endif
|
||||
@@ -56,8 +54,6 @@ BuildRequires: docbook-style-xsl docbook-dtds libxslt
|
||||
%endif
|
||||
|
||||
BuildRequires: asciidoc
|
||||
%endif
|
||||
|
||||
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel}
|
||||
# no "provides", because dracut does not offer
|
||||
@@ -98,17 +94,19 @@ Requires: kpartx
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
Requires: util-linux >= 2.21
|
||||
Requires: systemd >= 199
|
||||
Requires: systemd >= 219
|
||||
Requires: procps-ng
|
||||
Conflicts: grubby < 8.23
|
||||
Conflicts: initscripts < 8.63-1
|
||||
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
|
||||
Conflicts: bcache-tools < 0-0.14.20130909git
|
||||
%else
|
||||
Requires: udev > 166
|
||||
Requires: util-linux-ng >= 2.21
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
Conflicts: initscripts < 8.63-1
|
||||
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
|
||||
%endif
|
||||
|
||||
Conflicts: mdadm < 3.2.6-14
|
||||
|
||||
%description
|
||||
@@ -207,10 +205,7 @@ git am -p1 %{patches}
|
||||
%endif
|
||||
|
||||
%build
|
||||
%configure --systemdsystemunitdir=%{_unitdir} --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) --libdir=%{_prefix}/lib \
|
||||
%if %{without doc}
|
||||
--disable-documentation
|
||||
%endif
|
||||
%configure --systemdsystemunitdir=%{_unitdir} --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) --libdir=%{_prefix}/lib
|
||||
|
||||
make %{?_smp_mflags}
|
||||
|
||||
@@ -253,16 +248,13 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log
|
||||
touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
rm -f $RPM_BUILD_ROOT%{_mandir}/man?/*suse*
|
||||
%endif
|
||||
%if 0%{?suse_version}
|
||||
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/40-fips.conf
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/40-fips.conf
|
||||
%if 0%{?suse_version}
|
||||
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999
|
||||
@@ -292,9 +284,7 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,0755)
|
||||
%if %{with doc}
|
||||
%doc README HACKING TODO COPYING AUTHORS NEWS dracut.html dracut.png dracut.svg
|
||||
%endif
|
||||
%{_bindir}/dracut
|
||||
# compat symlink
|
||||
%{_sbindir}/dracut
|
||||
@@ -306,6 +296,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
|
||||
@@ -319,8 +310,6 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%endif
|
||||
%dir %{_sysconfdir}/dracut.conf.d
|
||||
%dir %{dracutlibdir}/dracut.conf.d
|
||||
|
||||
%if %{with doc}
|
||||
%{_mandir}/man8/dracut.8*
|
||||
%{_mandir}/man8/*service.8*
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
|
||||
@@ -332,8 +321,6 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%{_mandir}/man7/dracut.modules.7*
|
||||
%{_mandir}/man7/dracut.bootup.7*
|
||||
%{_mandir}/man5/dracut.conf.5*
|
||||
%endif
|
||||
|
||||
%if %{defined _unitdir}
|
||||
%{dracutlibdir}/modules.d/00systemd-bootchart
|
||||
%else
|
||||
@@ -350,6 +337,7 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/modules.d/50drm
|
||||
%{dracutlibdir}/modules.d/50plymouth
|
||||
%{dracutlibdir}/modules.d/80cms
|
||||
%{dracutlibdir}/modules.d/90bcache
|
||||
%{dracutlibdir}/modules.d/90btrfs
|
||||
%{dracutlibdir}/modules.d/90crypt
|
||||
%{dracutlibdir}/modules.d/90dm
|
||||
@@ -367,10 +355,8 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/modules.d/95rootfs-block
|
||||
%{dracutlibdir}/modules.d/95dasd
|
||||
%{dracutlibdir}/modules.d/95dasd_mod
|
||||
%{dracutlibdir}/modules.d/95dasd_rules
|
||||
%{dracutlibdir}/modules.d/95fstab-sys
|
||||
%{dracutlibdir}/modules.d/95zfcp
|
||||
%{dracutlibdir}/modules.d/95zfcp_rules
|
||||
%{dracutlibdir}/modules.d/95terminfo
|
||||
%{dracutlibdir}/modules.d/95udev-rules
|
||||
%{dracutlibdir}/modules.d/95virtfs
|
||||
@@ -441,11 +427,7 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
|
||||
%files fips-aesni
|
||||
%defattr(-,root,root,0755)
|
||||
|
||||
%if %{with doc}
|
||||
%doc COPYING
|
||||
%endif
|
||||
|
||||
%{dracutlibdir}/modules.d/02fips-aesni
|
||||
|
||||
%files caps
|
||||
@@ -454,11 +436,7 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
|
||||
%files tools
|
||||
%defattr(-,root,root,0755)
|
||||
|
||||
%if %{with doc}
|
||||
%doc %{_mandir}/man8/dracut-catimages.8*
|
||||
%endif
|
||||
|
||||
%{_mandir}/man8/dracut-catimages.8*
|
||||
%{_bindir}/dracut-catimages
|
||||
%dir /boot/dracut
|
||||
%dir /var/lib/dracut
|
||||
|
@@ -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
|
||||
@@ -209,7 +214,7 @@ be specified once.
|
||||
----
|
||||
# mkdir -p rd.live.overlay/etc/cmdline.d
|
||||
# mkdir -p rd.live.overlay/etc/conf.d
|
||||
# echo "ip=auto" >> rd.live.overlay/etc/cmdline.d/mycmdline.conf
|
||||
# echo "ip=dhcp" >> rd.live.overlay/etc/cmdline.d/mycmdline.conf
|
||||
# echo export FOO=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
|
||||
# echo export BAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
|
||||
# tree rd.live.overlay/
|
||||
@@ -261,7 +266,7 @@ How to setup your PXE/TFTP server can be found in the
|
||||
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/[Red
|
||||
Hat Enterprise Linux Storage Administration Guide].
|
||||
|
||||
If you specify ip=auto on the kernel command line, then dracut asks a dhcp
|
||||
If you specify ip=dhcp on the kernel command line, then dracut asks a dhcp
|
||||
server about the ip adress for the machine. The dhcp server can also serve an
|
||||
additional root-path, which will set the root device for dracut. With this
|
||||
mechanism, you have static configuration on your client machine and a
|
||||
@@ -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
|
||||
|
@@ -20,8 +20,7 @@ chomp($tag);
|
||||
my @patches=&create_patches($tag, $pdir);
|
||||
my $num=$#patches + 2;
|
||||
$tag=~s/[^0-9]+?([0-9]+)/$1/;
|
||||
my $release="$num.git$datestr";
|
||||
$release="1" if $num == 1;
|
||||
my $release="$num";
|
||||
|
||||
while(<>) {
|
||||
if (/^Version:/) {
|
||||
|
1
install/.kateconfig
Normal file
1
install/.kateconfig
Normal file
@@ -0,0 +1 @@
|
||||
kate: space-indent on; tab-width 8; indent-width 8; replace-tabs on; eol unix;
|
@@ -44,7 +44,6 @@
|
||||
#include "log.h"
|
||||
#include "hashmap.h"
|
||||
#include "util.h"
|
||||
#include "strv.h"
|
||||
|
||||
static bool arg_hmac = false;
|
||||
static bool arg_createdir = false;
|
||||
@@ -64,12 +63,12 @@ static size_t dir_len(char const *file)
|
||||
{
|
||||
size_t length;
|
||||
|
||||
if (!file)
|
||||
if(!file)
|
||||
return 0;
|
||||
|
||||
/* Strip the basename and any redundant slashes before it. */
|
||||
for (length = strlen(file) - 1; 0 < length; length--)
|
||||
if (file[length] == '/' && file[length - 1] != '/')
|
||||
for (length = strlen(file)-1; 0 < length; length--)
|
||||
if (file[length] == '/' && file[length-1] != '/')
|
||||
break;
|
||||
return length;
|
||||
}
|
||||
@@ -102,9 +101,9 @@ static char *convert_abs_rel(const char *from, const char *target)
|
||||
/* dir_len() skips double /'s e.g. //lib64, so we can't skip just one
|
||||
* character - need to skip all leading /'s */
|
||||
rl = strlen(target);
|
||||
for (i = dirlen + 1; i < rl; ++i)
|
||||
if (target_dir_p[i] != '/')
|
||||
break;
|
||||
for (i = dirlen+1; i < rl; ++i)
|
||||
if (target_dir_p[i] != '/')
|
||||
break;
|
||||
ret = asprintf(&realtarget, "%s/%s", realpath_p, &target_dir_p[i]);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
@@ -221,7 +220,7 @@ static int cp(const char *src, const char *dst)
|
||||
if (ret == 0) {
|
||||
struct timeval tv[2];
|
||||
if (fchown(dest_desc, sb.st_uid, sb.st_gid) != 0)
|
||||
fchown(dest_desc, (__uid_t) - 1, sb.st_gid);
|
||||
fchown(dest_desc, (__uid_t)-1, sb.st_gid);
|
||||
tv[0].tv_sec = sb.st_atime;
|
||||
tv[0].tv_usec = 0;
|
||||
tv[1].tv_sec = sb.st_mtime;
|
||||
@@ -240,16 +239,14 @@ static int cp(const char *src, const char *dst)
|
||||
normal_copy:
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode,timestamps", "-fL", src, dst,
|
||||
NULL);
|
||||
execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode,timestamps", "-fL", src, dst, NULL);
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
while (waitpid(pid, &ret, 0) < 0) {
|
||||
if (errno != EINTR) {
|
||||
ret = -1;
|
||||
log_error("Failed: cp --reflink=auto --sparse=auto --preserve=mode,timestamps -fL %s %s", src,
|
||||
dst);
|
||||
log_error("Failed: cp --reflink=auto --sparse=auto --preserve=mode,timestamps -fL %s %s", src, dst);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -289,7 +286,7 @@ static int library_install(const char *src, const char *lib)
|
||||
libc.so.6 (libc6,64bit, hwcap: 0x0000001000000000, OS ABI: Linux 2.6.32) => /lib64/power6/libc.so.6
|
||||
libc.so.6 (libc6,64bit, hwcap: 0x0000000000000200, OS ABI: Linux 2.6.32) => /lib64/power6x/libc.so.6
|
||||
libc.so.6 (libc6,64bit, OS ABI: Linux 2.6.32) => /lib64/libc.so.6
|
||||
*/
|
||||
*/
|
||||
|
||||
free(p);
|
||||
p = strdup(lib);
|
||||
@@ -375,7 +372,7 @@ static int resolve_deps(const char *src)
|
||||
|
||||
if (strstr(buf, "you do not have execution permission")) {
|
||||
log_error("%s", buf);
|
||||
ret += 1;
|
||||
ret+=1;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -428,7 +425,7 @@ static int hmac_install(const char *src, const char *dst, const char *hmacpath)
|
||||
if (endswith(src, ".hmac"))
|
||||
return 0;
|
||||
|
||||
if (!hmacpath) {
|
||||
if (!hmacpath) {
|
||||
hmac_install(src, dst, "/lib/fipscheck");
|
||||
hmac_install(src, dst, "/lib64/fipscheck");
|
||||
hmac_install(src, dst, "/lib/hmaccalc");
|
||||
@@ -642,8 +639,8 @@ static void item_free(char *i)
|
||||
}
|
||||
|
||||
static void usage(int status)
|
||||
{
|
||||
/* */
|
||||
{
|
||||
/* */
|
||||
printf("Usage: %s -D DESTROOTDIR [OPTION]... -a SOURCE...\n"
|
||||
"or: %s -D DESTROOTDIR [OPTION]... SOURCE DEST\n"
|
||||
"\n"
|
||||
@@ -683,8 +680,8 @@ static void usage(int status)
|
||||
" |-- libdl.so -> libdl-2.15.90.so\n"
|
||||
" |-- libdl.so.2 -> libdl-2.15.90.so\n"
|
||||
" |-- libtinfo.so.5 -> libtinfo.so.5.9\n"
|
||||
" `-- libtinfo.so.5.9\n", program_invocation_short_name, program_invocation_short_name,
|
||||
program_invocation_short_name);
|
||||
" `-- libtinfo.so.5.9\n"
|
||||
, program_invocation_short_name, program_invocation_short_name, program_invocation_short_name);
|
||||
exit(status);
|
||||
}
|
||||
|
||||
@@ -791,13 +788,13 @@ static int resolve_lazy(int argc, char **argv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char **find_binary(const char *src)
|
||||
static char *find_binary(const char *src)
|
||||
{
|
||||
char *path = NULL;
|
||||
_cleanup_strv_free_ char **p = NULL;
|
||||
char **ret = NULL;
|
||||
char **q;
|
||||
_cleanup_free_ char *path = NULL;
|
||||
char *p, *q;
|
||||
bool end = false;
|
||||
char *newsrc = NULL;
|
||||
int ret;
|
||||
|
||||
path = getenv("PATH");
|
||||
|
||||
@@ -805,21 +802,34 @@ static char **find_binary(const char *src)
|
||||
log_error("PATH is not set");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
path = strdup(path);
|
||||
p = path;
|
||||
|
||||
if (path == NULL) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
log_debug("PATH=%s", path);
|
||||
|
||||
p = strv_split(path, ":");
|
||||
|
||||
STRV_FOREACH(q, p) {
|
||||
do {
|
||||
struct stat sb;
|
||||
int r;
|
||||
|
||||
r = asprintf(&newsrc, "%s/%s", *q, src);
|
||||
if (r < 0) {
|
||||
for (q = p; *q && *q != ':'; q++) ;
|
||||
|
||||
if (*q == '\0')
|
||||
end = true;
|
||||
else
|
||||
*q = '\0';
|
||||
|
||||
ret = asprintf(&newsrc, "%s/%s", p, src);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
p = q + 1;
|
||||
|
||||
if (stat(newsrc, &sb) != 0) {
|
||||
log_debug("stat(%s) != 0", newsrc);
|
||||
free(newsrc);
|
||||
@@ -827,37 +837,30 @@ static char **find_binary(const char *src)
|
||||
continue;
|
||||
}
|
||||
|
||||
strv_push(&ret, newsrc);
|
||||
end = true;
|
||||
|
||||
};
|
||||
} while (!end);
|
||||
|
||||
if (ret) {
|
||||
STRV_FOREACH(q, ret) {
|
||||
log_debug("find_binary(%s) == %s", src, *q);
|
||||
}
|
||||
}
|
||||
if (newsrc)
|
||||
log_debug("find_binary(%s) == %s", src, newsrc);
|
||||
|
||||
return ret;
|
||||
return newsrc;
|
||||
}
|
||||
|
||||
static int install_one(const char *src, const char *dst)
|
||||
{
|
||||
int r = EXIT_SUCCESS;
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
if (strchr(src, '/') == NULL) {
|
||||
char **q = NULL;
|
||||
char **p = find_binary(src);
|
||||
if (p) {
|
||||
STRV_FOREACH(q, p) {
|
||||
char *newsrc = *q;
|
||||
log_debug("dracut_install '%s' '%s'", newsrc, dst);
|
||||
ret = dracut_install(newsrc, dst, arg_createdir, arg_resolvedeps, true);
|
||||
if (ret == 0) {
|
||||
log_debug("dracut_install '%s' '%s' OK", newsrc, dst);
|
||||
}
|
||||
char *newsrc = find_binary(src);
|
||||
if (newsrc) {
|
||||
log_debug("dracut_install '%s' '%s'", newsrc, dst);
|
||||
ret = dracut_install(newsrc, dst, arg_createdir, arg_resolvedeps, true);
|
||||
if (ret == 0) {
|
||||
log_debug("dracut_install '%s' '%s' OK", newsrc, dst);
|
||||
}
|
||||
strv_free(p);
|
||||
free(newsrc);
|
||||
} else {
|
||||
ret = -1;
|
||||
}
|
||||
@@ -878,22 +881,17 @@ static int install_all(int argc, char **argv)
|
||||
int r = EXIT_SUCCESS;
|
||||
int i;
|
||||
for (i = 0; i < argc; i++) {
|
||||
int ret = 0;
|
||||
int ret;
|
||||
log_debug("Handle '%s'", argv[i]);
|
||||
|
||||
if (strchr(argv[i], '/') == NULL) {
|
||||
char **q = NULL;
|
||||
char **p = find_binary(argv[i]);
|
||||
if (p) {
|
||||
STRV_FOREACH(q, p) {
|
||||
char *newsrc = *q;
|
||||
log_debug("dracut_install '%s'", newsrc);
|
||||
ret = dracut_install(newsrc, newsrc, arg_createdir, arg_resolvedeps, true);
|
||||
if (ret == 0) {
|
||||
log_debug("dracut_install '%s' OK", newsrc);
|
||||
}
|
||||
_cleanup_free_ char *newsrc = find_binary(argv[i]);
|
||||
if (newsrc) {
|
||||
log_debug("dracut_install '%s'", newsrc);
|
||||
ret = dracut_install(newsrc, newsrc, arg_createdir, arg_resolvedeps, true);
|
||||
if (ret == 0) {
|
||||
log_debug("dracut_install '%s' OK", newsrc);
|
||||
}
|
||||
strv_free(p);
|
||||
} else {
|
||||
ret = -1;
|
||||
}
|
||||
|
587
install/strv.c
587
install/strv.c
@@ -1,587 +0,0 @@
|
||||
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
|
||||
/***
|
||||
This file is part of systemd.
|
||||
|
||||
Copyright 2010 Lennart Poettering
|
||||
|
||||
systemd is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
systemd 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "strv.h"
|
||||
|
||||
char *strv_find(char **l, const char *name) {
|
||||
char **i;
|
||||
|
||||
assert(name);
|
||||
|
||||
STRV_FOREACH(i, l)
|
||||
if (streq(*i, name))
|
||||
return *i;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *strv_find_prefix(char **l, const char *name) {
|
||||
char **i;
|
||||
|
||||
assert(name);
|
||||
|
||||
STRV_FOREACH(i, l)
|
||||
if (startswith(*i, name))
|
||||
return *i;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void strv_free(char **l) {
|
||||
char **k;
|
||||
|
||||
if (!l)
|
||||
return;
|
||||
|
||||
for (k = l; *k; k++)
|
||||
free(*k);
|
||||
|
||||
free(l);
|
||||
}
|
||||
|
||||
char **strv_copy(char * const *l) {
|
||||
char **r, **k;
|
||||
|
||||
k = r = new(char*, strv_length(l) + 1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
if (l)
|
||||
for (; *l; k++, l++) {
|
||||
*k = strdup(*l);
|
||||
if (!*k) {
|
||||
strv_free(r);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
*k = NULL;
|
||||
return r;
|
||||
}
|
||||
|
||||
unsigned strv_length(char * const *l) {
|
||||
unsigned n = 0;
|
||||
|
||||
if (!l)
|
||||
return 0;
|
||||
|
||||
for (; *l; l++)
|
||||
n++;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
char **strv_new_ap(const char *x, va_list ap) {
|
||||
const char *s;
|
||||
char **a;
|
||||
unsigned n = 0, i = 0;
|
||||
va_list aq;
|
||||
|
||||
/* As a special trick we ignore all listed strings that equal
|
||||
* (const char*) -1. This is supposed to be used with the
|
||||
* STRV_IFNOTNULL() macro to include possibly NULL strings in
|
||||
* the string list. */
|
||||
|
||||
if (x) {
|
||||
n = x == (const char*) -1 ? 0 : 1;
|
||||
|
||||
va_copy(aq, ap);
|
||||
while ((s = va_arg(aq, const char*))) {
|
||||
if (s == (const char*) -1)
|
||||
continue;
|
||||
|
||||
n++;
|
||||
}
|
||||
|
||||
va_end(aq);
|
||||
}
|
||||
|
||||
a = new(char*, n+1);
|
||||
if (!a)
|
||||
return NULL;
|
||||
|
||||
if (x) {
|
||||
if (x != (const char*) -1) {
|
||||
a[i] = strdup(x);
|
||||
if (!a[i])
|
||||
goto fail;
|
||||
i++;
|
||||
}
|
||||
|
||||
while ((s = va_arg(ap, const char*))) {
|
||||
|
||||
if (s == (const char*) -1)
|
||||
continue;
|
||||
|
||||
a[i] = strdup(s);
|
||||
if (!a[i])
|
||||
goto fail;
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
a[i] = NULL;
|
||||
|
||||
return a;
|
||||
|
||||
fail:
|
||||
strv_free(a);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char **strv_new(const char *x, ...) {
|
||||
char **r;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, x);
|
||||
r = strv_new_ap(x, ap);
|
||||
va_end(ap);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
char **strv_merge(char **a, char **b) {
|
||||
char **r, **k;
|
||||
|
||||
if (!a)
|
||||
return strv_copy(b);
|
||||
|
||||
if (!b)
|
||||
return strv_copy(a);
|
||||
|
||||
r = new(char*, strv_length(a) + strv_length(b) + 1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
for (k = r; *a; k++, a++) {
|
||||
*k = strdup(*a);
|
||||
if (!*k)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (; *b; k++, b++) {
|
||||
*k = strdup(*b);
|
||||
if (!*k)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
*k = NULL;
|
||||
return r;
|
||||
|
||||
fail:
|
||||
strv_free(r);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char **strv_merge_concat(char **a, char **b, const char *suffix) {
|
||||
char **r, **k;
|
||||
|
||||
/* Like strv_merge(), but appends suffix to all strings in b, before adding */
|
||||
|
||||
if (!b)
|
||||
return strv_copy(a);
|
||||
|
||||
r = new(char*, strv_length(a) + strv_length(b) + 1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
k = r;
|
||||
if (a)
|
||||
for (; *a; k++, a++) {
|
||||
*k = strdup(*a);
|
||||
if (!*k)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (; *b; k++, b++) {
|
||||
*k = strappend(*b, suffix);
|
||||
if (!*k)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
*k = NULL;
|
||||
return r;
|
||||
|
||||
fail:
|
||||
strv_free(r);
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
char **strv_split(const char *s, const char *separator) {
|
||||
char *state;
|
||||
char *w;
|
||||
size_t l;
|
||||
unsigned n, i;
|
||||
char **r;
|
||||
|
||||
assert(s);
|
||||
|
||||
n = 0;
|
||||
FOREACH_WORD_SEPARATOR(w, l, s, separator, state)
|
||||
n++;
|
||||
|
||||
r = new(char*, n+1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
i = 0;
|
||||
FOREACH_WORD_SEPARATOR(w, l, s, separator, state) {
|
||||
r[i] = strndup(w, l);
|
||||
if (!r[i]) {
|
||||
strv_free(r);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
r[i] = NULL;
|
||||
return r;
|
||||
}
|
||||
|
||||
char **strv_split_quoted(const char *s) {
|
||||
char *state;
|
||||
char *w;
|
||||
size_t l;
|
||||
unsigned n, i;
|
||||
char **r;
|
||||
|
||||
assert(s);
|
||||
|
||||
n = 0;
|
||||
FOREACH_WORD_QUOTED(w, l, s, state)
|
||||
n++;
|
||||
|
||||
r = new(char*, n+1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
i = 0;
|
||||
FOREACH_WORD_QUOTED(w, l, s, state) {
|
||||
r[i] = cunescape_length(w, l);
|
||||
if (!r[i]) {
|
||||
strv_free(r);
|
||||
return NULL;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
r[i] = NULL;
|
||||
return r;
|
||||
}
|
||||
|
||||
char **strv_split_newlines(const char *s) {
|
||||
char **l;
|
||||
unsigned n;
|
||||
|
||||
assert(s);
|
||||
|
||||
/* Special version of strv_split() that splits on newlines and
|
||||
* suppresses an empty string at the end */
|
||||
|
||||
l = strv_split(s, NEWLINE);
|
||||
if (!l)
|
||||
return NULL;
|
||||
|
||||
n = strv_length(l);
|
||||
if (n <= 0)
|
||||
return l;
|
||||
|
||||
if (isempty(l[n-1])) {
|
||||
free(l[n-1]);
|
||||
l[n-1] = NULL;
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
char *strv_join(char **l, const char *separator) {
|
||||
char *r, *e;
|
||||
char **s;
|
||||
size_t n, k;
|
||||
|
||||
if (!separator)
|
||||
separator = " ";
|
||||
|
||||
k = strlen(separator);
|
||||
|
||||
n = 0;
|
||||
STRV_FOREACH(s, l) {
|
||||
if (n != 0)
|
||||
n += k;
|
||||
n += strlen(*s);
|
||||
}
|
||||
|
||||
r = new(char, n+1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
e = r;
|
||||
STRV_FOREACH(s, l) {
|
||||
if (e != r)
|
||||
e = stpcpy(e, separator);
|
||||
|
||||
e = stpcpy(e, *s);
|
||||
}
|
||||
|
||||
*e = 0;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
char **strv_append(char **l, const char *s) {
|
||||
char **r, **k;
|
||||
|
||||
if (!l)
|
||||
return strv_new(s, NULL);
|
||||
|
||||
if (!s)
|
||||
return strv_copy(l);
|
||||
|
||||
r = new(char*, strv_length(l)+2);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
for (k = r; *l; k++, l++) {
|
||||
*k = strdup(*l);
|
||||
if (!*k)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
k[0] = strdup(s);
|
||||
if (!k[0])
|
||||
goto fail;
|
||||
|
||||
k[1] = NULL;
|
||||
return r;
|
||||
|
||||
fail:
|
||||
strv_free(r);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int strv_push(char ***l, char *value) {
|
||||
char **c;
|
||||
unsigned n;
|
||||
|
||||
if (!value)
|
||||
return 0;
|
||||
|
||||
n = strv_length(*l);
|
||||
c = realloc(*l, sizeof(char*) * (n + 2));
|
||||
if (!c)
|
||||
return -ENOMEM;
|
||||
|
||||
c[n] = value;
|
||||
c[n+1] = NULL;
|
||||
|
||||
*l = c;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int strv_extend(char ***l, const char *value) {
|
||||
char *v;
|
||||
int r;
|
||||
|
||||
if (!value)
|
||||
return 0;
|
||||
|
||||
v = strdup(value);
|
||||
if (!v)
|
||||
return -ENOMEM;
|
||||
|
||||
r = strv_push(l, v);
|
||||
if (r < 0)
|
||||
free(v);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
char **strv_uniq(char **l) {
|
||||
char **i;
|
||||
|
||||
/* Drops duplicate entries. The first identical string will be
|
||||
* kept, the others dropped */
|
||||
|
||||
STRV_FOREACH(i, l)
|
||||
strv_remove(i+1, *i);
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
char **strv_remove(char **l, const char *s) {
|
||||
char **f, **t;
|
||||
|
||||
if (!l)
|
||||
return NULL;
|
||||
|
||||
assert(s);
|
||||
|
||||
/* Drops every occurrence of s in the string list, edits
|
||||
* in-place. */
|
||||
|
||||
for (f = t = l; *f; f++) {
|
||||
|
||||
if (streq(*f, s)) {
|
||||
free(*f);
|
||||
continue;
|
||||
}
|
||||
|
||||
*(t++) = *f;
|
||||
}
|
||||
|
||||
*t = NULL;
|
||||
return l;
|
||||
}
|
||||
|
||||
char **strv_remove_prefix(char **l, const char *s) {
|
||||
char **f, **t;
|
||||
|
||||
if (!l)
|
||||
return NULL;
|
||||
|
||||
assert(s);
|
||||
|
||||
/* Drops every occurrence of a string prefixed with s in the
|
||||
* string list, edits in-place. */
|
||||
|
||||
for (f = t = l; *f; f++) {
|
||||
|
||||
if (startswith(*f, s)) {
|
||||
free(*f);
|
||||
continue;
|
||||
}
|
||||
|
||||
*(t++) = *f;
|
||||
}
|
||||
|
||||
*t = NULL;
|
||||
return l;
|
||||
}
|
||||
|
||||
char **strv_parse_nulstr(const char *s, size_t l) {
|
||||
const char *p;
|
||||
unsigned c = 0, i = 0;
|
||||
char **v;
|
||||
|
||||
assert(s || l <= 0);
|
||||
|
||||
if (l <= 0)
|
||||
return new0(char*, 1);
|
||||
|
||||
for (p = s; p < s + l; p++)
|
||||
if (*p == 0)
|
||||
c++;
|
||||
|
||||
if (s[l-1] != 0)
|
||||
c++;
|
||||
|
||||
v = new0(char*, c+1);
|
||||
if (!v)
|
||||
return NULL;
|
||||
|
||||
p = s;
|
||||
while (p < s + l) {
|
||||
const char *e;
|
||||
|
||||
e = memchr(p, 0, s + l - p);
|
||||
|
||||
v[i] = strndup(p, e ? e - p : s + l - p);
|
||||
if (!v[i]) {
|
||||
strv_free(v);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
i++;
|
||||
|
||||
if (!e)
|
||||
break;
|
||||
|
||||
p = e + 1;
|
||||
}
|
||||
|
||||
assert(i == c);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
char **strv_split_nulstr(const char *s) {
|
||||
const char *i;
|
||||
char **r = NULL;
|
||||
|
||||
NULSTR_FOREACH(i, s)
|
||||
if (strv_extend(&r, i) < 0) {
|
||||
strv_free(r);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!r)
|
||||
return strv_new(NULL, NULL);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
bool strv_overlap(char **a, char **b) {
|
||||
char **i, **j;
|
||||
|
||||
STRV_FOREACH(i, a) {
|
||||
STRV_FOREACH(j, b) {
|
||||
if (streq(*i, *j))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static int str_compare(const void *_a, const void *_b) {
|
||||
const char **a = (const char**) _a, **b = (const char**) _b;
|
||||
|
||||
return strcmp(*a, *b);
|
||||
}
|
||||
|
||||
char **strv_sort(char **l) {
|
||||
|
||||
if (strv_isempty(l))
|
||||
return l;
|
||||
|
||||
qsort(l, strv_length(l), sizeof(char*), str_compare);
|
||||
return l;
|
||||
}
|
||||
|
||||
void strv_print(char **l) {
|
||||
char **s;
|
||||
|
||||
if (!l)
|
||||
return;
|
||||
|
||||
STRV_FOREACH(s, l)
|
||||
puts(*s);
|
||||
}
|
118
install/strv.h
118
install/strv.h
@@ -1,118 +0,0 @@
|
||||
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/***
|
||||
This file is part of systemd.
|
||||
|
||||
Copyright 2010 Lennart Poettering
|
||||
|
||||
systemd is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
systemd 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
char *strv_find(char **l, const char *name) _pure_;
|
||||
char *strv_find_prefix(char **l, const char *name) _pure_;
|
||||
|
||||
void strv_free(char **l);
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(char**, strv_free);
|
||||
#define _cleanup_strv_free_ _cleanup_(strv_freep)
|
||||
|
||||
char **strv_copy(char * const *l);
|
||||
unsigned strv_length(char * const *l) _pure_;
|
||||
|
||||
char **strv_merge(char **a, char **b);
|
||||
char **strv_merge_concat(char **a, char **b, const char *suffix);
|
||||
char **strv_append(char **l, const char *s);
|
||||
int strv_extend(char ***l, const char *value);
|
||||
int strv_push(char ***l, char *value);
|
||||
|
||||
char **strv_remove(char **l, const char *s);
|
||||
char **strv_remove_prefix(char **l, const char *s);
|
||||
char **strv_uniq(char **l);
|
||||
|
||||
#define strv_contains(l, s) (!!strv_find((l), (s)))
|
||||
|
||||
char **strv_new(const char *x, ...) _sentinel_;
|
||||
char **strv_new_ap(const char *x, va_list ap);
|
||||
|
||||
static inline const char* STRV_IFNOTNULL(const char *x) {
|
||||
return x ? x : (const char *) -1;
|
||||
}
|
||||
|
||||
static inline bool strv_isempty(char * const *l) {
|
||||
return !l || !*l;
|
||||
}
|
||||
|
||||
char **strv_split(const char *s, const char *separator);
|
||||
char **strv_split_quoted(const char *s);
|
||||
char **strv_split_newlines(const char *s);
|
||||
|
||||
char *strv_join(char **l, const char *separator);
|
||||
|
||||
char **strv_parse_nulstr(const char *s, size_t l);
|
||||
char **strv_split_nulstr(const char *s);
|
||||
|
||||
bool strv_overlap(char **a, char **b) _pure_;
|
||||
|
||||
#define STRV_FOREACH(s, l) \
|
||||
for ((s) = (l); (s) && *(s); (s)++)
|
||||
|
||||
#define STRV_FOREACH_BACKWARDS(s, l) \
|
||||
STRV_FOREACH(s, l) \
|
||||
; \
|
||||
for ((s)--; (l) && ((s) >= (l)); (s)--)
|
||||
|
||||
#define STRV_FOREACH_PAIR(x, y, l) \
|
||||
for ((x) = (l), (y) = (x+1); (x) && *(x) && *(y); (x) += 2, (y) = (x + 1))
|
||||
|
||||
char **strv_sort(char **l);
|
||||
void strv_print(char **l);
|
||||
|
||||
#define STRV_MAKE(...) ((char**) ((const char*[]) { __VA_ARGS__, NULL }))
|
||||
|
||||
#define STRV_MAKE_EMPTY ((char*[1]) { NULL })
|
||||
|
||||
#define strv_from_stdarg_alloca(first) \
|
||||
({ \
|
||||
char **_l; \
|
||||
\
|
||||
if (!first) \
|
||||
_l = (char**) &first; \
|
||||
else { \
|
||||
unsigned _n; \
|
||||
va_list _ap; \
|
||||
\
|
||||
_n = 1; \
|
||||
va_start(_ap, first); \
|
||||
while (va_arg(_ap, char*)) \
|
||||
_n++; \
|
||||
va_end(_ap); \
|
||||
\
|
||||
_l = newa(char*, _n+1); \
|
||||
_l[_n = 0] = (char*) first; \
|
||||
va_start(_ap, first); \
|
||||
for (;;) { \
|
||||
_l[++_n] = va_arg(_ap, char*); \
|
||||
if (!_l[_n]) \
|
||||
break; \
|
||||
} \
|
||||
va_end(_ap); \
|
||||
} \
|
||||
_l; \
|
||||
})
|
235
install/util.c
235
install/util.c
@@ -277,238 +277,3 @@ char *strjoin(const char *x, ...) {
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
char *cunescape_length_with_prefix(const char *s, size_t length, const char *prefix) {
|
||||
char *r, *t;
|
||||
const char *f;
|
||||
size_t pl;
|
||||
|
||||
assert(s);
|
||||
|
||||
/* Undoes C style string escaping, and optionally prefixes it. */
|
||||
|
||||
pl = prefix ? strlen(prefix) : 0;
|
||||
|
||||
r = new(char, pl+length+1);
|
||||
if (!r)
|
||||
return r;
|
||||
|
||||
if (prefix)
|
||||
memcpy(r, prefix, pl);
|
||||
|
||||
for (f = s, t = r + pl; f < s + length; f++) {
|
||||
|
||||
if (*f != '\\') {
|
||||
*(t++) = *f;
|
||||
continue;
|
||||
}
|
||||
|
||||
f++;
|
||||
|
||||
switch (*f) {
|
||||
|
||||
case 'a':
|
||||
*(t++) = '\a';
|
||||
break;
|
||||
case 'b':
|
||||
*(t++) = '\b';
|
||||
break;
|
||||
case 'f':
|
||||
*(t++) = '\f';
|
||||
break;
|
||||
case 'n':
|
||||
*(t++) = '\n';
|
||||
break;
|
||||
case 'r':
|
||||
*(t++) = '\r';
|
||||
break;
|
||||
case 't':
|
||||
*(t++) = '\t';
|
||||
break;
|
||||
case 'v':
|
||||
*(t++) = '\v';
|
||||
break;
|
||||
case '\\':
|
||||
*(t++) = '\\';
|
||||
break;
|
||||
case '"':
|
||||
*(t++) = '"';
|
||||
break;
|
||||
case '\'':
|
||||
*(t++) = '\'';
|
||||
break;
|
||||
|
||||
case 's':
|
||||
/* This is an extension of the XDG syntax files */
|
||||
*(t++) = ' ';
|
||||
break;
|
||||
|
||||
case 'x': {
|
||||
/* hexadecimal encoding */
|
||||
int a, b;
|
||||
|
||||
a = unhexchar(f[1]);
|
||||
b = unhexchar(f[2]);
|
||||
|
||||
if (a < 0 || b < 0) {
|
||||
/* Invalid escape code, let's take it literal then */
|
||||
*(t++) = '\\';
|
||||
*(t++) = 'x';
|
||||
} else {
|
||||
*(t++) = (char) ((a << 4) | b);
|
||||
f += 2;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7': {
|
||||
/* octal encoding */
|
||||
int a, b, c;
|
||||
|
||||
a = unoctchar(f[0]);
|
||||
b = unoctchar(f[1]);
|
||||
c = unoctchar(f[2]);
|
||||
|
||||
if (a < 0 || b < 0 || c < 0) {
|
||||
/* Invalid escape code, let's take it literal then */
|
||||
*(t++) = '\\';
|
||||
*(t++) = f[0];
|
||||
} else {
|
||||
*(t++) = (char) ((a << 6) | (b << 3) | c);
|
||||
f += 2;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 0:
|
||||
/* premature end of string.*/
|
||||
*(t++) = '\\';
|
||||
goto finish;
|
||||
|
||||
default:
|
||||
/* Invalid escape code, let's take it literal then */
|
||||
*(t++) = '\\';
|
||||
*(t++) = *f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
finish:
|
||||
*t = 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
char *cunescape_length(const char *s, size_t length) {
|
||||
return cunescape_length_with_prefix(s, length, NULL);
|
||||
}
|
||||
|
||||
|
||||
/* Split a string into words, but consider strings enclosed in '' and
|
||||
* "" as words even if they include spaces. */
|
||||
char *split_quoted(const char *c, size_t *l, char **state) {
|
||||
const char *current, *e;
|
||||
bool escaped = false;
|
||||
|
||||
assert(c);
|
||||
assert(l);
|
||||
assert(state);
|
||||
|
||||
current = *state ? *state : c;
|
||||
|
||||
current += strspn(current, WHITESPACE);
|
||||
|
||||
if (*current == 0)
|
||||
return NULL;
|
||||
|
||||
else if (*current == '\'') {
|
||||
current ++;
|
||||
|
||||
for (e = current; *e; e++) {
|
||||
if (escaped)
|
||||
escaped = false;
|
||||
else if (*e == '\\')
|
||||
escaped = true;
|
||||
else if (*e == '\'')
|
||||
break;
|
||||
}
|
||||
|
||||
*l = e-current;
|
||||
*state = (char*) (*e == 0 ? e : e+1);
|
||||
|
||||
} else if (*current == '\"') {
|
||||
current ++;
|
||||
|
||||
for (e = current; *e; e++) {
|
||||
if (escaped)
|
||||
escaped = false;
|
||||
else if (*e == '\\')
|
||||
escaped = true;
|
||||
else if (*e == '\"')
|
||||
break;
|
||||
}
|
||||
|
||||
*l = e-current;
|
||||
*state = (char*) (*e == 0 ? e : e+1);
|
||||
|
||||
} else {
|
||||
for (e = current; *e; e++) {
|
||||
if (escaped)
|
||||
escaped = false;
|
||||
else if (*e == '\\')
|
||||
escaped = true;
|
||||
else if (strchr(WHITESPACE, *e))
|
||||
break;
|
||||
}
|
||||
*l = e-current;
|
||||
*state = (char*) e;
|
||||
}
|
||||
|
||||
return (char*) current;
|
||||
}
|
||||
|
||||
/* Split a string into words. */
|
||||
char *split(const char *c, size_t *l, const char *separator, char **state) {
|
||||
char *current;
|
||||
|
||||
current = *state ? *state : (char*) c;
|
||||
|
||||
if (!*current || *c == 0)
|
||||
return NULL;
|
||||
|
||||
current += strspn(current, separator);
|
||||
*l = strcspn(current, separator);
|
||||
*state = current+*l;
|
||||
|
||||
return (char*) current;
|
||||
}
|
||||
|
||||
int unhexchar(char c) {
|
||||
|
||||
if (c >= '0' && c <= '9')
|
||||
return c - '0';
|
||||
|
||||
if (c >= 'a' && c <= 'f')
|
||||
return c - 'a' + 10;
|
||||
|
||||
if (c >= 'A' && c <= 'F')
|
||||
return c - 'A' + 10;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int unoctchar(char c) {
|
||||
|
||||
if (c >= '0' && c <= '7')
|
||||
return c - '0';
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@@ -134,16 +134,8 @@ static inline bool isempty(const char *p) {
|
||||
return !p || !p[0];
|
||||
}
|
||||
|
||||
|
||||
static inline const char *startswith(const char *s, const char *prefix) {
|
||||
if (strncmp(s, prefix, strlen(prefix)) == 0)
|
||||
return s + strlen(prefix);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool endswith(const char *s, const char *postfix);
|
||||
|
||||
|
||||
bool startswith(const char *s, const char *prefix);
|
||||
bool startswith_no_case(const char *s, const char *prefix);
|
||||
|
||||
bool first_word(const char *s, const char *word);
|
||||
@@ -570,16 +562,4 @@ void warn_melody(void);
|
||||
|
||||
char *strjoin(const char *x, ...) _sentinel_;
|
||||
|
||||
#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \
|
||||
static inline void func##p(type *p) { \
|
||||
if (*p) \
|
||||
func(*p); \
|
||||
} \
|
||||
struct __useless_struct_to_allow_trailing_semicolon__
|
||||
|
||||
char *split_quoted(const char *c, size_t *l, char **state);
|
||||
char *cunescape_length(const char *s, size_t length);
|
||||
int unhexchar(char c) _const_;
|
||||
int unoctchar(char c) _const_;
|
||||
|
||||
#endif
|
||||
|
90
lsinitrd.sh
90
lsinitrd.sh
@@ -27,6 +27,7 @@ usage()
|
||||
echo
|
||||
echo "-h, --help print a help message and exit."
|
||||
echo "-s, --size sort the contents of the initramfs by size."
|
||||
echo "-m, --mod list modules."
|
||||
echo "-f, --file <filename> print the contents of <filename>."
|
||||
echo "-k, --kver <kernel version> inspect the initramfs of <kernel version>."
|
||||
echo
|
||||
@@ -37,13 +38,15 @@ usage()
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
|
||||
sorted=0
|
||||
modules=0
|
||||
declare -A filenames
|
||||
|
||||
unset POSIXLY_CORRECT
|
||||
TEMP=$(getopt \
|
||||
-o "shf:k:" \
|
||||
-o "shmf:k:" \
|
||||
--long kver: \
|
||||
--long file: \
|
||||
--long mod \
|
||||
--long help \
|
||||
--long size \
|
||||
-- "$@")
|
||||
@@ -61,6 +64,7 @@ while (($# > 0)); do
|
||||
-f|--file) filenames[${2#/}]=1; shift;;
|
||||
-s|--size) sorted=1;;
|
||||
-h|--help) usage; exit 0;;
|
||||
-m|--mod) modules=1;;
|
||||
--) shift;break;;
|
||||
*) usage; exit 1;;
|
||||
esac
|
||||
@@ -112,20 +116,27 @@ extract_files()
|
||||
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
|
||||
done
|
||||
}
|
||||
|
||||
list_modules()
|
||||
{
|
||||
echo "dracut modules:"
|
||||
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/modules.txt' 'usr/lib/dracut/modules.txt' 2>/dev/null
|
||||
((ret+=$?))
|
||||
}
|
||||
|
||||
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 "========================================================================"
|
||||
@@ -160,27 +171,39 @@ case $bin in
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ $SKIP ]]; then
|
||||
read -N 6 bin < <($SKIP "$image")
|
||||
fi
|
||||
|
||||
case $bin in
|
||||
$'\x1f\x8b'*)
|
||||
CAT="zcat --";;
|
||||
BZh*)
|
||||
CAT="bzcat --";;
|
||||
$'\x71\xc7'*|070701)
|
||||
CAT="cat --"
|
||||
;;
|
||||
$'\x04\x22'*)
|
||||
CAT="lz4 -d -c";;
|
||||
*)
|
||||
CAT="xzcat --";
|
||||
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
|
||||
CAT="xzcat --single-stream --"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
CAT=$({
|
||||
if [[ $SKIP ]]; then
|
||||
$SKIP "$image"
|
||||
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
|
||||
})
|
||||
|
||||
skipcpio()
|
||||
{
|
||||
@@ -197,17 +220,20 @@ 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
|
||||
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
|
||||
echo
|
||||
echo "dracut modules:"
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/modules.txt' 'usr/lib/dracut/modules.txt' 2>/dev/null
|
||||
((ret+=$?))
|
||||
list_files
|
||||
if [ "$modules" -eq 1 ]; then
|
||||
list_modules
|
||||
echo "========================================================================"
|
||||
else
|
||||
echo -n "Arguments: "
|
||||
$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
|
||||
fi
|
||||
fi
|
||||
|
||||
exit $ret
|
||||
|
175
mkinitrd-dracut.sh
Executable file → Normal file
175
mkinitrd-dracut.sh
Executable file → Normal file
@@ -1,11 +1,6 @@
|
||||
#!/bin/bash --norc
|
||||
kver=$(uname -r)
|
||||
|
||||
boot_dir="/boot"
|
||||
quiet=0
|
||||
host_only=0
|
||||
force=0
|
||||
|
||||
error() { echo "$@" >&2; }
|
||||
|
||||
usage () {
|
||||
@@ -29,105 +24,36 @@ read_arg() {
|
||||
# $1 = arg name
|
||||
# $2 = arg value
|
||||
# $3 = arg parameter
|
||||
param="$1"
|
||||
local rematch='^[^=]*=(.*)$' result
|
||||
local rematch='^[^=]*=(.*)$'
|
||||
if [[ $2 =~ $rematch ]]; then
|
||||
read "$param" <<< "${BASH_REMATCH[1]}"
|
||||
else
|
||||
for ((i=3; $i <= $#; i++)); do
|
||||
# Only read next arg if it not an arg itself.
|
||||
if [[ ${@:$i:1} = -* ]];then
|
||||
break
|
||||
fi
|
||||
result="$result ${@:$i:1}"
|
||||
# There is no way to shift our callers args, so
|
||||
# return "no of args" to indicate they should do it instead.
|
||||
done
|
||||
read "$1" <<< "$result"
|
||||
return $(($i - 3))
|
||||
read "$1" <<< "${BASH_REMATCH[1]}"
|
||||
elif [[ $3 != -* ]]; then
|
||||
# Only read next arg if it not an arg itself.
|
||||
read "$1" <<< "$3"
|
||||
# There is no way to shift our callers args, so
|
||||
# return 1 to indicate they should do it instead.
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Taken over from SUSE mkinitrd
|
||||
default_kernel_images() {
|
||||
local regex kernel_image kernel_version version_version initrd_image
|
||||
local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
|
||||
|
||||
case "$(uname -m)" in
|
||||
s390|s390x)
|
||||
regex='image'
|
||||
;;
|
||||
ppc|ppc64)
|
||||
regex='vmlinux'
|
||||
;;
|
||||
i386|x86_64)
|
||||
regex='vmlinuz'
|
||||
;;
|
||||
arm*)
|
||||
regex='[uz]Image'
|
||||
;;
|
||||
aarch64)
|
||||
regex='Image'
|
||||
;;
|
||||
*) regex='vmlinu.'
|
||||
;;
|
||||
esac
|
||||
|
||||
# user mode linux
|
||||
if grep -q UML /proc/cpuinfo; then
|
||||
regex='linux'
|
||||
fi
|
||||
|
||||
kernel_images=""
|
||||
initrd_images=""
|
||||
for kernel_image in $(ls $boot_dir \
|
||||
| sed -ne "\|^$regex\(-[0-9.]\+-[0-9]\+-[a-z0-9]\+$\)\?|p" \
|
||||
| grep -v kdump$ ) ; do
|
||||
|
||||
# Note that we cannot check the RPM database here -- this
|
||||
# script is itself called from within the binary kernel
|
||||
# packages, and rpm does not allow recursive calls.
|
||||
|
||||
[ -L "$boot_dir/$kernel_image" ] && continue
|
||||
[ "${kernel_image%%.gz}" != "$kernel_image" ] && continue
|
||||
kernel_version=$(/usr/bin/get_kernel_version \
|
||||
$boot_dir/$kernel_image 2> /dev/null)
|
||||
initrd_image=$(echo $kernel_image | sed -e "s|${regex}|initrd|")
|
||||
if [ "$kernel_image" != "$initrd_image" -a \
|
||||
-n "$kernel_version" -a \
|
||||
-d "/lib/modules/$kernel_version" ]; then
|
||||
kernel_images="$kernel_images $boot_dir/$kernel_image"
|
||||
initrd_images="$initrd_images $boot_dir/$initrd_image"
|
||||
fi
|
||||
done
|
||||
for kernel_image in $kernel_images;do
|
||||
kernels="$kernels ${kernel_image#*-}"
|
||||
done
|
||||
for initrd_image in $initrd_images;do
|
||||
targets="$targets $initrd_image"
|
||||
done
|
||||
host_only=1
|
||||
force=1
|
||||
}
|
||||
|
||||
while (($# > 0)); do
|
||||
case ${1%%=*} in
|
||||
--with-usb) read_arg usbmodule "$@" || shift $?
|
||||
--with-usb) read_arg usbmodule "$@" || shift
|
||||
basicmodules="$basicmodules ${usbmodule:-usb-storage}"
|
||||
unset usbmodule;;
|
||||
--with-avail) read_arg modname "$@" || shift $?
|
||||
--with-avail) read_arg modname "$@" || shift
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--with) read_arg modname "$@" || shift $?
|
||||
--with) read_arg modname "$@" || shift
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--version)
|
||||
echo "mkinitrd: dracut compatibility wrapper"
|
||||
exit 0;;
|
||||
-v|--verbose) dracut_args="${dracut_args} -v";;
|
||||
-f|--force) force=1;;
|
||||
--preload) read_arg modname "$@" || shift $?
|
||||
-f|--force) dracut_args="${dracut_args} -f";;
|
||||
--preload) read_arg modname "$@" || shift
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--image-version) img_vers=yes;;
|
||||
--rootfs|-d) read_arg rootfs "$@" || shift $?
|
||||
--rootfs) read_arg rootfs "$@" || shift
|
||||
dracut_args="${dracut_args} --filesystems $rootfs";;
|
||||
--nocompress) dracut_args="$dracut_args --no-compress";;
|
||||
--help) usage -n;;
|
||||
@@ -154,31 +80,10 @@ while (($# > 0)); do
|
||||
--looppath*) ;;
|
||||
--dsdt*) ;;
|
||||
--bootchart) ;;
|
||||
-s) ;;
|
||||
--quiet|-q) quiet=1;;
|
||||
-b) read_arg boot_dir "$@" || shift $?
|
||||
if [ ! -d $boot_dir ];then
|
||||
error "Boot directory $boot_dir does not exist"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-k) # Would be nice to get a list of images here
|
||||
read_arg kernel_images "$@" || shift $?
|
||||
for kernel_image in $kernel_images;do
|
||||
kernels="$kernels ${kernel_image#*-}"
|
||||
done
|
||||
host_only=1
|
||||
force=1
|
||||
;;
|
||||
-i) read_arg initrd_images "$@" || shift $?
|
||||
for initrd_image in $initrd_images;do
|
||||
targets="$targets $boot_dir/$initrd_image"
|
||||
done
|
||||
;;
|
||||
*) if [[ ! $targets ]]; then
|
||||
targets=$1
|
||||
elif [[ ! $kernels ]]; then
|
||||
kernels=$1
|
||||
*) if [[ ! $target ]]; then
|
||||
target=$1
|
||||
elif [[ ! $kernel ]]; then
|
||||
kernel=$1
|
||||
else
|
||||
usage
|
||||
fi;;
|
||||
@@ -186,41 +91,11 @@ while (($# > 0)); do
|
||||
shift
|
||||
done
|
||||
|
||||
[[ $targets && $kernels ]] || default_kernel_images
|
||||
[[ $targets && $kernels ]] || (error "No kernel found in $boot_dir" && usage)
|
||||
[[ $target && $kernel ]] || usage
|
||||
[[ $img_vers ]] && target="$target-$kernel"
|
||||
|
||||
# We can have several targets/kernels, transform the list to an array
|
||||
targets=( $targets )
|
||||
[[ $kernels ]] && kernels=( $kernels )
|
||||
|
||||
[[ $host_only == 1 ]] && dracut_args="${dracut_args} -H"
|
||||
[[ $force == 1 ]] && dracut_args="${dracut_args} -f"
|
||||
|
||||
echo "Creating: target|kernel|dracut args|basicmodules "
|
||||
for ((i=0 ; $i<${#targets[@]} ; i++)); do
|
||||
|
||||
if [[ $img_vers ]];then
|
||||
target="${targets[$i]}-${kernels[$i]}"
|
||||
else
|
||||
target="${targets[$i]}"
|
||||
fi
|
||||
kernel="${kernels[$i]}"
|
||||
|
||||
# Duplicate code: No way found how to redirect output based on $quiet
|
||||
if [[ $quiet == 1 ]];then
|
||||
echo "$target|$kernel|$dracut_args|$basicmodules"
|
||||
if [[ $basicmodules ]]; then
|
||||
dracut $dracut_args --add-drivers "$basicmodules" "$target" \
|
||||
"$kernel" &>/dev/null
|
||||
else
|
||||
dracut $dracut_args "$target" "$kernel" &>/dev/null
|
||||
fi
|
||||
else
|
||||
if [[ $basicmodules ]]; then
|
||||
dracut $dracut_args --add-drivers "$basicmodules" "$target" \
|
||||
"$kernel"
|
||||
else
|
||||
dracut $dracut_args "$target" "$kernel"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [[ $basicmodules ]]; then
|
||||
dracut $dracut_args --add-drivers "$basicmodules" "$target" "$kernel"
|
||||
else
|
||||
dracut $dracut_args "$target" "$kernel"
|
||||
fi
|
||||
|
@@ -1,106 +0,0 @@
|
||||
MKINITRD(8)
|
||||
===========
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
|
||||
NAME
|
||||
----
|
||||
mkinitrd-suse - is a compat wrapper, which calls dracut to generate an initramfs
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
*mkinitrd* ['OPTION...']
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
*mkinitrd* creates an initramfs image <initrd-image> for the kernel with
|
||||
version <kernel-version> by calling *dracut*.
|
||||
|
||||
[IMPORTANT]
|
||||
This version of mkinitrd is provided for compability with older
|
||||
versions of mkinitrd. If a more fine grained control over the
|
||||
resulting image is needed, *dracut* should be called directly.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
**-R, --version**::
|
||||
print info about the version
|
||||
|
||||
**-k** _<kernel_list>_::
|
||||
List of kernel images for which initrd files are created (relative
|
||||
to _boot_dir_), defaults to _vmlinux_ on ppc/ppc64, _image_ on s390/s390x
|
||||
and _vmlinuz_ for everything else.
|
||||
|
||||
**-i** _<initrd_list>_::
|
||||
List of file names (relative to _boot_dir_) for the initrd; positions
|
||||
have to match the _kernel_list_. Defaults to _initrd_.
|
||||
|
||||
**-m** _<module_list>_::
|
||||
Modules to include in initrd, defaults to _INITRD_MODULES_ variable
|
||||
in */etc/sysconfig/kernel*.
|
||||
|
||||
**-f** _<feature_list>_::
|
||||
Features to be enabled for the initrd. In general mkinitrd
|
||||
configures the initrd for the root device it is started from. With
|
||||
this option additional feature can be enabled.
|
||||
|
||||
**-b** _<bootdir>_::
|
||||
Boot directory, defaults to */boot*, where the initrd is created.
|
||||
|
||||
**-d** _<root_device>_::
|
||||
Root device, defaults to the device from which the root_dir is
|
||||
mounted; overwrites the rootdev enviroment variable if set
|
||||
|
||||
**-s** _<size>_::
|
||||
Add splash animation and bootscreen to initrd.
|
||||
|
||||
**-D** _<interface>::
|
||||
Run dhcp on the specified interface (for example "eth0").
|
||||
|
||||
**-I** _<interface>::
|
||||
Configure the specified interface statically.
|
||||
|
||||
**-a** _<acpi_dsdt>::
|
||||
Attach compiled ACPI DSDT (Differentiated System Description Table)
|
||||
to initrd. This replaces the DSDT of the BIOS. Defaults to the
|
||||
_ACPI_DSDT_ variable in */etc/sysconfig/kernel*.
|
||||
|
||||
**-M** _<map>::
|
||||
System.map file to use.
|
||||
|
||||
**-B**::
|
||||
Don’t run the *update-bootloader(8)* script after the initrd(s) have
|
||||
been created. This is useful if you call mkinitrd(8) for anything
|
||||
else than the running system.
|
||||
|
||||
**-A**::
|
||||
Create a so called "monster initrd" which includes all available
|
||||
features and modules.
|
||||
|
||||
**-v, --verbose**::
|
||||
increase verbosity level
|
||||
|
||||
**-L**::
|
||||
Disable logging to _/var/log/YaST2/mkinitrd.log_. This is useful for
|
||||
testing if you don’t want to clutter the system log.
|
||||
|
||||
**--force**::
|
||||
overwrite existing initramfs file.
|
||||
|
||||
**--help**::
|
||||
print a help message and exit.
|
||||
|
||||
AVAILABILITY
|
||||
------------
|
||||
The mkinitrd command is part of the dracut package and is available from
|
||||
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]
|
||||
|
||||
AUTHORS
|
||||
-------
|
||||
Harald Hoyer, Hannes Reinecke
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
*dracut*(8)
|
||||
*update-bootloader*(8)
|
354
mkinitrd-suse.sh
354
mkinitrd-suse.sh
@@ -1,354 +0,0 @@
|
||||
#!/bin/bash --norc
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# mkinitrd compability wrapper for SUSE.
|
||||
#
|
||||
# Copyright (c) 2013 SUSE Linux Products GmbH. 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/>.
|
||||
#
|
||||
|
||||
boot_dir="/boot"
|
||||
quiet=0
|
||||
host_only=1
|
||||
force=0
|
||||
logfile=/var/log/YaST2/mkinitrd.log
|
||||
dracut_cmd=dracut
|
||||
|
||||
error() { echo "$@" >&2; }
|
||||
|
||||
usage () {
|
||||
[[ $1 = '-n' ]] && cmd=echo || cmd=error
|
||||
|
||||
$cmd "usage: ${0##*/} [options]"
|
||||
$cmd ""
|
||||
$cmd " Create initial ramdisk images that contain all kernel modules needed"
|
||||
$cmd " in the early boot process, before the root file system becomes"
|
||||
$cmd " available."
|
||||
$cmd " This usually includes SCSI and/or RAID modules, a file system module"
|
||||
$cmd " for the root file system, or a network interface driver module for dhcp."
|
||||
$cmd ""
|
||||
$cmd " options:"
|
||||
$cmd " -f \"feature list\" Features to be enabled when generating initrd."
|
||||
$cmd " Available features are:"
|
||||
$cmd " iscsi, md, multipath, lvm, lvm2,"
|
||||
$cmd " ifup, fcoe, dcbd"
|
||||
$cmd " -k \"kernel list\" List of kernel images for which initrd files are"
|
||||
$cmd " created. Defaults to all kernels found in /boot."
|
||||
$cmd " -i \"initrd list\" List of file names for the initrd; position have"
|
||||
$cmd " match to \"kernel list\". Defaults to all kernels"
|
||||
$cmd " found in /boot."
|
||||
$cmd " -b boot_dir Boot directory. Defaults to /boot."
|
||||
$cmd " -t tmp_dir Temporary directory. Defaults to /var/tmp."
|
||||
$cmd " -M map System.map file to use."
|
||||
$cmd " -A Create a so called \"monster initrd\" which"
|
||||
$cmd " includes all features and modules possible."
|
||||
$cmd " -B Do not update bootloader configuration."
|
||||
$cmd " -v Verbose mode."
|
||||
$cmd " -L Disable logging."
|
||||
$cmd " -h This help screen."
|
||||
$cmd " -m \"module list\" Modules to include in initrd. Defaults to the"
|
||||
$cmd " INITRD_MODULES variable in /etc/sysconfig/kernel"
|
||||
$cmd " -u \"DomU module list\" Modules to include in initrd. Defaults to the"
|
||||
$cmd " DOMU_INITRD_MODULES variable in"
|
||||
$cmd " /etc/sysconfig/kernel."
|
||||
$cmd " -d root_device Root device. Defaults to the device from"
|
||||
$cmd " which / is mounted. Overrides the rootdev"
|
||||
$cmd " enviroment variable if set."
|
||||
$cmd " -j device Journal device"
|
||||
$cmd " -D interface Run dhcp on the specified interface."
|
||||
$cmd " -I interface Configure the specified interface statically."
|
||||
$cmd " -a acpi_dsdt Attach compiled ACPI DSDT (Differentiated"
|
||||
$cmd " System Description Table) to initrd. This"
|
||||
$cmd " replaces the DSDT of the BIOS. Defaults to"
|
||||
$cmd " the ACPI_DSDT variable in /etc/sysconfig/kernel."
|
||||
$cmd " -s size Add splash animation and bootscreen to initrd."
|
||||
|
||||
[[ $1 = '-n' ]] && exit 0
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Little helper function for reading args from the commandline.
|
||||
# it automatically handles -a b and -a=b variants, and returns 1 if
|
||||
# we need to shift $3.
|
||||
read_arg() {
|
||||
# $1 = arg name
|
||||
# $2 = arg value
|
||||
# $3 = arg parameter
|
||||
param="$1"
|
||||
local rematch='^[^=]*=(.*)$' result
|
||||
if [[ $2 =~ $rematch ]]; then
|
||||
read "$param" <<< "${BASH_REMATCH[1]}"
|
||||
else
|
||||
for ((i=3; $i <= $#; i++)); do
|
||||
# Only read next arg if it not an arg itself.
|
||||
if [[ ${@:$i:1} = -* ]];then
|
||||
break
|
||||
fi
|
||||
result="$result ${@:$i:1}"
|
||||
# There is no way to shift our callers args, so
|
||||
# return "no of args" to indicate they should do it instead.
|
||||
done
|
||||
read "$1" <<< "$result"
|
||||
return $(($i - 3))
|
||||
fi
|
||||
}
|
||||
|
||||
# Helper functions to calculate ipconfig command line
|
||||
calc_netmask() {
|
||||
local prefix=$1
|
||||
|
||||
[ -z "$prefix" ] && return
|
||||
mask=$(echo "(2 ^ 32) - (2 ^ $prefix)" | bc -l)
|
||||
byte1=$(( mask >> 24 ))
|
||||
byte2=$(( mask >> 16 ))
|
||||
byte3=$(( mask >> 8 ))
|
||||
byte4=$(( mask & 0xff ))
|
||||
netmask=$(printf "%d.%d.%d.%d" $(( byte1 & 0xff )) $(( byte2 & 0xff )) $(( byte3 & 0xff )) $byte4);
|
||||
|
||||
echo $netmask
|
||||
}
|
||||
|
||||
ipconfig() {
|
||||
local interface=$1
|
||||
local iplink macaddr broadcast gateway ipaddr prefix netmask
|
||||
|
||||
iplink=$(ip addr show dev $interface | sed -n 's/ *inet \(.*\) brd.*/\1/p')
|
||||
macaddr=$(ip addr show dev $interface | sed -n 's/.*ether \(.*\) brd.*/\1/p')
|
||||
broadcast=$(ip addr show dev $interface | sed -n 's/.*brd \(.*\) scope.*/\1/p')
|
||||
gateway=$(ip route show dev $interface | sed -n 's/default via \([0-9\.]*\).*/\1/p')
|
||||
|
||||
ipaddr=${iplink%%/*}
|
||||
prefix=${iplink##*/}
|
||||
netmask=$(calc_netmask $prefix)
|
||||
|
||||
echo "${ipaddr}:${serveraddr}:${gateway}:${netmask}:${hostname}:${interface}:none::${macaddr}"
|
||||
}
|
||||
|
||||
is_xen_kernel() {
|
||||
local kversion=$1
|
||||
local root_dir=$2
|
||||
local cfg
|
||||
|
||||
for cfg in ${root_dir}/boot/config-$kversion $root_dir/lib/modules/$kversion/build/.config
|
||||
do
|
||||
test -r $cfg || continue
|
||||
grep -q "^CONFIG_XEN=y\$" $cfg
|
||||
return
|
||||
done
|
||||
test $kversion != "${kversion%-xen*}"
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
# Taken over from SUSE mkinitrd
|
||||
default_kernel_images() {
|
||||
local regex kernel_image kernel_version version_version initrd_image
|
||||
local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
|
||||
|
||||
case "$(uname -m)" in
|
||||
s390|s390x)
|
||||
regex='image'
|
||||
;;
|
||||
ppc|ppc64)
|
||||
regex='vmlinux'
|
||||
;;
|
||||
i386|x86_64)
|
||||
regex='vmlinuz'
|
||||
;;
|
||||
arm*)
|
||||
regex='[uz]Image'
|
||||
;;
|
||||
aarch64)
|
||||
regex='Image'
|
||||
;;
|
||||
*) regex='vmlinu.'
|
||||
;;
|
||||
esac
|
||||
|
||||
kernel_images=""
|
||||
initrd_images=""
|
||||
for kernel_image in $(ls $boot_dir \
|
||||
| sed -ne "\|^$regex\(-[0-9.]\+-[0-9]\+-[a-z0-9]\+$\)\?|p" \
|
||||
| grep -v kdump$ ) ; do
|
||||
|
||||
# Note that we cannot check the RPM database here -- this
|
||||
# script is itself called from within the binary kernel
|
||||
# packages, and rpm does not allow recursive calls.
|
||||
|
||||
[ -L "$boot_dir/$kernel_image" ] && continue
|
||||
[ "${kernel_image%%.gz}" != "$kernel_image" ] && continue
|
||||
kernel_version=$(/usr/bin/get_kernel_version \
|
||||
$boot_dir/$kernel_image 2> /dev/null)
|
||||
initrd_image=$(echo $kernel_image | sed -e "s|${regex}|initrd|")
|
||||
if [ "$kernel_image" != "$initrd_image" -a \
|
||||
-n "$kernel_version" -a \
|
||||
-d "/lib/modules/$kernel_version" ]; then
|
||||
kernel_images="$kernel_images $boot_dir/$kernel_image"
|
||||
initrd_images="$initrd_images $boot_dir/$initrd_image"
|
||||
fi
|
||||
done
|
||||
for kernel_image in $kernel_images;do
|
||||
kernels="$kernels ${kernel_image#*-}"
|
||||
done
|
||||
for initrd_image in $initrd_images;do
|
||||
targets="$targets $initrd_image"
|
||||
done
|
||||
host_only=1
|
||||
force=1
|
||||
}
|
||||
|
||||
while (($# > 0)); do
|
||||
case ${1%%=*} in
|
||||
-f) read_arg feature_list "$@" || shift $?
|
||||
# Could be several features
|
||||
;;
|
||||
-k) # Would be nice to get a list of images here
|
||||
read_arg kernel_images "$@" || shift $?
|
||||
for kernel_image in $kernel_images;do
|
||||
kernels="$kernels ${kernel_image#*-}"
|
||||
done
|
||||
host_only=1
|
||||
force=1
|
||||
;;
|
||||
-i) read_arg initrd_images "$@" || shift $?
|
||||
for initrd_image in $initrd_images;do
|
||||
# Check if the initrd_image contains a path.
|
||||
# if not, then add the default boot_dir
|
||||
dname=`dirname $initrd_image`
|
||||
if [ "$dname" == "." ]; then
|
||||
targets="$targets $boot_dir/$initrd_image";
|
||||
else
|
||||
targets="$targets $initrd_image";
|
||||
fi
|
||||
done
|
||||
;;
|
||||
-b) read_arg boot_dir "$@" || shift $?
|
||||
if [ ! -d $boot_dir ];then
|
||||
error "Boot directory $boot_dir does not exist"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-t) read_arg tmp_dir "$@" || shift $?
|
||||
dracut_args="${dracut_args} --tmpdir $tmp_dir"
|
||||
;;
|
||||
-M) read_arg map_file "$@" || shift $?
|
||||
;;
|
||||
-A) host_only=0;;
|
||||
-B) skip_update_bootloader=1;;
|
||||
-v|--verbose) dracut_args="${dracut_args} -v";;
|
||||
-L) logfile=;;
|
||||
-h|--help) usage -n;;
|
||||
-m) read_arg module_list "$@" || shift $? ;;
|
||||
-u) read_arg domu_module_list "$@" || shift $?
|
||||
echo "mkinitrd: DomU modules not yet supported" ;;
|
||||
-d) read_arg rootfs "$@" || shift $?
|
||||
dracut_args="${dracut_args} --filesystems $rootfs" ;;
|
||||
-D) read_arg dhcp_if "$@" || shift $?
|
||||
dracut_cmdline="${dracut_cmdline} ip=${dhcp_if}:dhcp"
|
||||
;;
|
||||
-I) read_arg static_if "$@" || shift $?
|
||||
dracut_cmdline="${dracut_cmdline} ip=$(ipconfig $static_if)":
|
||||
;;
|
||||
-a) read_arg acpi_dsdt "$@" || shift $?
|
||||
echo "mkinitrd: custom DSDT not yet supported"
|
||||
exit 1
|
||||
;;
|
||||
-s) read_arg boot_splash "$@" || shift $?
|
||||
echo "mkinitrd: boot splash not yet supported"
|
||||
exit 1
|
||||
;;
|
||||
-V) echo "mkinitrd: vendor scipts are no longer supported"
|
||||
exit 1;;
|
||||
--dracut)
|
||||
read_arg dracut_cmd "$@" || shift $? ;;
|
||||
--version|-R)
|
||||
echo "mkinitrd: dracut compatibility wrapper"
|
||||
exit 0;;
|
||||
--force) force=1;;
|
||||
--quiet|-q) quiet=1;;
|
||||
*) if [[ ! $targets ]]; then
|
||||
targets=$1
|
||||
elif [[ ! $kernels ]]; then
|
||||
kernels=$1
|
||||
else
|
||||
usage
|
||||
fi;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
[[ $targets && $kernels ]] || default_kernel_images
|
||||
[[ $targets && $kernels ]] || (error "No kernel found in $boot_dir" && usage)
|
||||
|
||||
# We can have several targets/kernels, transform the list to an array
|
||||
targets=( $targets )
|
||||
[[ $kernels ]] && kernels=( $kernels )
|
||||
|
||||
[[ $logfile ]] && dracut_args="${dracut_args} --logfile $logfile"
|
||||
[[ $host_only == 1 ]] && dracut_args="${dracut_args} --hostonly"
|
||||
[[ $force == 1 ]] && dracut_args="${dracut_args} --force"
|
||||
[[ $dracut_cmdline ]] && dracut_args="${dracut_args} --kernel-cmdline ${dracut_cmdline}"
|
||||
[ -z "$(type -p update-bootloader)" ] && skip_update_bootloader=1
|
||||
|
||||
# Update defaults from /etc/sysconfig/kernel
|
||||
if [ -f /etc/sysconfig/kernel ] ; then
|
||||
. /etc/sysconfig/kernel
|
||||
fi
|
||||
[[ $module_list ]] || module_list="${INITRD_MODULES}"
|
||||
basicmodules="$basicmodules ${module_list}"
|
||||
[[ $domu_module_list ]] || domu_module_list="${DOMU_INITRD_MODULES}"
|
||||
[[ $acpi_dsdt ]] || acpi_dsdt="${ACPI_DSDT}"
|
||||
|
||||
echo "Creating: target|kernel|dracut args|basicmodules "
|
||||
for ((i=0 ; $i<${#targets[@]} ; i++)); do
|
||||
|
||||
if [[ $img_vers ]];then
|
||||
target="${targets[$i]}-${kernels[$i]}"
|
||||
else
|
||||
target="${targets[$i]}"
|
||||
fi
|
||||
kernel="${kernels[$i]}"
|
||||
|
||||
# Duplicate code: No way found how to redirect output based on $quiet
|
||||
if [[ $quiet == 1 ]];then
|
||||
echo "$target|$kernel|$dracut_args|$basicmodules"
|
||||
if is_xen_kernel $kernel $rootfs ; then
|
||||
basicmodules="$basicmodules ${domu_module_list}"
|
||||
fi
|
||||
if [[ $basicmodules ]]; then
|
||||
$dracut_cmd $dracut_args --add-drivers "$basicmodules" "$target" \
|
||||
"$kernel" &>/dev/null
|
||||
else
|
||||
$dracut_cmd $dracut_args "$target" "$kernel" &>/dev/null
|
||||
fi
|
||||
else
|
||||
if is_xen_kernel $kernel $rootfs ; then
|
||||
basicmodules="$basicmodules ${domu_module_list}"
|
||||
fi
|
||||
if [[ $basicmodules ]]; then
|
||||
$dracut_cmd $dracut_args --add-drivers "$basicmodules" "$target" \
|
||||
"$kernel"
|
||||
else
|
||||
$dracut_cmd $dracut_args "$target" "$kernel"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$skip_update_bootloader" ] ; then
|
||||
echo 2>&1 "Did not refresh the bootloader. You might need to refresh it manually."
|
||||
else
|
||||
update-bootloader --refresh
|
||||
fi
|
@@ -2,17 +2,14 @@
|
||||
# -*- 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() {
|
||||
[ -x /bin/bash ]
|
||||
require_binaries /bin/bash
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
# If another shell is already installed, do not use bash
|
||||
[[ -x $initdir/bin/sh ]] && return
|
||||
|
@@ -2,19 +2,16 @@
|
||||
# -*- 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() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
[ -x /sbin/bootchartd ] || return 1
|
||||
require_binaries /sbin/bootchartd || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_symlink /init /sbin/init
|
||||
inst_dir /lib/bootchart/tmpfs
|
||||
|
@@ -2,17 +2,14 @@
|
||||
# -*- 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() {
|
||||
[ -x /bin/dash ]
|
||||
require_binaries /bin/dash
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
# If another shell is already installed, do not use dash
|
||||
[[ -x $initdir/bin/sh ]] && return
|
||||
|
@@ -2,19 +2,16 @@
|
||||
# -*- 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() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
[ -x $systemdutildir/systemd-bootchart ] || return 1
|
||||
require_binaries $systemdutildir/systemd-bootchart || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_symlink /init /sbin/init
|
||||
inst_multiple $systemdutildir/systemd-bootchart
|
||||
|
@@ -2,23 +2,21 @@
|
||||
# -*- 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() {
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
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 "
|
||||
_fipsmodules+="chainiv crc32c crct10dif_generic cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod drbg "
|
||||
_fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 "
|
||||
_fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic "
|
||||
_fipsmodules+="aes_s390 des_s390 prng sha256_s390 sha_common des_check_key sha1_s390 sha512_s390"
|
||||
_fipsmodules+="sha384 sha512 sha512_generic tcrypt tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib"
|
||||
|
||||
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
|
||||
@@ -31,7 +29,6 @@ installkernel() {
|
||||
done
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _dir
|
||||
inst_hook pre-trigger 01 "$moddir/fips-boot.sh"
|
||||
@@ -42,7 +39,8 @@ install() {
|
||||
|
||||
inst_libdir_file libsoftokn3.so libsoftokn3.so \
|
||||
libsoftokn3.chk libfreebl3.so libfreebl3.chk \
|
||||
libssl.so 'hmaccalc/sha512hmac.hmac' libssl.so.10
|
||||
libssl.so 'hmaccalc/sha512hmac.hmac' libssl.so.10 \
|
||||
libfreeblpriv3.so libfreeblpriv3.chk
|
||||
|
||||
inst_multiple -o prelink
|
||||
inst_simple /etc/system-fips
|
||||
|
@@ -2,21 +2,22 @@
|
||||
# -*- 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 capsh >/dev/null 2>&1
|
||||
require_binaries capsh
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
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
|
||||
}
|
||||
|
||||
|
@@ -2,17 +2,14 @@
|
||||
# -*- 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() {
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
local _fipsmodules _mod
|
||||
_fipsmodules="aesni-intel ghash_clmulni_intel"
|
||||
@@ -27,7 +24,6 @@ installkernel() {
|
||||
done
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
return 0
|
||||
}
|
||||
|
@@ -7,9 +7,8 @@
|
||||
# Copyright 2013 Red Hat, Inc.
|
||||
# Peter Jones <pjones@redhat.com>
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
[[ -x /usr/bin/keyctl ]] || return 1
|
||||
require_binaries keyctl || return 1
|
||||
|
||||
# do not include module in hostonly mode,
|
||||
# if no keys are present
|
||||
@@ -21,12 +20,10 @@ check() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_dir /lib/modules/keys
|
||||
inst_binary /usr/bin/keyctl
|
||||
|
@@ -2,18 +2,15 @@
|
||||
# -*- 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() {
|
||||
# do not add this module by default
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple -o ps grep more cat rm strace free showmount \
|
||||
ping netstat rpcinfo vi scp ping6 ssh \
|
||||
|
@@ -2,17 +2,14 @@
|
||||
# -*- 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() {
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_hook cmdline 00 "$moddir/watchdog.sh"
|
||||
inst_hook cmdline 50 "$moddir/watchdog.sh"
|
||||
|
@@ -2,19 +2,16 @@
|
||||
# -*- 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 busybox >/dev/null || return 1
|
||||
require_binaries busybox || return 1
|
||||
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _i _progs _path _busybox
|
||||
_busybox=$(type -P busybox)
|
||||
|
@@ -2,23 +2,18 @@
|
||||
# -*- 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() {
|
||||
[[ "$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
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
if dracut_module_included "systemd"; then
|
||||
unset FONT
|
||||
@@ -157,9 +152,6 @@ install() {
|
||||
# Gentoo user may have KEYMAP set to something like "-u pl2",
|
||||
KEYMAP=${KEYMAP#-* }
|
||||
|
||||
# openSUSE user may have KEYMAP set to something like ".gz"
|
||||
KEYMAP=${KEYMAP/.gz/}
|
||||
|
||||
# KEYTABLE is a bit special - it defines base keymap name and UNICODE
|
||||
# determines whether non-UNICODE or UNICODE version is used
|
||||
|
||||
@@ -249,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
|
||||
|
@@ -6,30 +6,37 @@ inst_key_val() {
|
||||
local _value
|
||||
local _file
|
||||
local _default
|
||||
_file="$1"; shift
|
||||
_key="$1"; shift
|
||||
_default="$1"; shift
|
||||
_value="$(getarg $@)"
|
||||
_default=$1
|
||||
shift
|
||||
_file=$1
|
||||
shift
|
||||
_value=$(getarg $@)
|
||||
[ -z "${_value}" ] && _value=$_default
|
||||
if [ -n "${_value}" ]; then
|
||||
printf '%s="%s"\n' $key ${_value} >> $_file
|
||||
printf '%s="%s"\n' $2 ${_value} >> $_file
|
||||
fi
|
||||
unset _file
|
||||
unset _value
|
||||
}
|
||||
|
||||
inst_key_val /etc/vconsole.conf KEYMAP '' rd.vconsole.keymap KEYMAP -d KEYTABLE
|
||||
inst_key_val /etc/vconsole.conf FONT '' rd.vconsole.font FONT -d SYSFONT
|
||||
inst_key_val /etc/vconsole.conf FONT_MAP '' rd.vconsole.font.map FONT_MAP -d CONTRANS
|
||||
inst_key_val /etc/vconsole.conf FONT_UNIMAP '' rd.vconsole.font.unimap FONT_UNIMAP -d UNIMAP
|
||||
inst_key_val /etc/vconsole.conf UNICODE 1 rd.vconsole.font.unicode UNICODE vconsole.unicode
|
||||
inst_key_val /etc/vconsole.conf EXT_KEYMAP '' rd.vconsole.keymap.ext EXT_KEYMAP
|
||||
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/locale.conf LANG '' rd.locale.LANG LANG
|
||||
inst_key_val /etc/locale.conf LC_ALL '' rd.locale.LC_ALL LC_ALL
|
||||
inst_key_val '' /etc/locale.conf locale.LANG LANG
|
||||
inst_key_val '' /etc/locale.conf 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
|
||||
|
@@ -2,18 +2,15 @@
|
||||
# -*- 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() {
|
||||
[[ $mount_needs ]] && return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple bash find ldconfig mv rm cp ln
|
||||
inst_hook pre-pivot 99 "$moddir/do-convertfs.sh"
|
||||
|
@@ -2,6 +2,14 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
|
||||
# We already need a set netif here
|
||||
netif=$interface
|
||||
|
||||
setup_interface() {
|
||||
ip=$new_ip_address
|
||||
mtu=$new_interface_mtu
|
||||
@@ -12,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
|
||||
|
||||
@@ -30,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 add 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
|
||||
@@ -48,24 +66,47 @@ setup_interface() {
|
||||
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
}
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
setup_interface6() {
|
||||
domain=$new_domain_name
|
||||
search=$(printf -- "$new_domain_search")
|
||||
namesrv=$new_domain_name_servers
|
||||
hostname=$new_host_name
|
||||
[ -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
|
||||
|
||||
export PS4="dhclient.$interface.$$ + "
|
||||
[ -e /run/initramfs/loginit.pipe ] && 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
|
||||
[ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override
|
||||
|
||||
# We already need a set netif here
|
||||
netif=$interface
|
||||
ip -6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \
|
||||
dev ${netif} scope global \
|
||||
${lease_time:+valid_lft $lease_time} \
|
||||
${preferred_lft:+preferred_lft ${preferred_lft}}
|
||||
|
||||
# Huh? Interface configured?
|
||||
[ -f "/tmp/net.$netif.up" ] && exit 0
|
||||
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
|
||||
if [ -n "$namesrv" ] ; then
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
done
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
|
||||
# Note: hostname can be fqdn OR short hostname, so chop off any
|
||||
# trailing domain name and explicity add any domain if set.
|
||||
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
}
|
||||
|
||||
case $reason in
|
||||
PREINIT)
|
||||
echo "dhcp: PREINIT $netif up"
|
||||
linkup $netif
|
||||
;;
|
||||
|
||||
PREINIT6)
|
||||
echo "dhcp: PREINIT6 $netif up"
|
||||
linkup $netif
|
||||
wait_for_ipv6_dad $netif
|
||||
;;
|
||||
|
||||
BOUND)
|
||||
echo "dhcp: BOND setting $netif"
|
||||
unset layer2
|
||||
@@ -73,7 +114,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
|
||||
@@ -90,14 +131,63 @@ case $reason in
|
||||
echo "setup_net $netif"
|
||||
echo "source_hook initqueue/online $netif"
|
||||
[ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
|
||||
echo "> /tmp/setup_net_$netif.ok"
|
||||
echo "> /tmp/setup_net_\$(cat /sys/class/net/$netif/address).ok"
|
||||
echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh"
|
||||
} > $hookdir/initqueue/setup_net_$netif.sh
|
||||
|
||||
echo "[ -f /tmp/setup_net_$netif.ok ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
|
||||
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)
|
||||
echo "dhcp: BOND6 setting $netif"
|
||||
setup_interface6
|
||||
|
||||
set | while read line; do
|
||||
[ "${line#new_}" = "$line" ] && continue
|
||||
echo "$line"
|
||||
done >/tmp/dhclient.$netif.dhcpopts
|
||||
|
||||
{
|
||||
echo '. /lib/net-lib.sh'
|
||||
echo "setup_net $netif"
|
||||
echo "source_hook initqueue/online $netif"
|
||||
[ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
|
||||
echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh"
|
||||
} > $hookdir/initqueue/setup_net_$netif.sh
|
||||
|
||||
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
|
||||
|
||||
|
@@ -34,14 +34,17 @@ for i in /tmp/bond.*.info; do
|
||||
done
|
||||
done
|
||||
|
||||
if [ -e /tmp/team.info ]; then
|
||||
. /tmp/team.info
|
||||
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
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -e /tmp/vlan.info ]; then
|
||||
. /tmp/vlan.info
|
||||
@@ -60,7 +63,7 @@ fi
|
||||
# bridge this interface?
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
for ethname in $ethnames ; do
|
||||
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)
|
||||
@@ -79,24 +82,53 @@ 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
|
||||
[ -n "$manualup" ] && >/tmp/net.$netif.manualup
|
||||
|
||||
if [ -n "$manualup" ]; then
|
||||
>/tmp/net.$netif.manualup
|
||||
rm -f /tmp/net.${netif}.did-setup
|
||||
else
|
||||
[ -e /tmp/net.${netif}.did-setup ] && exit 0
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
[ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && exit 0
|
||||
fi
|
||||
|
||||
# Run dhclient
|
||||
do_dhcp() {
|
||||
# dhclient-script will mark the netif up and generate the online
|
||||
# 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"
|
||||
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"
|
||||
|
||||
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() {
|
||||
[ -d /proc/sys/net/ipv6 ] && return
|
||||
modprobe ipv6
|
||||
i=0
|
||||
while [ ! -d /proc/sys/net/ipv6 ]; do
|
||||
@@ -123,21 +155,38 @@ do_ipv6auto() {
|
||||
do_static() {
|
||||
strstr $ip '*:*:*' && load_ipv6
|
||||
|
||||
linkup $netif
|
||||
if ! 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
|
||||
# note no ip addr flush for ipv6
|
||||
ip addr add $ip/$mask ${srv:+peer $srv} dev $netif
|
||||
wait_for_ipv6_dad $netif
|
||||
else
|
||||
if ! arping -f -q -D -c 2 -I $netif $ip; then
|
||||
warn "Duplicate address detected for $ip for interface $netif."
|
||||
return 1
|
||||
fi
|
||||
ip addr flush dev $netif
|
||||
ip addr add $ip/$mask ${srv:+peer $srv} brd + dev $netif
|
||||
fi
|
||||
|
||||
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
[ -n "$gw" ] && echo ip route replace default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
|
||||
> /tmp/setup_net_${netif}.ok
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -179,6 +228,7 @@ if [ -e /tmp/bond.${netif}.info ]; then
|
||||
|
||||
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
|
||||
@@ -194,26 +244,44 @@ if [ -e /tmp/bond.${netif}.info ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e /tmp/team.info ]; then
|
||||
. /tmp/team.info
|
||||
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
|
||||
ip link set $slave up 2>/dev/null
|
||||
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 -t $teammaster -f /etc/teamd/$teammaster.conf
|
||||
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
|
||||
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 $teammaster up
|
||||
ip link set dev $teammaster up
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -225,7 +293,7 @@ if [ -e /tmp/bridge.info ]; then
|
||||
if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
|
||||
brctl addbr $bridgename
|
||||
brctl setfd $bridgename 0
|
||||
for ethname in $ethnames ; do
|
||||
for ethname in $bridgeslaves ; do
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
DO_BOND_SETUP=yes ifup $bondname -m
|
||||
elif [ "$ethname" = "$teammaster" ] ; then
|
||||
@@ -264,18 +332,15 @@ if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
|
||||
ip link set "$vlanname" up
|
||||
fi
|
||||
|
||||
# setup nameserver
|
||||
namesrv=$(getargs nameserver)
|
||||
if [ -n "$namesrv" ] ; then
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
done
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
|
||||
# No ip lines default to dhcp
|
||||
ip=$(getarg ip)
|
||||
|
||||
if [ -z "$ip" ]; then
|
||||
for s in $(getargs nameserver); do
|
||||
[ -n "$s" ] || continue
|
||||
echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
||||
done
|
||||
|
||||
if [ "$netroot" = "dhcp6" ]; then
|
||||
do_dhcp -6
|
||||
else
|
||||
@@ -307,27 +372,43 @@ for p in $(getargs ip=); do
|
||||
[ "$use_bridge" != 'true' ] && \
|
||||
[ "$use_vlan" != 'true' ] && continue
|
||||
|
||||
# setup nameserver
|
||||
for s in "$dns1" "$dns2" $(getargs nameserver); do
|
||||
[ -n "$s" ] || continue
|
||||
echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
||||
done
|
||||
|
||||
# Store config for later use
|
||||
for i in ip srv gw mask hostname macaddr; do
|
||||
for i in ip srv gw mask hostname macaddr dns1 dns2; do
|
||||
eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
|
||||
done > /tmp/net.$netif.override
|
||||
|
||||
case $autoconf in
|
||||
dhcp|on|any)
|
||||
do_dhcp -4 ;;
|
||||
dhcp6)
|
||||
do_dhcp -6 ;;
|
||||
auto6)
|
||||
do_ipv6auto ;;
|
||||
*)
|
||||
do_static ;;
|
||||
esac
|
||||
for autoopt in $(str_replace "$autoconf" "," " "); do
|
||||
case $autoopt in
|
||||
dhcp|on|any)
|
||||
do_dhcp -4 ;;
|
||||
dhcp6)
|
||||
load_ipv6
|
||||
do_dhcp -6 ;;
|
||||
auto6)
|
||||
do_ipv6auto ;;
|
||||
*)
|
||||
do_static ;;
|
||||
esac
|
||||
done
|
||||
ret=$?
|
||||
|
||||
> /tmp/net.${netif}.up
|
||||
|
||||
if [ -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
|
||||
if [ $ret -eq 0 ]; then
|
||||
setup_net $netif
|
||||
source_hook initqueue/online $netif
|
||||
if [ -z "$manualup" ]; then
|
||||
@@ -348,8 +429,22 @@ 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/setup_net_${netif}.ok ]; then
|
||||
do_dhcp -4
|
||||
if [ ! -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
|
||||
if getargs 'ip=dhcp6'; then
|
||||
load_ipv6
|
||||
do_dhcp -6
|
||||
fi
|
||||
if getargs 'ip=dhcp'; then
|
||||
do_dhcp -4
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
@@ -2,26 +2,18 @@
|
||||
# -*- 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() {
|
||||
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
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
# Include wired net drivers, excluding wireless
|
||||
|
||||
@@ -72,9 +64,9 @@ 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
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _arch _i _dir
|
||||
inst_multiple ip arping dhclient sed
|
||||
@@ -99,6 +91,43 @@ install() {
|
||||
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
|
||||
inst_hook cleanup 10 "$moddir/kill-dhclient.sh"
|
||||
|
||||
# install all config files for teaming
|
||||
unset TEAM_MASTER
|
||||
unset TEAM_CONFIG
|
||||
unset TEAM_PORT_CONFIG
|
||||
unset HWADDR
|
||||
unset SUBCHANNELS
|
||||
for i in /etc/sysconfig/network-scripts/ifcfg-*; do
|
||||
[ -e "$i" ] || continue
|
||||
case "$i" in
|
||||
*~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
(
|
||||
. "$i"
|
||||
if ! [ "${ONBOOT}" = "no" -o "${ONBOOT}" = "NO" ] \
|
||||
&& [ -n "${TEAM_MASTER}${TEAM_CONFIG}${TEAM_PORT_CONFIG}" ]; then
|
||||
if [ -n "$TEAM_CONFIG" ] && [ -n "$DEVICE" ]; then
|
||||
mkdir -p $initdir/etc/teamd
|
||||
printf -- "%s" "$TEAM_CONFIG" > "$initdir/etc/teamd/${DEVICE}.conf"
|
||||
elif [ -n "$TEAM_PORT_CONFIG" ]; then
|
||||
inst_simple "$i"
|
||||
|
||||
HWADDR="$(echo $HWADDR | sed 'y/ABCDEF/abcdef/')"
|
||||
if [ -n "$HWADDR" ]; then
|
||||
ln_r "$i" "/etc/sysconfig/network-scripts/mac-${HWADDR}.conf"
|
||||
fi
|
||||
|
||||
SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
|
||||
if [ -n "$SUBCHANNELS" ]; then
|
||||
ln_r "$i" "/etc/sysconfig/network-scripts/ccw-${SUBCHANNELS}.conf"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
)
|
||||
done
|
||||
|
||||
_arch=$(uname -m)
|
||||
|
||||
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
|
||||
|
@@ -16,7 +16,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
# bridge: attempt only the defined interface
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
IFACES="$IFACES ${ethnames%% *}"
|
||||
IFACES="$IFACES ${bridgeslaves%% *}"
|
||||
MASTER_IFACES="$MASTER_IFACES $bridgename"
|
||||
fi
|
||||
|
||||
@@ -31,11 +31,14 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
MASTER_IFACES="$MASTER_IFACES ${bondname}"
|
||||
done
|
||||
|
||||
if [ -e /tmp/team.info ]; then
|
||||
. /tmp/team.info
|
||||
for i in /tmp/team.*.info; do
|
||||
[ -e "$i" ] || continue
|
||||
unset teamslaves
|
||||
unset teammaster
|
||||
. "$i"
|
||||
IFACES="$IFACES ${teamslaves}"
|
||||
MASTER_IFACES="$MASTER_IFACES ${teammaster}"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -e /tmp/vlan.info ]; then
|
||||
. /tmp/vlan.info
|
||||
@@ -52,7 +55,6 @@ 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\""
|
||||
|
||||
@@ -89,7 +91,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
for iface in $wait_ifaces; do
|
||||
if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
|
||||
echo "[ -f /tmp/setup_net_${iface}.ok ]" >$hookdir/initqueue/finished/wait-$iface.sh
|
||||
echo "[ -f /tmp/net.${iface}.did-setup ]" >$hookdir/initqueue/finished/wait-$iface.sh
|
||||
fi
|
||||
done
|
||||
# Default: We don't know the interface to use, handle all
|
||||
|
@@ -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,22 +102,41 @@ ifdown() {
|
||||
ip addr flush dev $netif
|
||||
echo "#empty" > /etc/resolv.conf
|
||||
rm -f -- /tmp/net.$netif.did-setup
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
rm -f -- /tmp/net.$(cat /sys/class/net/$netif/address).did-setup
|
||||
# TODO: send "offline" uevent?
|
||||
}
|
||||
|
||||
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 ] && \
|
||||
[ -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
|
||||
[ -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
|
||||
printf -- "%s\n" "$route_mask ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}" \
|
||||
> /tmp/net.route6."$netif"
|
||||
else
|
||||
printf -- "%s\n" "$route_mask ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}" \
|
||||
> /tmp/net.route."$netif"
|
||||
fi
|
||||
done
|
||||
|
||||
# Handle STP Timeout: arping the default gateway.
|
||||
# (or the root server, if a) it's local or b) there's no gateway.)
|
||||
@@ -123,12 +162,14 @@ setup_net() {
|
||||
read layer2 < /sys/class/net/$netif/device/layer2
|
||||
fi
|
||||
|
||||
if [ "$layer2" != "0" ] && [ -n "$dest" ] && ! arping -q -f -w 60 -I $netif $dest ; then
|
||||
info "Resolving $dest via ARP on $netif failed"
|
||||
if [ "$layer2" != "0" ] && [ -n "$dest" ] && ! strstr "$dest" ":"; then
|
||||
arping -q -f -w 60 -I $netif $dest || info "Resolving $dest via ARP on $netif failed"
|
||||
fi
|
||||
unset layer2
|
||||
|
||||
> /tmp/net.$netif.did-setup
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
> /tmp/net.$(cat /sys/class/net/$netif/address).did-setup
|
||||
}
|
||||
|
||||
save_netinfo() {
|
||||
@@ -185,6 +226,7 @@ ibft_to_cmdline() {
|
||||
for iface in /sys/firmware/ibft/ethernet*; do
|
||||
local mac="" dev=""
|
||||
local dhcp="" ip="" gw="" mask="" hostname=""
|
||||
local dns1 dns2
|
||||
|
||||
[ -e ${iface}/mac ] || continue
|
||||
mac=$(read a < ${iface}/mac; echo $a)
|
||||
@@ -202,10 +244,15 @@ ibft_to_cmdline() {
|
||||
# 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}/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 [ -n "$ip" ] && [ -n "$mask" ]; then
|
||||
echo "ip=$ip::$gw:$mask:$hostname:$dev:none"
|
||||
echo "ip=$ip::$gw:$mask:$hostname:$dev:none${dns1:+:$dns1}${dns2:+:$dns2}"
|
||||
else
|
||||
warn "${iface} does not contain a valid iBFT configuration"
|
||||
warn "ip-addr=$ip"
|
||||
@@ -224,15 +271,20 @@ ibft_to_cmdline() {
|
||||
case "$vlan" in
|
||||
[0-9]*)
|
||||
echo "vlan=$dev.$vlan:$dev"
|
||||
echo $mac > /tmp/net.${dev}.${vlan}.has_ibft_config
|
||||
;;
|
||||
*)
|
||||
echo "vlan=$vlan:$dev"
|
||||
echo $mac > /tmp/net.${vlan}.has_ibft_config
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo $mac > /tmp/net.${dev}.has_ibft_config
|
||||
fi
|
||||
else
|
||||
echo $mac > /tmp/net.${dev}.has_ibft_config
|
||||
fi
|
||||
|
||||
echo $mac > /tmp/net.${dev}.has_ibft_config
|
||||
done
|
||||
) >> /etc/cmdline.d/40-ibft.conf
|
||||
}
|
||||
@@ -242,66 +294,63 @@ parse_iscsi_root()
|
||||
local v
|
||||
v=${1#iscsi:}
|
||||
|
||||
# extract authentication info
|
||||
# extract authentication info
|
||||
case "$v" in
|
||||
*@*:*:*:*:*)
|
||||
authinfo=${v%%@*}
|
||||
v=${v#*@}
|
||||
# allow empty authinfo to allow having an @ in iscsi_target_name like this:
|
||||
# netroot=iscsi:@192.168.1.100::3260::iqn.2009-01.com.example:testdi@sk
|
||||
if [ -n "$authinfo" ]; then
|
||||
OLDIFS="$IFS"
|
||||
IFS=:
|
||||
set $authinfo
|
||||
IFS="$OLDIFS"
|
||||
if [ $# -gt 4 ]; then
|
||||
warn "Wrong authentication info in iscsi: parameter!"
|
||||
return 1
|
||||
fi
|
||||
iscsi_username=$1
|
||||
iscsi_password=$2
|
||||
if [ $# -gt 2 ]; then
|
||||
iscsi_in_username=$3
|
||||
iscsi_in_password=$4
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*@*:*:*:*:*)
|
||||
authinfo=${v%%@*}
|
||||
v=${v#*@}
|
||||
# allow empty authinfo to allow having an @ in iscsi_target_name like this:
|
||||
# netroot=iscsi:@192.168.1.100::3260::iqn.2009-01.com.example:testdi@sk
|
||||
if [ -n "$authinfo" ]; then
|
||||
OLDIFS="$IFS"
|
||||
IFS=:
|
||||
set $authinfo
|
||||
IFS="$OLDIFS"
|
||||
if [ $# -gt 4 ]; then
|
||||
warn "Wrong authentication info in iscsi: parameter!"
|
||||
return 1
|
||||
fi
|
||||
iscsi_username=$1
|
||||
iscsi_password=$2
|
||||
if [ $# -gt 2 ]; then
|
||||
iscsi_in_username=$3
|
||||
iscsi_in_password=$4
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# extract target ip
|
||||
# extract target ip
|
||||
case "$v" in
|
||||
[[]*[]]:*)
|
||||
iscsi_target_ip=${v#[[]}
|
||||
iscsi_target_ip=${iscsi_target_ip%%[]]*}
|
||||
v=${v#[[]$iscsi_target_ip[]]:}
|
||||
;;
|
||||
*)
|
||||
iscsi_target_ip=${v%%[:]*}
|
||||
v=${v#$iscsi_target_ip:}
|
||||
;;
|
||||
[[]*[]]:*)
|
||||
iscsi_target_ip=${v#[[]}
|
||||
iscsi_target_ip=${iscsi_target_ip%%[]]*}
|
||||
v=${v#[[]$iscsi_target_ip[]]:}
|
||||
;;
|
||||
*)
|
||||
iscsi_target_ip=${v%%[:]*}
|
||||
v=${v#$iscsi_target_ip:}
|
||||
;;
|
||||
esac
|
||||
|
||||
# extract target name
|
||||
unset iscsi_target_name
|
||||
# extract target name
|
||||
case "$v" in
|
||||
*:iqn.*)
|
||||
iscsi_target_name=iqn.${v##*:iqn.}
|
||||
v=${v%:iqn.*}:
|
||||
;;
|
||||
*:eui.*)
|
||||
iscsi_target_name=iqn.${v##*:eui.}
|
||||
v=${v%:iqn.*}:
|
||||
;;
|
||||
*:naa.*)
|
||||
iscsi_target_name=iqn.${v##*:naa.}
|
||||
v=${v%:iqn.*}:
|
||||
;;
|
||||
*)
|
||||
warn "Invalid iscii target name, should begin with 'iqn.' or 'eui.' or 'naa.'"
|
||||
return 1
|
||||
;;
|
||||
*:iqn.*)
|
||||
iscsi_target_name=iqn.${v##*:iqn.}
|
||||
v=${v%:iqn.*}:
|
||||
;;
|
||||
*:eui.*)
|
||||
iscsi_target_name=eui.${v##*:eui.}
|
||||
v=${v%:eui.*}:
|
||||
;;
|
||||
*:naa.*)
|
||||
iscsi_target_name=naa.${v##*:naa.}
|
||||
v=${v%:naa.*}:
|
||||
;;
|
||||
esac
|
||||
|
||||
# parse the rest
|
||||
# parse the rest
|
||||
OLDIFS="$IFS"
|
||||
IFS=:
|
||||
set $v
|
||||
@@ -309,17 +358,34 @@ parse_iscsi_root()
|
||||
|
||||
iscsi_protocol=$1; shift # ignored
|
||||
iscsi_target_port=$1; shift
|
||||
if [ $# -eq 3 ]; then
|
||||
iscsi_iface_name=$1; shift
|
||||
|
||||
if [ -n "$iscsi_target_name" ]; then
|
||||
if [ $# -eq 3 ]; then
|
||||
iscsi_iface_name=$1; shift
|
||||
fi
|
||||
if [ $# -eq 2 ]; then
|
||||
iscsi_netdev_name=$1; shift
|
||||
fi
|
||||
iscsi_lun=$1; shift
|
||||
if [ $# -ne 0 ]; then
|
||||
warn "Invalid parameter in iscsi: parameter!"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
if [ $# -eq 2 ]; then
|
||||
iscsi_netdev_name=$1; shift
|
||||
|
||||
|
||||
if [ $# -gt 3 ] && [ -n "$1$2" ]; then
|
||||
if [ -z "$3" ] || [ "$3" -ge 0 ] 2>/dev/null ; then
|
||||
iscsi_iface_name=$1; shift
|
||||
iscsi_netdev_name=$1; shift
|
||||
fi
|
||||
fi
|
||||
|
||||
iscsi_lun=$1; shift
|
||||
if [ $# -ne 0 ]; then
|
||||
warn "Invalid parameter in iscsi: parameter!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
iscsi_target_name=$(printf "%s:" "$@")
|
||||
iscsi_target_name=${iscsi_target_name%:}
|
||||
}
|
||||
|
||||
ip_to_var() {
|
||||
@@ -339,7 +405,7 @@ ip_to_var() {
|
||||
fi
|
||||
done
|
||||
|
||||
unset ip srv gw mask hostname dev autoconf macaddr mtu
|
||||
unset ip srv gw mask hostname dev autoconf macaddr mtu dns1 dns2
|
||||
case $# in
|
||||
0) autoconf="error" ;;
|
||||
1) autoconf=$1 ;;
|
||||
@@ -347,11 +413,22 @@ ip_to_var() {
|
||||
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; [ -n "$8" ] && 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
|
||||
;;
|
||||
[ -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:
|
||||
@@ -375,6 +452,33 @@ ip_to_var() {
|
||||
fi
|
||||
}
|
||||
|
||||
route_to_var() {
|
||||
local v=${1}:
|
||||
local i
|
||||
set --
|
||||
while [ -n "$v" ]; do
|
||||
if [ "${v#\[*:*:*\]:}" != "$v" ]; then
|
||||
# handle IPv6 address
|
||||
i="${v%%\]:*}"
|
||||
i="${i##\[}"
|
||||
set -- "$@" "$i"
|
||||
v=${v#\[$i\]:}
|
||||
else
|
||||
set -- "$@" "${v%%:*}"
|
||||
v=${v#*:}
|
||||
fi
|
||||
done
|
||||
|
||||
unset route_mask route_gw route_dev
|
||||
case $# in
|
||||
2) [ -n "$1" ] && route_mask="$1"; [ -n "$2" ] && route_gw="$2"
|
||||
return 0;;
|
||||
3) [ -n "$1" ] && route_mask="$1"; [ -n "$2" ] && route_gw="$2"; [ -n "$3" ] && route_dev="$3"
|
||||
return 0;;
|
||||
*) return 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
parse_ifname_opts() {
|
||||
local IFS=:
|
||||
set $1
|
||||
@@ -405,7 +509,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
|
||||
@@ -417,9 +525,29 @@ 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 ! strstr "$li" "NO-CARRIER"; then
|
||||
if [ -n "$li" ]; then
|
||||
case "$li" in
|
||||
*\<UP*)
|
||||
return 0;;
|
||||
*\<*,UP\>*)
|
||||
return 0;;
|
||||
*\<*,UP,*\>*)
|
||||
return 0;;
|
||||
esac
|
||||
fi
|
||||
if strstr "$li" "LOWER_UP" \
|
||||
&& strstr "$li" "state UNKNOWN" \
|
||||
&& ! strstr "$li" "DORMANT"; then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
@@ -428,7 +556,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
|
||||
@@ -437,12 +569,34 @@ wait_for_route_ok() {
|
||||
return 1
|
||||
}
|
||||
|
||||
wait_for_ipv6_dad() {
|
||||
local cnt=0
|
||||
local li
|
||||
local timeout="$(getargs rd.net.timeout.ipv6dad=)"
|
||||
timeout=${timeout:-50}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
li=$(ip -6 addr show dev $1 scope link)
|
||||
strstr "$li" "tentative" || return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
wait_for_ipv6_auto() {
|
||||
local cnt=0
|
||||
local li
|
||||
while [ $cnt -lt 400 ]; do
|
||||
local timeout="$(getargs rd.net.timeout.ipv6auto=)"
|
||||
timeout=${timeout:-40}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
li=$(ip -6 addr show dev $1)
|
||||
strstr "$li" "dynamic" && return 0
|
||||
if ! strstr "$li" "tentative"; then
|
||||
strstr "$li" "dynamic" && return 0
|
||||
fi
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
@@ -461,13 +615,22 @@ hostname() {
|
||||
}
|
||||
|
||||
iface_has_link() {
|
||||
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:-5}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
linkup "$1"
|
||||
[ "$(cat $interface/carrier)" = 1 ] || return 1
|
||||
# XXX Do we need to reset the flags here? anaconda never bothered..
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ "$(cat $interface/carrier)" = 1 ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
find_iface_with_link() {
|
||||
@@ -482,3 +645,87 @@ find_iface_with_link() {
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
is_persistent_ethernet_name() {
|
||||
local _netif="$1"
|
||||
local _name_assign_type="0"
|
||||
|
||||
[ -f "/sys/class/net/$_netif/name_assign_type" ] \
|
||||
&& _name_assign_type=$(cat "/sys/class/net/$_netif/name_assign_type")
|
||||
|
||||
# NET_NAME_ENUM 1
|
||||
[ "$_name_assign_type" = "1" ] && return 1
|
||||
|
||||
# NET_NAME_PREDICTABLE 2
|
||||
[ "$_name_assign_type" = "2" ] && return 0
|
||||
|
||||
case "$_netif" in
|
||||
# udev persistent interface names
|
||||
eno[0-9]|eno[0-9][0-9]|eno[0-9][0-9][0-9]*)
|
||||
;;
|
||||
ens[0-9]|ens[0-9][0-9]|ens[0-9][0-9][0-9]*)
|
||||
;;
|
||||
enp[0-9]s[0-9]*|enp[0-9][0-9]s[0-9]*|enp[0-9][0-9][0-9]*s[0-9]*)
|
||||
;;
|
||||
enP*p[0-9]s[0-9]*|enP*p[0-9][0-9]s[0-9]*|enP*p[0-9][0-9][0-9]*s[0-9]*)
|
||||
;;
|
||||
# biosdevname
|
||||
em[0-9]|em[0-9][0-9]|em[0-9][0-9][0-9]*)
|
||||
;;
|
||||
p[0-9]p[0-9]*|p[0-9][0-9]p[0-9]*|p[0-9][0-9][0-9]*p[0-9]*)
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
|
||||
is_kernel_ethernet_name() {
|
||||
local _netif="$1"
|
||||
local _name_assign_type="1"
|
||||
|
||||
if [ -e "/sys/class/net/$_netif/name_assign_type" ]; then
|
||||
_name_assign_type=$(cat "/sys/class/net/$_netif/name_assign_type")
|
||||
|
||||
case "$_name_assign_type" in
|
||||
2|3|4)
|
||||
# NET_NAME_PREDICTABLE 2
|
||||
# NET_NAME_USER 3
|
||||
# NET_NAME_RENAMED 4
|
||||
return 1
|
||||
;;
|
||||
1|*)
|
||||
# NET_NAME_ENUM 1
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# fallback to error prone manual name check
|
||||
case "$_netif" in
|
||||
eth[0-9]|eth[0-9][0-9]|eth[0-9][0-9][0-9]*)
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
iface_get_subchannels() {
|
||||
local _netif
|
||||
local _subchannels
|
||||
|
||||
_netif="$1"
|
||||
|
||||
_subchannels=$({
|
||||
for i in /sys/class/net/$_netif/device/cdev[0-9]*; do
|
||||
[ -e $i ] || continue
|
||||
channel=$(readlink -f $i)
|
||||
printf -- "%s" "${channel##*/},"
|
||||
done
|
||||
})
|
||||
[ -n "$_subchannels" ] || return 1
|
||||
|
||||
printf -- "%s" ${_subchannels%,}
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -3,9 +3,9 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Format:
|
||||
# bridge=<bridgename>:<ethnames>
|
||||
# bridge=<bridgename>:<bridgeslaves>
|
||||
#
|
||||
# <ethnames> is a comma-separated list of physical (ethernet) interfaces
|
||||
# <bridgeslaves> is a comma-separated list of physical (ethernet) interfaces
|
||||
# bridge without parameters assumes bridge=br0:eth0
|
||||
#
|
||||
|
||||
@@ -25,20 +25,20 @@ parsebridge() {
|
||||
v=${v#*:}
|
||||
done
|
||||
|
||||
unset bridgename ethnames
|
||||
unset bridgename bridgeslaves
|
||||
case $# in
|
||||
0) bridgename=br0; ethnames=$iface ;;
|
||||
0) bridgename=br0; bridgeslaves=$iface ;;
|
||||
1) die "bridge= requires two parameters" ;;
|
||||
2) bridgename=$1; ethnames=$(str_replace "$2" "," " ") ;;
|
||||
2) bridgename=$1; bridgeslaves=$(str_replace "$2" "," " ") ;;
|
||||
*) die "bridge= requires two parameters" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
unset bridgename ethnames
|
||||
unset bridgename bridgeslaves
|
||||
|
||||
iface=eth0
|
||||
|
||||
# Parse bridge for bridgename and ethnames
|
||||
# Parse bridge for bridgename and bridgeslaves
|
||||
if bridge="$(getarg bridge)"; then
|
||||
# Read bridge= parameters if they exist
|
||||
if [ -n "$bridge" ]; then
|
||||
@@ -47,9 +47,9 @@ if bridge="$(getarg bridge)"; then
|
||||
# Simple default bridge
|
||||
if [ -z "$bridgename" ]; then
|
||||
bridgename=br0
|
||||
ethnames=$iface
|
||||
bridgeslaves=$iface
|
||||
fi
|
||||
echo "bridgename=$bridgename" > /tmp/bridge.info
|
||||
echo "ethnames=\"$ethnames\"" >> /tmp/bridge.info
|
||||
echo "bridgeslaves=\"$bridgeslaves\"" >> /tmp/bridge.info
|
||||
return
|
||||
fi
|
||||
|
@@ -5,6 +5,8 @@
|
||||
command -v getarg >/dev/null || . /lib/dracut-lib.sh
|
||||
command -v ibft_to_cmdline >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
# If ibft is requested, read ibft vals and write ip=XXX cmdline args
|
||||
[ "ibft" = "$(getarg ip=)" ] && ibft_to_cmdline
|
||||
|
||||
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
|
||||
|
@@ -25,6 +25,10 @@ fi
|
||||
if [ -z "$NEEDBOOTDEV" ] ; then
|
||||
count=0
|
||||
for p in $(getargs ip=); do
|
||||
case "$p" in
|
||||
ibft)
|
||||
continue;;
|
||||
esac
|
||||
count=$(( $count + 1 ))
|
||||
done
|
||||
[ $count -gt 1 ] && NEEDBOOTDEV=1
|
||||
@@ -34,8 +38,10 @@ 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 1 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"
|
||||
fi
|
||||
|
||||
# Check ip= lines
|
||||
@@ -46,7 +52,7 @@ for p in $(getargs ip=); do
|
||||
# make first device specified the BOOTDEV
|
||||
if [ -z "$BOOTDEV" ] && [ -n "$dev" ]; then
|
||||
BOOTDEV="$dev"
|
||||
[ -n "$NEEDBOOTDEV" ] && warn "Setting bootdev to '$BOOTDEV'"
|
||||
[ -n "$NEEDBOOTDEV" ] && info "Setting bootdev to '$BOOTDEV'"
|
||||
fi
|
||||
|
||||
# skip ibft since we did it above
|
||||
@@ -62,24 +68,26 @@ for p in $(getargs ip=); do
|
||||
fi
|
||||
|
||||
# Error checking for autoconf in combination with other values
|
||||
case $autoconf in
|
||||
error) die "Error parsing option 'ip=$p'";;
|
||||
bootp|rarp|both) die "Sorry, ip=$autoconf is currenty unsupported";;
|
||||
none|off)
|
||||
[ -z "$ip" ] && \
|
||||
die "For argument 'ip=$p'\nValue '$autoconf' without static configuration does not make sense"
|
||||
[ -z "$mask" ] && \
|
||||
die "Sorry, automatic calculation of netmask is not yet supported"
|
||||
;;
|
||||
auto6);;
|
||||
dhcp|dhcp6|on|any) \
|
||||
[ -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 '$autoconf'"
|
||||
;;
|
||||
*) die "For argument 'ip=$p'\nSorry, unknown value '$autoconf'";;
|
||||
esac
|
||||
for autoopt in $(str_replace "$autoconf" "," " "); do
|
||||
case $autoopt in
|
||||
error) die "Error parsing option 'ip=$p'";;
|
||||
bootp|rarp|both) die "Sorry, ip=$autoopt is currenty unsupported";;
|
||||
none|off)
|
||||
[ -z "$ip" ] && \
|
||||
die "For argument 'ip=$p'\nValue '$autoopt' without static configuration does not make sense"
|
||||
[ -z "$mask" ] && \
|
||||
die "Sorry, automatic calculation of netmask is not yet supported"
|
||||
;;
|
||||
auto6);;
|
||||
dhcp|dhcp6|on|any) \
|
||||
[ -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'"
|
||||
;;
|
||||
*) die "For argument 'ip=$p'\nSorry, unknown value '$autoopt'";;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -n "$dev" ] ; then
|
||||
# We don't like duplicate device configs
|
||||
@@ -105,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
|
||||
|
@@ -24,21 +24,31 @@ parseteam() {
|
||||
|
||||
unset teammaster teamslaves
|
||||
case $# in
|
||||
2) teammaster=$1; teamslaves=$(str_replace "$2" "," " ") ;;
|
||||
*) die "team= requires two parameters" ;;
|
||||
2) teammaster=$1; teamslaves=$(str_replace "$2" "," " ") ;;
|
||||
*) warn "team= requires two parameters"; return 1;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
|
||||
unset teammaster teamslaves
|
||||
|
||||
if getarg team>/dev/null; then
|
||||
# Read team= parameters if they exist
|
||||
team="$(getarg team=)"
|
||||
if [ ! "$team" = "team" ]; then
|
||||
parseteam "$(getarg team=)"
|
||||
fi
|
||||
for team in $(getargs team); do
|
||||
[ "$team" = "team" ] && continue
|
||||
|
||||
echo "teammaster=$teammaster" > /tmp/team.info
|
||||
echo "teamslaves=\"$teamslaves\"" >> /tmp/team.info
|
||||
return
|
||||
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
|
||||
|
@@ -2,18 +2,16 @@
|
||||
# -*- 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() {
|
||||
[[ -d /etc/sysconfig/network-scripts ]] && return 0
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo "network"
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
|
||||
}
|
||||
|
@@ -3,6 +3,8 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# NFS root might have reached here before /tmp/net.ifaces was written
|
||||
type is_persistent_ethernet_name >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
|
||||
udevadm settle --timeout=30
|
||||
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
@@ -55,9 +57,9 @@ print_s390() {
|
||||
|
||||
SUBCHANNELS=${SUBCHANNELS%,}
|
||||
echo "SUBCHANNELS=\"${SUBCHANNELS}\""
|
||||
CONFIG_LINE=$(get_config_line_by_subchannel $SUBCHANNELS)
|
||||
|
||||
[ $? -ne 0 -o -z "$CONFIG_LINE" ] && return
|
||||
CONFIG_LINE=$(get_config_line_by_subchannel $SUBCHANNELS)
|
||||
[ $? -ne 0 -o -z "$CONFIG_LINE" ] && return 0
|
||||
|
||||
OLD_IFS=$IFS
|
||||
IFS=","
|
||||
@@ -77,6 +79,44 @@ print_s390() {
|
||||
OPTIONS=${OPTIONS## }
|
||||
echo "NETTYPE=\"${NETTYPE}\""
|
||||
echo "OPTIONS=\"${OPTIONS}\""
|
||||
return 0
|
||||
}
|
||||
|
||||
hw_bind() {
|
||||
local _netif="$1"
|
||||
local _macaddr="$2"
|
||||
|
||||
[ -n "$_macaddr" ] \
|
||||
&& echo "MACADDR=\"$_macaddr\""
|
||||
|
||||
print_s390 "$_netif" \
|
||||
&& return 0
|
||||
|
||||
[ -n "$_macaddr" ] && return 0
|
||||
|
||||
is_persistent_ethernet_name "$_netif" && return 0
|
||||
|
||||
[ -f "/sys/class/net/$_netif/addr_assign_type" ] \
|
||||
&& [ "$(cat "/sys/class/net/$_netif/addr_assign_type")" != "0" ] \
|
||||
&& return 1
|
||||
|
||||
[ -f "/sys/class/net/$_netif/address" ] \
|
||||
|| return 1
|
||||
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$_netif/address)\""
|
||||
}
|
||||
|
||||
interface_bind() {
|
||||
local _netif="$1"
|
||||
local _macaddr="$2"
|
||||
|
||||
# see, if we can bind it to some hw parms
|
||||
if hw_bind "$_netif" "$_macaddr"; then
|
||||
# only print out DEVICE, if it's user assigned
|
||||
is_kernel_ethernet_name "$_netif" && return 0
|
||||
fi
|
||||
|
||||
echo "DEVICE=\"$_netif\""
|
||||
}
|
||||
|
||||
for netup in /tmp/net.*.did-setup ; do
|
||||
@@ -84,9 +124,11 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
|
||||
netif=${netup%%.did-setup}
|
||||
netif=${netif##*/net.}
|
||||
strstr "$netif" ":*:*:*:*:" && continue
|
||||
[ -e /tmp/ifcfg/ifcfg-$netif ] && continue
|
||||
unset bridge
|
||||
unset bond
|
||||
unset team
|
||||
unset bondslaves
|
||||
unset bondname
|
||||
unset bondoptions
|
||||
@@ -98,11 +140,16 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
unset macaddr
|
||||
unset slave
|
||||
unset ethname
|
||||
unset vlan
|
||||
|
||||
[ -e /tmp/bond.${netif}.info ] && . /tmp/bond.${netif}.info
|
||||
[ -e /tmp/team.${netif}.info ] && . /tmp/team.${netif}.info
|
||||
|
||||
uuid=$(cat /proc/sys/kernel/random/uuid)
|
||||
if [ "$netif" = "$bridgename" ]; then
|
||||
bridge=yes
|
||||
elif [ "$netif" = "$teammaster" ]; then
|
||||
team=yes
|
||||
elif [ "$netif" = "$bondname" ]; then
|
||||
# $netif can't be bridge and bond at the same time
|
||||
bond=yes
|
||||
@@ -110,16 +157,20 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
if [ "$netif" = "$vlanname" ]; then
|
||||
vlan=yes
|
||||
fi
|
||||
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
|
||||
|
||||
# skip team interfaces for now, the host config must be in sync
|
||||
[ "$netif" = "$teammaster" ] && continue
|
||||
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=\"$netif\""
|
||||
echo "NAME=\"$netif\""
|
||||
[ -z "$vlan" ] && interface_bind "$netif" "$macaddr"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "UUID=\"$uuid\""
|
||||
strstr "$(ip -6 addr show dev $netif)" 'inet6' && echo "IPV6INIT=yes"
|
||||
if [ -f /tmp/dhclient.$netif.lease ]; then
|
||||
[ -f /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
|
||||
strstr "$ip" '*:*:*' && echo "IPV6INIT=yes"
|
||||
if [ -f /tmp/net.$netif.has_ibft_config ]; then
|
||||
echo "BOOTPROTO=ibft"
|
||||
else
|
||||
@@ -156,17 +207,10 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
} > /tmp/ifcfg/ifcfg-$netif
|
||||
|
||||
# bridge needs different things written to ifcfg
|
||||
if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ]; then
|
||||
if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ] && [ -z "$team" ]; then
|
||||
# standard interface
|
||||
{
|
||||
if [ -n "$macaddr" ]; then
|
||||
echo "MACADDR=\"$macaddr\""
|
||||
else
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$netif/address)\""
|
||||
fi
|
||||
print_s390 $netif
|
||||
echo "TYPE=Ethernet"
|
||||
echo "NAME=\"$netif\""
|
||||
[ -n "$mtu" ] && echo "MTU=\"$mtu\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
fi
|
||||
@@ -174,7 +218,7 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
if [ -n "$vlan" ] ; then
|
||||
{
|
||||
echo "TYPE=Vlan"
|
||||
echo "NAME=\"$netif\""
|
||||
echo "DEVICE=\"$netif\""
|
||||
echo "VLAN=yes"
|
||||
echo "PHYSDEV=\"$phydevice\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
@@ -191,17 +235,19 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
|
||||
for slave in $bondslaves ; do
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
{
|
||||
(
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=\"$slave\""
|
||||
echo "NAME=\"$slave\""
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\""
|
||||
echo "SLAVE=yes"
|
||||
echo "MASTER=\"$netif\""
|
||||
echo "NAME=\"$slave\""
|
||||
} >> /tmp/ifcfg/ifcfg-$slave
|
||||
echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
|
||||
unset macaddr
|
||||
[ -e /tmp/net.$slave.override ] && . /tmp/net.$slave.override
|
||||
interface_bind "$slave" "$macaddr"
|
||||
) >> /tmp/ifcfg/ifcfg-$slave
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -211,50 +257,31 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
echo "TYPE=Bridge"
|
||||
echo "NAME=\"$netif\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=\"$bondname\""
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
# This variable is an indicator of a bond interface for initscripts
|
||||
echo "BONDING_OPTS=\"$bondoptions\""
|
||||
echo "BRIDGE=\"$netif\""
|
||||
echo "NAME=\"$bondname\""
|
||||
} >> /tmp/ifcfg/ifcfg-$bondname
|
||||
for slave in $bondslaves ; do
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=\"$slave\""
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\""
|
||||
echo "SLAVE=yes"
|
||||
echo "MASTER=\"$bondname\""
|
||||
echo "NAME=\"$slave\""
|
||||
} >> /tmp/ifcfg/ifcfg-$slave
|
||||
done
|
||||
else
|
||||
for slave in $bridgeslaves ; do
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
{
|
||||
(
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=\"$ethname\""
|
||||
echo "NAME=\"$slave\""
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$ethname/address)\""
|
||||
echo "BRIDGE=\"$netif\""
|
||||
echo "NAME=\"$ethname\""
|
||||
} >> /tmp/ifcfg/ifcfg-$ethname
|
||||
fi
|
||||
echo "BRIDGE=\"$bridgename\""
|
||||
echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
|
||||
unset macaddr
|
||||
[ -e /tmp/net.$slave.override ] && . /tmp/net.$slave.override
|
||||
interface_bind "$slave" "$macaddr"
|
||||
) >> /tmp/ifcfg/ifcfg-$slave
|
||||
done
|
||||
fi
|
||||
|
||||
i=1
|
||||
for ns in $(getargs nameserver); do
|
||||
echo "DNS${i}=\"${ns}\"" >> /tmp/ifcfg/ifcfg-$netif
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
[ -f /tmp/net.route6."$netif" ] && cp /tmp/net.route6."$netif" /tmp/ifcfg/route6-"$netif"
|
||||
[ -f /tmp/net.route."$netif" ] && cp /tmp/net.route."$netif" /tmp/ifcfg/route-"$netif"
|
||||
done
|
||||
|
||||
# Pass network opts
|
||||
|
@@ -1,19 +1,16 @@
|
||||
#!/bin/bash
|
||||
# module-setup for url-lib
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
command -v curl >/dev/null || return 1
|
||||
require_binaries curl || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo network
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _dir _crt _found _lib
|
||||
inst_simple "$moddir/url-lib.sh" "/lib/url-lib.sh"
|
||||
|
@@ -76,7 +76,7 @@ curl_fetch_url() {
|
||||
fi
|
||||
if [ -z "$2" ]; then echo "$outloc" ; fi
|
||||
}
|
||||
add_url_handler curl_fetch_url http https ftp tftp
|
||||
add_url_handler curl_fetch_url http https ftp
|
||||
|
||||
set_http_header() {
|
||||
echo "header = \"$1: $2\"" >> $CURL_HOME/.curlrc
|
||||
|
@@ -2,17 +2,14 @@
|
||||
# -*- 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() {
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
local _modname
|
||||
# Include KMS capable drm drivers
|
||||
@@ -51,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,
|
||||
|
@@ -2,19 +2,16 @@
|
||||
# -*- 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() {
|
||||
# TODO: splash_geninitramfs
|
||||
# TODO: /usr/share/splashutils/initrd.splash
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _opts
|
||||
local _splash_theme
|
||||
|
@@ -2,18 +2,15 @@
|
||||
# -*- 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() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
type -P plymouthd >/dev/null && type -P plymouth >/dev/null
|
||||
require_binaries plymouthd plymouth
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo drm
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
if grep -q nash /usr/libexec/plymouth/plymouth-populate-initrd \
|
||||
|| [ ! -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
|
||||
|
@@ -9,6 +9,7 @@ mkdir -m 0755 -p /run/initramfs/state/etc/sysconfig/network-scripts
|
||||
function cms_write_config()
|
||||
{
|
||||
. /tmp/cms.conf
|
||||
SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
|
||||
OLDIFS=$IFS
|
||||
IFS=,
|
||||
read -a subch_array <<< "indexzero,$SUBCHANNELS"
|
||||
|
@@ -37,4 +37,4 @@ fi
|
||||
IFACES="$IFACES $DEVICE"
|
||||
echo "$IFACES" >> /tmp/net.ifaces
|
||||
|
||||
ifup $DEVICE -m
|
||||
exec ifup "$DEVICE"
|
||||
|
@@ -44,146 +44,147 @@ function dasd_settle() {
|
||||
}
|
||||
|
||||
function dasd_settle_all() {
|
||||
for dasdccw in $(while read line; do echo ${line%%(*}; done < /proc/dasd/devices) ; do
|
||||
for dasdccw in $(while read line; do echo "${line%%(*}"; done < /proc/dasd/devices) ; do
|
||||
if ! dasd_settle $dasdccw ; then
|
||||
echo $"Could not access DASD $dasdccw in time"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
# prints a canonocalized device bus ID for a given devno of any format
|
||||
function canonicalize_devno()
|
||||
{
|
||||
case ${#1} in
|
||||
3) echo "0.0.0${1}" ;;
|
||||
4) echo "0.0.${1}" ;;
|
||||
*) echo "${1}" ;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
function canonicalize_devno()
|
||||
{
|
||||
case ${#1} in
|
||||
3) echo "0.0.0${1}" ;;
|
||||
4) echo "0.0.${1}" ;;
|
||||
*) echo "${1}" ;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
|
||||
# read file from CMS and write it to /tmp
|
||||
function readcmsfile() # $1=dasdport $2=filename
|
||||
{
|
||||
local dev
|
||||
local numcpus
|
||||
local devname
|
||||
local ret=0
|
||||
if [ $# -ne 2 ]; then return; fi
|
||||
function readcmsfile() # $1=dasdport $2=filename
|
||||
{
|
||||
local dev
|
||||
local numcpus
|
||||
local devname
|
||||
local ret=0
|
||||
if [ $# -ne 2 ]; then return; fi
|
||||
# precondition: udevd created dasda block device node
|
||||
if ! dasd_cio_free -d $1 ; then
|
||||
echo $"DASD $1 could not be cleared from device blacklist"
|
||||
return 1
|
||||
fi
|
||||
if ! dasd_cio_free -d $1 ; then
|
||||
echo $"DASD $1 could not be cleared from device blacklist"
|
||||
return 1
|
||||
fi
|
||||
|
||||
modprobe dasd_mod dasd=$CMSDASD
|
||||
modprobe dasd_eckd_mod
|
||||
udevadm settle
|
||||
modprobe dasd_mod dasd=$CMSDASD
|
||||
modprobe dasd_eckd_mod
|
||||
udevadm settle
|
||||
|
||||
# precondition: dasd_eckd_mod driver incl. dependencies loaded,
|
||||
# dasd_mod must be loaded without setting any DASD online
|
||||
dev=$(canonicalize_devno $1)
|
||||
numcpus=$(
|
||||
while read line; do
|
||||
if strstr "$line" "# processors"; then
|
||||
echo ${line##*:};
|
||||
break;
|
||||
fi;
|
||||
done < /proc/cpuinfo
|
||||
)
|
||||
dev=$(canonicalize_devno $1)
|
||||
numcpus=$(
|
||||
while read line; do
|
||||
if strstr "$line" "# processors"; then
|
||||
echo ${line##*:};
|
||||
break;
|
||||
fi;
|
||||
done < /proc/cpuinfo
|
||||
)
|
||||
|
||||
if [ ${numcpus} -eq 1 ]; then
|
||||
echo 1 > /sys/bus/ccw/devices/$dev/online
|
||||
else
|
||||
if ! sysecho /sys/bus/ccw/devices/$dev/online 1; then
|
||||
echo $"DASD $dev could not be set online"
|
||||
return 1
|
||||
fi
|
||||
udevadm settle
|
||||
if ! dasd_settle $dev ; then
|
||||
echo $"Could not access DASD $dev in time"
|
||||
return 1
|
||||
fi
|
||||
if [ ${numcpus} -eq 1 ]; then
|
||||
echo 1 > /sys/bus/ccw/devices/$dev/online
|
||||
else
|
||||
if ! sysecho /sys/bus/ccw/devices/$dev/online 1; then
|
||||
echo $"DASD $dev could not be set online"
|
||||
return 1
|
||||
fi
|
||||
|
||||
udevadm settle
|
||||
|
||||
devname=$(cd /sys/bus/ccw/devices/$dev/block; set -- *; [ -b /dev/$1 ] && echo $1)
|
||||
devname=${devname:-dasda}
|
||||
|
||||
[[ -d /mnt ]] || mkdir /mnt
|
||||
if cmsfs-fuse --to=UTF-8 -a /dev/$devname /mnt; then
|
||||
cat /mnt/$2 > /run/initramfs/$2
|
||||
umount /mnt || umount -l /mnt
|
||||
udevadm settle
|
||||
else
|
||||
echo $"Could not read conf file $2 on CMS DASD $1."
|
||||
ret=1
|
||||
if ! dasd_settle $dev ; then
|
||||
echo $"Could not access DASD $dev in time"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! sysecho /sys/bus/ccw/devices/$dev/online 0; then
|
||||
echo $"DASD $dev could not be set offline again"
|
||||
udevadm settle
|
||||
|
||||
devname=$(cd /sys/bus/ccw/devices/$dev/block; set -- *; [ -b /dev/$1 ] && echo $1)
|
||||
devname=${devname:-dasda}
|
||||
|
||||
[[ -d /mnt ]] || mkdir /mnt
|
||||
if cmsfs-fuse --to=UTF-8 -a /dev/$devname /mnt; then
|
||||
cat /mnt/$2 > /run/initramfs/$2
|
||||
umount /mnt || umount -l /mnt
|
||||
udevadm settle
|
||||
else
|
||||
echo $"Could not read conf file $2 on CMS DASD $1."
|
||||
ret=1
|
||||
fi
|
||||
|
||||
if ! sysecho /sys/bus/ccw/devices/$dev/online 0; then
|
||||
echo $"DASD $dev could not be set offline again"
|
||||
#return 1
|
||||
fi
|
||||
udevadm settle
|
||||
fi
|
||||
udevadm settle
|
||||
|
||||
# unbind all dasds to unload the dasd modules for a clean start
|
||||
( cd /sys/bus/ccw/drivers/dasd-eckd; for i in *.*; do echo $i > unbind;done)
|
||||
udevadm settle
|
||||
modprobe -r dasd_eckd_mod
|
||||
udevadm settle
|
||||
modprobe -r dasd_diag_mod
|
||||
udevadm settle
|
||||
modprobe -r dasd_mod
|
||||
udevadm settle
|
||||
return $ret
|
||||
}
|
||||
( cd /sys/bus/ccw/drivers/dasd-eckd; for i in *.*; do echo $i > unbind;done)
|
||||
udevadm settle
|
||||
modprobe -r dasd_eckd_mod
|
||||
udevadm settle
|
||||
modprobe -r dasd_diag_mod
|
||||
udevadm settle
|
||||
modprobe -r dasd_mod
|
||||
udevadm settle
|
||||
return $ret
|
||||
}
|
||||
|
||||
processcmsfile()
|
||||
{
|
||||
source /tmp/cms.conf
|
||||
processcmsfile()
|
||||
{
|
||||
source /tmp/cms.conf
|
||||
SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
|
||||
|
||||
if [[ $NETTYPE ]]; then
|
||||
(
|
||||
echo -n $NETTYPE,$SUBCHANNELS
|
||||
[[ $PORTNAME ]] && echo -n ",portname=$PORTNAME"
|
||||
[[ $LAYER2 ]] && echo -n ",layer2=$LAYER2"
|
||||
[[ "$NETTYPE" = "ctc" ]] && [[ $CTCPROT ]] && echo -n ",protocol=$CTCPROT"
|
||||
echo
|
||||
) >> /etc/ccw.conf
|
||||
if [[ $NETTYPE ]]; then
|
||||
(
|
||||
echo -n $NETTYPE,$SUBCHANNELS
|
||||
[[ $PORTNAME ]] && echo -n ",portname=$PORTNAME"
|
||||
[[ $LAYER2 ]] && echo -n ",layer2=$LAYER2"
|
||||
[[ "$NETTYPE" = "ctc" ]] && [[ $CTCPROT ]] && echo -n ",protocol=$CTCPROT"
|
||||
echo
|
||||
) >> /etc/ccw.conf
|
||||
|
||||
OLDIFS=$IFS
|
||||
IFS=,
|
||||
read -a subch_array <<< "indexzero,$SUBCHANNELS"
|
||||
IFS=$OLDIFS
|
||||
devbusid=${subch_array[1]}
|
||||
if [ "$NETTYPE" = "ctc" ]; then
|
||||
driver="ctcm"
|
||||
else
|
||||
driver=$NETTYPE
|
||||
fi
|
||||
OLDIFS=$IFS
|
||||
IFS=,
|
||||
read -a subch_array <<< "indexzero,$SUBCHANNELS"
|
||||
IFS=$OLDIFS
|
||||
devbusid=${subch_array[1]}
|
||||
if [ "$NETTYPE" = "ctc" ]; then
|
||||
driver="ctcm"
|
||||
else
|
||||
driver=$NETTYPE
|
||||
fi
|
||||
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$env{INTERFACE} /sbin/cmsifup $env{INTERFACE}"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$env{INTERFACE} /sbin/cmsifup $env{INTERFACE}"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
|
||||
# remove the default net rules
|
||||
rm -f -- /etc/udev/rules.d/91-default-net.rules
|
||||
[[ -f /etc/udev/rules.d/90-net.rules ]] \
|
||||
|| printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
|
||||
udevadm control --reload
|
||||
znet_cio_free
|
||||
fi
|
||||
rm -f -- /etc/udev/rules.d/91-default-net.rules
|
||||
[[ -f /etc/udev/rules.d/90-net.rules ]] \
|
||||
|| printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
|
||||
udevadm control --reload
|
||||
znet_cio_free
|
||||
fi
|
||||
|
||||
if [[ $DASD ]]; then
|
||||
echo $DASD | normalize_dasd_arg > /etc/dasd.conf
|
||||
echo "options dasd_mod dasd=$DASD" > /etc/modprobe.d/dasd_mod.conf
|
||||
dasd_cio_free
|
||||
fi
|
||||
if [[ $DASD ]] && [[ $DASD != "none" ]]; then
|
||||
echo $DASD | normalize_dasd_arg > /etc/dasd.conf
|
||||
echo "options dasd_mod dasd=$DASD" > /etc/modprobe.d/dasd_mod.conf
|
||||
dasd_cio_free
|
||||
fi
|
||||
|
||||
unset _do_zfcp
|
||||
for i in ${!FCP_*}; do
|
||||
echo "${!i}" | while read port rest; do
|
||||
case $port in
|
||||
unset _do_zfcp
|
||||
for i in ${!FCP_*}; do
|
||||
echo "${!i}" | while read port rest; do
|
||||
case $port in
|
||||
*.*.*)
|
||||
;;
|
||||
*.*)
|
||||
@@ -192,23 +193,23 @@ function dasd_settle_all() {
|
||||
*)
|
||||
port="0.0.$port"
|
||||
;;
|
||||
esac
|
||||
echo $port $rest >> /etc/zfcp.conf
|
||||
done
|
||||
_do_zfcp=1
|
||||
esac
|
||||
echo $port $rest >> /etc/zfcp.conf
|
||||
done
|
||||
[[ $_do_zfcp ]] && zfcp_cio_free
|
||||
unset _do_zfcp
|
||||
}
|
||||
_do_zfcp=1
|
||||
done
|
||||
[[ $_do_zfcp ]] && zfcp_cio_free
|
||||
unset _do_zfcp
|
||||
}
|
||||
|
||||
[[ $CMSDASD ]] || CMSDASD=$(getarg "CMSDASD=")
|
||||
[[ $CMSCONFFILE ]] || CMSCONFFILE=$(getarg "CMSCONFFILE=")
|
||||
[[ $CMSDASD ]] || CMSDASD=$(getarg "CMSDASD=")
|
||||
[[ $CMSCONFFILE ]] || CMSCONFFILE=$(getarg "CMSCONFFILE=")
|
||||
|
||||
# Parse configuration
|
||||
if [ -n "$CMSDASD" -a -n "$CMSCONFFILE" ]; then
|
||||
if readcmsfile $CMSDASD $CMSCONFFILE; then
|
||||
ln -s /run/initramfs/$CMSCONFFILE /tmp/$CMSCONFFILE
|
||||
ln -s /run/initramfs/$CMSCONFFILE /tmp/cms.conf
|
||||
processcmsfile
|
||||
fi
|
||||
if [ -n "$CMSDASD" -a -n "$CMSCONFFILE" ]; then
|
||||
if readcmsfile $CMSDASD $CMSCONFFILE; then
|
||||
ln -s /run/initramfs/$CMSCONFFILE /tmp/$CMSCONFFILE
|
||||
ln -s /run/initramfs/$CMSCONFFILE /tmp/cms.conf
|
||||
processcmsfile
|
||||
fi
|
||||
fi
|
||||
|
@@ -2,14 +2,12 @@
|
||||
# -*- 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() {
|
||||
arch=$(uname -m)
|
||||
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
arch=$(uname -m)
|
||||
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
|
||||
@@ -17,12 +15,10 @@ depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
instmods zfcp
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_hook pre-trigger 30 "$moddir/cmssetup.sh"
|
||||
inst_hook pre-pivot 95 "$moddir/cms-write-ifcfg.sh"
|
||||
|
33
modules.d/90bcache/module-setup.sh
Executable file
33
modules.d/90bcache/module-setup.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
if ! blkid -k | { while read line; do [[ $line == bcache ]] && exit 0; done; exit 1; } \
|
||||
&& ! type -P probe-bcache >/dev/null; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ $fs = "bcache" ]] && return 0
|
||||
done
|
||||
return 255
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods bcache
|
||||
}
|
||||
|
||||
install() {
|
||||
blkid -k | { while read line; do [[ $line == bcache ]] && exit 0; done; exit 1; } || inst_multiple -o probe-bcache
|
||||
inst_multiple -o ${udevdir}/bcache-register
|
||||
inst_rules 61-bcache.rules 69-bcache.rules
|
||||
}
|
@@ -2,12 +2,11 @@
|
||||
# -*- 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() {
|
||||
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
|
||||
@@ -19,18 +18,15 @@ check() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo udev-rules
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
instmods btrfs
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
if ! inst_rules 64-btrfs.rules; then
|
||||
inst_rules "$moddir/80-btrfs.rules"
|
||||
|
@@ -8,7 +8,22 @@ NEWROOT=${NEWROOT:-"/sysroot"}
|
||||
# do not ask, if we already have root
|
||||
[ -f $NEWROOT/proc ] && exit 0
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
# check if destination already exists
|
||||
[ -b /dev/mapper/$2 ] && exit 0
|
||||
|
||||
# we already asked for this device
|
||||
[ -f /tmp/cryptroot-asked-$2 ] && exit 0
|
||||
|
||||
# load dm_crypt if it is not already loaded
|
||||
[ -d /sys/module/dm_crypt ] || modprobe dm_crypt
|
||||
|
||||
. /lib/dracut-crypt-lib.sh
|
||||
|
||||
# default luksname - luks-UUID
|
||||
luksname=$2
|
||||
|
||||
# fallback to passphrase
|
||||
ask_passphrase=1
|
||||
|
||||
# if device name is /dev/dm-X, convert to /dev/mapper/name
|
||||
if [ "${1##/dev/dm-}" != "$1" ]; then
|
||||
@@ -17,9 +32,6 @@ else
|
||||
device="$1"
|
||||
fi
|
||||
|
||||
# default luksname - luks-UUID
|
||||
luksname=$2
|
||||
|
||||
# number of tries
|
||||
numtries=${3:-10}
|
||||
|
||||
@@ -51,17 +63,6 @@ if [ -f /etc/crypttab ] && getargbool 1 rd.luks.crypttab -d -n rd_NO_CRYPTTAB; t
|
||||
unset name dev
|
||||
fi
|
||||
|
||||
# check if destination already exists
|
||||
[ -b /dev/mapper/$luksname ] && exit 0
|
||||
|
||||
# we already asked for this device
|
||||
[ -f /tmp/cryptroot-asked-$luksname ] && exit 0
|
||||
|
||||
# load dm_crypt if it is not already loaded
|
||||
[ -d /sys/module/dm_crypt ] || modprobe dm_crypt
|
||||
|
||||
. /lib/dracut-crypt-lib.sh
|
||||
|
||||
#
|
||||
# Open LUKS device
|
||||
#
|
||||
@@ -111,9 +112,6 @@ fi
|
||||
|
||||
unset allowdiscards
|
||||
|
||||
# fallback to passphrase
|
||||
ask_passphrase=1
|
||||
|
||||
if [ -n "$luksfile" -a "$luksfile" != "none" -a -e "$luksfile" ]; then
|
||||
if cryptsetup --key-file "$luksfile" $cryptsetupopts luksOpen "$device" "$luksname"; then
|
||||
ask_passphrase=0
|
||||
@@ -159,7 +157,7 @@ fi
|
||||
unset device luksname luksfile
|
||||
|
||||
# mark device as asked
|
||||
>> /tmp/cryptroot-asked-$luksname
|
||||
>> /tmp/cryptroot-asked-$2
|
||||
|
||||
need_shutdown
|
||||
udevsettle
|
||||
|
@@ -2,11 +2,10 @@
|
||||
# -*- 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() {
|
||||
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
|
||||
@@ -18,18 +17,16 @@ check() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo dm rootfs-block
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
instmods dm_crypt =crypto
|
||||
hostonly="" instmods drbg
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
cmdline() {
|
||||
local dev UUID
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
@@ -48,11 +45,12 @@ cmdline() {
|
||||
done
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
|
||||
cmdline >> "${initdir}/etc/cmdline.d/90crypt.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90crypt.conf"
|
||||
if [[ $hostonly_cmdline == "yes" ]]; then
|
||||
cmdline >> "${initdir}/etc/cmdline.d/90crypt.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90crypt.conf"
|
||||
fi
|
||||
|
||||
inst_multiple cryptsetup rmdir readlink umount
|
||||
inst_script "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
|
||||
@@ -65,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
|
||||
|
||||
|
@@ -2,24 +2,20 @@
|
||||
# -*- 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 dmsetup >/dev/null || return 1
|
||||
require_binaries dmsetup || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
instmods =drivers/md
|
||||
instmods dm_mod
|
||||
instmods dm_mod dm-cache dm-cache-mq dm-cache-cleaner
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
modinfo -k $kernel dm_mod >/dev/null 2>&1 && \
|
||||
inst_hook pre-udev 30 "$moddir/dm-pre-udev.sh"
|
||||
|
@@ -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
|
||||
|
@@ -2,12 +2,11 @@
|
||||
# -*- 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() {
|
||||
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
|
||||
@@ -28,13 +27,11 @@ check() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo dm rootfs-block
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
cmdline() {
|
||||
local _activated
|
||||
declare -A _activated
|
||||
@@ -61,12 +58,13 @@ cmdline() {
|
||||
done
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _i
|
||||
|
||||
cmdline >> "${initdir}/etc/cmdline.d/90dmraid.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90dmraid.conf"
|
||||
if [[ $hostonly_cmdline == "yes" ]]; then
|
||||
cmdline >> "${initdir}/etc/cmdline.d/90dmraid.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90dmraid.conf"
|
||||
fi
|
||||
|
||||
inst_multiple dmraid
|
||||
inst_multiple -o kpartx
|
||||
|
@@ -11,3 +11,4 @@ StandardInput=tty-force
|
||||
StandardOutput=inherit
|
||||
StandardError=inherit
|
||||
TimeoutSec=0
|
||||
SuccessExitStatus=2
|
||||
|
@@ -9,7 +9,7 @@ case "$root" in
|
||||
printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
|
||||
${root#live:/dev/}
|
||||
} >> /etc/udev/rules.d/99-live-squash.rules
|
||||
wait_for_dev "${root#live:}"
|
||||
wait_for_dev -n "${root#live:}"
|
||||
;;
|
||||
live:*)
|
||||
if [ -f "${root#live:}" ]; then
|
||||
|
@@ -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
|
||||
@@ -124,7 +131,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 +150,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 +192,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 +202,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 +211,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 +222,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
|
||||
|
@@ -2,27 +2,23 @@
|
||||
# -*- 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() {
|
||||
# a live host-only image doesn't really make a lot of sense
|
||||
[[ $hostonly ]] && return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
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
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
instmods squashfs loop iso9660
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple umount dmsetup blkid dd losetup grep blockdev
|
||||
inst_multiple -o checkisomd5
|
||||
|
@@ -56,4 +56,4 @@ info "root was $liveroot, is now $root"
|
||||
# make sure that init doesn't complain
|
||||
[ -z "$root" ] && root="live"
|
||||
|
||||
wait_for_dev /dev/mapper/live-rw
|
||||
wait_for_dev -n /dev/mapper/live-rw
|
||||
|
@@ -2,11 +2,10 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
if [[ -z $drivers ]]; then
|
||||
block_module_filter() {
|
||||
local _blockfuncs='ahci_init_controller|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect'
|
||||
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'
|
||||
# subfunctions inherit following FDs
|
||||
local _merge=8 _side2=9
|
||||
function bmf1() {
|
||||
@@ -41,18 +40,31 @@ 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
|
||||
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
|
||||
|
||||
instmods \
|
||||
"=drivers/hid" \
|
||||
"=drivers/input/serio" \
|
||||
"=drivers/input/keyboard"
|
||||
|
||||
if [[ "$(uname -p)" == arm* ]]; then
|
||||
# arm specific modules
|
||||
hostonly='' instmods sdhci_esdhc_imx mmci sdhci_tegra mvsdio omap omapdrm \
|
||||
omap_hsmmc panel-tfp410 sdhci_dove ahci_platform pata_imx sata_mv \
|
||||
ehci-tegra mmc_block usb_storage
|
||||
hostonly='' instmods \
|
||||
connector-hdmi connector-dvi encoder-tfp410 \
|
||||
encoder-tpd12s015 i2c-tegra gpio-regulator \
|
||||
as3722-regulator orion-ehci ehci-tegra
|
||||
instmods \
|
||||
"=drivers/i2c/busses" \
|
||||
"=drivers/regulator" \
|
||||
"=drivers/rtc" \
|
||||
"=drivers/usb/host" \
|
||||
"=drivers/usb/phy" \
|
||||
${NULL}
|
||||
fi
|
||||
|
||||
# install virtual machine support
|
||||
@@ -77,7 +89,6 @@ installkernel() {
|
||||
:
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple -o /lib/modprobe.d/*.conf
|
||||
[[ $hostonly ]] && inst_multiple -o /etc/modprobe.d/*.conf /etc/modprobe.conf
|
||||
|
@@ -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
|
||||
|
@@ -1,18 +1,15 @@
|
||||
#!/bin/bash
|
||||
# module-setup.sh for livenet
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo network url-lib dmsquash-live img-lib
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_hook cmdline 29 "$moddir/parse-livenet.sh"
|
||||
inst_hook initqueue/online 95 "$moddir/fetch-liveupdate.sh"
|
||||
|
@@ -27,7 +27,7 @@ if get_url_handler "$liveurl" >/dev/null; then
|
||||
netroot="livenet:$liveurl"
|
||||
root="livenet" # quiet complaints from init
|
||||
rootok=1
|
||||
wait_for_dev /dev/root
|
||||
wait_for_dev -n /dev/root
|
||||
else
|
||||
info "livenet: no url handler for $liveurl"
|
||||
fi
|
||||
|
@@ -107,11 +107,13 @@ fi
|
||||
if [ -n "$LVS" ] ; then
|
||||
info "Scanning devices $lvmdevs for LVM logical volumes $LVS"
|
||||
lvm lvscan --ignorelockingfailure 2>&1 | vinfo
|
||||
if [ -z "$sysinit" ]; then
|
||||
lvm lvchange --yes -ay --ignorelockingfailure $nopoll --ignoremonitoring $LVS 2>&1 | vinfo
|
||||
else
|
||||
lvm lvchange --yes -ay $sysinit $LVS 2>&1 | vinfo
|
||||
fi
|
||||
for LV in $LVS; do
|
||||
if [ -z "$sysinit" ]; then
|
||||
lvm lvchange --yes -ay --ignorelockingfailure $nopoll --ignoremonitoring $LV 2>&1 | vinfo
|
||||
else
|
||||
lvm lvchange --yes -ay $sysinit $LV 2>&1 | vinfo
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -z "$LVS" -o -n "$VGS" ]; then
|
||||
|
@@ -2,10 +2,9 @@
|
||||
# -*- 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() {
|
||||
# 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
|
||||
@@ -17,7 +16,6 @@ check() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
# We depend on dm_mod being loaded
|
||||
echo rootfs-block dm
|
||||
@@ -50,8 +48,10 @@ install() {
|
||||
|
||||
inst lvm
|
||||
|
||||
cmdline >> "${initdir}/etc/cmdline.d/90lvm.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90lvm.conf"
|
||||
if [[ $hostonly_cmdline == "yes" ]]; then
|
||||
cmdline >> "${initdir}/etc/cmdline.d/90lvm.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90lvm.conf"
|
||||
fi
|
||||
|
||||
inst_rules "$moddir/64-lvm.rules"
|
||||
|
||||
@@ -78,12 +78,16 @@ install() {
|
||||
inst_rules 11-dm-lvm.rules 69-dm-lvm-metad.rules
|
||||
|
||||
# Do not run lvmetad update via pvscan in udev rule - lvmetad is not running yet in dracut!
|
||||
if grep -q SYSTEMD_WANTS ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules; then
|
||||
sed -i -e 's/^ENV{SYSTEMD_ALIAS}=.*/# No LVM pvscan in dracut - lvmetad is not running yet/' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
|
||||
sed -i -e 's/^ENV{ID_MODEL}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
|
||||
sed -i -e 's/^ENV{SYSTEMD_WANTS}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
|
||||
else
|
||||
sed -i -e 's/.*lvm pvscan.*/# No LVM pvscan for in dracut - lvmetad is not running yet/' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
|
||||
if [[ -f ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules ]]; then
|
||||
if grep -q SYSTEMD_WANTS ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules; then
|
||||
sed -i -e 's/^ENV{SYSTEMD_ALIAS}=.*/# No LVM pvscan in dracut - lvmetad is not running yet/' \
|
||||
${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
|
||||
sed -i -e 's/^ENV{ID_MODEL}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
|
||||
sed -i -e 's/^ENV{SYSTEMD_WANTS}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
|
||||
else
|
||||
sed -i -e 's/.*lvm pvscan.*/# No LVM pvscan for in dracut - lvmetad is not running yet/' \
|
||||
${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
|
||||
fi
|
||||
fi
|
||||
|
||||
# Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
|
||||
@@ -103,12 +107,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
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@ if ! getargbool 1 rd.lvm -d -n rd_NO_LVM \
|
||||
rm -f -- /etc/udev/rules.d/64-lvm*.rules
|
||||
else
|
||||
for dev in $LV_DEVS; do
|
||||
wait_for_dev "/dev/$dev"
|
||||
wait_for_dev -n "/dev/$dev"
|
||||
done
|
||||
fi
|
||||
|
||||
|
@@ -2,11 +2,10 @@
|
||||
# -*- 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() {
|
||||
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
|
||||
@@ -27,18 +26,15 @@ check() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo rootfs-block
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
instmods =drivers/md
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
cmdline() {
|
||||
local _activated dev line UUID
|
||||
declare -A _activated
|
||||
@@ -54,6 +50,8 @@ cmdline() {
|
||||
done
|
||||
)
|
||||
|
||||
[[ -z "$UUID" ]] && continue
|
||||
|
||||
if ! [[ ${_activated[${UUID}]} ]]; then
|
||||
printf "%s" " rd.md.uuid=${UUID}"
|
||||
_activated["${UUID}"]=1
|
||||
@@ -62,7 +60,6 @@ cmdline() {
|
||||
done
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local rule rule_path
|
||||
inst_multiple cat
|
||||
@@ -70,8 +67,10 @@ install() {
|
||||
inst $(command -v partx) /sbin/partx
|
||||
inst $(command -v mdadm) /sbin/mdadm
|
||||
|
||||
cmdline >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
||||
if [[ $hostonly_cmdline == "yes" ]]; then
|
||||
cmdline >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
||||
fi
|
||||
|
||||
# <mdadm-3.3 udev rule
|
||||
inst_rules 64-md-raid.rules
|
||||
|
@@ -2,18 +2,28 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
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 `ls -1 /dev/mapper/mpath*`; do
|
||||
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
|
||||
@@ -22,14 +32,12 @@ check() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo rootfs-block
|
||||
echo dm
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
local _ret
|
||||
local _arch=$(uname -m)
|
||||
@@ -67,12 +75,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
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
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 \
|
||||
@@ -86,6 +104,11 @@ install() {
|
||||
/etc/multipath.conf \
|
||||
/etc/multipath/*
|
||||
|
||||
[[ $hostonly ]] && {
|
||||
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/*"
|
||||
|
@@ -2,7 +2,6 @@
|
||||
# -*- 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() {
|
||||
if type -P systemd-detect-virt >/dev/null 2>&1; then
|
||||
vm=$(systemd-detect-virt --vm >/dev/null 2>&1)
|
||||
@@ -22,7 +21,6 @@ check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
# qemu specific modules
|
||||
hostonly='' instmods virtio_net e1000 8139cp pcnet32 e100 ne2k_pci
|
||||
|
@@ -2,10 +2,9 @@
|
||||
# -*- 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() {
|
||||
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
|
||||
@@ -15,14 +14,17 @@ 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
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
# qemu specific modules
|
||||
hostonly='' instmods virtio_blk virtio virtio_ring virtio_pci ata_piix ata_generic pata_acpi cdrom sr_mod ahci virtio_scsi
|
||||
hostonly='' instmods \
|
||||
ata_piix ata_generic pata_acpi cdrom sr_mod ahci \
|
||||
virtio_blk virtio virtio_ring virtio_pci \
|
||||
virtio_scsi virtio_console spapr-vscsi ibmvscsi
|
||||
}
|
||||
|
@@ -3,19 +3,16 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# GPG support is optional
|
||||
# called by dracut
|
||||
check() {
|
||||
type -P gpg >/dev/null || return 1
|
||||
require_binaries gpg || return 1
|
||||
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo crypt
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple gpg
|
||||
inst "$moddir/crypt-gpg-lib.sh" "/lib/dracut-crypt-gpg-lib.sh"
|
||||
|
@@ -1,23 +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
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo crypt
|
||||
echo crypt
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
instmods loop
|
||||
instmods loop
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
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
|
||||
}
|
||||
|
@@ -2,10 +2,9 @@
|
||||
# -*- 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() {
|
||||
# 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
|
||||
@@ -17,18 +16,15 @@ check() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
# We depend on network modules being loaded
|
||||
echo network
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
instmods cifs ipv6
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _i
|
||||
local _nsslibs
|
||||
|
@@ -2,21 +2,21 @@
|
||||
# -*- 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() {
|
||||
local _arch=$(uname -m)
|
||||
[ -x /sbin/normalize_dasd_arg ] || return 1
|
||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
||||
require_binaries normalize_dasd_arg || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo "dasd_mod"
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
instmods dasd_mod dasd_eckd_mod dasd_fba_mod dasd_diag_mod
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_hook cmdline 30 "$moddir/parse-dasd.sh"
|
||||
inst_multiple dasdinfo dasdconf.sh normalize_dasd_arg
|
||||
|
@@ -2,28 +2,24 @@
|
||||
# -*- 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() {
|
||||
local _arch=$(uname -m)
|
||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
||||
require_binaries grep sed seq
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
instmods dasd_mod dasd_eckd_mod dasd_fba_mod dasd_diag_mod
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_hook cmdline 31 "$moddir/parse-dasd-mod.sh"
|
||||
inst_multiple grep sed seq
|
||||
inst_multiple -o dasd_cio_free
|
||||
inst_multiple dasd_cio_free grep sed seq
|
||||
}
|
||||
|
||||
|
@@ -15,6 +15,4 @@ if [ -n "$mod_args" ]; then
|
||||
fi
|
||||
|
||||
unset dasd_arg
|
||||
if [ -x /sbin/dasd_cio_free ] ; then
|
||||
dasd_cio_free
|
||||
fi
|
||||
dasd_cio_free
|
||||
|
@@ -1,27 +0,0 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
local _arch=$(uname -m)
|
||||
[ -x /sbin/dasd_configure ] || return 1
|
||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo 'dasd_mod'
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple /usr/lib/udev/collect
|
||||
inst_hook cmdline 30 "$moddir/parse-dasd.sh"
|
||||
if [[ $hostonly ]] ; then
|
||||
inst_rules_wildcard 51-dasd-*.rules
|
||||
fi
|
||||
inst_rules 59-dasd.rules
|
||||
}
|
@@ -1,56 +0,0 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
create_udev_rule() {
|
||||
local ccw=$1
|
||||
local _drv _cu_type _dev_type
|
||||
local _rule=/etc/udev/rules.d/51-dasd-${ccw}.rules
|
||||
|
||||
if [ -e /sys/bus/ccw/devices/${ccw} ] ; then
|
||||
read _cu_type < /sys/bus/ccw/devices/${ccw}/cutype
|
||||
read _dev_type < /sys/bus/ccw/devices/${ccw}/devtype
|
||||
fi
|
||||
case "$_cu_type" in
|
||||
3990/*|2105/*|2107/*|1750/*|9343/*)
|
||||
_drv=dasd-eckd
|
||||
;;
|
||||
6310/*)
|
||||
_drv=dasd-fba
|
||||
;;
|
||||
3880/*)
|
||||
case "$_dev_type" in
|
||||
3380/*)
|
||||
_drv=dasd_eckd
|
||||
;;
|
||||
3370/*)
|
||||
_drv=dasd-fba
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
[ -z "${_drv}" ] && return 0
|
||||
|
||||
[ -e ${_rule} ] && return 0
|
||||
|
||||
cat > $_rule <<EOF
|
||||
ACTION=="add", SUBSYSTEM=="ccw", KERNEL=="$ccw", IMPORT{program}="collect $ccw %k ${ccw} $_drv"
|
||||
ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="$_drv", IMPORT{program}="collect $ccw %k ${ccw} $_drv"
|
||||
ACTION=="add", ENV{COLLECT_$ccw}=="0", ATTR{[ccw/$ccw]online}="1"
|
||||
EOF
|
||||
}
|
||||
|
||||
for dasd_arg in $(getargs root=) $(getargs resume=); do
|
||||
(
|
||||
case $dasd_arg in
|
||||
/dev/disk/by-path/ccw-*)
|
||||
ccw_arg=${dasd_arg##*/}
|
||||
break;
|
||||
esac
|
||||
if [ -n "$ccw_arg" ] ; then
|
||||
IFS="-"
|
||||
set -- $ccw_arg
|
||||
create_udev_rule $2
|
||||
fi
|
||||
)
|
||||
done
|
@@ -2,18 +2,15 @@
|
||||
# -*- 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() {
|
||||
# do not add this module by default
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple -o ps grep more cat rm strace free showmount \
|
||||
ping netstat rpcinfo vi scp ping6 ssh \
|
||||
|
@@ -4,9 +4,10 @@
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
for i in dcbtool fipvlan lldpad ip readlink; do
|
||||
type -P $i >/dev/null || return 1
|
||||
done
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
[ -d /sys/firmware/efi ] || return 255
|
||||
}
|
||||
require_binaries dcbtool fipvlan lldpad ip readlink || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@@ -9,10 +9,10 @@ command -v set_ifname >/dev/null || . /lib/net-lib.sh
|
||||
print_fcoe_uefi_conf()
|
||||
{
|
||||
local mac dev vlan
|
||||
mac=$(get_fcoe_boot_mac)
|
||||
[ -z "$mac" ] && continue
|
||||
mac=$(get_fcoe_boot_mac "$1")
|
||||
[ -z "$mac" ] && return 1
|
||||
dev=$(set_ifname fcoe $mac)
|
||||
vlan=$(get_fcoe_boot_vlan)
|
||||
vlan=$(get_fcoe_boot_vlan "$1")
|
||||
if [ "$vlan" -ne "0" ]; then
|
||||
case "$vlan" in
|
||||
[0-9]*)
|
||||
@@ -26,10 +26,11 @@ print_fcoe_uefi_conf()
|
||||
esac
|
||||
fi
|
||||
# fcoe=eth0:nodcb
|
||||
printf "%s\n" "$dev:nodcb"
|
||||
printf "fcoe=%s\n" "$dev:nodcb"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
if [ -e /sys/firmware/efi/vars/FcoeBootDevice-a0ebca23-5f9c-447a-a268-22b6c158c2ac/data ]; then
|
||||
print_fcoe_uefi_conf > /etc/cmdline.d/40-fcoe-uefi.conf
|
||||
fi
|
||||
for i in /sys/firmware/efi/vars/FcoeBootDevice-*/data; do
|
||||
[ -e "$i" ] || continue
|
||||
print_fcoe_uefi_conf $i > /etc/cmdline.d/40-fcoe-uefi.conf && break
|
||||
done
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user