Compare commits
336 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a74eae77ac | ||
![]() |
ce18bc4e97 | ||
![]() |
567cc5d814 | ||
![]() |
56ac6c7e76 | ||
![]() |
59feafc6c7 | ||
![]() |
5ccc88a742 | ||
![]() |
de247618e7 | ||
![]() |
c6c6a08850 | ||
![]() |
204db8a134 | ||
![]() |
96b8d60a9b | ||
![]() |
4951a1199d | ||
![]() |
76a80dff18 | ||
![]() |
9ea901191e | ||
![]() |
3bdc01c9a5 | ||
![]() |
e29d0b8b85 | ||
![]() |
65fe8ae8a5 | ||
![]() |
4b691cccbe | ||
![]() |
935b37ee8b | ||
![]() |
fe266c6c69 | ||
![]() |
c6655c4115 | ||
![]() |
65bb31a405 | ||
![]() |
cc78087b83 | ||
![]() |
0fc2080294 | ||
![]() |
957bc5c92f | ||
![]() |
418febfc44 | ||
![]() |
6aafdc5c04 | ||
![]() |
a178ca6b5c | ||
![]() |
9d5e3ed740 | ||
![]() |
415d268051 | ||
![]() |
43a8f6133d | ||
![]() |
437cecb967 | ||
![]() |
61ad49e7d3 | ||
![]() |
2cf328ad0a | ||
![]() |
dfbb922ddb | ||
![]() |
fe51c4ab3c | ||
![]() |
e684ee786a | ||
![]() |
c416b1de5a | ||
![]() |
e4d85a77aa | ||
![]() |
5ebad51b84 | ||
![]() |
6334ffdbb0 | ||
![]() |
4cbc0c79ac | ||
![]() |
ae8b82e395 | ||
![]() |
38164332e1 | ||
![]() |
92dc0adca2 | ||
![]() |
7f347723d8 | ||
![]() |
a2a74022e2 | ||
![]() |
ba7fa583bf | ||
![]() |
5f282199c8 | ||
![]() |
74132a10f3 | ||
![]() |
4f10ae2b86 | ||
![]() |
4fcd5409e0 | ||
![]() |
a29cf54c02 | ||
![]() |
c254ac796f | ||
![]() |
1b91369455 | ||
![]() |
ccaa9bee2e | ||
![]() |
6769292c0d | ||
![]() |
da55af4763 | ||
![]() |
39339512e2 | ||
![]() |
c96425c364 | ||
![]() |
1fcf2d2f4a | ||
![]() |
3ea5d2e28f | ||
![]() |
7fffc9f11f | ||
![]() |
e38fcc8608 | ||
![]() |
b93aaba84f | ||
![]() |
cdfeb278ab | ||
![]() |
85bb744dfe | ||
![]() |
4401925c82 | ||
![]() |
59ee80764e | ||
![]() |
8e1ffb1859 | ||
![]() |
e7cbf8fd30 | ||
![]() |
b3d838e5d0 | ||
![]() |
acfab3733f | ||
![]() |
2e7b661681 | ||
![]() |
027dbc9f85 | ||
![]() |
e263867f6b | ||
![]() |
0de93fa1da | ||
![]() |
a996d703e9 | ||
![]() |
a75c3afe68 | ||
![]() |
1cc57edaf5 | ||
![]() |
ce32e32f2a | ||
![]() |
a72cae66dc | ||
![]() |
eead773204 | ||
![]() |
d0096de764 | ||
![]() |
426b68b20a | ||
![]() |
1b7fd0fa3e | ||
![]() |
cd7ff122a4 | ||
![]() |
cf5229190d | ||
![]() |
345f9fa77e | ||
![]() |
62073c3048 | ||
![]() |
54f1a77fb6 | ||
![]() |
09ee7234b6 | ||
![]() |
f65b874bda | ||
![]() |
5d55ceb75c | ||
![]() |
fa20c18525 | ||
![]() |
5fae9d9a20 | ||
![]() |
482c573d9e | ||
![]() |
7835e1465f | ||
![]() |
95023eb325 | ||
![]() |
39f87ab2ab | ||
![]() |
dcba56cafa | ||
![]() |
5e90d26658 | ||
![]() |
14599cd760 | ||
![]() |
e74167bd6a | ||
![]() |
70cb8a686f | ||
![]() |
bb61d657c1 | ||
![]() |
5112bfc8cc | ||
![]() |
828feae4f1 | ||
![]() |
4d63882615 | ||
![]() |
43f2185221 | ||
![]() |
480d772f22 | ||
![]() |
7ae5d9d11d | ||
![]() |
ef8b121e2c | ||
![]() |
76bba2a1fc | ||
![]() |
45abddb069 | ||
![]() |
f74775ba1c | ||
![]() |
1939a4f96e | ||
![]() |
452e46dbfc | ||
![]() |
7eb8797b81 | ||
![]() |
ed919de0a7 | ||
![]() |
c5a6599080 | ||
![]() |
a9e8ca4ab4 | ||
![]() |
a1abd64aff | ||
![]() |
2799897ad8 | ||
![]() |
191f6945ac | ||
![]() |
0be1785aea | ||
![]() |
bf7487ab18 | ||
![]() |
4e05cb4023 | ||
![]() |
dd03dea22e | ||
![]() |
0ec40e08d5 | ||
![]() |
d1b7efd578 | ||
![]() |
d00f97a7db | ||
![]() |
7e800bfffc | ||
![]() |
f6783bee07 | ||
![]() |
760dcc6a65 | ||
![]() |
2e1b9171bf | ||
![]() |
ef6900eb79 | ||
![]() |
3fa9d4d717 | ||
![]() |
ecf9496d17 | ||
![]() |
50acb19719 | ||
![]() |
745af91663 | ||
![]() |
87af1cba3c | ||
![]() |
ce335a0d5c | ||
![]() |
01f896d38e | ||
![]() |
9af39cbe31 | ||
![]() |
1133b5e07a | ||
![]() |
470ee2d214 | ||
![]() |
b0692d0311 | ||
![]() |
9549014694 | ||
![]() |
e696ade15d | ||
![]() |
03cec38834 | ||
![]() |
03b5494ca1 | ||
![]() |
028a79b8a1 | ||
![]() |
7c3a7bd1f0 | ||
![]() |
85cda6ae16 | ||
![]() |
f60995adb4 | ||
![]() |
4637c5c242 | ||
![]() |
624c70d763 | ||
![]() |
bfdc0eba0b | ||
![]() |
4f6eb791b4 | ||
![]() |
b01885338b | ||
![]() |
44cef0d563 | ||
![]() |
d73bbd57ee | ||
![]() |
5259da1043 | ||
![]() |
c2801d0938 | ||
![]() |
15a5dc5b89 | ||
![]() |
e2d92b5adf | ||
![]() |
6f00044317 | ||
![]() |
d3be5a89e5 | ||
![]() |
f8342dd5f2 | ||
![]() |
54ba7acba1 | ||
![]() |
2cd4a8065a | ||
![]() |
7e8228cf5a | ||
![]() |
d239b550ce | ||
![]() |
c32bda6bb9 | ||
![]() |
61bc3bbc0e | ||
![]() |
450f5d6694 | ||
![]() |
ffcfc0e432 | ||
![]() |
c44e3cb4e5 | ||
![]() |
4c5da0157f | ||
![]() |
25b45979f2 | ||
![]() |
77270329ba | ||
![]() |
c1609dd497 | ||
![]() |
88b3e00515 | ||
![]() |
0c3a8dea88 | ||
![]() |
e0f9ecc6a4 | ||
![]() |
54ffd5447d | ||
![]() |
e0e9221e23 | ||
![]() |
77a57d5eaf | ||
![]() |
d23159a69c | ||
![]() |
9e103df45e | ||
![]() |
9fc3f04520 | ||
![]() |
ae816bb6aa | ||
![]() |
db9b9f396e | ||
![]() |
08769b7f8a | ||
![]() |
f07aaccd06 | ||
![]() |
7c14b3688c | ||
![]() |
69063507d4 | ||
![]() |
cb28815405 | ||
![]() |
76f5fa549c | ||
![]() |
662ed0a13f | ||
![]() |
75e8f476e7 | ||
![]() |
a025cc17f0 | ||
![]() |
cf5891424e | ||
![]() |
66426469d0 | ||
![]() |
9383421c1c | ||
![]() |
5f6a71b38a | ||
![]() |
e3e5128cf2 | ||
![]() |
6d385c7111 | ||
![]() |
16457c869d | ||
![]() |
d63fdc1198 | ||
![]() |
ca8d4e8933 | ||
![]() |
6d82a0470e | ||
![]() |
e41e5b78c6 | ||
![]() |
baa5c11363 | ||
![]() |
380b8b516e | ||
![]() |
86880b8ff7 | ||
![]() |
59f288ce63 | ||
![]() |
dffb93feaf | ||
![]() |
f9708da223 | ||
![]() |
0024702fe7 | ||
![]() |
881eda695e | ||
![]() |
e6024e0030 | ||
![]() |
ceebd9ac76 | ||
![]() |
3f590c7840 | ||
![]() |
f063d0e89f | ||
![]() |
5f06f0c367 | ||
![]() |
1e2f60993f | ||
![]() |
ed42e64cfc | ||
![]() |
2c0b5281f5 | ||
![]() |
f4ca564ba6 | ||
![]() |
ab55a117e2 | ||
![]() |
a3381af1de | ||
![]() |
82dfee9960 | ||
![]() |
1073b9f93a | ||
![]() |
8cf621ffd9 | ||
![]() |
2e0c003435 | ||
![]() |
1f735f82cc | ||
![]() |
c70f6415f8 | ||
![]() |
07aeaae356 | ||
![]() |
3378a54f15 | ||
![]() |
641d84a4ec | ||
![]() |
581dd40e73 | ||
![]() |
a76dc27801 | ||
![]() |
bc313467bd | ||
![]() |
d619fb5e1c | ||
![]() |
d670e21998 | ||
![]() |
ea8e543bb8 | ||
![]() |
e7b8fe03e8 | ||
![]() |
fb216d1a7c | ||
![]() |
566dab2ac1 | ||
![]() |
4a049ce556 | ||
![]() |
e9519a397f | ||
![]() |
2ae52e649b | ||
![]() |
57258a2c64 | ||
![]() |
1610a566c6 | ||
![]() |
7ef8ff9a2e | ||
![]() |
e59f58f854 | ||
![]() |
4073c8159c | ||
![]() |
02a0c05bf7 | ||
![]() |
016c3cfed2 | ||
![]() |
5e802b113a | ||
![]() |
f116ca115c | ||
![]() |
a12db35efa | ||
![]() |
48205bb064 | ||
![]() |
ac965cd828 | ||
![]() |
e22ad50953 | ||
![]() |
d128791b84 | ||
![]() |
1afa0cb674 | ||
![]() |
d6770cf001 | ||
![]() |
bcf94bba99 | ||
![]() |
de0b239907 | ||
![]() |
459bfe02f9 | ||
![]() |
cee3b8966c | ||
![]() |
40e27f1bf0 | ||
![]() |
31f1c02dda | ||
![]() |
0c7112fcff | ||
![]() |
588c362362 | ||
![]() |
bdf96a5d25 | ||
![]() |
5ce355f6c0 | ||
![]() |
3f02ed32a7 | ||
![]() |
e23f46e86f | ||
![]() |
6b592c1487 | ||
![]() |
e7b877427b | ||
![]() |
f295392724 | ||
![]() |
814fa9a58f | ||
![]() |
3236e662d4 | ||
![]() |
8ec1562355 | ||
![]() |
37ee12b0f3 | ||
![]() |
c60dbcc0aa | ||
![]() |
21b691152c | ||
![]() |
fefab84fff | ||
![]() |
1ddaffda88 | ||
![]() |
6d2a79432b | ||
![]() |
031bf1d0fa | ||
![]() |
1eb8e9217f | ||
![]() |
9a716018be | ||
![]() |
a9fa6d265d | ||
![]() |
d765a3e71b | ||
![]() |
6a3c2215bb | ||
![]() |
e51260e4fe | ||
![]() |
d727c5ae7b | ||
![]() |
aaced3f990 | ||
![]() |
6c706227f5 | ||
![]() |
949a077a58 | ||
![]() |
0c71fb672f | ||
![]() |
e1ed2a207b | ||
![]() |
a6c418ee43 | ||
![]() |
b6632d616f | ||
![]() |
626d9eba9c | ||
![]() |
6f09acf855 | ||
![]() |
5a10d93d29 | ||
![]() |
7b07f4e83f | ||
![]() |
a8eecab079 | ||
![]() |
d4bb431621 | ||
![]() |
3cd98a6094 | ||
![]() |
7641c73dec | ||
![]() |
40ee8c1814 | ||
![]() |
a4c235ed3a | ||
![]() |
82eea29797 | ||
![]() |
09e0549d51 | ||
![]() |
c029f4c1da | ||
![]() |
4a855e6beb | ||
![]() |
8570b544e9 | ||
![]() |
b1b678427e | ||
![]() |
9e7f495589 | ||
![]() |
f47e023498 | ||
![]() |
00d89f5170 | ||
![]() |
ceaf49d735 | ||
![]() |
8e448cadf9 | ||
![]() |
4456861f7e | ||
![]() |
2560da6be2 | ||
![]() |
34b22d6049 | ||
![]() |
e45ffb5d1f | ||
![]() |
8a29368bf1 | ||
![]() |
54703a719f | ||
![]() |
8e702c3d0f |
6
.mailmap
6
.mailmap
@@ -5,4 +5,8 @@ Victor Lowther <victor.lowther@gmail.com> <victor.lowther-Re5JQEeQqe8AvxtiuMwx3w
|
||||
Harald Hoyer <harald@redhat.com> <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
|
||||
Harald Hoyer <harald@redhat.com> <harald@eeepc.(none)>
|
||||
Mike Snitzer <snitzer@redhat.com> <msnitzer@redhat.com>
|
||||
|
||||
Amerigo Wang <amwang@redhat.com> <xiyou.wangcong@gmail.com>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com> <arvidjaar@mail.ru>
|
||||
Dan Horák <dhorak@redhat.com> <dan@danny.cz>
|
||||
John Reiser <jreiser@bitwagon.com> <jreiser@BitWagon.com>
|
||||
Luca Berra <bluca@vodka.it> <bluca@comedia.it>
|
||||
|
39
AUTHORS
39
AUTHORS
@@ -2,50 +2,65 @@ Harald Hoyer <harald@redhat.com>
|
||||
Victor Lowther <victor.lowther@gmail.com>
|
||||
Philippe Seewer <philippe.seewer@bfh.ch>
|
||||
Warren Togami <wtogami@redhat.com>
|
||||
Jeremy Katz <katzj@redhat.com>
|
||||
Amadeusz Żołnowski <aidecoe@aidecoe.name>
|
||||
Jeremy Katz <katzj@redhat.com>
|
||||
David Dillow <dave@thedillows.org>
|
||||
Michal Soltys <soltys@ziu.info>
|
||||
Will Woods <wwoods@redhat.com>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Andreas Thienemann <andreas@bawue.net>
|
||||
Hans de Goede <hdegoede@redhat.com>
|
||||
Peter Jones <pjones@redhat.com>
|
||||
Luca Berra <bluca@comedia.it>
|
||||
Will Woods <wwoods@redhat.com>
|
||||
Andrey Borzenkov <arvidjaar@mail.ru>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Marc Grimme <grimme@atix.de>
|
||||
Amerigo Wang <amwang@redhat.com>
|
||||
Colin Guthrie <colin@mageia.org>
|
||||
John Reiser <jreiser@bitwagon.com>
|
||||
Luca Berra <bluca@vodka.it>
|
||||
Dave Young <dyoung@redhat.com>
|
||||
Daniel Drake <dsd@laptop.org>
|
||||
Marc Grimme <grimme@atix.de>
|
||||
Roberto Sassu <roberto.sassu@polito.it>
|
||||
Anton Blanchard <anton@samba.org>
|
||||
Bill Nottingham <notting@redhat.com>
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
Dan Horák <dhorak@redhat.com>
|
||||
David Cantrell <dcantrell@redhat.com>
|
||||
Lance Albertson <lance@osuosl.org>
|
||||
Marian Ganisin <mganisin@redhat.com>
|
||||
Michael Ploujnikov <plouj@somanetworks.com>
|
||||
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
||||
Dan Horák <dan@danny.cz>
|
||||
Alan Pevec <apevec@redhat.com>
|
||||
Ian Dall <ian@beware.dropbear.id.au>
|
||||
James Buren <ryuo@frugalware.org>
|
||||
Joey Boggs <jboggs@redhat.com>
|
||||
Jon Ander Hernandez <jonan.h@gmail.com>
|
||||
Mike Snitzer <snitzer@redhat.com>
|
||||
Peter Rajnoha <prajnoha@redhat.com>
|
||||
Przemysław Rudy <prudy1@o2.pl>
|
||||
Vladislav Bogdanov <bubble@hoster-ok.com>
|
||||
Alexander Todorov <atodorov@redhat.com>
|
||||
Andy Lutomirski <luto@mit.edu>
|
||||
Anssi Hannula <anssi@mageia.org>
|
||||
Christian Heinz <christian.ch.heinz@gmail.com>
|
||||
Dan Horák <dhorak@redhat.com>
|
||||
Dave Jones <davej@redhat.com>
|
||||
Duane Griffin <duaneg@dghda.com>
|
||||
Frederic Crozat <fcrozat@mandriva.com>
|
||||
Glen Gray <slaine@slaine.org>
|
||||
Ian Dall <ian@beware.dropbear.id.au>
|
||||
Hermann Gausterer <git-dracut-2012@mrq1.org>
|
||||
James Laska <jlaska@redhat.com>
|
||||
Jon Ander Hernandez <jonan.h@gmail.com>
|
||||
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Leho Kraav <leho@kraav.com>
|
||||
Lubomir Rintel <lkundrak@v3.sk>
|
||||
Luca Berra <bluca@vodka.it>
|
||||
Matt <smoothsailing72@hotmail.com>
|
||||
Matt Smith <shadowfax@gmx.com>
|
||||
Michal Schmidt <mschmidt@redhat.com>
|
||||
Michal Soltys <soltys@ziu.info>
|
||||
Munehiro Matsuda <haro@kgt.co.jp>
|
||||
Paolo Bonzini <pbonzini@redhat.com>
|
||||
Peter Robinson <pbrobinson@fedoraproject.org>
|
||||
Pádraig Brady <P@draigBrady.com>
|
||||
Quentin Armitage <quentin@armitage.org.uk>
|
||||
Sergey Fionov <fionov@gmail.com>
|
||||
Thilo Bangert <thilo.bangert@gmx.net>
|
||||
Thomas Lange <lange@informatik.uni-koeln.de>
|
||||
Tomasz Torcz <tomek@pipebreaker.pl>
|
||||
Vadim Kuznetsov <vadimk@gentoo.org>
|
||||
Ville Skyttä <ville.skytta@iki.fi>
|
||||
|
47
Makefile
47
Makefile
@@ -1,14 +1,15 @@
|
||||
VERSION=011
|
||||
VERSION=015
|
||||
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
|
||||
|
||||
prefix ?= /usr
|
||||
libdir ?= ${prefix}/lib
|
||||
datadir ?= ${prefix}/share
|
||||
pkglibdir ?= ${datadir}/dracut
|
||||
pkglibdir ?= ${libdir}/dracut
|
||||
sysconfdir ?= ${prefix}/etc
|
||||
sbindir ?= ${prefix}/sbin
|
||||
bindir ?= ${prefix}/bin
|
||||
mandir ?= ${prefix}/share/man
|
||||
|
||||
manpages = dracut.8 dracut.kernel.7 dracut.conf.5 dracut-catimages.8 dracut-gencmdline.8
|
||||
manpages = dracut.8 dracut.cmdline.7 dracut.conf.5 dracut-catimages.8 dracut-gencmdline.8
|
||||
|
||||
.PHONY: install clean archive rpm testimage test all check AUTHORS doc
|
||||
|
||||
@@ -26,25 +27,26 @@ dracut.html: dracut.xml $(manpages)
|
||||
|
||||
install: doc
|
||||
mkdir -p $(DESTDIR)$(pkglibdir)
|
||||
mkdir -p $(DESTDIR)$(sbindir)
|
||||
mkdir -p $(DESTDIR)$(bindir)
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)
|
||||
mkdir -p $(DESTDIR)$(pkglibdir)/modules.d
|
||||
mkdir -p $(DESTDIR)$(mandir)/man{5,7,8}
|
||||
install -m 0755 dracut $(DESTDIR)$(sbindir)/dracut
|
||||
install -m 0755 dracut-gencmdline $(DESTDIR)$(sbindir)/dracut-gencmdline
|
||||
install -m 0755 dracut-catimages $(DESTDIR)$(sbindir)/dracut-catimages
|
||||
install -m 0755 mkinitrd-dracut.sh $(DESTDIR)$(sbindir)/mkinitrd
|
||||
install -m 0755 lsinitrd $(DESTDIR)$(sbindir)/lsinitrd
|
||||
mkdir -p $(DESTDIR)$(mandir)/man5 $(DESTDIR)$(mandir)/man7 $(DESTDIR)$(mandir)/man8
|
||||
install -m 0755 dracut $(DESTDIR)$(bindir)/dracut
|
||||
install -m 0755 dracut-gencmdline $(DESTDIR)$(bindir)/dracut-gencmdline
|
||||
install -m 0755 dracut-catimages $(DESTDIR)$(bindir)/dracut-catimages
|
||||
install -m 0755 mkinitrd-dracut.sh $(DESTDIR)$(bindir)/mkinitrd
|
||||
install -m 0755 lsinitrd $(DESTDIR)$(bindir)/lsinitrd
|
||||
install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
|
||||
install -m 0755 dracut-functions $(DESTDIR)$(pkglibdir)/dracut-functions
|
||||
install -m 0755 dracut-logger $(DESTDIR)$(pkglibdir)/dracut-logger
|
||||
cp -arx modules.d $(DESTDIR)$(pkglibdir)
|
||||
install -m 0644 dracut.8 $(DESTDIR)$(mandir)/man8
|
||||
install -m 0644 dracut-catimages.8 $(DESTDIR)$(mandir)/man8
|
||||
install -m 0644 dracut-gencmdline.8 $(DESTDIR)$(mandir)/man8
|
||||
install -m 0644 dracut.conf.5 $(DESTDIR)$(mandir)/man5
|
||||
install -m 0644 dracut.kernel.7 $(DESTDIR)$(mandir)/man7
|
||||
install -m 0644 dracut.8 $(DESTDIR)$(mandir)/man8/dracut.8
|
||||
install -m 0644 dracut-catimages.8 $(DESTDIR)$(mandir)/man8/dracut-catimages.8
|
||||
install -m 0644 dracut-gencmdline.8 $(DESTDIR)$(mandir)/man8/dracut-gencmdline.8
|
||||
install -m 0644 dracut.conf.5 $(DESTDIR)$(mandir)/man5/dracut.conf.5
|
||||
install -m 0644 dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.cmdline.7
|
||||
ln -s dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.kernel.7
|
||||
|
||||
clean:
|
||||
$(RM) *~
|
||||
@@ -66,14 +68,13 @@ dracut-$(VERSION).tar.gz:
|
||||
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ |gzip > dracut-$(VERSION).tar.gz
|
||||
|
||||
rpm: dracut-$(VERSION).tar.bz2
|
||||
mkdir -p rpmbuild
|
||||
cp dracut-$(VERSION).tar.bz2 rpmbuild
|
||||
cd rpmbuild; ../git2spec.pl $(VERSION) < ../dracut.spec > dracut.spec; \
|
||||
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
|
||||
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
|
||||
cp dracut-$(VERSION).tar.bz2 "$$rpmbuild"; \
|
||||
$$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
|
||||
(cd "$$rpmbuild"; rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
|
||||
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
|
||||
--define "_rpmdir $$PWD" -ba dracut.spec || :; \
|
||||
cd ..;
|
||||
mv rpmbuild/noarch/*.rpm .; mv rpmbuild/*.src.rpm .;rm -fr rpmbuild; ls *.rpm
|
||||
--define "_rpmdir $$PWD" -ba dracut.spec; ) && \
|
||||
( mv "$$rpmbuild"/noarch/*.rpm .; mv "$$rpmbuild"/*.src.rpm .;rm -fr "$$rpmbuild"; ls *.rpm )
|
||||
|
||||
syncheck:
|
||||
@ret=0;for i in dracut-logger modules.d/99base/init modules.d/*/*.sh; do \
|
||||
|
86
NEWS
86
NEWS
@@ -1,3 +1,87 @@
|
||||
dracut-015
|
||||
==========
|
||||
- hostonly mode automatically adds command line options for root and /usr
|
||||
- --add-fstab --mount parameters
|
||||
- ssh-client module
|
||||
- --ctty option: add job control
|
||||
- cleanup /run/initramfs
|
||||
- convertfs module
|
||||
- /sbin/ifup can be called directly
|
||||
- support kernel modules compressed with xz
|
||||
- s390 iscsi modules added
|
||||
- terminfo module
|
||||
- lsinitrd can handle concatened images
|
||||
- lsinitrd can sort by size
|
||||
|
||||
dracut-014
|
||||
==========
|
||||
- new dracut arguments:
|
||||
--lvmconf
|
||||
--nolvmconf
|
||||
--fscks [LIST]
|
||||
--nofscks
|
||||
- new .conf options:
|
||||
install_items
|
||||
fscks
|
||||
nofscks
|
||||
- new kernel options:
|
||||
rd.md.ddf
|
||||
rd.md.waitclean
|
||||
plymouth.enable
|
||||
- dracut move from /sbin to /usr/bin
|
||||
- dracut modules dir moved from /usr/share/dracut to /usr/lib/dracut
|
||||
- profiling with "dracut --profile"
|
||||
- new TEST-16-DMSQUASH, test for Fedora LiveCDs
|
||||
- speedup of initramfs creation
|
||||
- ask_for_password fallback to CLI
|
||||
- mdraid completely switched to incremental assembly
|
||||
- no more cdrom polling
|
||||
- "switch_root" breakpoint is now very late
|
||||
- /dev/live is gone
|
||||
- /dev/root is gone
|
||||
- fs-lib dracut module for fscks added
|
||||
- xen dracut module removed
|
||||
- usb mass storage kernel drivers now included
|
||||
- usrmount dracut module added:
|
||||
mount /usr if found in /sysroot/etc/fstab
|
||||
- only include fsck helper needed for hostonly
|
||||
- fcoe: support for bnx2fc
|
||||
- support iSCSI drivers: qla4xxx, cxgb3i, cxgb4i, bnx2i, be2iscsi
|
||||
- fips-aesni dracut module added
|
||||
- add install_items to dracut.conf
|
||||
install_items+=" <file>[ <file> ...] "
|
||||
- speedup internal testsuite
|
||||
- internal testsuite: store temporary data in a temporary dir
|
||||
|
||||
dracut-013
|
||||
==========
|
||||
- speedup of initramfs creation
|
||||
- fixed inst_dir for symbolic links
|
||||
- add unix kernel module
|
||||
|
||||
dracut-012
|
||||
==========
|
||||
- better fsck handling
|
||||
- fixed wait condition for LVM volumes
|
||||
- fix for hardlinks (welcome Debian! :-)
|
||||
- shutdown bugfixes
|
||||
- automatic busybox symlink creation
|
||||
- try to mount /usr, if init points to a path in /usr
|
||||
- btrfs with multiple devices
|
||||
- "--force-add" option for dracut, to force-add dracut modules,
|
||||
without hostonly checks
|
||||
- lsinitrd also display the initramfs size in human readable form
|
||||
- livenet module, to mount live-isos over http
|
||||
- masterkey,ecryptfs,integrity security modules
|
||||
- initqueue/timeout queue e.g. for starting degraded raids
|
||||
- "make rpm" creates an rpm with an increasing release number from any
|
||||
git checkout
|
||||
- support lvm mirrors
|
||||
- start degraded lvm mirrors after a timeout
|
||||
- start degraded md raids after a timeout
|
||||
- getarg() now returns wildcards without file matching to the current fs
|
||||
- lots of bugfixes
|
||||
|
||||
dracut-011
|
||||
==========
|
||||
- use udev-168 features for shutting down udev
|
||||
@@ -21,7 +105,7 @@ dracut-009
|
||||
|
||||
- initramfs
|
||||
- hooks moved to /lib/dracut/hooks in initramfs
|
||||
- rd.driver.{blacklist|pre|post} accept comma seperated driver list
|
||||
- rd.driver.{blacklist|pre|post} accept comma separated driver list
|
||||
- iSCSI: iSCSI Boot Firmware Table (iBFT) support
|
||||
- support for /run
|
||||
- live image: support for generic rootfs.img (instead of ext3fs.img)
|
||||
|
1
TODO
1
TODO
@@ -4,6 +4,7 @@ INITRAMFS TODO
|
||||
- The hard-coded list of udev rules that we care about is kind of lame.
|
||||
- automatic kexec fallback
|
||||
- panic fallback
|
||||
- fsck for $NEWROOT/usr
|
||||
|
||||
GENERATOR TODO
|
||||
|
||||
|
53
debian/changelog
vendored
53
debian/changelog
vendored
@@ -1,53 +0,0 @@
|
||||
dracut (2.26) unstable; urgency=low
|
||||
|
||||
[ Harald Hoyer ]
|
||||
* multipath: install udev rules and helper tools
|
||||
* NEWS update
|
||||
* multipath: install xdr utils
|
||||
* multipath: install multipath kernel module
|
||||
* specfile update
|
||||
* dracut.8: fixed formatting for rootfs and mount options
|
||||
* dracut: check more return codes, check for permissions and use
|
||||
derror
|
||||
* dracut: create initramfs-$(kernelversion).img by default
|
||||
* Makefile: add WITH_SWITCH_ROOT
|
||||
* fips: search different lib paths
|
||||
* kernel-modules: add firewire-ohci to hardcoded modules list
|
||||
* 90dm: install more device mapper kernel modules
|
||||
* specfile update
|
||||
|
||||
[ Peter Jones ]
|
||||
* Use glob for libdir when installing multipath libraries.
|
||||
* Add #!/bin/bash for consistency.
|
||||
* Make sure and get all the multipath related modules.
|
||||
* Bring up multipath devices that are configured in multipath.conf.
|
||||
* Fix missing shell variables.
|
||||
* This has to be executable.
|
||||
* Handle modules with hyphens in their names properly.
|
||||
|
||||
[ Harald Hoyer ]
|
||||
* lvm: scan without monitor
|
||||
|
||||
[ Yanko Kaneti ]
|
||||
* Wildcards need dracut_install
|
||||
|
||||
[ Harald Hoyer ]
|
||||
* lvm/dmraid: make LIBDIR depend on the binary
|
||||
* nfs: install passwd entries for nobody and nfsnobody
|
||||
* nfs: add rd_NFS_DOMAIN parameter to set the NFSv4 domain name
|
||||
* dracut-functions: inst_simple(): do not bail out if target is a dir
|
||||
and exists
|
||||
* dm: install dmsetup
|
||||
* multipath: corrected initqueue parameter
|
||||
* rootfs-block/mount-root: remount root with /etc/fstab filesystem
|
||||
options
|
||||
* test: set PATH
|
||||
|
||||
-- Philippe Seewer <philippe.seewer@.bfh.ch> Fri, 27 Nov 2009 10:58:26 +0100
|
||||
|
||||
dracut (2.21) unstable; urgency=low
|
||||
[ Harald Hoyer ]
|
||||
* fix rd_DASD argument handling (bug #531720)
|
||||
* Resolves: rhbz#531720
|
||||
|
||||
-- Philippe Seewer <philippe.seewer@.bfh.ch> Fri, 06 Nov 2009 15:52:00 +0100
|
1
debian/compat
vendored
1
debian/compat
vendored
@@ -1 +0,0 @@
|
||||
5
|
41
debian/control
vendored
41
debian/control
vendored
@@ -1,41 +0,0 @@
|
||||
Source: dracut
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Maintainer: Philippe Seewer <philippe.seewer@bfh.ch>
|
||||
Build-Depends: debhelper (>= 5.0), cdbs
|
||||
Standards-Version: 3.8.4
|
||||
Vcs-Browser: http://git.kernel.org/?p=boot/dracut/dracut.git
|
||||
Vcs-Git: git://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
|
||||
Package: dracut
|
||||
Architecture: all
|
||||
Recommends: cryptsetup, dmsetup, dmraid, lvm2, mdadm
|
||||
Suggests: dracut-network
|
||||
Depends: cpio, module-init-tools, udev, ${misc:Depends}
|
||||
Provides: linux-initramfs-tool
|
||||
Description: A new initramfs infrastructure
|
||||
Unlike existing initramfs's, this is an attempt at having as little as
|
||||
possible hard-coded into the initramfs as possible. The initramfs has
|
||||
(basically) one purpose in life -- getting the rootfs mounted so that
|
||||
we can transition to the real rootfs. This is all driven off of
|
||||
device availability. Therefore, instead of scripts hard-coded to do
|
||||
various things, we depend on udev to create device nodes for us and
|
||||
then when we have the rootfs's device node, we mount and carry on.
|
||||
Having the root on MD, LVM2, LUKS is supported as well as NFS, iSCSI,
|
||||
NBD and FCOE with dracut-network.
|
||||
|
||||
Package: dracut-network
|
||||
Architecture: all
|
||||
Recommends: nfs-common, open-iscsi, nbd-client
|
||||
Depends: dracut, iputils-arping, dhcp3-client, ${misc:Depends}
|
||||
Description: A new initramfs infrastucture
|
||||
Unlike existing initramfs's, this is an attempt at having as little as
|
||||
possible hard-coded into the initramfs as possible. The initramfs has
|
||||
(basically) one purpose in life -- getting the rootfs mounted so that
|
||||
we can transition to the real rootfs. This is all driven off of
|
||||
device availability. Therefore, instead of scripts hard-coded to do
|
||||
various things, we depend on udev to create device nodes for us and
|
||||
then when we have the rootfs's device node, we mount and carry on.
|
||||
Having the root on MD, LVM2, LUKS is supported as well as NFS, iSCSI,
|
||||
NBD and FCOE with dracut-network.
|
||||
|
39
debian/copyright
vendored
39
debian/copyright
vendored
@@ -1,39 +0,0 @@
|
||||
This package was debianized by Philippe Seewer <philippe.seewer@bfh.ch> on
|
||||
Fri Nov 20 15:45:00 +0100
|
||||
|
||||
Sources can be downloaded from:
|
||||
|
||||
http://www.kernel.org/pub/linux/utils/boot/dracut/
|
||||
|
||||
Upstream Maintainer:
|
||||
Harald Hoyer <harald@redhat.com>
|
||||
|
||||
Updstream Authors:
|
||||
Victor Lowther <victor.lowther@gmail.com>
|
||||
Warren Togami <wtogami@redhat.com>
|
||||
Jeremy Katz <katzj@redhat.com>
|
||||
Philippe Seewer <philippe.seewer@bfh.ch>
|
||||
David Dillow <dave@thedillows.org>
|
||||
Andreas Thienemann <andreas@bawue.net>
|
||||
Hans de Goede <hdegoede@redhat.com>
|
||||
Marc Grimme <grimme@atix.de>
|
||||
Bill Nottingham <notting@redhat.com>
|
||||
Daniel Drake <dsd@laptop.org>
|
||||
Lance Albertson <lance@osuosl.org>
|
||||
Michael Ploujnikov <plouj@somanetworks.com>
|
||||
Peter Jones <pjones@redhat.com>
|
||||
Dave Jones <davej@redhat.com>
|
||||
Michal Schmidt <mschmidt@redhat.com>
|
||||
Peter Rajnoha <prajnoha@redhat.com>
|
||||
Quentin Armitage <quentin@armitage.org.uk>
|
||||
Sergey Fionov <fionov@gmail.com>
|
||||
Thilo Bangert <thilo.bangert@gmx.net>
|
||||
|
||||
Copyright:
|
||||
Copyright 2009 Harald Hoyer <harald@redhat.com>
|
||||
|
||||
|
||||
License: GPLv2
|
||||
|
||||
On Debian systems, the complete text of the GNU General Public
|
||||
License version 2 can be found in `/usr/share/common-licenses/GPL-2'.
|
5
debian/dracut-network.dirs
vendored
5
debian/dracut-network.dirs
vendored
@@ -1,5 +0,0 @@
|
||||
usr/share/dracut/modules.d/40network
|
||||
usr/share/dracut/modules.d/95fcoe
|
||||
usr/share/dracut/modules.d/95iscsi
|
||||
usr/share/dracut/modules.d/95nbd
|
||||
usr/share/dracut/modules.d/95nfs
|
5
debian/dracut-network.install
vendored
5
debian/dracut-network.install
vendored
@@ -1,5 +0,0 @@
|
||||
modules.d/40network usr/share/dracut/modules.d
|
||||
modules.d/95fcoe usr/share/dracut/modules.d
|
||||
modules.d/95iscsi usr/share/dracut/modules.d
|
||||
modules.d/95nbd usr/share/dracut/modules.d
|
||||
modules.d/95nfs usr/share/dracut/modules.d
|
25
debian/dracut.dirs
vendored
25
debian/dracut.dirs
vendored
@@ -1,25 +0,0 @@
|
||||
usr/share/dracut
|
||||
usr/share/dracut/modules.d/00dash
|
||||
usr/share/dracut/modules.d/01fips
|
||||
usr/share/dracut/modules.d/60xen
|
||||
usr/share/dracut/modules.d/90crypt
|
||||
usr/share/dracut/modules.d/90dm
|
||||
usr/share/dracut/modules.d/90dmraid
|
||||
usr/share/dracut/modules.d/90kernel-modules
|
||||
usr/share/dracut/modules.d/90lvm
|
||||
usr/share/dracut/modules.d/90mdraid
|
||||
usr/share/dracut/modules.d/90multipath
|
||||
usr/share/dracut/modules.d/95dasd
|
||||
usr/share/dracut/modules.d/95dasd_mod
|
||||
usr/share/dracut/modules.d/95debug
|
||||
usr/share/dracut/modules.d/95resume
|
||||
usr/share/dracut/modules.d/95rootfs-block
|
||||
usr/share/dracut/modules.d/95terminfo
|
||||
usr/share/dracut/modules.d/95udev-rules
|
||||
usr/share/dracut/modules.d/95uswsusp
|
||||
usr/share/dracut/modules.d/95zfcp
|
||||
usr/share/dracut/modules.d/95znet
|
||||
usr/share/dracut/modules.d/98syslog
|
||||
usr/share/dracut/modules.d/99base
|
||||
/var/lib/dracut
|
||||
/etc/dracut.conf.d
|
4
debian/dracut.docs
vendored
4
debian/dracut.docs
vendored
@@ -1,4 +0,0 @@
|
||||
HACKING
|
||||
README.generic
|
||||
README.kernel
|
||||
README.modules
|
28
debian/dracut.install
vendored
28
debian/dracut.install
vendored
@@ -1,28 +0,0 @@
|
||||
dracut usr/sbin
|
||||
dracut-catimages usr/sbin
|
||||
dracut-update-initramfs usr/sbin
|
||||
dracut-gencmdline usr/sbin
|
||||
dracut-functions usr/share/dracut
|
||||
dracut.conf etc
|
||||
modules.d/00dash usr/share/dracut/modules.d
|
||||
modules.d/01fips usr/share/dracut/modules.d
|
||||
modules.d/60xen usr/share/dracut/modules.d
|
||||
modules.d/90crypt usr/share/dracut/modules.d
|
||||
modules.d/90dm usr/share/dracut/modules.d
|
||||
modules.d/90dmraid usr/share/dracut/modules.d
|
||||
modules.d/90kernel-modules usr/share/dracut/modules.d
|
||||
modules.d/90lvm usr/share/dracut/modules.d
|
||||
modules.d/90mdraid usr/share/dracut/modules.d
|
||||
modules.d/90multipath usr/share/dracut/modules.d
|
||||
modules.d/95dasd usr/share/dracut/modules.d
|
||||
modules.d/95dasd_mod usr/share/dracut/modules.d
|
||||
modules.d/95debug usr/share/dracut/modules.d
|
||||
modules.d/95resume usr/share/dracut/modules.d
|
||||
modules.d/95rootfs-block usr/share/dracut/modules.d
|
||||
modules.d/95terminfo usr/share/dracut/modules.d
|
||||
modules.d/95udev-rules usr/share/dracut/modules.d
|
||||
modules.d/95uswsusp usr/share/dracut/modules.d
|
||||
modules.d/95zfcp usr/share/dracut/modules.d
|
||||
modules.d/95znet usr/share/dracut/modules.d
|
||||
modules.d/98syslog usr/share/dracut/modules.d
|
||||
modules.d/99base usr/share/dracut/modules.d
|
4
debian/dracut.manpages
vendored
4
debian/dracut.manpages
vendored
@@ -1,4 +0,0 @@
|
||||
dracut.8
|
||||
dracut.conf.5
|
||||
dracut-catimages.8
|
||||
dracut-gencmdline.8
|
8
debian/dracut.postinst
vendored
8
debian/dracut.postinst
vendored
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# Regenerate initramfs when we're `installed`
|
||||
DPKG_MAINTSCRIPT_PACKAGE='' dracut-update-initramfs -u
|
||||
|
||||
#DEBHELPER#
|
1
debian/dracut.triggers
vendored
1
debian/dracut.triggers
vendored
@@ -1 +0,0 @@
|
||||
interest update-initramfs
|
3
debian/rules
vendored
3
debian/rules
vendored
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
include /usr/share/cdbs/1/rules/debhelper.mk
|
196
dracut
196
dracut
@@ -35,7 +35,7 @@ Creates initial ramdisk images for preloading modules
|
||||
-f, --force Overwrite existing initramfs file.
|
||||
-m, --modules [LIST] Specify a space-separated list of dracut modules to
|
||||
call when building the initramfs. Modules are located
|
||||
in /usr/share/dracut/modules.d.
|
||||
in /usr/lib/dracut/modules.d.
|
||||
-o, --omit [LIST] Omit a space-separated list of dracut modules.
|
||||
-a, --add [LIST] Add a space-separated list of dracut modules.
|
||||
-d, --drivers [LIST] Specify a space-separated list of kernel modules to
|
||||
@@ -59,8 +59,11 @@ Creates initial ramdisk images for preloading modules
|
||||
--nomdadmconf Do not include local /etc/mdadm.conf
|
||||
--lvmconf Include local /etc/lvm/lvm.conf
|
||||
--nolvmconf Do not include local /etc/lvm/lvm.conf
|
||||
--fscks [LIST] Add a space-separated list of fsck helpers.
|
||||
--nofscks Inhibit installation of any fsck helpers.
|
||||
-h, --help This message
|
||||
--debug Output debug information of the build process
|
||||
--profile Output profile information of the build process
|
||||
-L, --stdlog [0-6] Specify logging level (to standard error)
|
||||
0 - suppress any messages
|
||||
1 - only fatal errors
|
||||
@@ -77,11 +80,15 @@ Creates initial ramdisk images for preloading modules
|
||||
from. Default: /etc/dracut.conf.d
|
||||
-l, --local Local mode. Use modules from the current working
|
||||
directory instead of the system-wide installed in
|
||||
/usr/share/dracut/modules.d.
|
||||
/usr/lib/dracut/modules.d.
|
||||
Useful when running dracut from a git checkout.
|
||||
-H, --hostonly Host-Only mode: Install only what is needed for
|
||||
booting the local host instead of a generic host.
|
||||
--fstab Use /etc/fstab to determine the root device.
|
||||
--add-fstab [FILE] Add file to the initramfs fstab
|
||||
--mount "[DEV] [MP] [FSTYPE] [FSOPTS]"
|
||||
Mount device [DEV] on mountpoint [MP] with filesystem
|
||||
[FSTYPE] and options [FSOPTS] in the initramfs
|
||||
-i, --include [SOURCE] [TARGET]
|
||||
Include the files in the SOURCE directory into the
|
||||
Target directory in the final initramfs.
|
||||
@@ -111,6 +118,12 @@ Creates initial ramdisk images for preloading modules
|
||||
-M, --show-modules Print included module's name to standard output during
|
||||
build.
|
||||
--keep Keep the temporary initramfs for debugging purposes
|
||||
--sshkey [SSHKEY] Add ssh key to initramfs (use with ssh-client module)
|
||||
--ctty Add control tty for emergency shells
|
||||
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes.
|
||||
For example:
|
||||
# dracut --add-drivers "module1 module2" ...
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -195,19 +208,22 @@ verbosity_mod_l=0
|
||||
while (($# > 0)); do
|
||||
case ${1%%=*} in
|
||||
-a|--add) push_arg add_dracutmodules_l "$@" || shift;;
|
||||
--force-add) push_arg force_add_dracutmodules_l "$@" || shift;;
|
||||
--add-drivers) push_arg add_drivers_l "$@" || shift;;
|
||||
-m|--modules) push_arg dracutmodules_l "$@" || shift;;
|
||||
-o|--omit) push_arg omit_dracutmodules_l "$@" || shift;;
|
||||
-d|--drivers) push_arg drivers_l "$@" || shift;;
|
||||
--filesystems) push_arg filesystems_l "$@" || shift;;
|
||||
-I|--install) push_arg install_items "$@" || shift;;
|
||||
-I|--install) push_arg install_items_l "$@" || shift;;
|
||||
--fwdir) push_arg fw_dir_l "$@" || shift;;
|
||||
--fscks) push_arg fscks_l "$@" || shift;;
|
||||
--add-fstab) push_arg add_fstab_l "$@" || shift;;
|
||||
--mount) push_arg fstab_lines "$@" || shift;;
|
||||
--nofscks) nofscks_l="yes";;
|
||||
-k|--kmoddir) read_arg drivers_dir_l "$@" || shift;;
|
||||
-c|--conf) read_arg conffile "$@" || shift;;
|
||||
--confdir) read_arg confdir "$@" || shift;;
|
||||
-L|--stdlog) read_arg stdloglvl_l "$@" || shift;;
|
||||
-I|--install) read_arg install_items "$@" || shift;;
|
||||
--fwdir) read_arg fw_dir_l "$@" || shift;;
|
||||
--compress) read_arg compress_l "$@" || shift;;
|
||||
--prefix) read_arg prefix_l "$@" || shift;;
|
||||
-f|--force) force=yes;;
|
||||
@@ -221,6 +237,9 @@ while (($# > 0)); do
|
||||
--lvmconf) lvmconf_l="yes";;
|
||||
--nolvmconf) lvmconf_l="no";;
|
||||
--debug) debug="yes";;
|
||||
--profile) profile="yes";;
|
||||
--ctty) cttyhack="yes";;
|
||||
--sshkey) read_arg sshkey "$@" || shift;;
|
||||
-v|--verbose) ((verbosity_mod_l++));;
|
||||
-q|--quiet) ((verbosity_mod_l--));;
|
||||
-l|--local) allowlocal="yes" ;;
|
||||
@@ -260,15 +279,29 @@ if ! [[ $kernel ]]; then
|
||||
fi
|
||||
[[ $outfile ]] || outfile="/boot/initramfs-$kernel.img"
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
for i in /usr/bin /bin /usr/sbin /sbin; do
|
||||
rl=$i
|
||||
if [ -L "$i" ]; then
|
||||
rl=$(readlink -f $i)
|
||||
fi
|
||||
PATH="$PATH:$rl"
|
||||
done
|
||||
export PATH
|
||||
unset LD_LIBRARY_PATH
|
||||
unset GREP_OPTIONS
|
||||
|
||||
[[ $debug ]] && {
|
||||
export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
|
||||
set -x
|
||||
}
|
||||
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
|
||||
[[ $profile ]] && {
|
||||
export PS4='+ $(date "+%s.%N") ${BASH_SOURCE}@${LINENO}: ';
|
||||
set -x
|
||||
debug=yes
|
||||
}
|
||||
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
|
||||
[[ $allowlocal && -f "$(readlink -f ${0%/*})/dracut-functions" ]] && \
|
||||
dracutbasedir="$(readlink -f ${0%/*})"
|
||||
@@ -301,12 +334,43 @@ if (( ${#add_dracutmodules_l[@]} )); then
|
||||
done
|
||||
fi
|
||||
|
||||
if (( ${#force_add_dracutmodules_l[@]} )); then
|
||||
while pop force_add_dracutmodules_l val; do
|
||||
force_add_dracutmodules+=" $val "
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
if (( ${#add_drivers_l[@]} )); then
|
||||
while pop add_drivers_l val; do
|
||||
add_drivers+=" $val "
|
||||
done
|
||||
fi
|
||||
|
||||
if (( ${#fscks_l[@]} )); then
|
||||
while pop fscks_l val; do
|
||||
fscks+=" $val "
|
||||
done
|
||||
fi
|
||||
|
||||
if (( ${#add_fstab_l[@]} )); then
|
||||
while pop add_fstab_l val; do
|
||||
add_fstab+=" $val "
|
||||
done
|
||||
fi
|
||||
|
||||
if (( ${#fstab_lines_l[@]} )); then
|
||||
while pop fstab_lines_l val; do
|
||||
push fstab_lines $val
|
||||
done
|
||||
fi
|
||||
|
||||
if (( ${#install_items_l[@]} )); then
|
||||
while pop install_items_l val; do
|
||||
install_items+=" $val "
|
||||
done
|
||||
fi
|
||||
|
||||
# these options override the stuff in the config file
|
||||
if (( ${#dracutmodules_l[@]} )); then
|
||||
dracutmodules=''
|
||||
@@ -357,11 +421,12 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||
[[ $use_fstab_l ]] && use_fstab=$use_fstab_l
|
||||
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
|
||||
[[ $lvmconf_l ]] && lvmconf=$lvmconf_l
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
[[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware"
|
||||
[[ $do_strip ]] || do_strip=no
|
||||
[[ $compress_l ]] && compress=$compress_l
|
||||
[[ $show_modules_l ]] && show_modules=$show_modules_l
|
||||
[[ $nofscks_l ]] && nofscks="yes"
|
||||
# eliminate IFS hackery when messing with fw_dir
|
||||
fw_dir=${fw_dir//:/ }
|
||||
|
||||
@@ -390,6 +455,13 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verify bash version, curret minimum is 3.1
|
||||
if (( ${BASH_VERSINFO[0]} < 3 ||
|
||||
( ${BASH_VERSINFO[0]} == 3 && ${BASH_VERSINFO[1]} < 1 ) )); then
|
||||
dfatal 'You need at least Bash 3.1 to use dracut, sorry.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dracutfunctions=$dracutbasedir/dracut-functions
|
||||
export dracutfunctions
|
||||
|
||||
@@ -455,6 +527,10 @@ fi
|
||||
|
||||
readonly TMPDIR=/var/tmp
|
||||
readonly initdir=$(mktemp --tmpdir=/var/tmp/ -d -t initramfs.XXXXXX)
|
||||
[ -d "$initdir" ] || {
|
||||
dfatal "mktemp failed."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap 'ret=$?;[[ $keep ]] && echo "Not removing $initdir." >&2 || rm -rf "$initdir";exit $ret;' EXIT
|
||||
@@ -464,12 +540,73 @@ trap 'exit 1;' SIGINT
|
||||
# Need to be able to have non-root users read stuff (rpcbind etc)
|
||||
chmod 755 "$initdir"
|
||||
|
||||
for line in "${fstab_lines[@]}"; do
|
||||
set -- $line
|
||||
#dev mp fs fsopts
|
||||
push host_devs "$1"
|
||||
push host_fs_types "$1|$3"
|
||||
done
|
||||
|
||||
for f in $add_fstab; do
|
||||
[ -e $f ] || continue
|
||||
while read dev rest; do
|
||||
push host_devs $dev
|
||||
done < $f
|
||||
done
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
# in hostonly mode, determine all devices, which have to be accessed
|
||||
# and examine them for filesystem types
|
||||
|
||||
push host_mp \
|
||||
"/" \
|
||||
"/etc" \
|
||||
"/usr" \
|
||||
"/usr/bin" \
|
||||
"/usr/sbin" \
|
||||
"/usr/lib" \
|
||||
"/usr/lib64" \
|
||||
"/boot"
|
||||
|
||||
for mp in "${host_mp[@]}"; do
|
||||
mountpoint "$mp" >/dev/null 2>&1 || continue
|
||||
push host_devs $(readlink -f "/dev/block/$(find_block_device "$mp")")
|
||||
done
|
||||
fi
|
||||
|
||||
_get_fs_type() (
|
||||
[[ $1 ]] || return
|
||||
if [[ -b $1 ]] && get_fs_env $1; then
|
||||
echo "$1|$ID_FS_TYPE"
|
||||
return 1
|
||||
fi
|
||||
if [[ -b /dev/block/$1 ]] && get_fs_env /dev/block/$1; then
|
||||
echo "/dev/block/$1|$ID_FS_TYPE"
|
||||
return 1
|
||||
fi
|
||||
if fstype=$(find_dev_fstype $1); then
|
||||
echo "$1|$fstype"
|
||||
return 1
|
||||
fi
|
||||
return 1
|
||||
)
|
||||
|
||||
for dev in "${host_devs[@]}"; do
|
||||
unset fs_type
|
||||
for fstype in $(_get_fs_type $dev) \
|
||||
$(check_block_and_slaves _get_fs_type $(get_maj_min $dev)); do
|
||||
if ! strstr " ${host_fs_types[*]} " " $fstype ";then
|
||||
push host_fs_types "$fstype"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
export initdir dracutbasedir dracutmodules drivers \
|
||||
fw_dir drivers_dir debug no_kernel kernel_only \
|
||||
add_drivers mdadmconf lvmconf filesystems \
|
||||
use_fstab libdir usrlibdir \
|
||||
use_fstab fstab_lines libdir usrlibdir fscks nofscks cttyhack \
|
||||
stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
|
||||
debug
|
||||
debug host_fs_types host_devs sshkey
|
||||
|
||||
# Create some directory structure first
|
||||
[[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"
|
||||
@@ -484,7 +621,7 @@ if [[ $prefix ]]; then
|
||||
fi
|
||||
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
for d in bin etc lib "$libdir" sbin tmp usr var usr/bin usr/sbin; do
|
||||
for d in bin etc lib "$libdir" sbin tmp usr var var/log usr/bin usr/sbin; do
|
||||
[[ -e "${initdir}${prefix}/$d" ]] && continue
|
||||
if [ -h "/$d" ]; then
|
||||
inst "/$d" "${prefix}/$d"
|
||||
@@ -493,7 +630,7 @@ if [[ $kernel_only != yes ]]; then
|
||||
fi
|
||||
done
|
||||
|
||||
for d in proc sys sysroot root run run/lock run/initramfs; do
|
||||
for d in dev proc sys sysroot root run run/lock run/initramfs; do
|
||||
if [ -h "/$d" ]; then
|
||||
inst "/$d"
|
||||
else
|
||||
@@ -503,11 +640,25 @@ if [[ $kernel_only != yes ]]; then
|
||||
|
||||
ln -sfn /run "$initdir/var/run"
|
||||
ln -sfn /run/lock "$initdir/var/lock"
|
||||
else
|
||||
for d in lib "$libdir"; do
|
||||
[[ -e "${initdir}${prefix}/$d" ]] && continue
|
||||
if [ -h "/$d" ]; then
|
||||
inst "/$d" "${prefix}/$d"
|
||||
else
|
||||
mkdir -m 0755 -p "${initdir}${prefix}/$d"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
mkdir -p "${initdir}/etc/cmdline.d"
|
||||
|
||||
mods_to_load=""
|
||||
# check all our modules to see if they should be sourced.
|
||||
# This builds a list of modules that we will install next.
|
||||
check_module_dir
|
||||
for_each_module_dir check_module
|
||||
for_each_module_dir check_mount
|
||||
|
||||
modules_loaded=" "
|
||||
# source our modules.
|
||||
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
@@ -565,18 +716,23 @@ while pop include_src src && pop include_target tgt; do
|
||||
fi
|
||||
done
|
||||
|
||||
while pop install_items items; do
|
||||
for item in $items; do
|
||||
dracut_install "$item"
|
||||
done
|
||||
for item in $install_items; do
|
||||
dracut_install -o "$item"
|
||||
done
|
||||
unset item
|
||||
|
||||
while pop fstab_lines line; do
|
||||
echo "$line 0 0" >> "${initdir}/etc/fstab"
|
||||
done
|
||||
|
||||
for f in $add_fstab; do
|
||||
cat $f >> "${initdir}/etc/fstab"
|
||||
done
|
||||
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
# make sure that library links are correct and up to date
|
||||
for f in /etc/ld.so.conf /etc/ld.so.conf.d/*; do
|
||||
[[ -e $f ]] && dracut_install "$f"
|
||||
[[ -f $f ]] && inst_simple "$f"
|
||||
done
|
||||
if ! ldconfig -r "$initdir"; then
|
||||
if [[ $UID = 0 ]]; then
|
||||
@@ -617,14 +773,14 @@ type hardlink &>/dev/null && {
|
||||
|
||||
if strstr "$modules_loaded" " fips " && command -v prelink >/dev/null; then
|
||||
for i in $initdir/bin/* \
|
||||
$initdir/bin/* \
|
||||
$initdir/sbin/* \
|
||||
$initdir/usr/bin/* \
|
||||
$initdir/usr/sbin/*; do
|
||||
[ -x $i ] && prelink -u $i &>/dev/null
|
||||
done
|
||||
fi
|
||||
|
||||
if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet | \
|
||||
if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet| \
|
||||
$compress > "$outfile"; ); then
|
||||
dfatal "dracut: creation of $outfile failed"
|
||||
exit 1
|
||||
|
500
dracut-functions
500
dracut-functions
@@ -82,6 +82,65 @@ print_vars() {
|
||||
done
|
||||
}
|
||||
|
||||
normalize_path() {
|
||||
shopt -q -s extglob
|
||||
set -- "${1//+(\/)//}"
|
||||
shopt -q -u extglob
|
||||
echo "${1%/}"
|
||||
}
|
||||
|
||||
convert_abs_rel() {
|
||||
local __current __absolute __abssize __cursize __newpath __oldifs
|
||||
local -i __i __level
|
||||
# PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
|
||||
|
||||
set -- "$(normalize_path "$1")" "$(normalize_path "$2")"
|
||||
|
||||
# corner case #1 - self looping link
|
||||
[[ "$1" == "$2" ]] && { echo "${1##*/}"; return; }
|
||||
|
||||
# corner case #2 - own dir link
|
||||
[[ "${1%/*}" == "$2" ]] && { echo "."; return; }
|
||||
|
||||
__oldifs="$IFS"
|
||||
IFS="/"
|
||||
__current=($1)
|
||||
__absolute=($2)
|
||||
IFS="$__oldifs"
|
||||
|
||||
__abssize=${#__absolute[@]}
|
||||
__cursize=${#__current[@]}
|
||||
|
||||
while [[ ${__absolute[__level]} == ${__current[__level]} ]]
|
||||
do
|
||||
(( __level++ ))
|
||||
if (( __level > __abssize || __level > __cursize ))
|
||||
then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
for ((__i = __level; __i < __cursize-1; __i++))
|
||||
do
|
||||
if ((__i > __level))
|
||||
then
|
||||
__newpath=$__newpath"/"
|
||||
fi
|
||||
__newpath=$__newpath".."
|
||||
done
|
||||
|
||||
for ((__i = __level; __i < __abssize; __i++))
|
||||
do
|
||||
if [[ -n $__newpath ]]
|
||||
then
|
||||
__newpath=$__newpath"/"
|
||||
fi
|
||||
__newpath=$__newpath${__absolute[__i]}
|
||||
done
|
||||
|
||||
echo "$__newpath"
|
||||
}
|
||||
|
||||
get_fs_env() {
|
||||
[[ $1 ]] || return
|
||||
unset ID_FS_TYPE
|
||||
@@ -106,8 +165,11 @@ get_fs_type() (
|
||||
echo "nfs"
|
||||
return
|
||||
fi
|
||||
get_fs_env $1 || return
|
||||
echo $ID_FS_TYPE
|
||||
if get_fs_env $1; then
|
||||
echo $ID_FS_TYPE
|
||||
return
|
||||
fi
|
||||
find_dev_fstype $1
|
||||
)
|
||||
|
||||
get_fs_uuid() (
|
||||
@@ -115,22 +177,27 @@ get_fs_uuid() (
|
||||
echo $ID_FS_UUID
|
||||
)
|
||||
|
||||
# finds the major:minor of the block device backing the root filesystem.
|
||||
|
||||
get_maj_min() {
|
||||
local _dev
|
||||
_dev=$(stat -L -c '$((0x%t)):$((0x%T))' "$1" 2>/dev/null)
|
||||
_dev=$(eval "echo $_dev")
|
||||
echo $_dev
|
||||
}
|
||||
|
||||
find_block_device() {
|
||||
local _x _mpt _majmin _dev _fs _maj _min
|
||||
if [[ $use_fstab != yes ]]; then
|
||||
while read _x _x _majmin _x _mpt _x _x _fs _dev _x; do
|
||||
[[ $_mpt = $1 ]] || continue
|
||||
[[ $_fs = nfs ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = nfs3 ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = nfs4 ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = btrfs ]] && {
|
||||
ls -nLl "$_dev" | {
|
||||
read _x _x _x _x _maj _min _x
|
||||
_maj=${_maj//,/}
|
||||
echo $_maj:$_min
|
||||
} && return 0
|
||||
get_maj_min $_dev
|
||||
return 0;
|
||||
}
|
||||
if [[ $_mpt = $1 ]] && [[ ${_majmin#0:} = $_majmin ]]; then
|
||||
if [[ ${_majmin#0:} = $_majmin ]]; then
|
||||
echo $_majmin
|
||||
return 0 # we have a winner!
|
||||
fi
|
||||
@@ -156,8 +223,44 @@ find_block_device() {
|
||||
return 1
|
||||
}
|
||||
|
||||
find_dev_fstype() {
|
||||
local _x _mpt _majmin _dev _fs _maj _min
|
||||
while read _x _x _majmin _x _mpt _x _x _fs _dev _x; do
|
||||
[[ $_dev = $1 ]] || continue
|
||||
echo -n $_fs;
|
||||
return 0;
|
||||
done < /proc/self/mountinfo
|
||||
|
||||
# fall back to /etc/fstab
|
||||
while read _dev _mpt _fs _x; do
|
||||
[[ $_dev = $1 ]] || continue
|
||||
echo -n $_fs;
|
||||
return 0;
|
||||
done < /etc/fstab
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
# finds the major:minor of the block device backing the root filesystem.
|
||||
find_root_block_device() { find_block_device /; }
|
||||
|
||||
for_each_host_dev_fs()
|
||||
{
|
||||
local _func="$1"
|
||||
local _dev
|
||||
local _fs
|
||||
for f in ${host_fs_types[@]}; do
|
||||
OLDIFS="$IFS"
|
||||
IFS="|"
|
||||
set -- $f
|
||||
IFS="$OLDIFS"
|
||||
_dev="$1"
|
||||
[[ -b "$_dev" ]] || continue
|
||||
_fs="$2"
|
||||
$_func $_dev $_fs
|
||||
done
|
||||
}
|
||||
|
||||
# Walk all the slave relationships for a given block device.
|
||||
# Stop when our helper function returns success
|
||||
# $1 = function to call on every found block device
|
||||
@@ -209,36 +312,34 @@ check_vol_slaves() {
|
||||
}
|
||||
|
||||
# Install a directory, keeping symlinks as on the original system.
|
||||
# Example: if /lib64 points to /lib on the host, "inst_dir /lib/file"
|
||||
# Example: if /lib points to /lib64 on the host, "inst_dir /lib/file"
|
||||
# will create ${initdir}/lib64, ${initdir}/lib64/file,
|
||||
# and a symlink ${initdir}/lib -> lib64.
|
||||
inst_dir() {
|
||||
local _dir="$1"
|
||||
local _file=""
|
||||
local IFS="/"
|
||||
local _part
|
||||
[[ -e ${initdir}$_dir ]] && return 0
|
||||
[[ -e ${initdir}/"$1" ]] && return 0 # already there
|
||||
|
||||
local _dir="$1" _part="${1%/*}" _file
|
||||
while [[ "$_part" != "${_part%/*}" ]] && ! [[ -e "${initdir}/${_part}" ]]; do
|
||||
_dir="$_part $_dir"
|
||||
_part=${_part%/*}
|
||||
done
|
||||
|
||||
# iterate over parent directories
|
||||
for _part in $_dir; do
|
||||
[[ $_part ]] || continue
|
||||
_file="$_file/$_part"
|
||||
[[ -e ${initdir}$_file ]] && continue
|
||||
|
||||
for _file in $_dir; do
|
||||
if [[ -L $_file ]]; then
|
||||
# create link as the original
|
||||
local target=$(readlink "$_file")
|
||||
ln -sfn "$target" "${initdir}$_file" || return 1
|
||||
local target=$(readlink -f "$_file")
|
||||
# resolve relative path and recursively install destination
|
||||
[[ $target == ${target#/} ]] && target="$(dirname "$_file")/$target"
|
||||
inst_dir "$target"
|
||||
inst_symlink "$_file"
|
||||
else
|
||||
[[ -h ${initdir}$_file ]] && _file=$(readlink "${initdir}$_file")
|
||||
[[ -h ${initdir}/$_file ]] && _file=$(readlink "${initdir}/$_file")
|
||||
# create directory
|
||||
mkdir -m 0755 -p "${initdir}$_file" || return 1
|
||||
[[ -e "${initdir}/$_file" ]] || mkdir -m 0755 -p "${initdir}/$_file" || return 1
|
||||
if [[ -d "$_file" ]]; then
|
||||
chmod --reference="$_file" "${initdir}$_file"
|
||||
chmod u+w "${initdir}$_file"
|
||||
chmod --reference="$_file" "${initdir}/$_file"
|
||||
chmod u+w "${initdir}/$_file"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@@ -249,12 +350,13 @@ inst_dir() {
|
||||
# Location of the image dir is assumed to be $initdir
|
||||
# We never overwrite the target if it exists.
|
||||
inst_simple() {
|
||||
local _src target
|
||||
[[ -f $1 ]] || return 1
|
||||
_src=$1 target="${2:-$1}"
|
||||
if ! [[ -d ${initdir}$target ]]; then
|
||||
[[ -e ${initdir}$target ]] && return 0
|
||||
[[ -h ${initdir}$target ]] && return 0
|
||||
[[ -f "$1" ]] || return 1
|
||||
strstr "$1" "/" || return 1
|
||||
|
||||
local _src=$1 target="${2:-$1}"
|
||||
if ! [[ -d ${initdir}/$target ]]; then
|
||||
[[ -e ${initdir}/$target ]] && return 0
|
||||
[[ -h ${initdir}/$target ]] && return 0
|
||||
inst_dir "${target%/*}"
|
||||
fi
|
||||
# install checksum files also
|
||||
@@ -262,7 +364,7 @@ inst_simple() {
|
||||
inst "${_src%/*}/.${_src##*/}.hmac" "${target%/*}/.${target##*/}.hmac"
|
||||
fi
|
||||
ddebug "Installing $_src"
|
||||
cp -pfL "$_src" "${initdir}$target"
|
||||
cp --sparse=always -pfL "$_src" "${initdir}/$target"
|
||||
}
|
||||
|
||||
# find symlinks linked to given library file
|
||||
@@ -294,25 +396,25 @@ rev_lib_symlinks() {
|
||||
# It handles making symlinks according to how the original library
|
||||
# is referenced.
|
||||
inst_library() {
|
||||
local _src=$1 _dest=${2:-$1} _lib _reallib _symlink
|
||||
[[ -e $initdir$_dest ]] && return 0
|
||||
local _src="$1" _dest=${2:-$1} _lib _reallib _symlink
|
||||
strstr "$1" "/" || return 1
|
||||
[[ -e $initdir/$_dest ]] && return 0
|
||||
if [[ -L $_src ]]; then
|
||||
# install checksum files also
|
||||
if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
|
||||
inst "${_src%/*}/.${_src##*/}.hmac" "${_dest%/*}/.${_dest##*/}.hmac"
|
||||
fi
|
||||
_reallib=$(readlink -f "$_src")
|
||||
_lib=${_src##*/}
|
||||
inst_simple "$_reallib" "$_reallib"
|
||||
inst_dir "${_dest%/*}"
|
||||
(cd "${initdir}${_dest%/*}" && ln -sfn "$_reallib" "$_lib")
|
||||
ln -sfn $(convert_abs_rel "${_dest}" "${_reallib}") "${initdir}/${_dest}"
|
||||
else
|
||||
inst_simple "$_src" "$_dest"
|
||||
fi
|
||||
|
||||
# Create additional symlinks. See rev_symlinks description.
|
||||
for _symlink in $(rev_lib_symlinks $_src) $(rev_lib_symlinks $_reallib); do
|
||||
[[ ! -e $initdir$_symlink ]] && {
|
||||
[[ ! -e $initdir/$_symlink ]] && {
|
||||
ddebug "Creating extra symlink: $_symlink"
|
||||
inst_symlink $_symlink
|
||||
}
|
||||
@@ -322,17 +424,14 @@ inst_library() {
|
||||
# find a binary. If we were not passed the full path directly,
|
||||
# search in the usual places to find the binary.
|
||||
find_binary() {
|
||||
local _binpath="/usr/sbin /sbin /usr/bin /bin" _p
|
||||
if [[ -z ${1##/*} ]]; then
|
||||
if [[ -x $1 ]] || ldd $1 &>/dev/null; then
|
||||
echo $1
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
for _p in $_binpath; do
|
||||
[[ -x $_p/$1 ]] && { echo "$_p/$1"; return 0; }
|
||||
done
|
||||
return 1
|
||||
|
||||
type -P $1
|
||||
}
|
||||
|
||||
# Same as above, but specialized to install binary executables.
|
||||
@@ -342,8 +441,8 @@ inst_binary() {
|
||||
|
||||
_bin=$(find_binary "$1") || return 1
|
||||
_target=${2:-$_bin}
|
||||
[[ -e $initdir/$_target ]] && return 0
|
||||
inst_symlink $_bin $_target && return 0
|
||||
[[ -e $initdir$_target ]] && return 0
|
||||
|
||||
# If the binary being installed is also a library, add it to the loop.
|
||||
_so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
|
||||
@@ -361,22 +460,20 @@ inst_binary() {
|
||||
fi
|
||||
[[ $_line =~ $_so_regex ]] || continue
|
||||
_file=${BASH_REMATCH[1]}
|
||||
[[ -e ${initdir}$_file ]] && continue
|
||||
[[ -e ${initdir}/$_file ]] && continue
|
||||
|
||||
# See if we are loading an optimized version of a shared lib.
|
||||
if [[ $_file =~ $_lib_regex ]]; then
|
||||
_tlibdir=${BASH_REMATCH[1]}
|
||||
_base=${_file##*/}
|
||||
# Prefer nosegneg libs to unoptimized ones.
|
||||
for _f in "$_tlibdir/i686/nosegneg" "$_tlibdir"; do
|
||||
_tlibdir=${BASH_REMATCH[1]}
|
||||
_base=${_file##*/}
|
||||
# Prefer nosegneg libs to unoptimized ones.
|
||||
for _f in "$_tlibdir/i686/nosegneg"; do
|
||||
[[ -e $_f/$_base ]] || continue
|
||||
_file=$_f/$_base
|
||||
inst_library $_f/$_base
|
||||
break
|
||||
done
|
||||
inst_library "$_file" "$_tlibdir/$_base"
|
||||
else
|
||||
inst_library "$_file"
|
||||
fi
|
||||
inst_library "$_file"
|
||||
done
|
||||
|
||||
# Install the binary if it wasn't handled in the above loop.
|
||||
@@ -386,32 +483,62 @@ inst_binary() {
|
||||
# same as above, except for shell scripts.
|
||||
# If your shell script does not start with shebang, it is not a shell script.
|
||||
inst_script() {
|
||||
[[ -f $1 ]] || return 1
|
||||
local _bin
|
||||
_bin=$(find_binary "$1") || return 1
|
||||
shift
|
||||
local _line _shebang_regex
|
||||
read -r -n 80 _line <"$1"
|
||||
read -r -n 80 _line <"$_bin"
|
||||
# If debug is set, clean unprintable chars to prevent messing up the term
|
||||
[[ $debug ]] && _line=$(echo -n "$_line" | tr -c -d '[:print:][:space:]')
|
||||
_shebang_regex='(#! *)(/[^ ]+).*'
|
||||
[[ $_line =~ $_shebang_regex ]] || return 1
|
||||
inst "${BASH_REMATCH[2]}" && inst_simple "$@"
|
||||
inst "${BASH_REMATCH[2]}" && inst_simple "$_bin" "$@"
|
||||
}
|
||||
|
||||
# same as above, but specialized for symlinks
|
||||
inst_symlink() {
|
||||
local _src=$1 _target=$initdir${2:-$1} _realsrc
|
||||
local _src=$1 _target=${2:-$1} _realsrc
|
||||
strstr "$1" "/" || return 1
|
||||
[[ -L $1 ]] || return 1
|
||||
[[ -L $_target ]] && return 0
|
||||
[[ -L $initdir/$_target ]] && return 0
|
||||
_realsrc=$(readlink -f "$_src")
|
||||
[[ $_realsrc = ${_realsrc##*/} ]] && _realsrc=${_src%/*}/$_realsrc
|
||||
[[ -d ${_target%/*} ]] && _target=$(readlink -f ${_target%/*})/${_target##*/}
|
||||
if [[ -d $_realsrc ]]; then
|
||||
inst_dir "$_realsrc"
|
||||
else
|
||||
inst "$_realsrc" && mkdir -m 0755 -p "${_target%/*}"
|
||||
{
|
||||
local _t
|
||||
_t=${2:-$1}
|
||||
_t="${_t%/*}"
|
||||
[[ $_t ]] && inst_dir "$_t"
|
||||
inst "$_realsrc"
|
||||
}
|
||||
fi
|
||||
if [[ -e "${_src}" ]]; then
|
||||
cp -aP "${_src}" "$_target"
|
||||
ln -sfn $(convert_abs_rel "${_target}" "${_realsrc}") "$initdir/$_target"
|
||||
else
|
||||
ln -sfn "$_realsrc" "$_target"
|
||||
ln -sfn "$_realsrc" "$initdir/$_target"
|
||||
fi
|
||||
}
|
||||
|
||||
# attempt to install any programs specified in a udev rule
|
||||
inst_rule_programs() {
|
||||
local _prog _bin
|
||||
|
||||
if grep -qE 'PROGRAM==?"[^ "]+' "$1"; then
|
||||
for _prog in $(grep -E 'PROGRAM==?"[^ "]+' "$1" | sed -r 's/.*PROGRAM==?"([^ "]+).*/\1/'); do
|
||||
if [ -x /lib/udev/$_prog ]; then
|
||||
_bin=/lib/udev/$_prog
|
||||
else
|
||||
_bin=$(find_binary "$_prog") || {
|
||||
dinfo "Skipping program $_prog using in udev rule $(basename $1) as it cannot be found"
|
||||
continue;
|
||||
}
|
||||
fi
|
||||
|
||||
#dinfo "Installing $_bin due to it's use in the udev rule $(basename $1)"
|
||||
dracut_install "$_bin"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -423,16 +550,20 @@ inst_rules() {
|
||||
inst_dir "/lib/udev/rules.d"
|
||||
inst_dir "$_target"
|
||||
for _rule in "$@"; do
|
||||
for r in /lib/udev/rules.d /etc/udev/rules.d; do
|
||||
if [[ -f $r/$_rule ]]; then
|
||||
_found="$r/$_rule"
|
||||
inst_simple "$_found"
|
||||
fi
|
||||
done
|
||||
if [ "${rule#/}" = "$rule" ]; then
|
||||
for r in /lib/udev/rules.d /etc/udev/rules.d; do
|
||||
if [[ -f $r/$_rule ]]; then
|
||||
_found="$r/$_rule"
|
||||
inst_simple "$_found"
|
||||
inst_rule_programs "$_found"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
for r in '' ./ $dracutbasedir/rules.d/; do
|
||||
if [[ -f ${r}$_rule ]]; then
|
||||
_found="${r}$_rule"
|
||||
inst_simple "$_found" "$_target/${_found##*/}"
|
||||
inst_rule_programs "$_found"
|
||||
fi
|
||||
done
|
||||
[[ $_found ]] || dinfo "Skipping udev rule: $_rule"
|
||||
@@ -461,7 +592,7 @@ inst() {
|
||||
|
||||
[[ $hookdirs ]] || {
|
||||
hookdirs="cmdline pre-udev pre-trigger netroot initqueue pre-mount"
|
||||
hookdirs+=" pre-pivot mount emergency emergency-shutdown shutdown"
|
||||
hookdirs+=" pre-pivot mount emergency shutdown-emergency shutdown cleanup"
|
||||
export hookdirs
|
||||
}
|
||||
|
||||
@@ -480,6 +611,34 @@ inst_hook() {
|
||||
inst_simple "$3" "/lib/dracut/hooks/${1}/${2}${3##*/}"
|
||||
}
|
||||
|
||||
# install any of listed files
|
||||
#
|
||||
# If first argument is '-d' and second some destination path, first accessible
|
||||
# source is installed into this path, otherwise it will installed in the same
|
||||
# path as source. If none of listed files was installed, function return 1.
|
||||
# On first successful installation it returns with 0 status.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# inst_any -d /bin/foo /bin/bar /bin/baz
|
||||
#
|
||||
# Lets assume that /bin/baz exists, so it will be installed as /bin/foo in
|
||||
# initramfs.
|
||||
inst_any() {
|
||||
local to f
|
||||
|
||||
[[ $1 = '-d' ]] && to="$2" && shift 2
|
||||
|
||||
for f in "$@"; do
|
||||
if [[ -e $f ]]; then
|
||||
[[ $to ]] && inst "$f" "$to" && return 0
|
||||
inst "$f" && return 0
|
||||
fi
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
dracut_install() {
|
||||
local _optional=no
|
||||
if [[ $1 = '-o' ]]; then
|
||||
@@ -489,7 +648,7 @@ dracut_install() {
|
||||
while (($# > 0)); do
|
||||
if ! inst "$1" ; then
|
||||
if [[ $_optional = yes ]]; then
|
||||
dwarn "Skipping program $1 as it cannot be found and is" \
|
||||
dinfo "Skipping program $1 as it cannot be found and is" \
|
||||
"flagged to be optional"
|
||||
else
|
||||
dfatal "Failed to install $1"
|
||||
@@ -550,21 +709,27 @@ inst_opt_decompress() {
|
||||
module_check() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local _ret
|
||||
local _forced=0
|
||||
local _hostonly=$hostonly
|
||||
[ $# -eq 2 ] && _forced=$2
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
# if we do not have a check script, we are unconditionally included
|
||||
[[ -x $_moddir/check ]] || return 0
|
||||
[ $_forced -ne 0 ] && unset hostonly
|
||||
$_moddir/check $hostonly
|
||||
return $?
|
||||
_ret=$?
|
||||
else
|
||||
unset check depends install installkernel
|
||||
. $_moddir/module-setup.sh
|
||||
is_func check || return 0
|
||||
check
|
||||
[ $_forced -ne 0 ] && unset hostonly
|
||||
check $hostonly
|
||||
_ret=$?
|
||||
unset check depends install installkernel
|
||||
return $_ret
|
||||
fi
|
||||
hostonly=$_hostonly
|
||||
return $_ret
|
||||
}
|
||||
|
||||
module_depends() {
|
||||
@@ -623,6 +788,67 @@ module_installkernel() {
|
||||
fi
|
||||
}
|
||||
|
||||
module_check_mount() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local _ret
|
||||
mount_needs=1
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
# if we do not have a check script, we are unconditionally included
|
||||
[[ -x $_moddir/check ]] || return 0
|
||||
mount_needs=1 $_moddir/check 0
|
||||
_ret=$?
|
||||
else
|
||||
unset check depends install installkernel
|
||||
. $_moddir/module-setup.sh
|
||||
is_func check || return 1
|
||||
check 0
|
||||
_ret=$?
|
||||
unset check depends install installkernel
|
||||
fi
|
||||
unset mount_needs
|
||||
return $_ret
|
||||
}
|
||||
|
||||
check_mount() {
|
||||
local _mod=$1
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local _ret
|
||||
local _moddep
|
||||
# If we are already scheduled to be loaded, no need to check again.
|
||||
strstr " $mods_to_load " " $_mod " && return 0
|
||||
strstr " $mods_checked_as_dep " " $_mod " && return 1
|
||||
|
||||
# This should never happen, but...
|
||||
[[ -d $_moddir ]] || return 1
|
||||
|
||||
[[ $2 ]] || mods_checked_as_dep+=" $_mod "
|
||||
|
||||
strstr " $omit_dracutmodules " " $_mod " && return 1
|
||||
|
||||
if [ "${#host_fs_types[*]}" -gt 0 ]; then
|
||||
module_check_mount $_mod || return 1
|
||||
else
|
||||
# skip this module
|
||||
return 1
|
||||
fi
|
||||
|
||||
for _moddep in $(module_depends $_mod); do
|
||||
# handle deps as if they were manually added
|
||||
strstr " $add_dracutmodules " " $_moddep " || \
|
||||
add_dracutmodules+=" $_moddep "
|
||||
strstr " $force_add_dracutmodules " " $_moddep " || \
|
||||
force_add_dracutmodules+=" $_moddep "
|
||||
# if a module we depend on fail, fail also
|
||||
check_module $_moddep || return 1
|
||||
done
|
||||
|
||||
strstr " $mods_to_load " " $_mod " || \
|
||||
mods_to_load+=" $_mod "
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
check_module() {
|
||||
local _mod=$1
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
@@ -639,8 +865,12 @@ check_module() {
|
||||
|
||||
strstr " $omit_dracutmodules " " $_mod " && return 1
|
||||
|
||||
if strstr " $dracutmodules $add_dracutmodules " " $_mod "; then
|
||||
module_check $_mod; ret=$?
|
||||
if strstr " $dracutmodules $add_dracutmodules $force_add_dracutmodules" " $_mod "; then
|
||||
if strstr " $force_add_dracutmodules" " $_mod"; then
|
||||
module_check $_mod 1; ret=$?
|
||||
else
|
||||
module_check $_mod 0; ret=$?
|
||||
fi
|
||||
# explicit module, so also accept ret=255
|
||||
[[ $ret = 0 || $ret = 255 ]] || return 1
|
||||
else
|
||||
@@ -658,6 +888,8 @@ check_module() {
|
||||
# handle deps as if they were manually added
|
||||
strstr " $add_dracutmodules " " $_moddep " || \
|
||||
add_dracutmodules+=" $_moddep "
|
||||
strstr " $force_add_dracutmodules " " $_moddep " || \
|
||||
force_add_dracutmodules+=" $_moddep "
|
||||
# if a module we depend on fail, fail also
|
||||
check_module $_moddep || return 1
|
||||
done
|
||||
@@ -668,18 +900,19 @@ check_module() {
|
||||
return 0
|
||||
}
|
||||
|
||||
check_module_dir() {
|
||||
for_each_module_dir() {
|
||||
local _modcheck
|
||||
local _mod
|
||||
local _moddir
|
||||
mods_to_load=""
|
||||
local _func
|
||||
_func=$1
|
||||
for _moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
_mod=${_moddir##*/}; _mod=${_mod#[0-9][0-9]}
|
||||
check_module $_mod 1
|
||||
$_func $_mod 1
|
||||
done
|
||||
|
||||
# Report any missing dracut modules, the user has specified
|
||||
_modcheck=$add_dracutmodules
|
||||
_modcheck="$add_dracutmodules $force_add_dracutmodules"
|
||||
[[ $dracutmodules != all ]] && _modcheck="$m $dracutmodules"
|
||||
for _mod in $_modcheck; do
|
||||
strstr "$mods_to_load" "$_mod" && continue
|
||||
@@ -691,13 +924,14 @@ check_module_dir() {
|
||||
# Install a single kernel module along with any firmware it may require.
|
||||
# $1 = full path to kernel module to install
|
||||
install_kmod_with_fw() {
|
||||
local _modname=${1##*/} _fwdir _found _fw
|
||||
_modname=${_modname%.ko*}
|
||||
# no need to go further if the module is already installed
|
||||
[[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] \
|
||||
&& return 0
|
||||
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" \
|
||||
|| return $?
|
||||
|
||||
local _modname=${1##*/} _fwdir _found _fw
|
||||
_modname=${_modname%.ko*}
|
||||
for _fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do
|
||||
_found=''
|
||||
for _fwdir in $fw_dir; do
|
||||
@@ -725,10 +959,11 @@ install_kmod_with_fw() {
|
||||
# It will be passed the full path to the found kernel module
|
||||
# $2 = module to get dependencies for
|
||||
# rest of args = arguments to modprobe
|
||||
# _fderr specifies FD passed from surrounding scope
|
||||
for_each_kmod_dep() {
|
||||
local _func=$1 _kmod=$2 _cmd _modpath _options _found=0
|
||||
shift 2
|
||||
modprobe "$@" --ignore-install --show-depends $_kmod 2>"$initdir/modprobe.err" | (
|
||||
modprobe "$@" --ignore-install --show-depends $_kmod 2>&${_fderr} | (
|
||||
while read _cmd _modpath _options; do
|
||||
[[ $_cmd = insmod ]] || continue
|
||||
$_func ${_modpath} || exit $?
|
||||
@@ -737,24 +972,23 @@ for_each_kmod_dep() {
|
||||
[[ $_found -eq 0 ]] && exit 1
|
||||
exit 0
|
||||
)
|
||||
egrep -v 'FATAL: Module .* not found.' "$initdir/modprobe.err" | derror
|
||||
rm -f "$initdir/modprobe.err"
|
||||
return $?
|
||||
}
|
||||
|
||||
# filter kernel modules to install certain modules that meet specific
|
||||
# requirements.
|
||||
# $1 = function to call with module name to filter.
|
||||
# $1 = search only in subdirectory of /kernel/$1
|
||||
# $2 = function to call with module name to filter.
|
||||
# This function will be passed the full path to the module to test.
|
||||
# The behaviour of this function can vary depending on whether $hostonly is set.
|
||||
# If it is, we will only look at modules that are already in memory.
|
||||
# If it is not, we will look at all kernel modules
|
||||
# This function returns the full filenames of modules that match $1
|
||||
filter_kernel_modules () (
|
||||
filter_kernel_modules_by_path () (
|
||||
local _modname _filtercmd
|
||||
if ! [[ $hostonly ]]; then
|
||||
_filtercmd='find "$srcmods/kernel/drivers" "$srcmods/extra"'
|
||||
_filtercmd='find "$srcmods/kernel/$1" "$srcmods/extra"'
|
||||
_filtercmd+=' "$srcmods/weak-updates" -name "*.ko" -o -name "*.ko.gz"'
|
||||
_filtercmd+=' -o -name "*.ko.xz"'
|
||||
_filtercmd+=' 2>/dev/null'
|
||||
else
|
||||
_filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename '
|
||||
@@ -762,64 +996,108 @@ filter_kernel_modules () (
|
||||
fi
|
||||
for _modname in $(eval $_filtercmd); do
|
||||
case $_modname in
|
||||
*.ko) "$1" "$_modname" && echo "$_modname";;
|
||||
*.ko) "$2" "$_modname" && echo "$_modname";;
|
||||
*.ko.gz) gzip -dc "$_modname" > $initdir/$$.ko
|
||||
$1 $initdir/$$.ko && echo "$_modname"
|
||||
$2 $initdir/$$.ko && echo "$_modname"
|
||||
rm -f $initdir/$$.ko
|
||||
;;
|
||||
*.ko.xz) xz -dc "$_modname" > $initdir/$$.ko
|
||||
$2 $initdir/$$.ko && echo "$_modname"
|
||||
rm -f $initdir/$$.ko
|
||||
;;
|
||||
esac
|
||||
done
|
||||
)
|
||||
find_kernel_modules_by_path () (
|
||||
if ! [[ $hostonly ]]; then
|
||||
find "$srcmods/kernel/$1" "$srcmods/extra" "$srcmods/weak-updates" \
|
||||
-name "*.ko" -o -name "*.ko.gz" -o -name "*.ko.xz" 2>/dev/null
|
||||
else
|
||||
cut -d " " -f 1 </proc/modules \
|
||||
| xargs modinfo -F filename -k $kernel 2>/dev/null
|
||||
fi
|
||||
)
|
||||
|
||||
filter_kernel_modules () {
|
||||
filter_kernel_modules_by_path drivers "$1"
|
||||
}
|
||||
|
||||
find_kernel_modules () {
|
||||
find_kernel_modules_by_path drivers
|
||||
}
|
||||
|
||||
# install kernel modules along with all their dependencies.
|
||||
instmods() {
|
||||
[[ $no_kernel = yes ]] && return
|
||||
local _mod _mpargs _moddirname
|
||||
local _ret=0
|
||||
while (($# > 0)); do
|
||||
_mod=${1%.ko*}
|
||||
# called [sub]functions inherit _fderr
|
||||
local _fderr=9
|
||||
|
||||
function inst1mod() {
|
||||
local _mod="$1"
|
||||
case $_mod in
|
||||
=*)
|
||||
# This introduces 2 incompatible meanings for =* arguments
|
||||
# to instmods. We need to decide which one to keep.
|
||||
if [[ $_mod = =ata && -f $srcmods/modules.block ]]; then
|
||||
instmods $_mpargs \
|
||||
$(egrep 'ata|ahci' "${srcmods}/modules.block")
|
||||
( [[ "$_mpargs" ]] && echo $_mpargs
|
||||
egrep 'ata|ahci' "${srcmods}/modules.block" ) \
|
||||
| instmods
|
||||
elif [ -f $srcmods/modules.${_mod#=} ]; then
|
||||
instmods $_mpargs $(cat ${srcmods}/modules.${_mod#=} )
|
||||
( [[ "$_mpargs" ]] && echo $_mpargs
|
||||
cat "${srcmods}/modules.${_mod#=}" ) \
|
||||
| instmods
|
||||
else
|
||||
instmods $_mpargs $(find "$srcmods" -path "*/${_mod#=}/*")
|
||||
( [[ "$_mpargs" ]] && echo $_mpargs
|
||||
find "$srcmods" -path "*/${_mod#=}/*" ) \
|
||||
| instmods
|
||||
fi
|
||||
;;
|
||||
--*)
|
||||
_mod=${_mod##*/}
|
||||
_mpargs+=" $_mod";;
|
||||
i2o_scsi) shift; continue;; # Do not load this diagnostic-only module
|
||||
--*) _mpargs+=" $_mod" ;;
|
||||
i2o_scsi) return ;; # Do not load this diagnostic-only module
|
||||
*) _mod=${_mod##*/}
|
||||
|
||||
# if we are already installed, skip this module and go on
|
||||
# to the next one.
|
||||
[[ -f $initdir/$1 ]] && { shift; continue; }
|
||||
[[ -f $initdir/$1 ]] && return
|
||||
|
||||
# If we are building a host-specific initramfs and this
|
||||
# module is not already loaded, move on to the next one.
|
||||
[[ $hostonly ]] && ! grep -qe "\<${_mod//-/_}\>" /proc/modules \
|
||||
&& ! echo $add_drivers | grep -qe "\<${_mod}\>" && {
|
||||
shift; continue
|
||||
}
|
||||
&& ! echo $add_drivers | grep -qe "\<${_mod}\>" \
|
||||
&& return
|
||||
|
||||
# We use '-d' option in modprobe only if modules prefix path
|
||||
# differs from default '/'. This allows us to use Dracut with
|
||||
# old version of modprobe which doesn't have '-d' option.
|
||||
_moddirname=${srcmods%%/lib/modules/*}
|
||||
local _moddirname=${srcmods%%/lib/modules/*}
|
||||
[[ -n ${_moddirname} ]] && _moddirname="-d ${_moddirname}/"
|
||||
|
||||
# ok, load the module, all its dependencies, and any firmware
|
||||
# it may require
|
||||
for_each_kmod_dep install_kmod_with_fw $_mod \
|
||||
--set-version $kernel ${_moddirname}
|
||||
--set-version $kernel ${_moddirname} $_mpargs
|
||||
((_ret+=$?))
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
return $_ret
|
||||
}
|
||||
|
||||
function instmods_1() {
|
||||
local _ret=0 _mod _mpargs
|
||||
if (($# == 0)); then # filenames from stdin
|
||||
while read _mod; do
|
||||
inst1mod "${_mod%.ko*}"
|
||||
done
|
||||
fi
|
||||
while (($# > 0)); do # filenames as arguments
|
||||
inst1mod ${1%.ko*}
|
||||
shift
|
||||
done
|
||||
return $_ret
|
||||
}
|
||||
|
||||
# Capture all stderr from modprobe to _fderr. We could use {var}>...
|
||||
# redirections, but that would make dracut require bash4 at least.
|
||||
eval "( instmods_1 \"\$@\" ) ${_fderr}>&1" \
|
||||
| egrep -v 'FATAL: Module .* not found.' | derror
|
||||
return $?
|
||||
}
|
||||
|
@@ -106,19 +106,21 @@ __DRACUT_LOGGER__=1
|
||||
# @warning Function sets global variables @var maxloglvl and @syslogfacility.
|
||||
# See file doc comment for details.
|
||||
dlog_init() {
|
||||
# Skip initialization if it's already done.
|
||||
[ -n "$maxloglvl" ] && return 0
|
||||
|
||||
local __oldumask
|
||||
local ret=0; local errmsg
|
||||
|
||||
[ -z "$stdloglvl" ] && stdloglvl=4
|
||||
[ -z "$sysloglvl" ] && sysloglvl=0
|
||||
[ -z "$kmsgloglvl" ] && kmsgloglvl=0
|
||||
# Skip initialization if it's already done.
|
||||
[ -n "$maxloglvl" ] && return 0
|
||||
|
||||
if [ -z "$fileloglvl" ]; then
|
||||
[ -w "$logfile" ] && fileloglvl=4 || fileloglvl=0
|
||||
elif [ $fileloglvl -gt 0 ]; then
|
||||
__oldumask=$(umask)
|
||||
umask 0377
|
||||
! [ -e "$logfile" ] && >"$logfile"
|
||||
umask $__oldumask
|
||||
if [ -w "$logfile" -a -f "$logfile" ]; then
|
||||
# Mark new run in the log file
|
||||
echo >>"$logfile"
|
||||
@@ -269,12 +271,8 @@ _dlvl2syslvl() {
|
||||
# - @c INFO to @c info
|
||||
# - @c DEBUG and @c TRACE both to @c debug
|
||||
_do_dlog() {
|
||||
[ -z "$maxloglvl" ] && return 0
|
||||
local lvl="$1"; shift
|
||||
local lvlc=$(_lvl2char "$lvl") || return 0
|
||||
|
||||
[ $lvl -le $maxloglvl ] || return 0
|
||||
|
||||
local msg="$lvlc: $*"
|
||||
|
||||
[ $lvl -le $stdloglvl ] && echo "$msg" >&2
|
||||
@@ -305,6 +303,9 @@ _do_dlog() {
|
||||
# dwarn "This is a warning"
|
||||
# echo "This is a warning" | dwarn
|
||||
dlog() {
|
||||
[ -z "$maxloglvl" ] && return 0
|
||||
[ $1 -le $maxloglvl ] || return 0
|
||||
|
||||
if [ $# -gt 1 ]; then
|
||||
_do_dlog "$@"
|
||||
else
|
||||
@@ -312,7 +313,6 @@ dlog() {
|
||||
_do_dlog "$1" "$line"
|
||||
done
|
||||
fi
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
|
||||
## @brief Logs message at TRACE level (6)
|
||||
@@ -322,6 +322,7 @@ dlog() {
|
||||
dtrace() {
|
||||
set +x
|
||||
dlog 6 "$@"
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
|
||||
## @brief Logs message at DEBUG level (5)
|
||||
@@ -331,6 +332,7 @@ dtrace() {
|
||||
ddebug() {
|
||||
set +x
|
||||
dlog 5 "$@"
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
|
||||
## @brief Logs message at INFO level (4)
|
||||
@@ -340,6 +342,7 @@ ddebug() {
|
||||
dinfo() {
|
||||
set +x
|
||||
dlog 4 "$@"
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
|
||||
## @brief Logs message at WARN level (3)
|
||||
@@ -349,6 +352,7 @@ dinfo() {
|
||||
dwarn() {
|
||||
set +x
|
||||
dlog 3 "$@"
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
|
||||
## @brief It's an alias to dwarn() function.
|
||||
@@ -358,6 +362,7 @@ dwarn() {
|
||||
dwarning() {
|
||||
set +x
|
||||
dwarn "$@"
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
|
||||
## @brief Logs message at ERROR level (2)
|
||||
@@ -367,6 +372,7 @@ dwarning() {
|
||||
derror() {
|
||||
set +x
|
||||
dlog 2 "$@"
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
|
||||
## @brief Logs message at FATAL level (1)
|
||||
@@ -376,4 +382,5 @@ derror() {
|
||||
dfatal() {
|
||||
set +x
|
||||
dlog 1 "$@"
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
|
@@ -1,560 +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
|
||||
|
||||
STATEDIR=/var/lib/dracut
|
||||
BOOTDIR=/boot
|
||||
CONF=/etc/dracut.conf
|
||||
KPKGCONF=/etc/kernel-img.conf
|
||||
USETRIGGERS=true
|
||||
mode=""
|
||||
version=""
|
||||
|
||||
set -e
|
||||
|
||||
if $USETRIGGERS \
|
||||
&& [ x"$DPKG_MAINTSCRIPT_PACKAGE" != x ] \
|
||||
&& [ $# = 1 ] \
|
||||
&& [ x"$1" = x-u ] \
|
||||
&& dpkg-trigger --check-supported 2>/dev/null
|
||||
then
|
||||
if dpkg-trigger --no-await update-initramfs; then
|
||||
echo "dracut-update-initramfs: deferring update (trigger activated)"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
usage()
|
||||
{
|
||||
if [ -n "${1}" ]; then
|
||||
printf "${@}\n\n" >&2
|
||||
fi
|
||||
cat >&2 << EOF
|
||||
Usage: ${0} [OPTION]...
|
||||
|
||||
Options:
|
||||
-k [version] Specify kernel version or 'all'
|
||||
-c Create a new initramfs
|
||||
-u Update an existing initramfs
|
||||
-d Remove an existing initramfs
|
||||
-t Take over a custom initramfs with this one
|
||||
-b Set alternate boot directory
|
||||
-v Be verbose
|
||||
-h This message
|
||||
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
# chroot check
|
||||
chrooted()
|
||||
{
|
||||
# borrowed from udev's postinst
|
||||
if [ "$(stat -c %d/%i /)" = "$(stat -Lc %d/%i /proc/1/root 2>/dev/null)" ]; then
|
||||
# the devicenumber/inode pair of / is the same as that of
|
||||
# /sbin/init's root, so we're *not* in a chroot and hence
|
||||
# return false.
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
mild_panic()
|
||||
{
|
||||
if [ -n "${1}" ]; then
|
||||
printf "${@}\n" >&2
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
panic()
|
||||
{
|
||||
if [ -n "${1}" ]; then
|
||||
printf "${@}\n" >&2
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
|
||||
verbose()
|
||||
{
|
||||
if [ "${verbose}" = 1 ]; then
|
||||
printf "${@}\n"
|
||||
fi
|
||||
}
|
||||
|
||||
version_exists()
|
||||
{
|
||||
[ -e "${STATEDIR}/${1}" ] && [ -e "${initramfs}" ]
|
||||
return $?
|
||||
}
|
||||
|
||||
set_initramfs()
|
||||
{
|
||||
initramfs="${BOOTDIR}/dracut.img-${version}"
|
||||
}
|
||||
|
||||
|
||||
# backup initramfs while running
|
||||
backup_initramfs()
|
||||
{
|
||||
[ ! -r "${initramfs}" ] && return 0
|
||||
initramfs_bak="${initramfs}.dpkg-bak"
|
||||
[ -r "${initramfs_bak}" ] && rm -f "${initramfs_bak}"
|
||||
ln -f "${initramfs}" "${initramfs_bak}" \
|
||||
|| cp -a "${initramfs}" "${initramfs_bak}"
|
||||
verbose "Keeping ${initramfs_bak}"
|
||||
}
|
||||
|
||||
# keep booted initramfs
|
||||
backup_booted_initramfs()
|
||||
{
|
||||
initramfs_bak="${initramfs}.dpkg-bak"
|
||||
|
||||
# first time run thus no backup
|
||||
[ ! -r "${initramfs_bak}" ] && return 0
|
||||
|
||||
# chroot with no /proc
|
||||
[ ! -r /proc/uptime ] && rm -f "${initramfs_bak}" && return 0
|
||||
|
||||
# no kept backup wanted
|
||||
[ "${backup_initramfs}" = "no" ] && rm -f "${initramfs_bak}" && return 0
|
||||
|
||||
# no backup yet
|
||||
if [ ! -r "${initramfs}.bak" ]; then
|
||||
mv -f ${initramfs_bak} "${initramfs}.bak"
|
||||
verbose "Backup ${initramfs}.bak"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# keep booted initramfs
|
||||
uptime_days=$(awk '{printf "%d", $1 / 3600 / 24}' /proc/uptime)
|
||||
if [ -n "$uptime_days" ]; then
|
||||
boot_initramfs=$(find "${initramfs}.bak" -mtime +${uptime_days})
|
||||
fi
|
||||
if [ -n "${boot_initramfs}" ]; then
|
||||
mv -f "${initramfs_bak}" "${initramfs}.bak"
|
||||
verbose "Backup ${initramfs}.bak"
|
||||
return 0
|
||||
fi
|
||||
verbose "Removing current backup ${initramfs_bak}"
|
||||
rm -f ${initramfs_bak}
|
||||
}
|
||||
|
||||
# nuke generated copy
|
||||
remove_initramfs()
|
||||
{
|
||||
[ -z "${initramfs_bak}" ] && return 0
|
||||
rm -f "${initramfs_bak}"
|
||||
verbose "Removing ${initramfs_bak}"
|
||||
}
|
||||
|
||||
|
||||
generate_initramfs()
|
||||
{
|
||||
echo "dracut-update-initramfs: Generating ${initramfs}"
|
||||
OPTS=""
|
||||
if [ "${verbose}" = 1 ]; then
|
||||
OPTS="-v ${OPTS}"
|
||||
fi
|
||||
##WORK HERE!
|
||||
if dracut ${OPTS} "${initramfs}.new" "${version}"; then
|
||||
mv -f "${initramfs}.new" "${initramfs}"
|
||||
set_sha1
|
||||
else
|
||||
mkinitramfs_return="$?"
|
||||
remove_initramfs
|
||||
rm -f "${initramfs}.new"
|
||||
if [ "$mkinitramfs_return" = "2" ]; then
|
||||
# minversion wasn't met, exit 0
|
||||
exit 0
|
||||
fi
|
||||
echo "update-initramfs: failed for ${initramfs}"
|
||||
exit $mkinitramfs_return
|
||||
fi
|
||||
}
|
||||
|
||||
# lilo call
|
||||
run_lilo()
|
||||
{
|
||||
# show lilo errors on failure
|
||||
if ! lilo -t > /dev/null 2>&1 ; then
|
||||
echo "ERROR lilo fails for new ${initramfs}:"
|
||||
echo
|
||||
lilo -t
|
||||
fi
|
||||
lilo
|
||||
}
|
||||
|
||||
# check if lilo is on mbr
|
||||
mbr_check()
|
||||
{
|
||||
# try to discover grub|grub2 and be happy
|
||||
[ -r /boot/grub/grub.cfg ] \
|
||||
&& groot=$(awk '/^set root=/{print substr($2, 7, 3); exit}' \
|
||||
/boot/grub/grub.cfg)
|
||||
[ -r /boot/grub/menu.lst ] \
|
||||
&& groot=$(awk '/^root/{print substr($2, 2, 3); exit}' \
|
||||
/boot/grub/menu.lst)
|
||||
[ -e /boot/grub/device.map ] && [ -n "${groot}" ] \
|
||||
&& dev=$(awk "/${groot}/{ print \$NF}" /boot/grub/device.map)
|
||||
[ -n "${dev}" ] && [ -r ${dev} ] \
|
||||
&& dd if="${dev}" bs=512 skip=0 count=1 2> /dev/null \
|
||||
| grep -q GRUB && return 0
|
||||
|
||||
# check out lilo.conf for validity
|
||||
boot=$(awk -F = '/^boot=/{ print $2}' /etc/lilo.conf)
|
||||
[ -z "${boot}" ] && return 0
|
||||
case ${boot} in
|
||||
/dev/md/*)
|
||||
if [ -r /proc/mdstat ]; then
|
||||
MD=${boot#/dev/md/}
|
||||
boot="/dev/$(awk "/^md${MD}/{print substr(\$5, 1, 3)}" \
|
||||
/proc/mdstat)"
|
||||
fi
|
||||
;;
|
||||
/dev/md*)
|
||||
if [ -r /proc/mdstat ]; then
|
||||
MD=${boot#/dev/}
|
||||
boot="/dev/$(awk "/^${MD}/{print substr(\$5, 1, 3)}" \
|
||||
/proc/mdstat)"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
[ ! -r "${boot}" ] && return 0
|
||||
dd if="${boot}" bs=512 skip=0 count=1 2> /dev/null | grep -q LILO \
|
||||
&& run_lilo && return 0
|
||||
|
||||
# no idea which bootloader is used
|
||||
echo
|
||||
echo "WARNING: grub and lilo installed."
|
||||
echo "If you use grub as bootloader everything is fine."
|
||||
echo "If you use lilo as bootloader you must run lilo!"
|
||||
echo
|
||||
}
|
||||
|
||||
# Invoke bootloader
|
||||
run_bootloader()
|
||||
{
|
||||
# if both lilo and grub around, figure out if lilo needs to be run
|
||||
if ( command -v update-grub >/dev/null 2>&1 \
|
||||
|| [ -e /boot/grub/menu.lst ] || [ -e /boot/grub/grub.cfg ] ) \
|
||||
&& ( [ -e /etc/lilo.conf ] && command -v lilo >/dev/null 2>&1 ); then
|
||||
[ -r "${KPKGCONF}" ] && \
|
||||
do_b=$(awk '/^do_bootloader/{print $3}' "${KPKGCONF}")
|
||||
if [ "${do_b}" = "yes" ] || [ "${do_b}" = "Yes" ] \
|
||||
|| [ "${do_b}" = "YES" ]; then
|
||||
run_lilo
|
||||
return 0
|
||||
elif [ "${do_b}" = "no" ] || [ "${do_b}" = "No" ] \
|
||||
|| [ "${do_b}" = "NO" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# do_bootloader unconfigured
|
||||
mbr_check
|
||||
return 0
|
||||
fi
|
||||
if [ -r /etc/lilo.conf ] && command -v lilo >/dev/null 2>&1; then
|
||||
run_lilo
|
||||
return 0
|
||||
fi
|
||||
if command -v elilo >/dev/null 2>&1; then
|
||||
elilo
|
||||
return 0
|
||||
fi
|
||||
if [ -r /etc/zipl.conf ]; then
|
||||
zipl
|
||||
fi
|
||||
if flash-kernel --supported >/dev/null 2>&1; then
|
||||
flash-kernel ${version}
|
||||
fi
|
||||
}
|
||||
|
||||
compare_sha1()
|
||||
{
|
||||
sha1sum "${initramfs}" | diff "${STATEDIR}/${version}" - >/dev/null 2>&1
|
||||
return $?
|
||||
}
|
||||
|
||||
# Note that this must overwrite so that updates work.
|
||||
set_sha1()
|
||||
{
|
||||
sha1sum "${initramfs}" > "${STATEDIR}/${version}"
|
||||
}
|
||||
|
||||
delete_sha1()
|
||||
{
|
||||
rm -f "${STATEDIR}/${version}"
|
||||
}
|
||||
|
||||
# ro /boot is not modified
|
||||
ro_boot_check()
|
||||
{
|
||||
# check irrelevant inside of a chroot
|
||||
if [ ! -r /proc/mounts ] || chrooted; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
boot_opts=$(awk '/boot/{if ((match($4, /^ro/) || match($4, /,ro/)) \
|
||||
&& $2 == "/boot") print "ro"}' /proc/mounts)
|
||||
if [ -n "${boot_opts}" ]; then
|
||||
echo "WARNING: /boot is ro mounted."
|
||||
echo "update-initramfs: Not updating ${initramfs}"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
get_sorted_versions()
|
||||
{
|
||||
version_list=""
|
||||
|
||||
for gsv_x in "${STATEDIR}"/*; do
|
||||
gsv_x="$(basename "${gsv_x}")"
|
||||
if [ "${gsv_x}" = '*' ]; then
|
||||
return 0
|
||||
fi
|
||||
worklist=""
|
||||
for gsv_i in $version_list; do
|
||||
if dpkg --compare-versions "${gsv_x}" '>' "${gsv_i}"; then
|
||||
worklist="${worklist} ${gsv_x} ${gsv_i}"
|
||||
gsv_x=""
|
||||
else
|
||||
worklist="${worklist} ${gsv_i}"
|
||||
fi
|
||||
done
|
||||
if [ "${gsv_x}" != "" ]; then
|
||||
worklist="${worklist} ${gsv_x}"
|
||||
fi
|
||||
version_list="${worklist}"
|
||||
done
|
||||
|
||||
verbose "Available versions: ${version_list}"
|
||||
}
|
||||
|
||||
set_current_version()
|
||||
{
|
||||
if [ -f /boot/dracut.img-`uname -r` ]; then
|
||||
version=`uname -r`
|
||||
fi
|
||||
}
|
||||
|
||||
set_linked_version()
|
||||
{
|
||||
if [ -e /initrd.img ] && [ -L /initrd.img ]; then
|
||||
linktarget="$(basename "$(readlink /initrd.img)")"
|
||||
fi
|
||||
|
||||
if [ -e /boot/initrd.img ] && [ -L /boot/initrd.img ]; then
|
||||
linktarget="$(basename "$(readlink /boot/initrd.img)")"
|
||||
fi
|
||||
|
||||
if [ -z "${linktarget}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
version="${linktarget##*img-}"
|
||||
}
|
||||
|
||||
set_highest_version()
|
||||
{
|
||||
get_sorted_versions
|
||||
set -- ${version_list}
|
||||
version=${1}
|
||||
}
|
||||
|
||||
create()
|
||||
{
|
||||
if [ -z "${version}" ]; then
|
||||
usage "Create mode requires a version argument"
|
||||
fi
|
||||
|
||||
set_initramfs
|
||||
|
||||
if [ "${takeover}" = 0 ]; then
|
||||
if version_exists "${version}"; then
|
||||
panic "Cannot create version ${version}: already exists"
|
||||
fi
|
||||
|
||||
if [ -e "${initramfs}" ]; then
|
||||
panic "${initramfs} already exists, cannot create."
|
||||
fi
|
||||
fi
|
||||
|
||||
generate_initramfs
|
||||
}
|
||||
|
||||
update()
|
||||
{
|
||||
if [ "${update_initramfs}" = "no" ]; then
|
||||
echo "update-initramfs: Not updating initramfs."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z "${version}" ]; then
|
||||
set_highest_version
|
||||
fi
|
||||
|
||||
if [ -z "${version}" ]; then
|
||||
set_linked_version
|
||||
fi
|
||||
|
||||
if [ -z "${version}" ]; then
|
||||
set_current_version
|
||||
fi
|
||||
|
||||
if [ -z "${version}" ]; then
|
||||
verbose "Nothing to do, exiting."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
set_initramfs
|
||||
|
||||
ro_boot_check
|
||||
|
||||
altered_check
|
||||
|
||||
backup_initramfs
|
||||
|
||||
generate_initramfs
|
||||
|
||||
run_bootloader
|
||||
|
||||
backup_booted_initramfs
|
||||
}
|
||||
|
||||
delete()
|
||||
{
|
||||
if [ -z "${version}" ]; then
|
||||
usage "Delete mode requires a version argument"
|
||||
fi
|
||||
|
||||
set_initramfs
|
||||
|
||||
if [ ! -e "${initramfs}" ]; then
|
||||
panic "Cannot delete ${initramfs}, doesn't exist."
|
||||
fi
|
||||
|
||||
if ! version_exists "${version}"; then
|
||||
panic "Cannot delete version ${version}: Not created by this utility."
|
||||
fi
|
||||
|
||||
altered_check
|
||||
|
||||
echo "update-initramfs: Deleting ${initramfs}"
|
||||
|
||||
delete_sha1
|
||||
|
||||
rm -f "${initramfs}"
|
||||
}
|
||||
|
||||
# Check for update mode on existing and modified initramfs
|
||||
altered_check()
|
||||
{
|
||||
# No check on takeover
|
||||
[ "${takeover}" = 1 ] && return 0
|
||||
if [ ! -e "${initramfs}" ]; then
|
||||
mild_panic "${initramfs} does not exist. Cannot update."
|
||||
fi
|
||||
if ! compare_sha1; then
|
||||
echo "update-initramfs: ${initramfs} has been altered." >&2
|
||||
mild_panic "update-initramfs: Cannot update. Override with -t option."
|
||||
fi
|
||||
}
|
||||
|
||||
# Defaults
|
||||
verbose=0
|
||||
yes=0
|
||||
# We default to takeover=1 in Ubuntu, but not Debian
|
||||
takeover=0
|
||||
|
||||
##
|
||||
|
||||
while getopts "k:cudyvtb:h?" flag; do
|
||||
case "${flag}" in
|
||||
k)
|
||||
version="${OPTARG}"
|
||||
;;
|
||||
c)
|
||||
mode="c"
|
||||
;;
|
||||
d)
|
||||
mode="d"
|
||||
;;
|
||||
u)
|
||||
mode="u"
|
||||
;;
|
||||
v)
|
||||
verbose="1"
|
||||
;;
|
||||
y)
|
||||
yes="1"
|
||||
;;
|
||||
t)
|
||||
takeover="1"
|
||||
;;
|
||||
b)
|
||||
BOOTDIR="${OPTARG}"
|
||||
if [ ! -d "${BOOTDIR}" ]; then
|
||||
echo "Error: ${BOOTDIR} is not a directory."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
h|?)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $((${OPTIND} - 1))
|
||||
|
||||
if [ $# -ne 0 ]; then
|
||||
echo "Invalid argument for option -k."
|
||||
usage
|
||||
fi
|
||||
|
||||
# Validate arguments
|
||||
if [ -z "${mode}" ]; then
|
||||
usage "You must specify at least one of -c, -u, or -d."
|
||||
fi
|
||||
|
||||
if [ "${version}" = "all" ] \
|
||||
|| ( [ "${update_initramfs}" = "all" ] && [ -z "${version}" ] ); then
|
||||
: FIXME check for --yes, and if not ask are you sure
|
||||
get_sorted_versions
|
||||
if [ -z "${version_list}" ]; then
|
||||
verbose "Nothing to do, exiting."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
OPTS="-b ${BOOTDIR}"
|
||||
if [ "${verbose}" = "1" ]; then
|
||||
OPTS="${OPTS} -v"
|
||||
fi
|
||||
if [ "${takeover}" = "1" ]; then
|
||||
OPTS="${OPTS} -t"
|
||||
fi
|
||||
if [ "${yes}" = "1" ]; then
|
||||
OPTS="${OPTS} -y"
|
||||
fi
|
||||
for u_version in ${version_list}; do
|
||||
# Don't stop if one version doesn't work.
|
||||
set +e
|
||||
verbose "Execute: ${0} -${mode} -k \"${u_version}\" ${OPTS}"
|
||||
"${0}" -${mode} -k "${u_version}" ${OPTS}
|
||||
set -e
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
case "${mode}" in
|
||||
c)
|
||||
create
|
||||
;;
|
||||
d)
|
||||
delete
|
||||
;;
|
||||
u)
|
||||
update
|
||||
;;
|
||||
esac
|
167
dracut.8.xml
167
dracut.8.xml
@@ -1,5 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- This document was created with Syntext Serna Free. --><!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
|
||||
<!-- vim: set ts=8 sts=2 sw=2 et: -->
|
||||
<refentry id="dracut8">
|
||||
<refentryinfo>
|
||||
<title>dracut</title>
|
||||
@@ -17,18 +18,6 @@
|
||||
<surname>Lowther</surname>
|
||||
<email>victor.lowther@gmail.com</email>
|
||||
</author>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Warren</firstname>
|
||||
<surname>Togami</surname>
|
||||
<email>wtogami@redhat.com</email>
|
||||
</author>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Jeremy</firstname>
|
||||
<surname>Katz</surname>
|
||||
<email>katzj@redhat.com</email>
|
||||
</author>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Philippe</firstname>
|
||||
@@ -37,9 +26,8 @@
|
||||
</author>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>David</firstname>
|
||||
<surname>Dillow</surname>
|
||||
<email>dave@thedillows.org</email>
|
||||
<firstname>Warren</firstname>
|
||||
<surname>Togami</surname>
|
||||
</author>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
@@ -47,6 +35,17 @@
|
||||
<surname>Żołnowski</surname>
|
||||
<email>aidecoe@aidecoe.name</email>
|
||||
</author>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Jeremy</firstname>
|
||||
<surname>Katz</surname>
|
||||
</author>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>David</firstname>
|
||||
<surname>Dillow</surname>
|
||||
<email>dave@thedillows.org</email>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
<refmeta>
|
||||
@@ -82,7 +81,7 @@ which are needed to access the root filesystem.</para>
|
||||
<para>
|
||||
For a complete list of kernel command line options see
|
||||
<citerefentry>
|
||||
<refentrytitle>dracut.kernel</refentrytitle>
|
||||
<refentrytitle>dracut.cmdline</refentrytitle>
|
||||
<manvolnum>7</manvolnum>
|
||||
</citerefentry>
|
||||
</para>
|
||||
@@ -111,7 +110,12 @@ For a complete list of kernel command line options see
|
||||
<para>specify a space-separated list of dracut modules to call
|
||||
when building the initramfs.
|
||||
Modules are located in
|
||||
<filename>/usr/share/dracut/modules.d</filename>. This parameter can be specified multiple times.</para>
|
||||
<filename>/usr/lib/dracut/modules.d</filename>. This parameter can be specified multiple times.</para>
|
||||
<para>
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes.
|
||||
For example:
|
||||
<screen># dracut --modules "module1 module2" ...</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@@ -123,6 +127,11 @@ Modules are located in
|
||||
</term>
|
||||
<listitem>
|
||||
<para>omit a space-separated list of dracut modules. This parameter can be specified multiple times.</para>
|
||||
<para>
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes.
|
||||
For example:
|
||||
<screen># dracut --omit "module1 module2" ...</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@@ -134,8 +143,27 @@ Modules are located in
|
||||
</term>
|
||||
<listitem>
|
||||
<para>add a space-separated list of dracut modules to the default set of modules. This parameter can be specified multiple times.</para>
|
||||
<para>
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes.
|
||||
For example:
|
||||
<screen># dracut --add "module1 module2" ...</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--force-add <replaceable><list of dracut modules></replaceable></option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>force to add a space-separated list of dracut modules to the default set of modules, when -H is specified. This parameter can be specified multiple times.</para>
|
||||
<para>
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes.
|
||||
For example:
|
||||
<screen># dracut --force-add "module1 module2" ...</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>-d</option>
|
||||
@@ -147,6 +175,11 @@ Modules are located in
|
||||
<para>specify a space-separated list of kernel modules to exclusively include
|
||||
in the initramfs.
|
||||
The kernel modules have to be specified without the ".ko" suffix. This parameter can be specified multiple times.</para>
|
||||
<para>
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes.
|
||||
For example:
|
||||
<screen># dracut --drivers "kmodule1 kmodule2" ...</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@@ -156,6 +189,11 @@ The kernel modules have to be specified without the ".ko" suffix. This
|
||||
<listitem>
|
||||
<para>specify a space-separated list of kernel modules to add to the initramfs.
|
||||
The kernel modules have to be specified without the ".ko" suffix. This parameter can be specified multiple times.</para>
|
||||
<para>
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes.
|
||||
For example:
|
||||
<screen># dracut --add-drivers "kmodule1 kmodule2" ...</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@@ -165,6 +203,11 @@ The kernel modules have to be specified without the ".ko" suffix. This
|
||||
<listitem>
|
||||
<para>specify a space-separated list of kernel filesystem modules to exclusively
|
||||
include in the generic initramfs. This parameter can be specified multiple times.</para>
|
||||
<para>
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes.
|
||||
For example:
|
||||
<screen># dracut --filesystems "filesystem1 filesystem2" ...</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@@ -218,6 +261,46 @@ include in the generic initramfs. This parameter can be specified multiple times
|
||||
<para>do not include local <filename>/etc/mdadm.conf</filename></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--lvmconf</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>include local <filename>/etc/lvm/lvm.conf</filename></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--nolvmconf</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>do not include local <filename>/etc/lvm/lvm.conf</filename></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--fscks [LIST]</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>add a space-separated list of fsck tools, in addition to
|
||||
<filename>dracut.conf</filename>'s specification; the
|
||||
installation is opportunistic (non-existing tools are ignored)
|
||||
</para>
|
||||
<para>
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes.
|
||||
For example:
|
||||
<screen># dracut --fscks "fsck.foo barfsck" ...</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--nofscks</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>inhibit installation of any fsck tools</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--strip</option>
|
||||
@@ -236,10 +319,10 @@ include in the generic initramfs. This parameter can be specified multiple times
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--prefix</option>
|
||||
<option>--prefix <replaceable><dir></replaceable></option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>prefix initramfs files with /run/initramfs/</para>
|
||||
<para>prefix initramfs files with the specified directory</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@@ -247,7 +330,16 @@ include in the generic initramfs. This parameter can be specified multiple times
|
||||
<option>--noprefix</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>do not prefix initramfs files with /run/initramfs/ (default)</para>
|
||||
<para>do not prefix initramfs files (default)</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--ctty</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>if possible, try to spawn an emergency shell on a terminal
|
||||
with job control</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@@ -314,6 +406,14 @@ Default:
|
||||
<filename>/etc/dracut.conf.d</filename></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--sshkey <replaceable><sshkey file></replaceable></option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>ssh key file used with ssh-client module.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>-l</option>
|
||||
@@ -324,7 +424,7 @@ Default:
|
||||
<listitem>
|
||||
<para>activates the local mode. dracut will use modules from the current working
|
||||
directory instead of the system-wide installed modules in
|
||||
<filename>/usr/share/dracut/modules.d</filename>.
|
||||
<filename>/usr/lib/dracut/modules.d</filename>.
|
||||
This is useful when running dracut from a git checkout.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -351,7 +451,23 @@ the local host instead of a generic host.
|
||||
<para>Use <filename>/etc/fstab</filename> instead of <filename>/proc/self/mountinfo</filename>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--add_fstab <replaceable><filename></replaceable> </option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Add entries of <replaceable><filename></replaceable> to the initramfs /etc/fstab.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--mount "<replaceable><device></replaceable> <replaceable><mountpoint></replaceable> <replaceable><filesystem type></replaceable> <replaceable><filesystem options></replaceable>"</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Add entries of <replaceable><filename></replaceable> to the initramfs /etc/fstab.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>-i</option>
|
||||
</term>
|
||||
@@ -372,6 +488,11 @@ TARGET directory in the final initramfs. If SOURCE is a file, it will be install
|
||||
</term>
|
||||
<listitem>
|
||||
<para>install the space separated list of files into the initramfs.</para>
|
||||
<para>
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes.
|
||||
For example:
|
||||
<screen># dracut --install "/bin/foo /sbin/bar" ...</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@@ -537,7 +658,7 @@ set in the configuration files.</para>
|
||||
<title>See Also</title>
|
||||
<para>
|
||||
<citerefentry>
|
||||
<refentrytitle>dracut.kernel</refentrytitle>
|
||||
<refentrytitle>dracut.cmdline</refentrytitle>
|
||||
<manvolnum>7</manvolnum>
|
||||
</citerefentry>
|
||||
<citerefentry>
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- This document was created with Syntext Serna Free. --><!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" []>
|
||||
<!-- vim: set ts=8 sts=2 sw=2 et: -->
|
||||
<refentry id="dracutkernel7">
|
||||
<refentryinfo>
|
||||
<title>dracut.kernel</title>
|
||||
<title>dracut.cmdline</title>
|
||||
<productname>dracut</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
@@ -14,12 +15,12 @@
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
<refmeta>
|
||||
<refentrytitle>dracut.kernel</refentrytitle>
|
||||
<refentrytitle>dracut.cmdline</refentrytitle>
|
||||
<manvolnum>7</manvolnum>
|
||||
<refmiscinfo class="version"/>
|
||||
</refmeta>
|
||||
<refnamediv>
|
||||
<refname>dracut.kernel</refname>
|
||||
<refname>dracut.cmdline</refname>
|
||||
<refpurpose>dracut kernel command line options</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
@@ -87,7 +88,7 @@ accordingly.</para>
|
||||
<envar>rd.driver.blacklist=<replaceable><drivername><optional>,<drivername>,...</optional></replaceable></envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>do not load kernel module <drivername>
|
||||
<para>do not load kernel module <drivername>.
|
||||
This parameter can be specified multiple times.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -96,7 +97,7 @@ This parameter can be specified multiple times.</para>
|
||||
<envar>rd.driver.pre=<replaceable><drivername><optional>,<drivername>,...</optional></replaceable></envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>force loading kernel module <drivername>
|
||||
<para>force loading kernel module <drivername>.
|
||||
This parameter can be specified multiple times.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -108,6 +109,20 @@ This parameter can be specified multiple times.</para>
|
||||
<para>force loading kernel module <drivername> after all automatic loading modules have been loaded. This parameter can be specified multiple times.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>rd.ctty=<replaceable><terminal></replaceable></envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
if the dracut image was generated with --ctty option, try to
|
||||
spawn an emergency shell on the specified terminal; if
|
||||
<envar>rd.ctty</envar> is specified without a value or not
|
||||
provided at all, the default is /dev/tty1. The '/dev' prefix
|
||||
can be omitted.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect2>
|
||||
<refsect2 id="dracut-kernel-debug">
|
||||
@@ -176,7 +191,7 @@ This parameter can be specified multiple times.</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>voonsole.keymap=</envar>
|
||||
<envar>vconsole.keymap=</envar>
|
||||
<replaceable><keymap base file name></replaceable>
|
||||
</term>
|
||||
<listitem>
|
||||
@@ -342,6 +357,12 @@ This parameter can be specified multiple times.</para>
|
||||
<para>disable MD RAID for imsm/isw raids, use DM RAID instead</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><envar>rd.md.ddf</envar>=0</term>
|
||||
<listitem>
|
||||
<para>disable MD RAID for SNIA ddf raids, use DM RAID instead</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>rd.md.conf</envar>=0
|
||||
@@ -350,6 +371,14 @@ This parameter can be specified multiple times.</para>
|
||||
<para>ignore mdadm.conf included in initramfs</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>rd.md.waitclean</envar>=1
|
||||
</term>
|
||||
<listitem>
|
||||
<para>wait for any resync, recovery, or reshape activity to finish before continuing</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>rd.md.uuid=<replaceable><md raid uuid></replaceable></envar>
|
||||
@@ -420,7 +449,7 @@ e.g.
|
||||
<envar>ip=</envar><replaceable>{dhcp|on|any|dhcp6|auto6|ibft}</replaceable>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>dhcp|on|any: get ip from dhcp server from all interfaces. If root=dhcp,
|
||||
<para><constant>dhcp|on|any</constant>: 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.</para>
|
||||
<para><constant>auto6</constant>: IPv6 autoconfiguration</para>
|
||||
@@ -431,15 +460,15 @@ with a valid DHCP root-path.</para>
|
||||
<varlistentry>
|
||||
<term><envar>ip=</envar><replaceable><interface></replaceable>:<replaceable>{dhcp|on|any|dhcp6|auto6}</replaceable></term>
|
||||
<listitem>
|
||||
<para>dhcp|on|any|dhcp6: get ip from dhcp server on a specific interface
|
||||
auto6: do IPv6 autoconfiguration
|
||||
This parameter can be specified multiple times.</para>
|
||||
<para><constant>dhcp|on|any|dhcp6</constant>: get ip from dhcp server on a specific interface</para>
|
||||
<para><constant>auto6</constant>: do IPv6 autoconfiguration</para>
|
||||
<para>This parameter can be specified multiple times.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><envar>ip=</envar><replaceable><client-IP></replaceable>:<optional>
|
||||
<replaceable><server-id></replaceable>
|
||||
</optional>:<replaceable><gateway-IP></replaceable>:<replaceable><netmask></replaceable>:<replaceable><client_hostname></replaceable>:<replaceable><interface></replaceable>:<replaceable>{none|off}</replaceable></term>
|
||||
<term><envar>ip=</envar><replaceable><client-IP></replaceable>:
|
||||
<replaceable><server-IP></replaceable>
|
||||
:<replaceable><gateway-IP></replaceable>:<replaceable><netmask></replaceable>:<replaceable><client_hostname></replaceable>:<replaceable><interface></replaceable>:<replaceable>{none|off}</replaceable></term>
|
||||
<listitem>
|
||||
<para>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.</para>
|
||||
@@ -449,7 +478,6 @@ This parameter can be specified multiple times.</para>
|
||||
<term><envar>ifname=</envar><replaceable><interface></replaceable>:<replaceable><MAC></replaceable></term>
|
||||
<listitem>
|
||||
<para>Assign network device name <interface> (ie eth0) to the NIC with MAC <MAC>.
|
||||
Note letters in the MAC-address must be lowercase!
|
||||
<remark>Note: If you use this option you <emphasis remap="B">must</emphasis> specify an ifname= argument for all interfaces used in ip= or fcoe= arguments.</remark>
|
||||
This parameter can be specified multiple times.</para>
|
||||
</listitem>
|
||||
@@ -479,6 +507,14 @@ Required if multiple ip= lines are used.</para>
|
||||
<para>turn on/off biosdevname network interface renaming</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>rd.neednet=</envar><replaceable><0|1></replaceable>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>boolean, bring up network even without netroot set</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect2>
|
||||
<refsect2>
|
||||
@@ -695,10 +731,45 @@ rd.znet=ctc,0.0.0600,0.0.0601,0.0.0602,protocol=bar</programlisting></para>
|
||||
<refsect2>
|
||||
<title>Plymouth Boot Splash</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><envar>plymouth.enable</envar>=0</term>
|
||||
<listitem>
|
||||
<para>disable the plymouth bootsplash.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><envar>rd.plymouth</envar>=0</term>
|
||||
<listitem>
|
||||
<para>disable plymouth. This will not work with encrypted partitions.</para>
|
||||
<para>disable the plymouth bootsplash only for the initramfs.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect2>
|
||||
<refsect2>
|
||||
<title>Kernel keys</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><envar>masterkey=</envar><replaceable><kernel master key path name></replaceable></term>
|
||||
<listitem>
|
||||
<para>Set the path name of the kernel master key. e.g.: <programlisting>masterkey=/etc/keys/kmk-trusted.blob</programlisting></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><envar>masterkeytype=</envar><replaceable><kernel master key type></replaceable></term>
|
||||
<listitem>
|
||||
<para>Set the type of the kernel master key. e.g.: <programlisting>masterkeytype=trusted</programlisting></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><envar>evmkey=</envar><replaceable><EVM key path name></replaceable></term>
|
||||
<listitem>
|
||||
<para>Set the path name of the EVM key. e.g.: <programlisting>evmkey=/etc/keys/evm-trusted.blob</programlisting></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><envar>ecryptfskey=</envar><replaceable><eCryptfs key path name></replaceable></term>
|
||||
<listitem>
|
||||
<para>Set the path name of the eCryptfs key. e.g.: <programlisting>ecryptfskey=/etc/keys/ecryptfs-trusted.blob</programlisting></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
@@ -1227,6 +1298,14 @@ set in the configuration files.</para>
|
||||
<para>Can contain additional command line options.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<filename>/etc/cmdline.d/*.conf</filename>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Can contain additional command line options.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
<refsect1>
|
@@ -29,3 +29,12 @@ mdadmconf="yes"
|
||||
|
||||
# install local /etc/lvm/lvm.conf
|
||||
lvmconf="yes"
|
||||
|
||||
# A list of fsck tools to install. If it's not specified, module's hardcoded
|
||||
# default is used, currently: "umount mount /sbin/fsck* xfs_db xfs_check
|
||||
# xfs_repair e2fsck jfs_fsck reiserfsck btrfsck". The installation is
|
||||
# opportunistic, so non-existing tools are just ignored.
|
||||
#fscks=""
|
||||
|
||||
# inhibit installation of any fsck tools
|
||||
#nofscks="yes"
|
||||
|
@@ -1,5 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- This document was created with Syntext Serna Free. --><!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
|
||||
<!-- vim: set ts=8 sts=2 sw=2 et: -->
|
||||
<refentry id="dracutconf5">
|
||||
<refentryinfo>
|
||||
<title>dracut.conf</title>
|
||||
@@ -45,7 +46,7 @@ overwrite parameters set in <filename>/etc/dracut.conf</filename>. Each line spe
|
||||
<listitem>
|
||||
<para>Specify a space-separated list of dracut modules to
|
||||
call when building the initramfs. Modules are located
|
||||
in <filename>/usr/share/dracut/modules.d</filename>.</para>
|
||||
in <filename>/usr/lib/dracut/modules.d</filename>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@@ -84,6 +85,14 @@ modules to add to the initramfs.
|
||||
The kernel modules have to be specified without the ".ko" suffix.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>install_items+=" <replaceable><kernel modules></replaceable> "</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Specify a space-separated list of files, which are added to the initramfs image.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>filesystems+=" <replaceable><filesystem names></replaceable> "</envar>
|
||||
@@ -110,6 +119,14 @@ initramfs.</para>
|
||||
<para>Specify additional directories, where to look for firmwares, separated by <constant>:</constant></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>install_items+=" <replaceable><file></replaceable>[ <replaceable><file></replaceable> ...] "</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Specify additional files to include in the initramfs, separated by spaces.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>do_strip="<replaceable>{yes|no}</replaceable>"</envar>
|
||||
@@ -138,6 +155,14 @@ initramfs.</para>
|
||||
<para>Use <filename>/etc/fstab</filename> instead of <filename>/proc/self/mountinfo</filename>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>add_fstab+=" <replaceable><filename></replaceable> "</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Add entries of <replaceable><filename></replaceable> to the initramfs /etc/fstab.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>mdadmconf="<replaceable>{yes|no}</replaceable>"</envar>
|
||||
@@ -154,6 +179,27 @@ initramfs.</para>
|
||||
<para>Include local <filename>/etc/lvm/lvm.conf</filename> (default=yes)</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>fscks=" <replaceable><fsck tools></replaceable> "</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Add a space-separated list of fsck tools. If nothing is
|
||||
specified, the default is: "<replaceable>umount mount
|
||||
/sbin/fsck* xfs_db xfs_check xfs_repair e2fsck jfs_fsck
|
||||
reiserfsck btrfsck</replaceable>"
|
||||
</para>
|
||||
<para>The installation is opportunistic (non-existing tools are ignored).</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>nofscks="<replaceable>{yes}</replaceable>"</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>If specified, inhibit installation of any fsck tools.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>kernel_only="<replaceable>{yes|no}</replaceable>"</envar>
|
||||
@@ -233,7 +279,7 @@ The configuration files are read in alphanumerical order.</para>
|
||||
<manvolnum>8</manvolnum>
|
||||
</citerefentry>
|
||||
<citerefentry>
|
||||
<refentrytitle>dracut.kernel</refentrytitle>
|
||||
<refentrytitle>dracut.cmdline</refentrytitle>
|
||||
<manvolnum>7</manvolnum>
|
||||
</citerefentry>
|
||||
</para>
|
||||
|
@@ -2,6 +2,9 @@
|
||||
|
||||
# i18n
|
||||
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
|
||||
add_dracutmodules+=" rpmversion shutdown "
|
||||
add_dracutmodules+=" rpmversion "
|
||||
omit_dracutmodules+=" dash "
|
||||
stdloglvl=3
|
||||
prefix=/run/initramfs
|
||||
realinitpath="/usr/lib/systemd/systemd"
|
||||
install_items+=" vi /etc/virc ps grep cat rm openvt "
|
||||
|
@@ -2,6 +2,5 @@
|
||||
missingok
|
||||
notifempty
|
||||
size 30k
|
||||
yearly
|
||||
create 0600 root root
|
||||
}
|
||||
|
210
dracut.spec
210
dracut.spec
@@ -1,3 +1,5 @@
|
||||
%define dracutlibdir %{_prefix}/lib/dracut
|
||||
|
||||
# Variables must be defined
|
||||
%define with_nbd 1
|
||||
|
||||
@@ -11,7 +13,7 @@ Version: xxx
|
||||
Release: xxx
|
||||
|
||||
Summary: Initramfs generator using udev
|
||||
%if 0%{?fedora}
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
Group: System Environment/Base
|
||||
%endif
|
||||
%if 0%{?suse_version}
|
||||
@@ -24,15 +26,15 @@ URL: https://dracut.wiki.kernel.org/
|
||||
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.bz2
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: dash bash
|
||||
%if 0%{?fedora}
|
||||
BuildRequires: dash bash git
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
%endif
|
||||
%if 0%{?suse_version}
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora}
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
BuildRequires: docbook-style-xsl docbook-dtds libxslt
|
||||
%endif
|
||||
|
||||
@@ -61,29 +63,20 @@ Requires: bash
|
||||
Requires: bzip2
|
||||
Requires: coreutils
|
||||
Requires: cpio
|
||||
Requires: dash
|
||||
Requires: filesystem >= 2.1.0
|
||||
Requires: findutils
|
||||
Requires: grep
|
||||
Requires: gzip
|
||||
Requires: kbd
|
||||
Requires: mktemp >= 1.5-5
|
||||
Requires: module-init-tools >= 3.7-9
|
||||
Requires: sed
|
||||
Requires: tar
|
||||
Requires: udev
|
||||
Requires: util-linux >= 2.20
|
||||
|
||||
%if 0%{?fedora}
|
||||
Requires: util-linux >= 2.16
|
||||
Requires: initscripts >= 8.63-1
|
||||
Requires: plymouth >= 0.8.0-0.2009.29.09.19.1
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
Conflicts: initscripts < 8.63-1
|
||||
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
Requires: util-linux >= 2.16
|
||||
%endif
|
||||
|
||||
|
||||
%description
|
||||
Dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
|
||||
Unlike existing implementations, dracut does hard-code as little as possible
|
||||
@@ -94,24 +87,6 @@ NFS, iSCSI, NBD, FCoE with the dracut-network package.
|
||||
%package network
|
||||
Summary: Dracut modules to build a dracut initramfs with network support
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: rpcbind
|
||||
%if %{with_nbd}
|
||||
Requires: nbd
|
||||
%endif
|
||||
Requires: iproute
|
||||
Requires: bridge-utils
|
||||
|
||||
%if 0%{?fedora}
|
||||
Requires: iscsi-initiator-utils
|
||||
Requires: nfs-utils
|
||||
Requires: dhclient
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
Requires: dhcp-client
|
||||
Requires: nfs-client
|
||||
Requires: vlan
|
||||
%endif
|
||||
Obsoletes: dracut-generic < 008
|
||||
Provides: dracut-generic = %{version}-%{release}
|
||||
|
||||
@@ -119,7 +94,7 @@ Provides: dracut-generic = %{version}-%{release}
|
||||
This package requires everything which is needed to build a generic
|
||||
all purpose initramfs with network support with dracut.
|
||||
|
||||
%if 0%{?fedora}
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
%package fips
|
||||
Summary: Dracut modules to build a dracut initramfs with an integrity check
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
@@ -137,6 +112,15 @@ This package requires everything which is needed to build an
|
||||
all purpose initramfs with dracut, which does an integrity check.
|
||||
%endif
|
||||
|
||||
%package fips-aesni
|
||||
Summary: Dracut modules to build a dracut initramfs with an integrity check with aesni-intel
|
||||
Requires: %{name}-fips = %{version}-%{release}
|
||||
|
||||
%description fips-aesni
|
||||
This package requires everything which is needed to build an
|
||||
all purpose initramfs with dracut, which does an integrity check
|
||||
and adds the aesni-intel kernel module.
|
||||
|
||||
%package caps
|
||||
Summary: Dracut modules to build a dracut initramfs which drops capabilities
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
@@ -156,24 +140,38 @@ This package contains tools to assemble the local initrd and host configuration.
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}
|
||||
|
||||
%if %{defined PATCH1}
|
||||
git init
|
||||
git config user.email "dracut-maint@redhat.com"
|
||||
git config user.name "Fedora dracut team"
|
||||
git add .
|
||||
git commit -a -q -m "%{version} baseline."
|
||||
|
||||
# Apply all the patches.
|
||||
git am -p1 %{patches}
|
||||
%endif
|
||||
|
||||
%build
|
||||
make
|
||||
|
||||
%install
|
||||
%if 0%{?fedora}
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
%endif
|
||||
make install DESTDIR=$RPM_BUILD_ROOT sbindir=/sbin \
|
||||
make install DESTDIR=$RPM_BUILD_ROOT \
|
||||
libdir=%{_prefix}/lib \
|
||||
bindir=%{_bindir} \
|
||||
sysconfdir=/etc mandir=%{_mandir}
|
||||
|
||||
echo %{name}-%{version}-%{release} > $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/10rpmversion/dracut-version
|
||||
echo %{name}-%{version}-%{release} > $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/10rpmversion/dracut-version
|
||||
|
||||
%if 0%{?fedora} == 0
|
||||
rm -fr $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/01fips
|
||||
%if 0%{?fedora} == 0 && 0%{?rhel} == 0
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/02fips-aesni
|
||||
%endif
|
||||
|
||||
# remove gentoo specific modules
|
||||
rm -fr $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/50gensplash
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/50gensplash
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/boot/dracut
|
||||
mkdir -p $RPM_BUILD_ROOT/var/lib/dracut/overlay
|
||||
@@ -181,7 +179,7 @@ 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}
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/01-dist.conf
|
||||
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/40-fips.conf
|
||||
%endif
|
||||
@@ -191,98 +189,118 @@ install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT/etc/dracut.con
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999
|
||||
rm $RPM_BUILD_ROOT/sbin/mkinitrd
|
||||
rm $RPM_BUILD_ROOT/sbin/lsinitrd
|
||||
rm $RPM_BUILD_ROOT%{_bindir}/mkinitrd
|
||||
rm $RPM_BUILD_ROOT%{_bindir}/lsinitrd
|
||||
%endif
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
|
||||
install -m 0644 dracut.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/dracut_log
|
||||
|
||||
# create compat symlink
|
||||
mkdir -p $RPM_BUILD_ROOT/sbin
|
||||
ln -s /usr/bin/dracut $RPM_BUILD_ROOT/sbin/dracut
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,0755)
|
||||
%doc README HACKING TODO COPYING AUTHORS NEWS dracut.html dracut.png dracut.svg
|
||||
%{_bindir}/dracut
|
||||
# compat symlink
|
||||
/sbin/dracut
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
|
||||
/sbin/mkinitrd
|
||||
/sbin/lsinitrd
|
||||
%{_bindir}/mkinitrd
|
||||
%{_bindir}/lsinitrd
|
||||
%endif
|
||||
%dir %{_datadir}/dracut
|
||||
%dir %{_datadir}/dracut/modules.d
|
||||
%{_datadir}/dracut/dracut-functions
|
||||
%{_datadir}/dracut/dracut-logger
|
||||
%dir %{dracutlibdir}
|
||||
%dir %{dracutlibdir}/modules.d
|
||||
%{dracutlibdir}/dracut-functions
|
||||
%{dracutlibdir}/dracut-logger
|
||||
%config(noreplace) /etc/dracut.conf
|
||||
%if 0%{?fedora} || 0%{?suse_version}
|
||||
%config(noreplace) /etc/dracut.conf.d/01-dist.conf
|
||||
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} > 6
|
||||
%config /etc/dracut.conf.d/01-dist.conf
|
||||
%endif
|
||||
%dir /etc/dracut.conf.d
|
||||
%{_mandir}/man8/dracut.8*
|
||||
%{_mandir}/man7/dracut.kernel.7*
|
||||
%{_mandir}/man7/dracut.cmdline.7*
|
||||
%{_mandir}/man5/dracut.conf.5*
|
||||
%{_datadir}/dracut/modules.d/00bootchart
|
||||
%{_datadir}/dracut/modules.d/00dash
|
||||
%{_datadir}/dracut/modules.d/05busybox
|
||||
%{_datadir}/dracut/modules.d/10i18n
|
||||
%{_datadir}/dracut/modules.d/10rpmversion
|
||||
%{_datadir}/dracut/modules.d/50plymouth
|
||||
%{_datadir}/dracut/modules.d/60xen
|
||||
%{_datadir}/dracut/modules.d/90btrfs
|
||||
%{_datadir}/dracut/modules.d/90crypt
|
||||
%{_datadir}/dracut/modules.d/90dm
|
||||
%{_datadir}/dracut/modules.d/90dmraid
|
||||
%{_datadir}/dracut/modules.d/90dmsquash-live
|
||||
%{_datadir}/dracut/modules.d/90kernel-modules
|
||||
%{_datadir}/dracut/modules.d/90lvm
|
||||
%{_datadir}/dracut/modules.d/90mdraid
|
||||
%{_datadir}/dracut/modules.d/90multipath
|
||||
%{_datadir}/dracut/modules.d/91crypt-gpg
|
||||
%{_datadir}/dracut/modules.d/95debug
|
||||
%{_datadir}/dracut/modules.d/95resume
|
||||
%{_datadir}/dracut/modules.d/95rootfs-block
|
||||
%{_datadir}/dracut/modules.d/95dasd
|
||||
%{_datadir}/dracut/modules.d/95dasd_mod
|
||||
%{_datadir}/dracut/modules.d/95fstab-sys
|
||||
%{_datadir}/dracut/modules.d/95zfcp
|
||||
%{_datadir}/dracut/modules.d/95terminfo
|
||||
%{_datadir}/dracut/modules.d/95udev-rules
|
||||
%{_datadir}/dracut/modules.d/97biosdevname
|
||||
%{_datadir}/dracut/modules.d/98selinux
|
||||
%{_datadir}/dracut/modules.d/98syslog
|
||||
%{_datadir}/dracut/modules.d/99base
|
||||
%{_datadir}/dracut/modules.d/99shutdown
|
||||
%{dracutlibdir}/modules.d/00bootchart
|
||||
%{dracutlibdir}/modules.d/00dash
|
||||
%{dracutlibdir}/modules.d/05busybox
|
||||
%{dracutlibdir}/modules.d/10i18n
|
||||
%{dracutlibdir}/modules.d/10rpmversion
|
||||
%{dracutlibdir}/modules.d/30convertfs
|
||||
%{dracutlibdir}/modules.d/50plymouth
|
||||
%{dracutlibdir}/modules.d/90btrfs
|
||||
%{dracutlibdir}/modules.d/90crypt
|
||||
%{dracutlibdir}/modules.d/90dm
|
||||
%{dracutlibdir}/modules.d/90dmraid
|
||||
%{dracutlibdir}/modules.d/90dmsquash-live
|
||||
%{dracutlibdir}/modules.d/90kernel-modules
|
||||
%{dracutlibdir}/modules.d/90lvm
|
||||
%{dracutlibdir}/modules.d/90mdraid
|
||||
%{dracutlibdir}/modules.d/90multipath
|
||||
%{dracutlibdir}/modules.d/91crypt-gpg
|
||||
%{dracutlibdir}/modules.d/95debug
|
||||
%{dracutlibdir}/modules.d/95resume
|
||||
%{dracutlibdir}/modules.d/95rootfs-block
|
||||
%{dracutlibdir}/modules.d/95dasd
|
||||
%{dracutlibdir}/modules.d/95dasd_mod
|
||||
%{dracutlibdir}/modules.d/95fstab-sys
|
||||
%{dracutlibdir}/modules.d/95zfcp
|
||||
%{dracutlibdir}/modules.d/95terminfo
|
||||
%{dracutlibdir}/modules.d/95udev-rules
|
||||
%{dracutlibdir}/modules.d/96securityfs
|
||||
%{dracutlibdir}/modules.d/97biosdevname
|
||||
%{dracutlibdir}/modules.d/97masterkey
|
||||
%{dracutlibdir}/modules.d/98ecryptfs
|
||||
%{dracutlibdir}/modules.d/98integrity
|
||||
%{dracutlibdir}/modules.d/98selinux
|
||||
%{dracutlibdir}/modules.d/98syslog
|
||||
%{dracutlibdir}/modules.d/98usrmount
|
||||
%{dracutlibdir}/modules.d/99base
|
||||
%{dracutlibdir}/modules.d/99fs-lib
|
||||
%{dracutlibdir}/modules.d/99shutdown
|
||||
%config(noreplace) /etc/logrotate.d/dracut_log
|
||||
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
|
||||
%dir %{_sharedstatedir}/initramfs
|
||||
|
||||
%files network
|
||||
%defattr(-,root,root,0755)
|
||||
%{_datadir}/dracut/modules.d/40network
|
||||
%{_datadir}/dracut/modules.d/95fcoe
|
||||
%{_datadir}/dracut/modules.d/95iscsi
|
||||
%{_datadir}/dracut/modules.d/95nbd
|
||||
%{_datadir}/dracut/modules.d/95nfs
|
||||
%{_datadir}/dracut/modules.d/45ifcfg
|
||||
%{_datadir}/dracut/modules.d/95znet
|
||||
%{dracutlibdir}/modules.d/40network
|
||||
%{dracutlibdir}/modules.d/95fcoe
|
||||
%{dracutlibdir}/modules.d/95iscsi
|
||||
%{dracutlibdir}/modules.d/90livenet
|
||||
%{dracutlibdir}/modules.d/95nbd
|
||||
%{dracutlibdir}/modules.d/95nfs
|
||||
%{dracutlibdir}/modules.d/95ssh-client
|
||||
%{dracutlibdir}/modules.d/45ifcfg
|
||||
%{dracutlibdir}/modules.d/95znet
|
||||
|
||||
%if 0%{?fedora}
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
%files fips
|
||||
%defattr(-,root,root,0755)
|
||||
%{_datadir}/dracut/modules.d/01fips
|
||||
%{dracutlibdir}/modules.d/01fips
|
||||
%config(noreplace) /etc/dracut.conf.d/40-fips.conf
|
||||
%endif
|
||||
|
||||
%files fips-aesni
|
||||
%defattr(-,root,root,0755)
|
||||
%doc COPYING
|
||||
%{dracutlibdir}/modules.d/02fips-aesni
|
||||
|
||||
%files caps
|
||||
%defattr(-,root,root,0755)
|
||||
%{_datadir}/dracut/modules.d/02caps
|
||||
%{dracutlibdir}/modules.d/02caps
|
||||
|
||||
%files tools
|
||||
%defattr(-,root,root,0755)
|
||||
%{_mandir}/man8/dracut-gencmdline.8*
|
||||
%{_mandir}/man8/dracut-catimages.8*
|
||||
/sbin/dracut-gencmdline
|
||||
/sbin/dracut-catimages
|
||||
%{_bindir}/dracut-gencmdline
|
||||
%{_bindir}/dracut-catimages
|
||||
%dir /boot/dracut
|
||||
%dir /var/lib/dracut
|
||||
%dir /var/lib/dracut/overlay
|
||||
|
20
dracut.xml
20
dracut.xml
@@ -170,7 +170,7 @@ include ld.so.conf.d/*.conf</screen>
|
||||
<para>To see a list of available dracut modules, use the <option>--list-modules</option> option:</para>
|
||||
<screen># dracut --list-modules</screen>
|
||||
<para>or, if you have a dracut version earlier than <literal>008</literal>, issue the command:</para>
|
||||
<screen># for mod in /usr/share/dracut/modules.d/*; do echo ${mod##*/??}; done</screen>
|
||||
<screen># for mod in /usr/lib/dracut/modules.d/*; do echo ${mod##*/??}; done</screen>
|
||||
</section>
|
||||
<section>
|
||||
<title>Omitting dracut Modules</title>
|
||||
@@ -534,7 +534,7 @@ Key slot 0 unlocked. </screen></para>
|
||||
<title>Developer Manual</title>
|
||||
<section>
|
||||
<title>dracut Components</title>
|
||||
<para>dracut uses a modular system to build and extend the initramfs image. All modules are located in <filename>/usr/share/dracut/modules.d</filename> or in <filename><replaceable><git-src></replaceable>/modules.d</filename>. The most basic dracut module is <filename>99base</filename>. In <filename>99base</filename> the initial shell script <command>init</command> is defined, which gets run by the kernel after initramfs loading. Although you can replace <command>init</command> with your own version of <filename>99base</filename>, this is not encouraged. Instead you should use, if possible, the hooks of dracut. All hooks, and the point of time in which they are executed, are described in <xref linkend="stages"/>.</para>
|
||||
<para>dracut uses a modular system to build and extend the initramfs image. All modules are located in <filename>/usr/lib/dracut/modules.d</filename> or in <filename><replaceable><git-src></replaceable>/modules.d</filename>. The most basic dracut module is <filename>99base</filename>. In <filename>99base</filename> the initial shell script <command>init</command> is defined, which gets run by the kernel after initramfs loading. Although you can replace <command>init</command> with your own version of <filename>99base</filename>, this is not encouraged. Instead you should use, if possible, the hooks of dracut. All hooks, and the point of time in which they are executed, are described in <xref linkend="stages"/>.</para>
|
||||
<para>The main script, which creates the initramfs is <command>dracut</command> itsself. It parses all arguments and sets up the directory, in which everything is installed. It then executes all <command>check</command>, <command>install</command>, <command>installkernel</command> scripts found in the modules, which are to be processed. After everything is installed, the install directory is archived and compressed to the final initramfs image. All helper functions used by <command>check</command>, <command>install</command> and <command>installkernel</command> are found in in the file <filename>dracut-functions</filename>. These shell functions are available to all module installer (<command>install</command>, <command>installkernel</command>) scripts, without the need to source <filename>dracut-functions</filename>.</para>
|
||||
<para>A module can check the preconditions for <command>install</command> and <command>installkernel</command> with the <command>check</command> script. Also dependencies can be expressed with <command>check</command>. If a module passed <command>check</command>, <command>install</command> and <command>installkernel</command> will be called to install all of the necessary files for the module. To split between kernel and non-kernel parts of the installation, all kernel module related parts have to be in <command>installkernel</command>. All other files found in a module directory are module specific and mostly are hook scripts and udev rules.</para>
|
||||
</section>
|
||||
@@ -572,7 +572,7 @@ Common used functions are in <filename>dracut-lib.sh</filename>, which can be so
|
||||
</section>
|
||||
<section>
|
||||
<title>Main Loop</title>
|
||||
<para>Now the main loop of <command>99base/init</command> begins. Here we loop until <command>udev</command> has settled and all scripts in <filename>initqueue-finished</filename> returned true. In this loop there are three hooks, where scripts can be inserted by calling <command>/sbin/initqueue</command>.
|
||||
<para>Now the main loop of <command>99base/init</command> begins. Here we loop until <command>udev</command> has settled and all scripts in <filename>initqueue/finished</filename> returned true. In this loop there are three hooks, where scripts can be inserted by calling <command>/sbin/initqueue</command>.
|
||||
</para>
|
||||
<section>
|
||||
<title>Initqueue</title>
|
||||
@@ -582,6 +582,10 @@ Common used functions are in <filename>dracut-lib.sh</filename>, which can be so
|
||||
<title>Initqueue settled</title>
|
||||
<para>This hooks gets executed every time <command>udev</command> has settled.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Initqueue timeout</title>
|
||||
<para>This hooks gets executed, when the main loop counter becomes half of the rd.retry counter.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Initqueue finished</title>
|
||||
<para>This hook is called after <command>udev</command> has settled and if all scripts herein return <errorcode>0</errorcode> the main loop will be ended.</para>
|
||||
@@ -621,7 +625,7 @@ Common used functions are in <filename>dracut-lib.sh</filename>, which can be so
|
||||
<para><function>install()</function>:</para>
|
||||
<programlisting>inst_hook cmdline 20 "$moddir/parse-insmodpost.sh"
|
||||
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh</programlisting>
|
||||
<para>The <filename>pase-instmodpost.sh</filename> parses the kernel command line for a argument <envar>rd.driver.post</envar>, blacklists the module from being autoloaded and installs the hook <filename>insmodpost.sh</filename> in the <filename>initqueue-settled</filename>.</para>
|
||||
<para>The <filename>pase-instmodpost.sh</filename> parses the kernel command line for a argument <envar>rd.driver.post</envar>, blacklists the module from being autoloaded and installs the hook <filename>insmodpost.sh</filename> in the <filename>initqueue/settled</filename>.</para>
|
||||
<para><filename>parse-insmodpost.sh</filename>:</para>
|
||||
<programlisting>for p in $(getargs rd.driver.post=); do
|
||||
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
|
||||
@@ -631,7 +635,7 @@ done
|
||||
[ -n "$_do_insmodpost" ] && /sbin/initqueue --settled --unique --onetime /sbin/insmodpost.sh
|
||||
unset _do_insmodpost
|
||||
</programlisting>
|
||||
<para><filename>insmodpost.sh</filename>, which is called in the <filename>initqueue-settled</filename> hook will just modprobe the kernel modules specified in all <envar>rd.driver.post</envar> kernel command line parameters. It runs after <command>udev</command> has settled and is only called once (<parameter>--onetime</parameter>).</para>
|
||||
<para><filename>insmodpost.sh</filename>, which is called in the <filename>initqueue/settled</filename> hook will just modprobe the kernel modules specified in all <envar>rd.driver.post</envar> kernel command line parameters. It runs after <command>udev</command> has settled and is only called once (<parameter>--onetime</parameter>).</para>
|
||||
<para><filename>insmodpost.sh</filename>:</para>
|
||||
<programlisting>. /lib/dracut-lib.sh
|
||||
|
||||
@@ -717,9 +721,9 @@ done
|
||||
<title>dracut.conf</title>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dracut.conf.5.xml" encoding="UTF-8" parse="xml"/>
|
||||
</section>
|
||||
<section id="dracut.kernel">
|
||||
<title>dracut.kernel</title>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dracut.kernel.7.xml" encoding="UTF-8" parse="xml"/>
|
||||
<section id="dracut.cmdline">
|
||||
<title>dracut.cmdline</title>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dracut.cmdline.7.xml" encoding="UTF-8" parse="xml"/>
|
||||
</section>
|
||||
</appendix>
|
||||
</book>
|
||||
|
19
git2spec.pl
19
git2spec.pl
@@ -18,18 +18,21 @@ sub last_tag {
|
||||
|
||||
sub create_patches {
|
||||
my $tag=shift;
|
||||
my $pdir=shift;
|
||||
my $num=0;
|
||||
open( GIT, 'git format-patch -M -N --no-signature '.$tag.' |');
|
||||
open( GIT, 'git format-patch -N --no-signature -o "'.$pdir.'" '.$tag.' |');
|
||||
@lines=<GIT>;
|
||||
close GIT; # be done
|
||||
return @lines;
|
||||
};
|
||||
|
||||
use POSIX qw(strftime);
|
||||
my $datestr = strftime "%Y%m%d", gmtime;
|
||||
|
||||
my $tag=shift;
|
||||
my $pdir=shift;
|
||||
$tag=&last_tag if not defined $tag;
|
||||
my @patches=&create_patches($tag);
|
||||
my @patches=&create_patches($tag, $pdir);
|
||||
my $num=$#patches + 2;
|
||||
$tag=~s/[^0-9]+?([0-9]+)/$1/;
|
||||
my $release="$num.git$datestr";
|
||||
@@ -40,26 +43,18 @@ while(<>) {
|
||||
print "Version: $tag\n";
|
||||
}
|
||||
elsif (/^Release:/) {
|
||||
print "Release: $release\n";
|
||||
print "Release: $release%{?dist}\n";
|
||||
}
|
||||
elsif ((/^Source0:/) || (/^Source:/)) {
|
||||
print $_;
|
||||
$num=1;
|
||||
for(@patches) {
|
||||
s/.*\///g;
|
||||
print "Patch$num: $_";
|
||||
$num++;
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
elsif (/^%setup/) {
|
||||
print $_;
|
||||
$num=1;
|
||||
for(@patches) {
|
||||
print "%patch$num -p1\n";
|
||||
$num++;
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
else {
|
||||
print $_;
|
||||
}
|
||||
|
28
lsinitrd
28
lsinitrd
@@ -19,19 +19,33 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
[[ $# -le 2 ]] || { echo "Usage: $(basename $0) [<initramfs file> [<filename>]]" ; exit 1 ; }
|
||||
[[ $# -le 2 ]] || { echo "Usage: $(basename $0) [-s] [<initramfs file> [<filename>]]" ; exit 1 ; }
|
||||
|
||||
sorted=0
|
||||
while getopts "s" opt; do
|
||||
case $opt in
|
||||
s) sorted=1;;
|
||||
\?) exit 1;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
image="${1:-/boot/initramfs-$(uname -r).img}"
|
||||
[[ -f "$image" ]] || { echo "$image does not exist" ; exit 1 ; }
|
||||
|
||||
CAT=zcat
|
||||
FILE_T=$(file "$image")
|
||||
|
||||
if echo "test"|xz|xz -dc --single-stream; then
|
||||
XZ_SINGLE_STREAM="--single-stream"
|
||||
fi
|
||||
|
||||
if [[ "$FILE_T" =~ ": gzip compressed data" ]]; then
|
||||
CAT=zcat
|
||||
elif [[ "$FILE_T" =~ ": xz compressed data" ]]; then
|
||||
CAT=xzcat
|
||||
CAT="xzcat $XZ_SINGLE_STREAM"
|
||||
elif [[ "$FILE_T" =~ ": XZ compressed data" ]]; then
|
||||
CAT=xzcat
|
||||
CAT="xzcat $XZ_SINGLE_STREAM"
|
||||
elif [[ "$FILE_T" =~ ": data" ]]; then
|
||||
CAT=lzcat
|
||||
fi
|
||||
@@ -41,9 +55,13 @@ if [[ $# -eq 2 ]]; then
|
||||
exit $?
|
||||
fi
|
||||
|
||||
echo "$image:"
|
||||
echo "$image: $(du -h $image | awk '{print $1}')"
|
||||
echo "========================================================================"
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout 'lib/dracut/dracut-*' 2>/dev/null
|
||||
echo "========================================================================"
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list
|
||||
if [ "$sorted" -eq 1 ]; then
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
else
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list
|
||||
fi
|
||||
echo "========================================================================"
|
||||
|
@@ -8,6 +8,7 @@ usage () {
|
||||
|
||||
$cmd "usage: ${0##*/} [--version] [--help] [-v] [-f] [--preload <module>]"
|
||||
$cmd " [--image-version] [--with=<module>]"
|
||||
$cmd " [--nocompress]"
|
||||
$cmd " <initrd-image> <kernel-version>"
|
||||
$cmd ""
|
||||
$cmd " (ex: ${0##*/} /boot/initramfs-$kver.img $kver)"
|
||||
@@ -49,10 +50,10 @@ while (($# > 0)); do
|
||||
exit 0;;
|
||||
-v|--verbose) dracut_args="${dracut_args} -v";;
|
||||
-f|--force) dracut_args="${dracut_args} -f";;
|
||||
--preload) read_args modname "$@" || shift
|
||||
--preload) read_arg modname "$@" || shift
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--image-version) img_vers=yes;;
|
||||
--rootfs) read_args rootfs "$@" || shift
|
||||
--rootfs) read_arg rootfs "$@" || shift
|
||||
dracut_args="${dracut_args} --filesystems $rootfs";;
|
||||
--nocompress) dracut_args="$dracut_args --no-compress";;
|
||||
--help) usage -n;;
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
[ -x /sbin/bootchartd ] || return 1
|
||||
return 255
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ installkernel() {
|
||||
local _fipsmodules _mod
|
||||
_fipsmodules="aead aes_generici aes-xts aes-x86_64 ansi_cprng cbc ccm chainiv ctr"
|
||||
_fipsmodules+=" des deflate ecb eseqiv hmac seqiv sha256 sha512"
|
||||
_fipsmodules+=" cryptomgr crypto_null tcrypt"
|
||||
_fipsmodules+=" cryptomgr crypto_null tcrypt dm-mod dm-crypt"
|
||||
|
||||
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
|
||||
|
||||
|
@@ -2,7 +2,7 @@ This adds the following parameters:
|
||||
rd.caps=1
|
||||
turn the caps module on/off
|
||||
rd.caps.initdrop=cap_sys_module,cap_sys_rawio
|
||||
drop the specified comma seperated capabilities
|
||||
drop the specified comma separated capabilities
|
||||
rd.caps.disablemodules=1
|
||||
turn off module loading
|
||||
rd.caps.disablekexec=1
|
||||
|
30
modules.d/02fips-aesni/module-setup.sh
Executable file
30
modules.d/02fips-aesni/module-setup.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
local _fipsmodules _mod
|
||||
_fipsmodules="aesni-intel"
|
||||
|
||||
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
|
||||
|
||||
for _mod in $_fipsmodules; do
|
||||
if instmods $_mod; then
|
||||
echo $_mod >> "${initdir}/etc/fipsmodules"
|
||||
echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
install() {
|
||||
return 0
|
||||
}
|
||||
|
@@ -15,22 +15,22 @@ depends() {
|
||||
install() {
|
||||
local _i _progs _path
|
||||
inst busybox /usr/bin/busybox
|
||||
|
||||
# List of shell programs that we use in other official dracut modules, that
|
||||
# must be supported by the busybox installed on the host system
|
||||
_progs="echo grep usleep [ rmmod insmod mount uname umount setfont kbd_mode stty gzip bzip2 chvt readlink blkid dd losetup tr sed seq ps more cat rm free ping netstat vi ping6 fsck ip hostname basename mknod mkdir pidof sleep chroot ls cp mv dmesg mkfifo less ln modprobe"
|
||||
for _i in `/sbin/busybox | sed -ne '1,/Currently/!{s/,//g; s/busybox//g; p}'`
|
||||
do
|
||||
_progs="$_progs $_i"
|
||||
done
|
||||
|
||||
# FIXME: switch_root should be in the above list, but busybox version hangs
|
||||
# (using busybox-1.15.1-7.fc14.i686 at the time of writing)
|
||||
|
||||
for _i in $_progs; do
|
||||
_path=$(find_binary "$_i")
|
||||
_path=$(find_binary "$_i")
|
||||
[ -z "$_path" ] && continue
|
||||
if [[ $_path != ${_path#/usr} ]]; then
|
||||
ln -s ../../usr/bin/busybox "$initdir/$_path"
|
||||
ln -sf ../../usr/bin/busybox "$initdir/$_path"
|
||||
else
|
||||
ln -s ../usr/bin/busybox "$initdir/$_path"
|
||||
ln -sf ../usr/bin/busybox "$initdir/$_path"
|
||||
fi
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
|
@@ -47,6 +47,8 @@ The following variables are used by i18n install script and at initramfs
|
||||
runtime:
|
||||
|
||||
KEYMAP - keyboard translation table loaded by loadkeys
|
||||
KEYTABLE - base name for keyboard translation table; if UNICODE is
|
||||
true, Unicode version will be loaded. Overrides KEYMAP.
|
||||
EXT_KEYMAPS - list of extra keymaps to bo loaded (sep. by space)
|
||||
UNICODE - boolean, indicating UTF-8 mode
|
||||
FONT - console font
|
||||
|
@@ -22,6 +22,7 @@ set_terminal() {
|
||||
stty -F ${dev} iutf8
|
||||
else
|
||||
printf '\033%%@' >&7
|
||||
stty -F ${dev} -iutf8
|
||||
fi
|
||||
}
|
||||
|
||||
|
5
modules.d/10i18n/i18n-cleanup.sh
Executable file
5
modules.d/10i18n/i18n-cleanup.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
rm -fr /usr/lib/kbd
|
@@ -3,6 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -86,6 +87,7 @@ install() {
|
||||
inst ${moddir}/console_init /lib/udev/console_init
|
||||
inst_rules ${moddir}/10-console.rules
|
||||
inst_hook cmdline 20 "${moddir}/parse-i18n.sh"
|
||||
inst_hook cleanup 20 "${moddir}/i18n-cleanup.sh"
|
||||
}
|
||||
|
||||
install_all_kbd() {
|
||||
@@ -93,7 +95,7 @@ install() {
|
||||
|
||||
for f in $(eval find ${kbddir}/{${KBDSUBDIRS}} -type f -print)
|
||||
do
|
||||
inst $f
|
||||
inst_simple $f
|
||||
done
|
||||
|
||||
# remove unnecessary files
|
||||
@@ -110,8 +112,38 @@ install() {
|
||||
[ -f $I18N_CONF ] && . $I18N_CONF
|
||||
[ -f $VCONFIG_CONF ] && . $VCONFIG_CONF
|
||||
|
||||
shopt -q -s nocasematch
|
||||
if [[ ${UNICODE} ]]
|
||||
then
|
||||
if [[ ${UNICODE} = YES || ${UNICODE} = 1 ]]
|
||||
then
|
||||
UNICODE=1
|
||||
elif [[ ${UNICODE} = NO || ${UNICODE} = 0 ]]
|
||||
then
|
||||
UNICODE=0
|
||||
else
|
||||
UNICODE=''
|
||||
fi
|
||||
fi
|
||||
if [[ ! ${UNICODE} && ${LANG} =~ .*\.UTF-?8 ]]
|
||||
then
|
||||
UNICODE=1
|
||||
fi
|
||||
shopt -q -u nocasematch
|
||||
|
||||
# Gentoo user may have KEYMAP set to something like "-u pl2",
|
||||
KEYMAP=${KEYMAP#-* }
|
||||
|
||||
# KEYTABLE is a bit special - it defines base keymap name and UNICODE
|
||||
# determines whether non-UNICODE or UNICODE version is used
|
||||
|
||||
if [[ ${KEYTABLE} ]]; then
|
||||
if [[ ${UNICODE} == 1 ]]; then
|
||||
[[ ${KEYTABLE} =~ .*\.uni.* ]] || KEYTABLE=${KEYTABLE%.map*}.uni
|
||||
fi
|
||||
KEYMAP=${KEYTABLE}
|
||||
fi
|
||||
|
||||
# I'm not sure of the purpose of UNIKEYMAP and GRP_TOGGLE. They were in
|
||||
# original redhat-i18n module. Anyway it won't hurt.
|
||||
EXT_KEYMAPS+=\ ${UNIKEYMAP}\ ${GRP_TOGGLE}
|
||||
@@ -141,30 +173,13 @@ install() {
|
||||
if [[ ${FONT_MAP} ]]
|
||||
then
|
||||
FONT_MAP=${FONT_MAP%.trans}
|
||||
inst ${kbddir}/consoletrans/${FONT_MAP}.trans
|
||||
inst_simple ${kbddir}/consoletrans/${FONT_MAP}.trans
|
||||
fi
|
||||
|
||||
if [[ ${FONT_UNIMAP} ]]
|
||||
then
|
||||
FONT_UNIMAP=${FONT_UNIMAP%.uni}
|
||||
inst ${kbddir}/unimaps/${FONT_UNIMAP}.uni
|
||||
fi
|
||||
|
||||
if [[ ${UNICODE} ]]
|
||||
then
|
||||
if [[ ${UNICODE^^} = YES || ${UNICODE} = 1 ]]
|
||||
then
|
||||
UNICODE=1
|
||||
elif [[ ${UNICODE^^} = NO || ${UNICODE} = 0 ]]
|
||||
then
|
||||
UNICODE=0
|
||||
else
|
||||
UNICODE=''
|
||||
fi
|
||||
fi
|
||||
if [[ ! ${UNICODE} && ${LANG^^} =~ .*\.UTF-?8 ]]
|
||||
then
|
||||
UNICODE=1
|
||||
inst_simple ${kbddir}/unimaps/${FONT_UNIMAP}.uni
|
||||
fi
|
||||
|
||||
mksubdirs ${initdir}${I18N_CONF}
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
[ -f /etc/redhat-release ]
|
||||
}
|
||||
|
||||
|
176
modules.d/30convertfs/convertfs.sh
Executable file
176
modules.d/30convertfs/convertfs.sh
Executable file
@@ -0,0 +1,176 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
ROOT="$1"
|
||||
|
||||
if [[ ! -d "$ROOT" ]]; then
|
||||
echo "Usage: $0 <rootdir>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$ROOT" -ef / ]]; then
|
||||
echo "Can't convert the running system."
|
||||
echo "Please boot with 'rd.convertfs' on the kernel command line,"
|
||||
echo "to update with the help of the initramfs,"
|
||||
echo "or run this script from a rescue system."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while [[ "$ROOT" != "${ROOT%/}" ]]; do
|
||||
ROOT=${ROOT%/}
|
||||
done
|
||||
|
||||
if [ ! -L $ROOT/var/run ]; then
|
||||
echo "Converting /var/run to symlink"
|
||||
mv -f $ROOT/var/run $ROOT/var/run.runmove~
|
||||
ln -sfn ../run $ROOT/var/run
|
||||
fi
|
||||
|
||||
if [ ! -L $ROOT/var/lock ]; then
|
||||
echo "Converting /var/lock to symlink"
|
||||
mv -f $ROOT/var/lock $ROOT/var/lock.lockmove~
|
||||
ln -sfn ../run/lock $ROOT/var/lock
|
||||
fi
|
||||
|
||||
needconvert() {
|
||||
for dir in "$ROOT/bin" "$ROOT/sbin" "$ROOT/lib" "$ROOT/lib64"; do
|
||||
if [[ -e "$dir" ]]; then
|
||||
[[ -L "$dir" ]] || return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
if ! needconvert; then
|
||||
echo "Your system is already converted."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
testfile="$ROOT/.usrmovecheck$$"
|
||||
rm -f "$testfile"
|
||||
> "$testfile"
|
||||
if [[ ! -e "$testfile" ]]; then
|
||||
echo "Cannot write to $ROOT/"
|
||||
exit 1
|
||||
fi
|
||||
rm -f "$testfile"
|
||||
|
||||
testfile="$ROOT/usr/.usrmovecheck$$"
|
||||
rm -f "$testfile"
|
||||
> "$testfile"
|
||||
if [[ ! -e "$testfile" ]]; then
|
||||
echo "Cannot write to $ROOT/usr/"
|
||||
exit 1
|
||||
fi
|
||||
rm -f "$testfile"
|
||||
|
||||
ismounted() {
|
||||
while read a m a; do
|
||||
[[ "$m" = "$1" ]] && return 0
|
||||
done < /proc/mounts
|
||||
return 1
|
||||
}
|
||||
|
||||
# clean up after ourselves no matter how we die.
|
||||
cleanup() {
|
||||
echo "Something failed. Move back to the original state"
|
||||
for dir in "$ROOT/bin" "$ROOT/sbin" "$ROOT/lib" "$ROOT/lib64" \
|
||||
"$ROOT/usr/bin" "$ROOT/usr/sbin" "$ROOT/usr/lib" \
|
||||
"$ROOT/usr/lib64"; do
|
||||
[[ -d "${dir}.usrmove-new" ]] && rm -fr "${dir}.usrmove-new"
|
||||
if [[ -d "${dir}.usrmove-old" ]]; then
|
||||
mv "$dir" "${dir}.del~"
|
||||
mv "${dir}.usrmove-old" "$dir"
|
||||
rm -fr "${dir}.del~"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
trap 'ret=$?; [[ $ret -ne 0 ]] && cleanup;exit $ret;' EXIT
|
||||
trap 'exit 1;' SIGINT
|
||||
|
||||
ismounted "$ROOT/usr" || CP_HARDLINK="-l"
|
||||
|
||||
set -e
|
||||
|
||||
# merge / and /usr in new dir in /usr
|
||||
for dir in bin sbin lib lib64; do
|
||||
rm -rf "$ROOT/usr/${dir}.usrmove-new"
|
||||
[[ -L "$ROOT/$dir" ]] && continue
|
||||
[[ -d "$ROOT/$dir" ]] || continue
|
||||
echo "Make a copy of \`$ROOT/usr/$dir'."
|
||||
[[ -d "$ROOT/usr/$dir" ]] \
|
||||
&& cp -ax $CP_HARDLINK "$ROOT/usr/$dir" "$ROOT/usr/${dir}.usrmove-new"
|
||||
echo "Merge the copy with \`$ROOT/$dir'."
|
||||
[[ -d "$ROOT/usr/${dir}.usrmove-new" ]] \
|
||||
|| mkdir -p "$ROOT/usr/${dir}.usrmove-new"
|
||||
cp -axT $CP_HARDLINK --backup --suffix=.usrmove~ "$ROOT/$dir" "$ROOT/usr/${dir}.usrmove-new"
|
||||
echo "Clean up duplicates in \`$ROOT/usr/$dir'."
|
||||
# delete all symlinks that have been backed up
|
||||
find "$ROOT/usr/${dir}.usrmove-new" -type l -name '*.usrmove~' -delete || :
|
||||
# replace symlink with backed up binary
|
||||
find "$ROOT/usr/${dir}.usrmove-new" \
|
||||
-name '*.usrmove~' \
|
||||
-type f \
|
||||
-exec bash -c 'p="{}";o=${p%%%%.usrmove~};
|
||||
[[ -L "$o" ]] && mv -f "$p" "$o"' ';' || :
|
||||
done
|
||||
# switch over merged dirs in /usr
|
||||
for dir in bin sbin lib lib64; do
|
||||
[[ -d "$ROOT/usr/${dir}.usrmove-new" ]] || continue
|
||||
echo "Switch to new \`$ROOT/usr/$dir'."
|
||||
rm -fr "$ROOT/usr/${dir}.usrmove-old"
|
||||
mv "$ROOT/usr/$dir" "$ROOT/usr/${dir}.usrmove-old"
|
||||
mv "$ROOT/usr/${dir}.usrmove-new" "$ROOT/usr/$dir"
|
||||
done
|
||||
|
||||
# replace dirs in / with links to /usr
|
||||
for dir in bin sbin lib lib64; do
|
||||
[[ -L "$ROOT/$dir" ]] && continue
|
||||
[[ -d "$ROOT/$dir" ]] || continue
|
||||
echo "Create \`$ROOT/$dir' symlink."
|
||||
rm -rf "$ROOT/${dir}.usrmove-old" || :
|
||||
mv "$ROOT/$dir" "$ROOT/${dir}.usrmove-old"
|
||||
ln -sfn usr/$dir "$ROOT/$dir"
|
||||
done
|
||||
|
||||
echo "Clean up backup files."
|
||||
# everything seems to work; cleanup
|
||||
for dir in bin sbin lib lib64; do
|
||||
# if we get killed in the middle of "rm -rf", ensure not to leave
|
||||
# an incomplete directory, which is moved back by cleanup()
|
||||
[[ -d "$ROOT/usr/${dir}.usrmove-old" ]] \
|
||||
&& mv "$ROOT/usr/${dir}.usrmove-old" "$ROOT/usr/${dir}.usrmove-old~"
|
||||
[[ -d "$ROOT/${dir}.usrmove-old" ]] \
|
||||
&& mv "$ROOT/${dir}.usrmove-old" "$ROOT/${dir}.usrmove-old~"
|
||||
done
|
||||
|
||||
for dir in bin sbin lib lib64; do
|
||||
[[ -d "$ROOT/usr/${dir}.usrmove-old~" ]] \
|
||||
&& rm -rf "$ROOT/usr/${dir}.usrmove-old~" || :
|
||||
[[ -d "$ROOT/${dir}.usrmove-old~" ]] \
|
||||
&& rm -rf "$ROOT/${dir}.usrmove-old~" || :
|
||||
done
|
||||
|
||||
for dir in lib lib64; do
|
||||
[[ -d "$ROOT/$dir" ]] || continue
|
||||
for lib in "$ROOT"/usr/${dir}/lib*.so*.usrmove~; do
|
||||
[[ -f $lib ]] || continue
|
||||
mv $lib ${lib/.so/_so}
|
||||
done
|
||||
done
|
||||
|
||||
set +e
|
||||
|
||||
echo "Run ldconfig."
|
||||
ldconfig -r "$ROOT"
|
||||
|
||||
. $ROOT/etc/selinux/config
|
||||
if [ -n "$(command -v setfiles)" ] && [ "$SELINUX" != "disabled" ] && [ -f /etc/selinux/${SELINUXTYPE}/contexts/files/file_contexts ]; then
|
||||
echo "Fixing SELinux labels"
|
||||
setfiles -r $ROOT -p /etc/selinux/${SELINUXTYPE}/contexts/files/file_contexts $ROOT/sbin $ROOT/bin $ROOT/lib $ROOT/lib64 $ROOT/usr/lib $ROOT/usr/lib64 $ROOT/etc/ld.so.cache $ROOT/var/cache/ldconfig || :
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
exit 0
|
11
modules.d/30convertfs/do-convertfs.sh
Executable file
11
modules.d/30convertfs/do-convertfs.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if getargbool 0 rd.convertfs; then
|
||||
if getargbool 0 rd.debug; then
|
||||
bash -x convertfs "$NEWROOT" 2>&1 | vinfo
|
||||
else
|
||||
convertfs "$NEWROOT" 2>&1 | vinfo
|
||||
fi
|
||||
fi
|
20
modules.d/30convertfs/module-setup.sh
Executable file
20
modules.d/30convertfs/module-setup.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
[[ $mount_needs ]] && return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install bash
|
||||
dracut_install find ldconfig mv rm cp ln
|
||||
inst_hook pre-pivot 99 "$moddir/do-convertfs.sh"
|
||||
inst "$moddir/convertfs.sh" /usr/bin/convertfs
|
||||
}
|
||||
|
@@ -41,7 +41,9 @@ setup_interface() {
|
||||
done
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
|
||||
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
# 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
|
||||
}
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
@@ -74,7 +76,13 @@ case $reason in
|
||||
echo "$line"
|
||||
done >/tmp/dhclient.$netif.dhcpopts
|
||||
echo online > /sys/class/net/$netif/uevent
|
||||
initqueue --onetime --name netroot-$netif netroot $netif
|
||||
|
||||
if [ -e /tmp/net.$netif.manualup ]; then
|
||||
/sbin/netroot $netif -m
|
||||
rm -f /tmp/net.$netif.manualup
|
||||
else
|
||||
initqueue --onetime --name netroot-$netif netroot $netif
|
||||
fi
|
||||
;;
|
||||
*) echo "dhcp: $reason";;
|
||||
esac
|
||||
|
@@ -5,9 +5,54 @@
|
||||
# We don't need to check for ip= errors here, that is handled by the
|
||||
# cmdline parser script
|
||||
#
|
||||
# without $2 means this is for real netroot case
|
||||
# or it is for manually bring up network ie. for kdump scp vmcore
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
export PS4="ifup.$1.$$ + "
|
||||
exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
# Huh? No $1?
|
||||
[ -z "$1" ] && exit 1
|
||||
|
||||
# $netif reads easier than $1
|
||||
netif=$1
|
||||
|
||||
# enslave this interface to bond?
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
for slave in $bondslaves ; do
|
||||
if [ "$netif" = "$slave" ] ; then
|
||||
netif=$bondname
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# bridge this interface?
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
if [ "$netif" = "$ethname" ]; then
|
||||
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
|
||||
: # We need to really setup bond (recursive call)
|
||||
else
|
||||
netif="$bridgename"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# bail immediately if the interface is already up
|
||||
# or we don't need the network
|
||||
[ -f "/tmp/net.$netif.up" ] && exit 0
|
||||
[ -f "/tmp/root.info" ] || exit 0
|
||||
. /tmp/root.info
|
||||
|
||||
# disable manual ifup while netroot is set for simplifying our logic
|
||||
# in netroot case we prefer netroot to bringup $netif automaticlly
|
||||
[ -n "$2" ] && [ -z "$netroot" ] && manualup="$2"
|
||||
[ -z "$netroot" ] && [ -z "$manualup" ] && exit 0
|
||||
[ -n "$manualup" ] && >/tmp/net.$netif.manualup
|
||||
|
||||
# Run dhclient
|
||||
do_dhcp() {
|
||||
@@ -50,7 +95,11 @@ do_ipv6auto() {
|
||||
|
||||
|
||||
echo online > /sys/class/net/$netif/uevent
|
||||
initqueue --onetime --name netroot-$netif netroot $netif
|
||||
if [ -n "$manualup" ]; then
|
||||
/sbin/netroot $netif -m
|
||||
else
|
||||
initqueue --onetime --name netroot-$netif netroot $netif
|
||||
fi
|
||||
}
|
||||
|
||||
# Handle static ip configuration
|
||||
@@ -63,7 +112,7 @@ do_static() {
|
||||
# do not flush addr for ipv6
|
||||
strstr $ip '*:*:*' || \
|
||||
echo ip addr flush dev $netif
|
||||
echo ip addr add $ip/$mask dev $netif
|
||||
echo ip addr add $ip/$mask brd + dev $netif
|
||||
} > /tmp/net.$netif.up
|
||||
|
||||
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
@@ -77,47 +126,12 @@ do_static() {
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
|
||||
echo online > /sys/class/net/$netif/uevent
|
||||
initqueue --onetime --name netroot-$netif netroot $netif
|
||||
}
|
||||
|
||||
export PS4="ifup.$1.$$ + "
|
||||
exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
# Huh? No $1?
|
||||
[ -z "$1" ] && exit 1
|
||||
|
||||
# $netif reads easier than $1
|
||||
netif=$1
|
||||
|
||||
# enslave this interface to bond?
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
for slave in $bondslaves ; do
|
||||
if [ "$netif" = "$slave" ] ; then
|
||||
netif=$bondname
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# bridge this interface?
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
if [ "$netif" = "$ethname" ]; then
|
||||
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
|
||||
: # We need to really setup bond (recursive call)
|
||||
else
|
||||
netif="$bridgename"
|
||||
fi
|
||||
if [ -n "$manualup" ]; then
|
||||
/sbin/netroot $netif -m
|
||||
else
|
||||
initqueue --onetime --name netroot-$netif netroot $netif
|
||||
fi
|
||||
fi
|
||||
|
||||
# bail immediately if the interface is already up
|
||||
# or we don't need the network
|
||||
[ -f "/tmp/net.$netif.up" ] && exit 0
|
||||
[ -f "/tmp/root.info" ] || exit 0
|
||||
. /tmp/root.info
|
||||
[ -z "$netroot" ] && exit 0
|
||||
}
|
||||
|
||||
# loopback is always handled the same way
|
||||
if [ "$netif" = "lo" ] ; then
|
||||
@@ -228,5 +242,4 @@ for p in $(getargs ip=); do
|
||||
esac
|
||||
break
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
@@ -24,15 +24,42 @@ depends() {
|
||||
installkernel() {
|
||||
# Include wired net drivers, excluding wireless
|
||||
|
||||
net_module_test() {
|
||||
net_module_filter() {
|
||||
local _net_drivers='eth_type_trans|register_virtio_device'
|
||||
local _unwanted_drivers='/(wireless|isdn|uwb)/'
|
||||
egrep -q $_net_drivers "$1" && \
|
||||
egrep -qv 'iw_handler_get_spy' "$1" && \
|
||||
[[ ! $1 =~ $_unwanted_drivers ]]
|
||||
# subfunctions inherit following FDs
|
||||
local _merge=8 _side2=9
|
||||
function nmf1() {
|
||||
local _fname _fcont
|
||||
while read _fname; do
|
||||
[[ $_fname =~ $_unwanted_drivers ]] && continue
|
||||
case "$_fname" in
|
||||
*.ko) _fcont="$(< $_fname)" ;;
|
||||
*.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
|
||||
*.ko.xz) _fcont="$(xz -dc $_fname)" ;;
|
||||
esac
|
||||
[[ $_fcont =~ $_net_drivers
|
||||
&& ! $_fcont =~ iw_handler_get_spy ]] \
|
||||
&& echo "$_fname"
|
||||
done
|
||||
}
|
||||
function rotor() {
|
||||
local _f1 _f2
|
||||
while read _f1; do
|
||||
echo "$_f1"
|
||||
if read _f2; then
|
||||
echo "$_f2" 1>&${_side2}
|
||||
fi
|
||||
done | nmf1 1>&${_merge}
|
||||
}
|
||||
# Use two parallel streams to filter alternating modules.
|
||||
set +x
|
||||
eval "( ( rotor ) ${_side2}>&1 | nmf1 ) ${_merge}>&1"
|
||||
[[ $debug ]] && set -x
|
||||
}
|
||||
|
||||
instmods $(filter_kernel_modules net_module_test)
|
||||
{ find_kernel_modules_by_path drivers/net; find_kernel_modules_by_path drivers/s390/net; } \
|
||||
| net_module_filter | instmods
|
||||
|
||||
instmods ecb arc4
|
||||
# bridge modules
|
||||
@@ -49,7 +76,7 @@ install() {
|
||||
inst "$moddir/ifup" "/sbin/ifup"
|
||||
inst "$moddir/netroot" "/sbin/netroot"
|
||||
inst "$moddir/dhclient-script" "/sbin/dhclient-script"
|
||||
inst "$moddir/dhclient.conf" "/etc/dhclient.conf"
|
||||
inst_simple "$moddir/dhclient.conf" "/etc/dhclient.conf"
|
||||
inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"
|
||||
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
|
||||
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
|
||||
|
@@ -14,7 +14,7 @@ fix_bootif() {
|
||||
}
|
||||
|
||||
# Don't continue if we don't need network
|
||||
[ -z "$netroot" ] && return;
|
||||
[ -z "$netroot" ] && ! getargbool 0 rd.neednet && return;
|
||||
|
||||
# Write udev rules
|
||||
{
|
||||
@@ -35,17 +35,29 @@ fix_bootif() {
|
||||
BOOTIF=$(getarg 'BOOTIF=')
|
||||
if [ -n "$BOOTIF" ] ; then
|
||||
BOOTIF=$(fix_bootif "$BOOTIF")
|
||||
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$BOOTIF"
|
||||
if [ -n "$netroot" ]; then
|
||||
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", OPTIONS+="event_timeout=360", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$BOOTIF"
|
||||
else
|
||||
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", OPTIONS+="event_timeout=360", RUN+="/sbin/ifup $env{INTERFACE} -m"\n' "$BOOTIF"
|
||||
fi
|
||||
|
||||
# If we have to handle multiple interfaces, handle only them.
|
||||
elif [ -n "$IFACES" ] ; then
|
||||
for iface in $IFACES ; do
|
||||
printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$iface"
|
||||
if [ -n "$netroot" ]; then
|
||||
printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", OPTIONS+="event_timeout=360", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$iface"
|
||||
else
|
||||
printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", OPTIONS+="event_timeout=360", RUN+="/sbin/ifup $env{INTERFACE} -m"\n' "$iface"
|
||||
fi
|
||||
done
|
||||
|
||||
# Default: We don't know the interface to use, handle all
|
||||
else
|
||||
printf 'SUBSYSTEM=="net", RUN+="/sbin/ifup $env{INTERFACE}"\n'
|
||||
if [ -n "$netroot" ]; then
|
||||
printf 'SUBSYSTEM=="net", OPTIONS+="event_timeout=360", RUN+="/sbin/ifup $env{INTERFACE}"\n'
|
||||
else
|
||||
printf 'SUBSYSTEM=="net", OPTIONS+="event_timeout=360", RUN+="/sbin/ifup $env{INTERFACE} -m"\n'
|
||||
fi
|
||||
fi
|
||||
|
||||
} > /etc/udev/rules.d/60-net.rules
|
||||
|
@@ -3,7 +3,6 @@
|
||||
# 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
|
||||
|
||||
# Huh? Empty $1?
|
||||
@@ -12,12 +11,16 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
# Huh? No interface config?
|
||||
[ ! -e /tmp/net.$1.up ] && exit 1
|
||||
|
||||
# There's no sense in doing something if no (net)root info is available
|
||||
# [ ! -z $2 ] means this is for manually bringing up network
|
||||
# instead of real netroot; If It's called without $2, then there's
|
||||
# no sense in doing something if no (net)root info is available
|
||||
# or root is already there
|
||||
[ -e /tmp/root.info ] || exit 1
|
||||
. /tmp/root.info
|
||||
[ -d $NEWROOT/proc ] && exit 0
|
||||
[ -z "$netroot" ] && exit 1
|
||||
if [ -z "$2" ]; then
|
||||
[ -d $NEWROOT/proc ] && exit 0
|
||||
[ -z "$netroot" ] && exit 1
|
||||
fi
|
||||
|
||||
# Let's see if we have to wait for other interfaces
|
||||
# Note: exit works just fine, since the last interface to be
|
||||
@@ -31,43 +34,49 @@ done
|
||||
netif=$1
|
||||
[ -e "/tmp/net.bootdev" ] && read netif < /tmp/net.bootdev
|
||||
|
||||
# Figure out the handler for root=dhcp by recalling all netroot cmdline
|
||||
# handlers
|
||||
if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then
|
||||
# Unset root so we can check later
|
||||
unset root
|
||||
|
||||
# Load dhcp options
|
||||
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
|
||||
|
||||
# If we have a specific bootdev with no dhcpoptions or empty root-path,
|
||||
# we die. Otherwise we just warn
|
||||
if [ -z "$new_root_path" ] ; then
|
||||
[ -n "$BOOTDEV" ] && die "No dhcp root-path received for '$BOOTDEV'"
|
||||
warn "No dhcp root-path received for '$BOOTDEV' trying other interfaces if available"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set netroot to new_root_path, so cmdline parsers don't call
|
||||
netroot=$new_root_path
|
||||
|
||||
# FIXME!
|
||||
for f in $hookdir/cmdline/90*.sh; do
|
||||
[ -f "$f" ] && . "$f";
|
||||
done
|
||||
else
|
||||
rootok="1"
|
||||
if [ -e /tmp/net.$netif.manualup ]; then
|
||||
rm -f /tmp/net.$netif.manualup
|
||||
fi
|
||||
|
||||
# Check: do we really know how to handle (net)root?
|
||||
[ -z "$root" ] && die "No or empty root= argument"
|
||||
[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"
|
||||
# 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
|
||||
# Unset root so we can check later
|
||||
unset root
|
||||
|
||||
handler=${netroot%%:*}
|
||||
handler=${handler%%4}
|
||||
handler=$(command -v ${handler}root)
|
||||
if [ -z "$netroot" ] || [ ! -e "$handler" ] ; then
|
||||
die "No handler for netroot type '$netroot'"
|
||||
# Load dhcp options
|
||||
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
|
||||
|
||||
# If we have a specific bootdev with no dhcpoptions or empty root-path,
|
||||
# we die. Otherwise we just warn
|
||||
if [ -z "$new_root_path" ] ; then
|
||||
[ -n "$BOOTDEV" ] && die "No dhcp root-path received for '$BOOTDEV'"
|
||||
warn "No dhcp root-path received for '$BOOTDEV' trying other interfaces if available"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set netroot to new_root_path, so cmdline parsers don't call
|
||||
netroot=$new_root_path
|
||||
|
||||
# FIXME!
|
||||
for f in $hookdir/cmdline/90*.sh; do
|
||||
[ -f "$f" ] && . "$f";
|
||||
done
|
||||
else
|
||||
rootok="1"
|
||||
fi
|
||||
|
||||
# Check: do we really know how to handle (net)root?
|
||||
[ -z "$root" ] && die "No or empty root= argument"
|
||||
[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"
|
||||
|
||||
handler=${netroot%%:*}
|
||||
handler=${handler%%4}
|
||||
handler=$(command -v ${handler}root)
|
||||
if [ -z "$netroot" ] || [ ! -e "$handler" ] ; then
|
||||
die "No handler for netroot type '$netroot'"
|
||||
fi
|
||||
fi
|
||||
|
||||
# We're here, so we can assume that upping interfaces is now ok
|
||||
@@ -119,11 +128,14 @@ if [ -n "$netroot_ip" ]; then
|
||||
fi
|
||||
fi
|
||||
if [ -n "$dest" ] && ! arping -q -f -w 60 -I $netif $dest ; then
|
||||
die "Resolving $dest via ARP on $netif failed"
|
||||
dinfo "Resolving $dest via ARP on $netif failed"
|
||||
fi
|
||||
|
||||
# exit in case manually bring up network
|
||||
[ -n "$2" ] && exit 0
|
||||
|
||||
# Source netroot hooks before we start the handler
|
||||
source_all netroot
|
||||
source_all $hookdir/netroot
|
||||
|
||||
# Run the handler; don't store the root, it may change from device to device
|
||||
# XXX other variables to export?
|
||||
|
@@ -18,6 +18,7 @@ if getarg bond= >/dev/null ; then
|
||||
if [ -z "$netroot" ] ; then
|
||||
die "No netboot configured, bond is invalid"
|
||||
fi
|
||||
command -v brctl >/dev/null 2>&1 || die "No 'brctl' installed"
|
||||
fi
|
||||
|
||||
# We translate list of slaves to space-separated here to mwke it easier to loop over them in ifup
|
||||
|
@@ -16,6 +16,7 @@ if getarg bridge= >/dev/null ; then
|
||||
if [ -z "$netroot" ] ; then
|
||||
die "No netboot configured, bridge is invalid"
|
||||
fi
|
||||
command -v brctl >/dev/null 2>&1 || die "No 'brctl' installed"
|
||||
fi
|
||||
|
||||
parsebridge() {
|
||||
@@ -46,11 +47,10 @@ if [ -e /tmp/bond.info ]; then
|
||||
fi
|
||||
|
||||
# Parse bridge for bridgename and ethname
|
||||
if getarg bridge >/dev/null; then
|
||||
if bridge="$(getarg bridge)"; then
|
||||
# Read bridge= parameters if they exist
|
||||
bridge="$(getarg bridge=)"
|
||||
if [ ! "$bridge" = "bridge" ]; then
|
||||
parsebridge "$(getarg bridge=)"
|
||||
if [ -n "$bridge" ]; then
|
||||
parsebridge $bridge
|
||||
fi
|
||||
# Simple default bridge
|
||||
if [ -z "$bridgename" ]; then
|
||||
|
@@ -25,7 +25,8 @@ parse_ifname_opts() {
|
||||
case $# in
|
||||
7)
|
||||
ifname_if=$1
|
||||
ifname_mac=$2:$3:$4:$5:$6:$7
|
||||
# udev requires MAC addresses to be lower case
|
||||
ifname_mac=`echo $2:$3:$4:$5:$6:$7 | tr '[:upper:]' '[:lower:]'`
|
||||
;;
|
||||
*)
|
||||
die "Invalid arguments for ifname="
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# ip=<interface>:[dhcp|on|any]
|
||||
#
|
||||
# ip=<client-IP-number>:<server-id>:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:[dhcp|on|any|none|off]
|
||||
# ip=<client-IP-number>:<server-IP-number>:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:[dhcp|on|any|none|off]
|
||||
#
|
||||
# When supplying more than only ip= line, <interface> is mandatory and
|
||||
# bootdev= must contain the name of the primary interface to use for
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
[[ -x /sbin/plymouthd && -x /bin/plymouth && -x /usr/sbin/plymouth-set-default-theme ]]
|
||||
}
|
||||
|
||||
@@ -13,8 +14,23 @@ depends() {
|
||||
installkernel() {
|
||||
local _modname
|
||||
# Include KMS capable drm drivers
|
||||
for _modname in $(find "$srcmods/kernel/drivers/gpu/drm" "$srcmods/extra" -name '*.ko' 2>/dev/null); do
|
||||
grep -q drm_crtc_init $_modname && instmods $_modname
|
||||
for _modname in $(find "$srcmods/kernel/drivers/gpu/drm" "$srcmods/extra" \( -name '*.ko' -o -name '*.ko.gz' -o -name '*.ko.xz' \) 2>/dev/null); do
|
||||
case $_modname in
|
||||
*.ko) grep -q drm_crtc_init $_modname ;;
|
||||
*.ko.gz) zgrep -q drm_crtc_init $_modname ;;
|
||||
*.ko.xz) xzgrep -q drm_crtc_init $_modname ;;
|
||||
esac
|
||||
if test $? -eq 0; then
|
||||
# if the hardware is present, include module even if it is not currently loaded,
|
||||
# as we could e.g. be in the installer; nokmsboot boot parameter will disable
|
||||
# loading of the driver if needed
|
||||
if [[ $hostonly ]] && modinfo -F alias $_modname | sed -e 's,\?,\.,g' -e 's,\*,\.\*,g' \
|
||||
| grep -qxf - /sys/bus/pci/devices/*/modalias; then
|
||||
hostonly='' instmods $_modname
|
||||
continue
|
||||
fi
|
||||
instmods $_modname
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@@ -30,6 +46,7 @@ install() {
|
||||
|
||||
inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
|
||||
inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh
|
||||
inst_hook cleanup 10 "$moddir"/plymouth-cleanup.sh
|
||||
inst_hook emergency 50 "$moddir"/plymouth-emergency.sh
|
||||
inst readlink
|
||||
}
|
||||
|
5
modules.d/50plymouth/plymouth-cleanup.sh
Executable file
5
modules.d/50plymouth/plymouth-cleanup.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
rm -fr /usr/share/plymouth /usr/lib/plymouth /usr/lib64/plymouth /usr/share/pixmaps
|
@@ -2,7 +2,7 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if getargbool 1 rd.plymouth -n rd_NO_PLYMOUTH; then
|
||||
if getargbool 1 plymouth.enable && getargbool 1 rd.plymouth -n rd_NO_PLYMOUTH; then
|
||||
[ -c /dev/null ] || mknod -m 0666 /dev/null c 1 3
|
||||
# first trigger graphics subsystem
|
||||
udevadm trigger --action=add --attr-match=class=0x030000 >/dev/null 2>&1
|
||||
@@ -18,7 +18,9 @@ if getargbool 1 rd.plymouth -n rd_NO_PLYMOUTH; then
|
||||
|
||||
info "Starting plymouth daemon"
|
||||
mkdir -m 0755 /run/plymouth
|
||||
[ -x /lib/udev/console_init ] && /lib/udev/console_init /dev/tty0
|
||||
consoledev=$(getarg console= | sed -e 's/,.*//')
|
||||
consoledev=${consoledev:-tty0}
|
||||
[ -x /lib/udev/console_init ] && /lib/udev/console_init "/dev/$consoledev"
|
||||
[ -x /bin/plymouthd ] && /bin/plymouthd --attach-to-session --pid-file /run/plymouth/pid
|
||||
/bin/plymouth --show-splash 2>&1 | vinfo
|
||||
# reset tty after plymouth messed with it
|
||||
|
@@ -1,42 +0,0 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
# No Xen-detect? Boo!!
|
||||
if ! hash xen-detect 2>/dev/null; then
|
||||
[[ -d /usr/lib/xen-default ]] && \
|
||||
hash -p /usr/lib/xen-default/bin/xen-detect xen-detect || return 1
|
||||
fi
|
||||
|
||||
. $dracutfunctions
|
||||
[[ $debug ]] && set -x
|
||||
|
||||
# Yes, we are under Xen PV env.
|
||||
xen-detect | grep -q -v PV || return 0
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
local _i
|
||||
for _i in \
|
||||
xenbus_probe_frontend xen-pcifront \
|
||||
xen-fbfront xen-kbdfront xen-blkfront xen-netfront \
|
||||
; do
|
||||
modinfo -k $kernel $_i >/dev/null 2>&1 && instmods $_i
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
install() {
|
||||
hash xen-detect 2>/dev/null || \
|
||||
hash -p /usr/lib/xen-default/bin/xen-detect xen-detect
|
||||
inst "$(hash -t xen-detect)" /sbin/xen-detect
|
||||
inst_hook pre-udev 40 "$moddir/xen-pre-udev.sh"
|
||||
}
|
||||
|
@@ -1,13 +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
|
||||
xen-detect
|
||||
RC=$?
|
||||
if [ "$RC" = "1" ] ; then
|
||||
modprobe xenbus_probe_frontend
|
||||
modprobe xen-kbdfront
|
||||
modprobe xen-fbfront
|
||||
modprobe xen-blkfront
|
||||
modprobe xen-netfront
|
||||
modprobe xen-pcifront
|
||||
fi
|
@@ -1,8 +1,11 @@
|
||||
SUBSYSTEM!="block", GOTO="btrfs_end"
|
||||
ACTION!="add|change", GOTO="btrfs_end"
|
||||
ENV{ID_FS_TYPE}!="btrfs", GOTO="btrfs_end"
|
||||
RUN+="/sbin/modprobe btrfs"
|
||||
RUN+="/sbin/btrfs device scan $env{DEVNAME}"
|
||||
|
||||
ENV{ID_FS_TYPE}=="btrfs", RUN+="/sbin/modprobe btrfs"
|
||||
ENV{ID_FS_TYPE}=="btrfs", RUN+="/sbin/btrfs device scan $env{DEVNAME}"
|
||||
RUN+="/sbin/initqueue --finished --unique --name btrfs_finished /sbin/btrfs_finished"
|
||||
RUN+="/sbin/initqueue --timeout --onetime --unique --name btrfs_timeout /sbin/btrfs_timeout"
|
||||
|
||||
LABEL="btrfs_end"
|
||||
|
||||
|
24
modules.d/90btrfs/btrfs_finished.sh
Executable file
24
modules.d/90btrfs/btrfs_finished.sh
Executable file
@@ -0,0 +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
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
btrfs_check_complete() {
|
||||
local _rootinfo _dev
|
||||
_dev="${1:-/dev/root}"
|
||||
[ -e "$_dev" ] || return 0
|
||||
_rootinfo=$(udevadm info --query=env "--name=$_dev" 2>/dev/null)
|
||||
if strstr "$_rootinfo" "ID_FS_TYPE=btrfs"; then
|
||||
info "Checking, if btrfs device complete"
|
||||
unset __btrfs_mount
|
||||
mount -o ro "$_dev" /tmp >/dev/null 2>&1
|
||||
__btrfs_mount=$?
|
||||
[ $__btrfs_mount -eq 0 ] && umount "$_dev" >/dev/null 2>&1
|
||||
return $__btrfs_mount
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
btrfs_check_complete $1
|
||||
exit $?
|
@@ -1,7 +1,9 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
info "Autoassembling MD Raid"
|
||||
mdadm -As --auto=yes --run 2>&1 | vinfo
|
||||
info "Scanning for all btrfs devices"
|
||||
/sbin/btrfs device scan 2>&1 | vinfo
|
||||
exit 0
|
@@ -11,14 +11,14 @@ check() {
|
||||
. $dracutfunctions
|
||||
[[ $debug ]] && set -x
|
||||
|
||||
is_btrfs() { get_fs_type /dev/block/$1 | grep -q btrfs; }
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
_rootdev=$(find_root_block_device)
|
||||
if [[ $_rootdev ]]; then
|
||||
is_btrfs "$_rootdev" || return 1
|
||||
fi
|
||||
fi
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
local _found
|
||||
for fs in ${host_fs_types[@]}; do
|
||||
strstr "$fs" "\|btrfs" && _found="1"
|
||||
done
|
||||
[[ $_found ]] || return 1
|
||||
unset _found
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -29,11 +29,13 @@ depends() {
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods btrfs
|
||||
instmods btrfs crc32c
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_rules "$moddir/80-btrfs.rules"
|
||||
dracut_install btrfs
|
||||
inst "$moddir/btrfs_finished.sh" /sbin/btrfs_finished
|
||||
inst "$moddir/btrfs_timeout.sh" /sbin/btrfs_timeout
|
||||
dracut_install btrfs btrfsck
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# close everything which is not busy
|
||||
rm -f /etc/udev/rules.d/70-luks.rules >/dev/null 2>&1
|
||||
|
||||
if ! getarg rd.luks.uuid rd_LUKS_UUID && getargbool 1 rd.luks -n rd_NO_LUKS; then
|
||||
if ! getarg rd.luks.uuid rd_LUKS_UUID >/dev/null 2>&1 && getargbool 1 rd.luks -n rd_NO_LUKS >/dev/null 2>&1; then
|
||||
while true; do
|
||||
local do_break="y"
|
||||
for i in /dev/mapper/luks-*; do
|
||||
|
39
modules.d/90crypt/crypt-lib.sh
Normal file → Executable file
39
modules.d/90crypt/crypt-lib.sh
Normal file → Executable file
@@ -47,7 +47,7 @@ ask_for_password() {
|
||||
|
||||
{ flock -s 9;
|
||||
# Prompt for password with plymouth, if installed and running.
|
||||
if [ -x /bin/plymouth ]; then
|
||||
if [ -x /bin/plymouth ] && /bin/plymouth --ping; then
|
||||
/bin/plymouth ask-for-password \
|
||||
--prompt "$ply_prompt" --number-of-tries=$ply_tries \
|
||||
--command="$ply_cmd"
|
||||
@@ -100,43 +100,6 @@ test_dev() {
|
||||
return $ret
|
||||
}
|
||||
|
||||
# Get kernel name for given device. Device may be the name too (then the same
|
||||
# is returned), a symlink (full path), UUID (prefixed with "UUID=") or label
|
||||
# (prefixed with "LABEL="). If just a beginning of the UUID is specified or
|
||||
# even an empty, function prints all device names which UUIDs match - every in
|
||||
# single line.
|
||||
#
|
||||
# NOTICE: The name starts with "/dev/".
|
||||
#
|
||||
# Example:
|
||||
# devnames UUID=123
|
||||
# May print:
|
||||
# /dev/dm-1
|
||||
# /dev/sdb1
|
||||
# /dev/sdf3
|
||||
devnames() {
|
||||
local dev="$1"; local d; local names
|
||||
|
||||
case "$dev" in
|
||||
UUID=*)
|
||||
dev="$(foreach_uuid_until '! blkid -U $___' "${dev#UUID=}")" \
|
||||
&& return 255
|
||||
[ -z "$dev" ] && return 255
|
||||
;;
|
||||
LABEL=*) dev="$(blkid -L "${dev#LABEL=}")" || return 255 ;;
|
||||
/dev/?*) ;;
|
||||
*) return 255 ;;
|
||||
esac
|
||||
|
||||
for d in $dev; do
|
||||
names="$names
|
||||
$(readlink -e -q "$d")" || return 255
|
||||
done
|
||||
|
||||
echo "${names#
|
||||
}"
|
||||
}
|
||||
|
||||
# match_dev devpattern dev
|
||||
#
|
||||
# Returns true if 'dev' matches 'devpattern'. Both 'devpattern' and 'dev' are
|
||||
|
@@ -22,6 +22,9 @@ NEWROOT=${NEWROOT:-"/sysroot"}
|
||||
# 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
|
||||
device="/dev/mapper/$(dmsetup info -c --noheadings -o name "$1")"
|
||||
@@ -31,7 +34,7 @@ fi
|
||||
|
||||
# TODO: improve to support what cmdline does
|
||||
if [ -f /etc/crypttab ] && getargbool 1 rd.luks.crypttab -n rd_NO_CRYPTTAB; then
|
||||
while read name dev rest; do
|
||||
while read name dev luksfile rest; do
|
||||
# ignore blank lines and comments
|
||||
if [ -z "$name" -o "${name#\#}" != "$name" ]; then
|
||||
continue
|
||||
@@ -61,26 +64,45 @@ fi
|
||||
# Open LUKS device
|
||||
#
|
||||
|
||||
info "luksOpen $device $luksname"
|
||||
info "luksOpen $device $luksname $luksfile"
|
||||
|
||||
if [ -n "$(getarg rd.luks.key)" ]; then
|
||||
if tmp=$(getkey /tmp/luks.keys $device); then
|
||||
keydev="${tmp%%:*}"
|
||||
keypath="${tmp#*:}"
|
||||
else
|
||||
info "No key found for $device. Will try later."
|
||||
initqueue --unique --onetime --settled \
|
||||
--name cryptroot-ask-$luksname \
|
||||
$(command -v cryptroot-ask) "$@"
|
||||
exit 0
|
||||
if [ -n "$luksfile" -a "$luksfile" != "none" -a -e "$luksfile" ]; then
|
||||
if cryptsetup --key-file "$luksfile" luksOpen "$device" "$luksname"; then
|
||||
ask_passphrase=0
|
||||
fi
|
||||
unset tmp
|
||||
|
||||
info "Using '$keypath' on '$keydev'"
|
||||
readkey "$keypath" "$keydev" "$device" \
|
||||
| cryptsetup -d - luksOpen "$device" "$luksname"
|
||||
unset keypath keydev
|
||||
else
|
||||
while [ -n "$(getarg rd.luks.key)" ]; do
|
||||
if tmp=$(getkey /tmp/luks.keys $device); then
|
||||
keydev="${tmp%%:*}"
|
||||
keypath="${tmp#*:}"
|
||||
else
|
||||
if [ $# -eq 3 ]; then
|
||||
if [ $3 -eq 0 ]; then
|
||||
info "No key found for $device. Fallback to passphrase mode."
|
||||
break
|
||||
fi
|
||||
info "No key found for $device. Will try $3 time(s) more later."
|
||||
set -- "$1" "$2" "$(($3 - 1))"
|
||||
else
|
||||
info "No key found for $device. Will try later."
|
||||
fi
|
||||
initqueue --unique --onetime --settled \
|
||||
--name cryptroot-ask-$luksname \
|
||||
$(command -v cryptroot-ask) "$@"
|
||||
exit 0
|
||||
fi
|
||||
unset tmp
|
||||
|
||||
info "Using '$keypath' on '$keydev'"
|
||||
readkey "$keypath" "$keydev" "$device" \
|
||||
| cryptsetup -d - luksOpen "$device" "$luksname"
|
||||
unset keypath keydev
|
||||
ask_passphrase=0
|
||||
break
|
||||
done
|
||||
fi
|
||||
|
||||
if [ $ask_passphrase -ne 0 ]; then
|
||||
luks_open="$(command -v cryptsetup) luksOpen"
|
||||
ask_for_password --ply-tries 5 \
|
||||
--ply-cmd "$luks_open -T1 $device $luksname" \
|
||||
@@ -90,7 +112,7 @@ else
|
||||
unset luks_open
|
||||
fi
|
||||
|
||||
unset device luksname
|
||||
unset device luksname luksfile
|
||||
|
||||
# mark device as asked
|
||||
>> /tmp/cryptroot-asked-$2
|
||||
|
@@ -9,18 +9,23 @@ check() {
|
||||
|
||||
. $dracutfunctions
|
||||
|
||||
is_crypt() { [[ $(get_fs_type /dev/block/$1) = crypto_LUKS ]]; }
|
||||
check_crypt() {
|
||||
local dev=$1 fs=$2
|
||||
[[ $fs = "crypto_LUKS" ]] || continue
|
||||
ID_FS_UUID=$(udevadm info --query=property --name=$dev \
|
||||
| while read line; do
|
||||
[[ ${line#ID_FS_UUID} = $line ]] && continue
|
||||
eval "$line"
|
||||
echo $ID_FS_UUID
|
||||
break
|
||||
done)
|
||||
[[ ${ID_FS_UUID} ]] || continue
|
||||
echo " rd.luks.uuid=luks-${ID_FS_UUID} " >> "${initdir}/etc/cmdline.d/90crypt.conf"
|
||||
}
|
||||
|
||||
[[ $hostonly ]] && {
|
||||
_rootdev=$(find_root_block_device)
|
||||
if [[ $_rootdev ]]; then
|
||||
# root lives on a block device, so we can be more precise about
|
||||
# hostonly checking
|
||||
check_block_and_slaves is_crypt "$_rootdev" || return 1
|
||||
else
|
||||
# root is not on a block device, use the shotgun approach
|
||||
blkid | grep -q crypto\?_LUKS || return 1
|
||||
fi
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_fs check_crypt
|
||||
[ -f "${initdir}/etc/cmdline.d/90crypt.conf" ] || return 1
|
||||
}
|
||||
|
||||
return 0
|
||||
@@ -42,7 +47,7 @@ install() {
|
||||
inst_hook cmdline 10 "$moddir/parse-keydev.sh"
|
||||
inst_hook cmdline 30 "$moddir/parse-crypt.sh"
|
||||
inst_hook pre-pivot 30 "$moddir/crypt-cleanup.sh"
|
||||
inst /etc/crypttab
|
||||
inst_simple /etc/crypttab
|
||||
inst "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
|
||||
}
|
||||
|
||||
|
@@ -11,6 +11,7 @@ else
|
||||
} > /etc/udev/rules.d/70-luks.rules.new
|
||||
|
||||
LUKS=$(getargs rd.luks.uuid rd_LUKS_UUID)
|
||||
tout=$(getarg rd.luks.key.tout)
|
||||
|
||||
if [ -n "$LUKS" ]; then
|
||||
for luksid in $LUKS; do
|
||||
@@ -20,11 +21,25 @@ else
|
||||
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
|
||||
printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
|
||||
printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask)
|
||||
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID}"\n'
|
||||
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
|
||||
printf -- '[ -e /dev/disk/by-uuid/*%s* ]\n' $luksid \
|
||||
>> $hookdir/initqueue/finished/90-crypt.sh
|
||||
|
||||
[ -e $hookdir/initqueue/finished/90-crypt.sh ] || \
|
||||
{
|
||||
printf -- 'UUIDS=:\n'
|
||||
printf -- 'for dm in /dev/dm-*; do\n'
|
||||
printf -- '[ -e "$dm" ] || exit 1\n'
|
||||
printf -- 'dmid=`/sbin/dmsetup info -c -o uuid --noheadings "$dm"`\n'
|
||||
printf -- 'uuid=${dmid#CRYPT-LUKS*-}\n'
|
||||
printf -- '[ "x$uuid" = "x$dmid" ] && continue\n'
|
||||
printf -- 'UUIDS="${UUIDS}${uuid%%%%-*}:"\n'
|
||||
printf -- 'done\n'
|
||||
} > $hookdir/initqueue/finished/90-crypt.sh
|
||||
uuid=$luksid
|
||||
while [ "$uuid" != "${uuid#*-}" ]; do uuid=${uuid%%-*}${uuid#*-}; done
|
||||
printf -- '[ "x${UUIDS#*:%s*:}" != "x$UUIDS" ] || exit 1\n' $uuid >> $hookdir/initqueue/finished/90-crypt.sh
|
||||
|
||||
{
|
||||
printf -- '[ -e /dev/disk/by-uuid/*%s* ] || ' $luksid
|
||||
printf -- 'warn "crypto LUKS UUID "%s" not found"\n' $luksid
|
||||
@@ -34,7 +49,7 @@ else
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
|
||||
printf -- '--unique --onetime --name cryptroot-ask-%%k '
|
||||
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID}"\n' $(command -v cryptroot-ask)
|
||||
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $(command -v cryptroot-ask) $tout
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
fi
|
||||
|
||||
|
0
modules.d/90crypt/parse-keydev.sh
Normal file → Executable file
0
modules.d/90crypt/parse-keydev.sh
Normal file → Executable file
@@ -2,3 +2,4 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
strstr "$(cat /proc/misc)" device-mapper || modprobe dm_mod
|
||||
modprobe dm_mirror 2>/dev/null
|
||||
|
18
modules.d/90dm/dm-shutdown.sh
Normal file → Executable file
18
modules.d/90dm/dm-shutdown.sh
Normal file → Executable file
@@ -1,2 +1,16 @@
|
||||
echo "Disassembling device-mapper devices"
|
||||
dmsetup -v remove_all
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
_do_dm_shutdown() {
|
||||
local ret
|
||||
local final=$1
|
||||
info "Disassembling device-mapper devices"
|
||||
dmsetup -v remove_all
|
||||
ret=$?
|
||||
if [ "x$final" != "x" ]; then
|
||||
info "dmsetup ls --tree"
|
||||
dmsetup ls --tree 2>&1 | vinfo
|
||||
fi
|
||||
return $ret
|
||||
}
|
||||
_do_dm_shutdown $1
|
||||
|
@@ -21,10 +21,16 @@ install() {
|
||||
inst dmsetup
|
||||
|
||||
type -P dmeventd >/dev/null && dracut_install dmeventd
|
||||
inst_rules 10-dm.rules 95-dm-notify.rules
|
||||
|
||||
for _i in {"$libdir","$usrlibdir"}/libdevmapper-event.so*; do
|
||||
[ -e "$_i" ] && dracut_install "$_i"
|
||||
done
|
||||
|
||||
inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
|
||||
# Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
|
||||
# files, but provides the one below:
|
||||
inst_rules 64-device-mapper.rules
|
||||
|
||||
inst_rules "$moddir/11-dm.rules"
|
||||
|
||||
inst_hook shutdown 30 "$moddir/dm-shutdown.sh"
|
||||
|
@@ -10,6 +10,7 @@ ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="dm_end"
|
||||
ENV{ID_FS_TYPE}!="*_raid_member", , GOTO="dm_end"
|
||||
|
||||
ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}!="?*", GOTO="dm_end"
|
||||
ENV{ID_FS_TYPE}=="ddf_raid_member", ENV{rd_NO_MDDDF}!="?*", GOTO="dm_end"
|
||||
|
||||
ENV{rd_NO_DM}=="?*", GOTO="dm_end"
|
||||
|
||||
|
@@ -11,19 +11,36 @@ check() {
|
||||
. $dracutfunctions
|
||||
[[ $debug ]] && set -x
|
||||
|
||||
is_dmraid() { get_fs_type /dev/block/$1 |grep -v linux_raid_member | \
|
||||
grep -q _raid_member; }
|
||||
check_dmraid() {
|
||||
local dev=$1 fs=$2 holder DEVPATH DM_NAME
|
||||
[[ "$fs" = "linux_raid_member" ]] && continue
|
||||
[[ "$fs" = "${fs%%_raid_member}" ]] && continue
|
||||
|
||||
[[ $hostonly ]] && {
|
||||
_rootdev=$(find_root_block_device)
|
||||
if [[ $_rootdev ]]; then
|
||||
# root lives on a block device, so we can be more precise about
|
||||
# hostonly checking
|
||||
check_block_and_slaves is_dmraid "$_rootdev" || return 1
|
||||
else
|
||||
# root is not on a block device, use the shotgun approach
|
||||
dmraid -r | grep -q ok || return 1
|
||||
fi
|
||||
DEVPATH=$(udevadm info --query=property --name=$dev \
|
||||
| while read line; do
|
||||
[[ ${line#DEVPATH} = $line ]] && continue
|
||||
eval "$line"
|
||||
echo $DEVPATH
|
||||
break
|
||||
done)
|
||||
for holder in /sys/$DEVPATH/holders/*; do
|
||||
[[ -e $holder ]] || continue
|
||||
DM_NAME=$(udevadm info --query=property --path=$holder \
|
||||
| while read line; do
|
||||
[[ ${line#DM_NAME} = $line ]] && continue
|
||||
eval "$line"
|
||||
echo $DM_NAME
|
||||
break
|
||||
done)
|
||||
done
|
||||
|
||||
[[ ${DM_NAME} ]] || continue
|
||||
echo " rd.dm.uuid=${DM_NAME} " >> "${initdir}/etc/cmdline.d/90dmraid.conf"
|
||||
}
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_fs check_dmraid
|
||||
[ -f "${initdir}/etc/cmdline.d/90dmraid.conf" ] || return 1
|
||||
}
|
||||
|
||||
return 0
|
||||
@@ -38,26 +55,17 @@ install() {
|
||||
local _i
|
||||
dracut_install dmraid partx kpartx
|
||||
|
||||
inst dmeventd
|
||||
|
||||
for _i in {"$libdir","$usrlibdir"}/libdmraid-events*.so; do
|
||||
[ -e "$_i" ] && dracut_install "$_i"
|
||||
done
|
||||
|
||||
inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
|
||||
# Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
|
||||
# files, but provides the one below:
|
||||
inst_rules 64-device-mapper.rules
|
||||
|
||||
inst "$moddir/dmraid.sh" /sbin/dmraid_scan
|
||||
|
||||
if [ ! -x /lib/udev/vol_id ]; then
|
||||
inst_rules 64-md-raid.rules
|
||||
fi
|
||||
|
||||
for _i in {"$libdir","$usrlibdir"}/libdmraid-events*.so*; do
|
||||
[ -e "$_i" ] && dracut_install "$_i"
|
||||
done
|
||||
|
||||
inst_rules "$moddir/61-dmraid-imsm.rules"
|
||||
inst "$moddir/dmraid-cleanup.sh" /sbin/dmraid-cleanup
|
||||
#inst "$moddir/dmraid-cleanup.sh" /sbin/dmraid-cleanup
|
||||
inst_hook pre-trigger 30 "$moddir/parse-dm.sh"
|
||||
|
||||
}
|
||||
|
||||
|
@@ -12,3 +12,7 @@ if ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.imsm -n rd_NO_MDIMSM |
|
||||
udevproperty rd_NO_MDIMSM=1
|
||||
fi
|
||||
|
||||
if ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF || getarg noddfmd; then
|
||||
info "rd.md.ddf=0: no MD RAID for SNIA ddf raids"
|
||||
udevproperty rd_NO_MDDDF=1
|
||||
fi
|
||||
|
9
modules.d/90dmsquash-live/apply-live-updates.sh
Executable file
9
modules.d/90dmsquash-live/apply-live-updates.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
if [ -b /dev/mapper/live-rw ]; then
|
||||
if [ -d /updates ]; then
|
||||
echo "Applying updates to live image..."
|
||||
cd /updates
|
||||
/bin/cp -a -t $NEWROOT .
|
||||
cd -
|
||||
fi
|
||||
fi
|
@@ -3,24 +3,17 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
case "$root" in
|
||||
live:/dev/*)
|
||||
{
|
||||
printf 'KERNEL=="%s", SYMLINK+="live"\n' \
|
||||
${root#live:/dev/}
|
||||
printf 'SYMLINK=="%s", SYMLINK+="live"\n' \
|
||||
${root#live:/dev/}
|
||||
} >> $UDEVRULESD/99-live-mount.rules
|
||||
{
|
||||
printf 'KERNEL=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
|
||||
${root#live:/dev/}
|
||||
printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
|
||||
${root#live:/dev/}
|
||||
} >> $UDEVRULESD/99-live-squash.rules
|
||||
echo '[ -e /dev/root ]' > $hookdir/initqueue/finished/dmsquash.sh
|
||||
} >> /etc/udev/rules.d/99-live-squash.rules
|
||||
wait_for_dev "${root#live:}"
|
||||
;;
|
||||
live:*)
|
||||
if [ -f "${root#live:}" ]; then
|
||||
/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root "${root#live:}"
|
||||
echo '[ -e /dev/root ]' > $hookdir/initqueue/finished/dmsquash.sh
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
@@ -3,6 +3,8 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
type det_fs >/dev/null 2>&1 || . /lib/fs-lib.sh
|
||||
|
||||
[ -f /tmp/root.info ] && . /tmp/root.info
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
@@ -25,7 +27,8 @@ getargbool 0 rd.live.overlay.reset -y reset_overlay && reset_overlay="yes"
|
||||
getargbool 0 rd.live.overlay.readonly -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
|
||||
overlay=$(getarg rd.live.overlay overlay)
|
||||
|
||||
[ -e $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
|
||||
# CD/DVD media check
|
||||
[ -b $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
|
||||
if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
|
||||
check="yes"
|
||||
fi
|
||||
@@ -40,21 +43,27 @@ if [ -n "$check" ]; then
|
||||
[ -x /bin/plymouth ] && /bin/plymouth --show-splash
|
||||
fi
|
||||
|
||||
getarg ro && liverw=ro
|
||||
getarg rw && liverw=rw
|
||||
[ -z "$liverw" ] && liverw=ro
|
||||
# determine filesystem type for a filesystem image
|
||||
det_img_fs() {
|
||||
blkid -s TYPE -u noraid -o value "$1"
|
||||
}
|
||||
|
||||
for arg in $CMDLINE; do case $arg in ro|rw) liverw=$arg ;; esac; done
|
||||
# mount the backing of the live image first
|
||||
mkdir -m 0755 -p /run/initramfs/live
|
||||
if [ -f $livedev ]; then
|
||||
# no mount needed - we've already got the LiveOS image in initramfs
|
||||
case $livedev in
|
||||
*squashfs.img) SQUASHED=$livedev ;;
|
||||
*ext3fs.img|*rootfs.img) FSIMG=$livedev ;;
|
||||
# check filesystem type and handle accordingly
|
||||
fstype=$(det_img_fs $livedev)
|
||||
case $fstype in
|
||||
squashfs) SQUASHED=$livedev;;
|
||||
auto) die "cannot mount live image (unknown filesystem type)" ;;
|
||||
*) FSIMG=$livedev ;;
|
||||
esac
|
||||
[ -e /sys/fs/$fstype ] || modprobe $fstype
|
||||
else
|
||||
mount -n -t $fstype -o $liverw $livedev /run/initramfs/live
|
||||
RES=$?
|
||||
if [ "$RES" != "0" ]; then
|
||||
mount -n -t $fstype -o ${liverw:-ro} $livedev /run/initramfs/live
|
||||
if [ "$?" != "0" ]; then
|
||||
die "Failed to mount block device of live image"
|
||||
exit 1
|
||||
fi
|
||||
@@ -191,6 +200,9 @@ if [ -n "$ROOTFLAGS" ]; then
|
||||
ROOTFLAGS="-o $ROOTFLAGS"
|
||||
fi
|
||||
|
||||
if [ -b "$BASE_LOOPDEV" ]; then
|
||||
ln -s $BASE_LOOPDEV /run/initramfs/live-baseloop
|
||||
fi
|
||||
ln -s /dev/mapper/live-rw /dev/root
|
||||
printf '/bin/mount %s /dev/mapper/live-rw %s\n' "$ROOTFLAGS" "$NEWROOT" > $hookdir/mount/01-$$-live.sh
|
||||
|
||||
|
@@ -6,5 +6,4 @@ if [ "${root%%:*}" = "liveiso" ]; then
|
||||
printf 'KERNEL=="loop0", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root `/sbin/losetup -f --show %s`"\n' \
|
||||
${root#liveiso:}
|
||||
} >> /etc/udev/rules.d/99-liveiso-mount.rules
|
||||
echo '[ -e /dev/root ]' > $hookdir/initqueue/finished/dmsquash.sh
|
||||
fi
|
||||
|
@@ -5,7 +5,7 @@
|
||||
check() {
|
||||
# a live host-only image doesn't really make a lot of sense
|
||||
[[ $hostonly ]] && return 1
|
||||
return 0
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
@@ -16,7 +16,7 @@ depends() {
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods squashfs
|
||||
instmods squashfs loop
|
||||
}
|
||||
|
||||
install() {
|
||||
@@ -27,13 +27,14 @@ install() {
|
||||
inst losetup
|
||||
inst grep
|
||||
|
||||
dracut_install eject
|
||||
dracut_install -o eject
|
||||
|
||||
inst blockdev
|
||||
type -P checkisomd5 >/dev/null && inst checkisomd5
|
||||
inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh"
|
||||
inst_hook pre-udev 30 "$moddir/dmsquash-live-genrules.sh"
|
||||
inst_hook pre-udev 30 "$moddir/dmsquash-liveiso-genrules.sh"
|
||||
inst_hook pre-pivot 20 "$moddir/apply-live-updates.sh"
|
||||
inst "$moddir/dmsquash-live-root" "/sbin/dmsquash-live-root"
|
||||
# should probably just be generally included
|
||||
inst_rules 60-cdrom_id.rules
|
||||
|
@@ -17,6 +17,8 @@ fi
|
||||
|
||||
[ "${liveroot%%:*}" = "live" ] || return
|
||||
|
||||
modprobe -q loop
|
||||
|
||||
case "$liveroot" in
|
||||
live:LABEL=*|LABEL=*) \
|
||||
root="${root#live:}"
|
||||
@@ -41,7 +43,9 @@ case "$liveroot" in
|
||||
live:/*.[Ii][Mm][Gg]|/*.[Ii][Mm][Gg])
|
||||
[ -f "${root#live:}" ] && rootok=1 ;;
|
||||
esac
|
||||
info "root was $root, liveroot is now $liveroot"
|
||||
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
|
||||
|
5
modules.d/90kernel-modules/kernel-cleanup.sh
Executable file
5
modules.d/90kernel-modules/kernel-cleanup.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
rm -fr /lib/modules /lib/firmware
|
@@ -4,20 +4,43 @@
|
||||
|
||||
installkernel() {
|
||||
if [[ -z $drivers ]]; then
|
||||
block_module_test() {
|
||||
local blockfuncs='ahci_init_controller|ata_scsi_ioctl|scsi_add_host|blk_init_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device'
|
||||
|
||||
egrep -q "$blockfuncs" "$1"
|
||||
block_module_filter() {
|
||||
local _blockfuncs='ahci_init_controller|ata_scsi_ioctl|scsi_add_host|blk_init_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect'
|
||||
# subfunctions inherit following FDs
|
||||
local _merge=8 _side2=9
|
||||
function bmf1() {
|
||||
local _f
|
||||
while read _f; do case "$_f" in
|
||||
*.ko) [[ $(< $_f) =~ $_blockfuncs ]] && echo "$_f" ;;
|
||||
*.ko.gz) [[ $(gzip -dc <$_f) =~ $_blockfuncs ]] && echo "$_f" ;;
|
||||
*.ko.xz) [[ $(xz -dc <$_f) =~ $_blockfuncs ]] && echo "$_f" ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
function rotor() {
|
||||
local _f1 _f2
|
||||
while read _f1; do
|
||||
echo "$_f1"
|
||||
if read _f2; then
|
||||
echo "$_f2" 1>&${_side2}
|
||||
fi
|
||||
done | bmf1 1>&${_merge}
|
||||
}
|
||||
# Use two parallel streams to filter alternating modules.
|
||||
set +x
|
||||
eval "( ( rotor ) ${_side2}>&1 | bmf1 ) ${_merge}>&1"
|
||||
[[ $debug ]] && set -x
|
||||
}
|
||||
hostonly='' instmods sr_mod sd_mod scsi_dh scsi_dh_rdac scsi_dh_emc
|
||||
hostonly='' instmods pcmcia firewire-ohci
|
||||
hostonly='' instmods usb_storage sdhci sdhci-pci
|
||||
|
||||
# install keyboard support
|
||||
hostonly='' instmods atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech hid-microsoft ehci-hcd ohci-hcd uhci-hcd
|
||||
|
||||
hostonly='' instmods atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech hid-logitech-dj hid-microsoft ehci-hcd ohci-hcd uhci-hcd
|
||||
# install unix socket support
|
||||
hostonly='' instmods unix
|
||||
instmods "=drivers/pcmcia" =ide "=drivers/usb/storage"
|
||||
instmods $(filter_kernel_modules block_module_test)
|
||||
find_kernel_modules | block_module_filter | instmods
|
||||
# if not on hostonly mode, install all known filesystems,
|
||||
# if the required list is not set via the filesystems variable
|
||||
if ! [[ $hostonly ]]; then
|
||||
@@ -28,7 +51,11 @@ installkernel() {
|
||||
rm -fr ${initdir}/lib/modules/*/kernel/fs/ocfs2
|
||||
fi
|
||||
else
|
||||
hostonly='' instmods $(get_fs_type "/dev/block/$(find_root_block_device)")
|
||||
inst_fs() {
|
||||
[[ $2 ]] || return 1
|
||||
hostonly='' instmods $2
|
||||
}
|
||||
for_each_host_dev_fs inst_fs
|
||||
fi
|
||||
else
|
||||
hostonly='' instmods $drivers
|
||||
@@ -42,19 +69,23 @@ installkernel() {
|
||||
}
|
||||
|
||||
install() {
|
||||
local _f
|
||||
local _f i
|
||||
[ -f /etc/modprobe.conf ] && dracut_install /etc/modprobe.conf
|
||||
dracut_install $(find /etc/modprobe.d/ -type f -name '*.conf')
|
||||
for i in $(find -L /etc/modprobe.d/ -maxdepth 1 -type f -name '*.conf'); do
|
||||
inst_simple "$i"
|
||||
done
|
||||
inst_hook cmdline 01 "$moddir/parse-kernel.sh"
|
||||
inst_hook cleanup 20 "$moddir/kernel-cleanup.sh"
|
||||
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
|
||||
|
||||
local f
|
||||
|
||||
for _f in modules.builtin.bin modules.builtin; do
|
||||
[[ $srcmods/$_f ]] && inst "$srcmods/$_f" "/lib/modules/$kernel/$_f" \
|
||||
&& break
|
||||
[[ $srcmods/$_f ]] && break
|
||||
done || {
|
||||
dfatal "No modules.builtin.bin and modules.builtin found!"
|
||||
return 1
|
||||
}
|
||||
|
||||
for _f in modules.builtin.bin modules.builtin modules.order; do
|
||||
[[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
|
||||
done
|
||||
}
|
||||
|
41
modules.d/90livenet/livenetroot
Executable file
41
modules.d/90livenet/livenetroot
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
# livenetroot - fetch a live image from the network and run it
|
||||
#
|
||||
# TODO:
|
||||
# * HTTPS: arg to use --no-check-certificate with https (boo)
|
||||
# args for --certificate, --ca-certificate
|
||||
# * NFS support?
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
[ -f /tmp/root.info ] && . /tmp/root.info
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
# args get passed from 40network/netroot
|
||||
netroot=$2
|
||||
|
||||
liveurl=${netroot#livenet:}
|
||||
|
||||
if [ ${liveurl##*.} == "iso" ]; then
|
||||
imgfile="/run/live.iso"
|
||||
else
|
||||
imgfile="/run/rootfs.img"
|
||||
fi
|
||||
|
||||
|
||||
case "$liveurl" in
|
||||
http://*|https://*|ftp://*)
|
||||
wget -O $imgfile "$liveurl"
|
||||
;;
|
||||
*) die "don't know how to handle URL: $liveurl" ;;
|
||||
esac
|
||||
[ $? == 0 ] || die "failed to download live image"
|
||||
|
||||
|
||||
if [ ${imgfile##*.} == "iso" ]; then
|
||||
root=$(losetup -f)
|
||||
losetup $root $imgfile
|
||||
else
|
||||
root=$imgfile
|
||||
fi
|
||||
exec /sbin/dmsquash-live-root $root
|
28
modules.d/90livenet/module-setup.sh
Executable file
28
modules.d/90livenet/module-setup.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
# module-setup.sh for livenet
|
||||
|
||||
check() {
|
||||
# a live, host-only image doesn't really make a lot of sense
|
||||
[[ $hostonly ]] && return 1
|
||||
command -v wget >/dev/null || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
echo network dmsquash-live
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install wget
|
||||
mkdir -m 0755 -p "$initdir/etc/ssl/certs"
|
||||
if ! inst_any -t /etc/ssl/certs/ca-bundle.crt \
|
||||
/etc/ssl/certs/ca-bundle.crt \
|
||||
/etc/ssl/certs/ca-certificates.crt; then
|
||||
dwarn "Couldn't find SSL CA cert bundle; HTTPS won't work."
|
||||
fi
|
||||
|
||||
inst_hook cmdline 29 "$moddir/parse-livenet.sh"
|
||||
inst "$moddir/livenetroot" "/sbin/livenetroot"
|
||||
}
|
||||
|
19
modules.d/90livenet/parse-livenet.sh
Executable file
19
modules.d/90livenet/parse-livenet.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
# live net images - just like live images, but specified like:
|
||||
# root=live:[url-to-backing-file]
|
||||
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
|
||||
str_starts $root "live:" && liveurl=$root
|
||||
str_starts $liveurl "live:" || return
|
||||
liveurl="${liveurl#live:}"
|
||||
|
||||
# setting netroot to "livenet:..." makes "livenetroot" get run after ifup
|
||||
case "$liveurl" in
|
||||
http://*|https://*|ftp://*)
|
||||
netroot="livenet:$liveurl"
|
||||
root="livenet" # quiet complaints from init
|
||||
rootok=1 ;;
|
||||
esac
|
||||
|
||||
wait_for_dev /dev/root
|
@@ -13,6 +13,7 @@ PROGRAM=="/bin/sh -c 'for i in $sys/$devpath/holders/dm-[0-9]*; do [ -e $$i ] &&
|
||||
GOTO="lvm_end"
|
||||
|
||||
RUN+="/sbin/initqueue --settled --onetime --unique /sbin/lvm_scan"
|
||||
RUN+="/sbin/initqueue --timeout --name 51-lvm_scan --onetime --unique /sbin/lvm_scan --partial"
|
||||
RUN+="/bin/sh -c '>/tmp/.lvm_scan-%k;'"
|
||||
|
||||
LABEL="lvm_end"
|
||||
|
@@ -4,6 +4,7 @@
|
||||
|
||||
# run lvm scan if udev has settled
|
||||
|
||||
extraargs="$@"
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
VGS=$(getargs rd.lvm.vg rd_LVM_VG=)
|
||||
@@ -71,8 +72,11 @@ sub=${sub%%\(*};
|
||||
check_lvm_ver 2 2 57 $maj $min $sub && \
|
||||
nopoll="--poll n"
|
||||
|
||||
check_lvm_ver 2 2 65 $maj $min $sub && \
|
||||
sysinit=" --sysinit "
|
||||
if check_lvm_ver 2 2 65 $maj $min $sub; then
|
||||
sysinit=" --sysinit $extraargs"
|
||||
fi
|
||||
|
||||
unset extraargs
|
||||
|
||||
export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
|
||||
|
||||
|
@@ -10,18 +10,17 @@ check() {
|
||||
. $dracutfunctions
|
||||
[[ $debug ]] && set -x
|
||||
|
||||
is_lvm() { [[ $(get_fs_type /dev/block/$1) = LVM2_member ]]; }
|
||||
check_lvm() {
|
||||
unset DM_VG_NAME
|
||||
unset DM_LV_NAME
|
||||
eval $(udevadm info --query=property --name=$1|egrep '(DM_VG_NAME|DM_LV_NAME)=')
|
||||
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return
|
||||
echo " rd.lvm.lv=${DM_VG_NAME}/${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf"
|
||||
}
|
||||
|
||||
[[ $hostonly ]] && {
|
||||
_rootdev=$(find_root_block_device)
|
||||
if [[ $_rootdev ]]; then
|
||||
# root lives on a block device, so we can be more precise about
|
||||
# hostonly checking
|
||||
check_block_and_slaves is_lvm "$_rootdev" || return 1
|
||||
else
|
||||
# root is not on a block device, use the shotgun approach
|
||||
blkid | grep -q LVM2_member || return 1
|
||||
fi
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_fs check_lvm
|
||||
[ -f "${initdir}/etc/cmdline.d/90lvm.conf" ] || return 1
|
||||
}
|
||||
|
||||
return 0
|
||||
@@ -41,14 +40,14 @@ install() {
|
||||
|
||||
if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
|
||||
if [ -f /etc/lvm/lvm.conf ]; then
|
||||
inst /etc/lvm/lvm.conf
|
||||
inst_simple /etc/lvm/lvm.conf
|
||||
# FIXME: near-term hack to establish read-only locking;
|
||||
# use command-line lvm.conf editor once it is available
|
||||
sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 4/' ${initdir}/etc/lvm/lvm.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules 11-dm-lvm.rules
|
||||
inst_rules 11-dm-lvm.rules
|
||||
# Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
|
||||
# files, but provides the one below:
|
||||
inst_rules 64-device-mapper.rules
|
||||
|
@@ -10,12 +10,7 @@ if ! getargbool 1 rd.lvm -n rd_NO_LVM; then
|
||||
rm -f /etc/udev/rules.d/64-lvm*.rules
|
||||
else
|
||||
for dev in $(getargs rd.lvm.vg rd_LVM_VG=) $(getargs rd.lvm.lv rd_LVM_LV=); do
|
||||
printf '[ -e "/dev/%s" ]\n' $dev \
|
||||
>> $hookdir/initqueue/finished/lvm.sh
|
||||
{
|
||||
printf '[ -e "/dev/%s" ] || ' $dev
|
||||
printf 'warn "LVM "%s" not found"\n' $dev
|
||||
} >> $hookdir/emergency/90-lvm.sh
|
||||
wait_for_dev "/dev/$dev"
|
||||
done
|
||||
fi
|
||||
|
||||
|
@@ -2,84 +2,39 @@
|
||||
# automatically cause mdadm to be run.
|
||||
# See udev(8) for syntax
|
||||
|
||||
ACTION!="add|change", GOTO="md_inc_end"
|
||||
SUBSYSTEM!="block", GOTO="md_inc_end"
|
||||
ENV{ID_FS_TYPE}!="linux_raid_member|isw_raid_member", GOTO="md_inc_end"
|
||||
ACTION!="add|change", GOTO="md_end"
|
||||
SUBSYSTEM!="block", GOTO="md_end"
|
||||
ENV{rd_NO_MD}=="?*", GOTO="md_end"
|
||||
KERNEL=="md*", GOTO="md_end"
|
||||
|
||||
ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}=="?*", GOTO="md_inc_end"
|
||||
ENV{ID_FS_TYPE}=="ddf_raid_member|isw_raid_member|linux_raid_member", GOTO="md_try"
|
||||
GOTO="md_end"
|
||||
|
||||
ENV{rd_NO_MD}=="?*", GOTO="md_inc_end"
|
||||
LABEL="md_try"
|
||||
ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}=="?*", GOTO="md_end"
|
||||
ENV{ID_FS_TYPE}=="ddf_raid_member", ENV{rd_NO_MDDDF}=="?*", GOTO="md_end"
|
||||
|
||||
PROGRAM=="/bin/sh -c 'for i in $sys/$devpath/holders/md[0-9]*; do [ -e $$i ] && exit 0; done; exit 1;' ", \
|
||||
GOTO="md_inc_end"
|
||||
# already done ?
|
||||
PROGRAM="/bin/sh -c 'for i in $sys/$devpath/holders/md[0-9_]*; do [ -e $$i ] && exit 0; done; exit 1;' ", \
|
||||
GOTO="md_end"
|
||||
|
||||
# for native arrays - array's uuid has to be specified
|
||||
# for containers - container's uuid has to be specified
|
||||
# TODO : how to get embedded array's uuid having container's component ?
|
||||
#
|
||||
# UUID CHECK
|
||||
|
||||
ENV{DEVTYPE}!="partition", \
|
||||
RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
|
||||
|
||||
KERNEL!="md*", IMPORT{program}="/sbin/mdadm --examine --export $tempnode"
|
||||
|
||||
# UUID CHECK
|
||||
|
||||
LABEL="do_md_inc"
|
||||
RUN+="/sbin/initqueue --timeout --name 50-mdraid_start --onetime --unique /sbin/mdraid_start"
|
||||
|
||||
#
|
||||
# if rd_MDADMCONF do not assemble incrementally
|
||||
# defer auto assembly until the udev queue is settled
|
||||
# Incrementally build the md array; this will automatically assemble
|
||||
# any eventual containers as well (imsm, ddf)
|
||||
#
|
||||
ENV{rd_MDADMCONF}!="?*", GOTO="md_auto_end"
|
||||
LABEL="md_incremental"
|
||||
|
||||
RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh $hookdir/initqueue/finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique /sbin/mdadm_auto'"
|
||||
|
||||
GOTO="md_inc_end"
|
||||
|
||||
LABEL="md_auto_end"
|
||||
|
||||
#
|
||||
# Incrementally build the md array
|
||||
#
|
||||
RUN+="/sbin/mdadm -I $env{DEVNAME}"
|
||||
|
||||
RUN+="/bin/ln -s /sbin/md_finished.sh $hookdir/initqueue/finished/md_finished.sh"
|
||||
|
||||
LABEL="md_inc_end"
|
||||
|
||||
#
|
||||
# Handle non-container raid arrays
|
||||
#
|
||||
ACTION=="add|change", \
|
||||
KERNEL=="md[0-9]*|md/*", \
|
||||
ENV{MD_LEVEL}!="container", \
|
||||
ENV{MD_CONTAINER}!="?*", \
|
||||
ENV{rd_MDADMCONF}!="?*", \
|
||||
ENV{rd_NO_MD}!="?*", \
|
||||
GOTO="do_raidstart"
|
||||
|
||||
GOTO="end_raidstart"
|
||||
|
||||
LABEL="do_raidstart"
|
||||
|
||||
# check if array is not inactive anymore
|
||||
TEST=="md/array_state", ATTR{md/array_state}!="|inactive", GOTO="end_raidstart"
|
||||
|
||||
RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh $hookdir/initqueue/finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique /sbin/mdraid_start'"
|
||||
|
||||
LABEL="end_raidstart"
|
||||
|
||||
#
|
||||
# Handle container raid arrays
|
||||
#
|
||||
ACTION=="add|change", \
|
||||
KERNEL=="md[0-9]*|md/*", \
|
||||
ENV{DEVTYPE}!="partition", \
|
||||
ENV{MD_LEVEL}=="container", \
|
||||
ENV{rd_MDADMCONF}!="?*", \
|
||||
ENV{rd_NO_MD}!="?*", \
|
||||
GOTO="do_container"
|
||||
|
||||
GOTO="end_container"
|
||||
|
||||
LABEL="do_container"
|
||||
|
||||
RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh $hookdir/initqueue/finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique --name mdcontainer_start-%k /sbin/mdcontainer_start $env{DEVNAME}'"
|
||||
|
||||
LABEL="end_container"
|
||||
LABEL="md_end"
|
||||
|
5
modules.d/90mdraid/md-noddf.sh
Executable file
5
modules.d/90mdraid/md-noddf.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
info "rd.md.ddf=0: no MD RAID for SNIA ddf raids"
|
||||
udevproperty rd_NO_MDDDF=1
|
@@ -2,4 +2,4 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
info "rd.md.imsm=0: no MD RAID for imsm/isw raids"
|
||||
udevproperty rd_NO_MDIMSM=1
|
||||
udevproperty rd_NO_MDIMSM=1
|
||||
|
19
modules.d/90mdraid/md-shutdown.sh
Normal file → Executable file
19
modules.d/90mdraid/md-shutdown.sh
Normal file → Executable file
@@ -1,2 +1,17 @@
|
||||
echo "Disassembling mdraid devices."
|
||||
mdadm -v --stop --scan
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
_do_md_shutdown() {
|
||||
local ret
|
||||
local final=$1
|
||||
info "Disassembling mdraid devices."
|
||||
mdadm -v --stop --scan
|
||||
ret=$?
|
||||
if [ "x$final" != "x" ]; then
|
||||
info "cat /proc/mdstat"
|
||||
cat /proc/mdstat | vinfo
|
||||
fi
|
||||
return $ret
|
||||
}
|
||||
|
||||
_do_md_shutdown $1
|
||||
|
@@ -1,10 +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
|
||||
for f in $hookdir/initqueue/settled/mdcontainer_start* $hookdir/initqueue/settled/mdraid_start* $hookdir/initqueue/settled/mdadm_auto*; do
|
||||
[ -e $f ] && return 1
|
||||
done
|
||||
|
||||
$UDEV_QUEUE_EMPTY >/dev/null 2>&1 || return 1
|
||||
|
||||
return 0
|
@@ -1,12 +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
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
md=$1
|
||||
udevadm control --stop-exec-queue
|
||||
# and activate any containers
|
||||
mdadm -IR $md 2>&1 | vinfo
|
||||
ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
|
||||
ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
|
||||
udevadm control --start-exec-queue
|
@@ -2,18 +2,22 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# stop everything which is not busy
|
||||
for i in /dev/md* /dev/md/*; do
|
||||
[ -b $i ] || continue
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
mddetail=$(udevadm info --query=property --name=$i)
|
||||
case "$mddetail" in
|
||||
*MD_LEVEL=container*)
|
||||
;;
|
||||
*DEVTYPE=partition*)
|
||||
;;
|
||||
*)
|
||||
mdadm --stop $i >/dev/null 2>&1
|
||||
;;
|
||||
esac
|
||||
containers=""
|
||||
for md in /dev/md[0-9_]*; do
|
||||
[ -b "$md" ] || continue
|
||||
udevinfo="$(udevadm info --query=env --name=$md)"
|
||||
strstr "$udevinfo" "DEVTYPE=partition" && continue
|
||||
if strstr "$udevinfo" "MD_LEVEL=container"; then
|
||||
containers="$containers $md"
|
||||
continue
|
||||
fi
|
||||
mdadm -S "$md" >/dev/null 2>&1
|
||||
done
|
||||
|
||||
for md in $containers; do
|
||||
mdadm -S "$md" >/dev/null 2>&1
|
||||
done
|
||||
|
||||
unset containers udevinfo
|
||||
|
26
modules.d/90mdraid/mdraid-waitclean.sh
Executable file
26
modules.d/90mdraid/mdraid-waitclean.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if getargbool 0 rd.md.waitclean; then
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
containers=""
|
||||
for md in /dev/md[0-9_]*; do
|
||||
[ -b "$md" ] || continue
|
||||
udevinfo="$(udevadm info --query=env --name=$md)"
|
||||
strstr "$udevinfo" "DEVTYPE=partition" && continue
|
||||
if strstr "$udevinfo" "MD_LEVEL=container"; then
|
||||
containers="$containers $md"
|
||||
continue
|
||||
fi
|
||||
info "Waiting for $md to become clean"
|
||||
mdadm -W "$md" >/dev/null 2>&1
|
||||
done
|
||||
|
||||
for md in $containers; do
|
||||
info "Waiting for $md to become clean"
|
||||
mdadm -W "$md" >/dev/null 2>&1
|
||||
done
|
||||
|
||||
unset containers udevinfo
|
||||
fi
|
@@ -3,24 +3,34 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
# run mdadm if udev has settled
|
||||
info "Assembling MD RAID arrays"
|
||||
udevadm control --stop-exec-queue
|
||||
mdadm -As --auto=yes --run 2>&1 | vinfo
|
||||
mdadm -Is --run 2>&1 | vinfo
|
||||
_md_force_run() {
|
||||
local _udevinfo
|
||||
local _path_s
|
||||
local _path_d
|
||||
# try to force-run anything not running yet
|
||||
for md in /dev/md[0-9_]*; do
|
||||
[ -b "$md" ] || continue
|
||||
_udevinfo="$(udevadm info --query=env --name="$md")"
|
||||
strstr "$_udevinfo" "MD_LEVEL=container" && continue
|
||||
strstr "$_udevinfo" "DEVTYPE=partition" && continue
|
||||
|
||||
# there could still be some leftover devices
|
||||
# which have had a container added
|
||||
for md in /dev/md[0-9]* /dev/md/*; do
|
||||
[ -b "$md" ] || continue
|
||||
udevinfo="$(udevadm info --query=env --name=$md)"
|
||||
strstr "$udevinfo" "MD_UUID=" && continue
|
||||
strstr "$udevinfo" "MD_LEVEL=container" && continue
|
||||
strstr "$udevinfo" "DEVTYPE=partition" && continue
|
||||
mdadm --run "$md" 2>&1 | vinfo
|
||||
done
|
||||
unset udevinfo
|
||||
_path_s="/sys/$(udevadm info -q path -n "$md")/md/array_state"
|
||||
[ ! -r "$_path_s" ] && continue
|
||||
|
||||
ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
|
||||
ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
|
||||
udevadm control --start-exec-queue
|
||||
# inactive ?
|
||||
[ "$(cat "$_path_s")" != "inactive" ] && continue
|
||||
|
||||
mdadm -R "$md" 2>&1 | vinfo
|
||||
|
||||
# still inactive ?
|
||||
[ "$(cat "$_path_s")" = "inactive" ] && continue
|
||||
|
||||
_path_d="${_path_s%/*}/degraded"
|
||||
[ ! -r "$_path_d" ] && continue
|
||||
|
||||
# workaround for mdmon bug
|
||||
[ "$(cat "$_path_d")" -gt "0" ] && mdmon --takeover "$md"
|
||||
done
|
||||
}
|
||||
|
||||
_md_force_run
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user