Compare commits
432 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
534b0525a5 | ||
![]() |
051501eea6 | ||
![]() |
71df3c4329 | ||
![]() |
6ae5caf008 | ||
![]() |
b9d7fda0e1 | ||
![]() |
e6752f1a6c | ||
![]() |
46bc0593ac | ||
![]() |
76c4613abc | ||
![]() |
7238aa0cf0 | ||
![]() |
95d2dabc25 | ||
![]() |
07caee2662 | ||
![]() |
b43f4df540 | ||
![]() |
a2b5bb004d | ||
![]() |
444061de67 | ||
![]() |
ee1fa07f3d | ||
![]() |
cf3bc080c1 | ||
![]() |
2ca68bb82b | ||
![]() |
e2d86d001a | ||
![]() |
8082a0946e | ||
![]() |
79799c954f | ||
![]() |
1b434f1ba9 | ||
![]() |
3003cfdf9e | ||
![]() |
7c6eb15280 | ||
![]() |
ab9b7eee0a | ||
![]() |
3f003263d2 | ||
![]() |
b9cc6f7ca9 | ||
![]() |
5b928ffade | ||
![]() |
ae202ef02e | ||
![]() |
7f7a91b75f | ||
![]() |
770b796e52 | ||
![]() |
b2415f4414 | ||
![]() |
2eea164db7 | ||
![]() |
7a8a33b6cd | ||
![]() |
325d491360 | ||
![]() |
91f4d45f93 | ||
![]() |
c7e72136b2 | ||
![]() |
8844cd6b6c | ||
![]() |
ccb0ab7348 | ||
![]() |
5023964844 | ||
![]() |
4af673c3f8 | ||
![]() |
5dc6f24085 | ||
![]() |
e53fdd1c35 | ||
![]() |
040f3d2ffc | ||
![]() |
d884af8077 | ||
![]() |
a4f88b8a49 | ||
![]() |
3d7c58ca1e | ||
![]() |
ce51f3be11 | ||
![]() |
4cba811f6c | ||
![]() |
85de3d281a | ||
![]() |
3817c2f138 | ||
![]() |
13af399f65 | ||
![]() |
2cbcbd7532 | ||
![]() |
c2c3108882 | ||
![]() |
cd7ee4913d | ||
![]() |
856285aa90 | ||
![]() |
0e08f1de8d | ||
![]() |
161da365e2 | ||
![]() |
dbcc4e94c5 | ||
![]() |
d118a5990a | ||
![]() |
498a131239 | ||
![]() |
9840eaade6 | ||
![]() |
f8fcc56ed9 | ||
![]() |
1c290032a4 | ||
![]() |
1fbe575888 | ||
![]() |
6545b9d792 | ||
![]() |
67bde9f067 | ||
![]() |
921f4b5b52 | ||
![]() |
7853bbfa7d | ||
![]() |
c79517b4d9 | ||
![]() |
5e1898fa5a | ||
![]() |
11a2ab6228 | ||
![]() |
c56e44a63a | ||
![]() |
3871942d13 | ||
![]() |
07ecac56da | ||
![]() |
5ce6642fed | ||
![]() |
fb4ba86f44 | ||
![]() |
353ef76019 | ||
![]() |
44b013967a | ||
![]() |
67c0c1847b | ||
![]() |
544de3c87f | ||
![]() |
1be365c500 | ||
![]() |
13f91fc78d | ||
![]() |
256a816c9f | ||
![]() |
ee6fa3240d | ||
![]() |
9b79345001 | ||
![]() |
51c977d1ff | ||
![]() |
577b1fc833 | ||
![]() |
6ef8e5b4d3 | ||
![]() |
9bfff3746f | ||
![]() |
b2559a8895 | ||
![]() |
51b28ba9c4 | ||
![]() |
c8584872be | ||
![]() |
387bf82e30 | ||
![]() |
11adeb7c01 | ||
![]() |
3afca618da | ||
![]() |
2c1f37d45c | ||
![]() |
fa7ada31d0 | ||
![]() |
54b01e99d3 | ||
![]() |
75bb595c6c | ||
![]() |
490f98aa6c | ||
![]() |
e6b637b067 | ||
![]() |
453fd25152 | ||
![]() |
228694e5a9 | ||
![]() |
c54f73a2ff | ||
![]() |
d9416c0df5 | ||
![]() |
771c215192 | ||
![]() |
0a70f452bb | ||
![]() |
bfd602f849 | ||
![]() |
8541b35ed7 | ||
![]() |
57a49c6727 | ||
![]() |
96fb9c8dd7 | ||
![]() |
6daac70e55 | ||
![]() |
d4916e36d0 | ||
![]() |
1b4a9d8ad8 | ||
![]() |
6bde7a17be | ||
![]() |
9d1015b646 | ||
![]() |
2ca35ac7ee | ||
![]() |
4bacdf2811 | ||
![]() |
94388aaffa | ||
![]() |
a8a949d9e5 | ||
![]() |
1b29b0f7cf | ||
![]() |
ecefdfc280 | ||
![]() |
b2dff45423 | ||
![]() |
1f9de919e0 | ||
![]() |
0437ced41d | ||
![]() |
90ccb5efe7 | ||
![]() |
647bef8ca6 | ||
![]() |
2d9f5858bc | ||
![]() |
5b11bb734a | ||
![]() |
430bfefda3 | ||
![]() |
3636d59e38 | ||
![]() |
9346982f22 | ||
![]() |
48d2199e94 | ||
![]() |
f8bc899063 | ||
![]() |
cc02093d69 | ||
![]() |
d95d2f3b44 | ||
![]() |
a79f11d254 | ||
![]() |
89fb4162e3 | ||
![]() |
dab1a1dc99 | ||
![]() |
4c77612245 | ||
![]() |
5acc508cae | ||
![]() |
f844e7dc8f | ||
![]() |
620d031534 | ||
![]() |
e4e3b4c821 | ||
![]() |
094d9cae63 | ||
![]() |
eaa62cd541 | ||
![]() |
ae24b1146b | ||
![]() |
0a325a917d | ||
![]() |
7254c24a76 | ||
![]() |
55309e7800 | ||
![]() |
fa5cd2bf50 | ||
![]() |
1ad309fbc6 | ||
![]() |
f3af7bd66b | ||
![]() |
5fce1ef0c9 | ||
![]() |
85ab21a6e0 | ||
![]() |
1de37e808c | ||
![]() |
b2ff4317f1 | ||
![]() |
690396a5b1 | ||
![]() |
5bc545ed79 | ||
![]() |
644c5241d2 | ||
![]() |
937f678ef6 | ||
![]() |
5b158ad3a9 | ||
![]() |
afbeadb9da | ||
![]() |
8a4745694b | ||
![]() |
ebfdb219c6 | ||
![]() |
6438b4fedf | ||
![]() |
eebc929abb | ||
![]() |
0e4fee3d5a | ||
![]() |
3478b3146f | ||
![]() |
cfa5a0da6d | ||
![]() |
c033d96e49 | ||
![]() |
59a232ddcd | ||
![]() |
01816f2bb1 | ||
![]() |
0d86614794 | ||
![]() |
8821f4109e | ||
![]() |
783721b34b | ||
![]() |
f6c76abe8e | ||
![]() |
41bad60c82 | ||
![]() |
9c7f67a94d | ||
![]() |
26df1299cb | ||
![]() |
1f03abefad | ||
![]() |
f2db681002 | ||
![]() |
5bb59e428f | ||
![]() |
a1ef436531 | ||
![]() |
c865ecbf32 | ||
![]() |
2576bec68f | ||
![]() |
7c1796860f | ||
![]() |
d350ae6966 | ||
![]() |
9b3d462b68 | ||
![]() |
5150d44a7e | ||
![]() |
30cd3616e9 | ||
![]() |
609d00c467 | ||
![]() |
27e15000d0 | ||
![]() |
029f2691f8 | ||
![]() |
0493f9c849 | ||
![]() |
3eccdb5289 | ||
![]() |
17cb0e3fe8 | ||
![]() |
cdc8d9c403 | ||
![]() |
719cc30626 | ||
![]() |
0ca3a5ee84 | ||
![]() |
62f8a2b63c | ||
![]() |
a0342347e9 | ||
![]() |
076bab08c1 | ||
![]() |
578c24a473 | ||
![]() |
c492fe12c0 | ||
![]() |
e0c1d4e79f | ||
![]() |
0b2ddf8f69 | ||
![]() |
80a18b8bef | ||
![]() |
3a4d0c9c14 | ||
![]() |
3122e93350 | ||
![]() |
21a7b84486 | ||
![]() |
4b0a61c586 | ||
![]() |
cc97412c32 | ||
![]() |
aceaf13b44 | ||
![]() |
d7cc3f2ef5 | ||
![]() |
db3641a2ea | ||
![]() |
8e102a2487 | ||
![]() |
4c2d8f5816 | ||
![]() |
d6351b36b8 | ||
![]() |
d752c51b90 | ||
![]() |
f007e84e8e | ||
![]() |
9c111e59c9 | ||
![]() |
4754226a1a | ||
![]() |
606852a4a6 | ||
![]() |
8220945b2c | ||
![]() |
6292ee9d18 | ||
![]() |
dd2c34a82b | ||
![]() |
1246703bb4 | ||
![]() |
d2a535855b | ||
![]() |
ddd109bdf9 | ||
![]() |
3f62b2637c | ||
![]() |
08852c50b9 | ||
![]() |
bb7645459e | ||
![]() |
e5c6cb2a8c | ||
![]() |
3272ed884f | ||
![]() |
3ad4f77cef | ||
![]() |
e001359311 | ||
![]() |
dcdca91d91 | ||
![]() |
6baa63110e | ||
![]() |
93ad8c19bb | ||
![]() |
2926b5b35d | ||
![]() |
76514565c0 | ||
![]() |
bd324b9d94 | ||
![]() |
a10a1416c1 | ||
![]() |
e13918d24a | ||
![]() |
466f36159d | ||
![]() |
2245f3723b | ||
![]() |
dde97b301f | ||
![]() |
6f9d69c95a | ||
![]() |
adde3a7a27 | ||
![]() |
ed61aae141 | ||
![]() |
26257a5cf4 | ||
![]() |
0e1d2c3efa | ||
![]() |
b8a2f174d7 | ||
![]() |
e9ef52b460 | ||
![]() |
3a4989cae2 | ||
![]() |
ecee64bffa | ||
![]() |
540eb97162 | ||
![]() |
013986a8ad | ||
![]() |
a0af4fa5ea | ||
![]() |
5cae1fe179 | ||
![]() |
91bb250aed | ||
![]() |
40d69001ac | ||
![]() |
06f91665df | ||
![]() |
8442b51e20 | ||
![]() |
e9a9c8bb7e | ||
![]() |
847b618b4c | ||
![]() |
fd2312e03d | ||
![]() |
5f70a1bd06 | ||
![]() |
876bd1a2be | ||
![]() |
87122afcda | ||
![]() |
78cd3b9824 | ||
![]() |
185468f57d | ||
![]() |
45b5a4e142 | ||
![]() |
e4ebd474ec | ||
![]() |
ae5ec68355 | ||
![]() |
95c1941ce5 | ||
![]() |
59a083d8d1 | ||
![]() |
be217dc4d4 | ||
![]() |
e8e4b28dfa | ||
![]() |
1c894acb42 | ||
![]() |
7d86d90d11 | ||
![]() |
532b8c7a43 | ||
![]() |
22ecea456b | ||
![]() |
5f927f201d | ||
![]() |
b48d98dda3 | ||
![]() |
4eab305062 | ||
![]() |
edcd2c5eb7 | ||
![]() |
2c24ee9a72 | ||
![]() |
169f167151 | ||
![]() |
08e10f05f6 | ||
![]() |
bd987e3036 | ||
![]() |
be0921a413 | ||
![]() |
f01d965f0e | ||
![]() |
ecf42850c3 | ||
![]() |
2974f382f8 | ||
![]() |
6a4f980921 | ||
![]() |
5a4bbf1bda | ||
![]() |
123e24a3b5 | ||
![]() |
dcdf5c8801 | ||
![]() |
ed8c7bf5c2 | ||
![]() |
70503db416 | ||
![]() |
a2929f90ff | ||
![]() |
9cdde06d50 | ||
![]() |
b6a7c09070 | ||
![]() |
680ac04370 | ||
![]() |
e54a84113e | ||
![]() |
91d8394093 | ||
![]() |
e02c2d5c43 | ||
![]() |
7c0aa2a2ea | ||
![]() |
9ab1426534 | ||
![]() |
647035f9aa | ||
![]() |
a3afcf2a5a | ||
![]() |
7e33fa5b52 | ||
![]() |
d0ced35fc6 | ||
![]() |
a8ca68a91e | ||
![]() |
5be225d299 | ||
![]() |
a8a103e093 | ||
![]() |
d7a272a95e | ||
![]() |
c198a4bc8c | ||
![]() |
13289be133 | ||
![]() |
3df3a99759 | ||
![]() |
270ba358fa | ||
![]() |
d87c2708ec | ||
![]() |
d8b9844c61 | ||
![]() |
1d323cd938 | ||
![]() |
8f74a60ced | ||
![]() |
127fb81754 | ||
![]() |
ebcfda6c61 | ||
![]() |
bdcb63b0e6 | ||
![]() |
8f4c066020 | ||
![]() |
1fca65c576 | ||
![]() |
da4e644327 | ||
![]() |
c5ef4b63a3 | ||
![]() |
6c980807d0 | ||
![]() |
97add1b383 | ||
![]() |
3de984ba7f | ||
![]() |
85fd75f91f | ||
![]() |
0c88742669 | ||
![]() |
709302e3cc | ||
![]() |
3e96d7aa33 | ||
![]() |
3409c2377f | ||
![]() |
4058d85cb6 | ||
![]() |
2937028c54 | ||
![]() |
56f184310a | ||
![]() |
1d149cd039 | ||
![]() |
dafa4f621f | ||
![]() |
0679a6d24e | ||
![]() |
8ded2a65c0 | ||
![]() |
400723054c | ||
![]() |
7f00669875 | ||
![]() |
c91570782c | ||
![]() |
fede5bbcda | ||
![]() |
e9e93e2ec6 | ||
![]() |
d4abad2288 | ||
![]() |
ddbdebb9c8 | ||
![]() |
4828beb949 | ||
![]() |
9b17b085f3 | ||
![]() |
d293133982 | ||
![]() |
cd83e4c54d | ||
![]() |
fbf1b5b138 | ||
![]() |
58ffd15bff | ||
![]() |
0e0bf83057 | ||
![]() |
d693f34afb | ||
![]() |
d1bae3cd17 | ||
![]() |
7ea25f3a34 | ||
![]() |
e876763655 | ||
![]() |
ab56546dc7 | ||
![]() |
3592d8683b | ||
![]() |
c55b20803a | ||
![]() |
7095aab4a2 | ||
![]() |
8ef5ade737 | ||
![]() |
b3561ee15f | ||
![]() |
16b046d5da | ||
![]() |
37b14e7295 | ||
![]() |
f6458b80ef | ||
![]() |
3b0f71921d | ||
![]() |
df54ef1390 | ||
![]() |
16add2aac7 | ||
![]() |
501cc2458c | ||
![]() |
ee7eb10523 | ||
![]() |
232c082cbc | ||
![]() |
58659bf221 | ||
![]() |
8a08012764 | ||
![]() |
fdc421dbac | ||
![]() |
70aaa95d52 | ||
![]() |
80a6943fc4 | ||
![]() |
72011255e0 | ||
![]() |
de50046cd7 | ||
![]() |
e606012ce6 | ||
![]() |
b63fd4d905 | ||
![]() |
01b8cdffca | ||
![]() |
aab70adc0b | ||
![]() |
7baade2b87 | ||
![]() |
b686095f99 | ||
![]() |
a56e93c10c | ||
![]() |
465f223905 | ||
![]() |
3121677949 | ||
![]() |
a65914b4a2 | ||
![]() |
cff621603c | ||
![]() |
259872feac | ||
![]() |
43f2533977 | ||
![]() |
454771cd86 | ||
![]() |
0ec519f8a4 | ||
![]() |
d793fc2e8b | ||
![]() |
26999d6ddb | ||
![]() |
9232cab470 | ||
![]() |
a15935c143 | ||
![]() |
11ce36d78e | ||
![]() |
4819ae98ac | ||
![]() |
8c8cd69d32 | ||
![]() |
7800cc247e | ||
![]() |
21a74b32b2 | ||
![]() |
1cf0b1750b | ||
![]() |
94d2148707 | ||
![]() |
2c2c45800c | ||
![]() |
edb511860c | ||
![]() |
a39ea24f10 | ||
![]() |
93bc3d440c | ||
![]() |
7e22ab0891 | ||
![]() |
c98bcec89c | ||
![]() |
b456ab777d | ||
![]() |
d43036ffeb | ||
![]() |
54aaad9dad | ||
![]() |
c88b219410 | ||
![]() |
bab749e23e | ||
![]() |
d54a0e5ae8 | ||
![]() |
4dc4cc3fc6 | ||
![]() |
3d45f9bba9 | ||
![]() |
97c97ff6d5 | ||
![]() |
d8231fa5c2 | ||
![]() |
5db587d7c1 |
@@ -1,3 +0,0 @@
|
||||
((nil . ((setq sh-basic-offset: 4)
|
||||
(setq indent-tabs-mode nil)
|
||||
)))
|
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,3 +1,8 @@
|
||||
test*.img
|
||||
modules.d/99base/switch_root
|
||||
*~
|
||||
dracut.kernel.7
|
||||
dracut.conf.5
|
||||
dracut.8
|
||||
dracut-catimages.8
|
||||
dracut-gencmdline.8
|
||||
|
@@ -1 +0,0 @@
|
||||
kate: space-indent on; tab-width 4; indent-width 4; replace-tabs on; eol unix;
|
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"name": "Kate"
|
||||
, "files": [ { "git": 1 } ]
|
||||
, "build": {
|
||||
"directory": "build"
|
||||
, "build": "make -j $(getconf _NPROCESSORS_ONLN) all"
|
||||
, "clean": "make clean"
|
||||
}
|
||||
}
|
2
.mailmap
2
.mailmap
@@ -4,3 +4,5 @@ Philippe Seewer <philippe.seewer@bfh.ch> <philippe.seewer@bfh.ch>
|
||||
Victor Lowther <victor.lowther@gmail.com> <victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
|
||||
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>
|
||||
|
||||
|
32
AUTHORS
32
AUTHORS
@@ -4,29 +4,45 @@ Philippe Seewer <philippe.seewer@bfh.ch>
|
||||
Warren Togami <wtogami@redhat.com>
|
||||
Jeremy Katz <katzj@redhat.com>
|
||||
David Dillow <dave@thedillows.org>
|
||||
Amadeusz Żołnowski <aidecoe@aidecoe.name>
|
||||
Andreas Thienemann <andreas@bawue.net>
|
||||
Hans de Goede <hdegoede@redhat.com>
|
||||
Peter Jones <pjones@redhat.com>
|
||||
Luca Berra <bluca@comedia.it>
|
||||
Marc Grimme <grimme@atix.de>
|
||||
Andrey Borzenkov <arvidjaar@mail.ru>
|
||||
Bill Nottingham <notting@redhat.com>
|
||||
Marc Grimme <grimme@atix.de>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Daniel Drake <dsd@laptop.org>
|
||||
Bill Nottingham <notting@redhat.com>
|
||||
David Cantrell <dcantrell@redhat.com>
|
||||
Lance Albertson <lance@osuosl.org>
|
||||
Michael Ploujnikov <plouj@somanetworks.com>
|
||||
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
||||
Dan Horák <dan@danny.cz>
|
||||
Joey Boggs <jboggs@redhat.com>
|
||||
Dave Jones <davej@redhat.com>
|
||||
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Luca Berra <bluca@vodka.it>
|
||||
Michal Schmidt <mschmidt@redhat.com>
|
||||
Mike Snitzer <msnitzer@redhat.com>
|
||||
Mike Snitzer <snitzer@redhat.com>
|
||||
Munehiro Matsuda <haro@kgt.co.jp>
|
||||
Peter Rajnoha <prajnoha@redhat.com>
|
||||
Vladislav Bogdanov <bubble@hoster-ok.com>
|
||||
Alexander Todorov <atodorov@redhat.com>
|
||||
Andy Lutomirski <luto@mit.edu>
|
||||
Christian Heinz <christian.ch.heinz@gmail.com>
|
||||
Dan Horák <dhorak@redhat.com>
|
||||
Dave Jones <davej@redhat.com>
|
||||
Frederic Crozat <fcrozat@mandriva.com>
|
||||
Glen Gray <slaine@slaine.org>
|
||||
Ian Dall <ian@beware.dropbear.id.au>
|
||||
James Laska <jlaska@redhat.com>
|
||||
Konrad Rzeszutek Wilk <konrad.wilk@oracle.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>
|
||||
Munehiro Matsuda <haro@kgt.co.jp>
|
||||
Pádraig Brady <P@draigBrady.com>
|
||||
Quentin Armitage <quentin@armitage.org.uk>
|
||||
Sergey Fionov <fionov@gmail.com>
|
||||
Thilo Bangert <thilo.bangert@gmx.net>
|
||||
Tomasz Torcz <tomek@pipebreaker.pl>
|
||||
Ville Skyttä <ville.skytta@iki.fi>
|
||||
Yanko Kaneti <yaneti@declera.com>
|
||||
|
63
Makefile
63
Makefile
@@ -1,4 +1,4 @@
|
||||
VERSION=004
|
||||
VERSION=008
|
||||
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
|
||||
|
||||
prefix ?= /usr
|
||||
@@ -8,6 +8,7 @@ sysconfdir ?= ${prefix}/etc
|
||||
sbindir ?= ${prefix}/sbin
|
||||
mandir ?= ${prefix}/share/man
|
||||
|
||||
manpages = dracut.8 dracut.kernel.7 dracut.conf.5 dracut-catimages.8 dracut-gencmdline.8
|
||||
|
||||
.PHONY: install clean archive rpm testimage test all check AUTHORS
|
||||
|
||||
@@ -17,13 +18,16 @@ else
|
||||
targets =
|
||||
endif
|
||||
|
||||
all: $(targets) dracut-rhel6.html
|
||||
all: $(targets) $(manpages) dracut.html
|
||||
|
||||
dracut-rhel6.html: dracut-rhel6.xml
|
||||
xsltproc -o dracut-rhel6.html --xinclude -nonet \
|
||||
%: %.xml
|
||||
xsltproc -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
|
||||
|
||||
dracut.html: dracut.xml $(manpages)
|
||||
xsltproc -o dracut.html --xinclude -nonet \
|
||||
--stringparam draft.mode yes \
|
||||
--stringparam html.stylesheet http://docs.redhat.com/docs/en-US/Common_Content/css/default.css \
|
||||
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut-rhel6.xml
|
||||
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
|
||||
|
||||
modules.d/99base/switch_root: switch_root.c
|
||||
gcc -D _GNU_SOURCE -D 'PACKAGE_STRING="dracut"' -std=gnu99 -fsigned-char -g -O2 -o modules.d/99base/switch_root switch_root.c
|
||||
@@ -33,7 +37,7 @@ install:
|
||||
mkdir -p $(DESTDIR)$(sbindir)
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)
|
||||
mkdir -p $(DESTDIR)$(pkglibdir)/modules.d
|
||||
mkdir -p $(DESTDIR)$(mandir)/man{1,5,8}
|
||||
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
|
||||
@@ -47,21 +51,23 @@ endif
|
||||
install -m 0755 dracut-functions $(DESTDIR)$(pkglibdir)/dracut-functions
|
||||
cp -arx modules.d $(DESTDIR)$(pkglibdir)
|
||||
install -m 0644 dracut.8 $(DESTDIR)$(mandir)/man8
|
||||
install -m 0644 mkinitrd.8 $(DESTDIR)$(mandir)/man8
|
||||
install -m 0644 lsinitrd.1 $(DESTDIR)$(mandir)/man1
|
||||
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
|
||||
ifeq (1,${WITH_SWITCH_ROOT})
|
||||
rm $(DESTDIR)$(pkglibdir)/modules.d/99base/switch_root
|
||||
endif
|
||||
|
||||
clean:
|
||||
rm -f *~
|
||||
rm -f modules.d/99base/switch_root
|
||||
rm -f test-*.img
|
||||
rm -f dracut-*.rpm dracut-*.tar.bz2
|
||||
make -C test clean
|
||||
$(RM) *~
|
||||
$(RM) */*~
|
||||
$(RM) */*/*~
|
||||
$(RM) modules.d/99base/switch_root
|
||||
$(RM) test-*.img
|
||||
$(RM) dracut-*.rpm dracut-*.tar.bz2
|
||||
$(RM) $(manpages) dracut.html
|
||||
$(MAKE) -C test clean
|
||||
|
||||
archive: dracut-$(VERSION)-$(GITVERSION).tar.bz2
|
||||
|
||||
@@ -70,32 +76,27 @@ dist: dracut-$(VERSION).tar.bz2
|
||||
dracut-$(VERSION).tar.bz2:
|
||||
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ |bzip2 > dracut-$(VERSION).tar.bz2
|
||||
|
||||
dracut-$(VERSION).tar.gz:
|
||||
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ |gzip > dracut-$(VERSION).tar.gz
|
||||
|
||||
dracut-$(VERSION)-$(GITVERSION).tar.bz2:
|
||||
git archive --format=tar HEAD --prefix=dracut-$(VERSION)-$(GITVERSION)/ |bzip2 > dracut-$(VERSION)-$(GITVERSION).tar.bz2
|
||||
|
||||
|
||||
rpm: dracut-$(VERSION).tar.bz2
|
||||
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; ) && \
|
||||
( mv "$$rpmbuild"/noarch/*.rpm .; mv "$$rpmbuild"/*.src.rpm .;rm -fr "$$rpmbuild"; ls *.rpm )
|
||||
rpm: clean dracut-$(VERSION).tar.bz2
|
||||
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" --define "_rpmdir $$PWD" -ba dracut.spec
|
||||
rm -fr BUILD BUILDROOT
|
||||
|
||||
syncheck:
|
||||
gitrpm: dracut-$(VERSION)-$(GITVERSION).tar.bz2
|
||||
echo "%define gittag $(GITVERSION)" > dracut.spec.git
|
||||
cat dracut.spec >> dracut.spec.git
|
||||
mv dracut.spec dracut.spec.bak
|
||||
mv dracut.spec.git dracut.spec
|
||||
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" --define "_rpmdir $$PWD" --define "gittag $(GITVERSION)" -ba dracut.spec || :
|
||||
mv dracut.spec.bak dracut.spec
|
||||
rm -fr BUILD BUILDROOT
|
||||
|
||||
check: all
|
||||
@ret=0;for i in modules.d/99base/init modules.d/*/*.sh; do \
|
||||
[ "$${i##*/}" = "caps.sh" ] && continue; \
|
||||
dash -n "$$i" ; ret=$$(($$ret+$$?)); \
|
||||
done;exit $$ret
|
||||
@ret=0;for i in dracut modules.d/02caps/caps.sh modules.d/*/install modules.d/*/installkernel modules.d/*/check; do \
|
||||
bash -n "$$i" ; ret=$$(($$ret+$$?)); \
|
||||
done;exit $$ret
|
||||
|
||||
check: all syncheck
|
||||
$(MAKE) -C test check
|
||||
|
||||
testimage: all
|
||||
|
40
NEWS
40
NEWS
@@ -1,3 +1,35 @@
|
||||
dracut-008
|
||||
==========
|
||||
- removed --ignore-kernel-modules option (no longer necessary)
|
||||
- renamed kernel command line arguments to follow the rd. naming scheme
|
||||
- merged check, install, installkernel to module-setup.sh
|
||||
- support for bzip2 and xz compressed initramfs images.
|
||||
- source code beautification
|
||||
- lots of documentation
|
||||
- lsinitrd: "catinitrd" functionality
|
||||
- dracut: --list-modules
|
||||
- lvm: support for dynamic LVM SNAPSHOT root volume
|
||||
- 95fstab-sys: mount all /etc/fstab.sys volumes before switch_root
|
||||
- 96insmodpost dracut module
|
||||
- rd.shell=1 per default
|
||||
- rootfs-block:mount-root.sh add fsck
|
||||
- busybox shell replacements module
|
||||
- honor old "real_init="
|
||||
- 97biosdevname dracut module
|
||||
|
||||
dracut-007
|
||||
==========
|
||||
- module i18n is no longer fedora/red hat specific (Amadeusz Żołnowski)
|
||||
- distribution specific conf file
|
||||
- bootchartd support
|
||||
- debug module now has fsck
|
||||
- use "hardlink", if available, to save some space
|
||||
- /etc/dracut.conf can be overwritten by settings in /etc/dracut.conf.d/*.conf
|
||||
- gentoo splash module
|
||||
- --ignore-kernel-modules option
|
||||
- crypto keys on external devices support
|
||||
- bugfixes
|
||||
|
||||
dracut-006
|
||||
==========
|
||||
- fixed mdraid with IMSM
|
||||
@@ -11,6 +43,13 @@ dracut-006
|
||||
- fixed add_drivers handling
|
||||
- add sr_mod
|
||||
- use pigz instead of gzip, if available
|
||||
- boot from LVM mirrors and snapshots
|
||||
- iscsi: add support for multiple netroot=iscsi:
|
||||
- Support old version of module-init-tools
|
||||
- got rid of rdnetdebug
|
||||
- fixed "ip=auto6"
|
||||
- dracut.conf: use "+=" as default for config variables
|
||||
- bugfixes
|
||||
|
||||
dracut-005
|
||||
==========
|
||||
@@ -22,7 +61,6 @@ dracut-005
|
||||
- add preliminary IPv6 support
|
||||
- bugfixes
|
||||
|
||||
|
||||
dracut-004
|
||||
==========
|
||||
- dracut-lib: read multiple lines from $init/etc/cmdline
|
||||
|
20
PKGBUILD
Normal file
20
PKGBUILD
Normal file
@@ -0,0 +1,20 @@
|
||||
pkgname=dracut-git
|
||||
pkgver=$(date +%s)
|
||||
pkgrel=$(git log --pretty=format:%h |head -n 1)
|
||||
pkgdesc="Initramfs generation utility"
|
||||
arch=('i686' 'x86_64')
|
||||
url="http://sourceforge.net/apps/trac/dracut/"
|
||||
license=('GPL')
|
||||
conflicts=('dracut' 'mkinitcpio')
|
||||
provides=('dracut=9999' 'mkinitcpio=9999')
|
||||
depends=('bash')
|
||||
optdepends=('cryptsetup' 'lvm2')
|
||||
makedepends=('libxslt')
|
||||
source=()
|
||||
md5sums=()
|
||||
|
||||
build() {
|
||||
cd ..
|
||||
make sysconfdir=/etc || return 1
|
||||
make DESTDIR="${pkgdir}" sysconfdir=/etc install || return 1
|
||||
}
|
@@ -1,6 +1,3 @@
|
||||
dracut-kernel is used to pull in all firmware files to build an initrd with
|
||||
only kernel modules and firmware files.
|
||||
|
||||
dracut --kernel-only only executes "installkernel" in the modules
|
||||
subdirectories.
|
||||
"dracut --kernel-only" is to build an initrd with only kernel modules and firmware files.
|
||||
"dracut --kernel-only" only executes "installkernel" in the modules subdirectories.
|
||||
|
||||
|
3
debian/control
vendored
3
debian/control
vendored
@@ -3,13 +3,14 @@ Section: utils
|
||||
Priority: optional
|
||||
Maintainer: Philippe Seewer <philippe.seewer@bfh.ch>
|
||||
Build-Depends: debhelper (>= 5.0), cdbs
|
||||
Standards-Version: 3.8.3
|
||||
Standards-Version: 3.8.4
|
||||
Vcs-Browser: http://dracut.git.sourceforge.net/git/gitweb-index.cgi
|
||||
Vcs-Git: git://dracut.git.sourceforge.net/gitroot/dracut/dracut
|
||||
|
||||
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
|
||||
|
3
debian/dracut.dirs
vendored
3
debian/dracut.dirs
vendored
@@ -1,6 +1,7 @@
|
||||
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
|
||||
@@ -15,8 +16,10 @@ 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
|
3
debian/dracut.install
vendored
3
debian/dracut.install
vendored
@@ -1,10 +1,12 @@
|
||||
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
|
||||
@@ -19,6 +21,7 @@ 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
|
||||
|
2
debian/dracut.manpages
vendored
2
debian/dracut.manpages
vendored
@@ -1,2 +1,4 @@
|
||||
dracut.8
|
||||
dracut.conf.5
|
||||
dracut-catimages.8
|
||||
dracut-gencmdline.8
|
||||
|
327
dracut
327
dracut
@@ -1,11 +1,13 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Generator script for a dracut initramfs
|
||||
# Tries to retain some degree of compatibility with the command line
|
||||
# of the various mkinitrd implementations out there
|
||||
#
|
||||
|
||||
# Copyright 2005-2009 Red Hat, Inc. All rights reserved.
|
||||
# Copyright 2005-2010 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -21,12 +23,11 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# store for logging
|
||||
dracut_args="$@"
|
||||
|
||||
usage() {
|
||||
# 80x25 linebreak here ^
|
||||
echo "Usage: $0 [OPTION]... <initramfs> <kernel-version>
|
||||
cat << EOF
|
||||
Usage: $0 [OPTION]... <initramfs> <kernel-version>
|
||||
Creates initial ramdisk images for preloading modules
|
||||
|
||||
-f, --force Overwrite existing initramfs file.
|
||||
@@ -39,8 +40,6 @@ Creates initial ramdisk images for preloading modules
|
||||
exclusively include in the initramfs.
|
||||
--add-drivers [LIST] Specify a space-separated list of kernel
|
||||
modules to add to the initramfs.
|
||||
--omit-drivers [LIST] Specify a space-separated list of kernel
|
||||
modules not to add to the initramfs.
|
||||
--filesystems [LIST] Specify a space-separated list of kernel filesystem
|
||||
modules to exclusively include in the generic
|
||||
initramfs.
|
||||
@@ -50,70 +49,111 @@ Creates initial ramdisk images for preloading modules
|
||||
firmwares, separated by :
|
||||
--kernel-only Only install kernel drivers and firmware files
|
||||
--no-kernel Do not install kernel drivers and firmware files
|
||||
--strip Strip binaries in the initramfs (default)
|
||||
--nostrip Do not strip binaries in the initramfs
|
||||
--strip Strip binaries in the initramfs
|
||||
--nostrip Do not strip binaries in the initramfs (default)
|
||||
--mdadmconf Include local /etc/mdadm.conf
|
||||
--nomdadmconf Do not include local /etc/mdadm.conf
|
||||
--lvmconf Include local /etc/lvm/lvm.conf
|
||||
--nolvmconf Do not include local /etc/lvm/lvm.conf
|
||||
--nolvmconf Do not include local /etc/lvm/lvm.conf
|
||||
-h, --help This message
|
||||
--debug Output debug information of the build process
|
||||
-v, --verbose Verbose output during the build process
|
||||
-c, --conf [FILE] Specify configuration file to use.
|
||||
Default: /etc/dracut.conf
|
||||
--confdir [DIR] Specify configuration directory to use *.conf files
|
||||
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.
|
||||
Useful when running dracut from a git checkout.
|
||||
-H, --hostonly Host-Only mode: Install only what is needed for
|
||||
-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.
|
||||
-i, --include [SOURCE] [TARGET]
|
||||
Include the files in the SOURCE directory into the
|
||||
Target directory in the final initramfs.
|
||||
-I, --install [LIST] Install the space separated list of files into the
|
||||
initramfs.
|
||||
"
|
||||
--gzip Compress the generated initramfs using gzip.
|
||||
This will be done by default, unless another
|
||||
compression option or --no-compress is passed.
|
||||
--bzip2 Compress the generated initramfs using bzip2.
|
||||
Make sure your kernel has bzip2 decompression support
|
||||
compiled in, otherwise you will not be able to boot.
|
||||
--lzma Compress the generated initramfs using lzma.
|
||||
Make sure your kernel has lzma support compiled in,
|
||||
otherwise you will not be able to boot.
|
||||
--no-compress Do not compress the generated initramfs. This will
|
||||
override any other compression options.
|
||||
--list-modules List all available dracut modules.
|
||||
EOF
|
||||
}
|
||||
|
||||
# Little helper function for reading args from the commandline.
|
||||
# it automatically handles -a b and -a=b variants, and returns 1 if
|
||||
# we need to shift $3.
|
||||
read_arg() {
|
||||
# $1 = arg name
|
||||
# $2 = arg value
|
||||
# $3 = arg parameter
|
||||
local rematch='^[^=]*=(.*)$'
|
||||
if [[ $2 =~ $rematch ]]; then
|
||||
read "$1" <<< "${BASH_REMATCH[1]}"
|
||||
else
|
||||
read "$1" <<< "$3"
|
||||
# There is no way to shift our callers args, so
|
||||
# return 1 to indicate they should do it instead.
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
while (($# > 0)); do
|
||||
case $1 in
|
||||
-f|--force) force=yes;;
|
||||
-m|--modules) dracutmodules_l="$2"; shift;;
|
||||
-o|--omit) omit_dracutmodules_l="$2"; shift;;
|
||||
-a|--add) add_dracutmodules_l="$2"; shift;;
|
||||
-d|--drivers) drivers_l="$2"; shift;;
|
||||
--add-drivers) add_drivers_l="$2"; shift;;
|
||||
--omit-drivers) omit_drivers_l+="$2"; shift;;
|
||||
--filesystems) filesystems_l="$2"; shift;;
|
||||
-k|--kmoddir) drivers_dir_l="$2"; shift;;
|
||||
--fwdir) fw_dir_l="$2"; shift;;
|
||||
--kernel-only) kernel_only="yes"; no_kernel="no";;
|
||||
--no-kernel) kernel_only="no"; no_kernel="yes";;
|
||||
--strip) do_strip_l="yes";;
|
||||
--nostrip) do_strip_l="no";;
|
||||
--mdadmconf) mdadmconf_l="yes";;
|
||||
case ${1%%=*} in
|
||||
-m|--modules) read_arg dracutmodules_l "$@" || shift;;
|
||||
-o|--omit) read_arg omit_dracutmodules_l "$@" || shift;;
|
||||
-a|--add) read_arg add_dracutmodules_l "$@" || shift;;
|
||||
-d|--drivers) read_arg drivers_l "$@" || shift;;
|
||||
--add-drivers) read_arg add_drivers_l "$@" || shift;;
|
||||
--filesystems) read_arg filesystems_l "$@" || shift;;
|
||||
-k|--kmoddir) read_arg drivers_dir_l "$@" || shift;;
|
||||
-c|--conf) read_arg conffile "$@" || shift;;
|
||||
--confdir) read_arg confdir "$@" || shift;;
|
||||
-I|--install) read_arg install_items "$@" || shift;;
|
||||
--fwdir) read_arg fw_dir_l "$@" || shift;;
|
||||
-f|--force) force=yes;;
|
||||
--kernel-only) kernel_only="yes"; no_kernel="no";;
|
||||
--no-kernel) kernel_only="no"; no_kernel="yes";;
|
||||
--strip) do_strip_l="yes";;
|
||||
--nostrip) do_strip_l="no";;
|
||||
--mdadmconf) mdadmconf_l="yes";;
|
||||
--nomdadmconf) mdadmconf_l="no";;
|
||||
--lvmconf) lvmconf_l="yes";;
|
||||
--nolvmconf) lvmconf_l="no";;
|
||||
-h|--help) usage; exit 1 ;;
|
||||
--debug) debug="yes";;
|
||||
-v|--verbose) beverbose="yes";;
|
||||
-c|--conf) conffile="$2"; shift;;
|
||||
--confdir) confdir="$2"; shift;;
|
||||
-l|--local) allowlocal="yes" ;;
|
||||
-H|--hostonly) hostonly_l="yes" ;;
|
||||
-i|--include) include_src="$2"; include_target="$3"; shift 2;;
|
||||
-I|--install) install_items="$2"; shift;;
|
||||
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
|
||||
*) break ;;
|
||||
--lvmconf) lvmconf_l="yes";;
|
||||
--nolvmconf) lvmconf_l="no";;
|
||||
--debug) debug="yes";;
|
||||
-v|--verbose) beverbose="yes";;
|
||||
-l|--local) allowlocal="yes" ;;
|
||||
-H|--hostonly) hostonly_l="yes" ;;
|
||||
--fstab) use_fstab_l="yes" ;;
|
||||
-h|--help) usage; exit 1 ;;
|
||||
-i|--include) include_src="$2"; include_target="$3"; shift 2;;
|
||||
--bzip2) [[ $compress != cat ]] && compress="bzip2 -9";;
|
||||
--lzma) [[ $compress != cat ]] && compress="lzma -9";;
|
||||
--no-compress) compress="cat";;
|
||||
--gzip) if [[ $compress != cat ]]; then
|
||||
type pigz > /dev/null 2>&1 && compress="pigz -9" || \
|
||||
compress="gzip -9"
|
||||
fi;;
|
||||
--list-modules)
|
||||
do_list="yes";
|
||||
;;
|
||||
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
|
||||
*) break ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
export PATH
|
||||
unset LD_LIBRARY_PATH
|
||||
unset GREP_OPTIONS
|
||||
|
||||
[[ $debug ]] && {
|
||||
export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
|
||||
@@ -122,33 +162,33 @@ unset GREP_OPTIONS
|
||||
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
|
||||
|
||||
[[ $allowlocal && -f "$(readlink -f $(dirname $0))/dracut-functions" ]] && dracutbasedir="$(dirname $0)"
|
||||
[[ $allowlocal && -f "$(readlink -f ${0%/*})/dracut-functions" ]] && \
|
||||
dracutbasedir="${0%/*}"
|
||||
|
||||
# if we were not passed a config file, try the default one
|
||||
if [[ ! -f $conffile ]]; then
|
||||
[[ $allowlocal ]] || conffile="/etc/dracut.conf"
|
||||
[[ $allowlocal ]] && conffile="$dracutbasedir/dracut.conf"
|
||||
[[ $allowlocal ]] && conffile="$dracutbasedir/dracut.conf" || \
|
||||
conffile="/etc/dracut.conf"
|
||||
fi
|
||||
|
||||
if [[ ! -d $confdir ]]; then
|
||||
[[ $allowlocal ]] || confdir="/etc/dracut.conf.d"
|
||||
[[ $allowlocal ]] && confdir="$dracutbasedir/dracut.conf.d"
|
||||
fi
|
||||
|
||||
# source our config dir
|
||||
if [ "$confdir" ] && [ -d "$confdir" ]; then
|
||||
for f in "$confdir"/*.conf; do
|
||||
[ -e "$f" ] && . "$f"
|
||||
done
|
||||
[[ $allowlocal ]] && confdir="$dracutbasedir/dracut.conf.d" || \
|
||||
confdir="/etc/dracut.conf.d"
|
||||
fi
|
||||
|
||||
# source our config file
|
||||
[[ -f $conffile ]] && . "$conffile"
|
||||
|
||||
# source our config dir
|
||||
if [[ $confdir && -d $confdir ]]; then
|
||||
for f in "$confdir"/*.conf; do
|
||||
[[ -e $f ]] && . "$f"
|
||||
done
|
||||
fi
|
||||
|
||||
# these optins add to the stuff in the config file
|
||||
[[ $add_dracutmodules_l ]] && add_dracutmodules+=" $add_dracutmodules_l"
|
||||
[[ $add_drivers_l ]] && add_drivers+=" $add_drivers_l"
|
||||
[[ $omit_drivers_l ]] && omit_drivers+=" $omit_drivers_l"
|
||||
|
||||
# these options override the stuff in the config file
|
||||
[[ $dracutmodules_l ]] && dracutmodules=$dracutmodules_l
|
||||
@@ -159,37 +199,50 @@ fi
|
||||
[[ $fw_dir_l ]] && fw_dir=$fw_dir_l
|
||||
[[ $do_strip_l ]] && do_strip=$do_strip_l
|
||||
[[ $hostonly_l ]] && hostonly=$hostonly_l
|
||||
[[ $use_fstab_l ]] && use_fstab=$use_fstab_l
|
||||
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
|
||||
[[ $lvmconf_l ]] && lvmconf=$lvmconf_l
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
|
||||
[[ $fw_dir ]] || fw_dir=/lib/firmware
|
||||
[[ $do_strip ]] || do_strip=yes
|
||||
[[ $do_strip ]] || do_strip=no
|
||||
# eliminate IFS hackery when messing with fw_dir
|
||||
fw_dir=${fw_dir//:/ }
|
||||
|
||||
[[ $hostonly = yes ]] && hostonly="-h"
|
||||
[[ $hostonly != "-h" ]] && unset hostonly
|
||||
[[ $compress ]] || compress="gzip -9"
|
||||
|
||||
if [[ -f $dracutbasedir/dracut-functions ]]; then
|
||||
. $dracutbasedir/dracut-functions
|
||||
. $dracutbasedir/dracut-functions
|
||||
else
|
||||
echo "Cannot find $dracutbasedir/dracut-functions. Are you running from a git checkout?"
|
||||
echo "Try passing -l as an argument to $0"
|
||||
exit 1
|
||||
derror "Cannot find $dracutbasedir/dracut-functions."
|
||||
derror "Are you running from a git checkout?"
|
||||
derror "Try passing -l as an argument to $0"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dracutfunctions=$dracutbasedir/dracut-functions
|
||||
export dracutfunctions
|
||||
|
||||
dinfo "Executing $0 $dracut_args"
|
||||
[[ $do_list = yes ]] && {
|
||||
for mod in $dracutbasedir/modules.d/*; do
|
||||
[[ -d $mod ]] || continue;
|
||||
[[ -e $mod/install || -e $mod/installkernel ]] || continue;
|
||||
echo ${mod##*/??}
|
||||
done
|
||||
exit 0
|
||||
}
|
||||
|
||||
omit_drivers_corrected=""
|
||||
for d in $omit_drivers; do
|
||||
strstr " $drivers $add_drivers " " $d " && continue
|
||||
omit_drivers_corrected+="$d|"
|
||||
done
|
||||
omit_drivers="${omit_drivers_corrected%|}"
|
||||
unset omit_drivers_corrected
|
||||
# Detect lib paths
|
||||
[[ $libdir ]] || for libdir in /lib64 /lib; do
|
||||
[[ -d $libdir ]] && break
|
||||
done || {
|
||||
derror 'No lib directory?!!!'
|
||||
exit 1
|
||||
}
|
||||
[[ $usrlibdir ]] || for usrlibdir in /usr/lib64 /usr/lib; do
|
||||
[[ -d $usrlibdir ]] && break
|
||||
done || dwarning 'No usr/lib directory!'
|
||||
|
||||
# This is kinda legacy -- eventually it should go away.
|
||||
case $dracutmodules in
|
||||
@@ -201,7 +254,13 @@ esac
|
||||
abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
|
||||
|
||||
srcmods="/lib/modules/$kernel/"
|
||||
[[ $drivers_dir ]] && srcmods="$drivers_dir"
|
||||
[[ $drivers_dir ]] && {
|
||||
if vercmp $(modprobe --version | cut -d' ' -f3) lt 3.7; then
|
||||
derror 'To use --kmoddir option module-init-tools >= 3.7 is required.'
|
||||
exit 1
|
||||
fi
|
||||
srcmods="$drivers_dir"
|
||||
}
|
||||
export srcmods
|
||||
|
||||
if [[ -f $outfile && ! $force ]]; then
|
||||
@@ -209,63 +268,63 @@ if [[ -f $outfile && ! $force ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
outdir=$(dirname "$outfile")
|
||||
if ! [[ -d "$outdir" ]]; then
|
||||
outdir=${outfile%/*}
|
||||
if [[ ! -d "$outdir" ]]; then
|
||||
derror "Can't write $outfile: Directory $outdir does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [[ -w "$outdir" ]]; then
|
||||
elif [[ ! -w "$outdir" ]]; then
|
||||
derror "No permission to write $outdir."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -f "$outfile" ]] && ! [[ -w "$outfile" ]]; then
|
||||
elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
|
||||
derror "No permission to write $outfile."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
hookdirs="cmdline pre-udev pre-trigger netroot pre-mount pre-pivot mount emergency initqueue initqueue-finished initqueue-settled initqueue-timeout
|
||||
"
|
||||
hookdirs="cmdline pre-udev pre-trigger netroot pre-mount"
|
||||
hookdirs+=" pre-pivot mount emergency"
|
||||
|
||||
[[ -n "$TMPDIR" ]] && ! [[ -w "$TMPDIR" ]] && unset TMPDIR
|
||||
[[ $TMPDIR && ! -w $TMPDIR ]] && unset TMPDIR
|
||||
readonly initdir=$(mktemp -d -t initramfs.XXXXXX)
|
||||
|
||||
trap 'ret=$?;rm -rf "$initdir";exit $ret;' EXIT # clean up after ourselves no matter how we die.
|
||||
trap 'exit 1;' SIGINT # clean up after ourselves no matter how we die.
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap 'ret=$?;rm -rf "$initdir";exit $ret;' EXIT
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap 'exit 1;' SIGINT
|
||||
|
||||
# Need to be able to have non-root users read stuff (rpcbind etc)
|
||||
chmod 755 "$initdir"
|
||||
|
||||
export initdir hookdirs dracutbasedir dracutmodules drivers \
|
||||
fw_dir drivers_dir debug beverbose no_kernel kernel_only \
|
||||
add_drivers omit_drivers mdadmconf lvmconf filesystems
|
||||
add_drivers mdadmconf lvmconf filesystems \
|
||||
use_fstab libdir usrlibdir
|
||||
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
# Create some directory structure first
|
||||
for d in bin sbin usr/bin usr/sbin usr/lib etc proc sys sysroot tmp dev/pts var/log var/run $hookdirs; do
|
||||
inst_dir "/$d"
|
||||
for d in bin sbin usr/bin usr/sbin usr/lib etc \
|
||||
proc sys sysroot tmp dev/pts var/run; do
|
||||
inst_dir "/$d";
|
||||
done
|
||||
fi
|
||||
|
||||
# check all our modules to see if they should be sourced.
|
||||
# This builds a list of modules that we will install next.
|
||||
check_modules
|
||||
modules_loaded=" "
|
||||
check_module_dir
|
||||
|
||||
# source our modules.
|
||||
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
_d_mod=${moddir##*/}; _d_mod=${_d_mod#[0-9][0-9]}
|
||||
if strstr "$mods_to_load" " $_d_mod "; then
|
||||
if [[ $kernel_only = yes ]]; then
|
||||
[[ -x $moddir/installkernel ]] && . "$moddir/installkernel"
|
||||
else
|
||||
[[ -x "$moddir/install" ]] && . "$moddir/install"
|
||||
if [[ $no_kernel != yes && -x $moddir/installkernel ]]; then
|
||||
. "$moddir/installkernel"
|
||||
fi
|
||||
fi
|
||||
modules_loaded+="$_d_mod "
|
||||
mods_to_load=${mods_to_load// $_d_mod /}
|
||||
mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
|
||||
if strstr "$mods_to_load" " $mod "; then
|
||||
dinfo "*** Sourcing module $mod"
|
||||
if [[ $kernel_only = yes ]]; then
|
||||
module_installkernel $mod
|
||||
else
|
||||
module_install $mod
|
||||
if [[ $no_kernel != yes ]]; then
|
||||
module_installkernel $mod
|
||||
fi
|
||||
fi
|
||||
mods_to_load=${mods_to_load// $mod /}
|
||||
fi
|
||||
done
|
||||
unset moddir
|
||||
@@ -273,74 +332,58 @@ unset moddir
|
||||
## final stuff that has to happen
|
||||
|
||||
# generate module dependencies for the initrd
|
||||
if [[ -d $initdir/lib/modules/$kernel ]]; then
|
||||
if ! depmod -a -b "$initdir" $kernel; then
|
||||
derror "\"depmod -a $kernel\" failed."
|
||||
exit 1
|
||||
fi
|
||||
if [[ -d $initdir/lib/modules/$kernel ]] && \
|
||||
! depmod -a -b "$initdir" $kernel; then
|
||||
derror "\"depmod -a $kernel\" failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $include_src && $include_target ]]; then
|
||||
if [[ -f $include_src ]]; then
|
||||
inst $include_src $include_target
|
||||
else
|
||||
mkdir -p "$initdir$include_target"
|
||||
cp -a -t "$initdir$include_target" "$include_src"/*
|
||||
fi
|
||||
mkdir -p "$initdir$include_target"
|
||||
cp -a -t "$initdir$include_target" "$include_src"/*
|
||||
fi
|
||||
|
||||
for item in $install_items; do
|
||||
dracut_install "$item"
|
||||
dracut_install "$item"
|
||||
done
|
||||
unset item
|
||||
|
||||
# make sure that library links are correct and up to date
|
||||
cp -ar /etc/ld.so.conf* "$initdir"/etc
|
||||
ldconfig -r "$initdir" || [[ $(id -u) != "0" ]] && dinfo "ldconfig might need uid=0 (root) for chroot()"
|
||||
ldconfig -r "$initdir" || [[ $UID != "0" ]] && \
|
||||
dinfo "ldconfig might need uid=0 (root) for chroot()"
|
||||
|
||||
[[ $beverbose = yes ]] && (du -c "$initdir" | sort -n)
|
||||
|
||||
# strip binaries
|
||||
if [[ $do_strip = yes ]] ; then
|
||||
for p in strip grep find; do
|
||||
if ! which $p >/dev/null 2>&1; then
|
||||
dwarn "Could not find '$p'. Not stripping binaries in the initramfs."
|
||||
do_strip=no
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ $do_strip = yes ]] ; then
|
||||
for f in $(find "$initdir" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 -or -path '*/lib/modules/*.ko' \) ); do
|
||||
# do not strip files with a .hmac file,
|
||||
# because that would alter the checksum
|
||||
if ! [[ -f "${f%/*}/.${f##*/}.hmac" ]]; then
|
||||
dinfo "Stripping '$f'"
|
||||
strip -g "$f" 2>/dev/null|| :
|
||||
else
|
||||
dinfo "Not stripping '$f', because it has a hmac checksum file."
|
||||
if ! type -P $p >/dev/null; then
|
||||
derror "Could not find '$p'. You should run $0 with '--nostrip'."
|
||||
do_strip=no
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if strstr "$modules_loaded" " fips " && command -v prelink >/dev/null; then
|
||||
for i in $initdir/bin/* \
|
||||
$initdir/bin/* \
|
||||
$initdir/usr/bin/* \
|
||||
$initdir/usr/sbin/*; do
|
||||
[ -x $i ] && prelink -u $i &>/dev/null
|
||||
if [[ $do_strip = yes ]] ; then
|
||||
for f in $(find "$initdir" -type f \
|
||||
\( -perm -0100 -or -perm -0010 -or -perm -0001 \
|
||||
-or -path '*/lib/modules/*.ko' \) ); do
|
||||
dinfo "Stripping $f"
|
||||
strip -g "$f" 2>/dev/null|| :
|
||||
done
|
||||
fi
|
||||
|
||||
type pigz &>/dev/null && gzip=pigz || gzip=gzip
|
||||
if ! ( set -o pipefail; umask 077; cd "$initdir"; find . |cpio -R root:root -H newc -o --quiet| \
|
||||
$gzip -9 > "$outfile"; ); then
|
||||
type hardlink &>/dev/null && {
|
||||
hardlink "$initdir" 2>&1
|
||||
}
|
||||
|
||||
if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet | \
|
||||
$compress > "$outfile"; ); then
|
||||
derror "dracut: creation of $outfile failed"
|
||||
rm -f "$outfile"
|
||||
exit 1
|
||||
fi
|
||||
dinfo "Wrote $outfile"
|
||||
dinfo $(ls -l "$outfile")
|
||||
fi
|
||||
|
||||
[[ $beverbose = yes ]] && ls -lh "$outfile"
|
||||
|
||||
exit 0
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
#!/bin/bash --norc
|
||||
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Copyright 2009 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@@ -31,7 +33,8 @@ derror() {
|
||||
|
||||
usage() {
|
||||
# 80x25 linebreak here ^
|
||||
echo "Usage: $0 [OPTION]... <initramfs> <base image> [<image>...]
|
||||
cat << EOF
|
||||
Usage: $0 [OPTION]... <initramfs> <base image> [<image>...]
|
||||
Creates initial ramdisk image by concatenating several images from the command
|
||||
line and /boot/dracut/
|
||||
|
||||
@@ -45,7 +48,7 @@ line and /boot/dracut/
|
||||
-h, --help This message
|
||||
--debug Output debug information of the build process
|
||||
-v, --verbose Verbose output during the build process
|
||||
"
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
@@ -54,16 +57,16 @@ overlay=/var/lib/dracut/overlay
|
||||
|
||||
while (($# > 0)); do
|
||||
case $1 in
|
||||
-f|--force) force=yes;;
|
||||
-i|--imagedir) imagedir=$2;shift;;
|
||||
-o|--overlaydir) overlay=$2;shift;;
|
||||
--nooverlay) no_overlay=yes;shift;;
|
||||
--noimagedir) no_imagedir=yes;shift;;
|
||||
-h|--help) usage; exit 1 ;;
|
||||
--debug) debug="yes";;
|
||||
-v|--verbose) beverbose="yes";;
|
||||
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
|
||||
*) break ;;
|
||||
-f|--force) force=yes;;
|
||||
-i|--imagedir) imagedir=$2;shift;;
|
||||
-o|--overlaydir) overlay=$2;shift;;
|
||||
--nooverlay) no_overlay=yes;shift;;
|
||||
--noimagedir) no_imagedir=yes;shift;;
|
||||
-h|--help) usage; exit 1 ;;
|
||||
--debug) debug="yes";;
|
||||
-v|--verbose) beverbose="yes";;
|
||||
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
|
||||
*) break ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
@@ -108,7 +111,7 @@ fi
|
||||
|
||||
if [[ ! $no_imagedir ]]; then
|
||||
for i in "$imagedir/"*.img; do
|
||||
[[ -f $i ]] && images+=("$i")
|
||||
[[ -f $i ]] && images+=("$i")
|
||||
done
|
||||
fi
|
||||
|
||||
|
@@ -1,52 +0,0 @@
|
||||
.TH DRACUT-CATIMAGES 8 "June 2009" "Linux"
|
||||
.SH NAME
|
||||
dracut-catimages \- creates initial ramdisk image by concatenating images
|
||||
.SH SYNOPSIS
|
||||
\fBdracut-catimages\fR [\fIOPTION\fR]... \fI<initramfs base image>\fR \fI[<image>...]\fR
|
||||
|
||||
.SH DESCRIPTION
|
||||
.B dracut-catimages
|
||||
creates an initial ramdisk image by concatenating several images from the command
|
||||
line and /boot/dracut/*.img
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.BR \-f ", " \-\-force
|
||||
overwrite existing initramfs file.
|
||||
.TP
|
||||
.BR \-i ", " \-\-imagedir
|
||||
Directory with additional images to add (default: /boot/dracut/)
|
||||
.TP
|
||||
.BR \-o ", " \-\-overlaydir
|
||||
Overlay directory, which contains additional files that will be used to create an additional image
|
||||
.TP
|
||||
.BR \-\-nooverlay
|
||||
Do not use the overlay directory
|
||||
.TP
|
||||
.BR \-\-noimagedir
|
||||
Do not use the additional image directory
|
||||
.TP
|
||||
.BR \-h ", " \-\-help
|
||||
display help text and exit.
|
||||
.TP
|
||||
.B \-\-debug
|
||||
output debug information of the build process
|
||||
.TP
|
||||
.BR \-v ", " \-\-verbose
|
||||
verbose output during the build process
|
||||
|
||||
.SH FILES
|
||||
.TP
|
||||
.B /boot/dracut/*.img
|
||||
.TP
|
||||
.B
|
||||
.SH AUTHORS
|
||||
.nf
|
||||
Harald Hoyer <harald@redhat.com>
|
||||
.fi
|
||||
.SH AVAILABILITY
|
||||
The dracut-catimages command is part of the dracut package and is available from
|
||||
http://sourceforge.net/apps/trac/dracut/wiki
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR dracut (8)
|
116
dracut-catimages.8.xml
Normal file
116
dracut-catimages.8.xml
Normal file
@@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
|
||||
<!-- lifted from troff+man by doclifter -->
|
||||
<refentry id='dracutcatimages8'>
|
||||
<refmeta>
|
||||
<refentrytitle>DRACUT-CATIMAGES</refentrytitle>
|
||||
<manvolnum>8</manvolnum>
|
||||
<refmiscinfo class='source'>June 2009</refmiscinfo>
|
||||
<refmiscinfo class='manual'>Linux</refmiscinfo>
|
||||
</refmeta>
|
||||
<refnamediv id='name'>
|
||||
<refname>dracut-catimages</refname>
|
||||
<refpurpose>creates initial ramdisk image by concatenating images</refpurpose>
|
||||
</refnamediv>
|
||||
<!-- body begins here -->
|
||||
<refsynopsisdiv id='synopsis'>
|
||||
<cmdsynopsis>
|
||||
<command>dracut-catimages</command> <arg choice='opt' rep='repeat'><replaceable>OPTION</replaceable></arg>
|
||||
<arg choice='plain'><replaceable><initramfs</replaceable></arg>
|
||||
<arg choice='plain'><replaceable>base</replaceable></arg>
|
||||
<arg choice='plain'><replaceable>image></replaceable></arg>
|
||||
<arg choice='opt' rep='repeat'><replaceable><image></replaceable></arg>
|
||||
<sbr/>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
|
||||
<refsect1 id='description'><title>DESCRIPTION</title>
|
||||
<para><command>dracut-catimages</command>
|
||||
creates an initial ramdisk image by concatenating several images from the command
|
||||
line and /boot/dracut/*.img</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id='options'><title>OPTIONS</title>
|
||||
<variablelist remap='TP'>
|
||||
<varlistentry>
|
||||
<term><option>-f</option>, <option>--force</option></term>
|
||||
<listitem>
|
||||
<para>overwrite existing initramfs file.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-i</option>, <option>--imagedir</option></term>
|
||||
<listitem>
|
||||
<para>Directory with additional images to add (default: /boot/dracut/)</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-o</option>, <option>--overlaydir</option></term>
|
||||
<listitem>
|
||||
<para>Overlay directory, which contains additional files that will be used to create an additional image</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--nooverlay</option></term>
|
||||
<listitem>
|
||||
<para>Do not use the overlay directory</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--noimagedir</option></term>
|
||||
<listitem>
|
||||
<para>Do not use the additional image directory</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-h</option>, <option>--help</option></term>
|
||||
<listitem>
|
||||
<para>display help text and exit.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--debug</option></term>
|
||||
<listitem>
|
||||
<para>output debug information of the build process</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-v</option>, <option>--verbose</option></term>
|
||||
<listitem>
|
||||
<para>verbose output during the build process</para>
|
||||
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id='files'><title>FILES</title>
|
||||
<variablelist remap='TP'>
|
||||
<varlistentry>
|
||||
<term><filename>/boot/dracut/*.img</filename></term>
|
||||
<listitem>
|
||||
<para></para> <!-- FIXME: blank list item -->
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id='authors'><title>AUTHORS</title>
|
||||
<literallayout remap='.nf'>
|
||||
Harald Hoyer <harald@redhat.com>
|
||||
</literallayout> <!-- .fi -->
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id='availability'><title>AVAILABILITY</title>
|
||||
<para>The dracut-catimages command is part of the dracut package and is available from
|
||||
<ulink url='http://sourceforge.net/apps/trac/dracut/wiki'>http://sourceforge.net/apps/trac/dracut/wiki</ulink></para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id='see_also'><title>SEE ALSO</title>
|
||||
<para><citerefentry><refentrytitle>dracut</refentrytitle><manvolnum>8</manvolnum></citerefentry></para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
823
dracut-functions
823
dracut-functions
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,6 @@
|
||||
#!/bin/bash --norc
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Copyright 2005-2009 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
@@ -43,13 +45,13 @@ function get_verbose() {
|
||||
|
||||
|
||||
function get_numeric_dev() {
|
||||
(
|
||||
fmt="%d:%d"
|
||||
if [ "$1" == "hex" ]; then
|
||||
fmt="%x:%x"
|
||||
fi
|
||||
ls -lH "$2" | awk '{ sub(/,/, "", $5); printf("'"$fmt"'", $5, $6); }'
|
||||
) 2>/dev/null
|
||||
(
|
||||
fmt="%d:%d"
|
||||
if [ "$1" == "hex" ]; then
|
||||
fmt="%x:%x"
|
||||
fi
|
||||
ls -lH "$2" | awk '{ sub(/,/, "", $5); printf("'"$fmt"'", $5, $6); }'
|
||||
) 2>/dev/null
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +175,7 @@ finddevnoinsys() {
|
||||
majmin="$1"
|
||||
if [ -n "$majmin" ]; then
|
||||
dev=$(for x in /sys/block/* ; do find $x/ -name dev ; done | while read device ; do \
|
||||
echo "$majmin" | cmp -s $device && echo $device ; done)
|
||||
echo "$majmin" | cmp -s $device && echo $device ; done)
|
||||
if [ -n "$dev" ]; then
|
||||
dev=${dev%%/dev}
|
||||
dev=${dev%%/}
|
||||
@@ -309,7 +311,7 @@ iscsi_set_parameters() {
|
||||
iscsi_get_rec_val $tmpfile "node.session.auth.password"
|
||||
chap_pw="-w ${result}"
|
||||
else
|
||||
chap=""
|
||||
chap=""
|
||||
fi
|
||||
|
||||
iscsi_get_rec_val $tmpfile "node.session.auth.username_in"
|
||||
@@ -319,7 +321,7 @@ iscsi_set_parameters() {
|
||||
iscsi_get_rec_val $tmpfile "node.session.auth.password_in"
|
||||
chap_in_pw="-W ${result}"
|
||||
else
|
||||
chap_in=""
|
||||
chap_in=""
|
||||
fi
|
||||
|
||||
rm $tmpfile
|
||||
@@ -395,29 +397,29 @@ handledm() {
|
||||
done << EOF
|
||||
$(dmsetup table -j $major -m $minor 2>/dev/null)
|
||||
EOF
|
||||
local name=$(dmsetup info --noheadings -c -j $major -m $minor -o name)
|
||||
local vg=$(lvshow "/dev/mapper/$name")
|
||||
local raids=$(/sbin/dmraid -s -craidname 2>/dev/null | grep -vi "no raid disks")
|
||||
if [ -n "$vg" ]; then
|
||||
vg=`echo $vg` # strip whitespace
|
||||
case " $vg_list " in
|
||||
*" $vg "*) ;;
|
||||
*) vg_list="$vg_list $vg"
|
||||
[ -z "$nolvm" ] && find_base_dm_mods
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
for raid in $raids ; do
|
||||
if [ "$raid" == "$name" ]; then
|
||||
case " $DMRAIDS " in
|
||||
*" $raid "*) ;;
|
||||
*) DMRAIDS="$DMRAIDS $raid"
|
||||
[ -z "$nodmraid" ] && find_base_dm_mods
|
||||
local name=$(dmsetup info --noheadings -c -j $major -m $minor -o name)
|
||||
local vg=$(lvshow "/dev/mapper/$name")
|
||||
local raids=$(/sbin/dmraid -s -craidname 2>/dev/null | grep -vi "no raid disks")
|
||||
if [ -n "$vg" ]; then
|
||||
vg=`echo $vg` # strip whitespace
|
||||
case " $vg_list " in
|
||||
*" $vg "*) ;;
|
||||
*) vg_list="$vg_list $vg"
|
||||
[ -z "$nolvm" ] && find_base_dm_mods
|
||||
;;
|
||||
esac
|
||||
break
|
||||
fi
|
||||
done
|
||||
for raid in $raids ; do
|
||||
if [ "$raid" == "$name" ]; then
|
||||
case " $DMRAIDS " in
|
||||
*" $raid "*) ;;
|
||||
*) DMRAIDS="$DMRAIDS $raid"
|
||||
[ -z "$nodmraid" ] && find_base_dm_mods
|
||||
;;
|
||||
esac
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
handleiscsi() {
|
||||
@@ -440,25 +442,25 @@ handleraid() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
levels=$(awk "/^$1[ ]*:/ { print\$4 }" /proc/mdstat)
|
||||
levels=$(awk "/^$1[ ]*:/ { print\$4 }" /proc/mdstat)
|
||||
|
||||
for level in $levels ; do
|
||||
case $level in
|
||||
linear)
|
||||
start=1
|
||||
;;
|
||||
multipath)
|
||||
start=1
|
||||
;;
|
||||
raid[01] | raid10)
|
||||
start=1
|
||||
;;
|
||||
raid[456])
|
||||
start=1
|
||||
;;
|
||||
*)
|
||||
error "raid level $level (in /proc/mdstat) not recognized"
|
||||
;;
|
||||
linear)
|
||||
start=1
|
||||
;;
|
||||
multipath)
|
||||
start=1
|
||||
;;
|
||||
raid[01] | raid10)
|
||||
start=1
|
||||
;;
|
||||
raid[456])
|
||||
start=1
|
||||
;;
|
||||
*)
|
||||
error "raid level $level (in /proc/mdstat) not recognized"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [ "$start" = 1 ]; then
|
||||
@@ -474,7 +476,7 @@ lvshow() {
|
||||
|
||||
vgdisplay() {
|
||||
lvm vgdisplay --ignorelockingfailure -v $1 2>/dev/null |
|
||||
sed -n 's/PV Name//p'
|
||||
sed -n 's/PV Name//p'
|
||||
}
|
||||
|
||||
dmmods_found="n"
|
||||
@@ -508,78 +510,78 @@ while [ $# -gt 0 ]; do
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--rootdev*)
|
||||
--rootdev*)
|
||||
if [ "$1" != "${1##--rootdev=}" ]; then
|
||||
rootdev="${1##--rootdev=}"
|
||||
else
|
||||
rootdev="$2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--thawdev*)
|
||||
;;
|
||||
--thawdev*)
|
||||
if [ "$1" != "${1##--thawdev=}" ]; then
|
||||
thawdev="${1##--thawdev=}"
|
||||
else
|
||||
thawdev="$2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--rootfs*)
|
||||
;;
|
||||
--rootfs*)
|
||||
if [ "$1" != "${1##--rootfs=}" ]; then
|
||||
rootfs="${1##--rootfs=}"
|
||||
else
|
||||
rootfs="$2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--rootopts*)
|
||||
;;
|
||||
--rootopts*)
|
||||
if [ "$1" != "${1##--rootopts=}" ]; then
|
||||
rootopts="${1##--rootopts=}"
|
||||
else
|
||||
rootopts="$2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--root*)
|
||||
;;
|
||||
--root*)
|
||||
if [ "$1" != "${1##--root=}" ]; then
|
||||
root="${1##--root=}"
|
||||
else
|
||||
root="$2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--loopdev*)
|
||||
;;
|
||||
--loopdev*)
|
||||
if [ "$1" != "${1##--loopdev=}" ]; then
|
||||
loopdev="${1##--loopdev=}"
|
||||
else
|
||||
loopdev="$2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--loopfs*)
|
||||
;;
|
||||
--loopfs*)
|
||||
if [ "$1" != "${1##--loopfs=}" ]; then
|
||||
loopfs="${1##--loopfs=}"
|
||||
else
|
||||
loopfs="$2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--loopopts*)
|
||||
;;
|
||||
--loopopts*)
|
||||
if [ "$1" != "${1##--loopopts=}" ]; then
|
||||
loopopts="${1##--loopopts=}"
|
||||
else
|
||||
loopopts="$2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--looppath*)
|
||||
;;
|
||||
--looppath*)
|
||||
if [ "$1" != "${1##--looppath=}" ]; then
|
||||
looppath="${1##--looppath=}"
|
||||
else
|
||||
looppath="$2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
;;
|
||||
--help)
|
||||
usage -n
|
||||
;;
|
||||
@@ -597,33 +599,33 @@ while [ $# -gt 0 ]; do
|
||||
shift
|
||||
done
|
||||
|
||||
[ -z "$rootfs" ] && rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' $fstab)
|
||||
[ -z "$rootopts" ] && rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' $fstab)
|
||||
[ -z "$rootopts" ] && rootopts="defaults"
|
||||
[ -z "$rootfs" ] && rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' $fstab)
|
||||
[ -z "$rootopts" ] && rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' $fstab)
|
||||
[ -z "$rootopts" ] && rootopts="defaults"
|
||||
|
||||
|
||||
[ -z "$rootdev" ] && rootdev=$(awk '/^[ \t]*[^#]/ { if ($2 == "/") { print $1; }}' $fstab)
|
||||
[ -z "$rootdev" ] && rootdev=$(awk '/^[ \t]*[^#]/ { if ($2 == "/") { print $1; }}' $fstab)
|
||||
# check if it's nfsroot
|
||||
physdev=""
|
||||
if [ "$rootfs" == "nfs" ]; then
|
||||
if [ "x$net_list" == "x" ]; then
|
||||
handlenfs $rootdev
|
||||
fi
|
||||
else
|
||||
# check if it's root by label
|
||||
rdev=$rootdev
|
||||
rdev=$(resolve_device_name "$rdev")
|
||||
rootopts=$(echo $rootopts | sed -e 's/^r[ow],//' -e 's/,_netdev//' -e 's/_netdev//' -e 's/,r[ow],$//' -e 's/,r[ow],/,/' -e 's/^r[ow]$/defaults/' -e 's/$/,ro/')
|
||||
findstoragedriver "$rdev"
|
||||
physdev=""
|
||||
if [ "$rootfs" == "nfs" ]; then
|
||||
if [ "x$net_list" == "x" ]; then
|
||||
handlenfs $rootdev
|
||||
fi
|
||||
else
|
||||
# check if it's root by label
|
||||
rdev=$rootdev
|
||||
rdev=$(resolve_device_name "$rdev")
|
||||
rootopts=$(echo $rootopts | sed -e 's/^r[ow],//' -e 's/,_netdev//' -e 's/_netdev//' -e 's/,_rnetdev//' -e 's/_rnetdev//' -e 's/,r[ow],$//' -e 's/,r[ow],/,/' -e 's/^r[ow]$/defaults/' -e 's/$/,ro/')
|
||||
findstoragedriver "$rdev"
|
||||
fi
|
||||
|
||||
# find the first swap dev which would get used for swsusp
|
||||
[ -z "$thawdev" ] && thawdev=$(awk '/^[ \t]*[^#]/ { if ($3 == "swap") { print $1; exit }}' $fstab)
|
||||
swsuspdev="$thawdev"
|
||||
if [ -n "$swsuspdev" ]; then
|
||||
swsuspdev=$(resolve_device_name "$swsuspdev")
|
||||
findstoragedriver "$swsuspdev"
|
||||
fi
|
||||
[ -z "$thawdev" ] && thawdev=$(awk '/^[ \t]*[^#]/ { if ($3 == "swap") { print $1; exit }}' $fstab)
|
||||
swsuspdev="$thawdev"
|
||||
if [ -n "$swsuspdev" ]; then
|
||||
swsuspdev=$(resolve_device_name "$swsuspdev")
|
||||
findstoragedriver "$swsuspdev"
|
||||
fi
|
||||
|
||||
|
||||
cemit()
|
||||
@@ -678,7 +680,7 @@ fi
|
||||
|
||||
if [ -z "$nolvm" -a -n "$vg_list" ]; then
|
||||
for vg in $vg_list; do
|
||||
echo -n "rd_LVM_VG=$vg "
|
||||
echo -n "rd_LVM_VG=$vg "
|
||||
done
|
||||
else
|
||||
echo -n "rd_NO_LVM "
|
||||
@@ -712,4 +714,3 @@ if [ -n "$rootdev" ]; then
|
||||
fi
|
||||
|
||||
echo
|
||||
# vim:ts=8:sw=4:sts=4:et
|
||||
|
@@ -1,20 +0,0 @@
|
||||
.TH DRACUT-GENCMDLINE 8 "June 2009" "Linux"
|
||||
.SH NAME
|
||||
dracut-gencmdline \- generates kernel command line parameters for the dracut generated initramfs
|
||||
.SH SYNOPSIS
|
||||
.BR dracut-gencmdline
|
||||
|
||||
.SH DESCRIPTION
|
||||
.B dracut-gencmdline
|
||||
generates kernel command line parameters for the dracut generated initramfs, which are very specific to the host system.
|
||||
|
||||
.SH AUTHORS
|
||||
.nf
|
||||
Harald Hoyer <harald@redhat.com>
|
||||
.fi
|
||||
.SH AVAILABILITY
|
||||
The dracut-gencmdline command is part of the dracut package and is available from
|
||||
http://sourceforge.net/apps/trac/dracut/wiki
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR dracut (8)
|
46
dracut-gencmdline.8.xml
Normal file
46
dracut-gencmdline.8.xml
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
|
||||
<!-- lifted from troff+man by doclifter -->
|
||||
<refentry id='dracutgencmdline8'>
|
||||
<refmeta>
|
||||
<refentrytitle>DRACUT-GENCMDLINE</refentrytitle>
|
||||
<manvolnum>8</manvolnum>
|
||||
<refmiscinfo class='source'>June 2009</refmiscinfo>
|
||||
<refmiscinfo class='manual'>Linux</refmiscinfo>
|
||||
</refmeta>
|
||||
<refnamediv id='name'>
|
||||
<refname>dracut-gencmdline</refname>
|
||||
<refpurpose>generates kernel command line parameters for the dracut generated initramfs</refpurpose>
|
||||
</refnamediv>
|
||||
<!-- body begins here -->
|
||||
<refsynopsisdiv id='synopsis'>
|
||||
<cmdsynopsis>
|
||||
<command>dracut-gencmdline</command>
|
||||
<sbr/>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
|
||||
<refsect1 id='description'><title>DESCRIPTION</title>
|
||||
<para><command>dracut-gencmdline</command>
|
||||
generates kernel command line parameters for the dracut generated initramfs, which are very specific to the host system.</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id='authors'><title>AUTHORS</title>
|
||||
<literallayout remap='.nf'>
|
||||
Harald Hoyer <harald@redhat.com>
|
||||
</literallayout> <!-- .fi -->
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id='availability'><title>AVAILABILITY</title>
|
||||
<para>The dracut-gencmdline command is part of the dracut package and is available from
|
||||
<ulink url='http://sourceforge.net/apps/trac/dracut/wiki'>http://sourceforge.net/apps/trac/dracut/wiki</ulink></para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id='see_also'><title>SEE ALSO</title>
|
||||
<para><citerefentry><refentrytitle>dracut</refentrytitle><manvolnum>8</manvolnum></citerefentry></para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
1764
dracut-rhel6.xml
1764
dracut-rhel6.xml
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,6 @@
|
||||
#!/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
|
||||
|
||||
STATEDIR=/var/lib/dracut
|
||||
BOOTDIR=/boot
|
||||
@@ -11,23 +13,23 @@ version=""
|
||||
set -e
|
||||
|
||||
if $USETRIGGERS \
|
||||
&& [ x"$DPKG_MAINTSCRIPT_PACKAGE" != x ] \
|
||||
&& [ $# = 1 ] \
|
||||
&& [ x"$1" = x-u ] \
|
||||
&& dpkg-trigger --check-supported 2>/dev/null
|
||||
&& [ 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
|
||||
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
|
||||
if [ -n "${1}" ]; then
|
||||
printf "${@}\n\n" >&2
|
||||
fi
|
||||
cat >&2 << EOF
|
||||
Usage: ${0} [OPTION]...
|
||||
|
||||
Options:
|
||||
@@ -41,422 +43,422 @@ Options:
|
||||
-h This message
|
||||
|
||||
EOF
|
||||
exit 1
|
||||
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
|
||||
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
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
mild_panic()
|
||||
{
|
||||
if [ -n "${1}" ]; then
|
||||
printf "${@}\n" >&2
|
||||
fi
|
||||
exit 0
|
||||
if [ -n "${1}" ]; then
|
||||
printf "${@}\n" >&2
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
panic()
|
||||
{
|
||||
if [ -n "${1}" ]; then
|
||||
printf "${@}\n" >&2
|
||||
fi
|
||||
exit 1
|
||||
if [ -n "${1}" ]; then
|
||||
printf "${@}\n" >&2
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
|
||||
verbose()
|
||||
{
|
||||
if [ "${verbose}" = 1 ]; then
|
||||
printf "${@}\n"
|
||||
fi
|
||||
if [ "${verbose}" = 1 ]; then
|
||||
printf "${@}\n"
|
||||
fi
|
||||
}
|
||||
|
||||
version_exists()
|
||||
{
|
||||
[ -e "${STATEDIR}/${1}" ] && [ -e "${initramfs}" ]
|
||||
return $?
|
||||
[ -e "${STATEDIR}/${1}" ] && [ -e "${initramfs}" ]
|
||||
return $?
|
||||
}
|
||||
|
||||
set_initramfs()
|
||||
{
|
||||
initramfs="${BOOTDIR}/dracut.img-${version}"
|
||||
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}"
|
||||
[ ! -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"
|
||||
initramfs_bak="${initramfs}.dpkg-bak"
|
||||
|
||||
# first time run thus no backup
|
||||
[ ! -r "${initramfs_bak}" ] && return 0
|
||||
[ ! -r "${initramfs_bak}" ] && return 0
|
||||
|
||||
# chroot with no /proc
|
||||
[ ! -r /proc/uptime ] && rm -f "${initramfs_bak}" && return 0
|
||||
[ ! -r /proc/uptime ] && rm -f "${initramfs_bak}" && return 0
|
||||
|
||||
# no kept backup wanted
|
||||
[ "${backup_initramfs}" = "no" ] && rm -f "${initramfs_bak}" && return 0
|
||||
[ "${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
|
||||
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}
|
||||
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}"
|
||||
[ -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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
[ -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
|
||||
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
|
||||
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
|
||||
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
|
||||
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 $?
|
||||
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}"
|
||||
sha1sum "${initramfs}" > "${STATEDIR}/${version}"
|
||||
}
|
||||
|
||||
delete_sha1()
|
||||
{
|
||||
rm -f "${STATEDIR}/${version}"
|
||||
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
|
||||
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
|
||||
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=""
|
||||
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
|
||||
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}"
|
||||
verbose "Available versions: ${version_list}"
|
||||
}
|
||||
|
||||
set_current_version()
|
||||
{
|
||||
if [ -f /boot/dracut.img-`uname -r` ]; then
|
||||
version=`uname -r`
|
||||
fi
|
||||
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 /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 [ -e /boot/initrd.img ] && [ -L /boot/initrd.img ]; then
|
||||
linktarget="$(basename "$(readlink /boot/initrd.img)")"
|
||||
fi
|
||||
|
||||
if [ -z "${linktarget}" ]; then
|
||||
return
|
||||
fi
|
||||
if [ -z "${linktarget}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
version="${linktarget##*img-}"
|
||||
version="${linktarget##*img-}"
|
||||
}
|
||||
|
||||
set_highest_version()
|
||||
{
|
||||
get_sorted_versions
|
||||
set -- ${version_list}
|
||||
version=${1}
|
||||
get_sorted_versions
|
||||
set -- ${version_list}
|
||||
version=${1}
|
||||
}
|
||||
|
||||
create()
|
||||
{
|
||||
if [ -z "${version}" ]; then
|
||||
usage "Create mode requires a version argument"
|
||||
fi
|
||||
if [ -z "${version}" ]; then
|
||||
usage "Create mode requires a version argument"
|
||||
fi
|
||||
|
||||
set_initramfs
|
||||
set_initramfs
|
||||
|
||||
if [ "${takeover}" = 0 ]; then
|
||||
if version_exists "${version}"; then
|
||||
panic "Cannot create version ${version}: already exists"
|
||||
fi
|
||||
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
|
||||
if [ -e "${initramfs}" ]; then
|
||||
panic "${initramfs} already exists, cannot create."
|
||||
fi
|
||||
fi
|
||||
|
||||
generate_initramfs
|
||||
generate_initramfs
|
||||
}
|
||||
|
||||
update()
|
||||
{
|
||||
if [ "${update_initramfs}" = "no" ]; then
|
||||
echo "update-initramfs: Not updating initramfs."
|
||||
exit 0
|
||||
fi
|
||||
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_highest_version
|
||||
fi
|
||||
|
||||
if [ -z "${version}" ]; then
|
||||
set_linked_version
|
||||
fi
|
||||
if [ -z "${version}" ]; then
|
||||
set_linked_version
|
||||
fi
|
||||
|
||||
if [ -z "${version}" ]; then
|
||||
set_current_version
|
||||
fi
|
||||
if [ -z "${version}" ]; then
|
||||
set_current_version
|
||||
fi
|
||||
|
||||
if [ -z "${version}" ]; then
|
||||
verbose "Nothing to do, exiting."
|
||||
exit 0
|
||||
fi
|
||||
if [ -z "${version}" ]; then
|
||||
verbose "Nothing to do, exiting."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
set_initramfs
|
||||
set_initramfs
|
||||
|
||||
ro_boot_check
|
||||
ro_boot_check
|
||||
|
||||
altered_check
|
||||
altered_check
|
||||
|
||||
backup_initramfs
|
||||
backup_initramfs
|
||||
|
||||
generate_initramfs
|
||||
generate_initramfs
|
||||
|
||||
run_bootloader
|
||||
run_bootloader
|
||||
|
||||
backup_booted_initramfs
|
||||
backup_booted_initramfs
|
||||
}
|
||||
|
||||
delete()
|
||||
{
|
||||
if [ -z "${version}" ]; then
|
||||
usage "Delete mode requires a version argument"
|
||||
fi
|
||||
if [ -z "${version}" ]; then
|
||||
usage "Delete mode requires a version argument"
|
||||
fi
|
||||
|
||||
set_initramfs
|
||||
set_initramfs
|
||||
|
||||
if [ ! -e "${initramfs}" ]; then
|
||||
panic "Cannot delete ${initramfs}, doesn't exist."
|
||||
fi
|
||||
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
|
||||
if ! version_exists "${version}"; then
|
||||
panic "Cannot delete version ${version}: Not created by this utility."
|
||||
fi
|
||||
|
||||
altered_check
|
||||
altered_check
|
||||
|
||||
echo "update-initramfs: Deleting ${initramfs}"
|
||||
echo "update-initramfs: Deleting ${initramfs}"
|
||||
|
||||
delete_sha1
|
||||
delete_sha1
|
||||
|
||||
rm -f "${initramfs}"
|
||||
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
|
||||
[ "${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
|
||||
@@ -468,91 +470,91 @@ 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
|
||||
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
|
||||
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."
|
||||
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
|
||||
|| ( [ "${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
|
||||
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
|
||||
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
|
||||
;;
|
||||
c)
|
||||
create
|
||||
;;
|
||||
d)
|
||||
delete
|
||||
;;
|
||||
u)
|
||||
update
|
||||
;;
|
||||
esac
|
||||
|
511
dracut.8
511
dracut.8
@@ -1,511 +0,0 @@
|
||||
.TH DRACUT 8 "June 2009" "Linux"
|
||||
.SH NAME
|
||||
dracut \- create initial ramdisk images for preloading modules
|
||||
.SH SYNOPSIS
|
||||
\fBdracut\fR [\fIOPTION\fR]... \fI<image>\fR \fI<kernel-version>\fR
|
||||
|
||||
.SH DESCRIPTION
|
||||
.B dracut
|
||||
creates an initial image used by the kernel for
|
||||
preloading the block device modules (such as IDE, SCSI or RAID)
|
||||
which are needed to access the root filesystem.
|
||||
|
||||
.SS Options
|
||||
.TP
|
||||
.BR \-f ", " \-\-force
|
||||
overwrite existing initramfs file.
|
||||
.TP
|
||||
.BR \-m ", " \-\-modules " \fILIST\fR"
|
||||
specify a space-separated list of dracut modules to call
|
||||
when building the initramfs.
|
||||
Modules are located in
|
||||
.IR /usr/share/dracut/modules.d .
|
||||
.TP
|
||||
.BR \-o ", " \-\-omit " \fILIST\fR"
|
||||
omit a space-separated list of dracut modules.
|
||||
.TP
|
||||
.BR \-a ", " \-\-add " \fILIST\fR"
|
||||
add a space-separated list of dracut modules.
|
||||
.TP
|
||||
.BR \-d ", " \-\-drivers " \fILIST\fR"
|
||||
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.
|
||||
.TP
|
||||
.BR \-\-add-drivers " \fILIST\fR"
|
||||
specify a space-separated list of kernel modules to add to the initramfs.
|
||||
The kernel modules have to be specified without the ".ko" suffix.
|
||||
.TP
|
||||
.BR \-\-omit-drivers " \fILIST\fR"
|
||||
specify a space-separated list of kernel modules to omit from the initramfs.
|
||||
The kernel modules have to be specified without the ".ko" suffix.
|
||||
Regular expressions are also allowed like ".*/fs/ocfs/.*".
|
||||
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes.
|
||||
|
||||
example:
|
||||
# dracut --omit "module1 module2" ...
|
||||
.TP
|
||||
.BR \-\-filesystems " \fILIST\fR"
|
||||
specify a space-separated list of kernel filesystem modules to exclusively
|
||||
include in the generic initramfs.
|
||||
.TP
|
||||
.BR \-k ", " \-\-kmoddir " \fI{DIR}\fR
|
||||
specify the directory, where to look for kernel modules
|
||||
.TP
|
||||
.BR " \-\-fwdir " \fI{DIR}\fR
|
||||
specify additional directory, where to look for firmwares
|
||||
.TP
|
||||
.BR \-\-kernel-only
|
||||
only install kernel drivers and firmware files
|
||||
.TP
|
||||
.BR \-\-no-kernel
|
||||
do not install kernel drivers and firmware files
|
||||
.TP
|
||||
.BR \-\-mdadmconf
|
||||
include local /etc/mdadm.conf
|
||||
.TP
|
||||
.BR \-\-nomdadmconf
|
||||
do not include local /etc/mdadm.conf
|
||||
.TP
|
||||
.BR \-\-strip
|
||||
strip binaries in the initramfs (default)
|
||||
.TP
|
||||
.BR \-\-nostrip
|
||||
do not strip binaries in the initramfs
|
||||
.TP
|
||||
.BR \-h ", " \-\-help
|
||||
display help text and exit.
|
||||
.TP
|
||||
.B \-\-debug
|
||||
output debug information of the build process
|
||||
.TP
|
||||
.BR \-v ", " \-\-verbose
|
||||
verbose output during the build process
|
||||
.TP
|
||||
.BR \-c ", " \-\-conf " \fIFILE\fR"
|
||||
specify configuration file to use.
|
||||
Default:
|
||||
.IR /etc/dracut.conf
|
||||
.TP
|
||||
.BR \-\-confdir " \fIDIR\fR"
|
||||
specify configuration directory to use.
|
||||
Default:
|
||||
.IR /etc/dracut.conf.d
|
||||
.TP
|
||||
.BR \-l ", " \-\-local
|
||||
local mode. Use modules from the current working
|
||||
directory instead of the system-wide installed in
|
||||
.IR /usr/share/dracut/modules.d .
|
||||
Useful when running dracut from a git checkout.
|
||||
.TP
|
||||
.BR \-H ", " \-\-hostonly
|
||||
Host-Only mode: Install only what is needed for
|
||||
booting the local host instead of a generic host.
|
||||
.TP
|
||||
.BR \-i ", " \-\-include " \fISOURCE\fR" "" " \fITARGET\fR"
|
||||
include the files in the SOURCE directory into the
|
||||
target directory in the final initramfs.
|
||||
.TP
|
||||
.BR \-I ", " \-\-install " \fILIST\fR"
|
||||
install the space separated list of files into the initramfs.
|
||||
|
||||
.SH "KERNEL COMMAND LINE"
|
||||
The root filesystem used by the kernel is specified in the boot configuration
|
||||
file, as always. The traditional \fBroot=/dev/hda1\fR style device
|
||||
specification is allowed. If a label is used, as in \fBroot=LABEL=rootPart\fR
|
||||
the initrd will search all available devices for an ext2 or ext3 filesystem
|
||||
with the appropriate label, and mount that device as the root filesystem.
|
||||
\fBroot=UUID=uuidnumber\fR will mount the partition with that UUID as the
|
||||
root filesystem.
|
||||
|
||||
.SS Standard
|
||||
.TP
|
||||
.BR init= "<path to real init>"
|
||||
.TP
|
||||
.BR root= "<path to blockdevice>"
|
||||
specify blockdevice to use as root filesystem.
|
||||
e.g.
|
||||
root=/dev/sda1
|
||||
root=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
|
||||
.TP
|
||||
.BR rootfstype= "<filesystem type>"
|
||||
"auto" if not specified, e.g. rootfstype=ext3
|
||||
.TP
|
||||
.BR rootflags= "<mount options>"
|
||||
specify additional mount options for the root filesystem. If not set, /etc/fstab
|
||||
of the real root will be parsed for special mount options and mounted
|
||||
accordingly.
|
||||
.TP
|
||||
\fBrootfallback=\fR\fI<path to blockdevice>\fR
|
||||
specify the block device to use as the root filesystem, if the normal root cannot be found\&. This can only be a simple block device with a simple file system, for which the filesystem driver is either compiled in, or added manually to the initramfs\&. This parameter can be specified multiple times\&.
|
||||
.TP
|
||||
.B rd_NO_FSTAB
|
||||
do not honor special mount options for the root filesystem found in
|
||||
/etc/fstab of the real root.
|
||||
|
||||
.SS Misc
|
||||
.TP
|
||||
.BR hostname= "<hostname>"
|
||||
set the initial hostname
|
||||
.TP
|
||||
.BR rdblacklist= "<drivername>"
|
||||
do not load kernel module <drivername>
|
||||
This parameter can be specified multiple times.
|
||||
.TP
|
||||
.BR rdloaddriver= "<drivername>"
|
||||
force loading kernel module <drivername>
|
||||
This parameter can be specified multiple times.
|
||||
.TP
|
||||
.BR rd_retry= "<seconds>"
|
||||
wait <seconds> until dracut tries to force assemble LVM or RAID volumes. If the root device is not found within <seconds>*2 then dracut fails and either drops to a shell, if rdshell is on the kernel command line, or exits with 1, which normally causes a kernel panic.
|
||||
|
||||
Default: rd_retry=40
|
||||
|
||||
.SS Debug
|
||||
.TP
|
||||
.B rdinfo
|
||||
print informational output though "quiet" is set
|
||||
.TP
|
||||
.B rdshell
|
||||
allow dropping to a shell, if root mounting fails
|
||||
.TP
|
||||
.B rdinitdebug
|
||||
set -x for the dracut shell and logs to dmesg, console and /init.log
|
||||
.TP
|
||||
.B rdbreak
|
||||
drop to a shell at the end
|
||||
.TP
|
||||
.ad l
|
||||
.BR rdbreak= \%{cmdline\:|pre-udev\:|pre-trigger\:|initqueue\:|pre-mount\:|mount\:|pre-pivot}
|
||||
.ad
|
||||
drop to a shell on defined breakpoint
|
||||
.TP
|
||||
.B rdudevinfo
|
||||
set udev to loglevel info
|
||||
.TP
|
||||
.B rdudevdebug
|
||||
set udev to loglevel debug
|
||||
|
||||
.SS I18N
|
||||
e.g.
|
||||
LANG=en_US.UTF-8
|
||||
SYSFONT=latarcyrheb-sun16
|
||||
KEYTABLE=de-latin1-nodeadkeys
|
||||
.TP
|
||||
.BR KEYBOARDTYPE= sun|pc
|
||||
will be written to /etc/sysconfig/keyboard in the initramfs
|
||||
.TP
|
||||
.BR KEYTABLE= "<keytable filename>"
|
||||
will be written to /etc/sysconfig/keyboard in the initramfs
|
||||
.TP
|
||||
.BR SYSFONT= "Console font"
|
||||
will be written to /etc/sysconfig/i18n in the initramfs
|
||||
.TP
|
||||
.BR SYSFONTACM= "Unicode font map"
|
||||
will be written to /etc/sysconfig/i18n in the initramfs
|
||||
.TP
|
||||
.BR UNIMAP= "Unicode font map"
|
||||
will be written to /etc/sysconfig/i18n in the initramfs
|
||||
.TP
|
||||
.BR LANG= <locale>
|
||||
will be written to /etc/sysconfig/i18n in the initramfs
|
||||
|
||||
.SS LVM
|
||||
.TP
|
||||
.BR rd_NO_LVM
|
||||
disable LVM detection
|
||||
.TP
|
||||
.BR rd_LVM_VG= "<volume group name>"
|
||||
only activate the volume groups with the given name
|
||||
rd_LVM_VG can be specified multiple times on the kernel command line.
|
||||
.TP
|
||||
.BR rd_LVM_LV= "<logical volume name>"
|
||||
only activate the logical volumes with the given name
|
||||
rd_LVM_LV can be specified multiple times on the kernel command line.
|
||||
.TP
|
||||
.BR rd_NO_LVMCONF
|
||||
remove any /etc/lvm/lvm.conf, which may exist in the initramfs
|
||||
|
||||
.SS "crypto LUKS"
|
||||
.TP
|
||||
.BR rd_NO_LUKS
|
||||
disable crypto LUKS detection
|
||||
.TP
|
||||
.BR rd_LUKS_UUID= "<luks uuid>"
|
||||
only activate the LUKS partitions with the given UUID
|
||||
Any "luks-" of the LUKS UUID is removed before comparing to <luks uuid>.
|
||||
The comparisons also matches, if <luks uuid> is only the beginning of the
|
||||
LUKS UUID, so you don't have to specify the full UUID.
|
||||
This parameter can be specified multiple times.
|
||||
.TP
|
||||
.BR rd_NO_CRYPTTAB
|
||||
do not check, if LUKS partition is in /etc/crypttab
|
||||
|
||||
.SS MD
|
||||
.TP
|
||||
.BR rd_NO_MD
|
||||
disable MD RAID detection
|
||||
.TP
|
||||
.BR rd_NO_MDIMSM
|
||||
no MD RAID for imsm/isw raids, use dmraid instead
|
||||
.TP
|
||||
.BR rd_NO_MDADMCONF
|
||||
ignore mdadm.conf included in initramfs
|
||||
.TP
|
||||
.BR rd_MD_UUID= "<md uuid>"
|
||||
only activate the raid sets with the given UUID.
|
||||
This parameter can be specified multiple times.
|
||||
|
||||
.SS DMRAID
|
||||
.TP
|
||||
.BR rd_NO_DM
|
||||
disable DM RAID detection
|
||||
.TP
|
||||
.BR rd_DM_UUID= "<dmraid uuid>"
|
||||
only activate the raid sets with the given UUID.
|
||||
This parameter can be specified multiple times.
|
||||
|
||||
.SS MULTIPATH
|
||||
.TP
|
||||
.BR rd_NO_MULTIPATH
|
||||
disable multipath in the initramfs
|
||||
|
||||
.SS FIPS
|
||||
.TP
|
||||
.BR fips=1
|
||||
enable FIPS
|
||||
.TP
|
||||
.BR boot=<boot device>
|
||||
specify the device, where /boot is located
|
||||
e.g.
|
||||
boot=/dev/sda1
|
||||
boot=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
|
||||
boot=UUID=<uuid>
|
||||
boot=LABEL=<label>
|
||||
|
||||
If the root device is encrypted, the /boot partition must reside on a seperate partition and has to be specified.
|
||||
|
||||
.SS Network
|
||||
.TP
|
||||
.BR ip= {dhcp|on|any|dhcp6|auto6|ibft}
|
||||
dhcp|on|any: get ip from dhcp server from all interfaces. If root=dhcp,
|
||||
loop sequentially through all interfaces (eth0, eth1, ...) and use the first
|
||||
with a valid DHCP root-path.
|
||||
.sp
|
||||
\fBauto6\fR: IPv6 autoconfiguration
|
||||
.sp
|
||||
\fBdhcp6\fR: IPv6 DHCP
|
||||
.sp
|
||||
\fBibft\fR: iBFT autoconfiguration
|
||||
|
||||
.TP
|
||||
.BR ip= <interface>:{dhcp|on|any|dhcp6|auto6}
|
||||
dhcp|on|any|dhcp6: get ip from dhcp server on a specific interface
|
||||
auto6: do IPv6 autoconfiguration
|
||||
This parameter can be specified multiple times.
|
||||
|
||||
.TP
|
||||
.ad l
|
||||
.BR ip= "\%<client-IP>\::[<server-id>]\::<gateway-IP>\::<netmask>\::<client\%hostname>\::<interface>\::{none|off}"
|
||||
.ad
|
||||
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.
|
||||
.TP
|
||||
.BR ifname= <interface>:<MAC>
|
||||
Assign network device name <interface> (ie eth0) to the NIC with MAC <MAC>.
|
||||
Note that if you use this option you \fBmust\fR specify an ifname= argument
|
||||
for all interfaces used in ip= or fcoe= arguments
|
||||
This parameter can be specified multiple times.
|
||||
.TP
|
||||
.BR bootdev= <interface>
|
||||
specify network interface to use routing and netroot information from.
|
||||
Required if multiple ip= lines are used.
|
||||
.TP
|
||||
.BR nameserver= "<IP> [nameserver=<IP> ...]"
|
||||
specify nameserver(s) to use
|
||||
.TP
|
||||
.BR vlan= "<vlanname>:<phydevice>"
|
||||
Setup vlan device named <vlanname> on <phydeivce>.
|
||||
We support the four styles of vlan names: VLAN_PLUS_VID (vlan0005), VLAN_PLUS_VID_NO_PAD (vlan5),
|
||||
DEV_PLUS_VID (eth0.0005), DEV_PLUS_VID_NO_PAD (eth0.5)
|
||||
This parameter can be specified multiple times.
|
||||
.TP
|
||||
.BR bridge= "<bridgename>:<ethnames>"
|
||||
Setup bridge <bridgename> with <ethnames>\&. <ethnames> is a comma\-separated list of physical (ethernet) interfaces\&. Bridge without parameters assumes bridge=br0:eth0
|
||||
.TP
|
||||
.BR bond= "<bondname>[:<bondslaves>:[:<options>]]"
|
||||
Setup bonding device <bondname> on top of <bondslaves>\&. <bondslaves> is a comma\-separated list of physical (ethernet) interfaces\&. <options> is a comma\-separated list on bonding options (modinfo bonding for details) in format compatible with initscripts\&. If <options> includes multi\-valued arp_ip_target option, then its values should be separated by semicolon\&. Bond without parameters assumes bond=bond0:eth0,eth1:mode=balance\-rr
|
||||
.TP
|
||||
.BR biosdevname={0|1]}
|
||||
turn off/on biosdevname network interface renaming
|
||||
.SS NFS
|
||||
.TP
|
||||
.BR root= "[<server-ip>:]<root-dir>[:<nfs-options>]"
|
||||
mount nfs share from <server-ip>:/<root-dir>, if no server-ip is given,
|
||||
use dhcp next_server. if server-ip is an IPv6 address it has to be put in brackets, e.g. [2001:DB8::1].
|
||||
NFS options can be appended with the prefix ":" or "," and are seperated by ",".
|
||||
.TP
|
||||
.BR root= "nfs:[<server-ip>:]<root-dir>[:<nfs-options>]"
|
||||
.TP
|
||||
.BR root= "nfs4:[<server-ip>:]<root-dir>[:<nfs-options>]"
|
||||
.TP
|
||||
.BR root= dhcp|dhcp6
|
||||
root=dhcp alone directs initrd to look at the DHCP root-path where NFS
|
||||
options can be specified.
|
||||
root-path=<server-ip>:<root-dir>[,<nfs-options>]
|
||||
root-path=nfs:<server-ip>:<root-dir>[,<nfs-options>]
|
||||
root-path=nfs4:<server-ip>:<root-dir>[,<nfs-options>]
|
||||
.TP
|
||||
.BR root= /dev/nfs " nfsroot=" "[<server-ip>:]<root-dir>[,<nfs-options>]"
|
||||
\fBDeprecated!\fR kernel Documentation/filesystems/nfsroot.txt defines
|
||||
this method.
|
||||
This is supported by dracut but not recommended.
|
||||
.TP
|
||||
.BR rd_NFS_DOMAIN= "<NFSv4 domain name>"
|
||||
Set the NFSv4 domain name. Will overwrite the settings in /etc/idmap.conf.
|
||||
|
||||
.SS iSCSI
|
||||
.TP
|
||||
.ad l
|
||||
.BR root= "\%iscsi:[username:password\:[:reverse:password]@]\:[<servername>]\::[<protocol>]\::[<port>]\:[:[<iscsi_iface_name>]:[<netdev_name>]]\::[<LUN>]\::<targetname>"
|
||||
.ad
|
||||
protocol defaults to "6", LUN defaults to "0".
|
||||
|
||||
If the "servername" field is provided by BOOTP or DHCP, then that
|
||||
field is used in conjunction with other associated fields to contact
|
||||
the boot server in the Boot stage (Section 7). However, if the
|
||||
"servername" field is not provided, then the "targetname" field is
|
||||
then used in the Discovery Service stage in conjunction with other
|
||||
associated fields.
|
||||
|
||||
http://tools.ietf.org/html/rfc4173
|
||||
|
||||
.TP
|
||||
.ad l
|
||||
.BR root= "\%iscsi:[username:password\:[:reverse:password]@]\:[<servername>]\::[<protocol>]\::[<port>]\:[:[<iscsi_iface_name>]:[<netdev_name>]]\::[<LUN>]\::<targetname>"
|
||||
.ad
|
||||
e.g. root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
|
||||
|
||||
.ad l
|
||||
If servername is an IPv6 address, it has to be put in brackets.
|
||||
e.g.
|
||||
root=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0
|
||||
.TP
|
||||
.ad l
|
||||
.BR root= ??? " netroot=" "\%iscsi:[username:password[:reverse:password]@]\:[<servername>]\::[<protocol>]\::[<port>]\:[:[<iscsi_iface_name>]:[<netdev_name>]]\::[<LUN>]\::<targetname> ..."
|
||||
.ad
|
||||
multiple netroot options allow setting up multiple iscsi disks
|
||||
e.g.
|
||||
root=UUID=12424547
|
||||
netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
|
||||
netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1
|
||||
|
||||
.ad l
|
||||
If servername is an IPv6 address, it has to be put in brackets.
|
||||
e.g.
|
||||
netroot=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0
|
||||
.TP
|
||||
.ad l
|
||||
.BR \%root= \%??? " \%iscsi_initiator=" \%<initiator> " \%iscsi_target_name=" "<target name>" " \%iscsi_target_ip=" "<target ip>" " \%iscsi_target_port=" "<target port>" " \%iscsi_target_group=" "<target group>" " \%iscsi_username=" "<username>" " \%iscsi_password=" <password> " \%iscsi_in_username=" "<in username>" " \%iscsi_in_password=" "<in password>"
|
||||
.ad
|
||||
manually specify all iscsistart parameter (see \fIiscsistart\ --help\fR)
|
||||
|
||||
.TP
|
||||
.BR root= ??? " netroot=iscsi iscsi_firmware"
|
||||
will read the iscsi parameter from the BIOS firmware
|
||||
|
||||
.TP
|
||||
.BR iscsi_param= <param>
|
||||
<param> will be passed as "--param <param>" to iscsistart.
|
||||
This parameter can be specified multiple times.
|
||||
e.g.:
|
||||
"netroot=iscsi iscsi_firmware iscsi_param=node.session.timeo.replacement_timeout=30"
|
||||
will result in
|
||||
iscsistart -b --param node.session.timeo.replacement_timeout=30
|
||||
|
||||
.SS FCoE
|
||||
.TP
|
||||
.BR fcoe=<edd|interface|MAC>:<dcb|nodcb>
|
||||
Try to connect to a FCoE SAN through the NIC specified by <interface> or <MAC> or EDD settings.
|
||||
This parameter can be specified multiple times.
|
||||
|
||||
.SS NBD
|
||||
.TP
|
||||
.BR root= nbd:<server>:<port>[:<fstype>][:<mountopts>]
|
||||
mount nbd share from <server>
|
||||
.TP
|
||||
.BR root= dhcp
|
||||
with dhcp root-path=nbd:<server>:<port>[:<fstype>][:<mountopts>]
|
||||
root=dhcp alone directs initrd to look at the DHCP root-path where NBD
|
||||
options can be specified.
|
||||
This syntax is only usable in cases where you are directly mounting the volume
|
||||
as the rootfs.
|
||||
|
||||
|
||||
.SS DASD
|
||||
.TP
|
||||
.BR rd_DASD_MOD= ....
|
||||
same syntax as the kernel module parameter (s390 only)
|
||||
|
||||
.TP
|
||||
.ad l
|
||||
.BR rd_DASD= "\%<dasd adaptor device bus ID>\:[,readonly=X]\:[,use_diag=X]\:[,erplog=X]\:[,failfast=X]"
|
||||
.ad
|
||||
activate DASD device with the given adaptor device bus ID and setting the sysfs attributes
|
||||
to the specified values
|
||||
This parameter can be specified multiple times.
|
||||
|
||||
.SS ZFCP
|
||||
.TP
|
||||
.BR rd_ZFCP= "<zfcp adaptor device bus ID>,\:<WWPN>,\:<FCPLUN>"
|
||||
rd_ZFCP can be specified multiple times on the kernel command line.
|
||||
|
||||
example: rd_ZFCP=0.0.4000,0x5005076300C213e9,0x5022000000000000
|
||||
.TP
|
||||
.BR rd_NO_ZFCPCONF
|
||||
ignore zfcp.conf included in the initramfs
|
||||
|
||||
.SS ZNET
|
||||
.TP
|
||||
.BR rd_ZNET= "<nettype>,<subchannels>,<options>"
|
||||
rd_ZNET can be specified multiple times on the kernel command line. Examples:
|
||||
rd_ZNET=qeth,0.0.0600,0.0.0601,0.0.0602,layer2=1,portname=foo
|
||||
rd_ZNET=ctc,0.0.0600,0.0.0601,0.0.0602,protocol=bar
|
||||
|
||||
.SS "Plymouth Boot Splash"
|
||||
.TP
|
||||
.BR rd_NO_PLYMOUTH
|
||||
do not start plymouth. This will not work with encrypted partitions.
|
||||
|
||||
.SH FILES
|
||||
.TP
|
||||
.B /var/log/dracut.log
|
||||
.TP
|
||||
.B /etc/dracut.conf
|
||||
see \fBdracut.conf\fR(5)
|
||||
.SS "Configuration in the Initramfs"
|
||||
.TP
|
||||
.B /etc/conf.d/
|
||||
Any files found in /etc/conf.d/ will be sourced in the initramfs to
|
||||
set initial values. Command line options will override these values
|
||||
set in the configuration files.
|
||||
.TP
|
||||
.B /etc/cmdline
|
||||
Can contain additional command line options.
|
||||
|
||||
.SH AUTHORS
|
||||
.nf
|
||||
Harald Hoyer <harald@redhat.com>
|
||||
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>
|
||||
.fi
|
||||
.SH AVAILABILITY
|
||||
The dracut command is part of the dracut package and is available from
|
||||
http://sourceforge.net/apps/trac/dracut/wiki
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR dracut.conf (5)
|
484
dracut.8.xml
Normal file
484
dracut.8.xml
Normal file
@@ -0,0 +1,484 @@
|
||||
<?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" []>
|
||||
<refentry id="dracut8">
|
||||
<refentryinfo>
|
||||
<title>dracut</title>
|
||||
<productname>dracut</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Project Leader, Developer</contrib>
|
||||
<firstname>Harald</firstname>
|
||||
<surname>Hoyer</surname>
|
||||
<email>harald@redhat.com</email>
|
||||
</author>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Victor</firstname>
|
||||
<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>
|
||||
<surname>Seewer</surname>
|
||||
<email>philippe.seewer@bfh.ch</email>
|
||||
</author>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>David</firstname>
|
||||
<surname>Dillow</surname>
|
||||
<email>dave@thedillows.org</email>
|
||||
</author>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Amadeusz</firstname>
|
||||
<surname>Żołnowski</surname>
|
||||
<email>aidecoe@aidecoe.name</email>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
<refmeta>
|
||||
<refentrytitle>dracut</refentrytitle>
|
||||
<manvolnum>8</manvolnum>
|
||||
<refmiscinfo class="version"/>
|
||||
</refmeta>
|
||||
<refnamediv>
|
||||
<refname>dracut</refname>
|
||||
<refpurpose>create initial ramdisk images for preloading modules</refpurpose>
|
||||
</refnamediv>
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>dracut</command>
|
||||
<arg choice="opt" rep="repeat">
|
||||
<replaceable>OPTION</replaceable>
|
||||
</arg>
|
||||
<arg choice="opt">
|
||||
<replaceable><image></replaceable>
|
||||
<arg choice="opt">
|
||||
<replaceable><kernel-version></replaceable>
|
||||
</arg>
|
||||
</arg>
|
||||
<sbr/>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<para><command>dracut</command>
|
||||
creates an initial image used by the kernel for
|
||||
preloading the block device modules (such as IDE, SCSI or RAID)
|
||||
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>
|
||||
<manvolnum>7</manvolnum>
|
||||
</citerefentry>
|
||||
</para>
|
||||
<refsect2>
|
||||
<title>Options</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>-f</option>
|
||||
</term>
|
||||
<term>
|
||||
<option>--force</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>overwrite existing initramfs file.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>-m</option>
|
||||
</term>
|
||||
<term>
|
||||
<option>--modules <replaceable><list of dracut modules></replaceable></option>
|
||||
</term>
|
||||
<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>. This parameter can be specified multiple times.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>-o</option>
|
||||
</term>
|
||||
<term>
|
||||
<option>--omit <replaceable><list of dracut modules></replaceable></option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>omit a space-separated list of dracut modules. This parameter can be specified multiple times.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>-a</option>
|
||||
</term>
|
||||
<term>
|
||||
<option>--add <replaceable><list of dracut modules></replaceable></option>
|
||||
</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>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>-d</option>
|
||||
</term>
|
||||
<term>
|
||||
<option>--drivers <replaceable><list of kernel modules></replaceable></option>
|
||||
</term>
|
||||
<listitem>
|
||||
<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>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--add-drivers <replaceable><list of kernel modules></replaceable></option>
|
||||
</term>
|
||||
<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>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--filesystems <replaceable><list of filesystems></replaceable></option>
|
||||
</term>
|
||||
<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>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>-k</option>
|
||||
</term>
|
||||
<term>
|
||||
<option>--kmoddir <replaceable><kernel directory></replaceable></option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>specify the directory, where to look for kernel modules</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option> --fwdir <replaceable><dir>[:<dir>...]</replaceable></option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>specify additional directories, where to look for firmwares. This parameter can be specified multiple times.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--kernel-only</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>only install kernel drivers and firmware files</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--no-kernel</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>do not install kernel drivers and firmware files</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--mdadmconf</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>include local <filename>/etc/mdadm.conf</filename></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--nomdadmconf</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>do not include local <filename>/etc/mdadm.conf</filename></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--strip</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>strip binaries in the initramfs (default)</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--nostrip</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>do not strip binaries in the initramfs</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>-h</option>
|
||||
</term>
|
||||
<term>
|
||||
<option>--help</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>display help text and exit.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--debug</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>output debug information of the build process</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>-v</option>
|
||||
</term>
|
||||
<term>
|
||||
<option>--verbose</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>verbose output during the build process</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>-c</option>
|
||||
</term>
|
||||
<term>
|
||||
<option>--conf <replaceable><dracut configuration file></replaceable></option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>specify configuration file to use.
|
||||
Default:
|
||||
<filename>/etc/dracut.conf</filename></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--confdir <replaceable><configuration directory></replaceable></option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>specify configuration directory to use.
|
||||
Default:
|
||||
<filename>/etc/dracut.conf.d</filename></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>-l</option>
|
||||
</term>
|
||||
<term>
|
||||
<option>--local</option>
|
||||
</term>
|
||||
<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>.
|
||||
Thsi is useful when running dracut from a git checkout.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>-H</option>
|
||||
</term>
|
||||
<term>
|
||||
<option>--hostonly</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Host-Only mode: Install only what is needed for booting
|
||||
the local host instead of a generic host.
|
||||
<warning>
|
||||
<para>If chrooted to another root other than the real root device, use "--fstab" and provide a valid <filename>/etc/fstab</filename>.</para>
|
||||
</warning></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--fstab</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Use <filename>/etc/fstab</filename> instead of <filename>/proc/self/mountinfo</filename>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>-i</option>
|
||||
</term>
|
||||
<term>
|
||||
<option>--include <replaceable><source directory></replaceable> <replaceable><target directory></replaceable></option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>include the files in the source directory into the
|
||||
target directory in the final initramfs.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>-I</option>
|
||||
</term>
|
||||
<term>
|
||||
<option>--install <replaceable><file list></replaceable></option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>install the space separated list of files into the initramfs.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--gzip</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Compress the generated initramfs using gzip.
|
||||
This will be done by default, unless another compression option or --no-compress is passed.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--bzip2</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Compress the generated initramfs using bzip2.
|
||||
<warning>
|
||||
<para>Make sure your kernel has bzip2 decompression support compiled in, otherwise you will not be able to boot.</para>
|
||||
</warning></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--lzma</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Compress the generated initramfs using lzma.
|
||||
<warning>
|
||||
<para>Make sure your kernel has lzma decompression support compiled in, otherwise you will not be able to boot.</para>
|
||||
</warning></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--no-compress</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Do not compress the generated initramfs. This will override any other compression options.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--list-modules</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>List all available dracut modules.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Files</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<filename>/var/log/dracut.log</filename>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>logfile of initramfs image creation</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<filename>/tmp/dracut.log</filename>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>logfile of initramfs image creation, if <filename>/var/log/dracut.log</filename> is not writable</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<filename>/etc/dracut.conf</filename>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>see <citerefentry>
|
||||
<refentrytitle>dracut.conf</refentrytitle>
|
||||
<manvolnum>5</manvolnum>
|
||||
</citerefentry></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<filename>/etc/dracut.conf.d/*.conf</filename>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>see <citerefentry>
|
||||
<refentrytitle>dracut.conf</refentrytitle>
|
||||
<manvolnum>5</manvolnum>
|
||||
</citerefentry></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<refsect2>
|
||||
<title>Configuration in the Initramfs</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<filename>/conf/conf.d/</filename>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Any files found in <filename>/conf/conf.d/</filename> will be sourced in the initramfs to
|
||||
set initial values. Command line options will override these values
|
||||
set in the configuration files.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<filename>/etc/cmdline</filename>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Can contain additional command line options.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Availability</title>
|
||||
<para>The dracut command is part of the dracut package and is available from
|
||||
<ulink url="http://sourceforge.net/apps/trac/dracut/wiki">http://sourceforge.net/apps/trac/dracut/wiki</ulink></para>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
<para>
|
||||
<citerefentry>
|
||||
<refentrytitle>dracut.kernel</refentrytitle>
|
||||
<manvolnum>7</manvolnum>
|
||||
</citerefentry>
|
||||
<citerefentry>
|
||||
<refentrytitle>dracut.conf</refentrytitle>
|
||||
<manvolnum>5</manvolnum>
|
||||
</citerefentry>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
@@ -1,78 +0,0 @@
|
||||
.TH DRACUT.CONF 5 "NOV 2009" "Linux"
|
||||
.SH NAME
|
||||
dracut.conf \- configuration file for dracut
|
||||
|
||||
.SH SYNOPSIS
|
||||
\fB/etc/dracut.conf\fR
|
||||
|
||||
.SH DESCRIPTION
|
||||
.B dracut.conf
|
||||
is loaded during the initialisation phase of dracut.
|
||||
Command line parameter will overwrite any values set here.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.BR dracutmodules+= \%"\ [LIST]\ "
|
||||
Specify a space-separated list of dracut modules to
|
||||
call when building the initramfs. Modules are located
|
||||
in /usr/share/dracut/modules.d.
|
||||
.TP
|
||||
.BR omit_dracutmodules+= \%"\ [LIST]\ "
|
||||
Omit a space-separated list of dracut modules.
|
||||
.TP
|
||||
.BR add_dracutmodules+= \%"\ [LIST]\ "
|
||||
Add a space-separated list of dracut modules.
|
||||
.TP
|
||||
.BR drivers+= \%"\ [LIST]\ "
|
||||
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.
|
||||
.TP
|
||||
.BR add_drivers+= \%"\ [LIST]\ "
|
||||
Specify a space-separated list of kernel
|
||||
modules to add to the initramfs.
|
||||
The kernel modules have to be specified without the ".ko" suffix.
|
||||
.TP
|
||||
.BR omit_drivers+= \%"\ [LIST]\ "
|
||||
Specify a space-separated list of kernel
|
||||
modules to omit from the initramfs.
|
||||
The kernel modules have to be specified without the ".ko" suffix.
|
||||
Regular expressions are also allowed like ".*/fs/foo/.* .*/fs/bar/.*".
|
||||
.TP
|
||||
.BR filesystems+= \%"\ [LIST]\ "
|
||||
Specify a space-separated list of kernel filesystem
|
||||
modules to exclusively include in the generic
|
||||
initramfs.
|
||||
.TP
|
||||
.BR drivers_dir= \%"<dir>"
|
||||
Specify the directory, where to look for kernel modules
|
||||
.TP
|
||||
.BR fw_dir+= \%":<dir>[:<dir>\ ...]"
|
||||
Specify additional directories, where to look for firmwares, separated by :
|
||||
.TP
|
||||
.BR do_strip= \%"yes|no"
|
||||
Strip binaries in the initramfs (default=yes)
|
||||
.TP
|
||||
.BR hostonly= \%"yes|no"
|
||||
Host-Only mode: Install only what is needed for booting
|
||||
the local host instead of a generic host.
|
||||
.TP
|
||||
.BR mdadmconf= \%"yes|no"
|
||||
Include local /etc/mdadm.conf (default=yes)
|
||||
.TP
|
||||
.BR lvmconf= \%"yes|no"
|
||||
Include local /etc/lvm/lvm.conf (default=yes)
|
||||
.TP
|
||||
.BR kernel_only= \%"yes|no"
|
||||
Only install kernel drivers and firmware files. (default=no)
|
||||
.TP
|
||||
.BR no_kernel= \%"yes|no"
|
||||
Do not install kernel drivers and firmware files (default=no)
|
||||
.TP
|
||||
\fBinstall_items+=\fR"\ \&\fI<file>\fR[ \fI<file>\fR\ \&\&...]\ \&"
|
||||
|
||||
Specify additional files to include in the initramfs, separated by spaces.
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR dracut (8)
|
||||
|
201
dracut.conf.5.xml
Normal file
201
dracut.conf.5.xml
Normal file
@@ -0,0 +1,201 @@
|
||||
<?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" []>
|
||||
<refentry id="dracutconf5">
|
||||
<refentryinfo>
|
||||
<title>dracut.conf</title>
|
||||
<productname>dracut</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Harald</firstname>
|
||||
<surname>Hoyer</surname>
|
||||
<email>harald@redhat.com</email>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
<refmeta>
|
||||
<refentrytitle>dracut.conf</refentrytitle>
|
||||
<manvolnum>5</manvolnum>
|
||||
</refmeta>
|
||||
<refnamediv>
|
||||
<refname>dracut.conf</refname>
|
||||
<refpurpose>configuration file(s) for dracut</refpurpose>
|
||||
</refnamediv>
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>/etc/dracut.conf</command>
|
||||
<arg choice="plain">
|
||||
<replaceable>/etc/dracut.conf.d/*.conf</replaceable>
|
||||
</arg>
|
||||
<sbr/>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<para><filename>dracut.conf</filename>
|
||||
is loaded during the initialisation phase of dracut.
|
||||
Command line parameter will overwrite any values set here.
|
||||
<emphasis><filename>dracut.conf.d/*.conf</filename> files are read in alphanumerical order and will</emphasis>
|
||||
overwrite parameters set in <filename>/etc/dracut.conf</filename>. Each line specifies an attribute and a value. A '#' indicates the beginning of a comment; following characters, up to the end of the line are not interpreted.</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>dracutmodules+=" <replaceable><dracut modules></replaceable> "</envar>
|
||||
</term>
|
||||
<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>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>omit_dracutmodules+=" <replaceable><dracut modules></replaceable> "</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Omit a space-separated list of dracut modules.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>add_dracutmodules+=" <replaceable><dracut modules></replaceable> "</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Add a space-separated list of dracut modules.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>drivers+=" <replaceable><kernel modules></replaceable> "</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<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.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>add_drivers+=" <replaceable><kernel modules></replaceable> "</envar>
|
||||
</term>
|
||||
<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.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>filesystems+=" <replaceable><filesystem names></replaceable> "</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Specify a space-separated list of kernel filesystem
|
||||
modules to exclusively include in the generic
|
||||
initramfs.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>drivers_dir="<replaceable><kernel modules directory></replaceable>"</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Specify the directory, where to look for kernel modules</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>fw_dir+=" :<replaceable><dir></replaceable>[:<replaceable><dir></replaceable> ...] "</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Specify additional directories, where to look for firmwares, separated by <constant>:</constant></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>do_strip="<replaceable>{yes|no}</replaceable>"</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Strip binaries in the initramfs (default=yes)</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>hostonly="<replaceable>{yes|no}</replaceable>"</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Host-Only mode: Install only what is needed for booting
|
||||
the local host instead of a generic host.
|
||||
<warning><para>If chrooted to another root other than the real root device, use <option>--fstab</option> and provide a valid <filename>/etc/fstab</filename>.</para>
|
||||
</warning>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>use_fstab="<replaceable>{yes|no}</replaceable>"</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Use <filename>/etc/fstab</filename> instead of <filename>/proc/self/mountinfo</filename>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>mdadmconf="<replaceable>{yes|no}</replaceable>"</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Include local <filename>/etc/mdadm.conf</filename> (default=yes)</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>lvmconf="<replaceable>{yes|no}</replaceable>"</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Include local <filename>/etc/lvm/lvm.conf</filename> (default=yes)</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>kernel_only="<replaceable>{yes|no}</replaceable>"</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Only install kernel drivers and firmware files. (default=no)</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>no_kernel="<replaceable>{yes|no}</replaceable>"</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Do not install kernel drivers and firmware files (default=no)</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Files</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<filename>/etc/dracut/conf.d/</filename>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Any <filename>/etc/dracut/conf.d/*.conf</filename> file can overwrite the values in <filename>/etc/dracut.conf</filename>.
|
||||
The configuration files are read in alphanumerical order.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
<para><citerefentry>
|
||||
<refentrytitle>dracut</refentrytitle>
|
||||
<manvolnum>8</manvolnum>
|
||||
</citerefentry>
|
||||
<citerefentry>
|
||||
<refentrytitle>dracut.kernel</refentrytitle>
|
||||
<manvolnum>7</manvolnum>
|
||||
</citerefentry>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
6
dracut.conf.d/fedora.conf.example
Normal file
6
dracut.conf.d/fedora.conf.example
Normal file
@@ -0,0 +1,6 @@
|
||||
# /etc/dracut.conf.d/redhat.conf
|
||||
# Dracut config file customized for RedHat/Fedora.
|
||||
|
||||
# i18n
|
||||
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
|
||||
add_dracutmodules+=" rpmversion fips "
|
9
dracut.conf.d/gentoo-openrc.conf.example
Normal file
9
dracut.conf.d/gentoo-openrc.conf.example
Normal file
@@ -0,0 +1,9 @@
|
||||
# /etc/dracut.conf.d/gentoo-openrc.conf
|
||||
# Dracut config file customized for Gentoo Base System release 2
|
||||
|
||||
#
|
||||
# Modules
|
||||
#
|
||||
|
||||
# i18n
|
||||
i18n_vars="/etc/conf.d/keymaps:keymap-KEYMAP,extended_keymaps-EXT_KEYMAPS /etc/conf.d/consolefont:consolefont-FONT,consoletranslation-FONT_MAP /etc/rc.conf:unicode-UNICODE"
|
9
dracut.conf.d/gentoo.conf.example
Normal file
9
dracut.conf.d/gentoo.conf.example
Normal file
@@ -0,0 +1,9 @@
|
||||
# /etc/dracut.conf.d/gentoo.conf
|
||||
# Dracut config file customized for Gentoo Base System release 1
|
||||
|
||||
#
|
||||
# Modules
|
||||
#
|
||||
|
||||
# i18n
|
||||
i18n_vars="/etc/conf.d/keymaps:KEYMAP,EXTENDED_KEYMAPS-EXT_KEYMAPS /etc/conf.d/consolefont:CONSOLEFONT-FONT,CONSOLETRANSLATION-FONT_MAP /etc/rc.conf:UNICODE"
|
5
dracut.conf.d/suse.conf.example
Normal file
5
dracut.conf.d/suse.conf.example
Normal file
@@ -0,0 +1,5 @@
|
||||
i18n_vars="/etc/sysconfig/language:RC_LANG-LANG,RC_LC_ALL-LC_ALL /etc/sysconfig/console:CONSOLE_UNICODEMAP-FONT_UNIMAP,CONSOLE_FONT-FONT,CONSOLE_SCREENMAP-FONT_MAP /etc/sysconfig/keyboard:KEYTABLE-KEYMAP"
|
||||
|
||||
omit_dracutmodules+=" selinux "
|
||||
|
||||
|
1221
dracut.kernel.7.xml
Normal file
1221
dracut.kernel.7.xml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,9 +0,0 @@
|
||||
/var/log/dracut.log {
|
||||
missingok
|
||||
notifempty
|
||||
compress
|
||||
delaycompress
|
||||
copytruncate
|
||||
size 1M
|
||||
create 0600 root root
|
||||
}
|
242
dracut.spec
242
dracut.spec
@@ -1,27 +1,51 @@
|
||||
# Variables must be defined
|
||||
%define with_switch_root 1
|
||||
%define with_nbd 1
|
||||
%define with_nbd 1
|
||||
|
||||
# switchroot provided by util-linux-ng in F-12+
|
||||
%if 0%{?fedora} > 11 || 0%{?rhel} >= 6
|
||||
%define with_switch_root 0
|
||||
%endif
|
||||
# nbd in Fedora only
|
||||
%if 0%{?rhel} >= 6
|
||||
%define with_nbd 0
|
||||
%endif
|
||||
|
||||
%if %{defined gittag}
|
||||
%define rdist .git%{gittag}%{?dist}
|
||||
%define dashgittag -%{gittag}
|
||||
%else
|
||||
%define rdist %{?dist}
|
||||
%endif
|
||||
|
||||
Name: dracut
|
||||
Version: 004
|
||||
Release: 1%{?dist}
|
||||
Version: 008
|
||||
%define release_prefix 1%{?rdist}
|
||||
Release: %{release_prefix}
|
||||
|
||||
Summary: Initramfs generator using udev
|
||||
Group: System Environment/Base
|
||||
License: GPLv2+
|
||||
%if 0%{?fedora}
|
||||
Group: System Environment/Base
|
||||
%endif
|
||||
%if 0%{?suse_version}
|
||||
Group: System/Base
|
||||
%endif
|
||||
License: GPLv2+
|
||||
URL: http://apps.sourceforge.net/trac/dracut/wiki
|
||||
# Source can be generated by
|
||||
# http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=snapshot;h=%{?dashgittag};sf=tgz
|
||||
Source0: dracut-%{version}%{?dashgittag}.tar.bz2
|
||||
BuildArch: noarch
|
||||
|
||||
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.bz2
|
||||
|
||||
%if 0%{?fedora}
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
%endif
|
||||
%if 0%{?suse_version}
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora}
|
||||
BuildRequires: docbook-style-xsl docbook-dtds libxslt
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
BuildRequires: docbook-xsl-stylesheets libxslt
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6
|
||||
# no "provides", because dracut does not offer
|
||||
@@ -32,6 +56,14 @@ Obsoletes: nash <= 6.0.93
|
||||
Obsoletes: libbdevid-python <= 6.0.93
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version} > 9999
|
||||
Obsoletes: mkinitrd < 2.6.1
|
||||
Provides: mkinitrd = 2.6.1
|
||||
%endif
|
||||
|
||||
Obsoletes: dracut-kernel < 005
|
||||
Provides: dracut-kernel = %{version}-%{release}
|
||||
|
||||
Requires: bash
|
||||
Requires: bzip2
|
||||
Requires: coreutils
|
||||
@@ -41,182 +73,153 @@ Requires: filesystem >= 2.1.0
|
||||
Requires: findutils
|
||||
Requires: grep
|
||||
Requires: gzip
|
||||
Requires: initscripts >= 8.63-1
|
||||
Requires: kbd
|
||||
Requires: mktemp >= 1.5-5
|
||||
Requires: module-init-tools >= 3.7-9
|
||||
Requires: mount
|
||||
Requires: plymouth >= 0.8.0-0.2009.29.09.19.1
|
||||
Requires: plymouth-scripts
|
||||
Requires: sed
|
||||
Requires: tar
|
||||
Requires: udev
|
||||
Requires: util-linux-ng >= 2.16
|
||||
Requires: which
|
||||
Requires: file
|
||||
|
||||
%if ! 0%{?with_switch_root}
|
||||
Requires: util-linux-ng >= 2.16
|
||||
BuildArch: noarch
|
||||
%if 0%{?fedora}
|
||||
Requires: util-linux >= 2.16
|
||||
Requires: initscripts >= 8.63-1
|
||||
Requires: plymouth >= 0.8.0-0.2009.29.09.19.1
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
Requires: util-linux >= 2.16
|
||||
%endif
|
||||
|
||||
BuildRequires: docbook-style-xsl docbook-dtds libxslt
|
||||
BuildRequires: dash bash git
|
||||
|
||||
%description
|
||||
dracut is a new, event-driven initramfs infrastructure based around udev.
|
||||
Dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
|
||||
Unlike existing implementations, dracut does hard-code as little as possible
|
||||
into the initramfs. Dracut contains various modules which are driven by the
|
||||
event-based udev. Having root on MD, DM, LVM2, LUKS is supported as well as
|
||||
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: dhclient rpcbind nfs-utils
|
||||
Requires: iscsi-initiator-utils
|
||||
Requires: rpcbind
|
||||
%if %{with_nbd}
|
||||
Requires: nbd
|
||||
%endif
|
||||
Requires: net-tools 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}
|
||||
|
||||
%description network
|
||||
This package requires everything which is needed to build a generic
|
||||
all purpose initramfs with network support with dracut.
|
||||
|
||||
%if 0%{?fedora}
|
||||
%package fips
|
||||
Summary: Dracut modules to build a dracut initramfs with an integrity check
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: hmaccalc fipscheck
|
||||
Requires: hmaccalc
|
||||
%if 0%{?rhel} > 5
|
||||
# For Alpha 3, we want nss instead of nss-softokn
|
||||
Requires: nss
|
||||
%else
|
||||
Requires: nss-softokn
|
||||
%endif
|
||||
Requires: nss-softokn-freebl >= 3.14.3-22.el6_6
|
||||
Requires: nss-softokn-freebl
|
||||
|
||||
%description fips
|
||||
This package requires everything which is needed to build an
|
||||
all purpose initramfs with dracut, which does an integrity check.
|
||||
|
||||
%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}
|
||||
Requires: libcap
|
||||
|
||||
%description caps
|
||||
This package requires everything which is needed to build an
|
||||
all purpose initramfs with dracut, which drops capabilities.
|
||||
|
||||
%package generic
|
||||
Summary: Metapackage to build a generic initramfs with dracut
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: %{name}-network = %{version}-%{release}
|
||||
|
||||
%description generic
|
||||
This package requires everything which is needed to build a generic
|
||||
all purpose initramfs with dracut.
|
||||
|
||||
|
||||
%package kernel
|
||||
Summary: Metapackage to build generic initramfs with dracut with only kernel modules
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description kernel
|
||||
This package requires everything which is needed to build a initramfs with all
|
||||
kernel modules and firmware files needed by dracut modules.
|
||||
%endif
|
||||
|
||||
%package tools
|
||||
Summary: Dracut tools to build the local initramfs
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: coreutils cryptsetup-luks device-mapper
|
||||
Requires: diffutils dmraid findutils gawk grep lvm2
|
||||
Requires: module-init-tools sed
|
||||
Requires: cpio gzip
|
||||
|
||||
%description tools
|
||||
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
|
||||
|
||||
chmod 0755 modules.d/*/check
|
||||
# make rpmlint happy
|
||||
chmod 0755 modules.d/*/install
|
||||
chmod 0755 modules.d/*/installkernel
|
||||
chmod 0755 modules.d/*/*.sh
|
||||
%setup -q -n %{name}-%{version}%{?dashgittag}
|
||||
|
||||
%build
|
||||
make WITH_SWITCH_ROOT=0%{?with_switch_root}
|
||||
|
||||
%install
|
||||
%if 0%{?fedora}
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
%endif
|
||||
make install DESTDIR=$RPM_BUILD_ROOT sbindir=/sbin \
|
||||
sysconfdir=/etc mandir=%{_mandir} WITH_SWITCH_ROOT=0%{?with_switch_root}
|
||||
|
||||
echo %{name}-%{version}-%{release} > $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/10rpmversion/dracut-version
|
||||
rm $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/01fips/check
|
||||
rm $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/02fips-aesni/check
|
||||
|
||||
%if 0%{?fedora} == 0
|
||||
rm -fr $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/01fips
|
||||
%endif
|
||||
|
||||
# remove gentoo specific modules
|
||||
rm -fr $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/50gensplash
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/boot/dracut
|
||||
mkdir -p $RPM_BUILD_ROOT/var/lib/dracut/overlay
|
||||
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log
|
||||
touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log
|
||||
|
||||
%if 0%{?fedora} <= 12 && 0%{?rhel} < 6
|
||||
%if 0%{?fedora}
|
||||
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/01-dist.conf
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/01-dist.conf
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999
|
||||
rm $RPM_BUILD_ROOT/sbin/mkinitrd
|
||||
rm $RPM_BUILD_ROOT/sbin/lsinitrd
|
||||
%endif
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
|
||||
install -m 0644 dracut.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/dracut
|
||||
|
||||
echo 'do_strip=no' > $RPM_BUILD_ROOT/etc/dracut.conf.d/02-fips.conf
|
||||
> $RPM_BUILD_ROOT/etc/system-fips
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,0755)
|
||||
%doc README HACKING TODO COPYING AUTHORS NEWS dracut-rhel6.html
|
||||
%doc README HACKING TODO COPYING AUTHORS NEWS dracut.html dracut.png dracut.svg
|
||||
/sbin/dracut
|
||||
%if 0%{?with_switch_root}
|
||||
/sbin/switch_root
|
||||
%endif
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
|
||||
/sbin/mkinitrd
|
||||
/sbin/lsinitrd
|
||||
%endif
|
||||
%dir %{_datadir}/dracut
|
||||
%dir %{_datadir}/dracut/modules.d
|
||||
%{_datadir}/dracut/dracut-functions
|
||||
%config(noreplace) /etc/dracut.conf
|
||||
%if 0%{?fedora} || 0%{?suse_version}
|
||||
%config(noreplace) /etc/dracut.conf.d/01-dist.conf
|
||||
%endif
|
||||
%dir /etc/dracut.conf.d
|
||||
%config(noreplace) /etc/logrotate.d/dracut
|
||||
%{_mandir}/man1/lsinitrd.1*
|
||||
%{_mandir}/man8/mkinitrd.8*
|
||||
%{_mandir}/man8/dracut.8*
|
||||
%{_mandir}/man7/dracut.kernel.7*
|
||||
%{_mandir}/man5/dracut.conf.5*
|
||||
%{_datadir}/dracut/modules.d/00bootchart
|
||||
%{_datadir}/dracut/modules.d/00dash
|
||||
%{_datadir}/dracut/modules.d/10redhat-i18n
|
||||
%{_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
|
||||
@@ -230,60 +233,41 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_datadir}/dracut/modules.d/90mdraid
|
||||
%{_datadir}/dracut/modules.d/90multipath
|
||||
%{_datadir}/dracut/modules.d/95debug
|
||||
%{_datadir}/dracut/modules.d/95fstab-sys
|
||||
%{_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/95znet
|
||||
%{_datadir}/dracut/modules.d/95terminfo
|
||||
%{_datadir}/dracut/modules.d/95udev-rules
|
||||
%{_datadir}/dracut/modules.d/95uswsusp
|
||||
%{_datadir}/dracut/modules.d/96insmodpost
|
||||
%{_datadir}/dracut/modules.d/97biosdevname
|
||||
%{_datadir}/dracut/modules.d/98selinux
|
||||
%{_datadir}/dracut/modules.d/98syslog
|
||||
%{_datadir}/dracut/modules.d/99base
|
||||
# logfile needs no logrotate, because it gets overwritten
|
||||
# for every dracut run
|
||||
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
|
||||
|
||||
%files network
|
||||
%defattr(-,root,root,0755)
|
||||
%doc README HACKING TODO COPYING AUTHORS NEWS
|
||||
%{_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
|
||||
|
||||
%if 0%{?fedora}
|
||||
%files fips
|
||||
%defattr(-,root,root,0755)
|
||||
%doc COPYING
|
||||
%{_datadir}/dracut/modules.d/01fips
|
||||
%config(noreplace) /etc/dracut.conf.d/02-fips.conf
|
||||
%config(missingok) /etc/system-fips
|
||||
%endif
|
||||
|
||||
%files fips-aesni
|
||||
%files tools
|
||||
%defattr(-,root,root,0755)
|
||||
%doc COPYING
|
||||
%{_datadir}/dracut/modules.d/02fips-aesni
|
||||
|
||||
%files caps
|
||||
%defattr(-,root,root,0755)
|
||||
%doc COPYING
|
||||
%{_datadir}/dracut/modules.d/02caps
|
||||
|
||||
%files kernel
|
||||
%defattr(-,root,root,0755)
|
||||
%doc README.kernel
|
||||
|
||||
%files generic
|
||||
%defattr(-,root,root,0755)
|
||||
%doc README.generic
|
||||
|
||||
%files tools
|
||||
%defattr(-,root,root,0755)
|
||||
%doc COPYING NEWS
|
||||
%{_mandir}/man8/dracut-gencmdline.8*
|
||||
%{_mandir}/man8/dracut-catimages.8*
|
||||
/sbin/dracut-gencmdline
|
||||
|
725
dracut.xml
Normal file
725
dracut.xml
Normal file
@@ -0,0 +1,725 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- This document was created with Syntext Serna Free. -->
|
||||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
|
||||
<book>
|
||||
<title><inlinemediaobject>
|
||||
<imageobject>
|
||||
<imagedata valign="middle" fileref="dracut.png" format="PNG"/>
|
||||
</imageobject>
|
||||
<imageobject>
|
||||
<imagedata valign="middle" fileref="dracut.svg" format="SVG"/>
|
||||
</imageobject>
|
||||
<imageobject>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dracut.svg" encoding="UTF-8" parse="xml"/>
|
||||
</imageobject>
|
||||
</inlinemediaobject>dracut</title>
|
||||
<bookinfo>
|
||||
<author>
|
||||
<firstname>Harald</firstname>
|
||||
<surname>Hoyer</surname>
|
||||
</author>
|
||||
<pubdate>2010</pubdate>
|
||||
<edition>Version 1.0</edition>
|
||||
<copyright>
|
||||
<year>2010</year>
|
||||
<holder>Harald Hoyer</holder>
|
||||
</copyright>
|
||||
<legalnotice>
|
||||
<para>
|
||||
This work is licensed under the Creative Commons Attribution/Share-Alike License. To view a copy of this license, visit <ulink url="http://creativecommons.org/licenses/by-sa/3.0/">http://creativecommons.org/licenses/by-sa/3.0/</ulink> or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
</para>
|
||||
</legalnotice>
|
||||
</bookinfo>
|
||||
<toc/>
|
||||
<chapter>
|
||||
<chapterinfo>
|
||||
<legalnotice>
|
||||
<para>
|
||||
This section is a modified version of <ulink url="http://en.wikipedia.org/wiki/Initrd">http://en.wikipedia.org/wiki/Initrd</ulink>, which is licensed under the Creative Commons Attribution/Share-Alike License.
|
||||
</para>
|
||||
</legalnotice>
|
||||
</chapterinfo>
|
||||
<title>Introduction</title>
|
||||
<section>
|
||||
<title>Definition</title>
|
||||
<para>An <emphasis>initial ramdisk</emphasis> is a temporary file system used in the boot process of the Linux kernel. <emphasis>initrd</emphasis> and <emphasis>initramfs</emphasis> refer to slightly different schemes for loading this file system into memory. Both are commonly used to make preparations before the real root file system can be mounted.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Rationale </title>
|
||||
<para>Many Linux distributions ship a single, generic kernel image that is intended to boot as wide a variety of hardware as possible. The device drivers for this generic kernel image are included as loadable modules, as it is not possible to statically compile them all into the one kernel without making it too large to boot from computers with limited memory or from lower-capacity media like floppy disks.
|
||||
</para>
|
||||
<para>This then raises the problem of detecting and loading the modules necessary to mount the root file system at boot time (or, for that matter, deducing where or what the root file system is).
|
||||
</para>
|
||||
<para>To further complicate matters, the root file system may be on a software <acronym>RAID</acronym> volume, <acronym>LVM</acronym>, <acronym>NFS</acronym> (on diskless workstations), or on an encrypted partition. All of these require special preparations to mount.
|
||||
</para>
|
||||
<para>Another complication is kernel support for hibernation, which suspends the computer to disk by dumping an image of the entire system to a swap partition or a regular file, then powering off. On next boot, this image has to be made accessible before it can be loaded back into memory. </para>
|
||||
<para>To avoid having to hardcode handling for so many special cases into the kernel, an initial boot stage with a temporary root file system—now dubbed early user space—is used. This root file system would contain user-space helpers that would do the hardware detection, module loading and device discovery necessary to get the real root file system mounted.
|
||||
</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Implementation </title>
|
||||
<para>An image of this initial root file system (along with the kernel image) must be stored somewhere accessible by the Linux bootloader or the boot firmware of the computer. This can be: </para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>The root file system itself </para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>A boot image on an optical disc
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>A small ext2/ext3 or <acronym>FAT</acronym>-formatted partition on a local disk (a <emphasis>boot partition</emphasis>)</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>A <acronym>TFTP</acronym> server (on systems that can boot from Ethernet) </para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>The bootloader will load the kernel and initial root file system image into memory and then start the kernel, passing in the memory address of the image.
|
||||
</para>
|
||||
<para>Depending on which algorithms were compiled statically into it, the kernel can currently unpack initrd/initramfs images compressed with gzip, bzip2 and <acronym>LZMA</acronym>. </para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Mount preparations </title>
|
||||
<para>dracut can generate a customized initrams image which contains only whatever is necessary to boot some particular computer, such as <acronym>ATA</acronym>, <acronym>SCSI</acronym> and filesystem kernel modules (host-only mode).</para>
|
||||
<para>dracut can also generate a more generic initramfs image (default mode). </para>
|
||||
<para>dracut's initramfs starts only with the device name of the root file system (or its <acronym>UUID</acronym>) and must discover everything else at boot time. A complex cascade of tasks must be performed to get the root file system mounted: </para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Any hardware drivers that the boot process depends on must be loaded. All kernel modules for common storage devices are packed onto the initramfs and then udev pulls in modules matching the computer's detected hardware. </para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>On systems which display a boot rd.splash screen, the video hardware must be initialized and a user-space helper started to paint animations onto the display in lockstep with the boot process. </para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>If the root file system is on NFS, dracut does then: <itemizedlist>
|
||||
<listitem>
|
||||
<para>Bring up the primary network interface. </para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Invoke a DHCP client, with which it can obtain a DHCP lease. </para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Extract the name of the NFS share and the address of the NFS server from the lease. </para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Mount the <acronym>NFS</acronym> share. </para>
|
||||
</listitem>
|
||||
</itemizedlist></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>If the root file system appears to be on a software <acronym>RAID</acronym> device, there is no way of knowing which devices the <acronym>RAID</acronym> volume spans; the standard <acronym>MD</acronym> utilities must be invoked to scan all available block devices with a raid signature and bring the required ones online. </para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>If the root file system appears to be on a logical volume, the <acronym>LVM</acronym> utilities must be invoked to scan for and activate the volume group containing it. </para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>If the root file system is on an encrypted block device: <itemizedlist>
|
||||
<listitem>
|
||||
<para>Invoke a helper script to prompt the user to type in a passphrase and/or insert a hardware token (such as a smart card or a <acronym>USB</acronym> security dongle). </para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Create a decryption target with the device mapper. </para>
|
||||
</listitem>
|
||||
</itemizedlist></para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>dracut uses udev, an event-driven hotplug agent, which invokes helper programs as hardware devices, disk partitions and storage volumes matching certain rules come online. This allows discovery to run in parallel, and to progressively cascade into arbitrary nestings of <acronym>LVM</acronym>, <acronym>RAID</acronym> or encryption to get at the root file system. </para>
|
||||
<para>When the root file system finally becomes visible: <itemizedlist>
|
||||
<listitem>
|
||||
<para>Any maintenance tasks which cannot run on a mounted root file system are done. </para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>The root file system is mounted read-only. </para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Any processes which must continue running (such as the rd.splash screen helper and its command <acronym>FIFO</acronym>) are hoisted into the newly-mounted root file system. </para>
|
||||
</listitem>
|
||||
</itemizedlist></para>
|
||||
<para>The final root file system cannot simply be mounted over /, since that would make the scripts and tools on the initial root file system inaccessible for any final cleanup tasks. On an initramfs, the initial root file system cannot be rotated away. Instead, it is simply emptied and the final root file system mounted over the top.
|
||||
</para>
|
||||
</section>
|
||||
</chapter>
|
||||
<chapter>
|
||||
<title>User Manual</title>
|
||||
<section>
|
||||
<title>Creating an initramfs Image</title>
|
||||
<para>To create a initramfs image, the most simple command is:</para>
|
||||
<screen># dracut</screen>
|
||||
<para>This will generate a general purpose initramfs image, with all possible functionality resulting of the combination of the installed dracut modules and system tools. The image is /boot/initramfs-<replaceable><kernel version></replaceable>.img and contains the kernel modules of the currently active kernel with version <replaceable><kernel version></replaceable>.</para>
|
||||
<para>If the initramfs image already exists, dracut will display an error message, and to overwrite the existing image, you have to use the <option>--force</option> option. </para>
|
||||
<screen># dracut --force</screen>
|
||||
<para>If you want to specify another filename for the resulting image you would issue a command like:</para>
|
||||
<screen># dracut foobar.img</screen>
|
||||
<para>To generate an image for a specific kernel version, the command would be:</para>
|
||||
<screen># dracut foobar.img 2.6.40-1.rc5.f20</screen>
|
||||
<para>A shortcut to generate the image at the default location for a specific kernel version is:</para>
|
||||
<screen># dracut '' 2.6.40-1.rc5.f20</screen>
|
||||
<para>If you want to create lighter, smaller initramfs images, you may want to specify the <option>--host-only</option> or <option>-H</option> option. Using this option, the resulting image will contain only those dracut modules, kernel modules and filesystems, which are needed to boot this specific machine. This has the drawback, that you can't put the disk on another controller or machine, and that you can't switch to another root filesystem, without recreating the initramfs image. The usage of the <option>--host-only</option> option is only for experts and you will have to keep the broken pieces. At least keep a copy of a general purpose image (and corresponding kernel) as a fallback to rescue your system.</para>
|
||||
<section>
|
||||
<title>Inspecting the Contents</title>
|
||||
<para>To see the contents of the image created by dracut, you can use the <command>lsinitrd</command> tool.</para>
|
||||
<screen># lsinitrd /boot/initramfs-$(uname -r).img | less</screen>
|
||||
<para>To display the contents of a file in the initramfs also use the <command>lsinitrd</command> tool:</para>
|
||||
<screen># lsinitrd /boot/initramfs-$(uname -r).img /etc/ld.so.conf
|
||||
include ld.so.conf.d/*.conf</screen>
|
||||
</section>
|
||||
<section>
|
||||
<title>Adding dracut Modules</title>
|
||||
<para>Some dracut modules are turned off by default and have to be activated manually. You can do this by adding the dracut modules to the configuration file <filename>/etc/dracut.conf</filename> or <filename>/etc/dracut.conf.d/myconf.conf</filename>. See the man page <xref linkend="dracutconf5"/>. You can also add dracut modules on the command line by using the <option>-a</option> or <option>--add</option> option:</para>
|
||||
<screen># dracut --add bootchart initramfs-bootchart.img</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>
|
||||
</section>
|
||||
<section>
|
||||
<title>Omitting dracut Modules</title>
|
||||
<para>Sometimes you don't want a dracut module to be included for reasons of speed, size or functionality. To do this, either specify the <envar>omit_dracutmodules</envar> variable in the <filename>dracut.conf</filename> or <filename>/etc/dracut.conf.d/myconf.conf</filename> configuration file (see man page <xref linkend="dracutconf5"/>), or use the <option>-o</option> or <option>--omit</option> option on the command line:</para>
|
||||
<screen># dracut -o "multipath lvm" no-multipath-lvm.img</screen>
|
||||
</section>
|
||||
<section>
|
||||
<title>Adding Kernel Modules</title>
|
||||
<para>If you need a special kernel module in the initramfs, which is not automatically picked up by dracut, you have the use the <option>--add-drivers</option> option on the command line or the drivers vaiable in the <filename>/etc/dracut.conf</filename> or <filename>/etc/dracut.conf.d/myconf.conf</filename> configuration file (see man page <xref linkend="dracutconf5"/>):</para>
|
||||
<screen># dracut --add-drivers mymod initramfs-with-mymod.img</screen>
|
||||
</section>
|
||||
</section>
|
||||
<section>
|
||||
<title>Boot parameters</title>
|
||||
<para>The generated initramfs.img file normally does not contain any system configuration files (except for some special exceptions), so the configuration has to be done on the kernel command line. With this flexibility, you can easily boot from a changed root partition, without the need to recompile the initramfs image. So, you could completly change your root partition (move it inside a md raid with encryption and LVM on top), as long as you specify the correct filesystem <varname>LABEL</varname> or <varname>UUID</varname> on the kernel command line for your root device, dracut will find it and boot from it.</para>
|
||||
<para>The kernel command line usually can be configured in <filename>/boot/grub/grub.conf</filename>, if grub is your bootloader and it also can be edited in the real boot process in the grub menu.</para>
|
||||
<para>The kernel command line can also be provided by the dhcp server with the root-path option. See <xref linkend="NetworkBoot"/>.</para>
|
||||
<para>For a full reference of all kernel command line parameters, see the <xref linkend="dracutconf5"/> or <xref linkend="dracut8"/> man page.</para>
|
||||
<section>
|
||||
<title>Specifying the root Device</title>
|
||||
<para>This is the only option dracut really needs to boot from your root partition. Because your root partition can live in various environments, there are a lot of formats for the <envar>root=</envar> option. The most basic one is <envar>root=<replaceable><path to device node></replaceable></envar>:</para>
|
||||
<screen>root=/dev/sda2</screen>
|
||||
<para>Because device node names can change, dependent on the drive ordering, you are encouraged to use the filesystem identifier (UUID) or filesystem label (LABEL) to specify your root partition:</para>
|
||||
<screen>root=UUID=19e9dda3-5a38-484d-a9b0-fa6b067d0331</screen>
|
||||
<para>or</para>
|
||||
<screen>root=LABEL=myrootpartitionlabel</screen>
|
||||
<para>To see all <envar>UUID</envar>s or <envar>LABEL</envar>s on your system, do:</para>
|
||||
<screen># ls -l /dev/disk/by-uuid</screen>
|
||||
<para>or</para>
|
||||
<screen># ls -l /dev/disk/by-label</screen>
|
||||
<para>If your root partition is on the network see <xref linkend="NetworkBoot"/>.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Keyboard Settings</title>
|
||||
<para>If you have to input passwords for encrypted disk volumes, you might want to set the keyboard layout and specify a display font.</para>
|
||||
<para>A typical german kernel command would contain:</para>
|
||||
<screen>vconsole.font=latarcyrheb-sun16 vconsole.keymap=de-latin1-nodeadkeys locale.LANG=de_DE.UTF-8</screen>
|
||||
<para>Setting these options can override the setting stored on your system, if you use a modern init system, like systemd.</para>
|
||||
<para>For dracut versions prior to version <literal>008</literal> the line would look like:</para>
|
||||
<screen>LANG=de_DE.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=de-latin1-nodeadkeys</screen>
|
||||
</section>
|
||||
<section>
|
||||
<title>Blacklisting Kernel Modules</title>
|
||||
<para>Sometimes it is required to prevent the automatic kernel module loading of a specific kernel module. To do this, just add <envar>rd.blacklist=<replaceable><kernel module name></replaceable></envar>, with <replaceable><kernel module name></replaceable> not containing the <filename>.ko</filename> suffix, to the kernel command line. For example:</para>
|
||||
<screen>rd.blacklist=mptsas rd.blacklist=nouveau</screen>
|
||||
<para>The option can be specified multiple times on the kernel command line.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Speeding up the Boot Process</title>
|
||||
<para>If you want to speed up the boot process, you can specify as much information for dracut on the kernel command as possible. For example, you can tell dracut, that you root partition is not on a <acronym>LVM</acronym> volume or not on a raid partition, or that it lives inside a specific crypto <acronym>LUKS</acronym> encrypted volume. By default, dracut searches everywhere. A typical dracut kernel command line for a plain primary or logical partition would contain:</para>
|
||||
<screen>rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0</screen>
|
||||
<para>on systems with dracut version prior to <literal>008</literal> the line would look like:</para>
|
||||
<screen>rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM</screen>
|
||||
<para>This turns off every automatic assembly of <acronym>LVM</acronym>, <acronym>MD</acronym> raids, <acronym>DM</acronym> raids and crypto <acronym>LUKS</acronym>.</para>
|
||||
<para>Of course, you could also omit the dracut modules in the initramfs creation process, but then you would lose the posibility to turn it on on demand.</para>
|
||||
</section>
|
||||
<section id="Injecting">
|
||||
<title>Injecting custom Files</title>
|
||||
<para>To add your own files to the initramfs image, you have several possibilities.</para>
|
||||
<para>The <option>--include</option> option let you specify a source path and a target path. For example</para>
|
||||
<screen># dracut --include cmdline-preset /etc/cmdline initramfs-cmdline-pre.img</screen>
|
||||
<para>will create an initramfs image, where the file cmdline-preset will be copied inside the initramfs to <filename>/etc/cmdline</filename>. <option>--include</option> can only be specified once.</para>
|
||||
<screen># mkdir rd.live.overlay
|
||||
# mkdir rd.live.overlay/etc
|
||||
# mkdir rd.live.overlay/etc/conf.d
|
||||
# echo "ip=auto" >> rd.live.overlay/etc/cmdline
|
||||
# echo export TESTVAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
|
||||
# echo export TESTVAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
|
||||
# tree rd.live.overlay/
|
||||
rd.live.overlay/
|
||||
└── etc
|
||||
├── cmdline
|
||||
└── conf.d
|
||||
└── testvar.conf
|
||||
# dracut --include rd.live.overlay / initramfs-rd.live.overlay.img</screen>
|
||||
<para>This will put the contents of the rd.live.overlay directory into the root of the initramfs image.</para>
|
||||
<para>The <option>--install</option> option let you specify several files, which will get installed in the initramfs image at the same location, as they are present on initramfs creation time.</para>
|
||||
<screen># dracut --install 'strace fsck.ext3 ssh' initramfs-dbg.img</screen>
|
||||
<para>This will create an initramfs with the <command>strace</command>, <command>fsck.ext3</command> and <command>ssh</command> executables, together with the libraries needed to start those. The <option>--install</option> option can be specified multiple times.</para>
|
||||
</section>
|
||||
</section>
|
||||
<section id="NetworkBoot">
|
||||
<title>Network Boot</title>
|
||||
<para>If your root partition is on a network drive, you have to have the network dracut modules installed to create a network aware initramfs image.</para>
|
||||
<para>On a Red Hat Enterprise Linux or Fedora system, this means, you have to install the <filename>dracut-network</filename> rpm package:</para>
|
||||
<screen># yum install dracut-network</screen>
|
||||
<para>The resulting initramfs image can be served by a boot manager residing on your local hard drive or it can be served by a <acronym>PXE</acronym>/<acronym>TFTP</acronym> server.</para>
|
||||
<para>How to setup your <acronym>PXE</acronym>/<acronym>TFTP</acronym> server can be found in the <ulink url="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/">Red Hat Enterprise Linux Storage Administration Guide</ulink>.</para>
|
||||
<para>If you specify <envar>rd.ip=auto</envar> on the kernel command line, then dracut asks a dhcp server about the ip adress for the machine. The dhcp server can also serve an additional root-path, which will set the root device for dracut. With this mechanism, you have static configuration on your client machine and a centralized boot configuration on your <acronym>TFTP</acronym>/<acronym>DHCP</acronym> server. If you can't pass a kernel command line, then you can inject <filename>/etc/cmdline</filename>, with a method described in <xref linkend="Injecting"/>.
|
||||
</para>
|
||||
<section>
|
||||
<title>Reducing the Image Size</title>
|
||||
<para>To reduce the size of the initramfs, you should create it with by ommitting all dracut modules, which you know, you don't need to boot the machine.</para>
|
||||
<para>You can also specify the exact dracut and kernel modules to produce a very tiny initramfs image.</para>
|
||||
<para>For example for a <acronym>NFS</acronym> image, you would do:</para>
|
||||
<screen># dracut -m "nfs network base" initramfs-nfs-only.img</screen>
|
||||
<para>Then you would boot from this image with your target machine and reduce the size once more by creating it on the target machine with the <option>--host-only</option> option:</para>
|
||||
<screen># dracut -m "nfs network base" --host-only initramfs-nfs-host-only.img</screen>
|
||||
<para>This will reduce the size of the initramfs image significantly.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>NFS Root Device</title>
|
||||
<para/>
|
||||
</section>
|
||||
<section>
|
||||
<title>iSCSI Root Device</title>
|
||||
<para>
|
||||
</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>FCoE Root Device</title>
|
||||
<para>
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
<section>
|
||||
<title>Troubleshooting</title>
|
||||
<para>If the boot process does not succeed, you have several options to debug the situation. Some of the basic operations are covered here. For more information you should also visit: <ulink url="http://fedoraproject.org/wiki/How_to_debug_Dracut_problems">http://fedoraproject.org/wiki/How_to_debug_Dracut_problems</ulink></para>
|
||||
<section id="identifying-your-problem-area">
|
||||
<title>Identifying your problem area</title>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>Remove ''rhgb'' and ''quiet'' from the kernel command line
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Add ''rd.shell'' to the kernel command line. This will present a shell should dracut be unable to locate your root device
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Add ''rd.shell rd.debug'' to the kernel command line so that dracut shell commands are printed as they are executed
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>With dracut >= 002-11, you can inspect the rd.debug output with:
|
||||
</para>
|
||||
<screen># less /init.log
|
||||
# dmesg | less</screen>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</section>
|
||||
<section id="information-to-include-in-your-report">
|
||||
<title id="information-to-include-in-your-report-title">Information to include in your report</title>
|
||||
<section id="all-bug-reports">
|
||||
<title id="all-bug-reports-title">All bug reports</title>
|
||||
<para>In all cases, the following should be mentioned and attached to your bug report:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>The exact kernel command-line used. Typically from the bootloader configuration file (e.g. <filename>/etc/grub.conf</filename>) or from <filename>/proc/cmdline</filename>.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>A copy of your disk partition information from <filename>/etc/fstab</filename>, which might be obtained booting an old working initramfs or a rescue medium.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>A device listing from device-mapper. This can be obtained by running the command <screen># dmsetup ls --tree</screen></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>A list of block device attributes including vol_id compatible mode. This can be obtained by running the commands: <screen># blkid -p
|
||||
# blkid -p -o udev</screen></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Turn on dracut debugging (see <filename>the 'debugging dracut' section</filename>), and attach all relevant information from the boot log. This can be obtained by running the command <screen># dmesg|grep dracut</screen></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>If you use a dracut configuration file, please include <filename>/etc/dracut.conf</filename>
|
||||
and all files in <filename>/etc/dracut.conf.d/*.conf</filename></para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
<section id="logical-volume-management-related-problems">
|
||||
<title id="logical-volume-management-related-problems-title">Logical Volume Management related problems</title>
|
||||
<para>As well as the information from <xref linkend="all-bug-reports"/> include the following information:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Include physical volume information by running the command: <screen># lvm pvdisplay</screen></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Include volume group information by running the command: <screen># lvm vgdisplay</screen></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Include logical volume information by running the command: <screen># lvm lvdisplay</screen></para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
<section id="software-raid-related-problems">
|
||||
<title id="software-raid-related-problems-title">Software RAID related problems</title>
|
||||
<para>As well as the information from <xref linkend="all-bug-reports"/>, include the following information:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>If using software RAID disk partitions, please include the output of <screen># cat /proc/mdstat</screen></para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
<section id="network-root-device-related-problems">
|
||||
<title id="network-root-device-related-problems-title">Network root device related problems</title>
|
||||
<para>This section details information to include when experiencing problems on a system whose root device is located on a network attached volume (e.g. iSCSI, NFS or NBD). As well as the information from <xref linkend="all-bug-reports"/>, include the following information:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Please include the output of <screen># /sbin/ifup <replaceable><interfacename></replaceable>
|
||||
# ip addr show</screen></para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
</section>
|
||||
<section id="debugging-dracut">
|
||||
<title id="debugging-dracut-title">Debugging dracut</title>
|
||||
<section id="configure-a-serial-console">
|
||||
<title id="configure-a-serial-console-title">Configure a serial console</title>
|
||||
<para>Successfully debugging dracut will require some form of console logging during the system boot. This section documents configuring a serial console connection to record boot messages.
|
||||
</para>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>First, enable serial console output for both the kernel and the bootloader.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Open the file <filename>/etc/grub.conf</filename> for editing. Below the line ''timeout=5'', add the following:
|
||||
<screen>serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console</screen></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Also in <filename>/etc/grub.conf</filename>, add the following boot arguemnts to the ''kernel'' line:
|
||||
<screen>console=tty0 console=ttyS0,9600</screen></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>When finished, the <filename>/etc/grub.conf</filename> file should look similar to the example below.
|
||||
<screen>default=0
|
||||
timeout=5
|
||||
serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
title Fedora (2.6.29.5-191.fc11.x86_64)
|
||||
root (hd0,0)
|
||||
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 console=ttyS0,9600
|
||||
initrd /dracut-2.6.29.5-191.fc11.x86_64.img</screen></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>More detailed information on how to configure the kernel for console output can be found at <ulink url="http://www.faqs.org/docs/Linux-HOWTO/Remote-Serial-Console-HOWTO.html#CONFIGURE-KERNEL">http://www.faqs.org/docs/Linux-HOWTO/Remote-Serial-Console-HOWTO.html#CONFIGURE-KERNEL</ulink>.
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
<note>
|
||||
<title>Redirecting non-interactive output</title>
|
||||
<para>You can redirect all non-interactive output to <filename>/dev/kmsg</filename> and the kernel will put it out on the console when it reaches the kernel buffer by doing<screen># exec >/dev/kmsg 2>&1 </dev/console</screen></para>
|
||||
</note>
|
||||
</section>
|
||||
<section id="using-the-dracut-shell">
|
||||
<title id="using-the-dracut-shell-title">Using the dracut shell</title>
|
||||
<para>Dracut offers a shell for interactive debugging in the event dracut fails to locate your root filesystem. To enable the shell:
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>Add the boot parameter ''rd.shell'' to your bootloader configuration file (e.g. <filename>/etc/grub.conf</filename>)</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Remove the boot arguments ''rhgb'' and ''quiet''
|
||||
</para>
|
||||
<para>
|
||||
A sample <filename>/etc/grub.conf</filename> bootloader configuration file is listed below.
|
||||
</para>
|
||||
<para><screen>default=0
|
||||
timeout=5
|
||||
serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
title Fedora (2.6.29.5-191.fc11.x86_64)
|
||||
root (hd0,0)
|
||||
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
|
||||
initrd /dracut-2.6.29.5-191.fc11.x86_64.img</screen></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>If system boot fails, you will be dropped into a shell as seen in the example below.
|
||||
<screen>No root device found
|
||||
Dropping to debug shell.
|
||||
|
||||
sh: can't access tty; job control turned off
|
||||
|
||||
# </screen></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Use this shell prompt to gather the information requested above (see <xref linkend="all-bug-reports"/>).
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist></para>
|
||||
</section>
|
||||
<section id="accessing-the-root-volume-from-the-dracut-shell">
|
||||
<title id="accessing-the-root-volume-from-the-dracut-shell-title">Accessing the root volume from the dracut shell</title>
|
||||
<para>From the dracut debug shell, you can manually perform the task of locating and preparing your root volume for boot. The required steps will depend on how your root volume is configured. Common scenarios include:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>A block device (e.g. <filename>/dev/sda7</filename>)
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>A LVM logical volume (e.g. <filename>/dev/VolGroup00/LogVol00</filename>)
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>An encrypted device (e.g. <filename>/dev/mapper/luks-4d5972ea-901c-4584-bd75-1da802417d83</filename>)
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>A network attached device (e.g. netroot=iscsi:@192.168.0.4::3260::iqn.2009-02.org.fedoraproject:for.all)
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>The exact method for locating and preparing will vary. However, to continue with a successful boot, the objective is to locate your root volume and create a symlink <filename>/dev/root</filename> which points to the file system. For example, the following example demonstrates accessing and booting a root volume that is an encrypted LVM Logical volume. </para>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>Inspect your partitions using <command>parted</command><screen># parted /dev/sda -s p
|
||||
Model: ATA HTS541060G9AT00 (scsi)
|
||||
Disk /dev/sda: 60.0GB
|
||||
Sector size (logical/physical): 512B/512B
|
||||
Partition Table: msdos
|
||||
Number Start End Size Type File system Flags
|
||||
1 32.3kB 10.8GB 107MB primary ext4 boot
|
||||
2 10.8GB 55.6GB 44.7GB logical lvm</screen></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>You recall that your root volume was a LVM logical volume. Scan and activate any logical volumes.
|
||||
<screen># lvm vgscan
|
||||
# lvm vgchange -ay</screen></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>You should see any logical volumes now using the command <command>blkid</command>:
|
||||
<screen># blkid
|
||||
/dev/sda1: UUID="3de247f3-5de4-4a44-afc5-1fe179750cf7" TYPE="ext4"
|
||||
/dev/sda2: UUID="Ek4dQw-cOtq-5MJu-OGRF-xz5k-O2l8-wdDj0I" TYPE="LVM2_member"
|
||||
/dev/mapper/linux-root: UUID="def0269e-424b-4752-acf3-1077bf96ad2c" TYPE="crypto_LUKS"
|
||||
/dev/mapper/linux-home: UUID="c69127c1-f153-4ea2-b58e-4cbfa9257c5e" TYPE="ext3"
|
||||
/dev/mapper/linux-swap: UUID="47b4d329-975c-4c08-b218-f9c9bf3635f1" TYPE="swap"
|
||||
</screen></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>From the output above, you recall that your root volume exists on an encrypted block device. Following the guidance disk encryption guidance from the Installation Guide, you unlock your encrypted root volume.
|
||||
<screen># UUID=$(cryptsetup luksUUID /dev/mapper/linux-root)
|
||||
# cryptsetup luksOpen /dev/mapper/linux-root luks-$UUID
|
||||
Enter passphrase for /dev/mapper/linux-root:
|
||||
Key slot 0 unlocked. </screen></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Next, make a symbolic link to the unlocked root volume
|
||||
<screen># ln -s /dev/mapper/luks-$UUID /dev/root</screen></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>With the root volume available, you may continue booting the system by exiting the dracut shell
|
||||
<screen># exit</screen></para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</section>
|
||||
<section id="additional-dracut-boot-parameters">
|
||||
<title id="additional-dracut-boot-parameters-title">Additional dracut boot parameters</title>
|
||||
<para>For more debugging options, see <xref linkend="dracut-kernel-debug"/> in the man page <xref linkend="dracutkernel7"/>.</para>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
</chapter>
|
||||
<chapter>
|
||||
<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>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>
|
||||
<section id="stages">
|
||||
<title>Boot Process Stages</title>
|
||||
<para>The <command>init</command> script in <filename>99base</filename> is the main script, which prepares the root file system for usage, runs udev, mounts the real root device, kills the remaining processes, and switches to the real root device for further booting. dracut modules can insert custom script at various points, to control the boot process. These hooks are plain directories containing shell scripts ending with ".sh", which are sourced by <command>init</command>.
|
||||
Common used functions are in <filename>dracut-lib.sh</filename>, which can be sourced by any script. </para>
|
||||
<section>
|
||||
<title>Basic Setup</title>
|
||||
<para>The first thing <command>init</command> does, is to mount <filename>/proc</filename> and <filename>/sys</filename> and manually create the basic device nodes and symbolic links in <filename>/dev</filename> needed to execute basic commands. Then logging is setup according to kernel command line arguments. <filename>/dev/pts</filename> and <filename>/dev/shm</filename> are mounted and the first hook is sourced.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Hook: cmdline</title>
|
||||
<para>The <literal>
|
||||
<function>cmdline</function>
|
||||
</literal> hook is a place to insert scripts to parse the kernel command line and prepare the later actions, like setting up udev rules and configuration files.</para>
|
||||
<para>In this hook the most important environment variable is defined: <envar>root</envar>. The second one is <envar>rootok</envar>, which indicates, that a module claimed to be able to parse the <envar>root</envar> defined. So for example, <envar>root=</envar><replaceable>iscsi:....</replaceable> will be claimed by the <function>iscsi</function> dracut module, which then sets <envar>rootok</envar>.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Hook: pre-udev</title>
|
||||
<para>This hook is executed right after the <function>cmdline</function> hook and a check if <envar>root</envar> and <envar>rootok</envar> were set. Here modules can take action with the final <envar>root</envar>, and before <command>udev</command> has been run.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Start Udev</title>
|
||||
<para>Now <command>udev</command> is started and the logging for <command>udev</command> is setup.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Hook: pre-trigger</title>
|
||||
<para>In this hook, you can set udev environment variables with <code>udevadm control --property=<envar>KEY</envar>=<replaceable>value</replaceable></code> or control the further execution of <command>udev</command> with <command>udevadm</command>.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Trigger Udev</title>
|
||||
<para><command>udev</command> is triggered by calling <command>udevadm trigger</command>, which sends <constant>add</constant> events for all devices and subsystems.
|
||||
</para>
|
||||
</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>
|
||||
<section>
|
||||
<title>Initqueue</title>
|
||||
<para>This hook gets executed every time a script is inserted here, regardless of the <command>udev</command> state.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Initqueue settled</title>
|
||||
<para>This hooks gets executed every time <command>udev</command> has settled.</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>
|
||||
</section>
|
||||
</section>
|
||||
<section>
|
||||
<title>Hook: pre-mount</title>
|
||||
<para>Before the root device is mounted all scripts in the hook pre-mount are executed. In some cases (e.g. <acronym>NFS</acronym>) the real root device is already mounted, though.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Hook: mount</title>
|
||||
<para>This hook is mainly to mount the real root device.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Hook: pre-pivot</title>
|
||||
<para>This hook is the last hook and is called before init finally switches root to the real root device. This is a good place to clean up and kill processes not needed anymore.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Cleanup and switch_root</title>
|
||||
<para>Init kills all <command>udev</command> processes, cleans up the environment, sets up the arguments for the real <command>init</command> process and finally calls <command>switch_root</command>. <command>switch_root</command> removes the whole filesystem hierarchy of the initramfs, chroot()s to the real root device and calls <command>/sbin/init</command> with the specified arguments.</para>
|
||||
<para>To ensure all files in the initramfs hierarchy can be removed, all processes still running from the initramfs should not have any open file descriptors left.</para>
|
||||
</section>
|
||||
</section>
|
||||
<section>
|
||||
<title>Network Infrastructure</title>
|
||||
<para>
|
||||
</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Writing a Module</title>
|
||||
<para>A simple example module is <filename>96insmodpost</filename>, which modprobes a kernel module after udev has settled and the basic device drivers have been loaded.</para>
|
||||
<para>All module installation information is in the file module-setup.sh.</para>
|
||||
<para>First we create a <function>check()</function> function, which just exits with <errorcode>0</errorcode> indicating that this module should be included by default.</para>
|
||||
<para><function>check()</function>:</para>
|
||||
<programlisting>return 0</programlisting>
|
||||
<para>The we create the <function>install()</function> function, which installs a cmdline hook with priority number 20 called <filename>parse-insmodpost.sh</filename>. It also installs the <filename>insmodpost.sh</filename> script in <filename>/sbin</filename>.</para>
|
||||
<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><filename>parse-insmodpost.sh</filename>:</para>
|
||||
<programlisting>for p in $(getargs rd.driver.post=); do
|
||||
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
|
||||
_do_insmodpost=1
|
||||
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>:</para>
|
||||
<programlisting>. /lib/dracut-lib.sh
|
||||
|
||||
for p in $(getargs rd.driver.post=); do
|
||||
modprobe $p
|
||||
done
|
||||
</programlisting>
|
||||
<section>
|
||||
<title>check()</title>
|
||||
<para><filename>
|
||||
<function>check()</function>
|
||||
</filename> is called by dracut to evaluate the inclusion of a dracut module in the initramfs.</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term> $hostonly</term>
|
||||
<listitem>
|
||||
<para>If the $hostonly variable is set, then the module check() function should be in "hostonly" mode, which means, that the check() should only return 0, if the module is really needed to boot this specific host.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para><function>check()</function> should return with:</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>0</term>
|
||||
<listitem>
|
||||
<para>Include the dracut module in the initramfs.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>1</term>
|
||||
<listitem>
|
||||
<para>Do not include the dracut module. The requirements are not fullfilled (missing tools, etc.)</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>255</term>
|
||||
<listitem>
|
||||
<para>Only include the dracut module, if another module requires it or if explicitly specified in the config file or on the argument list.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section>
|
||||
<title>depends()</title>
|
||||
<para>The function <function>depends()</function> should <function>echo</function> all other dracut module names the module depends on.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>install()</title>
|
||||
<para>dracut_install</para>
|
||||
<para>inst</para>
|
||||
<para>inst_hook</para>
|
||||
<para>inst_rules</para>
|
||||
<para/>
|
||||
</section>
|
||||
<section>
|
||||
<title>installkernel()</title>
|
||||
<para>instmods</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Creation Functions</title>
|
||||
<para>
|
||||
</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Initramfs Functions</title>
|
||||
<para>
|
||||
</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Network Modules</title>
|
||||
<para>
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
</chapter>
|
||||
<appendix>
|
||||
<title>Man Pages</title>
|
||||
<section id="dracut.man">
|
||||
<title>dracut</title>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dracut.8.xml" encoding="UTF-8" parse="xml"/>
|
||||
</section>
|
||||
<section id="dracut.conf">
|
||||
<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>
|
||||
</appendix>
|
||||
</book>
|
61
git2spec.pl
61
git2spec.pl
@@ -1,61 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
sub last_tag {
|
||||
open( GIT, 'git log --pretty=format:%H |');
|
||||
LINE: while( <GIT> ) {
|
||||
open( GIT2, "git tag --contains $_ |");
|
||||
while( <GIT2> ) {
|
||||
chomp;
|
||||
last LINE if /..*/;
|
||||
}
|
||||
close GIT2;
|
||||
}
|
||||
$tag=$_;
|
||||
close GIT2;
|
||||
close GIT; # be done
|
||||
return $tag;
|
||||
};
|
||||
|
||||
sub create_patches {
|
||||
my $tag=shift;
|
||||
my $pdir=shift;
|
||||
my $num=0;
|
||||
open( GIT, 'git format-patch -M -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, $pdir);
|
||||
my $num=$#patches + 2;
|
||||
$tag=~s/[^0-9]+?([0-9]+)/$1/;
|
||||
my $release="$num.git$datestr";
|
||||
$release="1" if $num == 1;
|
||||
|
||||
while(<>) {
|
||||
if (/^Version:/) {
|
||||
print "Version: $tag\n";
|
||||
}
|
||||
elsif (/^Release:/) {
|
||||
print "Release: $release%{?dist}\n";
|
||||
}
|
||||
elsif ((/^Source0:/) || (/^Source:/)) {
|
||||
print $_;
|
||||
$num=1;
|
||||
for(@patches) {
|
||||
s/.*\///g;
|
||||
print "Patch$num: $_";
|
||||
$num++;
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
else {
|
||||
print $_;
|
||||
}
|
||||
}
|
@@ -1 +0,0 @@
|
||||
kate: space-indent on; tab-width 8; indent-width 8; replace-tabs on; eol unix;
|
130
lsinitrd
130
lsinitrd
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
@@ -19,123 +19,17 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
usage()
|
||||
{
|
||||
{
|
||||
echo "Usage: ${0##*/} [options] [<initramfs file> [<filename> [<filename> [...] ]]]"
|
||||
echo "Usage: ${0##*/} [options] -k <kernel version>"
|
||||
echo
|
||||
echo "-h, --help print a help message and exit."
|
||||
echo "-s, --size sort the contents of the initramfs by size."
|
||||
echo "-f, --file <filename> print the contents of <filename>."
|
||||
echo "-k, --kver <kernel version> inspect the initramfs of <kernel version>."
|
||||
echo
|
||||
} >&2
|
||||
}
|
||||
[[ $# -eq 1 || $# -eq 2 ]] || { echo "Usage: $(basename $0) <initramfs file> [<filename>]" ; exit 1 ; }
|
||||
[[ -f $1 ]] || { echo "$1 does not exist" ; exit 1 ; }
|
||||
|
||||
sorted=0
|
||||
declare -A filenames
|
||||
|
||||
unset POSIXLY_CORRECT
|
||||
TEMP=$(getopt \
|
||||
-o "shf:k:" \
|
||||
--long kver: \
|
||||
--long file: \
|
||||
--long help \
|
||||
--long size \
|
||||
-- "$@")
|
||||
|
||||
if (( $? != 0 )); then
|
||||
usage
|
||||
exit 1
|
||||
if [[ $# -eq 2 ]]; then
|
||||
zcat $1 | cpio --extract --verbose --quiet --to-stdout ${2#/} 2>/dev/null
|
||||
exit $?
|
||||
fi
|
||||
|
||||
eval set -- "$TEMP"
|
||||
|
||||
while (($# > 0)); do
|
||||
case $1 in
|
||||
-k|--kver) KERNEL_VERSION="$2"; shift;;
|
||||
-f|--file) filenames[${2#/}]=1; shift;;
|
||||
-s|--size) sorted=1;;
|
||||
-h|--help) usage; exit 0;;
|
||||
--) shift;break;;
|
||||
*) usage; exit 1;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
[[ $KERNEL_VERSION ]] || KERNEL_VERSION="$(uname -r)"
|
||||
|
||||
if [[ $1 ]]; then
|
||||
image="$1"
|
||||
if ! [[ -f "$image" ]]; then
|
||||
{
|
||||
echo "$image does not exist"
|
||||
echo
|
||||
} >&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
image="/boot/initramfs-${KERNEL_VERSION}.img"
|
||||
fi
|
||||
|
||||
shift
|
||||
while (($# > 0)); do
|
||||
filenames[${1#/}]=1;
|
||||
shift
|
||||
done
|
||||
|
||||
if ! [[ -f "$image" ]]; then
|
||||
{
|
||||
echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
|
||||
echo
|
||||
} >&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
read -N 6 bin < "$image"
|
||||
case $bin in
|
||||
$'\x1f\x8b'*)
|
||||
CAT="zcat";;
|
||||
BZh*)
|
||||
CAT="bzcat";;
|
||||
070701)
|
||||
CAT="cat";;
|
||||
*)
|
||||
CAT="xzcat";
|
||||
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
|
||||
CAT="xzcat --single-stream"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
ret=0
|
||||
|
||||
if (( ${#filenames[@]} > 0 )); then
|
||||
(( ${#filenames[@]} == 1 )) && nofileinfo=1
|
||||
for f in ${!filenames[@]}; do
|
||||
[[ $nofileinfo ]] || echo "initramfs:/$f"
|
||||
[[ $nofileinfo ]] || echo "========================================================================"
|
||||
$CAT -- $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
|
||||
((ret+=$?))
|
||||
[[ $nofileinfo ]] || echo "========================================================================"
|
||||
[[ $nofileinfo ]] || echo
|
||||
done
|
||||
else
|
||||
echo "Image: $image: $(du -h $image | while read a b; do echo $a;done)"
|
||||
echo "========================================================================"
|
||||
$CAT -- "$image" | cpio --extract --verbose --quiet --to-stdout -- 'dracut-*' 2>/dev/null
|
||||
((ret+=$?))
|
||||
echo "========================================================================"
|
||||
if [ "$sorted" -eq 1 ]; then
|
||||
$CAT -- "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
else
|
||||
$CAT -- "$image" | cpio --extract --verbose --quiet --list | sort -k9
|
||||
fi
|
||||
((ret+=$?))
|
||||
echo "========================================================================"
|
||||
fi
|
||||
|
||||
exit $ret
|
||||
echo "$1:"
|
||||
echo "========================================================================"
|
||||
zcat $1 | cpio --extract --verbose --quiet --to-stdout 'dracut-*' 2>/dev/null
|
||||
echo "========================================================================"
|
||||
zcat $1 | cpio --extract --verbose --quiet --list
|
||||
echo "========================================================================"
|
||||
|
73
lsinitrd.1
73
lsinitrd.1
@@ -1,73 +0,0 @@
|
||||
'\" t
|
||||
.\" Title: lsinitrd
|
||||
.\" Author: [see the "AUTHORS" section]
|
||||
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
|
||||
.\" Date: 07/17/2013
|
||||
.\" Manual: dracut
|
||||
.\" Source: dracut
|
||||
.\" Language: English
|
||||
.\"
|
||||
.TH "LSINITRD" "1" "07/17/2013" "dracut" "dracut"
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * Define some portability stuff
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
.\" http://bugs.debian.org/507673
|
||||
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
|
||||
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
.ie \n(.g .ds Aq \(aq
|
||||
.el .ds Aq '
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * set default formatting
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" disable hyphenation
|
||||
.nh
|
||||
.\" disable justification (adjust text to left margin only)
|
||||
.ad l
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * MAIN CONTENT STARTS HERE *
|
||||
.\" -----------------------------------------------------------------
|
||||
.SH "NAME"
|
||||
lsinitrd \- tool to show the contents of an initramfs image
|
||||
.SH "SYNOPSIS"
|
||||
.sp
|
||||
\fBlsinitrd\fR [\fIOPTION\&...\fR] [<image> [<filename> [<filename> [\&...] ]]]
|
||||
.sp
|
||||
\fBlsinitrd\fR [\fIOPTION\&...\fR] \-k <kernel\-version>
|
||||
.SH "DESCRIPTION"
|
||||
.sp
|
||||
lsinitrd shows the contents of an initramfs image\&. if <image> is omitted, then lsinitrd uses the default image \fI/boot/<machine\-id>/<kernel\-version>/initrd\fR or \fI/boot/initramfs\-<kernel\-version>\&.img\fR\&.
|
||||
.SH "OPTIONS"
|
||||
.PP
|
||||
\fB\-h, \-\-help\fR
|
||||
.RS 4
|
||||
print a help message and exit\&.
|
||||
.RE
|
||||
.PP
|
||||
\fB\-s, \-\-size\fR
|
||||
.RS 4
|
||||
sort the contents of the initramfs by size\&.
|
||||
.RE
|
||||
.PP
|
||||
\fB\-f, \-\-file\fR\ \&\fI<filename>\fR
|
||||
.RS 4
|
||||
print the contents of <filename>\&.
|
||||
.RE
|
||||
.PP
|
||||
\fB\-k, \-\-kver\fR\ \&\fI<kernel version>\fR
|
||||
.RS 4
|
||||
inspect the initramfs of <kernel version>\&.
|
||||
.RE
|
||||
.SH "AVAILABILITY"
|
||||
.sp
|
||||
The lsinitrd command is part of the dracut package and is available from \m[blue]\fBhttps://dracut\&.wiki\&.kernel\&.org\fR\m[]
|
||||
.SH "AUTHORS"
|
||||
.sp
|
||||
Harald Hoyer
|
||||
.sp
|
||||
Amerigo Wang
|
||||
.sp
|
||||
Nikoli
|
||||
.SH "SEE ALSO"
|
||||
.sp
|
||||
\fBdracut\fR(8)
|
@@ -1,102 +1,65 @@
|
||||
#!/bin/bash --norc
|
||||
kver=$(uname -r)
|
||||
|
||||
error() {
|
||||
local NONL=""
|
||||
if [ "$1" == "-n" ]; then
|
||||
NONL="-n"
|
||||
shift
|
||||
fi
|
||||
echo $NONL "$@" > /dev/stderr
|
||||
}
|
||||
error() { echo "$@" >&2; }
|
||||
|
||||
usage () {
|
||||
if [ "$1" == "-n" ]; then
|
||||
cmd=echo
|
||||
else
|
||||
cmd=error
|
||||
fi
|
||||
[[ $1 = '-n' ]] && cmd=echo || cmd=error
|
||||
|
||||
$cmd "usage: `basename $0` [--version] [--help] [-v] [-f] [--preload <module>]"
|
||||
$cmd "usage: ${0%/*} [--version] [--help] [-v] [-f] [--preload <module>]"
|
||||
$cmd " [--image-version] [--with=<module>]"
|
||||
$cmd " <initrd-image> <kernel-version>"
|
||||
$cmd ""
|
||||
$cmd " (ex: `basename $0` /boot/initramfs-$(uname -r).img $(uname -r))"
|
||||
$cmd " (ex: ${0%/*} /boot/initramfs-$kver.img $kver)"
|
||||
|
||||
if [ "$1" == "-n" ]; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
[[ $1 = '-n' ]] && exit 0
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Little helper function for reading args from the commandline.
|
||||
# it automatically handles -a b and -a=b variants, and returns 1 if
|
||||
# we need to shift $3.
|
||||
read_arg() {
|
||||
# $1 = arg name
|
||||
# $2 = arg value
|
||||
# $3 = arg parameter
|
||||
local rematch='^[^=]*=(.*)$'
|
||||
if [[ $2 =~ $rematch ]]; then
|
||||
read "$1" <<< "${BASH_REMATCH[1]}"
|
||||
elif [[ $3 != -* ]]; then
|
||||
# Only read next arg if it not an arg itself.
|
||||
read "$1" <<< "$3"
|
||||
# There is no way to shift our callers args, so
|
||||
# return 1 to indicate they should do it instead.
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--with-usb*)
|
||||
if [ "$1" != "${1##--with-usb=}" ]; then
|
||||
usbmodule=${1##--with-usb=}
|
||||
else
|
||||
usbmodule="usb-storage"
|
||||
fi
|
||||
basicmodules="$basicmodules $usbmodule"
|
||||
unset usbmodule
|
||||
;;
|
||||
--with-avail*)
|
||||
if [ "$1" != "${1##--with-avail=}" ]; then
|
||||
modname=${1##--with-avail=}
|
||||
else
|
||||
modname=$2
|
||||
shift
|
||||
fi
|
||||
|
||||
basicmodules="$basicmodules $modname"
|
||||
;;
|
||||
--with*)
|
||||
if [ "$1" != "${1##--with=}" ]; then
|
||||
modname=${1##--with=}
|
||||
else
|
||||
modname=$2
|
||||
shift
|
||||
fi
|
||||
|
||||
basicmodules="$basicmodules $modname"
|
||||
;;
|
||||
while (($# > 0)); do
|
||||
case ${1%%=*} in
|
||||
--with-usb) read_arg usbmodule "$@" || shift
|
||||
basicmodules="$basicmodules ${usbmodule:-usb-storage}"
|
||||
unset usbmodule;;
|
||||
--with-avail) read_arg modname "$@" || shift
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--with) read_arg modname "$@" || shift
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--version)
|
||||
echo "mkinitrd: dracut compatibility wrapper"
|
||||
exit 0
|
||||
;;
|
||||
-v|--verbose)
|
||||
dracut_args="${dracut_args} -v"
|
||||
;;
|
||||
-f|--force)
|
||||
dracut_args="${dracut_args} -f"
|
||||
;;
|
||||
--preload*)
|
||||
if [ "$1" != "${1##--preload=}" ]; then
|
||||
modname=${1##--preload=}
|
||||
else
|
||||
modname=$2
|
||||
shift
|
||||
fi
|
||||
basicmodules="$basicmodules $modname"
|
||||
;;
|
||||
--image-version)
|
||||
img_vers=yes
|
||||
;;
|
||||
--rootfs*)
|
||||
if [ "$1" != "${1##--rootfs=}" ]; then
|
||||
rootfs="${1##--rootfs=}"
|
||||
else
|
||||
rootfs="$2"
|
||||
shift
|
||||
fi
|
||||
dracut_args="${dracut_args} --filesystems $rootfs"
|
||||
;;
|
||||
--builtin*) ;;
|
||||
exit 0;;
|
||||
-v|--verbose) dracut_args="${dracut_args} -v";;
|
||||
-f|--force) dracut_args="${dracut_args} -f";;
|
||||
--preload) read_args modname "$@" || shift
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--image-version) img_vers=yes;;
|
||||
--rootfs) read_args rootfs "$@" || shift
|
||||
dracut_args="${dracut_args} --filesystems $rootfs";;
|
||||
--nocompress) dracut_args="$dracut_args --no-compress";;
|
||||
--help) usage -n;;
|
||||
--builtin) ;;
|
||||
--without*) ;;
|
||||
--without-usb) ;;
|
||||
--fstab*) ;;
|
||||
--nocompress) ;;
|
||||
--ifneeded) ;;
|
||||
--omit-scsi-modules) ;;
|
||||
--omit-ide-modules) ;;
|
||||
@@ -106,45 +69,32 @@ while [ $# -gt 0 ]; do
|
||||
--allow-missing) ;;
|
||||
--net-dev*) ;;
|
||||
--noresume) ;;
|
||||
--rootdev*) ;;
|
||||
--thawdev*) ;;
|
||||
--rootopts*) ;;
|
||||
--root*) ;;
|
||||
--loopdev*) ;;
|
||||
--loopfs*) ;;
|
||||
--loopopts*) ;;
|
||||
--looppath*) ;;
|
||||
--dsdt*) ;;
|
||||
--rootdev*) ;;
|
||||
--thawdev*) ;;
|
||||
--rootopts*) ;;
|
||||
--root*) ;;
|
||||
--loopdev*) ;;
|
||||
--loopfs*) ;;
|
||||
--loopopts*) ;;
|
||||
--looppath*) ;;
|
||||
--dsdt*) ;;
|
||||
--bootchart) ;;
|
||||
--help)
|
||||
usage -n
|
||||
;;
|
||||
*)
|
||||
if [ -z "$target" ]; then
|
||||
target=$1
|
||||
elif [ -z "$kernel" ]; then
|
||||
kernel=$1
|
||||
*) if [[ ! $target ]]; then
|
||||
target=$1
|
||||
elif [[ ! $kernel ]]; then
|
||||
kernel=$1
|
||||
else
|
||||
usage
|
||||
fi
|
||||
;;
|
||||
usage
|
||||
fi;;
|
||||
esac
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -z "$target" -o -z "$kernel" ]; then
|
||||
usage
|
||||
fi
|
||||
[[ $target && $kernel ]] || usage
|
||||
[[ $img_vers ]] && target="$target-$kernel"
|
||||
|
||||
if [ -n "$img_vers" ]; then
|
||||
target="$target-$kernel"
|
||||
fi
|
||||
|
||||
if [ -n "$basicmodules" ]; then
|
||||
dracut $dracut_args --add-drivers "$basicmodules" "$target" "$kernel"
|
||||
if [[ $basicmodules ]]; then
|
||||
dracut $dracut_args --add-drivers "$basicmodules" "$target" "$kernel"
|
||||
else
|
||||
dracut $dracut_args "$target" "$kernel"
|
||||
dracut $dracut_args "$target" "$kernel"
|
||||
fi
|
||||
|
||||
# vim:ts=8:sw=4:sts=4:et
|
||||
|
103
mkinitrd.8
103
mkinitrd.8
@@ -1,103 +0,0 @@
|
||||
'\" t
|
||||
.\" Title: mkinitrd
|
||||
.\" Author: [see the "AUTHORS" section]
|
||||
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
|
||||
.\" Date: 07/17/2013
|
||||
.\" Manual: dracut
|
||||
.\" Source: dracut
|
||||
.\" Language: English
|
||||
.\"
|
||||
.TH "MKINITRD" "8" "07/17/2013" "dracut" "dracut"
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * Define some portability stuff
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
.\" http://bugs.debian.org/507673
|
||||
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
|
||||
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
.ie \n(.g .ds Aq \(aq
|
||||
.el .ds Aq '
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * set default formatting
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" disable hyphenation
|
||||
.nh
|
||||
.\" disable justification (adjust text to left margin only)
|
||||
.ad l
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * MAIN CONTENT STARTS HERE *
|
||||
.\" -----------------------------------------------------------------
|
||||
.SH "NAME"
|
||||
mkinitrd \- is a compat wrapper, which calls dracut to generate an initramfs
|
||||
.SH "SYNOPSIS"
|
||||
.sp
|
||||
\fBmkinitrd\fR [\fIOPTION\&...\fR] [<initrd\-image>] <kernel\-version>
|
||||
.SH "DESCRIPTION"
|
||||
.sp
|
||||
mkinitrd creates an initramfs image <initrd\-image> for the kernel with version <kernel\-version> by calling "dracut"\&.
|
||||
.if n \{\
|
||||
.sp
|
||||
.\}
|
||||
.RS 4
|
||||
.it 1 an-trap
|
||||
.nr an-no-space-flag 1
|
||||
.nr an-break-flag 1
|
||||
.br
|
||||
.ps +1
|
||||
\fBImportant\fR
|
||||
.ps -1
|
||||
.br
|
||||
.sp
|
||||
If a more fine grained control over the resulting image is needed, "dracut" should be called directly\&.
|
||||
.sp .5v
|
||||
.RE
|
||||
.SH "OPTIONS"
|
||||
.PP
|
||||
\fB\-\-version\fR
|
||||
.RS 4
|
||||
print info about the version
|
||||
.RE
|
||||
.PP
|
||||
\fB\-v, \-\-verbose\fR
|
||||
.RS 4
|
||||
increase verbosity level
|
||||
.RE
|
||||
.PP
|
||||
\fB\-f, \-\-force\fR
|
||||
.RS 4
|
||||
overwrite existing initramfs file\&.
|
||||
.RE
|
||||
.PP
|
||||
\fB*\-\-image\-version\fR
|
||||
.RS 4
|
||||
append the kernel version to the target image <initrd\-image>\-<kernel\-version>\&.
|
||||
.RE
|
||||
.PP
|
||||
\fB\-\-with=<module>\fR
|
||||
.RS 4
|
||||
add the kernel module <module> to the initramfs\&.
|
||||
.RE
|
||||
.PP
|
||||
\fB\-\-preload=<module>\fR
|
||||
.RS 4
|
||||
preload the kernel module <module> in the initramfs before any other kernel modules are loaded\&. This can be used to ensure a certain device naming, which should in theory be avoided and the use of symbolic links in /dev is encouraged\&.
|
||||
.RE
|
||||
.PP
|
||||
\fB\-\-nocompress\fR
|
||||
.RS 4
|
||||
do not compress the resulting image\&.
|
||||
.RE
|
||||
.PP
|
||||
\fB\-\-help\fR
|
||||
.RS 4
|
||||
print a help message and exit\&.
|
||||
.RE
|
||||
.SH "AVAILABILITY"
|
||||
.sp
|
||||
The mkinitrd command is part of the dracut package and is available from \m[blue]\fBhttps://dracut\&.wiki\&.kernel\&.org\fR\m[]
|
||||
.SH "AUTHORS"
|
||||
.sp
|
||||
Harald Hoyer
|
||||
.SH "SEE ALSO"
|
||||
.sp
|
||||
\fBdracut\fR(8)
|
30
modules.d/00bootchart/module-setup.sh
Executable file
30
modules.d/00bootchart/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() {
|
||||
[ -x /sbin/bootchartd ] || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
inst /sbin/bootchartd
|
||||
inst /bin/bash
|
||||
inst_symlink /init /sbin/init
|
||||
inst_dir /lib/bootchart/tmpfs
|
||||
inst /lib/bootchart/bootchart-collector
|
||||
inst /etc/bootchartd.conf
|
||||
inst /sbin/accton
|
||||
inst /usr/bin/pkill /bin/pkill
|
||||
inst /bin/echo
|
||||
inst /bin/grep
|
||||
inst /bin/usleep
|
||||
inst /usr/bin/[ /bin/[
|
||||
|
||||
mknod -m 0666 "${initdir}/dev/null" c 1 3
|
||||
}
|
||||
|
@@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
[ -x /bin/dash ]
|
@@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
# If another shell is already installed, do not use dash
|
||||
[ -x "${initdir}/bin/sh" ] && return
|
||||
|
||||
# Prefer dash as /bin/sh if it is available.
|
||||
inst /bin/dash && ln -sf dash "${initdir}/bin/sh"
|
20
modules.d/00dash/module-setup.sh
Executable file
20
modules.d/00dash/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() {
|
||||
[ -x /bin/dash ]
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
# If another shell is already installed, do not use dash
|
||||
[[ -x $initdir/bin/sh ]] && return
|
||||
|
||||
# Prefer dash as /bin/sh if it is available.
|
||||
inst /bin/dash && ln -sf dash "${initdir}/bin/sh"
|
||||
}
|
||||
|
@@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
[[ $1 = -d ]] && exit 0
|
||||
exit 255
|
||||
|
@@ -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
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
|
||||
rm -f /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
elif getarg boot= >/dev/null; then
|
||||
. /sbin/fips.sh
|
||||
if mount_boot; then
|
||||
do_fips || die "FIPS integrity test failed"
|
||||
fi
|
||||
fi
|
@@ -1,11 +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
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
|
||||
rm -f /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
elif ! [ -f /tmp/fipsdone ]; then
|
||||
. /sbin/fips.sh
|
||||
mount_boot
|
||||
do_fips || die "FIPS integrity test failed"
|
||||
fi
|
@@ -1,124 +1,70 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
mount_boot()
|
||||
{
|
||||
boot=$(getarg boot=)
|
||||
|
||||
if [ -n "$boot" ]; then
|
||||
case "$boot" in
|
||||
LABEL=*)
|
||||
boot="$(echo $boot | sed 's,/,\\x2f,g')"
|
||||
boot="/dev/disk/by-label/${boot#LABEL=}"
|
||||
;;
|
||||
UUID=*)
|
||||
boot="/dev/disk/by-uuid/${boot#UUID=}"
|
||||
;;
|
||||
/dev/*)
|
||||
;;
|
||||
*)
|
||||
die "You have to specify boot=<boot device> as a boot option for fips=1" ;;
|
||||
esac
|
||||
|
||||
if ! [ -e "$boot" ]; then
|
||||
udevadm trigger --action=add >/dev/null 2>&1
|
||||
[ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)
|
||||
i=0
|
||||
while ! [ -e $boot ]; do
|
||||
if [ $UDEVVERSION -ge 143 ]; then
|
||||
udevadm settle --exit-if-exists=$boot >/dev/null 2>&1
|
||||
else
|
||||
udevadm settle --timeout=30 >/dev/null 2>&1
|
||||
fi
|
||||
[ -e $boot ] && break
|
||||
modprobe scsi_wait_scan && rmmod scsi_wait_scan
|
||||
[ -e $boot ] && break
|
||||
sleep 0.5
|
||||
i=$(($i+1))
|
||||
[ $i -gt 40 ] && break
|
||||
done
|
||||
fi
|
||||
|
||||
[ -e "$boot" ] || return 1
|
||||
|
||||
mkdir /boot
|
||||
info "Mounting $boot as /boot"
|
||||
mount -oro "$boot" /boot || return 1
|
||||
elif [ -d "$NEWROOT/boot" ]; then
|
||||
rm -fr /boot
|
||||
ln -sf "$NEWROOT/boot" /boot
|
||||
fi
|
||||
}
|
||||
|
||||
do_rhevh_check()
|
||||
{
|
||||
KERNEL=$(uname -r)
|
||||
kpath=${1}
|
||||
|
||||
# If we're on RHEV-H, the kernel is in /dev/.initramfs/live/vmlinuz0
|
||||
HMAC_SUM_ORIG=$(cat $NEWROOT/boot/.vmlinuz-${KERNEL}.hmac | while read a b; do printf "%s\n" $a; done)
|
||||
HMAC_SUM_CALC=$(sha512hmac $kpath | while read a b; do printf "%s\n" $a; done || return 1)
|
||||
if [ -z "$HMAC_SUM_ORIG" ] || [ -z "$HMAC_SUM_CALC" ] || [ "${HMAC_SUM_ORIG}" != "${HMAC_SUM_CALC}" ]; then
|
||||
warn "HMAC sum mismatch"
|
||||
return 1
|
||||
fi
|
||||
info "rhevh_check OK"
|
||||
return 0
|
||||
}
|
||||
|
||||
do_fips()
|
||||
{
|
||||
local _v
|
||||
local _s
|
||||
local _v
|
||||
local _module
|
||||
info "Checking integrity of kernel"
|
||||
FIPSMODULES=$(cat /etc/fipsmodules)
|
||||
BOOT=$(getarg boot=)
|
||||
KERNEL=$(uname -r)
|
||||
udevadm trigger --action=add >/dev/null 2>&1
|
||||
case "$boot" in
|
||||
block:LABEL=*|LABEL=*)
|
||||
boot="${boot#block:}"
|
||||
boot="$(echo $boot | sed 's,/,\\x2f,g')"
|
||||
boot="/dev/disk/by-label/${boot#LABEL=}"
|
||||
bootok=1 ;;
|
||||
block:UUID=*|UUID=*)
|
||||
boot="${boot#block:}"
|
||||
boot="/dev/disk/by-uuid/${root#UUID=}"
|
||||
bootok=1 ;;
|
||||
/dev/*)
|
||||
bootok=1 ;;
|
||||
esac
|
||||
|
||||
[ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)
|
||||
|
||||
if [ $UDEVVERSION -ge 143 ]; then
|
||||
udevadm settle --exit-if-exists=$boot
|
||||
else
|
||||
udevadm settle --timeout=30
|
||||
fi
|
||||
|
||||
[ -e "$boot" ]
|
||||
|
||||
mkdir /boot
|
||||
info "Mounting $boot as /boot"
|
||||
mount -oro "$boot" /boot
|
||||
|
||||
info "Checking integrity of kernel"
|
||||
|
||||
if ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
|
||||
warn "/boot/.vmlinuz-${KERNEL}.hmac does not exist"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -e "/dev/.initramfs/live/vmlinuz0" ]; then
|
||||
do_rhevh_check /dev/.initramfs/live/vmlinuz0 || return 1
|
||||
elif [ -e "/dev/.initramfs/live/isolinux/vmlinuz0" ]; then
|
||||
do_rhevh_check /dev/.initramfs/live/isolinux/vmlinuz0 || return 1
|
||||
else
|
||||
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
|
||||
fi
|
||||
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
|
||||
|
||||
FIPSMODULES=$(cat /etc/fipsmodules)
|
||||
info "Umounting /boot"
|
||||
umount /boot
|
||||
|
||||
info "Loading and integrity checking all crypto modules"
|
||||
mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
|
||||
for _module in $FIPSMODULES; do
|
||||
if [ "$_module" != "tcrypt" ]; then
|
||||
if ! modprobe "${_module}"; then
|
||||
# check if kernel provides generic algo
|
||||
_found=0
|
||||
while read _k _s _v; do
|
||||
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
|
||||
[ "$_k" = "driver" ] && _v=$(str_replace "$_v" "_" "-")
|
||||
[ "$_v" != "$_module" ] && continue
|
||||
_found=1
|
||||
break
|
||||
done </proc/crypto
|
||||
[ "$_found" = "0" ] && return 1
|
||||
fi
|
||||
for module in $FIPSMODULES; do
|
||||
if [ "$module" != "tcrypt" ]; then
|
||||
modprobe ${module} || return 1
|
||||
fi
|
||||
done
|
||||
mv /etc/modprobe.d/fips.conf.bak /etc/modprobe.d/fips.conf
|
||||
|
||||
info "Self testing crypto algorithms"
|
||||
modprobe tcrypt || return 1
|
||||
modprobe tcrypt noexit=1 || return 1
|
||||
rmmod tcrypt
|
||||
info "All initrd crypto checks done"
|
||||
|
||||
> /tmp/fipsdone
|
||||
|
||||
umount /boot >/dev/null 2>&1
|
||||
info "All initrd crypto checks done"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
|
||||
rm -f /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
else
|
||||
set -e
|
||||
do_fips || die "FIPS integrity test failed"
|
||||
set +e
|
||||
fi
|
||||
|
@@ -1,35 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
inst_hook pre-trigger 01 "$moddir/fips-boot.sh"
|
||||
inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
|
||||
inst "$moddir/fips.sh" /sbin/fips.sh
|
||||
dracut_install sha512hmac rmmod insmod mount uname umount
|
||||
|
||||
libdir="lib"
|
||||
if ldd $(find_binary sha512hmac) 2>/dev/null | grep -q /lib64/; then
|
||||
libdir="lib64"
|
||||
fi
|
||||
|
||||
if [ -e /usr/$libdir/libsoftokn3.so ]; then
|
||||
dracut_install \
|
||||
/usr/$libdir/libsoftokn3.so /usr/$libdir/libsoftokn3.chk
|
||||
else
|
||||
dracut_install \
|
||||
/$libdir/libsoftokn3.so /$libdir/libsoftokn3.chk
|
||||
fi
|
||||
|
||||
for i in /{usr,}/$libdir/libssl.so* /{usr,}/$libdir/libcrypto.so* \
|
||||
/{usr,}/$libdir/.libssl.so*.hmac /{usr,}/$libdir/.libcrypto.so*.hmac; do
|
||||
[ -e $i ] || continue
|
||||
dracut_install $i
|
||||
done
|
||||
|
||||
dracut_install -o /usr/$libdir/hmaccalc/sha*hmac.hmac
|
||||
dracut_install fipscheck
|
||||
dracut_install /etc/system-fips
|
||||
|
||||
if command -v prelink >/dev/null; then
|
||||
dracut_install prelink
|
||||
fi
|
||||
|
||||
# vim:ts=8:sw=4:sts=4:et
|
@@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
_fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 blowfish camellia cast6 cbc ccm "
|
||||
_fipsmodules+="chainiv crc32c cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod drbg "
|
||||
_fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 "
|
||||
_fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic "
|
||||
_fipsmodules+="sha384 sha512 sha512_generic tcrypt tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib"
|
||||
|
||||
mkdir -p "${initdir}/etc/modprobe.d"
|
||||
|
||||
for mod in $_fipsmodules; do
|
||||
if hostonly='' instmods $mod; then
|
||||
echo $mod >> "${initdir}/etc/fipsmodules"
|
||||
echo "blacklist $mod" >> "${initdir}/etc/modprobe.d/fips.conf"
|
||||
fi
|
||||
done
|
||||
|
||||
# vim:ts=8:sw=4:sts=4:et
|
41
modules.d/01fips/module-setup.sh
Executable file
41
modules.d/01fips/module-setup.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/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() {
|
||||
FIPSMODULES="aead aes_generici aes-xts aes-x86_64 ansi_cprng cbc ccm chainiv ctr"
|
||||
FIPSMODULES="$FIPSMODULES des deflate ecb eseqiv hmac seqiv sha256 sha512"
|
||||
FIPSMODULES="$FIPSMODULES cryptomgr crypto_null tcrypt"
|
||||
|
||||
mkdir -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() {
|
||||
inst_hook pre-trigger 01 "$moddir/fips.sh"
|
||||
dracut_install sha512hmac rmmod insmod mount uname umount
|
||||
|
||||
for dir in "$usrlibdir" "$libdir"; do
|
||||
[[ -e $dir/libsoftokn3.so ]] && \
|
||||
dracut_install $dir/libsoftokn3.so $dir/libsoftokn3.chk \
|
||||
$dir/libfreebl3.so $dir/libfreebl3.chk && \
|
||||
break
|
||||
done
|
||||
|
||||
dracut_install $usrlibdir/hmaccalc/sha512hmac.hmac
|
||||
}
|
||||
|
@@ -1,33 +0,0 @@
|
||||
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
|
||||
rd.caps.disablemodules=1
|
||||
turn off module loading
|
||||
rd.caps.disablekexec=1
|
||||
turn off the kexec functionality
|
||||
|
||||
If module loading is turned off, all modules have to be loaded in the
|
||||
initramfs, which are used later on. This can be done with
|
||||
"rdloaddriver="
|
||||
rdloaddriver=autofs4,sunrpc,ipt_REJECT,nf_conntrack_ipv4,....
|
||||
|
||||
Because the kernel command line would get huge with all those drivers, I
|
||||
recommend to make use of $initramfs/etc/cmdline.
|
||||
|
||||
So, all rd.caps.* and rdloaddriver arguments are in caps.conf can be
|
||||
copied to $initramfs/etc/cmdline with "-i caps.conf /etc/cmdline".
|
||||
|
||||
Also all modules have to be loaded in the initramfs via "--add-drivers".
|
||||
|
||||
The resulting initramfs creation would look like this:
|
||||
|
||||
--add-drivers "autofs4 sunrpc ipt_REJECT nf_conntrack_ipv4 \
|
||||
nf_defrag_ipv4 iptable_filter ip_tables
|
||||
ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack
|
||||
ip6table_filter ip6_tables dm_mirror dm_region_hash dm_log uinput ppdev
|
||||
parport_pc parport ipv6 sg 8139too 8139cp mii i2c_piix4 i2c_core ext3
|
||||
jbd mbcache sd_mod crc_t10dif sr_mod cdrom ata_generic pata_acpi ata_piix
|
||||
dm_mod" \
|
||||
/boot/initramfs-caps.img
|
@@ -1,36 +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
|
||||
|
||||
capsmode=$(getarg rd.caps)
|
||||
|
||||
if [ "$capsmode" = "1" ]; then
|
||||
CAPS_INIT_DROP=$(getarg rd.caps.initdrop=)
|
||||
CAPS_USERMODEHELPER_BSET=$(capsh --drop="$CAPS_INIT_DROP" -- -c 'while read a b ; do [ "$a" = "CapBnd:" ] && echo $((0x${b:$((${#b}-8)):8})) $((0x${b:$((${#b}-16)):8})) && break; done < /proc/self/status')
|
||||
CAPS_MODULES_DISABLED=$(getarg rd.caps.disablemodules=)
|
||||
CAPS_KEXEC_DISABLED=$(getarg rd.caps.disablekexec=)
|
||||
|
||||
info "Loading CAPS_MODULES $CAPS_MODULES"
|
||||
for i in $CAPS_MODULES;do modprobe $i 2>&1 >/dev/null | vinfo; done
|
||||
|
||||
if [ "$CAPS_MODULES_DISABLED" = "1" -a -e /proc/sys/kernel/modules_disabled ]; then
|
||||
info "Disabling module loading."
|
||||
echo $CAPS_MODULES_DISABLED > /proc/sys/kernel/modules_disabled
|
||||
fi
|
||||
|
||||
if [ "$CAPS_KEXEC_DISABLED" = "1" -a -e /proc/sys/kernel/kexec_disabled ]; then
|
||||
info "Disabling kexec."
|
||||
echo $CAPS_KEXEC_DISABLED > /proc/sys/kernel/kexec_disabled
|
||||
fi
|
||||
|
||||
info "CAPS_USERMODEHELPER_BSET=$CAPS_USERMODEHELPER_BSET"
|
||||
if [ -e /proc/sys/kernel/usermodehelper/bset ]; then
|
||||
info "Setting usermode helper bounding set."
|
||||
echo $CAPS_USERMODEHELPER_BSET > /proc/sys/kernel/usermodehelper/bset
|
||||
echo $CAPS_USERMODEHELPER_BSET > /proc/sys/kernel/usermodehelper/inheritable
|
||||
fi
|
||||
|
||||
echo "CAPS_INIT_DROP=\"$CAPS_INIT_DROP\"" > /etc/capsdrop
|
||||
info "Will drop capabilities $CAPS_INIT_DROP from init."
|
||||
fi
|
||||
|
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
[[ $1 = -d ]] && exit 0
|
||||
|
||||
type -P capsh >/dev/null 2>&1 || exit 1
|
||||
|
||||
exit 0
|
||||
|
@@ -1,10 +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
|
||||
|
||||
inst_hook pre-pivot 99 "$moddir/caps.sh"
|
||||
dracut_install capsh
|
||||
# capsh wants bash and we need bash also
|
||||
inst /bin/bash && ln -sf bash "${initdir}/bin/sh"
|
||||
|
||||
|
@@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
[[ $1 = -d ]] && exit 0
|
||||
exit 255
|
||||
|
@@ -1,14 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
FIPSMODULES="aesni-intel"
|
||||
|
||||
mkdir -p "${initdir}/etc/modprobe.d"
|
||||
|
||||
for mod in $FIPSMODULES; do
|
||||
if hostonly='' instmods $mod; then
|
||||
echo $mod >> "${initdir}/etc/fipsmodules"
|
||||
echo "blacklist $mod" >> "${initdir}/etc/modprobe.d/fips.conf"
|
||||
fi
|
||||
done
|
||||
|
||||
# vim:ts=8:sw=4:sts=4:et
|
31
modules.d/05busybox/module-setup.sh
Executable file
31
modules.d/05busybox/module-setup.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
type -P busybox >/dev/null || return 1
|
||||
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
inst busybox /sbin/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"
|
||||
|
||||
# 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")
|
||||
ln -s /sbin/busybox "$initdir/$path"
|
||||
done
|
||||
|
||||
}
|
||||
|
2
modules.d/10i18n/10-console.rules
Normal file
2
modules.d/10i18n/10-console.rules
Normal file
@@ -0,0 +1,2 @@
|
||||
# Console initialization - keyboard, font, etc.
|
||||
KERNEL=="tty0", RUN+="/lib/udev/console_init $root/$name"
|
122
modules.d/10i18n/README
Normal file
122
modules.d/10i18n/README
Normal file
@@ -0,0 +1,122 @@
|
||||
Dracut i18n module
|
||||
------------------
|
||||
|
||||
INDEX
|
||||
|
||||
0. Introduction
|
||||
1. Hostonly vs Generic
|
||||
2. Configuration
|
||||
2.1. Variables
|
||||
2.2. Setting up mappings
|
||||
2.3. Additional settings
|
||||
3. Kernel parameters
|
||||
|
||||
~
|
||||
|
||||
0. Introduction
|
||||
|
||||
i18n module provides internationalization for initramfs at runtime. It
|
||||
is intended to be generic across different GNU/Linux distributions.
|
||||
|
||||
i18n and keyboard settings are stored in different files among
|
||||
distributions. To deal with it avoiding hardcoding those differences in
|
||||
the installation script we handle it by mappings between variables used
|
||||
by Dracut and the ones in the system. Package maintainer is expected to
|
||||
create those for his/her distribution and it's appreciated to share it
|
||||
with us, so we can include it in source package.
|
||||
|
||||
|
||||
1. Hostonly vs Generic
|
||||
|
||||
If you invoke dracut with '-H' option, i18n module install script will
|
||||
gather variables values from your configuration files using mappings
|
||||
provided in "/etc/dracut.conf.d/<foo>.conf". Those variables will be
|
||||
put in "etc/vconsole.conf" and "etc/locale.conf" files inside initramfs
|
||||
image. Next it will install only declared font, keymaps and so.
|
||||
|
||||
When building generic image (dracut without '-H' option), install script
|
||||
copies all content of directories: consolefonts, consoletrans, unimaps
|
||||
and keymaps to image. Take into account that's about 4 MiB.
|
||||
|
||||
|
||||
2. Configuration
|
||||
|
||||
2.1. Variables
|
||||
|
||||
The following variables are used by i18n install script and at initramfs
|
||||
runtime:
|
||||
|
||||
KEYMAP - keyboard translation table loaded by loadkeys
|
||||
EXT_KEYMAPS - list of extra keymaps to bo loaded (sep. by space)
|
||||
UNICODE - boolean, indicating UTF-8 mode
|
||||
FONT - console font
|
||||
FONT_MAP - see description of '-m' parameter in setfont manual
|
||||
FONT_UNIMAP - see description of '-u' parameter in setfont manual
|
||||
|
||||
The following are appended to EXT_KEYMAPS only during build time:
|
||||
|
||||
UNIKEYMAP
|
||||
GRP_TOGGLE
|
||||
|
||||
They were used in 10redhat-i18n module, but not sure of its purpose.
|
||||
I'm leaving it in case... The following are taken from the environment:
|
||||
|
||||
LANG
|
||||
LC_ALL
|
||||
|
||||
If UNICODE variable is not provided, script indicates if UTF-8 should be
|
||||
used on the basis of LANG value (if it ends with ".utf8" or similar).
|
||||
|
||||
|
||||
2.2. Setting up mappings
|
||||
|
||||
Mappings between variables listed in 2.1. and the ones spread around
|
||||
your system are set up in /etc/dracut.conf.d/<foo>.conf. You need to
|
||||
assign mappings to i18n_vars. Here's an example:
|
||||
|
||||
i18n_vars="/etc/conf.d/keymaps:KEYMAP,EXTENDED_KEYMAPS-EXT_KEYMAPS /etc/conf.d/consolefont:CONSOLEFONT-FONT,CONSOLETRANSLATION-FONT_MAP /etc/rc.conf:UNICODE"
|
||||
|
||||
First we've got name of file in host file system tree. After colon
|
||||
there's mapping: <from>-<to>. If both variables have the same name you
|
||||
can enter just a single, but it's important to specify it! The module
|
||||
will source only variables you've listed.
|
||||
|
||||
Below there's detailed description in BNF:
|
||||
|
||||
<list> ::= <element> | <element> " " <list>
|
||||
<element> ::= <conf-file-name> ":" <map-list>
|
||||
<map-list> ::= <mapping> | <mapping> "," <map-list>
|
||||
<mapping> ::= <src-var> "-" <dst-var> | <src-var>
|
||||
|
||||
We assume no whitespace are allowed between symbols.
|
||||
<conf-file-name> is a file holding <src-var> in your system.
|
||||
<src-var> is a variable holding value of meaning the same as <dst-var>.
|
||||
<dst-var> is a variable which will be set up inside initramfs.
|
||||
If <dst-var> has the same name as <src-var> we can omit <dst-var>.
|
||||
|
||||
Example:
|
||||
/etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
|
||||
<list> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
|
||||
<element> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
|
||||
<conf-file-name> = /etc/conf.d/keymaps
|
||||
<map-list> = KEYMAP,extended_keymaps-EXT_KEYMAPS
|
||||
<mapping> = KEYMAP
|
||||
<src-var> = KEYMAP
|
||||
<mapping> = extended_keymaps-EXT_KEYMAPS
|
||||
<src-var> = extended_keymaps
|
||||
<dst-var> = EXT_KEYMAPS
|
||||
|
||||
|
||||
2.3. Additional settings
|
||||
|
||||
If you encounter following error message: "Directories consolefonts,
|
||||
consoletrans, keymaps, unimaps not found.", you can provide path where
|
||||
those directories lie in your system by setting kbddir in configuration
|
||||
file (the same where you put mappings).
|
||||
|
||||
|
||||
3. Kernel parameters
|
||||
|
||||
If you create generic initramfs you can set up i18n by kernel
|
||||
parameters using variables listed in 2.1. (except of UNIKEYMAP
|
||||
and GRP_TOGGLE) The recommended minimum is: FONT and KEYMAP.
|
91
modules.d/10i18n/console_init
Executable file
91
modules.d/10i18n/console_init
Executable file
@@ -0,0 +1,91 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
[ -e /etc/vconsole.conf ] && . /etc/vconsole.conf
|
||||
|
||||
DEFAULT_FONT=LatArCyrHeb-16
|
||||
DEFAULT_KEYMAP=/etc/sysconfig/console/default.kmap
|
||||
|
||||
set_keyboard() {
|
||||
local param
|
||||
|
||||
[ "${UNICODE}" = 1 ] && param=-u || param=-a
|
||||
kbd_mode ${param}
|
||||
}
|
||||
|
||||
set_terminal() {
|
||||
local dev=$1
|
||||
|
||||
if [ "${UNICODE}" = 1 ]; then
|
||||
printf '\033%%G' >&7
|
||||
stty -F ${dev} iutf8
|
||||
else
|
||||
printf '\033%%@' >&7
|
||||
fi
|
||||
}
|
||||
|
||||
set_keymap() {
|
||||
local utf_switch
|
||||
|
||||
if [ -z "${KEYMAP}" ]; then
|
||||
[ -f "${DEFAULT_KEYMAP}" ] && KEYMAP=${DEFAULT_KEYMAP}
|
||||
fi
|
||||
|
||||
[ -n "${KEYMAP}" ] || return 1
|
||||
|
||||
[ "${UNICODE}" = 1 ] && utf_switch=-u
|
||||
|
||||
loadkeys -q ${utf_switch} ${KEYMAP} ${EXT_KEYMAPS}
|
||||
}
|
||||
|
||||
set_font() {
|
||||
local dev=$1; local trans=''; local uni=''
|
||||
|
||||
[ -z "${FONT}" ] && FONT=${DEFAULT_FONT}
|
||||
[ -n "${FONT_MAP}" ] && trans="-m ${FONT_MAP}"
|
||||
[ -n "${FONT_UNIMAP}" ] && uni="-u ${FONT_UNIMAP}"
|
||||
|
||||
setfont ${FONT} -C ${dev} ${trans} ${uni}
|
||||
}
|
||||
|
||||
dev_close() {
|
||||
exec 6>&-
|
||||
exec 7>&-
|
||||
}
|
||||
|
||||
dev_open() {
|
||||
local dev=$1
|
||||
|
||||
exec 6<${dev} && \
|
||||
exec 7>>${dev}
|
||||
}
|
||||
|
||||
|
||||
dev=/dev/${1#/dev/}
|
||||
devname=${dev#/dev/}
|
||||
|
||||
[ -c "${dev}" ] || {
|
||||
echo "Usage: $0 device" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -e /tmp/console_init.${devname} ] && exit 0
|
||||
|
||||
dev_open ${dev}
|
||||
|
||||
for fd in 6 7; do
|
||||
if ! [ -t ${fd} ]; then
|
||||
echo "ERROR: File descriptor not opened: ${fd}" >&2
|
||||
dev_close
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
set_keyboard
|
||||
set_terminal ${dev}
|
||||
set_font ${dev}
|
||||
set_keymap
|
||||
|
||||
dev_close
|
||||
>/tmp/console_init.${devname}
|
209
modules.d/10i18n/module-setup.sh
Executable file
209
modules.d/10i18n/module-setup.sh
Executable file
@@ -0,0 +1,209 @@
|
||||
#!/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 0
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
|
||||
DEFAULT_FONT=LatArCyrHeb-16
|
||||
I18N_CONF="/etc/locale.conf"
|
||||
VCONFIG_CONF="/etc/vconsole.conf"
|
||||
|
||||
# This is from 10redhat-i18n.
|
||||
findkeymap () {
|
||||
local MAP=$1
|
||||
[[ ! -f $MAP ]] && \
|
||||
MAP=$(find ${kbddir}/keymaps -type f -name $MAP -o -name $MAP.\* | head -n1)
|
||||
[[ " $KEYMAPS " = *" $MAP "* ]] && return
|
||||
KEYMAPS="$KEYMAPS $MAP"
|
||||
case $MAP in
|
||||
*.gz) cmd=zgrep;;
|
||||
*.bz2) cmd=bzgrep;;
|
||||
*) cmd=grep ;;
|
||||
esac
|
||||
|
||||
for INCL in $($cmd "^include " $MAP | cut -d' ' -f2 | tr -d '"'); do
|
||||
for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
|
||||
findkeymap $FN
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
# Function gathers variables from distributed files among the tree, maps to
|
||||
# specified names and prints the result in format "new-name=value".
|
||||
#
|
||||
# $@ = list in format specified below (BNF notation)
|
||||
#
|
||||
# <list> ::= <element> | <element> " " <list>
|
||||
# <element> ::= <conf-file-name> ":" <map-list>
|
||||
# <map-list> ::= <mapping> | <mapping> "," <map-list>
|
||||
# <mapping> ::= <src-var> "-" <dst-var> | <src-var>
|
||||
#
|
||||
# We assume no whitespace are allowed between symbols.
|
||||
# <conf-file-name> is a file holding <src-var> in your system.
|
||||
# <src-var> is a variable holding value of meaning the same as <dst-var>.
|
||||
# <dst-var> is a variable which will be set up inside initramfs.
|
||||
# If <dst-var> has the same name as <src-var> we can omit <dst-var>.
|
||||
#
|
||||
# Example:
|
||||
# /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
|
||||
# <list> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
|
||||
# <element> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
|
||||
# <conf-file-name> = /etc/conf.d/keymaps
|
||||
# <map-list> = KEYMAP,extended_keymaps-EXT_KEYMAPS
|
||||
# <mapping> = KEYMAP
|
||||
# <src-var> = KEYMAP
|
||||
# <mapping> = extended_keymaps-EXT_KEYMAPS
|
||||
# <src-var> = extended_keymaps
|
||||
# <dst-var> = EXT_KEYMAPS
|
||||
gather_vars() {
|
||||
local item map value
|
||||
|
||||
for item in $@
|
||||
do
|
||||
item=${item/:/ }
|
||||
for map in ${item[1]//,/ }
|
||||
do
|
||||
map=${map//-/ }
|
||||
value=$(grep "^${map[0]}=" "${item[0]}")
|
||||
value=${value#*=}
|
||||
echo "${map[1]:-${map[0]}}=${value}"
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
install_base() {
|
||||
dracut_install setfont loadkeys kbd_mode stty
|
||||
|
||||
inst ${moddir}/console_init /lib/udev/console_init
|
||||
inst_rules ${moddir}/10-console.rules
|
||||
inst_hook cmdline 20 "${moddir}/parse-i18n.sh"
|
||||
}
|
||||
|
||||
install_all_kbd() {
|
||||
local rel f
|
||||
|
||||
for f in $(eval find ${kbddir}/{${KBDSUBDIRS}} -type f -print)
|
||||
do
|
||||
inst $f
|
||||
done
|
||||
|
||||
# remove unnecessary files
|
||||
rm -f "${initdir}${kbddir}/consoletrans/utflist"
|
||||
find "${initdir}${kbddir}/" -name README\* -delete
|
||||
|
||||
dracut_install gzip bzip2
|
||||
}
|
||||
|
||||
install_local_i18n() {
|
||||
local map
|
||||
|
||||
eval $(gather_vars ${i18n_vars})
|
||||
[ -f $I18N_CONF ] && . $I18N_CONF
|
||||
[ -f $VCONFIG_CONF ] && . $VCONFIG_CONF
|
||||
|
||||
# Gentoo user may have KEYMAP set to something like "-u pl2",
|
||||
KEYMAP=${KEYMAP#-* }
|
||||
# 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}
|
||||
|
||||
[[ ${KEYMAP} ]] || dwarning 'No KEYMAP.' || return 1
|
||||
findkeymap ${KEYMAP}
|
||||
|
||||
for map in ${EXT_KEYMAPS}
|
||||
do
|
||||
dinfo "Adding extra map: ${map}"
|
||||
findkeymap ${map}
|
||||
done
|
||||
|
||||
inst_opt_decompress ${KEYMAPS}
|
||||
|
||||
inst_opt_decompress ${kbddir}/consolefonts/${DEFAULT_FONT}.*
|
||||
|
||||
if [[ ${FONT} ]]
|
||||
then
|
||||
FONT=${FONT%.psf*}
|
||||
inst_opt_decompress ${kbddir}/consolefonts/${FONT}.*
|
||||
fi
|
||||
|
||||
if [[ ${FONT_MAP} ]]
|
||||
then
|
||||
FONT_MAP=${FONT_MAP%.trans}
|
||||
inst ${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
|
||||
fi
|
||||
|
||||
mksubdirs ${initdir}${I18N_CONF}
|
||||
mksubdirs ${initdir}${VCONFIG_CONF}
|
||||
print_vars LC_ALL LANG >> ${initdir}${I18N_CONF}
|
||||
print_vars KEYMAP EXT_KEYMAPS UNICODE FONT FONT_MAP FONT_UNIMAP >> ${initdir}${VCONFIG_CONF}
|
||||
return 0
|
||||
}
|
||||
|
||||
checks() {
|
||||
for kbddir in ${kbddir} /usr/lib/kbd /lib/kbd /usr/share /usr/share/kbd
|
||||
do
|
||||
[[ -d "${kbddir}" ]] && \
|
||||
for dir in ${KBDSUBDIRS//,/ }
|
||||
do
|
||||
[[ -d "${kbddir}/${dir}" ]] && continue
|
||||
false
|
||||
done && break
|
||||
kbddir=''
|
||||
done
|
||||
|
||||
[[ ${kbddir} ]] || {
|
||||
derror "Directories ${KBDSUBDIRS//,/, } not found. Please inform us about the issue including your OS name and version."
|
||||
return 1
|
||||
}
|
||||
|
||||
[[ -f $I18N_CONF && -f $VCONFIG_CONF ]] || \
|
||||
[[ ! ${hostonly} || ${i18n_vars} ]] || {
|
||||
dwarning 'Please set up i18n_vars in configuration file.'
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
if checks
|
||||
then
|
||||
install_base
|
||||
|
||||
if [[ ${hostonly} ]]
|
||||
then
|
||||
install_local_i18n || install_all_kbd
|
||||
else
|
||||
install_all_kbd
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
33
modules.d/10i18n/parse-i18n.sh
Executable file
33
modules.d/10i18n/parse-i18n.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
inst_key_val() {
|
||||
local _value
|
||||
local _file
|
||||
_file=$1
|
||||
shift
|
||||
_value=$(getarg $@)
|
||||
if [ -n "${_value}" ]; then
|
||||
printf '%s="%s"\n' $1 ${_value} >> $_file
|
||||
fi
|
||||
unset _file
|
||||
unset _value
|
||||
}
|
||||
|
||||
inst_key_val /etc/vconsole.conf KEYMAP vconsole.keymap KEYTABLE
|
||||
inst_key_val /etc/vconsole.conf FONT vconsole.font SYSFONT
|
||||
inst_key_val /etc/vconsole.conf FONT_MAP vconsole.font.map CONTRANS
|
||||
inst_key_val /etc/vconsole.conf FONT_UNIMAP vconsole.font.unimap UNIMAP
|
||||
inst_key_val /etc/vconsole.conf UNICODE vconsole.font.unicode
|
||||
inst_key_val /etc/vconsole.conf EXT_KEYMAP vconsole.keymap.ext
|
||||
|
||||
inst_key_val /etc/locale.conf LANG locale.LANG
|
||||
inst_key_val /etc/locale.conf LC_ALL locale.LC_ALL
|
||||
|
||||
if [ -f /etc/locale.conf ]; then
|
||||
. /etc/locale.conf
|
||||
export LANG
|
||||
export LC_ALL
|
||||
fi
|
||||
|
@@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
[ -f /etc/redhat-release ]
|
@@ -1,100 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
findkeymap () {
|
||||
local MAP=$1
|
||||
[[ ! -f $MAP ]] && \
|
||||
MAP=$(find ${kbddir}/keymaps -type f -name $MAP -o -name $MAP.\* | head -n1)
|
||||
[[ " $KEYMAPS " = *" $MAP "* ]] && return
|
||||
KEYMAPS="$KEYMAPS $MAP"
|
||||
case $MAP in
|
||||
*.gz) cmd=zgrep;;
|
||||
*.bz2) cmd=bzgrep;;
|
||||
*) cmd=grep ;;
|
||||
esac
|
||||
|
||||
for INCL in $($cmd "^include " $MAP | cut -d' ' -f2 | tr -d '"'); do
|
||||
for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
|
||||
findkeymap $FN
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
install_local()
|
||||
{
|
||||
# FIXME: i18n stuff isn't really distro-independent :/
|
||||
if [[ -f /etc/sysconfig/keyboard || -f /etc/sysconfig/console/default.kmap ]]; then
|
||||
if [ -f /etc/sysconfig/console/default.kmap ]; then
|
||||
KEYMAP=/etc/sysconfig/console/default.kmap
|
||||
else
|
||||
. /etc/sysconfig/keyboard
|
||||
if [[ $KEYTABLE && -d ${kbddir}/keymaps ]]; then
|
||||
[[ $KEYTABLE =~ *.uni ]] && UNIKEYMAP="$KEYTABLE.map" \
|
||||
|| UNIKEYMAP="$KEYTABLE.uni.map"
|
||||
KEYMAP="$KEYTABLE.map"
|
||||
fi
|
||||
fi
|
||||
if [[ $KEYMAP ]]; then
|
||||
[ -f /etc/sysconfig/keyboard ] && inst /etc/sysconfig/keyboard
|
||||
inst loadkeys
|
||||
findkeymap $KEYMAP
|
||||
[[ $UNIKEYMAP ]] && findkeymap $UNIKEYMAP
|
||||
[[ $GRP_TOGGLE ]] && findkeymap $GRP_TOGGLE.map
|
||||
findkeymap delete.map
|
||||
findkeymap backspace.map
|
||||
|
||||
for FN in $KEYMAPS; do
|
||||
if [ -L $FN ]; then
|
||||
TARGET=$(readlink -f $FN)
|
||||
TG=$(echo $TARGET | sed -e 's/\.gz$//' -e 's/\.bz2$//')
|
||||
LN=$(echo $FN | sed -e 's/\.gz$//' -e 's/\.bz2$//')
|
||||
mkdir -p "$initdir/$(dirname $LN)"
|
||||
ln -s "$TG" "$initdir/$LN"
|
||||
FN=$TARGET
|
||||
fi
|
||||
inst $FN
|
||||
case $FN in
|
||||
*.gz) gzip -d "$initdir$FN" ;;
|
||||
*.bz2) bzip2 -d "$initdir$FN" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f /etc/sysconfig/i18n ]; then
|
||||
. /etc/sysconfig/i18n
|
||||
inst /etc/sysconfig/i18n
|
||||
[[ $SYSFONT ]] || SYSFONT=latarcyrheb-sun16
|
||||
inst setfont
|
||||
|
||||
for FN in ${kbddir}/consolefonts/$SYSFONT.* ; do
|
||||
inst "$FN"
|
||||
case $FN in
|
||||
*.gz) gzip -d "$initdir$FN" ;;
|
||||
*.bz2) bzip2 -d "$initdir$FN" ;;
|
||||
esac
|
||||
done
|
||||
[[ $SYSFONTACM ]] && inst ${kbddir}/consoletrans/$SYSFONTACM
|
||||
[[ $UNIMAP ]] && inst ${kbddir}/unimaps/$UNIMAP
|
||||
fi
|
||||
}
|
||||
|
||||
for kbddir in /usr/lib/kbd /lib/kbd; do
|
||||
[[ -d ${kbddir} ]] && break
|
||||
done
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
install_local
|
||||
else
|
||||
for i in $(find ${kbddir} -type f -print); do
|
||||
dracut_install $i
|
||||
done
|
||||
# remove unnecessary files
|
||||
rm -f "$initdir${kbddir}/consoletrans/utflist" 2>/dev/null
|
||||
find "$initdir${kbddir}/" -name README\* -exec rm -f '{}' \;
|
||||
dracut_install gzip bzip2
|
||||
fi
|
||||
|
||||
[ -x /lib/udev/console_init ] && dracut_install /lib/udev/console_init
|
||||
dracut_install setfont loadkeys
|
||||
inst_rules 10-console.rules
|
||||
inst_hook cmdline 20 "$moddir/parse-i18n.sh"
|
@@ -1,20 +0,0 @@
|
||||
inst_key_val()
|
||||
{
|
||||
local value
|
||||
value=$(getarg $1)
|
||||
[ -n "$value" ] && printf '%s="%s"\n' $1 $value >> $2
|
||||
}
|
||||
|
||||
mkdir -p /etc/sysconfig
|
||||
inst_key_val KEYBOARDTYPE /etc/sysconfig/keyboard
|
||||
inst_key_val KEYTABLE /etc/sysconfig/keyboard
|
||||
inst_key_val SYSFONT /etc/sysconfig/i18n
|
||||
inst_key_val SYSFONTACM /etc/sysconfig/i18n
|
||||
inst_key_val UNIMAP /etc/sysconfig/i18n
|
||||
inst_key_val LANG /etc/sysconfig/i18n
|
||||
|
||||
if [ -f /etc/sysconfig/i18n ]; then
|
||||
. /etc/sysconfig/i18n
|
||||
export LANG
|
||||
fi
|
||||
|
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
[ -f /etc/redhat-release ]
|
||||
|
@@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -e "$moddir/dracut-version" ]; then
|
||||
dracut_rpm_version=$(cat "$moddir/dracut-version")
|
||||
inst "$moddir/dracut-version" /$dracut_rpm_version
|
||||
else
|
||||
if rpm -qf $(which $0) &>/dev/null; then
|
||||
dracut_rpm_version=$(rpm -qf --qf '%{name}-%{version}-%{release}\n' $(which $0) | { ver="";while read line;do ver=$line;done;echo $ver;} )
|
||||
echo $dracut_rpm_version > $initdir/$dracut_rpm_version
|
||||
fi
|
||||
fi
|
||||
inst_hook cmdline 01 "$moddir/version.sh"
|
||||
|
26
modules.d/10rpmversion/module-setup.sh
Executable file
26
modules.d/10rpmversion/module-setup.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
[ -f /etc/redhat-release ]
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
if [ -e "$moddir/dracut-version" ]; then
|
||||
dracut_rpm_version=$(cat "$moddir/dracut-version")
|
||||
inst "$moddir/dracut-version" /$dracut_rpm_version
|
||||
else
|
||||
if rpm -qf $(type -P $0) &>/dev/null; then
|
||||
dracut_rpm_version=$(rpm -qf --qf '%{name}-%{version}-%{release}\n' $(type -P $0) | { ver="";while read line;do ver=$line;done;echo $ver;} )
|
||||
echo $dracut_rpm_version > $initdir/$dracut_rpm_version
|
||||
fi
|
||||
fi
|
||||
inst_hook cmdline 01 "$moddir/version.sh"
|
||||
|
||||
}
|
||||
|
2
modules.d/10rpmversion/version.sh
Normal file → Executable file
2
modules.d/10rpmversion/version.sh
Normal file → Executable file
@@ -1,3 +1,5 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
for i in dracut-*; do
|
||||
if [ -f $i ]; then
|
||||
vinfo < $i
|
||||
|
@@ -1,27 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ $1 = -d ]]; then
|
||||
[ -d /etc/sysconfig/network-scripts/ ] && echo ifcfg
|
||||
exit 0
|
||||
fi
|
||||
|
||||
. $dracutfunctions
|
||||
|
||||
for program in ip arping; do
|
||||
which $program >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
dwarning "Could not find program \"$program\" required by network."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
for program in dhclient brctl ifenslave tr; do
|
||||
which $program >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
dwarning "Could not find program \"$program\" it might be required by network."
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
|
||||
exit 255
|
||||
|
@@ -1,4 +1,6 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
setup_interface() {
|
||||
ip=$new_ip_address
|
||||
@@ -20,25 +22,23 @@ setup_interface() {
|
||||
# disallow MTUs from 576 and below by default, so that broken
|
||||
# MTUs are ignored, but higher stuff is allowed (1492, 1500, etc).
|
||||
if [ -n "$mtu" ] && [ $mtu -gt 576 ] ; then
|
||||
if ! ip link set $netif mtu $mtu ; then
|
||||
ip link set $netif down
|
||||
ip link set $netif mtu $mtu
|
||||
ip link set $netif up
|
||||
wait_for_if_up $netif
|
||||
fi
|
||||
fi
|
||||
echo "if ! ip link set $netif mtu $mtu ; then"
|
||||
echo "ip link set $netif down"
|
||||
echo "ip link set $netif mtu $mtu"
|
||||
echo "ip link set $netif up"
|
||||
echo wait_for_if_up $netif
|
||||
echo "fi"
|
||||
fi > /tmp/net.$netif.up
|
||||
|
||||
ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif
|
||||
|
||||
> /tmp/net.$netif.up
|
||||
echo ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif >> /tmp/net.$netif.up
|
||||
|
||||
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
|
||||
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
|
||||
if [ -n "$namesrv" ] ; then
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
done
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
done
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
|
||||
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
@@ -47,32 +47,35 @@ setup_interface() {
|
||||
PATH=$PATH:/sbin:/usr/sbin
|
||||
|
||||
export PS4="dhclient.$interface.$$ + "
|
||||
exec >>/dev/initlog.pipe 2>>/dev/initlog.pipe
|
||||
exec >>/dev/.initramfs/initlog.pipe 2>>/dev/.initramfs/initlog.pipe
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
# We already need a set netif here
|
||||
netif=$interface
|
||||
|
||||
# Huh? Interface configured?
|
||||
[ -f "/tmp/net.$netif.up" ] && exit 0
|
||||
|
||||
case $reason in
|
||||
PREINIT)
|
||||
echo "dhcp: PREINIT $netif up"
|
||||
ip link set $netif up
|
||||
wait_for_if_up $netif
|
||||
;;
|
||||
echo "dhcp: PREINIT $netif up"
|
||||
ip link set $netif up
|
||||
wait_for_if_up $netif
|
||||
;;
|
||||
BOUND)
|
||||
echo "dhcp: BOND setting $netif"
|
||||
if ! arping -q -D -c 2 -I $netif $new_ip_address ; then
|
||||
warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
|
||||
exit 1
|
||||
fi
|
||||
setup_interface
|
||||
set | while read line; do
|
||||
[ "${line#new_}" = "$line" ] && continue
|
||||
echo "$line"
|
||||
done >/tmp/dhclient.$netif.dhcpopts
|
||||
echo online > /sys/class/net/$netif/uevent
|
||||
/sbin/initqueue --onetime --name netroot-$netif /sbin/netroot $netif
|
||||
;;
|
||||
echo "dhcp: BOND setting $netif"
|
||||
if ! arping -q -D -c 2 -I $netif $new_ip_address ; then
|
||||
warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
|
||||
exit 1
|
||||
fi
|
||||
setup_interface
|
||||
set | while read line; do
|
||||
[ "${line#new_}" = "$line" ] && continue
|
||||
echo "$line"
|
||||
done >/tmp/dhclient.$netif.dhcpopts
|
||||
echo online > /sys/class/net/$netif/uevent
|
||||
/sbin/initqueue --onetime --name netroot-$netif /sbin/netroot $netif
|
||||
;;
|
||||
*) echo "dhcp: $reason";;
|
||||
esac
|
||||
|
||||
|
@@ -1,4 +1,6 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# Don't continue if root is ok
|
||||
[ -n "$rootok" ] && return
|
||||
@@ -14,7 +16,7 @@ if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] ; th
|
||||
# Done, all good!
|
||||
rootok=1
|
||||
if [ "$netroot" != "dhcp" ] ; then
|
||||
netroot=$root
|
||||
netroot=$root
|
||||
fi
|
||||
|
||||
# Shut up init error check
|
||||
|
@@ -1,4 +1,6 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# if there are no ifname parameters, just use NAME=KERNEL
|
||||
if ! getarg ifname= >/dev/null ; then
|
||||
@@ -6,22 +8,14 @@ if ! getarg ifname= >/dev/null ; then
|
||||
fi
|
||||
|
||||
{
|
||||
|
||||
echo 'SUBSYSTEM!="net", GOTO="ifname_end"'
|
||||
echo 'ACTION!="add", GOTO="ifname_end"'
|
||||
echo 'ATTR{type}!="1", GOTO="ifname_end"'
|
||||
|
||||
for p in $(getargs ifname=); do
|
||||
parse_ifname_opts $p
|
||||
printf 'DRIVERS=="?*", ATTR{address}=="%s", NAME="%s", GOTO="ifname_end"\n' "$ifname_mac" "$ifname_if"
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="%s", ATTR{type}=="1", NAME="%s"\n' "$ifname_mac" "$ifname_if"
|
||||
done
|
||||
|
||||
# Rename non named interfaces out of the way for named ones.
|
||||
for p in $(getargs ifname=); do
|
||||
parse_ifname_opts $p
|
||||
printf 'DRIVERS=="?*", ATTR{address}!="%s", KERNEL=="%s", NAME="rename$attr{ifindex}", GOTO="ifname_end"\n' "$ifname_mac" "$ifname_if"
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="?*", ATTR{type}=="1", NAME!="?*", KERNEL=="%s", NAME="%%k-renamed"\n' "$ifname_if"
|
||||
done
|
||||
|
||||
echo 'LABEL="ifname_end"'
|
||||
|
||||
} > /etc/udev/rules.d/50-ifname.rules
|
||||
|
@@ -1,43 +1,31 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# We don't need to check for ip= errors here, that is handled by the
|
||||
# cmdline parser script
|
||||
#
|
||||
PATH=$PATH:/sbin:/usr/sbin
|
||||
|
||||
export PS4="ifup.$1.$$ + "
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
[ "$RDDEBUG" = "yes" ] \
|
||||
&& [ -e /dev/initlog.pipe ] \
|
||||
&& exec >>/dev/initlog.pipe 2>>/dev/initlog.pipe
|
||||
|
||||
# Run dhclient
|
||||
do_dhcp() {
|
||||
# /sbin/dhclient-script will mark the netif up and generate the online
|
||||
# event for nfsroot
|
||||
# XXX add -V vendor class and option parsing per kernel
|
||||
#echo "Starting dhcp for interface $netif"
|
||||
ip link set $netif up
|
||||
wait_for_if_up $netif
|
||||
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
|
||||
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
|
||||
dhclient "$@" -1 -q -cf /etc/dhclient.conf -pf /tmp/dhclient.$netif.pid -lf /tmp/dhclient.$netif.lease $netif &
|
||||
|
||||
# increase wait time for DHCP
|
||||
echo '[ $(($RDRETRY-$main_loop)) -lt 720 ] && RDRETRY=$(($main_loop+720)); rm -f "$job"' > /initqueue/rd_retry_inc_dhclient.$netif.sh
|
||||
|
||||
#|| echo "dhcp failed"
|
||||
echo "Starting dhcp for interface $netif"
|
||||
dhclient "$@" -1 -q -cf /etc/dhclient.conf -pf /tmp/dhclient.$netif.pid -lf /tmp/dhclient.$netif.lease $netif \
|
||||
|| echo "dhcp failed"
|
||||
}
|
||||
|
||||
load_ipv6() {
|
||||
modprobe ipv6
|
||||
i=0
|
||||
while [ ! -d /proc/sys/net/ipv6 ]; do
|
||||
i=$(($i+1))
|
||||
[ $i -gt 10 ] && break
|
||||
sleep 0.1
|
||||
i=$(($i+1))
|
||||
[ $i -gt 10 ] && break
|
||||
sleep 0.1
|
||||
done
|
||||
}
|
||||
|
||||
@@ -47,20 +35,17 @@ do_ipv6auto() {
|
||||
echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
|
||||
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
|
||||
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
|
||||
ip link set $netif up
|
||||
wait_for_if_up $netif
|
||||
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
|
||||
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
|
||||
}
|
||||
> /tmp/net.$netif.up
|
||||
echo ip link set $netif up
|
||||
echo wait_for_if_up $netif
|
||||
} > /tmp/net.$netif.up
|
||||
|
||||
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
|
||||
namesrv=$(getargs nameserver)
|
||||
if [ -n "$namesrv" ] ; then
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
done
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
done
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
|
||||
|
||||
@@ -73,41 +58,33 @@ do_static() {
|
||||
strstr $ip '*:*:*' && load_ipv6
|
||||
|
||||
{
|
||||
ip link set $netif up
|
||||
wait_for_if_up $netif
|
||||
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
|
||||
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
|
||||
# do not flush addr for ipv6
|
||||
#strstr $ip '*:*:*' || \
|
||||
# ip addr flush dev $netif
|
||||
ip addr add $ip/$mask brd + dev $netif
|
||||
}
|
||||
> /tmp/net.$netif.up
|
||||
echo ip link set $netif up
|
||||
echo wait_for_if_up $netif
|
||||
# do not flush addr for ipv6
|
||||
strstr $ip '*:*:*' || \
|
||||
echo ip addr flush dev $netif
|
||||
echo ip addr add $ip/$mask dev $netif
|
||||
} > /tmp/net.$netif.up
|
||||
|
||||
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
|
||||
namesrv=$(getargs nameserver)
|
||||
if [ -n "$namesrv" ] ; then
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
done
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
done
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
|
||||
echo online > /sys/class/net/$netif/uevent
|
||||
/sbin/initqueue --onetime --name netroot-$netif /sbin/netroot $netif
|
||||
}
|
||||
|
||||
get_vid() {
|
||||
case "$1" in
|
||||
vlan*)
|
||||
echo ${1#vlan}
|
||||
;;
|
||||
*.*)
|
||||
echo ${1##*.}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
PATH=$PATH:/sbin:/usr/sbin
|
||||
|
||||
export PS4="ifup.$1.$$ + "
|
||||
exec >>/dev/.initramfs/initlog.pipe 2>>/dev/.initramfs/initlog.pipe
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
# Huh? No $1?
|
||||
[ -z "$1" ] && exit 1
|
||||
@@ -115,24 +92,6 @@ get_vid() {
|
||||
# $netif reads easier than $1
|
||||
netif=$1
|
||||
|
||||
# check, if we need VLAN's for this interface
|
||||
if [ -z "$DO_VLAN_PHY" ] && [ -e /tmp/vlan.${netif}.phy ]; then
|
||||
NO_AUTO_DHCP=yes DO_VLAN_PHY=yes ifup "$netif"
|
||||
modprobe -b -q 8021q
|
||||
|
||||
for i in /tmp/vlan.*.${netif}; do
|
||||
[ -e "$i" ] || continue
|
||||
read vlanname < "$i"
|
||||
if [ -n "$vlanname" ]; then
|
||||
ip link set "$netif" up
|
||||
wait_for_if_up "$netif"
|
||||
ip link add dev "$vlanname" link "$netif" type vlan id "$(get_vid $vlanname)"
|
||||
ifup "$vlanname"
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# enslave this interface to bond?
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
@@ -155,7 +114,6 @@ if [ -e /tmp/bridge.info ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# bail immediately if the interface is already up
|
||||
# or we don't need the network
|
||||
[ -f "/tmp/net.$netif.up" ] && exit 0
|
||||
@@ -177,7 +135,6 @@ if [ -e /tmp/bond.info ]; then
|
||||
|
||||
if [ "$netif" = "$bondname" ] && [ ! -e /tmp/net.$bondname.up ] ; then # We are master bond device
|
||||
modprobe bonding
|
||||
echo "+$netif" > /sys/class/net/bonding_masters
|
||||
ip link set $netif down
|
||||
|
||||
# Stolen from ifup-eth
|
||||
@@ -235,15 +192,14 @@ if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
|
||||
brctl addif $bridgename $ethname
|
||||
fi
|
||||
|
||||
|
||||
# No ip lines default to dhcp
|
||||
ip=$(getarg ip)
|
||||
|
||||
if [ -z "$NO_AUTO_DHCP" ] && [ -z "$ip" ]; then
|
||||
if [ -z "$ip" ]; then
|
||||
if [ "$netroot" = "dhcp6" ]; then
|
||||
do_dhcp -6
|
||||
do_dhcp -6
|
||||
else
|
||||
do_dhcp -4
|
||||
do_dhcp -4
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -251,40 +207,25 @@ fi
|
||||
# looking for ip= lines
|
||||
for p in $(getargs ip=); do
|
||||
ip_to_var $p
|
||||
|
||||
|
||||
# If this option isn't directed at our interface, skip it
|
||||
[ -n "$dev" ] && [ "$dev" != "$netif" ] && continue
|
||||
|
||||
# skip ibft
|
||||
if [ "$autoconf" = "ibft" ]; then
|
||||
if [ -n "$mtu" ] || mtu=$(getarg "mtu="); then
|
||||
ip link set mtu $mtu dev $netif
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
# Store config for later use
|
||||
for i in ip srv gw mask hostname macaddr mtu; do
|
||||
eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
|
||||
for i in ip srv gw mask hostname; do
|
||||
eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
|
||||
done > /tmp/net.$netif.override
|
||||
|
||||
OLDIFS="$IFS"
|
||||
IFS=,
|
||||
set -- $autoconf
|
||||
IFS="$OLDIFS"
|
||||
|
||||
for autoconf in "$@"; do
|
||||
case $autoconf in
|
||||
dhcp|on|any)
|
||||
do_dhcp -4 ;;
|
||||
dhcp6)
|
||||
do_dhcp -6 ;;
|
||||
auto6)
|
||||
do_ipv6auto ;;
|
||||
*)
|
||||
do_static ;;
|
||||
esac
|
||||
done
|
||||
case $autoconf in
|
||||
dhcp|on|any)
|
||||
do_dhcp -4 ;;
|
||||
dhcp6)
|
||||
do_dhcp -6 ;;
|
||||
auto6)
|
||||
do_ipv6auto ;;
|
||||
*)
|
||||
do_static ;;
|
||||
esac
|
||||
break
|
||||
done
|
||||
|
||||
|
@@ -1,36 +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
|
||||
dracut_install ip dhclient brctl arping ifenslave tr
|
||||
|
||||
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_hook pre-udev 50 "$moddir/ifname-genrules.sh"
|
||||
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
|
||||
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
|
||||
|
||||
inst_hook cmdline 94 "$moddir/parse-ibft.sh"
|
||||
inst_hook cmdline 95 "$moddir/parse-vlan.sh"
|
||||
inst_hook cmdline 97 "$moddir/parse-bond.sh"
|
||||
inst_hook cmdline 98 "$moddir/parse-bridge.sh"
|
||||
inst_hook cmdline 99 "$moddir/parse-ip-opts.sh"
|
||||
|
||||
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
|
||||
inst_hook pre-pivot 10 "$moddir/kill-dhclient.sh"
|
||||
|
||||
if ldd $(which sh) 2>/dev/null | grep -q lib64; then
|
||||
LIBDIR="/lib64"
|
||||
else
|
||||
LIBDIR="/lib"
|
||||
fi
|
||||
|
||||
ARCH=$(uname -m)
|
||||
|
||||
for dir in /usr/$LIBDIR/tls/$ARCH/ /usr/$LIBDIR/tls/ /usr/$LIBDIR/$ARCH/ /usr/$LIBDIR/ /$LIBDIR/; do
|
||||
for i in $(ls $dir/libnss_dns.so.* $dir/libnss_mdns4_minimal.so.* 2>/dev/null); do
|
||||
dracut_install $i
|
||||
done
|
||||
done
|
||||
|
@@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Include wired net drivers, excluding wireless
|
||||
|
||||
net_module_test() {
|
||||
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 ]]
|
||||
}
|
||||
|
||||
instmods $(filter_kernel_modules net_module_test)
|
||||
|
||||
instmods ecb arc4
|
||||
# bridge modules
|
||||
instmods bridge stp llc
|
||||
instmods ipv6
|
||||
# vlan
|
||||
instmods 8021q
|
||||
# bonding
|
||||
instmods bonding
|
||||
# hyperv
|
||||
hostonly='' instmods hv_netvsc
|
@@ -1,7 +1,17 @@
|
||||
#!/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 /tmp/dhclient.*.pid; do
|
||||
[ -e $f ] || continue
|
||||
read PID < $f;
|
||||
kill $PID;
|
||||
done
|
||||
|
||||
sleep 0.1
|
||||
|
||||
for f in /tmp/dhclient.*.pid; do
|
||||
[ -e $f ] || continue
|
||||
read PID < $f;
|
||||
kill -9 $PID;
|
||||
done
|
||||
|
74
modules.d/40network/module-setup.sh
Executable file
74
modules.d/40network/module-setup.sh
Executable file
@@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
. $dracutfunctions
|
||||
|
||||
for program in ip arping; do
|
||||
if ! type -P $program >/dev/null; then
|
||||
dwarning "Could not find program \"$program\" required by network."
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
for program in dhclient brctl ifenslave tr; do
|
||||
if ! type -P $program >/dev/null; then
|
||||
dwarning "Could not find program \"$program\" it might be required by network."
|
||||
fi
|
||||
done
|
||||
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
[ -d /etc/sysconfig/network-scripts/ ] && echo ifcfg
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
# Include wired net drivers, excluding wireless
|
||||
|
||||
net_module_test() {
|
||||
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 ]]
|
||||
}
|
||||
|
||||
instmods $(filter_kernel_modules net_module_test)
|
||||
|
||||
instmods ecb arc4
|
||||
# bridge modules
|
||||
instmods bridge stp llc
|
||||
instmods ipv6
|
||||
# bonding
|
||||
instmods bonding
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install ip dhclient brctl arping ifenslave tr
|
||||
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_hook pre-udev 50 "$moddir/ifname-genrules.sh"
|
||||
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
|
||||
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
|
||||
inst_hook cmdline 99 "$moddir/parse-ip-opts.sh"
|
||||
inst_hook cmdline 97 "$moddir/parse-bond.sh"
|
||||
inst_hook cmdline 98 "$moddir/parse-bridge.sh"
|
||||
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
|
||||
inst_hook pre-pivot 10 "$moddir/kill-dhclient.sh"
|
||||
|
||||
arch=$(uname -m)
|
||||
|
||||
for dir in "$usrlibdir/tls/$arch" "$usrlibdir/tls" "$usrlibdir/$arch" \
|
||||
"$usrlibdir" "$libdir"; do
|
||||
for i in "$dir"/libnss_dns.so.* "$dir"/libnss_mdns4_minimal.so.*; do
|
||||
[ -e "$i" ] && dracut_install "$i"
|
||||
done
|
||||
done
|
||||
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@ fix_bootif() {
|
||||
macaddr=${macaddr%:}
|
||||
# strip hardware type field from pxelinux
|
||||
[ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
|
||||
echo $macaddr | tr '[:upper:]' '[:lower:]'
|
||||
echo $macaddr
|
||||
}
|
||||
|
||||
# Don't continue if we don't need network
|
||||
@@ -21,14 +21,9 @@ fix_bootif() {
|
||||
# bridge: attempt only the defined interface
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
IFACES="$IFACES $ethname"
|
||||
IFACES=$ethname
|
||||
fi
|
||||
|
||||
for i in /tmp/vlan.*.phy; do
|
||||
[ -e "$i" ] || continue
|
||||
IFACES="$IFACES $(cat "$i")"
|
||||
done
|
||||
|
||||
# bond: attempt only the defined interface (override bridge defines)
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
@@ -39,18 +34,18 @@ fix_bootif() {
|
||||
# BOOTIF says everything, use only that one
|
||||
BOOTIF=$(getarg 'BOOTIF=')
|
||||
if [ -n "$BOOTIF" ] ; then
|
||||
BOOTIF=$(fix_bootif "$BOOTIF")
|
||||
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/initqueue --onetime --unique --name ifup-$env{INTERFACE} /sbin/ifup $env{INTERFACE}"\n' "$BOOTIF"
|
||||
BOOTIF=$(fix_bootif "$BOOTIF")
|
||||
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$BOOTIF"
|
||||
|
||||
# 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/initqueue --onetime --unique --name ifup-$env{INTERFACE} /sbin/ifup $env{INTERFACE}"\n' "$iface"
|
||||
done
|
||||
for iface in $IFACES ; do
|
||||
printf 'ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$iface"
|
||||
done
|
||||
|
||||
# Default: We don't know the interface to use, handle all
|
||||
else
|
||||
printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name ifup-$env{INTERFACE} /sbin/ifup $env{INTERFACE}"\n'
|
||||
printf 'ACTION=="add", SUBSYSTEM=="net", RUN+="/sbin/ifup $env{INTERFACE}"\n'
|
||||
fi
|
||||
|
||||
} > /etc/udev/rules.d/60-net.rules
|
||||
|
@@ -1,20 +1,23 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
PATH=$PATH:/sbin:/usr/sbin
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
[ "$RDDEBUG" = "yes" ] \
|
||||
&& [ -e /dev/initlog.pipe ] \
|
||||
&& exec >>/dev/initlog.pipe 2>>/dev/initlog.pipe
|
||||
|
||||
# Huh? Empty $1?
|
||||
[ -z "$1" ] && exit 1
|
||||
|
||||
# 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
|
||||
# or root is already there
|
||||
[ -e /tmp/root.info ] || exit 1
|
||||
. /tmp/root.info
|
||||
[ -d $NEWROOT/proc ] && exit 0
|
||||
[ -z "$netroot" ] && exit 1
|
||||
|
||||
# Let's see if we have to wait for other interfaces
|
||||
# Note: exit works just fine, since the last interface to be
|
||||
@@ -26,11 +29,7 @@ done
|
||||
|
||||
# Set or override primary interface
|
||||
netif=$1
|
||||
if [ -e "/tmp/net.bootdev" ]; then
|
||||
read netif < /tmp/net.bootdev
|
||||
# only boot from $netif
|
||||
[ -n "$1" ] && [ -n "$netif"] && [ "$netif" != "$1" ] && exit 1
|
||||
fi
|
||||
[ -e "/tmp/net.bootdev" ] && read netif < /tmp/net.bootdev
|
||||
|
||||
# Figure out the handler for root=dhcp by recalling all netroot cmdline
|
||||
# handlers
|
||||
@@ -44,52 +43,21 @@ if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then
|
||||
# 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
|
||||
[ -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
|
||||
|
||||
for f in ./cmdline/90*.sh; do
|
||||
[ -f "$f" ] && . "$f";
|
||||
[ -f "$f" ] && . "$f";
|
||||
done
|
||||
else
|
||||
rootok="1"
|
||||
fi
|
||||
|
||||
# We're here, so we can assume that upping interfaces is now ok
|
||||
[ -z "$IFACES" ] && IFACES="$netif"
|
||||
|
||||
[ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw
|
||||
[ -e /tmp/net.$netif.hostname ] && . /tmp/net.$netif.hostname
|
||||
[ -e /tmp/net.$netif.resolv.conf ] && cp -f /tmp/net.$netif.resolv.conf /etc/resolv.conf
|
||||
|
||||
# Load interface options
|
||||
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
|
||||
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
|
||||
|
||||
# Handle STP Timeout: arping default router or if not available the
|
||||
# root server. Note: This assumes that if no router is present the
|
||||
# root server is on the same subnet.
|
||||
#
|
||||
# TODO There's some netroot variants that don't (yet) have their
|
||||
# server-ip netroot
|
||||
[ -n "$new_routers" ] && dest=${new_routers%%,*}
|
||||
[ -n "$gw" ] && dest=$gw
|
||||
if [ -z "$dest" ] ; then
|
||||
dummy=${netroot#*:}
|
||||
dummy=${dummy%%:*}
|
||||
case "$dummy" in
|
||||
[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*) dest=$dummy;;
|
||||
esac
|
||||
fi
|
||||
[ -n "$dest" ] && arping -q -f -w 60 -I $netif $dest
|
||||
|
||||
[ -d $NEWROOT/proc ] && exit 0
|
||||
[ -z "$netroot" ] && exit 1
|
||||
|
||||
# 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'"
|
||||
@@ -101,6 +69,58 @@ if [ -z "$netroot" ] || [ ! -e "$handler" ] ; then
|
||||
die "No handler for netroot type '$netroot'"
|
||||
fi
|
||||
|
||||
# We're here, so we can assume that upping interfaces is now ok
|
||||
[ -z "$IFACES" ] && IFACES="$netif"
|
||||
for iface in $IFACES ; do
|
||||
. /tmp/net.$iface.up
|
||||
done
|
||||
|
||||
[ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw
|
||||
[ -e /tmp/net.$netif.hostname ] && . /tmp/net.$netif.hostname
|
||||
[ -e /tmp/net.$netif.resolv.conf ] && cp -f /tmp/net.$netif.resolv.conf /etc/resolv.conf
|
||||
|
||||
# Load interface options
|
||||
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
|
||||
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
|
||||
|
||||
# Handle STP Timeout: arping the default router if root server is
|
||||
# unknown or not local, or if not available the root server.
|
||||
# Note: This assumes that if no router is present the
|
||||
# root server is on the same subnet.
|
||||
#
|
||||
# TODO There's some netroot variants that don't (yet) have their
|
||||
# server-ip netroot
|
||||
|
||||
# Get router IP if set
|
||||
[ -n "$new_routers" ] && gw_ip=${new_routers%%,*}
|
||||
[ -n "$gw" ] && gw_ip=$gw
|
||||
# Get root server IP if set
|
||||
if [ -n "$netroot" ]; then
|
||||
dummy=${netroot#*:}
|
||||
dummy=${dummy%%:*}
|
||||
case "$dummy" in
|
||||
[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*) netroot_ip=$dummy;;
|
||||
esac
|
||||
fi
|
||||
# Default arping dest to router
|
||||
dest="$gw_ip"
|
||||
# Change to arping root server if appropriate
|
||||
if [ -n "$netroot_ip" ]; then
|
||||
if [ -z "$dest" ]; then
|
||||
# no gateway so check root server
|
||||
dest="$netroot_ip"
|
||||
else
|
||||
r=$(ip route get "$netroot_ip")
|
||||
if ! strstr "$r" ' via ' ; then
|
||||
# local root server, so don't arping gateway
|
||||
dest="$netroot_ip"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -n "$dest" ] && ! arping -q -f -w 60 -I $netif $dest ; then
|
||||
die "Resolving $dest via ARP on $netif failed"
|
||||
fi
|
||||
|
||||
# Source netroot hooks before we start the handler
|
||||
source_all netroot
|
||||
|
||||
@@ -109,20 +129,20 @@ source_all netroot
|
||||
if $handler $netif $netroot $NEWROOT; then
|
||||
# Network rootfs mount successful
|
||||
for iface in $IFACES ; do
|
||||
[ -s /tmp/dhclient.$iface.lease ] && cp /tmp/dhclient.$iface.lease /tmp/net.$iface.lease
|
||||
[ -s /tmp/dhclient.$iface.dhcpopts ] && cp /tmp/dhclient.$iface.dhcpopts /tmp/net.$iface.dhcpopts
|
||||
[ -f /tmp/dhclient.$iface.lease ] && cp /tmp/dhclient.$iface.lease /tmp/net.$iface.lease
|
||||
[ -f /tmp/dhclient.$iface.dhcpopts ] && cp /tmp/dhclient.$iface.dhcpopts /tmp/net.$iface.dhcpopts
|
||||
done
|
||||
|
||||
# Save used netif for later use
|
||||
echo $netif >> /tmp/net.ifaces
|
||||
#else
|
||||
# warn "Mounting root via '$netif' failed"
|
||||
[ ! -f /tmp/net.ifaces ] && echo $netif > /tmp/net.ifaces
|
||||
else
|
||||
warn "Mounting root via '$netif' failed"
|
||||
# If we're trying with multiple interfaces, put that one down.
|
||||
# ip down/flush ensures that routeing info goes away as well
|
||||
# if [ -z "$BOOTDEV" ] ; then
|
||||
# ip link set $netif down
|
||||
# ip addr flush dev $netif
|
||||
# echo "#empty" > /etc/resolv.conf
|
||||
# fi
|
||||
if [ -z "$BOOTDEV" ] ; then
|
||||
ip link set $netif down
|
||||
ip addr flush dev $netif
|
||||
echo "#empty" > /etc/resolv.conf
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
|
@@ -1,9 +1,11 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Format:
|
||||
# bridge=<bridgename>:<ethname>
|
||||
# bridge=<bridgename>:<ethname>
|
||||
#
|
||||
# bridge without parameters assumes bridge=br0:eth0
|
||||
# bridge without parameters assumes bridge=br0:eth0
|
||||
#
|
||||
|
||||
# return if bridge already parsed
|
||||
@@ -12,7 +14,7 @@
|
||||
# Check if bridge parameter is valid
|
||||
if getarg bridge= >/dev/null ; then
|
||||
if [ -z "$netroot" ] ; then
|
||||
die "No netboot configured, bridge is invalid"
|
||||
die "No netboot configured, bridge is invalid"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -47,7 +49,7 @@ fi
|
||||
if getarg bridge >/dev/null; then
|
||||
# Read bridge= parameters if they exist
|
||||
bridge="$(getarg bridge=)"
|
||||
if [ ! "$bridge" = "bridge" ]; then
|
||||
if [ ! "$bridge" = "bridge" ]; then
|
||||
parsebridge "$(getarg bridge=)"
|
||||
fi
|
||||
# Simple default bridge
|
||||
|
@@ -1,85 +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
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
for p in $(getargs ip=); do
|
||||
[ "ibft" = "$p" ] || continue
|
||||
|
||||
modprobe iscsi_ibft
|
||||
num=0
|
||||
(
|
||||
for iface in /sys/firmware/ibft/ethernet*; do
|
||||
unset ifname_mac
|
||||
unset ifname_if
|
||||
unset dhcp
|
||||
unset ip
|
||||
unset gw
|
||||
unset mask
|
||||
unset hostname
|
||||
unset vlan
|
||||
unset dns1
|
||||
unset dns2
|
||||
[ -e ${iface}/mac ] || continue
|
||||
ifname_mac=$(read a < ${iface}/mac; echo $a)
|
||||
[ -z "$ifname_mac" ] && continue
|
||||
unset dev
|
||||
for ifname in $(getargs ifname=); do
|
||||
if strstr "$ifname" "$ifname_mac"; then
|
||||
dev=${ifname%%:*}
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$dev" ]; then
|
||||
ifname_if=ibft$num
|
||||
num=$(( $num + 1 ))
|
||||
echo "ifname=$ifname_if:$ifname_mac"
|
||||
dev=$ifname_if
|
||||
fi
|
||||
|
||||
if [ -e ${iface}/vlan ]; then
|
||||
vlan=$(read a < ${iface}/vlan; echo $a)
|
||||
if [ "$vlan" -ne "0" ]; then
|
||||
case "$vlan" in
|
||||
[0-9]*)
|
||||
[ -e /tmp/net.${dev}.${vlan}.has_ibft_config ] && continue
|
||||
echo "vlan=$dev.$vlan:$dev"
|
||||
dev="${dev}.${vlan}"
|
||||
;;
|
||||
*)
|
||||
[ -e /tmp/net.${vlan}.has_ibft_config ] && continue
|
||||
echo "vlan=$vlan:$dev"
|
||||
dev="${vlan}"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
[ -e /tmp/net.${dev}.has_ibft_config ] && continue
|
||||
|
||||
[ -e ${iface}/dhcp ] && dhcp=$(read a < ${iface}/dhcp; echo $a)
|
||||
|
||||
if [ -n "$dhcp" ]; then
|
||||
echo "ip=$dev:dhcp"
|
||||
else
|
||||
[ -e ${iface}/ip-addr ] && ip=$(read a < ${iface}/ip-addr; echo $a)
|
||||
[ "$ip" = "0.0.0.0" ] && unset ip
|
||||
[ -e ${iface}/gateway ] && gw=$(read a < ${iface}/gateway; echo $a)
|
||||
[ -e ${iface}/subnet-mask ] && mask=$(read a < ${iface}/subnet-mask; echo $a)
|
||||
[ -e ${iface}/hostname ] && hostname=$(read a < ${iface}/hostname; echo $a)
|
||||
[ -n "$ip" ] && echo "ip=$ip::$gw:$mask:$hostname:$dev:none"
|
||||
|
||||
[ -e ${iface}/primary-dns ] && dns1=$(read a < ${iface}/primary-dns; echo $a) \
|
||||
&& echo "nameserver=${dns1}"
|
||||
[ -e ${iface}/secondary-dns ] && dns2=$(read a < ${iface}/secondary-dns; echo $a) \
|
||||
&& echo "nameserver=${dns2}"
|
||||
fi
|
||||
|
||||
echo $mac > /tmp/net.${dev}.has_ibft_config
|
||||
done
|
||||
) >> /etc/cmdline
|
||||
# reread cmdline
|
||||
unset CMDLINE
|
||||
done
|
@@ -1,8 +1,11 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Format:
|
||||
# ifname=<interface>:<mac>
|
||||
# ifname=<interface>:<mac>
|
||||
#
|
||||
# Note letters in the macaddress must be lowercase!
|
||||
#
|
||||
# Examples:
|
||||
# ifname=eth0:4a:3f:4c:04:f8:d7
|
||||
@@ -10,6 +13,11 @@
|
||||
# Note when using ifname= to get persistent interface names, you must specify
|
||||
# an ifname= argument for each interface used in an ip= or fcoe= argument
|
||||
|
||||
# check if there are any ifname parameters
|
||||
if ! getarg ifname= >/dev/null ; then
|
||||
return
|
||||
fi
|
||||
|
||||
parse_ifname_opts() {
|
||||
local IFS=:
|
||||
set $1
|
||||
@@ -17,8 +25,7 @@ parse_ifname_opts() {
|
||||
case $# in
|
||||
7)
|
||||
ifname_if=$1
|
||||
# udev requires MAC addresses to be lower case
|
||||
ifname_mac=$(echo $2:$3:$4:$5:$6:$7 | tr '[:upper:]' '[:lower:]')
|
||||
ifname_mac=$2:$3:$4:$5:$6:$7
|
||||
;;
|
||||
*)
|
||||
die "Invalid arguments for ifname="
|
||||
@@ -26,11 +33,6 @@ parse_ifname_opts() {
|
||||
esac
|
||||
}
|
||||
|
||||
# check if there are any ifname parameters
|
||||
if ! getarg ifname= >/dev/null ; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Check ifname= lines
|
||||
for p in $(getargs ifname=); do
|
||||
parse_ifname_opts $p
|
||||
|
@@ -3,11 +3,11 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Format:
|
||||
# ip=[dhcp|on|any]
|
||||
# ip=[dhcp|on|any]
|
||||
#
|
||||
# ip=<interface>:[dhcp|on|any]
|
||||
# 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-id>:<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
|
||||
@@ -19,8 +19,8 @@
|
||||
# Check if ip= lines should be used
|
||||
if getarg ip= >/dev/null ; then
|
||||
if [ -z "$netroot" ] ; then
|
||||
echo "Warning: No netboot configured, ignoring ip= lines"
|
||||
return;
|
||||
echo "Warning: No netboot configured, ignoring ip= lines"
|
||||
return;
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -37,21 +37,18 @@ if [ -n "$netroot" ] && [ -z "$(getarg ip=)" ] ; then
|
||||
fi
|
||||
|
||||
# Count ip= lines to decide whether we need bootdev= or not
|
||||
if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ]; then
|
||||
if [ -z "$NEEDBOOTDEV" ] ; then
|
||||
local count=0
|
||||
for p in $(getargs ip=); do
|
||||
count=$(( $count + 1 ))
|
||||
done
|
||||
[ $count -gt 1 ] && NEEDBOOTDEV=1
|
||||
fi
|
||||
if [ -z "$NEEDBOOTDEV" ] ; then
|
||||
local count=0
|
||||
for p in $(getargs ip=); do
|
||||
count=$(( $count + 1 ))
|
||||
done
|
||||
[ $count -gt 1 ] && NEEDBOOTDEV=1
|
||||
fi
|
||||
|
||||
# If needed, check if bootdev= contains anything usable
|
||||
BOOTDEV=$(getarg bootdev=)
|
||||
|
||||
if [ -n "$NEEDBOOTDEV" ] ; then
|
||||
[ -z "$BOOTDEV" ] && warn "Please supply bootdev argument for multiple ip= lines"
|
||||
BOOTDEV=$(getarg bootdev=) || die "Please supply bootdev argument for multiple ip= lines"
|
||||
[ -z "$BOOTDEV" ] && die "Bootdev argument is empty"
|
||||
fi
|
||||
|
||||
# Check ip= lines
|
||||
@@ -59,66 +56,60 @@ fi
|
||||
for p in $(getargs ip=); do
|
||||
ip_to_var $p
|
||||
|
||||
# skip ibft
|
||||
[ "$autoconf" = "ibft" ] && continue
|
||||
|
||||
# We need to have an ip= line for the specified bootdev
|
||||
[ -n "$NEEDBOOTDEV" ] && [ "$dev" = "$BOOTDEV" ] && BOOTDEVOK=1
|
||||
|
||||
# Empty autoconf defaults to 'dhcp'
|
||||
if [ -z "$autoconf" ] ; then
|
||||
warn "Empty autoconf values default to dhcp"
|
||||
autoconf="dhcp"
|
||||
warn "Empty autoconf values default to dhcp"
|
||||
autoconf="dhcp"
|
||||
fi
|
||||
OLDIFS="$IFS"
|
||||
IFS=,
|
||||
set -- $autoconf
|
||||
IFS="$OLDIFS"
|
||||
for autoconf in "$@"; do
|
||||
# Error checking for autoconf in combination with other values
|
||||
case $autoconf in
|
||||
error) die "Error parsing option 'ip=$p'";;
|
||||
bootp|rarp|both) die "Sorry, ip=$autoconf is currenty unsupported";;
|
||||
none|off) \
|
||||
[ -z "$ip" ] && \
|
||||
die "For argument 'ip=$p'\nValue '$autoconf' without static configuration does not make sense"
|
||||
[ -z "$mask" ] && \
|
||||
die "Sorry, automatic calculation of netmask is not yet supported"
|
||||
;;
|
||||
auto6);;
|
||||
dhcp|dhcp6|on|any) \
|
||||
[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
|
||||
die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
|
||||
[ -n "$ip" ] && \
|
||||
die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoconf'"
|
||||
;;
|
||||
*) die "For argument 'ip=$p'\nSorry, unknown value '$autoconf'";;
|
||||
esac
|
||||
_part=${_part%,*}
|
||||
done
|
||||
|
||||
# Error checking for autoconf in combination with other values
|
||||
case $autoconf in
|
||||
error) die "Error parsing option 'ip=$p'";;
|
||||
bootp|rarp|both) die "Sorry, ip=$autoconf is currenty unsupported";;
|
||||
none|off) \
|
||||
[ -z "$ip" ] && \
|
||||
die "For argument 'ip=$p'\nValue '$autoconf' without static configuration does not make sense"
|
||||
[ -z "$mask" ] && \
|
||||
die "Sorry, automatic calculation of netmask is not yet supported"
|
||||
;;
|
||||
auto6);;
|
||||
dhcp|dhcp6|on|any) \
|
||||
[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
|
||||
die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
|
||||
[ -n "$ip" ] && \
|
||||
die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoconf'"
|
||||
;;
|
||||
*) die "For argument 'ip=$p'\nSorry, unknown value '$autoconf'";;
|
||||
esac
|
||||
|
||||
if [ -n "$dev" ] ; then
|
||||
# We don't like duplicate device configs
|
||||
if [ -n "$IFACES" ] ; then
|
||||
for i in $IFACES ; do
|
||||
[ "$dev" = "$i" ] && warn "For argument 'ip=$p'\nDuplication configurations for '$dev'"
|
||||
done
|
||||
fi
|
||||
# IFACES list for later use
|
||||
IFACES="$IFACES $dev"
|
||||
if [ -n "$IFACES" ] ; then
|
||||
for i in $IFACES ; do
|
||||
[ "$dev" = "$i" ] && die "For argument 'ip=$p'\nDuplication configurations for '$dev'"
|
||||
done
|
||||
fi
|
||||
# IFACES list for later use
|
||||
IFACES="$IFACES $dev"
|
||||
fi
|
||||
|
||||
# Small optimization for udev rules
|
||||
[ -z "$NEEDBOOTDEV" ] && [ -n "$dev" ] && BOOTDEV=$dev
|
||||
|
||||
# Do we need to check for specific options?
|
||||
if [ -n "$NEEDDHCP" ] || [ -n "$DHCPORSERVER" ] ; then
|
||||
# Correct device? (Empty is ok as well)
|
||||
[ "$dev" = "$BOOTDEV" ] || continue
|
||||
# Server-ip is there?
|
||||
[ -n "$DHCPORSERVER" ] && [ -n "$srv" ] && continue
|
||||
# dhcp? (It's simpler to check for a set ip. Checks above ensure that if
|
||||
# ip is there, we're static
|
||||
[ -z "$ip" ] && continue
|
||||
# Not good!
|
||||
die "Server-ip or dhcp for netboot needed, but current arguments say otherwise"
|
||||
# Correct device? (Empty is ok as well)
|
||||
[ "$dev" = "$BOOTDEV" ] || continue
|
||||
# Server-ip is there?
|
||||
[ -n "$DHCPORSERVER" ] && [ -n "$srv" ] && continue
|
||||
# dhcp? (It's simpler to check for a set ip. Checks above ensure that if
|
||||
# ip is there, we're static
|
||||
[ -z "$ip" ] && continue
|
||||
# Not good!
|
||||
die "Server-ip or dhcp for netboot needed, but current arguments say otherwise"
|
||||
fi
|
||||
|
||||
done
|
||||
|
@@ -1,32 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Format:
|
||||
# vlan=<vlanname>:<phydevice>
|
||||
#
|
||||
|
||||
parsevlan() {
|
||||
local v=${1}:
|
||||
set --
|
||||
while [ -n "$v" ]; do
|
||||
set -- "$@" "${v%%:*}"
|
||||
v=${v#*:}
|
||||
done
|
||||
|
||||
case $# in
|
||||
2) vlanname=$1; phydevice=$2 ; return 0 ;;
|
||||
*) die "vlan= requires two parameters" ;;
|
||||
esac
|
||||
return 1
|
||||
}
|
||||
|
||||
unset vlanname phydevice
|
||||
|
||||
for vlan in $(getargs vlan); do
|
||||
[ "$vlan" = "vlan" ] && continue
|
||||
unset vlanname phydevice
|
||||
if parsevlan "$(getarg vlan=)"; then
|
||||
echo "$phydevice" > /tmp/vlan.${phydevice}.phy
|
||||
echo "$phydevice" >> /tmp/net.ifaces
|
||||
echo "$vlanname" > /tmp/vlan.${vlanname}.${phydevice}
|
||||
fi
|
||||
done
|
@@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# ifcfg is required by network
|
||||
#[[ $1 = -d ]] && echo network
|
||||
|
||||
exit 255
|
@@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
|
@@ -2,5 +2,15 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
inst_hook cmdline 20 "$moddir/parse-insmodpost.sh"
|
||||
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
|
||||
check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
|
||||
}
|
||||
|
72
modules.d/45ifcfg/write-ifcfg.sh
Normal file → Executable file
72
modules.d/45ifcfg/write-ifcfg.sh
Normal file → Executable file
@@ -20,48 +20,29 @@ fi
|
||||
mkdir -p /tmp/ifcfg/
|
||||
|
||||
for netif in $IFACES ; do
|
||||
# bridge?
|
||||
unset bridge
|
||||
unset bond
|
||||
unset vlan
|
||||
unset phydevice
|
||||
unset vlanname
|
||||
unset uuid
|
||||
unset ip
|
||||
unset gw
|
||||
unset mtu
|
||||
unset mask
|
||||
unset macaddr
|
||||
|
||||
# bridge?
|
||||
if [ "$netif" = "$bridgename" ]; then
|
||||
bridge=yes
|
||||
elif [ "$netif" = "$bondname" ]; then
|
||||
# $netif can't be bridge and bond at the same time
|
||||
bond=yes
|
||||
fi
|
||||
|
||||
for i in /tmp/vlan.${netif}.*; do
|
||||
[ ! -e "$i" ] && continue
|
||||
. "$i"
|
||||
vlan=yes
|
||||
break
|
||||
done
|
||||
|
||||
cat /sys/class/net/$netif/address > /tmp/net.${netif}.hwaddr
|
||||
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$netif"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
if [ -f /tmp/dhclient.${netif}.dhcpopts ]; then
|
||||
strstr "$ip" '*:*:*' && echo "DHCPV6C=yes"
|
||||
echo "BOOTPROTO=dhcp"
|
||||
[ -f /tmp/dhclient.${netif}.lease ] && cp /tmp/dhclient.${netif}.lease /tmp/net.${netif}.lease
|
||||
[ -f /tmp/dhclient.${netif}.dhcpopts ] && cp /tmp/dhclient.${netif}.dhcpopts /tmp/net.${netif}.dhcpopts
|
||||
if [ -f /tmp/net.$netif.lease ]; then
|
||||
strstr "$ip" '*:*:*' &&
|
||||
echo "DHCPV6C=yes"
|
||||
echo "BOOTPROTO=dhcp"
|
||||
else
|
||||
echo "BOOTPROTO=none"
|
||||
# If we've booted with static ip= lines, the override file is there
|
||||
[ -e /tmp/net.${netif}.override ] && . /tmp/net.${netif}.override
|
||||
echo "BOOTPROTO=none"
|
||||
# If we've booted with static ip= lines, the override file is there
|
||||
. /tmp/net.$netif.override
|
||||
echo "IPADDR=$ip"
|
||||
echo "NETMASK=$mask"
|
||||
[ -n "$gw" ] && echo "GATEWAY=$gw"
|
||||
@@ -69,21 +50,12 @@ for netif in $IFACES ; do
|
||||
} > /tmp/ifcfg/ifcfg-$netif
|
||||
|
||||
# bridge needs different things written to ifcfg
|
||||
if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ]; then
|
||||
if [ -z "$bridge" ] && [ -z "$bond" ]; then
|
||||
# standard interface
|
||||
{
|
||||
echo "HWADDR=$(cat /sys/class/net/$netif/address)"
|
||||
echo "TYPE=Ethernet"
|
||||
echo "NAME=\"Boot Disk\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
fi
|
||||
|
||||
if [ -n "$vlan" ] ; then
|
||||
{
|
||||
echo "TYPE=Vlan"
|
||||
echo "NAME=\"$netif\""
|
||||
echo "VLAN=yes"
|
||||
echo "PHYSDEV=\"$phydevice\""
|
||||
echo "NAME=\"Boot Disk\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
fi
|
||||
|
||||
@@ -96,12 +68,13 @@ for netif in $IFACES ; do
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
|
||||
for slave in $bondslaves ; do
|
||||
# Set ONBOOT=no to prevent initscripts from trying to setup already bonded physical interface
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$slave"
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=yes"
|
||||
echo "ONBOOT=no"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=$(cat /sys/class/net/$slave/address)"
|
||||
echo "SLAVE=yes"
|
||||
@@ -115,27 +88,28 @@ for netif in $IFACES ; do
|
||||
# bridge
|
||||
{
|
||||
echo "TYPE=Bridge"
|
||||
echo "NAME=\"Boot Disk\""
|
||||
echo "NAME=\"Boot Disk\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
{
|
||||
# This variable is an indicator of a bond interface for initscripts
|
||||
# Set ONBOOT=no to prevent initscripts from trying to setup already bridged bond interface
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$bondname"
|
||||
echo "ONBOOT=yes"
|
||||
echo "ONBOOT=no"
|
||||
echo "NETBOOT=yes"
|
||||
# This variable is an indicator of a bond interface for initscripts
|
||||
echo "BONDING_OPTS=\"$bondoptions\""
|
||||
echo "BRIDGE=$netif"
|
||||
echo "NAME=\"$bondname\""
|
||||
echo "NAME=\"$bondname\""
|
||||
} >> /tmp/ifcfg/ifcfg-$bondname
|
||||
for slave in $bondslaves ; do
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
# yes, duplicated code at this moment
|
||||
# Set ONBOOT=no to prevent initscripts from trying to setup already bridged physical interface
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$slave"
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=yes"
|
||||
echo "ONBOOT=no"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=$(cat /sys/class/net/$slave/address)"
|
||||
echo "SLAVE=yes"
|
||||
@@ -149,7 +123,7 @@ for netif in $IFACES ; do
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$ethname"
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=yes"
|
||||
echo "ONBOOT=no"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=$(cat /sys/class/net/$ethname/address)"
|
||||
echo "BRIDGE=$netif"
|
||||
@@ -160,7 +134,7 @@ for netif in $IFACES ; do
|
||||
done
|
||||
|
||||
# Pass network opts
|
||||
mkdir /dev/.initramfs/
|
||||
mkdir -p /dev/.initramfs
|
||||
cp /tmp/net.* /dev/.initramfs/ >/dev/null 2>&1
|
||||
mkdir -p /dev/.initramfs/state/etc/sysconfig/network-scripts/
|
||||
cp /tmp/net.$netif.resolv.conf /dev/.initramfs/state/etc/ >/dev/null 2>&1
|
||||
|
42
modules.d/50gensplash/README
Normal file
42
modules.d/50gensplash/README
Normal file
@@ -0,0 +1,42 @@
|
||||
Dracut gensplash module
|
||||
-----------------------
|
||||
|
||||
INDEX
|
||||
|
||||
0. Introduction
|
||||
1. Hostonly vs Generic
|
||||
2. Configuration and kernel parameters
|
||||
|
||||
~
|
||||
|
||||
0. Introduction
|
||||
|
||||
gensplash is based on Genkernel code and that's why it's Gentoo-specific. It
|
||||
requires splashutils to work. To set up theme you may edit /etc/conf.d/splash
|
||||
or set DRACUT_GENSPLASH_THEME and DRACUT_GENSPLASH_RES variables. Your theme
|
||||
has to exist in /etc/splash and for every given resolution has to exist config
|
||||
in theme's directory, e.g. there's 1024x768.cfg in /etc/splash/natural_gentoo.
|
||||
List of resolutions is comma-separated.
|
||||
|
||||
NOTE: The module will be rewritten to be distro-neutral. Its name will change
|
||||
to fbsplash.
|
||||
|
||||
|
||||
1. Hostonly vs Generic
|
||||
|
||||
All available themes are installed only if no --hostonly is specified and no
|
||||
DRACUT_GENSPLASH_THEME and DRACUT_GENSPLASH_RES are set. Otherwise those vars
|
||||
are checked and if not set then config /etc/conf.d/splash is read.
|
||||
|
||||
|
||||
2. Configuration and kernel parameters
|
||||
|
||||
Example set up by environment variables:
|
||||
DRACUT_GENSPLASH_THEME=natural_gentoo
|
||||
DRACUT_GENSPLASH_RES=1024x768,1024x600
|
||||
|
||||
Example kernel arguments:
|
||||
splash=silent,theme:natural_gentoo console=tty1 quiet
|
||||
|
||||
You may easily set up the module using Genkernel with arguments:
|
||||
--gensplash=<theme>:<res1>,<res2>,...
|
@@ -2,5 +2,6 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
[ -e /sys/module/bnx2i ] && killproc iscsiuio
|
||||
|
||||
CDROOT=0
|
||||
. /lib/gensplash-lib.sh
|
||||
splash verbose
|
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
type -P biosdevname >/dev/null || exit 1
|
||||
|
||||
# do not enable bootchartd by default
|
||||
exit 0
|
||||
CDROOT=0
|
||||
. /lib/gensplash-lib.sh
|
||||
splash set_msg 'Switching to new root'
|
16
modules.d/50gensplash/gensplash-pretrigger.sh
Executable file
16
modules.d/50gensplash/gensplash-pretrigger.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/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 1 rd.splash -n rd_NO_SPLASH; then
|
||||
[ -c /dev/null ] || mknod /dev/null c 1 3
|
||||
[ -c /dev/console ] || mknod /dev/console c 5 1
|
||||
[ -c /dev/tty0 ] || mknod /dev/tty0 c 4 0
|
||||
|
||||
info "Starting Gentoo Splash"
|
||||
|
||||
/lib/udev/console_init tty0
|
||||
CDROOT=0
|
||||
. /lib/gensplash-lib.sh
|
||||
splash init
|
||||
fi
|
77
modules.d/50gensplash/module-setup.sh
Executable file
77
modules.d/50gensplash/module-setup.sh
Executable file
@@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
# TODO: splash_geninitramfs
|
||||
# TODO: /usr/share/splashutils/initrd.splash
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
call_splash_geninitramfs() {
|
||||
local out ret
|
||||
|
||||
out=$(splash_geninitramfs -c "$1" ${@:2} 2>&1)
|
||||
ret=$?
|
||||
|
||||
if [[ ${out} ]]; then
|
||||
local IFS='
|
||||
'
|
||||
for line in ${out}; do
|
||||
if [[ ${line} =~ ^Warning ]]; then
|
||||
dwarning "${line}"
|
||||
else
|
||||
derror "${line}"
|
||||
(( ret == 0 )) && ret=1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
return ${ret}
|
||||
}
|
||||
|
||||
|
||||
type -P splash_geninitramfs >/dev/null || return 1
|
||||
|
||||
opts=''
|
||||
|
||||
if [[ ${DRACUT_GENSPLASH_THEME} ]]; then
|
||||
# Variables from the environment
|
||||
# They're supposed to be set up by e.g. Genkernel in basis of cmdline args.
|
||||
# If user set them he/she would expect to be included only given theme
|
||||
# rather then all even if we're building generic initramfs.
|
||||
SPLASH_THEME=${DRACUT_GENSPLASH_THEME}
|
||||
SPLASH_RES=${DRACUT_GENSPLASH_RES}
|
||||
elif [[ ${hostonly} ]]; then
|
||||
# Settings from config only in hostonly
|
||||
[[ -e /etc/conf.d/splash ]] && source /etc/conf.d/splash
|
||||
[[ ! ${SPLASH_THEME} ]] && SPLASH_THEME=default
|
||||
[[ ${SPLASH_RES} ]] && opts+=" -r ${SPLASH_RES}"
|
||||
else
|
||||
# generic
|
||||
SPLASH_THEME=--all
|
||||
fi
|
||||
|
||||
dinfo "Installing Gentoo Splash (using the ${SPLASH_THEME} theme)"
|
||||
|
||||
pushd "${initdir}" >/dev/null
|
||||
mv dev dev.old
|
||||
call_splash_geninitramfs "${initdir}" ${opts} ${SPLASH_THEME} || {
|
||||
derror "Could not build splash"
|
||||
return 1
|
||||
}
|
||||
rm -rf dev
|
||||
mv dev.old dev
|
||||
popd >/dev/null
|
||||
|
||||
dracut_install chvt
|
||||
inst /usr/share/splashutils/initrd.splash /lib/gensplash-lib.sh
|
||||
inst_hook pre-pivot 90 "${moddir}"/gensplash-newroot.sh
|
||||
inst_hook pre-trigger 10 "${moddir}"/gensplash-pretrigger.sh
|
||||
inst_hook emergency 50 "${moddir}"/gensplash-emergency.sh
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
[[ $1 = -d ]] && which cryptsetup &>/dev/null && echo crypt
|
||||
[[ -x /sbin/plymouthd && -x /bin/plymouth && -x /usr/sbin/plymouth-set-default-theme ]]
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user