Compare commits
520 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
829c258554 | ||
![]() |
5dcd565dab | ||
![]() |
7838d85351 | ||
![]() |
db59288d79 | ||
![]() |
82794b4b90 | ||
![]() |
b4fbdbbe1e | ||
![]() |
9853774351 | ||
![]() |
79471f365e | ||
![]() |
98b108284c | ||
![]() |
8ee30d09a4 | ||
![]() |
01583ae4ad | ||
![]() |
249f8b5bfc | ||
![]() |
561d7f4d7c | ||
![]() |
4ad453445a | ||
![]() |
e620bb01da | ||
![]() |
7931bf0420 | ||
![]() |
c174aea07d | ||
![]() |
85323dcbb9 | ||
![]() |
8bc650d9dc | ||
![]() |
ea216a650e | ||
![]() |
a16ebfd56a | ||
![]() |
2aad23443e | ||
![]() |
8a5354a9a5 | ||
![]() |
dbf381f7fb | ||
![]() |
1080ce600a | ||
![]() |
0dd37f13c5 | ||
![]() |
6981a0bfe7 | ||
![]() |
e232c168d8 | ||
![]() |
66259efc14 | ||
![]() |
dc36969ae1 | ||
![]() |
ec88eb91d6 | ||
![]() |
9a54908fd7 | ||
![]() |
5b2cc025f4 | ||
![]() |
1489c9b1af | ||
![]() |
86d404513f | ||
![]() |
adcccd187d | ||
![]() |
956af8f26e | ||
![]() |
d60b71e8e8 | ||
![]() |
d1ef3951f3 | ||
![]() |
e27770e10c | ||
![]() |
0b70674329 | ||
![]() |
b991617f19 | ||
![]() |
9ebc51100b | ||
![]() |
0874654c78 | ||
![]() |
d6d53f60b2 | ||
![]() |
e94f4cce47 | ||
![]() |
07fa164e16 | ||
![]() |
9e7a3bf242 | ||
![]() |
0b53ca70b6 | ||
![]() |
c9f1e3d1f4 | ||
![]() |
c97e1a76f3 | ||
![]() |
94f4923039 | ||
![]() |
e86a6d390d | ||
![]() |
4af5e99124 | ||
![]() |
7bfacf2f21 | ||
![]() |
e43df9e342 | ||
![]() |
52eed26853 | ||
![]() |
4b3124ae85 | ||
![]() |
3a71443953 | ||
![]() |
5e6c3b035d | ||
![]() |
e5e5c8952d | ||
![]() |
19f3a804e7 | ||
![]() |
519d339233 | ||
![]() |
1e64e4939f | ||
![]() |
da22a02130 | ||
![]() |
432196aef8 | ||
![]() |
46265a9d3e | ||
![]() |
1953052994 | ||
![]() |
0afae1c7ce | ||
![]() |
e7b1b342bf | ||
![]() |
f709fa439b | ||
![]() |
510ef3af84 | ||
![]() |
bb08c7632a | ||
![]() |
200c7fd4b2 | ||
![]() |
4f7654715f | ||
![]() |
7fc4fb0131 | ||
![]() |
e103615be2 | ||
![]() |
d486e8f607 | ||
![]() |
66fe35eb3e | ||
![]() |
29cfd6c80b | ||
![]() |
fe17f4e86b | ||
![]() |
6927f09e1c | ||
![]() |
96d1d01572 | ||
![]() |
b151c3b1fe | ||
![]() |
28eb2436c8 | ||
![]() |
4877bb510e | ||
![]() |
2aee7e16ac | ||
![]() |
52881470ee | ||
![]() |
77e607a3a7 | ||
![]() |
1e2a167fe6 | ||
![]() |
2d7fe72bbb | ||
![]() |
661f9a3451 | ||
![]() |
8466db967e | ||
![]() |
486a1b9324 | ||
![]() |
4fea3ea6f1 | ||
![]() |
529349c66d | ||
![]() |
80bafe6d36 | ||
![]() |
7838ab5010 | ||
![]() |
5078c98abe | ||
![]() |
4c4c8b7239 | ||
![]() |
b177e9133e | ||
![]() |
9fe4f5ff25 | ||
![]() |
0ddd68f7e6 | ||
![]() |
533318113b | ||
![]() |
a5e33c7d6f | ||
![]() |
dfec8467b9 | ||
![]() |
44159d0598 | ||
![]() |
fe9cdf741f | ||
![]() |
3d88d27810 | ||
![]() |
d8e8e14e0b | ||
![]() |
fa79f00803 | ||
![]() |
b20ff981c4 | ||
![]() |
535ad9d1fb | ||
![]() |
a382492bf3 | ||
![]() |
8be12be16a | ||
![]() |
6fecffaab5 | ||
![]() |
6767fdaaed | ||
![]() |
fcbcc89bb2 | ||
![]() |
38ba0d7a62 | ||
![]() |
10b5dca0f7 | ||
![]() |
b60d5e90a5 | ||
![]() |
674bdee804 | ||
![]() |
62d0c4e7c1 | ||
![]() |
0b440844bd | ||
![]() |
724b87a6f8 | ||
![]() |
5242d8fb57 | ||
![]() |
1a0d82a3dd | ||
![]() |
ebaee770ac | ||
![]() |
ee89f47453 | ||
![]() |
58dad7025b | ||
![]() |
5d72984a01 | ||
![]() |
f90fd5b34b | ||
![]() |
9d49507f80 | ||
![]() |
e38e9e3f5e | ||
![]() |
6f590cd1c5 | ||
![]() |
41f90cbe50 | ||
![]() |
7d4f1101bc | ||
![]() |
8ce58f1f42 | ||
![]() |
2826a877af | ||
![]() |
53570e16c3 | ||
![]() |
94cce410aa | ||
![]() |
06e07df001 | ||
![]() |
9edf1b206b | ||
![]() |
440a4cc247 | ||
![]() |
b282107fa9 | ||
![]() |
0ce274f02b | ||
![]() |
c0a82e271e | ||
![]() |
ebaed7d51f | ||
![]() |
172d85b9c9 | ||
![]() |
81c6e7fb69 | ||
![]() |
f63c30d89b | ||
![]() |
1cedde0681 | ||
![]() |
c965ed2db4 | ||
![]() |
52889453c1 | ||
![]() |
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 |
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
|
||||
|
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>
|
||||
|
||||
|
41
AUTHORS
41
AUTHORS
@@ -1,30 +1,53 @@
|
||||
Harald Hoyer <harald@redhat.com>
|
||||
Victor Lowther <victor.lowther@gmail.com>
|
||||
Warren Togami <wtogami@redhat.com>
|
||||
Philippe Seewer <philippe.seewer@bfh.ch>
|
||||
Warren Togami <wtogami@redhat.com>
|
||||
Jeremy Katz <katzj@redhat.com>
|
||||
Amadeusz Żołnowski <aidecoe@aidecoe.name>
|
||||
David Dillow <dave@thedillows.org>
|
||||
Andreas Thienemann <andreas@bawue.net>
|
||||
Hans de Goede <hdegoede@redhat.com>
|
||||
Peter Jones <pjones@redhat.com>
|
||||
Luca Berra <bluca@comedia.it>
|
||||
Will Woods <wwoods@redhat.com>
|
||||
Andrey Borzenkov <arvidjaar@mail.ru>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Marc Grimme <grimme@atix.de>
|
||||
Bill Nottingham <notting@redhat.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>
|
||||
Andrey Borzenkov <arvidjaar@mail.ru>
|
||||
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>
|
||||
Munehiro Matsuda <haro@kgt.co.jp>
|
||||
Joey Boggs <jboggs@redhat.com>
|
||||
Mike Snitzer <snitzer@redhat.com>
|
||||
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>
|
||||
Jon Ander Hernandez <jonan.h@gmail.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>
|
||||
Michal Soltys <soltys@ziu.info>
|
||||
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>
|
||||
Vadim Kuznetsov <vadimk@gentoo.org>
|
||||
Ville Skyttä <ville.skytta@iki.fi>
|
||||
Yanko Kaneti <yaneti@declera.com>
|
||||
maximilian attems <max@stro.at>
|
||||
|
49
Makefile
49
Makefile
@@ -1,4 +1,4 @@
|
||||
VERSION=005
|
||||
VERSION=010
|
||||
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,7 +18,16 @@ else
|
||||
targets =
|
||||
endif
|
||||
|
||||
all: $(targets)
|
||||
all: $(targets) $(manpages) dracut.html
|
||||
|
||||
%: %.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.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
|
||||
@@ -27,7 +37,7 @@ install:
|
||||
mkdir -p $(DESTDIR)$(sbindir)
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)
|
||||
mkdir -p $(DESTDIR)$(pkglibdir)/modules.d
|
||||
mkdir -p $(DESTDIR)$(mandir)/man{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
|
||||
@@ -39,29 +49,37 @@ endif
|
||||
install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
|
||||
install -m 0755 dracut-functions $(DESTDIR)$(pkglibdir)/dracut-functions
|
||||
install -m 0755 dracut-logger $(DESTDIR)$(pkglibdir)/dracut-logger
|
||||
cp -arx modules.d $(DESTDIR)$(pkglibdir)
|
||||
install -m 0644 dracut.8 $(DESTDIR)$(mandir)/man8
|
||||
install -m 0644 dracut-catimages.8 $(DESTDIR)$(mandir)/man8
|
||||
install -m 0644 dracut-gencmdline.8 $(DESTDIR)$(mandir)/man8
|
||||
install -m 0644 dracut.conf.5 $(DESTDIR)$(mandir)/man5
|
||||
install -m 0644 dracut.kernel.7 $(DESTDIR)$(mandir)/man7
|
||||
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
|
||||
|
||||
dist: dracut-$(VERSION).tar.bz2
|
||||
dist: dracut-$(VERSION).tar.gz
|
||||
|
||||
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
|
||||
|
||||
@@ -79,11 +97,18 @@ gitrpm: dracut-$(VERSION)-$(GITVERSION).tar.bz2
|
||||
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 \
|
||||
syncheck:
|
||||
@ret=0;for i in dracut-logger modules.d/99base/init modules.d/*/*.sh; do \
|
||||
[ "$${i##*/}" = "module-setup.sh" ] && continue; \
|
||||
[ "$${i##*/}" = "caps.sh" ] && continue; \
|
||||
dash -n "$$i" ; ret=$$(($$ret+$$?)); \
|
||||
done;exit $$ret
|
||||
make -C test check
|
||||
@ret=0;for i in dracut modules.d/02caps/caps.sh modules.d/*/module-setup.sh; do \
|
||||
bash -n "$$i" ; ret=$$(($$ret+$$?)); \
|
||||
done;exit $$ret
|
||||
|
||||
check: all syncheck
|
||||
$(MAKE) -C test check
|
||||
|
||||
testimage: all
|
||||
./dracut -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
|
||||
|
76
NEWS
76
NEWS
@@ -1,3 +1,78 @@
|
||||
dracut-010
|
||||
==========
|
||||
- lots of bugfixes
|
||||
- plymouth: use /run/plymouth/pid instead of /run/initramfs/plymouth
|
||||
- add "/lib/firmware/updates" to default firmware path
|
||||
|
||||
dracut-009
|
||||
==========
|
||||
- dracut generator
|
||||
- dracut-logger
|
||||
- xz compression
|
||||
- better argument handling
|
||||
|
||||
- initramfs
|
||||
- hooks moved to /lib/dracut/hooks in initramfs
|
||||
- rd.driver.{blacklist|pre|post} accept comma seperated driver list
|
||||
- iSCSI: iSCSI Boot Firmware Table (iBFT) support
|
||||
- support for /run
|
||||
- live image: support for generic rootfs.img (instead of ext3fs.img)
|
||||
- caps module
|
||||
- FCoE: EDD support
|
||||
|
||||
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
|
||||
- fixed dracut manpages
|
||||
- dmraid parse different error messages
|
||||
- add cdrom polling mechanism for slow cdroms
|
||||
- add module btrfs
|
||||
- add btrfsctl scan for btrfs multi-devices (raid)
|
||||
- teach dmsquash live-root to use rootflags
|
||||
- trigger udev with action=add
|
||||
- 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
|
||||
==========
|
||||
- dcb support to dracut's FCoE support
|
||||
@@ -8,7 +83,6 @@ dracut-005
|
||||
- add preliminary IPv6 support
|
||||
- bugfixes
|
||||
|
||||
|
||||
dracut-004
|
||||
==========
|
||||
- dracut-lib: read multiple lines from $init/etc/cmdline
|
||||
|
21
PKGBUILD
Normal file
21
PKGBUILD
Normal file
@@ -0,0 +1,21 @@
|
||||
pkgname=dracut-git
|
||||
pkgver=$(date +%s)
|
||||
pkgrel=$(git log --pretty=format:%h |head -n 1)
|
||||
pkgdesc="Initramfs generation utility"
|
||||
arch=('i686' 'x86_64')
|
||||
url="https://dracut.wiki.kernel.org/"
|
||||
license=('GPL')
|
||||
conflicts=('dracut' 'mkinitcpio')
|
||||
provides=('dracut=9999' 'mkinitcpio=9999')
|
||||
depends=('bash')
|
||||
optdepends=('cryptsetup' 'lvm2')
|
||||
makedepends=('libxslt')
|
||||
backup=(etc/dracut.conf)
|
||||
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.
|
||||
|
||||
|
4
debian/control
vendored
4
debian/control
vendored
@@ -4,8 +4,8 @@ Priority: optional
|
||||
Maintainer: Philippe Seewer <philippe.seewer@bfh.ch>
|
||||
Build-Depends: debhelper (>= 5.0), cdbs
|
||||
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
|
||||
Vcs-Browser: http://git.kernel.org/?p=boot/dracut/dracut.git
|
||||
Vcs-Git: git://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
|
||||
Package: dracut
|
||||
Architecture: all
|
||||
|
2
debian/copyright
vendored
2
debian/copyright
vendored
@@ -3,7 +3,7 @@ Fri Nov 20 15:45:00 +0100
|
||||
|
||||
Sources can be downloaded from:
|
||||
|
||||
https://sourceforge.net/projects/dracut/
|
||||
http://www.kernel.org/pub/linux/utils/boot/dracut/
|
||||
|
||||
Upstream Maintainer:
|
||||
Harald Hoyer <harald@redhat.com>
|
||||
|
536
dracut
536
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,10 +23,13 @@
|
||||
# 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.
|
||||
@@ -46,64 +51,208 @@ 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
|
||||
-L, --stdlog [0-6] Specify logging level (to standard error)
|
||||
0 - suppress any messages
|
||||
1 - only fatal errors
|
||||
2 - all errors
|
||||
3 - warnings
|
||||
4 - info (default)
|
||||
5 - debug info (here starts lots of output)
|
||||
6 - trace info (and even more)
|
||||
-v, --verbose Increase verbosity level (default is info(4))
|
||||
-q, --quiet Decrease verbosity level (default is info(4))
|
||||
-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.
|
||||
If SOURCE is a file, it will be installed to TARGET
|
||||
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.
|
||||
--xz Compress the generated initramfs using xz.
|
||||
Make sure that your kernel has xz support compiled
|
||||
in, otherwise you will not be able to boot.
|
||||
--compress [COMPRESSION] Compress the generated initramfs with the
|
||||
passed compression program. Make sure your kernel
|
||||
knows how to decompress the generated initramfs,
|
||||
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.
|
||||
-M, --show-modules Print included module's name to standard output during
|
||||
build.
|
||||
EOF
|
||||
}
|
||||
|
||||
# function push()
|
||||
# push values to a stack
|
||||
# $1 = stack variable
|
||||
# $2.. values
|
||||
# example:
|
||||
# push stack 1 2 "3 4"
|
||||
push() {
|
||||
local __stack=$1; shift
|
||||
for i in "$@"; do
|
||||
eval ${__stack}'[${#'${__stack}'[@]}]="$i"'
|
||||
done
|
||||
}
|
||||
|
||||
# function pop()
|
||||
# pops the last value from a stack
|
||||
# assigns value to second argument variable
|
||||
# or echo to stdout, if no second argument
|
||||
# $1 = stack variable
|
||||
# $2 = optional variable to store the value
|
||||
# example:
|
||||
# pop stack val
|
||||
# val=$(pop stack)
|
||||
pop() {
|
||||
local __stack=$1; shift
|
||||
local __resultvar=$1
|
||||
local myresult;
|
||||
# check for empty stack
|
||||
eval '[[ ${#'${__stack}'[@]} -eq 0 ]] && return 1'
|
||||
|
||||
eval myresult='${'${__stack}'[${#'${__stack}'[@]}-1]}'
|
||||
|
||||
if [[ "$__resultvar" ]]; then
|
||||
eval $__resultvar="'$myresult'"
|
||||
else
|
||||
echo "$myresult"
|
||||
fi
|
||||
eval unset ${__stack}'[${#'${__stack}'[@]}-1]'
|
||||
return 0
|
||||
}
|
||||
|
||||
# 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
|
||||
}
|
||||
|
||||
# Little helper function for reading args from the commandline to a stack.
|
||||
# it automatically handles -a b and -a=b variants, and returns 1 if
|
||||
# we need to shift $3.
|
||||
push_arg() {
|
||||
# $1 = arg name
|
||||
# $2 = arg value
|
||||
# $3 = arg parameter
|
||||
local rematch='^[^=]*=(.*)$'
|
||||
if [[ $2 =~ $rematch ]]; then
|
||||
push "$1" "${BASH_REMATCH[1]}"
|
||||
else
|
||||
push "$1" "$3"
|
||||
# There is no way to shift our callers args, so
|
||||
# return 1 to indicate they should do it instead.
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
verbosity_mod_l=0
|
||||
|
||||
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;;
|
||||
--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
|
||||
-a|--add) push_arg add_dracutmodules_l "$@" || shift;;
|
||||
--add-drivers) push_arg add_drivers_l "$@" || shift;;
|
||||
-m|--modules) push_arg dracutmodules_l "$@" || shift;;
|
||||
-o|--omit) push_arg omit_dracutmodules_l "$@" || shift;;
|
||||
-d|--drivers) push_arg drivers_l "$@" || shift;;
|
||||
--filesystems) push_arg filesystems_l "$@" || shift;;
|
||||
-I|--install) push_arg install_items "$@" || shift;;
|
||||
--fwdir) push_arg fw_dir_l "$@" || shift;;
|
||||
-k|--kmoddir) read_arg drivers_dir_l "$@" || shift;;
|
||||
-c|--conf) read_arg conffile "$@" || shift;;
|
||||
--confdir) read_arg confdir "$@" || shift;;
|
||||
-L|--stdlog) read_arg stdloglvl_l "$@" || shift;;
|
||||
-I|--install) read_arg install_items "$@" || shift;;
|
||||
--fwdir) read_arg fw_dir_l "$@" || shift;;
|
||||
--compress) read_arg compress_l "$@" || shift;;
|
||||
-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) ((verbosity_mod_l++));;
|
||||
-q|--quiet) ((verbosity_mod_l--));;
|
||||
-l|--local) allowlocal="yes" ;;
|
||||
-H|--hostonly) hostonly_l="yes" ;;
|
||||
--fstab) use_fstab_l="yes" ;;
|
||||
-h|--help) usage; exit 1 ;;
|
||||
-i|--include) push include_src "$2"
|
||||
push include_target "$3"
|
||||
shift 2;;
|
||||
--bzip2) compress_l="bzip2";;
|
||||
--lzma) compress_l="lzma";;
|
||||
--xz) compress_l="xz";;
|
||||
--no-compress) _no_compress_l="cat";;
|
||||
--gzip) compress_l="gzip";;
|
||||
--list-modules)
|
||||
do_list="yes";
|
||||
;;
|
||||
-M|--show-modules)
|
||||
show_modules_l="yes"
|
||||
;;
|
||||
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
|
||||
*)
|
||||
if ! [[ ${outfile+x} ]]; then
|
||||
outfile=$1
|
||||
elif ! [[ ${kernel+x} ]]; then
|
||||
kernel=$1
|
||||
else
|
||||
usage; exit 1;
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
if ! [[ $kernel ]]; then
|
||||
kernel=$(uname -r)
|
||||
fi
|
||||
[[ $outfile ]] || outfile="/boot/initramfs-$kernel.img"
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
export PATH
|
||||
@@ -115,201 +264,310 @@ export PATH
|
||||
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
|
||||
|
||||
[[ $allowlocal && -f "$(readlink -f $(dirname $0))/dracut-functions" ]] && dracutbasedir="$(dirname $0)"
|
||||
[[ $allowlocal && -f "$(readlink -f ${0%/*})/dracut-functions" ]] && \
|
||||
dracutbasedir="$(readlink -f ${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
|
||||
if (( ${#add_dracutmodules_l[@]} )); then
|
||||
while pop add_dracutmodules_l val; do
|
||||
add_dracutmodules+=" $val "
|
||||
done
|
||||
fi
|
||||
|
||||
if (( ${#add_drivers_l[@]} )); then
|
||||
while pop add_drivers_l val; do
|
||||
add_drivers+=" $val "
|
||||
done
|
||||
fi
|
||||
|
||||
# these options override the stuff in the config file
|
||||
[[ $dracutmodules_l ]] && dracutmodules=$dracutmodules_l
|
||||
[[ $omit_dracutmodules_l ]] && omit_dracutmodules=$omit_dracutmodules_l
|
||||
[[ $add_dracutmodules_l ]] && add_dracutmodules="$add_dracutmodules $add_dracutmodules_l"
|
||||
[[ $drivers_l ]] && drivers=$drivers_l
|
||||
[[ $add_drivers_l ]] && add_drivers=$add_drivers_l
|
||||
[[ $filesystems_l ]] && filesystems=$filesystems_l
|
||||
if (( ${#dracutmodules_l[@]} )); then
|
||||
dracutmodules=''
|
||||
while pop dracutmodules_l val; do
|
||||
dracutmodules+="$val "
|
||||
done
|
||||
fi
|
||||
|
||||
if (( ${#omit_dracutmodules_l[@]} )); then
|
||||
omit_dracutmodules=''
|
||||
while pop omit_dracutmodules_l val; do
|
||||
omit_dracutmodules+="$val "
|
||||
done
|
||||
fi
|
||||
|
||||
if (( ${#drivers_l[@]} )); then
|
||||
drivers=''
|
||||
while pop drivers_l val; do
|
||||
drivers+="$val "
|
||||
done
|
||||
fi
|
||||
|
||||
if (( ${#filesystems_l[@]} )); then
|
||||
filesystems=''
|
||||
while pop filesystems_l val; do
|
||||
filesystems+="$val "
|
||||
done
|
||||
fi
|
||||
|
||||
if (( ${#fw_dir_l[@]} )); then
|
||||
fw_dir=''
|
||||
while pop fw_dir_l val; do
|
||||
fw_dir+="$val "
|
||||
done
|
||||
fi
|
||||
|
||||
[[ $stdloglvl_l ]] && stdloglvl=$stdloglvl_l
|
||||
[[ ! $stdloglvl ]] && stdloglvl=4
|
||||
stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||
((stdloglvl > 6)) && stdloglvl=6
|
||||
((stdloglvl < 0)) && stdloglvl=0
|
||||
|
||||
[[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
|
||||
[[ $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
|
||||
[[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware"
|
||||
[[ $do_strip ]] || do_strip=no
|
||||
[[ $compress_l ]] && compress=$compress_l
|
||||
[[ $show_modules_l ]] && show_modules=$show_modules_l
|
||||
# eliminate IFS hackery when messing with fw_dir
|
||||
fw_dir=${fw_dir//:/ }
|
||||
|
||||
# handle compression options.
|
||||
case $compress in
|
||||
bzip2) compress="bzip -9";;
|
||||
lzma) compress="lzma -9";;
|
||||
xz) compress="xz --check=crc32 --lzma2=dict=1MiB";;
|
||||
gzip) type pigz > /dev/null 2>&1 && compress="pigz -9" || \
|
||||
compress="gzip -9";;
|
||||
esac
|
||||
if [[ $_no_compress_l = "cat" ]]; then
|
||||
compress="cat"
|
||||
fi
|
||||
|
||||
[[ $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
|
||||
echo "Cannot find $dracutbasedir/dracut-functions." >&2
|
||||
echo "Are you running from a git checkout?" >&2
|
||||
echo "Try passing -l as an argument to $0" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dracutfunctions=$dracutbasedir/dracut-functions
|
||||
export dracutfunctions
|
||||
|
||||
ddebug "Executing $0 $dracut_args"
|
||||
|
||||
[[ $do_list = yes ]] && {
|
||||
for mod in $dracutbasedir/modules.d/*; do
|
||||
[[ -d $mod ]] || continue;
|
||||
[[ -e $mod/install || -e $mod/installkernel || \
|
||||
-e $mod/module-setup.sh ]] || continue
|
||||
echo ${mod##*/??}
|
||||
done
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Detect lib paths
|
||||
[[ $libdir ]] || for libdir in /lib64 /lib; do
|
||||
[[ -d $libdir ]] && break
|
||||
done || {
|
||||
dfatal 'No lib directory?!!!'
|
||||
exit 1
|
||||
}
|
||||
|
||||
[[ $usrlibdir ]] || for usrlibdir in /usr/lib64 /usr/lib; do
|
||||
[[ -d $usrlibdir ]] && break
|
||||
done || dwarn 'No usr/lib directory!'
|
||||
|
||||
# This is kinda legacy -- eventually it should go away.
|
||||
case $dracutmodules in
|
||||
""|auto) dracutmodules="all" ;;
|
||||
esac
|
||||
|
||||
[[ $2 ]] && kernel=$2 || kernel=$(uname -r)
|
||||
[[ $1 ]] && outfile=$1 || outfile="/boot/initramfs-$kernel.img"
|
||||
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
|
||||
dfatal 'To use --kmoddir option module-init-tools >= 3.7 is required.'
|
||||
exit 1
|
||||
fi
|
||||
srcmods="$drivers_dir"
|
||||
}
|
||||
export srcmods
|
||||
|
||||
if [[ -f $outfile && ! $force ]]; then
|
||||
echo "Will not override existing initramfs ($outfile) without --force"
|
||||
dfatal "Will not override existing initramfs ($outfile) without --force"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
outdir=$(dirname "$outfile")
|
||||
if ! [[ -d "$outdir" ]]; then
|
||||
echo "Can't write $outfile: Directory $outdir does not exist."
|
||||
outdir=${outfile%/*}
|
||||
[[ $outdir ]] || outdir="/"
|
||||
|
||||
if [[ ! -d "$outdir" ]]; then
|
||||
dfatal "Can't write $outfile: Directory $outdir does not exist."
|
||||
exit 1
|
||||
elif [[ ! -w "$outdir" ]]; then
|
||||
dfatal "No permission to write $outdir."
|
||||
exit 1
|
||||
elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
|
||||
dfatal "No permission to write $outfile."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [[ -w "$outdir" ]]; then
|
||||
echo "No permission to write $outdir."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -f "$outfile" ]] && ! [[ -w "$outfile" ]]; then
|
||||
echo "No permission to write $outfile."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
hookdirs="cmdline pre-udev pre-trigger netroot pre-mount 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 mdadmconf lvmconf filesystems
|
||||
export initdir dracutbasedir dracutmodules drivers \
|
||||
fw_dir drivers_dir debug no_kernel kernel_only \
|
||||
add_drivers mdadmconf lvmconf filesystems \
|
||||
use_fstab libdir usrlibdir \
|
||||
stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
|
||||
debug
|
||||
|
||||
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/run; 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
|
||||
|
||||
check_module_dir
|
||||
|
||||
# source our modules.
|
||||
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
|
||||
if strstr "$mods_to_load" " $mod "; then
|
||||
if [[ $kernel_only = yes ]]; then
|
||||
[[ -x $moddir/installkernel ]] && . "$moddir/installkernel"
|
||||
else
|
||||
. "$moddir/install"
|
||||
if [[ $no_kernel != yes && -x $moddir/installkernel ]]; then
|
||||
. "$moddir/installkernel"
|
||||
fi
|
||||
fi
|
||||
mods_to_load=${mods_to_load// $mod /}
|
||||
[[ $show_modules = yes ]] && echo "$mod" || \
|
||||
dinfo "*** Including 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
|
||||
dinfo "*** Including modules done ***"
|
||||
|
||||
## 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
|
||||
if [[ -d $initdir/lib/modules/$kernel ]] && \
|
||||
! depmod -a -b "$initdir" $kernel; then
|
||||
dfatal "\"depmod -a $kernel\" failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while pop include_src src && pop include_target tgt; do
|
||||
if [[ $src && $tgt ]]; then
|
||||
if [[ -f $src ]]; then
|
||||
inst $src $tgt
|
||||
else
|
||||
ddebug "Including directory: $src"
|
||||
mkdir -p "${initdir}/${tgt}"
|
||||
cp -a -t "${initdir}/${tgt}" "$src"/*
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $include_src && $include_target ]]; then
|
||||
mkdir -p "$initdir$include_target"
|
||||
cp -a -t "$initdir$include_target" "$include_src"/*
|
||||
fi
|
||||
|
||||
for item in $install_items; do
|
||||
dracut_install "$item"
|
||||
while pop install_items items; do
|
||||
for item in $items; do
|
||||
dracut_install "$item"
|
||||
done
|
||||
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()"
|
||||
dracut_install /etc/ld.so.conf /etc/ld.so.conf.d/*
|
||||
if ! ldconfig -r "$initdir"; then
|
||||
if [[ $UID = 0 ]]; then
|
||||
derror "ldconfig exited ungracefully"
|
||||
else
|
||||
derror "ldconfig might need uid=0 (root) for chroot()"
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ $beverbose = yes ]] && (du -c "$initdir" | sort -n)
|
||||
if (($maxloglvl >= 5)); then
|
||||
ddebug "Listing sizes of included files:"
|
||||
du -c "$initdir" | sort -n | ddebug
|
||||
fi
|
||||
|
||||
# strip binaries
|
||||
if [[ $do_strip = yes ]] ; then
|
||||
for p in strip objdump sed grep find; do
|
||||
if ! which $p >/dev/null 2>&1; then
|
||||
derror "Could not find '$p'. You should run $0 with '--nostrip'."
|
||||
do_strip=no
|
||||
fi
|
||||
for p in strip grep find; do
|
||||
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 [[ $do_strip = yes ]] ; then
|
||||
for f in $(find "$initdir" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 -or -path '/lib/modules/*.ko' \) -exec file {} \; |
|
||||
grep -v ' shared object,' |
|
||||
sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'); do
|
||||
dinfo "Stripping $f"
|
||||
strip -g "$f" || :
|
||||
#
|
||||
# FIXME: only strip -g for now
|
||||
#
|
||||
#strip -g --strip-unneeded "$f" || :
|
||||
#note="-R .note"
|
||||
#if objdump -h $f | grep '^[ ]*[0-9]*[ ]*.note[ ]' -A 1 | \
|
||||
# grep -q ALLOC; then
|
||||
# note=
|
||||
#fi
|
||||
#strip -R .comment $note "$f" || :
|
||||
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
|
||||
|
||||
( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet |gzip -9 > "$outfile"; )
|
||||
if [ $? -ne 0 ]; then
|
||||
derror "dracut: creation of $outfile failed"
|
||||
type hardlink &>/dev/null && {
|
||||
hardlink "$initdir" 2>&1
|
||||
}
|
||||
|
||||
if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet | \
|
||||
$compress > "$outfile"; ); then
|
||||
dfatal "dracut: creation of $outfile failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[[ $beverbose = yes ]] && ls -lh "$outfile"
|
||||
dinfo "Wrote $outfile:"
|
||||
dinfo "$(ls -l "$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
|
||||
@@ -102,12 +105,13 @@ fi
|
||||
if [[ ! $no_overlay ]]; then
|
||||
ofile="$imagedir/90-overlay.img"
|
||||
dinfo "Creating image $ofile from directory $overlay"
|
||||
( cd "$overlay"; find . |cpio --quiet -H newc -o |gzip -9 > "$ofile"; )
|
||||
type pigz &>/dev/null && gzip=pigz || gzip=gzip
|
||||
( cd "$overlay"; find . |cpio --quiet -H newc -o |$gzip -9 > "$ofile"; )
|
||||
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>
|
||||
|
770
dracut-functions
770
dracut-functions
@@ -1,4 +1,6 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# functions used by dracut and other tools.
|
||||
#
|
||||
@@ -18,49 +20,93 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
if ! [[ $dracutbasedir ]]; then
|
||||
dracutbasedir=${BASH_SOURCE[0]%/*}
|
||||
[[ $dracutbasedir = "dracut-functions" ]] && dracutbasedir="."
|
||||
[[ $dracutbasedir ]] || dracutbasedir="."
|
||||
dracutbasedir="$(readlink -f $dracutbasedir)"
|
||||
fi
|
||||
|
||||
if ! type dinfo >/dev/null 2>&1; then
|
||||
. "$dracutbasedir/dracut-logger"
|
||||
dlog_init
|
||||
fi
|
||||
|
||||
IF_RTLD=""
|
||||
IF_dynamic=""
|
||||
|
||||
# Generic substring function. If $2 is in $1, return 0.
|
||||
strstr() { [[ $1 =~ $2 ]]; }
|
||||
|
||||
# Log initrd creation.
|
||||
if ! [[ $dracutlogfile ]]; then
|
||||
[[ $dracutbasedir = /usr/share/dracut ]] && \
|
||||
dracutlogfile=/var/log/dracut.log || \
|
||||
dracutlogfile=/tmp/dracut.log
|
||||
# [[ -w $dracutlogfile ]] || dracutlogfile=/tmp/dracut.log
|
||||
if [[ -w $dracutlogfile ]]; then
|
||||
>"$dracutlogfile"
|
||||
fi
|
||||
fi
|
||||
# Create all subdirectories for given path without creating the last element.
|
||||
# $1 = path
|
||||
mksubdirs() { mkdir -m 0755 -p ${1%/*}; }
|
||||
|
||||
dwarning() {
|
||||
echo "W: $@" >&2
|
||||
[[ -w $dracutlogfile ]] && echo "W: $@" >>"$dracutlogfile"
|
||||
# Version comparision function. Assumes Linux style version scheme.
|
||||
# $1 = version a
|
||||
# $2 = comparision op (gt, ge, eq, le, lt, ne)
|
||||
# $3 = version b
|
||||
vercmp() {
|
||||
local n1=(${1//./ }) op=$2 n2=(${3//./ }) i res
|
||||
|
||||
for ((i=0; ; i++))
|
||||
do
|
||||
if [[ ! ${n1[i]}${n2[i]} ]]; then res=0
|
||||
elif ((${n1[i]:-0} > ${n2[i]:-0})); then res=1
|
||||
elif ((${n1[i]:-0} < ${n2[i]:-0})); then res=2
|
||||
else continue
|
||||
fi
|
||||
break
|
||||
done
|
||||
|
||||
case $op in
|
||||
gt) ((res == 1));;
|
||||
ge) ((res != 2));;
|
||||
eq) ((res == 0));;
|
||||
le) ((res != 1));;
|
||||
lt) ((res == 2));;
|
||||
ne) ((res != 0));;
|
||||
esac
|
||||
}
|
||||
|
||||
dinfo() {
|
||||
[[ $beverbose ]] && echo "I: $@" >&2
|
||||
[[ -w $dracutlogfile ]] && echo "I: $@" >>"$dracutlogfile"
|
||||
is_func() {
|
||||
[[ $(type -t $1) = "function" ]]
|
||||
}
|
||||
|
||||
derror() {
|
||||
echo "E: $@" >&2
|
||||
[[ -w $dracutlogfile ]] && echo "E: $@" >>"$dracutlogfile"
|
||||
# Function prints global variables in format name=value line by line.
|
||||
# $@ = list of global variables' name
|
||||
print_vars() {
|
||||
local var value
|
||||
|
||||
for var in $@
|
||||
do
|
||||
value=$(eval echo \$$var)
|
||||
[[ ${value} ]] && echo "${var}=\"${value}\""
|
||||
done
|
||||
}
|
||||
|
||||
get_fs_env() {
|
||||
[[ $1 ]] || return
|
||||
eval $(udevadm info --query=env --name=$1|egrep 'ID_FS_(TYPE|UUID)=')
|
||||
[[ $ID_FS_TYPE ]] && return
|
||||
|
||||
if [[ -x /lib/udev/vol_id ]]; then
|
||||
eval $(/lib/udev/vol_id --export $1)
|
||||
eval $(/lib/udev/vol_id --export $1)
|
||||
elif find_binary blkid >/dev/null; then
|
||||
eval $(blkid -o udev $1)
|
||||
eval $(blkid -o udev $1)
|
||||
else
|
||||
return 1
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
get_fs_type() (
|
||||
[[ $1 ]] || return
|
||||
if [[ $1 != ${1#/dev/block/nfs:} ]] \
|
||||
|| [[ $1 != ${1#/dev/block/nfs3:} ]] \
|
||||
|| [[ $1 != ${1#/dev/block/nfs4:} ]]; then
|
||||
echo "nfs"
|
||||
return
|
||||
fi
|
||||
get_fs_env $1 || return
|
||||
echo $ID_FS_TYPE
|
||||
)
|
||||
@@ -72,15 +118,43 @@ get_fs_uuid() (
|
||||
|
||||
# finds the major:minor of the block device backing the root filesystem.
|
||||
find_block_device() {
|
||||
local rootdev blkdev fs type opts misc
|
||||
while read blkdev fs type opts misc; do
|
||||
[[ $blkdev = rootfs ]] && continue # skip rootfs entry
|
||||
[[ $fs = $1 ]] && { rootdev=$blkdev; break; } # we have a winner!
|
||||
done < /proc/mounts
|
||||
[[ -b $rootdev ]] || return 1 # oops, not a block device.
|
||||
# get major/minor for the device
|
||||
ls -nLl "$rootdev" | \
|
||||
(read x x x x maj min x; maj=${maj//,/}; echo $maj:$min)
|
||||
local x mpt majmin dev fs misc maj min
|
||||
if [[ $use_fstab != yes ]]; then
|
||||
while read x x majmin x mpt x x fs dev misc; do
|
||||
[[ $fs = nfs ]] && { echo $dev; return 0;}
|
||||
[[ $fs = nfs3 ]] && { echo $dev; return 0;}
|
||||
[[ $fs = nfs4 ]] && { echo $dev; return 0;}
|
||||
[[ $fs = btrfs ]] && {
|
||||
ls -nLl "$dev" | {
|
||||
read x x x x maj min x
|
||||
maj=${maj//,/}
|
||||
echo $maj:$min
|
||||
} && return 0
|
||||
}
|
||||
if [[ $mpt = $1 ]] && [[ ${majmin#0:} = $majmin ]]; then
|
||||
echo $majmin
|
||||
return 0 # we have a winner!
|
||||
fi
|
||||
done < /proc/self/mountinfo
|
||||
fi
|
||||
# fall back to /etc/fstab
|
||||
while read dev mpt fs misc; do
|
||||
if [[ $mpt = $1 ]]; then
|
||||
[[ $fs = nfs ]] && { echo $dev; return 0;}
|
||||
[[ $fs = nfs3 ]] && { echo $dev; return 0;}
|
||||
[[ $fs = nfs4 ]] && { echo $dev; return 0;}
|
||||
[[ $dev != ${dev#UUID=} ]] && dev=/dev/disk/by-uuid/${dev#UUID=}
|
||||
[[ $dev != ${dev#LABEL=} ]] && dev=/dev/disk/by-label/${dev#LABEL=}
|
||||
[[ -b $dev ]] || return 1 # oops, not a block device.
|
||||
ls -nLl "$dev" | {
|
||||
read x x x x maj min x
|
||||
maj=${maj//,/}
|
||||
echo $maj:$min
|
||||
} && return 0
|
||||
fi
|
||||
done < /etc/fstab
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
find_root_block_device() { find_block_device /; }
|
||||
@@ -89,21 +163,24 @@ find_root_block_device() { find_block_device /; }
|
||||
# Stop when our helper function returns success
|
||||
# $1 = function to call on every found block device
|
||||
# $2 = block device in major:minor format
|
||||
check_block_and_slaves() {
|
||||
local x
|
||||
check_block_and_slaves() {
|
||||
local x
|
||||
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
|
||||
"$1" $2 && return
|
||||
check_vol_slaves "$@" && return 0
|
||||
if [[ -f /sys/dev/block/$2/../dev ]]; then
|
||||
check_block_and_slaves $1 $(cat "/sys/dev/block/$2/../dev") && return 0
|
||||
fi
|
||||
[[ -d /sys/dev/block/$2/slaves ]] || return 1
|
||||
for x in /sys/dev/block/$2/slaves/*/dev; do
|
||||
[[ -f $x ]] || continue
|
||||
check_block_and_slaves $1 $(cat "$x") && return 0
|
||||
check_block_and_slaves $1 $(cat "$x") && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
get_numeric_dev() {
|
||||
ls -lH "$1" | { read a b c d maj min rest; printf "%d:%d" ${maj%%,} $min;}
|
||||
ls -lH "$1" | { read a b c d maj min rest; printf "%d:%d" ${maj%%,} $min; }
|
||||
}
|
||||
|
||||
# ugly workaround for the lvm design
|
||||
@@ -113,20 +190,19 @@ get_numeric_dev() {
|
||||
# but you cannot create the logical volume without the volume group.
|
||||
# And the volume group might be bigger than the devices the LV needs.
|
||||
check_vol_slaves() {
|
||||
for i in /dev/mapper/*; do
|
||||
lv=$(get_numeric_dev $i)
|
||||
if [[ $lv = $2 ]]; then
|
||||
vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
|
||||
# strip space
|
||||
vg=$(echo $vg)
|
||||
if [[ $vg ]]; then
|
||||
for pv in $(lvm vgs --noheadings -o pv_name "$vg" 2>/dev/null); \
|
||||
do
|
||||
check_block_and_slaves $1 $(get_numeric_dev $pv) \
|
||||
&& return 0
|
||||
done
|
||||
fi
|
||||
fi
|
||||
for i in /dev/mapper/*; do
|
||||
lv=$(get_numeric_dev $i)
|
||||
if [[ $lv = $2 ]]; then
|
||||
vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
|
||||
# strip space
|
||||
vg=$(echo $vg)
|
||||
if [[ $vg ]]; then
|
||||
for pv in $(lvm vgs --noheadings -o pv_name "$vg" 2>/dev/null)
|
||||
do
|
||||
check_block_and_slaves $1 $(get_numeric_dev $pv) && return 0
|
||||
done
|
||||
fi
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
@@ -137,26 +213,26 @@ check_vol_slaves() {
|
||||
# and a symlink ${initdir}/lib -> lib64.
|
||||
inst_dir() {
|
||||
local dir="$1"
|
||||
[[ -e "${initdir}$dir" ]] && return 0
|
||||
[[ -e ${initdir}$dir ]] && return 0
|
||||
|
||||
# iterate over parent directories
|
||||
local file=""
|
||||
local IFS="/"
|
||||
for part in $dir; do
|
||||
[ -z "$part" ] && continue
|
||||
[[ $part ]] || continue
|
||||
file="$file/$part"
|
||||
[[ -e "${initdir}$file" ]] && continue
|
||||
[[ -e ${initdir}$file ]] && continue
|
||||
|
||||
if [ -L "$file" ]; then
|
||||
if [[ -L $file ]]; then
|
||||
# create link as the original
|
||||
local target=$(readlink "$file")
|
||||
ln -sfn "$target" "${initdir}$file" || return 1
|
||||
# resolve relative path and recursively install destionation
|
||||
[[ "$target" = "${target##*/}" ]] && target="${file%/*}/$target"
|
||||
# resolve relative path and recursively install destination
|
||||
[[ $target == ${target#/} ]] && target="$(dirname "$file")/$target"
|
||||
inst_dir "$target"
|
||||
else
|
||||
# create directory
|
||||
mkdir -p "${initdir}$file" || return 1
|
||||
mkdir -m 0755 -p "${initdir}$file" || return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -173,34 +249,80 @@ inst_simple() {
|
||||
[[ -e ${initdir}$target ]] && return 0
|
||||
inst_dir "${target%/*}"
|
||||
fi
|
||||
dinfo "Installing $src"
|
||||
# install checksum files also
|
||||
if [[ -e "${src%/*}/.${src##*/}.hmac" ]]; then
|
||||
inst "${src%/*}/.${src##*/}.hmac" "${target%/*}/.${target##*/}.hmac"
|
||||
fi
|
||||
ddebug "Installing $src"
|
||||
cp -pfL "$src" "${initdir}$target"
|
||||
}
|
||||
|
||||
# find symlinks linked to given library file
|
||||
# $1 = library file
|
||||
# Function searches for symlinks by stripping version numbers appended to
|
||||
# library filename, checks if it points to the same target and finally
|
||||
# prints the list of symlinks to stdout.
|
||||
#
|
||||
# Example:
|
||||
# rev_lib_symlinks libfoo.so.8.1
|
||||
# output: libfoo.so.8 libfoo.so
|
||||
# (Only if libfoo.so.8 and libfoo.so exists on host system.)
|
||||
rev_lib_symlinks() {
|
||||
[[ ! $1 ]] && return 0
|
||||
|
||||
local fn="$1" orig="$(readlink -f "$1")" links=''
|
||||
|
||||
[[ ${fn} =~ .*\.so\..* ]] || return 1
|
||||
|
||||
until [[ ${fn##*.} == so ]]; do
|
||||
fn="${fn%.*}"
|
||||
[[ -L ${fn} && $(readlink -f "${fn}") == ${orig} ]] && links+=" ${fn}"
|
||||
done
|
||||
|
||||
echo "${links}"
|
||||
}
|
||||
|
||||
# Same as above, but specialized to handle dynamic libraries.
|
||||
# It handles making symlinks according to how the original library
|
||||
# is referenced.
|
||||
inst_library() {
|
||||
local src=$1 dest=${2:-$1}
|
||||
local src=$1 dest=${2:-$1} lib reallib symlink
|
||||
[[ -e $initdir$dest ]] && return 0
|
||||
if [[ -L $src ]]; then
|
||||
reallib=$(readlink -f "$src")
|
||||
lib=${src##*/}
|
||||
inst_simple "$reallib" "$reallib"
|
||||
inst_dir "${dest%/*}"
|
||||
(cd "${initdir}${dest%/*}" && ln -s "$reallib" "$lib")
|
||||
# install checksum files also
|
||||
if [[ -e "${src%/*}/.${src##*/}.hmac" ]]; then
|
||||
inst "${src%/*}/.${src##*/}.hmac" "${dest%/*}/.${dest##*/}.hmac"
|
||||
fi
|
||||
reallib=$(readlink -f "$src")
|
||||
lib=${src##*/}
|
||||
inst_simple "$reallib" "$reallib"
|
||||
inst_dir "${dest%/*}"
|
||||
(cd "${initdir}${dest%/*}" && ln -s "$reallib" "$lib")
|
||||
else
|
||||
inst_simple "$src" "$dest"
|
||||
inst_simple "$src" "$dest"
|
||||
fi
|
||||
|
||||
# Create additional symlinks. See rev_symlinks description.
|
||||
for symlink in $(rev_lib_symlinks $src) $(rev_lib_symlinks $reallib); do
|
||||
[[ ! -e $initdir$symlink ]] && {
|
||||
ddebug "Creating extra symlink: $symlink"
|
||||
inst_symlink $symlink
|
||||
}
|
||||
done
|
||||
}
|
||||
|
||||
# find a binary. If we were not passed the full path directly,
|
||||
# search in the usual places to find the binary.
|
||||
find_binary() {
|
||||
local binpath="/bin /sbin /usr/bin /usr/sbin" p
|
||||
[[ -z ${1##/*} && -x $1 ]] && { echo $1; return 0; }
|
||||
if [[ -z ${1##/*} ]]; then
|
||||
if [[ -x $1 ]] || ldd $1 &>/dev/null; then
|
||||
echo $1
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
for p in $binpath; do
|
||||
[[ -x $p/$1 ]] && { echo "$p/$1"; return 0; }
|
||||
[[ -x $p/$1 ]] && { echo "$p/$1"; return 0; }
|
||||
done
|
||||
return 1
|
||||
}
|
||||
@@ -215,34 +337,34 @@ inst_binary() {
|
||||
local LDSO NAME IO FILE ADDR I1 n f TLIBDIR
|
||||
[[ -e $initdir$target ]] && return 0
|
||||
# I love bash!
|
||||
ldd $bin 2>/dev/null | while read line; do
|
||||
[[ $line = 'not a dynamic executable' ]] && return 1
|
||||
if [[ $line =~ not\ found ]]; then
|
||||
derror "Missing a shared library required by $bin."
|
||||
derror "Run \"ldd $bin\" to find out what it is."
|
||||
derror "dracut cannot create an initrd."
|
||||
exit 1
|
||||
fi
|
||||
so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
|
||||
[[ $line =~ $so_regex ]] || continue
|
||||
FILE=${BASH_REMATCH[1]}
|
||||
[[ -e ${initdir}$FILE ]] && continue
|
||||
# see if we are loading an optimized version of a shared lib.
|
||||
lib_regex='^(/lib[^/]*).*'
|
||||
if [[ $FILE =~ $lib_regex ]]; then
|
||||
LC_ALL=C ldd $bin 2>/dev/null | while read line; do
|
||||
[[ $line = 'not a dynamic executable' ]] && return 1
|
||||
if [[ $line =~ not\ found ]]; then
|
||||
dfatal "Missing a shared library required by $bin."
|
||||
dfatal "Run \"ldd $bin\" to find out what it is."
|
||||
dfatal "dracut cannot create an initrd."
|
||||
exit 1
|
||||
fi
|
||||
so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
|
||||
[[ $line =~ $so_regex ]] || continue
|
||||
FILE=${BASH_REMATCH[1]}
|
||||
[[ -e ${initdir}$FILE ]] && continue
|
||||
# see if we are loading an optimized version of a shared lib.
|
||||
lib_regex='^(/lib[^/]*).*'
|
||||
if [[ $FILE =~ $lib_regex ]]; then
|
||||
TLIBDIR=${BASH_REMATCH[1]}
|
||||
BASE=${FILE##*/}
|
||||
# prefer nosegneg libs, then unoptimized ones.
|
||||
for f in "$TLIBDIR/i686/nosegneg" "$TLIBDIR"; do
|
||||
[[ -e $f/$BASE ]] || continue
|
||||
FILE=$f/$BASE
|
||||
break
|
||||
done
|
||||
inst_library "$FILE" "$TLIBDIR/$BASE"
|
||||
# prefer nosegneg libs, then unoptimized ones.
|
||||
for f in "$TLIBDIR/i686/nosegneg" "$TLIBDIR"; do
|
||||
[[ -e $f/$BASE ]] || continue
|
||||
FILE=$f/$BASE
|
||||
break
|
||||
done
|
||||
inst_library "$FILE" "$TLIBDIR/$BASE"
|
||||
IF_dynamic=yes
|
||||
continue
|
||||
fi
|
||||
inst_library "$FILE"
|
||||
continue
|
||||
fi
|
||||
inst_library "$FILE"
|
||||
done
|
||||
inst_simple "$bin" "$target"
|
||||
}
|
||||
@@ -267,27 +389,40 @@ inst_symlink() {
|
||||
[[ -L $target ]] && return 0
|
||||
realsrc=$(readlink -f "$src")
|
||||
[[ $realsrc = ${realsrc##*/} ]] && realsrc=${src%/*}/$realsrc
|
||||
inst "$realsrc" && ln -s "$realsrc" "$target"
|
||||
inst "$realsrc" && mkdir -m 0755 -p "${target%/*}" && \
|
||||
ln -s "$realsrc" "$target"
|
||||
}
|
||||
|
||||
# find a udev rule in the usual places.
|
||||
find_rule() {
|
||||
[[ -f $1 ]] && { echo "$1"; return 0; }
|
||||
for r in . /lib/udev/rules.d /etc/udev/rules.d $dracutbasedir/rules.d; do
|
||||
[[ -f $r/$1 ]] && { echo "$r/$1"; return 0; }
|
||||
[[ -f $r/$1 ]] && { echo "$r/$1"; return 0; }
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# udev rules always get installed in the same place, so
|
||||
# create a function to install them to make life simpler.
|
||||
inst_rules() {
|
||||
local target=/etc/udev/rules.d
|
||||
inst_rules() {
|
||||
local target=/etc/udev/rules.d rule found
|
||||
|
||||
inst_dir "/lib/udev/rules.d"
|
||||
inst_dir "$target"
|
||||
for rule in "$@"; do
|
||||
rule=$(find_rule "$rule") && \
|
||||
inst_simple "$rule" "$target/${rule##*/}"
|
||||
for r in /lib/udev/rules.d /etc/udev/rules.d; do
|
||||
if [[ -f $r/$rule ]]; then
|
||||
found="$r/$rule"
|
||||
inst_simple "$found"
|
||||
fi
|
||||
done
|
||||
for r in '' ./ $dracutbasedir/rules.d/; do
|
||||
if [[ -f ${r}$rule ]]; then
|
||||
found="${r}$rule"
|
||||
inst_simple "$found" "$target/${found##*/}"
|
||||
fi
|
||||
done
|
||||
[[ $found ]] || dinfo "Skipping udev rule: $rule"
|
||||
done
|
||||
}
|
||||
|
||||
@@ -296,110 +431,238 @@ inst_rules() {
|
||||
inst() {
|
||||
case $# in
|
||||
1) ;;
|
||||
2)
|
||||
[[ -z $initdir ]] && [[ -d $2 ]] && export initdir=$2
|
||||
[[ $initdir = $2 ]] && set $1
|
||||
;;
|
||||
3)
|
||||
[[ -z $initdir ]] && export initdir=$2
|
||||
set $1 $3
|
||||
;;
|
||||
*)
|
||||
derror "inst only takes 1 or 2 or 3 arguments"
|
||||
exit 1
|
||||
;;
|
||||
2) [[ ! $initdir && -d $2 ]] && export initdir=$2
|
||||
[[ $initdir = $2 ]] && set $1;;
|
||||
3) [[ -z $initdir ]] && export initdir=$2
|
||||
set $1 $3;;
|
||||
*) dfatal "inst only takes 1 or 2 or 3 arguments"
|
||||
exit 1;;
|
||||
esac
|
||||
for x in inst_symlink inst_script inst_binary inst_simple; do
|
||||
$x "$@" && return 0
|
||||
$x "$@" && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
[[ $hookdirs ]] || {
|
||||
hookdirs="cmdline pre-udev pre-trigger netroot initqueue pre-mount"
|
||||
hookdirs+=" pre-pivot mount emergency"
|
||||
export hookdirs
|
||||
}
|
||||
|
||||
# install function specialized for hooks
|
||||
# $1 = type of hook, $2 = hook priority (lower runs first), $3 = hook
|
||||
# All hooks should be POSIX/SuS compliant, they will be sourced by init.
|
||||
inst_hook() {
|
||||
if ! [[ -f $3 ]]; then
|
||||
derror "Cannot install a hook ($3) that does not exist."
|
||||
derror "Aborting initrd creation."
|
||||
exit 1
|
||||
dfatal "Cannot install a hook ($3) that does not exist."
|
||||
dfatal "Aborting initrd creation."
|
||||
exit 1
|
||||
elif ! strstr "$hookdirs" "$1"; then
|
||||
derror "No such hook type $1. Aborting initrd creation."
|
||||
exit 1
|
||||
dfatal "No such hook type $1. Aborting initrd creation."
|
||||
exit 1
|
||||
fi
|
||||
inst_simple "$3" "/${1}/${2}${3##*/}"
|
||||
inst_simple "$3" "/lib/dracut/hooks/${1}/${2}${3##*/}"
|
||||
}
|
||||
|
||||
dracut_install() {
|
||||
if [[ $1 = '-o' ]]; then
|
||||
local optional=yes
|
||||
shift
|
||||
if [[ $1 = '-o' ]]; then
|
||||
local optional=yes
|
||||
shift
|
||||
fi
|
||||
while (($# > 0)); do
|
||||
if ! inst "$1" ; then
|
||||
if [[ $optional = yes ]]; then
|
||||
dwarning "Skipping program $1 as it cannot be found and is flagged to be optional"
|
||||
else
|
||||
derror "Failed to install $1"
|
||||
exit 1
|
||||
if ! inst "$1" ; then
|
||||
if [[ $optional = yes ]]; then
|
||||
dwarn "Skipping program $1 as it cannot be found and is" \
|
||||
"flagged to be optional"
|
||||
else
|
||||
dfatal "Failed to install $1"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
check_module_deps() {
|
||||
local moddir dep ret
|
||||
# if we are already set to be loaded, we do not have to be checked again.
|
||||
strstr "$mods_to_load" " $1 " && return
|
||||
# turn a module name into a directory, if we can.
|
||||
moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
[[ -d $moddir && -x $moddir/install ]] || return 1
|
||||
# if we do not have a check script, we are unconditionally included
|
||||
if [[ -x $moddir/check ]]; then
|
||||
"$moddir/check"
|
||||
ret=$?
|
||||
# a return value of 255 = load module only as a dependency.
|
||||
((ret==0||ret==255)) || return 1
|
||||
for dep in $("$moddir/check" -d); do
|
||||
check_module_deps "$dep" && continue
|
||||
dwarning "Dependency $mod failed."
|
||||
return 1
|
||||
done
|
||||
fi
|
||||
mods_to_load+=" $1 "
|
||||
}
|
||||
|
||||
should_source_module() {
|
||||
local dep
|
||||
if [[ $kernel_only = yes ]]; then
|
||||
[[ -x $1/installkernel ]] && return 0
|
||||
return 1
|
||||
fi
|
||||
[[ -x $1/install ]] || [[ -x $1/installkernel ]] || return 1
|
||||
[[ -x $1/check ]] || return 0
|
||||
"$1/check" $hostonly || return 1
|
||||
for dep in $("$1/check" -d); do
|
||||
check_module_deps "$dep" && continue
|
||||
dwarning "Cannot load $mod, dependencies failed."
|
||||
return 1
|
||||
done
|
||||
}
|
||||
|
||||
check_modules() {
|
||||
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
local mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
|
||||
# If we are already scheduled to be loaded, no need to check again.
|
||||
strstr "$mods_to_load" " $mod " && continue
|
||||
# This should never happen, but...
|
||||
[[ -d $moddir ]] || continue
|
||||
[[ $dracutmodules != all ]] && ! strstr "$dracutmodules" "$mod" && \
|
||||
continue
|
||||
strstr "$omit_dracutmodules" "$mod" && continue
|
||||
if ! strstr "$add_dracutmodules" "$mod"; then
|
||||
should_source_module "$moddir" || continue
|
||||
fi
|
||||
mods_to_load+=" $mod "
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
# install function decompressing the target and handling symlinks
|
||||
# $@ = list of compressed (gz or bz2) files or symlinks pointing to such files
|
||||
#
|
||||
# Function install targets in the same paths inside overlay but decompressed
|
||||
# and without extensions (.gz, .bz2).
|
||||
inst_decompress() {
|
||||
local src dst realsrc realdst cmd
|
||||
|
||||
for src in $@
|
||||
do
|
||||
case ${src} in
|
||||
*.gz) cmd='gzip -d' ;;
|
||||
*.bz2) cmd='bzip2 -d' ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
|
||||
if [[ -L ${src} ]]
|
||||
then
|
||||
realsrc="$(readlink -f ${src})" # symlink target with extension
|
||||
dst="${src%.*}" # symlink without extension
|
||||
realdst="${realsrc%.*}" # symlink target without extension
|
||||
mksubdirs "${initdir}/${src}"
|
||||
# Create symlink without extension to target without extension.
|
||||
ln -s "${realdst}" "${initdir}/${dst}"
|
||||
fi
|
||||
|
||||
# If the source is symlink we operate on its target.
|
||||
[[ ${realsrc} ]] && src=${realsrc}
|
||||
inst ${src}
|
||||
# Decompress with chosen tool. We assume that tool changes name e.g.
|
||||
# from 'name.gz' to 'name'.
|
||||
${cmd} "${initdir}${src}"
|
||||
done
|
||||
}
|
||||
|
||||
# It's similar to above, but if file is not compressed, performs standard
|
||||
# install.
|
||||
# $@ = list of files
|
||||
inst_opt_decompress() {
|
||||
local src
|
||||
|
||||
for src in $@
|
||||
do
|
||||
inst_decompress "${src}" || inst "${src}"
|
||||
done
|
||||
}
|
||||
|
||||
module_check() {
|
||||
local moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
[[ -d $moddir ]] || return 1
|
||||
if [[ ! -f $moddir/module-setup.sh ]]; then
|
||||
# if we do not have a check script, we are unconditionally included
|
||||
[[ -x $moddir/check ]] || return 0
|
||||
$moddir/check $hostonly
|
||||
return $?
|
||||
else
|
||||
unset check depends install installkernel
|
||||
. $moddir/module-setup.sh
|
||||
is_func check || return 0
|
||||
check
|
||||
ret=$?
|
||||
unset check depends install installkernel
|
||||
return $ret
|
||||
fi
|
||||
}
|
||||
|
||||
module_depends() {
|
||||
local moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
[[ -d $moddir ]] || return 1
|
||||
if [[ ! -f $moddir/module-setup.sh ]]; then
|
||||
# if we do not have a check script, we have no deps
|
||||
[[ -x $moddir/check ]] || return 0
|
||||
$moddir/check -d
|
||||
return $?
|
||||
else
|
||||
unset check depends install installkernel
|
||||
. $moddir/module-setup.sh
|
||||
is_func depends || return 0
|
||||
depends
|
||||
ret=$?
|
||||
unset check depends install installkernel
|
||||
return $ret
|
||||
fi
|
||||
}
|
||||
|
||||
module_install() {
|
||||
local moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
[[ -d $moddir ]] || return 1
|
||||
if [[ ! -f $moddir/module-setup.sh ]]; then
|
||||
[[ -x $moddir/install ]] && . "$moddir/install"
|
||||
return $?
|
||||
else
|
||||
unset check depends install installkernel
|
||||
. $moddir/module-setup.sh
|
||||
is_func install || return 0
|
||||
install
|
||||
ret=$?
|
||||
unset check depends install installkernel
|
||||
return $ret
|
||||
fi
|
||||
}
|
||||
|
||||
module_installkernel() {
|
||||
local moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
[[ -d $moddir ]] || return 1
|
||||
if [[ ! -f $moddir/module-setup.sh ]]; then
|
||||
[[ -x $moddir/installkernel ]] && . "$moddir/installkernel"
|
||||
return $?
|
||||
else
|
||||
unset check depends install installkernel
|
||||
. $moddir/module-setup.sh
|
||||
is_func installkernel || return 0
|
||||
installkernel
|
||||
ret=$?
|
||||
unset check depends install installkernel
|
||||
return $ret
|
||||
fi
|
||||
}
|
||||
|
||||
check_module() {
|
||||
local mod=$1;
|
||||
local moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local moddep;
|
||||
# If we are already scheduled to be loaded, no need to check again.
|
||||
strstr " $mods_to_load " " $mod " && return 0
|
||||
strstr " $mods_checked_as_dep " " $mod " && return 1
|
||||
|
||||
# This should never happen, but...
|
||||
[[ -d $moddir ]] || return 1
|
||||
|
||||
[[ $2 ]] || mods_checked_as_dep+=" $mod "
|
||||
|
||||
strstr " $omit_dracutmodules " " $mod " && return 1
|
||||
|
||||
if strstr " $dracutmodules $add_dracutmodules " " $mod "; then
|
||||
module_check $mod; ret=$?
|
||||
# explicit module, so also accept ret=255
|
||||
[[ $ret = 0 || $ret = 255 ]] || return 1
|
||||
else
|
||||
# module not in our list
|
||||
if [[ $dracutmodules = all ]]; then
|
||||
# check, if we can and should install this module
|
||||
module_check $mod || return 1
|
||||
else
|
||||
# skip this module
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
for moddep in $(module_depends $mod); do
|
||||
# handle deps as if they were manually added
|
||||
strstr " $add_dracutmodules " " $moddep " || \
|
||||
add_dracutmodules+=" $moddep "
|
||||
# if a module we depend on fail, fail also
|
||||
check_module $moddep || return 1
|
||||
done
|
||||
|
||||
strstr " $mods_to_load " " $mod " || \
|
||||
mods_to_load+=" $mod "
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
check_module_dir() {
|
||||
local modcheck;
|
||||
local mod;
|
||||
mods_to_load=""
|
||||
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
local mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
|
||||
check_module $mod 1
|
||||
done
|
||||
|
||||
# Report any missing dracut modules, the user has specified
|
||||
modcheck=$add_dracutmodules
|
||||
[[ $dracutmodules != all ]] && modcheck="$m $dracutmodules"
|
||||
for mod in $modcheck; do
|
||||
strstr "$mods_to_load" "$mod" && continue
|
||||
strstr "$omit_dracutmodules" "$mod" && continue
|
||||
derror "Dracut module \"$mod\" cannot be found."
|
||||
done
|
||||
}
|
||||
|
||||
@@ -408,36 +671,47 @@ check_modules() {
|
||||
install_kmod_with_fw() {
|
||||
local modname=${1##*/} fwdir found
|
||||
modname=${modname%.ko*}
|
||||
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" || \
|
||||
return 0 # no need to go further if the module is already installed
|
||||
# no need to go further if the module is already installed
|
||||
[[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] \
|
||||
&& return 0
|
||||
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" \
|
||||
|| return $?
|
||||
for fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do
|
||||
found=''
|
||||
for fwdir in $fw_dir; do
|
||||
if [[ -d $fwdir && -f $fwdir/$fw ]]; then
|
||||
inst_simple "$fwdir/$fw" "/lib/firmware/$fw"
|
||||
found=yes
|
||||
fi
|
||||
done
|
||||
if [[ $found != yes ]]; then
|
||||
dinfo "Possible missing firmware ${fw} for module ${mod}.ko"
|
||||
fi
|
||||
found=''
|
||||
for fwdir in $fw_dir; do
|
||||
if [[ -d $fwdir && -f $fwdir/$fw ]]; then
|
||||
inst_simple "$fwdir/$fw" "/lib/firmware/$fw"
|
||||
found=yes
|
||||
fi
|
||||
done
|
||||
if [[ $found != yes ]]; then
|
||||
dwarn "Possible missing firmware \"${fw}\" for kernel module" \
|
||||
"\"${mod}.ko\""
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
# Do something with all the dependencies of a kernel module.
|
||||
# Note that kernel modules depend on themselves using the technique we use
|
||||
# $1 = function to call for each dependency we find
|
||||
# It will be passed the full path to the found kernel module
|
||||
# $1 = function to call for each dependency we find
|
||||
# It will be passed the full path to the found kernel module
|
||||
# $2 = module to get dependencies for
|
||||
# rest of args = arguments to modprobe
|
||||
for_each_kmod_dep() {
|
||||
local func=$1 kmod=$2 cmd modpapth options
|
||||
shift 2
|
||||
modprobe "$@" --ignore-install --show-depends $kmod 2>/dev/null | \
|
||||
while read cmd modpath options; do
|
||||
[[ $cmd = insmod ]] || continue
|
||||
$func $modpath
|
||||
done
|
||||
modprobe "$@" --ignore-install --show-depends $kmod 2>/dev/null | (
|
||||
local found=0
|
||||
while read cmd modpath options; do
|
||||
[[ $cmd = insmod ]] || continue
|
||||
$func ${modpath} || exit $?
|
||||
found=1
|
||||
done
|
||||
[[ $found -eq 0 ]] && exit 1
|
||||
exit 0
|
||||
)
|
||||
return $?
|
||||
}
|
||||
|
||||
# filter kernel modules to install certain modules that meet specific
|
||||
@@ -450,17 +724,17 @@ for_each_kmod_dep() {
|
||||
# This function returns the full filenames of modules that match $1
|
||||
filter_kernel_modules () (
|
||||
if ! [[ $hostonly ]]; then
|
||||
filtercmd='find "$srcmods/kernel/drivers" -name "*.ko" -o -name "*.ko.gz"'
|
||||
filtercmd='find "$srcmods/kernel/drivers" "$srcmods/extra"'
|
||||
filtercmd+=' "$srcmods/weak-updates" -name "*.ko" -o -name "*.ko.gz"'
|
||||
filtercmd+=' 2>/dev/null'
|
||||
else
|
||||
filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename -k $kernel'
|
||||
filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename '
|
||||
filtercmd+='-k $kernel 2>/dev/null'
|
||||
fi
|
||||
for modname in $(eval $filtercmd); do
|
||||
case $modname in
|
||||
*.ko)
|
||||
"$1" "$modname" && echo "$modname"
|
||||
;;
|
||||
*.ko.gz)
|
||||
gzip -dc "$modname" > $initdir/$$.ko
|
||||
*.ko) "$1" "$modname" && echo "$modname";;
|
||||
*.ko.gz) gzip -dc "$modname" > $initdir/$$.ko
|
||||
$1 $initdir/$$.ko && echo "$modname"
|
||||
rm -f $initdir/$$.ko
|
||||
;;
|
||||
@@ -471,46 +745,52 @@ filter_kernel_modules () (
|
||||
# install kernel modules along with all their dependencies.
|
||||
instmods() {
|
||||
[[ $no_kernel = yes ]] && return
|
||||
local mod mpargs modpath modname cmd
|
||||
local mod mpargs modpath modname cmd moddirname
|
||||
local ret=0
|
||||
while (($# > 0)); do
|
||||
mod=${1%.ko*}
|
||||
case $mod in
|
||||
=*) # This introduces 2 incompatible meanings for =* arguments
|
||||
mod=${1%.ko*}
|
||||
case $mod in
|
||||
=*)
|
||||
# This introduces 2 incompatible meanings for =* arguments
|
||||
# to instmods. We need to decide which one to keep.
|
||||
if [[ $mod = =ata && -f $srcmods/modules.block ]] ; then
|
||||
instmods $mpargs $(egrep 'ata|ahci' "${srcmods}/modules.block")
|
||||
elif [ -f $srcmods/modules.${mod#=} ]; then
|
||||
instmods $mpargs $(cat ${srcmods}/modules.${mod#=} )
|
||||
else
|
||||
instmods $mpargs $(find "$srcmods" -path "*/${mod#=}/*")
|
||||
fi
|
||||
;;
|
||||
--*)
|
||||
mod=${mod##*/}
|
||||
mpargs+=" $mod";;
|
||||
i2o_scsi)
|
||||
# Must never run this diagnostic-only module
|
||||
shift; continue;
|
||||
if [[ $mod = =ata && -f $srcmods/modules.block ]]; then
|
||||
instmods $mpargs \
|
||||
$(egrep 'ata|ahci' "${srcmods}/modules.block")
|
||||
elif [ -f $srcmods/modules.${mod#=} ]; then
|
||||
instmods $mpargs $(cat ${srcmods}/modules.${mod#=} )
|
||||
else
|
||||
instmods $mpargs $(find "$srcmods" -path "*/${mod#=}/*")
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
mod=${mod##*/}
|
||||
--*)
|
||||
mod=${mod##*/}
|
||||
mpargs+=" $mod";;
|
||||
i2o_scsi) shift; continue;; # Do not load this diagnostic-only module
|
||||
*) mod=${mod##*/}
|
||||
# if we are already installed, skip this module and go on
|
||||
# to the next one.
|
||||
[[ -f $initdir/$1 ]] && { shift; continue; }
|
||||
# If we are building a host-specific initramfs and this
|
||||
# module is not already loaded, move on to the next one.
|
||||
[[ $hostonly ]] && ! grep -q "${mod//-/_}" /proc/modules && \
|
||||
! echo $add_drivers | grep -qe "\<${mod}\>" && {
|
||||
shift; continue;
|
||||
}
|
||||
# ok, load the module, all its dependencies, and any firmware
|
||||
# it may require
|
||||
for_each_kmod_dep install_kmod_with_fw $mod \
|
||||
--set-version $kernel -d ${srcmods%%/lib/modules/*}/
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
}
|
||||
# to the next one.
|
||||
[[ -f $initdir/$1 ]] && { shift; continue; }
|
||||
# If we are building a host-specific initramfs and this
|
||||
# module is not already loaded, move on to the next one.
|
||||
[[ $hostonly ]] && ! grep -qe "\<${mod//-/_}\>" /proc/modules \
|
||||
&& ! echo $add_drivers | grep -qe "\<${mod}\>" && {
|
||||
shift; continue
|
||||
}
|
||||
|
||||
# vim:ts=8:sw=4:sts=4:et
|
||||
# We use '-d' option in modprobe only if modules prefix path
|
||||
# differs from default '/'. This allows us to use Dracut with
|
||||
# old version of modprobe which doesn't have '-d' option.
|
||||
moddirname=${srcmods%%/lib/modules/*}
|
||||
[[ -n ${moddirname} ]] && moddirname="-d ${moddirname}/"
|
||||
|
||||
# ok, load the module, all its dependencies, and any firmware
|
||||
# it may require
|
||||
for_each_kmod_dep install_kmod_with_fw $mod \
|
||||
--set-version $kernel ${moddirname}
|
||||
((ret+=$?))
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
return $ret
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +72,7 @@ moduledep() {
|
||||
fi
|
||||
vecho -n "Looking for deps of module $1"
|
||||
deps=""
|
||||
deps=$(modprobe $MPARGS --set-version $kernel --show-depends $1 2>/dev/null| awk '/^insmod / { print gensub(".*/","","g",$2) }' | while read foo ; do [ "${foo%%.ko}" != "$1" ] && echo -n "${foo%%.ko} " ; done)
|
||||
deps=$(modprobe $MPARGS --set-version $kernel --quiet --show-depends $1 | awk '/^insmod / { print gensub(".*/","","g",$2) }' | while read foo ; do [ "${foo%%.ko}" != "$1" ] && echo -n "${foo%%.ko} " ; done)
|
||||
[ -n "$deps" ] && vecho ": $deps" || vecho
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
379
dracut-logger
Executable file
379
dracut-logger
Executable file
@@ -0,0 +1,379 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 et filetype=sh
|
||||
#
|
||||
# logging faciality module for dracut both at build- and boot-time
|
||||
#
|
||||
# Copyright 2010 Amadeusz Żołnowski <aidecoe@aidecoe.name>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
__DRACUT_LOGGER__=1
|
||||
|
||||
|
||||
## @brief Logging facility module for Dracut both at build- and boot-time.
|
||||
#
|
||||
# @section intro Introduction
|
||||
#
|
||||
# The logger takes a bit from Log4j philosophy. There are defined 6 logging
|
||||
# levels:
|
||||
# - TRACE (6)
|
||||
# The TRACE Level designates finer-grained informational events than the
|
||||
# DEBUG.
|
||||
# - DEBUG (5)
|
||||
# The DEBUG Level designates fine-grained informational events that are most
|
||||
# useful to debug an application.
|
||||
# - INFO (4)
|
||||
# The INFO level designates informational messages that highlight the
|
||||
# progress of the application at coarse-grained level.
|
||||
# - WARN (3)
|
||||
# The WARN level designates potentially harmful situations.
|
||||
# - ERROR (2)
|
||||
# The ERROR level designates error events that might still allow the
|
||||
# application to continue running.
|
||||
# - FATAL (1)
|
||||
# The FATAL level designates very severe error events that will presumably
|
||||
# lead the application to abort.
|
||||
# Descriptions are borrowed from Log4j documentation:
|
||||
# http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html
|
||||
#
|
||||
# @section usage Usage
|
||||
#
|
||||
# First of all you have to start with dlog_init() function which initializes
|
||||
# required variables. Don't call any other logging function before that one!
|
||||
# If you're ready with this, you can use following functions which corresponds
|
||||
# clearly to levels listed in @ref intro Introduction. Here they are:
|
||||
# - dtrace()
|
||||
# - ddebug()
|
||||
# - dinfo()
|
||||
# - dwarn()
|
||||
# - derror()
|
||||
# - dfatal()
|
||||
# They take all arguments given as a single message to be logged. See dlog()
|
||||
# function for details how it works. Note that you shouldn't use dlog() by
|
||||
# yourself. It's wrapped with above functions.
|
||||
#
|
||||
# @see dlog_init() dlog()
|
||||
#
|
||||
# @section conf Configuration
|
||||
#
|
||||
# Logging is controlled by following global variables:
|
||||
# - @var stdloglvl - logging level to standard error (console output)
|
||||
# - @var sysloglvl - logging level to syslog (by logger command)
|
||||
# - @var fileloglvl - logging level to file
|
||||
# - @var kmsgloglvl - logging level to /dev/kmsg (only for boot-time)
|
||||
# - @var logfile - log file which is used when @var fileloglvl is higher
|
||||
# than 0
|
||||
# and two global variables: @var maxloglvl and @var syslogfacility which <b>must
|
||||
# not</b> be overwritten. Both are set by dlog_init(). @var maxloglvl holds
|
||||
# maximum logging level of those three and indicates that dlog_init() was run.
|
||||
# @var syslogfacility is set either to 'user' (when building initramfs) or
|
||||
# 'daemon' (when booting).
|
||||
#
|
||||
# Logging level set by the variable means that messages from this logging level
|
||||
# and above (FATAL is the highest) will be shown. Logging levels may be set
|
||||
# independently for each destination (stderr, syslog, file, kmsg).
|
||||
#
|
||||
# @see dlog_init()
|
||||
|
||||
|
||||
## @brief Initializes Dracut Logger.
|
||||
#
|
||||
# @retval 1 if something has gone wrong
|
||||
# @retval 0 on success.
|
||||
#
|
||||
# @note This function need to be called before any other from this file.
|
||||
#
|
||||
# If any of the variables is not set, this function set it to default:
|
||||
# - @var stdloglvl = 4 (info)
|
||||
# - @var sysloglvl = 0 (no logging)
|
||||
# - @var fileloglvl is set to 4 when @var logfile is set too, otherwise it's
|
||||
# - @var kmsgloglvl = 0 (no logging)
|
||||
# set to 0
|
||||
#
|
||||
# @warning Function sets global variables @var maxloglvl and @syslogfacility.
|
||||
# See file doc comment for details.
|
||||
dlog_init() {
|
||||
# Skip initialization if it's already done.
|
||||
[ -n "$maxloglvl" ] && return 0
|
||||
|
||||
local ret=0; local errmsg
|
||||
|
||||
[ -z "$stdloglvl" ] && stdloglvl=4
|
||||
[ -z "$sysloglvl" ] && sysloglvl=0
|
||||
[ -z "$kmsgloglvl" ] && kmsgloglvl=0
|
||||
|
||||
if [ -z "$fileloglvl" ]; then
|
||||
[ -w "$logfile" ] && fileloglvl=4 || fileloglvl=0
|
||||
elif [ $fileloglvl -gt 0 ]; then
|
||||
! [ -e "$logfile" ] && >"$logfile"
|
||||
if [ -w "$logfile" -a -f "$logfile" ]; then
|
||||
# Mark new run in the log file
|
||||
echo >>"$logfile"
|
||||
if command -v date >/dev/null; then
|
||||
echo "=== $(date) ===" >>"$logfile"
|
||||
else
|
||||
echo "===============================================" >>"$logfile"
|
||||
fi
|
||||
echo >>"$logfile"
|
||||
else
|
||||
# We cannot log to file, so turn this facility off.
|
||||
fileloglvl=0
|
||||
ret=1
|
||||
errmsg="'$logfile' is not a writable file"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $sysloglvl -gt 0 ]; then
|
||||
if ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null
|
||||
then
|
||||
# We cannot log to syslog, so turn this facility off.
|
||||
sysloglvl=0
|
||||
ret=1
|
||||
errmsg="No '/dev/log' or 'logger' included for syslog logging"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $sysloglvl -gt 0 -o $kmsgloglvl -gt 0 ]; then
|
||||
if [ -n "$dracutbasedir" ]; then
|
||||
readonly syslogfacility=user
|
||||
else
|
||||
readonly syslogfacility=daemon
|
||||
fi
|
||||
export syslogfacility
|
||||
fi
|
||||
|
||||
local lvl; local maxloglvl_l=0
|
||||
for lvl in $stdloglvl $sysloglvl $fileloglvl $kmsgloglvl; do
|
||||
[ $lvl -gt $maxloglvl_l ] && maxloglvl_l=$lvl
|
||||
done
|
||||
readonly maxloglvl=$maxloglvl_l
|
||||
export maxloglvl
|
||||
|
||||
[ -n "$errmsg" ] && derror "$errmsg"
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
## @brief Converts numeric logging level to the first letter of level name.
|
||||
#
|
||||
# @param lvl Numeric logging level in range from 1 to 6.
|
||||
# @retval 1 if @a lvl is out of range.
|
||||
# @retval 0 if @a lvl is correct.
|
||||
# @result Echoes first letter of level name.
|
||||
_lvl2char() {
|
||||
case "$1" in
|
||||
1) echo F;;
|
||||
2) echo E;;
|
||||
3) echo W;;
|
||||
4) echo I;;
|
||||
5) echo D;;
|
||||
6) echo T;;
|
||||
*) return 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
## @brief Converts numeric level to logger priority defined by POSIX.2.
|
||||
#
|
||||
# @param lvl Numeric logging level in range from 1 to 6.
|
||||
# @retval 1 if @a lvl is out of range.
|
||||
# @retval 0 if @a lvl is correct.
|
||||
# @result Echoes logger priority.
|
||||
_lvl2syspri() {
|
||||
printf $syslogfacility.
|
||||
case "$1" in
|
||||
1) echo crit;;
|
||||
2) echo error;;
|
||||
3) echo warning;;
|
||||
4) echo info;;
|
||||
5) echo debug;;
|
||||
6) echo debug;;
|
||||
*) return 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
## @brief Converts dracut-logger numeric level to syslog log level
|
||||
#
|
||||
# @param lvl Numeric logging level in range from 1 to 6.
|
||||
# @retval 1 if @a lvl is out of range.
|
||||
# @retval 0 if @a lvl is correct.
|
||||
# @result Echoes kernel console numeric log level
|
||||
#
|
||||
# Conversion is done as follows:
|
||||
#
|
||||
# <tt>
|
||||
# FATAL(1) -> LOG_EMERG (0)
|
||||
# none -> LOG_ALERT (1)
|
||||
# none -> LOG_CRIT (2)
|
||||
# ERROR(2) -> LOG_ERR (3)
|
||||
# WARN(3) -> LOG_WARNING (4)
|
||||
# none -> LOG_NOTICE (5)
|
||||
# INFO(4) -> LOG_INFO (6)
|
||||
# DEBUG(5) -> LOG_DEBUG (7)
|
||||
# TRACE(6) /
|
||||
# </tt>
|
||||
#
|
||||
# @see /usr/include/sys/syslog.h
|
||||
_dlvl2syslvl() {
|
||||
local lvl
|
||||
|
||||
case "$1" in
|
||||
1) lvl=0;;
|
||||
2) lvl=3;;
|
||||
3) lvl=4;;
|
||||
4) lvl=6;;
|
||||
5) lvl=7;;
|
||||
6) lvl=7;;
|
||||
*) return 1;;
|
||||
esac
|
||||
|
||||
[ "$syslogfacility" = user ] && echo $((8+$lvl)) || echo $((24+$lvl))
|
||||
}
|
||||
|
||||
## @brief Prints to stderr and/or writes to file, to syslog and/or /dev/kmsg
|
||||
# given message with given level (priority).
|
||||
#
|
||||
# @param lvl Numeric logging level.
|
||||
# @param msg Message.
|
||||
# @retval 0 It's always returned, even if logging failed.
|
||||
#
|
||||
# @note This function is not supposed to be called manually. Please use
|
||||
# dtrace(), ddebug(), or others instead which wrap this one.
|
||||
#
|
||||
# This is core logging function which logs given message to standard error, file
|
||||
# and/or syslog (with POSIX shell command <tt>logger</tt>) and/or to /dev/kmsg.
|
||||
# The format is following:
|
||||
#
|
||||
# <tt>X: some message</tt>
|
||||
#
|
||||
# where @c X is the first letter of logging level. See module description for
|
||||
# details on that.
|
||||
#
|
||||
# Message to syslog is sent with tag @c dracut. Priorities are mapped as
|
||||
# following:
|
||||
# - @c FATAL to @c crit
|
||||
# - @c ERROR to @c error
|
||||
# - @c WARN to @c warning
|
||||
# - @c INFO to @c info
|
||||
# - @c DEBUG and @c TRACE both to @c debug
|
||||
_do_dlog() {
|
||||
[ -z "$maxloglvl" ] && return 0
|
||||
local lvl="$1"; shift
|
||||
local lvlc=$(_lvl2char "$lvl") || return 0
|
||||
|
||||
[ $lvl -le $maxloglvl ] || return 0
|
||||
|
||||
local msg="$lvlc: $*"
|
||||
|
||||
[ $lvl -le $stdloglvl ] && echo "$msg" >&2
|
||||
if [ $lvl -le $sysloglvl ]; then
|
||||
logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) "$msg"
|
||||
fi
|
||||
if [ $lvl -le $fileloglvl -a -w "$logfile" -a -f "$logfile" ]; then
|
||||
echo "$msg" >>"$logfile"
|
||||
fi
|
||||
[ $lvl -le $kmsgloglvl ] && \
|
||||
echo "<$(_dlvl2syslvl $lvl)>dracut[$$] $msg" >/dev/kmsg
|
||||
}
|
||||
|
||||
## @brief Internal helper function for _do_dlog()
|
||||
#
|
||||
# @param lvl Numeric logging level.
|
||||
# @param msg Message.
|
||||
# @retval 0 It's always returned, even if logging failed.
|
||||
#
|
||||
# @note This function is not supposed to be called manually. Please use
|
||||
# dtrace(), ddebug(), or others instead which wrap this one.
|
||||
#
|
||||
# This function calls _do_dlog() either with parameter msg, or if
|
||||
# none is given, it will read standard input and will use every line as
|
||||
# a message.
|
||||
#
|
||||
# This enables:
|
||||
# dwarn "This is a warning"
|
||||
# echo "This is a warning" | dwarn
|
||||
dlog() {
|
||||
if [ $# -gt 1 ]; then
|
||||
_do_dlog "$@"
|
||||
else
|
||||
while read line; do
|
||||
_do_dlog "$1" "$line"
|
||||
done
|
||||
fi
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
|
||||
## @brief Logs message at TRACE level (6)
|
||||
#
|
||||
# @param msg Message.
|
||||
# @retval 0 It's always returned, even if logging failed.
|
||||
dtrace() {
|
||||
set +x
|
||||
dlog 6 "$@"
|
||||
}
|
||||
|
||||
## @brief Logs message at DEBUG level (5)
|
||||
#
|
||||
# @param msg Message.
|
||||
# @retval 0 It's always returned, even if logging failed.
|
||||
ddebug() {
|
||||
set +x
|
||||
dlog 5 "$@"
|
||||
}
|
||||
|
||||
## @brief Logs message at INFO level (4)
|
||||
#
|
||||
# @param msg Message.
|
||||
# @retval 0 It's always returned, even if logging failed.
|
||||
dinfo() {
|
||||
set +x
|
||||
dlog 4 "$@"
|
||||
}
|
||||
|
||||
## @brief Logs message at WARN level (3)
|
||||
#
|
||||
# @param msg Message.
|
||||
# @retval 0 It's always returned, even if logging failed.
|
||||
dwarn() {
|
||||
set +x
|
||||
dlog 3 "$@"
|
||||
}
|
||||
|
||||
## @brief It's an alias to dwarn() function.
|
||||
#
|
||||
# @param msg Message.
|
||||
# @retval 0 It's always returned, even if logging failed.
|
||||
dwarning() {
|
||||
set +x
|
||||
dwarn "$@"
|
||||
}
|
||||
|
||||
## @brief Logs message at ERROR level (2)
|
||||
#
|
||||
# @param msg Message.
|
||||
# @retval 0 It's always returned, even if logging failed.
|
||||
derror() {
|
||||
set +x
|
||||
dlog 2 "$@"
|
||||
}
|
||||
|
||||
## @brief Logs message at FATAL level (1)
|
||||
#
|
||||
# @param msg Message.
|
||||
# @retval 0 It's always returned, even if logging failed.
|
||||
dfatal() {
|
||||
set +x
|
||||
dlog 1 "$@"
|
||||
}
|
@@ -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
|
||||
|
428
dracut.8
428
dracut.8
@@ -1,428 +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.
|
||||
.BR \-\-add-drivers " \fILIST\fR"
|
||||
specify a space-separated list of kernel modules to add to the initramfs.
|
||||
.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
|
||||
.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 rdblacklist= <drivername>
|
||||
do not load kernel module <drivername>
|
||||
.TP
|
||||
.BR rdloaddriver= <drivername>
|
||||
force loading kernel module <drivername>
|
||||
|
||||
.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
|
||||
.TP
|
||||
.B rdnetdebug
|
||||
debug network scripts in dracut. Output is written to /tmp/
|
||||
|
||||
.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 volume groups 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.
|
||||
.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
|
||||
|
||||
.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
|
||||
|
||||
.SS Network
|
||||
.TP
|
||||
.BR ip= {dhcp|on|any|dhcp6|auto6}
|
||||
dhcp|on|any: get ip from dhcp server from all interfaces. If root=dhcp,
|
||||
loop sequentially through all interfaces (eth0, eth1, ...) and use the first
|
||||
with a valid DHCP root-path.
|
||||
|
||||
auto6: do IPv6 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
|
||||
.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]).
|
||||
.TP
|
||||
.BR ifname= <interface>:<MAC>
|
||||
Assign network device name <interface> (ie eth0) to the NIC with MAC <MAC>.
|
||||
Note letters in the MAC-address must be lowercase!
|
||||
Note that if you use this option you \fBmust\fR specify an ifname= argument
|
||||
for all interfaces used in ip= or fcoe= arguments
|
||||
.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
|
||||
|
||||
.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.
|
||||
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>]\::[<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>]\::[<LUN>]\::<targetname>"
|
||||
.ad
|
||||
e.g. root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
|
||||
.TP
|
||||
.ad l
|
||||
.BR root= ??? " netroot=" "\%iscsi:[username:password[:reverse:password]@]\:[<servername>]\::[<protocol>]\::[<port>]\::[<LUN>]\::<targetname> ..."
|
||||
.ad
|
||||
multiple netroot options allow setting up multiple iscsi disks
|
||||
.B Not yet implemented!
|
||||
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
|
||||
|
||||
.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= ??? " iscsi_firmware"
|
||||
will read the iscsi parameter from the BIOS firmware
|
||||
|
||||
.SS FCoE
|
||||
.TP
|
||||
.BR netroot= fcoe:<interface|MAC>:<dcb|nodcb>
|
||||
Try to connect to a FCoE SAN through the NIC specified by <interface> or <MAC>,
|
||||
for the second argument, currently only nodcb is supported. Note letters in
|
||||
the MAC-address must be lowercase!
|
||||
|
||||
.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
|
||||
|
||||
.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 CCW
|
||||
.TP
|
||||
.BR rd_CCW= "<nettype>,<subchannels>,<options>"
|
||||
rd_CCW can be specified multiple times on the kernel command line. Examples:
|
||||
rd_CCW=qeth,0.0.0600,0.0.0601,0.0.0602,layer2=1,portname=foo
|
||||
rd_CCW=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 /tmp/dracut.log
|
||||
see \fBdracut.conf\fR(5)
|
||||
.TP
|
||||
.B /etc/dracut.conf
|
||||
.SS "Configuration in the Initramfs"
|
||||
.TP
|
||||
.B /conf/conf.d/
|
||||
Any files found in /conf/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)
|
525
dracut.8.xml
Normal file
525
dracut.8.xml
Normal file
@@ -0,0 +1,525 @@
|
||||
<?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>increase verbosity level (default is info(4))</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>-q</option>
|
||||
</term>
|
||||
<term>
|
||||
<option>--quiet</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>decrease verbosity level (default is info(4))</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>.
|
||||
This 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></replaceable> <replaceable><TARGET></replaceable></option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>include the files in the SOURCE directory into the
|
||||
TARGET directory in the final initramfs. If SOURCE is a file, it will be installed to TARGET in the final initramfs. This parameter can be specified multiple times.</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. Equivalent to "--compress=gzip -9"</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. Equivalent to "--compress=bzip2"</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. Equivalent to "--compress=lzma -9"</para>
|
||||
</warning></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--xz</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Compress the generated initramfs using xz.
|
||||
<warning>
|
||||
<para>Make sure your kernel has xz decompression support compiled in, otherwise you will not be able to boot. Equivalent to "--compress=xz --check=crc32 --lzma2=dict=1MiB"</para>
|
||||
</warning></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--compress <replaceable><compressor></replaceable></option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Compress the generated initramfs using the passed compression program. If you pass it just the name of a compression program, it will call that program with known-working arguments. If you pass a quoted string with arguments, it will be called with exactly those arguments. Depending on what you pass, this may result in an initramfs that the kernel cannot decompress.</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>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>-M</option>
|
||||
</term>
|
||||
<term>
|
||||
<option>--show-modules</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Print included module's name to standard output during build.</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>/etc/conf.d/</filename>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Any files found in <filename>/etc/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>
|
13
dracut.conf
13
dracut.conf
@@ -1,19 +1,22 @@
|
||||
# Sample dracut config file
|
||||
|
||||
logfile=/var/log/dracut.log
|
||||
fileloglvl=6
|
||||
|
||||
# Specific list of dracut modules to use
|
||||
#dracutmodules=""
|
||||
#dracutmodules+=""
|
||||
|
||||
# Dracut modules to omit
|
||||
#omit_dracutmodules=""
|
||||
#omit_dracutmodules+=""
|
||||
|
||||
# Dracut modules to add to the default
|
||||
#add_dracutmodules=""
|
||||
#add_dracutmodules+=""
|
||||
|
||||
# additional kernel modules to the default
|
||||
#add_drivers=""
|
||||
#add_drivers+=""
|
||||
|
||||
# list of kernel filesystem modules to be included in the generic initramfs
|
||||
#filesystems=""
|
||||
#filesystems+=""
|
||||
|
||||
# build initrd only to boot current hardware
|
||||
#hostonly="yes"
|
||||
|
@@ -1,66 +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.
|
||||
.TP
|
||||
.BR add_drivers= \%"[LIST]"
|
||||
Specify a space-separated list of kernel
|
||||
modules to add to the initramfs.
|
||||
.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)
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR dracut (8)
|
||||
|
241
dracut.conf.5.xml
Normal file
241
dracut.conf.5.xml
Normal file
@@ -0,0 +1,241 @@
|
||||
<?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>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>stdloglvl="<replaceable>{0-6}</replaceable>"</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Set logging to standard error level.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>sysloglvl="<replaceable>{0-6}</replaceable>"</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Set logging to syslog level.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>fileloglvl="<replaceable>{0-6}</replaceable>"</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Set logging to file level.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>logfile="<replaceable><file></replaceable>"</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Path to log file.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>show_modules="<replaceable>{yes|no}</replaceable>"</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Print included module's name to standard output during build.</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>
|
7
dracut.conf.d/fedora.conf.example
Normal file
7
dracut.conf.d/fedora.conf.example
Normal file
@@ -0,0 +1,7 @@
|
||||
# /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 "
|
||||
stdloglvl=3
|
3
dracut.conf.d/fips.conf.example
Normal file
3
dracut.conf.d/fips.conf.example
Normal file
@@ -0,0 +1,3 @@
|
||||
# turn on fips module
|
||||
|
||||
add_dracutmodules+=" 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"
|
2
dracut.conf.d/suse.conf.example
Normal file
2
dracut.conf.d/suse.conf.example
Normal file
@@ -0,0 +1,2 @@
|
||||
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"
|
||||
|
1230
dracut.kernel.7.xml
Normal file
1230
dracut.kernel.7.xml
Normal file
File diff suppressed because it is too large
Load Diff
7
dracut.logrotate
Normal file
7
dracut.logrotate
Normal file
@@ -0,0 +1,7 @@
|
||||
/var/log/dracut.log {
|
||||
missingok
|
||||
notifempty
|
||||
size 30k
|
||||
yearly
|
||||
create 0600 root root
|
||||
}
|
BIN
dracut.png
Normal file
BIN
dracut.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.2 KiB |
407
dracut.spec
407
dracut.spec
@@ -1,11 +1,6 @@
|
||||
# Variables must be defined
|
||||
%define with_switch_root 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
|
||||
@@ -19,16 +14,39 @@
|
||||
%endif
|
||||
|
||||
Name: dracut
|
||||
Version: 005
|
||||
Release: 1%{?rdist}
|
||||
Version: 010
|
||||
%define release_prefix 0%{?rdist}
|
||||
Release: %{release_prefix}
|
||||
|
||||
Summary: Initramfs generator using udev
|
||||
%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
|
||||
URL: https://dracut.wiki.kernel.org/
|
||||
# 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
|
||||
# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{?dashgittag};sf=tgz
|
||||
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}%{?dashgittag}.tar.bz2
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
%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
|
||||
@@ -38,42 +56,42 @@ Obsoletes: mkinitrd-devel <= 6.0.93
|
||||
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: udev
|
||||
Requires: util-linux-ng
|
||||
Requires: module-init-tools >= 3.7-9
|
||||
Requires: cpio
|
||||
Requires: coreutils
|
||||
Requires: findutils
|
||||
Requires: binutils
|
||||
Requires: grep
|
||||
Requires: which
|
||||
Requires: mktemp >= 1.5-5
|
||||
Requires: mount
|
||||
Requires: bash
|
||||
Requires: dash
|
||||
Requires: /bin/sh
|
||||
Requires: fileutils, gzip, tar
|
||||
Requires: lvm2 >= 2.02.33-9, dhclient
|
||||
Requires: filesystem >= 2.1.0, cpio, device-mapper, initscripts >= 8.63-1
|
||||
Requires: e2fsprogs >= 1.38-12, coreutils
|
||||
Requires: mdadm, elfutils-libelf
|
||||
Requires(pre): plymouth >= 0.8.0-0.2009.29.09.19.1
|
||||
Requires: plymouth >= 0.8.0-0.2009.29.09.19.1
|
||||
Requires: cryptsetup-luks
|
||||
Requires: file
|
||||
Requires: bzip2
|
||||
Requires: dmraid
|
||||
Requires: coreutils
|
||||
Requires: cpio
|
||||
Requires: dash
|
||||
Requires: filesystem >= 2.1.0
|
||||
Requires: findutils
|
||||
Requires: grep
|
||||
Requires: gzip
|
||||
Requires: kbd
|
||||
Requires: plymouth-scripts
|
||||
Requires: mktemp >= 1.5-5
|
||||
Requires: module-init-tools >= 3.7-9
|
||||
Requires: sed
|
||||
Requires: tar
|
||||
Requires: udev
|
||||
|
||||
%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
|
||||
|
||||
|
||||
%description
|
||||
Dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
|
||||
Unlike existing implementations, dracut does hard-code as little as possible
|
||||
@@ -84,18 +102,32 @@ NFS, iSCSI, NBD, FCoE with the dracut-network package.
|
||||
%package network
|
||||
Summary: Dracut modules to build a dracut initramfs with network support
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: rpcbind nfs-utils
|
||||
Requires: iscsi-initiator-utils
|
||||
Requires: rpcbind
|
||||
%if %{with_nbd}
|
||||
Requires: nbd
|
||||
%endif
|
||||
Requires: net-tools iproute
|
||||
Requires: iproute
|
||||
Requires: bridge-utils
|
||||
|
||||
%if 0%{?fedora}
|
||||
Requires: iscsi-initiator-utils
|
||||
Requires: nfs-utils
|
||||
Requires: dhclient
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
Requires: dhcp-client
|
||||
Requires: nfs-client
|
||||
Requires: vlan
|
||||
%endif
|
||||
Obsoletes: dracut-generic < 008
|
||||
Provides: dracut-generic = %{version}-%{release}
|
||||
|
||||
%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}
|
||||
@@ -111,22 +143,20 @@ 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.
|
||||
%endif
|
||||
|
||||
%package generic
|
||||
Summary: Metapackage to build a generic initramfs with dracut
|
||||
%package caps
|
||||
Summary: Dracut modules to build a dracut initramfs which drops capabilities
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: %{name}-network = %{version}-%{release}
|
||||
Requires: libcap
|
||||
|
||||
%description generic
|
||||
This package requires everything which is needed to build a generic
|
||||
all purpose initramfs with dracut.
|
||||
%description caps
|
||||
This package requires everything which is needed to build an
|
||||
all purpose initramfs with dracut, which drops capabilities.
|
||||
|
||||
%package tools
|
||||
Summary: Dracut tools to build the local initramfs
|
||||
Requires: coreutils cryptsetup-luks device-mapper
|
||||
Requires: diffutils dmraid findutils gawk grep lvm2
|
||||
Requires: module-init-tools sed
|
||||
Requires: cpio gzip
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description tools
|
||||
This package contains tools to assemble the local initrd and host configuration.
|
||||
@@ -138,48 +168,79 @@ This package contains tools to assemble the local initrd and host configuration.
|
||||
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
|
||||
|
||||
%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
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
|
||||
|
||||
%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
|
||||
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/40-fips.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/dracut
|
||||
install -m 0644 dracut.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/dracut
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,0755)
|
||||
%doc README HACKING TODO COPYING AUTHORS NEWS
|
||||
%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
|
||||
%{_datadir}/dracut/dracut-logger
|
||||
%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}/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
|
||||
%{_datadir}/dracut/modules.d/90btrfs
|
||||
%{_datadir}/dracut/modules.d/90crypt
|
||||
%{_datadir}/dracut/modules.d/90dm
|
||||
%{_datadir}/dracut/modules.d/90dmraid
|
||||
@@ -193,39 +254,42 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_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/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
|
||||
%dir %{_sharedstatedir}/initramfs
|
||||
|
||||
%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/40-fips.conf
|
||||
%endif
|
||||
|
||||
%files generic
|
||||
%files caps
|
||||
%defattr(-,root,root,0755)
|
||||
%doc README.generic
|
||||
%{_datadir}/dracut/modules.d/02caps
|
||||
|
||||
%files tools
|
||||
%defattr(-,root,root,0755)
|
||||
%doc COPYING NEWS
|
||||
%{_mandir}/man8/dracut-gencmdline.8*
|
||||
%{_mandir}/man8/dracut-catimages.8*
|
||||
/sbin/dracut-gencmdline
|
||||
@@ -235,222 +299,3 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%dir /var/lib/dracut/overlay
|
||||
|
||||
%changelog
|
||||
* Fri Jan 15 2010 Harald Hoyer <harald@redhat.com> 004-1
|
||||
- version 004
|
||||
- Resolves: rhbz#529339 rhbz#533494 rhbz#548550
|
||||
- Resolves: rhbz#548555 rhbz#553195
|
||||
|
||||
* Wed Jan 13 2010 Harald Hoyer <harald@redhat.com> 003-3
|
||||
- add Obsoletes of mkinitrd/nash/libbdevid-python
|
||||
- Related: rhbz#543948
|
||||
|
||||
* Wed Jan 13 2010 Warren Togami <wtogami@redhat.com> 003-2
|
||||
- nbd is Fedora only
|
||||
|
||||
* Fri Nov 27 2009 Harald Hoyer <harald@redhat.com> 003-1
|
||||
- version 003
|
||||
|
||||
* Mon Nov 23 2009 Harald Hoyer <harald@redhat.com> 002-26
|
||||
- add WITH_SWITCH_ROOT make flag
|
||||
- add fips requirement conditional
|
||||
- add more device mapper modules (bug #539656)
|
||||
|
||||
* Fri Nov 20 2009 Dennis Gregorovic <dgregor@redhat.com> - 002-25.1
|
||||
- nss changes for Alpha 3
|
||||
|
||||
* Thu Nov 19 2009 Harald Hoyer <harald@redhat.com> 002-25
|
||||
- add more requirements for dracut-fips (bug #539257)
|
||||
|
||||
* Tue Nov 17 2009 Harald Hoyer <harald@redhat.com> 002-24
|
||||
- put fips module in a subpackage (bug #537619)
|
||||
|
||||
* Tue Nov 17 2009 Harald Hoyer <harald@redhat.com> 002-23
|
||||
- install xdr utils for multipath (bug #463458)
|
||||
|
||||
* Thu Nov 12 2009 Harald Hoyer <harald@redhat.com> 002-22
|
||||
- add module 90multipath
|
||||
- add module 01fips
|
||||
- renamed module 95ccw to 95znet (bug #533833)
|
||||
- crypt: ignore devices in /etc/crypttab (root is not in there)
|
||||
- dasd: only install /etc/dasd.conf in hostonly mode (bug #533833)
|
||||
- zfcp: only install /etc/zfcp.conf in hostonly mode (bug #533833)
|
||||
- kernel-modules: add scsi_dh scsi_dh_rdac scsi_dh_emc (bug #527750)
|
||||
- dasd: use dasdconf.sh from s390utils (bug #533833)
|
||||
|
||||
* Fri Nov 06 2009 Harald Hoyer <harald@redhat.com> 002-21
|
||||
- fix rd_DASD argument handling (bug #531720)
|
||||
- Resolves: rhbz#531720
|
||||
|
||||
* Wed Nov 04 2009 Harald Hoyer <harald@redhat.com> 002-20
|
||||
- fix rd_DASD argument handling (bug #531720)
|
||||
- Resolves: rhbz#531720
|
||||
|
||||
* Tue Nov 03 2009 Harald Hoyer <harald@redhat.com> 002-19
|
||||
- changed rd_DASD to rd_DASD_MOD (bug #531720)
|
||||
- Resolves: rhbz#531720
|
||||
|
||||
* Tue Oct 27 2009 Harald Hoyer <harald@redhat.com> 002-18
|
||||
- renamed lvm/device-mapper udev rules according to upstream changes
|
||||
- fixed dracut search path issue
|
||||
|
||||
* Mon Oct 26 2009 Harald Hoyer <harald@redhat.com> 002-17
|
||||
- load dm_mod module (bug #530540)
|
||||
|
||||
* Fri Oct 09 2009 Jesse Keating <jkeating@redhat.com> - 002-16
|
||||
- Upgrade plymouth to Requires(pre) to make it show up before kernel
|
||||
|
||||
* Thu Oct 08 2009 Harald Hoyer <harald@redhat.com> 002-15
|
||||
- s390 ccw: s/layer1/layer2/g
|
||||
|
||||
* Thu Oct 08 2009 Harald Hoyer <harald@redhat.com> 002-14
|
||||
- add multinic support
|
||||
- add s390 zfcp support
|
||||
- add s390 network support
|
||||
|
||||
* Wed Oct 07 2009 Harald Hoyer <harald@redhat.com> 002-13
|
||||
- fixed init=<command> handling
|
||||
- kill loginit if "rdinitdebug" specified
|
||||
- run dmsquash-live-root after udev has settled (bug #527514)
|
||||
|
||||
* Tue Oct 06 2009 Harald Hoyer <harald@redhat.com> 002-12
|
||||
- add missing loginit helper
|
||||
- corrected dracut manpage
|
||||
|
||||
* Thu Oct 01 2009 Harald Hoyer <harald@redhat.com> 002-11
|
||||
- fixed dracut-gencmdline for root=UUID or LABEL
|
||||
|
||||
* Thu Oct 01 2009 Harald Hoyer <harald@redhat.com> 002-10
|
||||
- do not destroy assembled raid arrays if mdadm.conf present
|
||||
- mount /dev/shm
|
||||
- let udevd not resolve group and user names
|
||||
- preserve timestamps of tools on initramfs generation
|
||||
- generate symlinks for binaries correctly
|
||||
- moved network from udev to initqueue
|
||||
- mount nfs3 with nfsvers=3 option and retry with nfsvers=2
|
||||
- fixed nbd initqueue-finished
|
||||
- improved debug output: specifying "rdinitdebug" now logs
|
||||
to dmesg, console and /init.log
|
||||
- stop udev before killing it
|
||||
- add ghost /var/log/dracut.log
|
||||
- dmsquash: use info() and die() rather than echo
|
||||
- strip kernel modules which have no x bit set
|
||||
- redirect stdin, stdout, stderr all RW to /dev/console
|
||||
so the user can use "less" to view /init.log and dmesg
|
||||
|
||||
* Tue Sep 29 2009 Harald Hoyer <harald@redhat.com> 002-9
|
||||
- make install of new dm/lvm udev rules optionally
|
||||
- correct dasd module typo
|
||||
|
||||
* Fri Sep 25 2009 Warren Togami <wtogami@redhat.com> 002-8
|
||||
- revert back to dracut-002-5 tarball 845dd502
|
||||
lvm2 was reverted to pre-udev
|
||||
|
||||
* Wed Sep 23 2009 Harald Hoyer <harald@redhat.com> 002-7
|
||||
- build with the correct tarball
|
||||
|
||||
* Wed Sep 23 2009 Harald Hoyer <harald@redhat.com> 002-6
|
||||
- add new device mapper udev rules and dmeventd
|
||||
bug 525319, 525015
|
||||
|
||||
* Wed Sep 23 2009 Warren Togami <wtogami@redaht.com> 002-5
|
||||
- Revert back to -3, Add umount back to initrd
|
||||
This makes no functional difference to LiveCD. See Bug #525319
|
||||
|
||||
* Mon Sep 21 2009 Warren Togami <wtogami@redhat.com> 002-4
|
||||
- Fix LiveCD boot regression
|
||||
|
||||
* Mon Sep 21 2009 Harald Hoyer <harald@redhat.com> 002-3
|
||||
- bail out if selinux policy could not be loaded and
|
||||
selinux=0 not specified on kernel command line
|
||||
(bug #524113)
|
||||
- set finished criteria for dmsquash live images
|
||||
|
||||
* Fri Sep 18 2009 Harald Hoyer <harald@redhat.com> 002-2
|
||||
- do not cleanup dmraids
|
||||
- copy over lvm.conf
|
||||
|
||||
* Thu Sep 17 2009 Harald Hoyer <harald@redhat.com> 002-1
|
||||
- version 002
|
||||
- set correct PATH
|
||||
- workaround for broken mdmon implementation
|
||||
|
||||
* Wed Sep 16 2009 Harald Hoyer <harald@redhat.com> 001-12
|
||||
- removed lvm/mdraid/dmraid lock files
|
||||
- add missing ifname= files
|
||||
|
||||
* Wed Sep 16 2009 Harald Hoyer <harald@redhat.com> 001-11
|
||||
- generate dracut-version during rpm build time
|
||||
|
||||
* Tue Sep 15 2009 Harald Hoyer <harald@redhat.com> 001-10
|
||||
- add ifname= argument for persistent netdev names
|
||||
- new /initqueue-finished to check if the main loop can be left
|
||||
- copy mdadm.conf if --mdadmconf set or mdadmconf in dracut.conf
|
||||
|
||||
* Wed Sep 09 2009 Harald Hoyer <harald@redhat.com> 001-9
|
||||
- added Requires: plymouth-scripts
|
||||
|
||||
* Wed Sep 09 2009 Harald Hoyer <harald@redhat.com> 001-8
|
||||
- plymouth: use plymouth-populate-initrd
|
||||
- add add_drivers for dracut and dracut.conf
|
||||
- do not mount /proc and /selinux manually in selinux-load-policy
|
||||
|
||||
* Wed Sep 09 2009 Harald Hoyer <harald@redhat.com> 001-7
|
||||
- add scsi_wait_scan to be sure everything was scanned
|
||||
|
||||
* Tue Sep 08 2009 Harald Hoyer <harald@redhat.com> 001-6
|
||||
- fixed several problems with md raid containers
|
||||
- fixed selinux policy loading
|
||||
|
||||
* Tue Sep 08 2009 Harald Hoyer <harald@redhat.com> 001-5
|
||||
- patch does not honor file modes, fixed them manually
|
||||
|
||||
* Mon Sep 07 2009 Harald Hoyer <harald@redhat.com> 001-4
|
||||
- fixed mdraid for IMSM
|
||||
|
||||
* Mon Sep 07 2009 Harald Hoyer <harald@redhat.com> 001-3
|
||||
- fixed bug, which prevents installing 61-persistent-storage.rules (bug #520109)
|
||||
|
||||
* Thu Sep 03 2009 Harald Hoyer <harald@redhat.com> 001-2
|
||||
- fixed missing grep for md
|
||||
- reorder cleanup
|
||||
|
||||
* Wed Sep 02 2009 Harald Hoyer <harald@redhat.com> 001-1
|
||||
- version 001
|
||||
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
|
||||
|
||||
* Fri Aug 14 2009 Harald Hoyer <harald@redhat.com> 0.9-1
|
||||
- version 0.9
|
||||
|
||||
* Thu Aug 06 2009 Harald Hoyer <harald@redhat.com> 0.8-1
|
||||
- version 0.8
|
||||
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
|
||||
|
||||
* Fri Jul 24 2009 Harald Hoyer <harald@redhat.com> 0.7-1
|
||||
- version 0.7
|
||||
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
|
||||
|
||||
* Wed Jul 22 2009 Harald Hoyer <harald@redhat.com> 0.6-1
|
||||
- version 0.6
|
||||
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
|
||||
|
||||
* Fri Jul 17 2009 Harald Hoyer <harald@redhat.com> 0.5-1
|
||||
- version 0.5
|
||||
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
|
||||
|
||||
* Sat Jul 04 2009 Harald Hoyer <harald@redhat.com> 0.4-1
|
||||
- version 0.4
|
||||
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
|
||||
|
||||
* Thu Jul 02 2009 Harald Hoyer <harald@redhat.com> 0.3-1
|
||||
- version 0.3
|
||||
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
|
||||
|
||||
* Wed Jul 01 2009 Harald Hoyer <harald@redhat.com> 0.2-1
|
||||
- version 0.2
|
||||
|
||||
* Fri Jun 19 2009 Harald Hoyer <harald@redhat.com> 0.1-1
|
||||
- first release
|
||||
|
||||
* Thu Dec 18 2008 Jeremy Katz <katzj@redhat.com> - 0.0-1
|
||||
- Initial build
|
||||
|
||||
|
1701
dracut.svg
Normal file
1701
dracut.svg
Normal file
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 68 KiB |
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 /run/initramfs/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>
|
46
lsinitrd
46
lsinitrd
@@ -1,11 +1,47 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Copyright 2005-2010 Harald Hoyer <harald@redhat.com>
|
||||
# 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
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
[[ $# -eq 1 ]] || { echo "Usage: $(basename $0) <initramfs file>" ; exit 1 ; }
|
||||
[[ -f $1 ]] || { echo "$1 does not exist" ; exit 1 ; }
|
||||
[[ $# -le 2 ]] || { echo "Usage: $(basename $0) [<initramfs file> [<filename>]]" ; exit 1 ; }
|
||||
image="${1:-/boot/initramfs-$(uname -r).img}"
|
||||
[[ -f "$image" ]] || { echo "$image does not exist" ; exit 1 ; }
|
||||
|
||||
echo "$1:"
|
||||
CAT=zcat
|
||||
FILE_T=$(file "$image")
|
||||
|
||||
if [[ "$FILE_T" =~ ": gzip compressed data" ]]; then
|
||||
CAT=zcat
|
||||
elif [[ "$FILE_T" =~ ": xz compressed data" ]]; then
|
||||
CAT=xzcat
|
||||
elif [[ "$FILE_T" =~ ": data" ]]; then
|
||||
CAT=lzcat
|
||||
fi
|
||||
|
||||
if [[ $# -eq 2 ]]; then
|
||||
$CAT $image | cpio --extract --verbose --quiet --to-stdout ${2#/} 2>/dev/null
|
||||
exit $?
|
||||
fi
|
||||
|
||||
echo "$image:"
|
||||
echo "========================================================================"
|
||||
zcat $1 | cpio --extract --verbose --quiet --to-stdout 'dracut-*' 2>/dev/null
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout 'lib/dracut/dracut-*' 2>/dev/null
|
||||
echo "========================================================================"
|
||||
zcat $1 | cpio --extract --verbose --quiet --list
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list
|
||||
echo "========================================================================"
|
||||
|
@@ -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)
|
||||
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 -H $dracut_args --add-drivers "$basicmodules" "$target" "$kernel"
|
||||
if [[ $basicmodules ]]; then
|
||||
dracut $dracut_args --add-drivers "$basicmodules" "$target" "$kernel"
|
||||
else
|
||||
dracut -H $dracut_args "$target" "$kernel"
|
||||
dracut $dracut_args "$target" "$kernel"
|
||||
fi
|
||||
|
||||
# vim:ts=8:sw=4:sts=4:et
|
||||
|
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,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
. $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; 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,30 +1,34 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
do_fips()
|
||||
{
|
||||
FIPSMODULES=$(cat /etc/fipsmodules)
|
||||
BOOT=$(getarg boot=)
|
||||
boot=$(getarg boot=)
|
||||
KERNEL=$(uname -r)
|
||||
udevadm trigger >/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 ;;
|
||||
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
|
||||
|
||||
[ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)
|
||||
if ! [ -e "$boot" ]; then
|
||||
udevadm trigger --action=add >/dev/null 2>&1
|
||||
[ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)
|
||||
|
||||
if [ $UDEVVERSION -ge 143 ]; then
|
||||
udevadm settle --exit-if-exists=$boot
|
||||
else
|
||||
udevadm settle --timeout=30
|
||||
if [ $UDEVVERSION -ge 143 ]; then
|
||||
udevadm settle --exit-if-exists=$boot
|
||||
else
|
||||
udevadm settle --timeout=30
|
||||
fi
|
||||
fi
|
||||
|
||||
[ -e "$boot" ]
|
||||
@@ -52,19 +56,17 @@ do_fips()
|
||||
fi
|
||||
done
|
||||
info "Self testing crypto algorithms"
|
||||
modprobe tcrypt noexit=1 || return 1
|
||||
modprobe tcrypt || return 1
|
||||
rmmod tcrypt
|
||||
info "All initrd crypto checks done"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode == "0" ]; then
|
||||
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
|
||||
|
||||
# vim:ts=8:sw=4:sts=4:et
|
||||
|
@@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
inst_hook pre-trigger 01 "$moddir/fips.sh"
|
||||
dracut_install sha512hmac rmmod insmod mount uname umount
|
||||
|
||||
libdir="lib"
|
||||
if ldd $(find_binary sha512hmac) |grep -q /lib64/; then
|
||||
libdir="lib64"
|
||||
fi
|
||||
|
||||
if [ -e /usr/$libdir/libsoftokn3.so ]; then
|
||||
dracut_install \
|
||||
/usr/$libdir/libsoftokn3.so /usr/$libdir/libsoftokn3.chk \
|
||||
/usr/$libdir/libfreebl3.so /usr/$libdir/libfreebl3.chk
|
||||
else
|
||||
dracut_install \
|
||||
/$libdir/libsoftokn3.so /$libdir/libsoftokn3.chk \
|
||||
/$libdir/libfreebl3.so /$libdir/libfreebl3.chk
|
||||
fi
|
||||
|
||||
dracut_install /usr/$libdir/hmaccalc/sha512hmac.hmac
|
||||
|
||||
# vim:ts=8:sw=4:sts=4:et
|
@@ -1,16 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
FIPSMODULES="aead aes_generic 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
|
||||
|
||||
# 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
|
||||
}
|
||||
|
33
modules.d/02caps/README
Normal file
33
modules.d/02caps/README
Normal file
@@ -0,0 +1,33 @@
|
||||
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
|
||||
"rd.driver.pre="
|
||||
rd.driver.pre=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 rd.driver.pre 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
|
36
modules.d/02caps/caps.sh
Executable file
36
modules.d/02caps/caps.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/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
|
||||
|
19
modules.d/02caps/module-setup.sh
Executable file
19
modules.d/02caps/module-setup.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/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 capsh >/dev/null 2>&1
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_hook pre-pivot 00 "$moddir/caps.sh"
|
||||
inst $(type -P capsh 2>/dev/null) /usr/sbin/capsh
|
||||
# capsh wants bash and we need bash also
|
||||
inst /bin/bash && ln -sf bash "${initdir}/bin/sh"
|
||||
}
|
||||
|
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}
|
214
modules.d/10i18n/module-setup.sh
Executable file
214
modules.d/10i18n/module-setup.sh
Executable file
@@ -0,0 +1,214 @@
|
||||
#!/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} ]] || {
|
||||
derror 'No KEYMAP.'
|
||||
return 1
|
||||
}
|
||||
findkeymap ${KEYMAP}
|
||||
|
||||
for map in ${EXT_KEYMAPS}
|
||||
do
|
||||
ddebug "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} ]] || {
|
||||
derror 'i18n_vars not set! 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
|
||||
}
|
||||
|
37
modules.d/10i18n/parse-i18n.sh
Executable file
37
modules.d/10i18n/parse-i18n.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/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
|
||||
local _default
|
||||
_default=$1
|
||||
shift
|
||||
_file=$1
|
||||
shift
|
||||
_value=$(getarg $@)
|
||||
[ -z "${_value}" ] && _value=$_default
|
||||
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 1 /etc/vconsole.conf UNICODE vconsole.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
|
||||
|
||||
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"
|
||||
|
27
modules.d/10rpmversion/module-setup.sh
Executable file
27
modules.d/10rpmversion/module-setup.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/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" /lib/dracut/$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;} )
|
||||
mkdir -m 0755 -p $initdir/lib $initdir/lib/dracut
|
||||
echo $dracut_rpm_version > $initdir/lib/dracut/$dracut_rpm_version
|
||||
fi
|
||||
fi
|
||||
inst_hook cmdline 01 "$moddir/version.sh"
|
||||
|
||||
}
|
||||
|
5
modules.d/10rpmversion/version.sh
Normal file → Executable file
5
modules.d/10rpmversion/version.sh
Normal file → Executable file
@@ -1,4 +1,7 @@
|
||||
for i in dracut-*; do
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
for i in lib/dracut/dracut-*; do
|
||||
if [ -f $i ]; then
|
||||
vinfo < $i
|
||||
fi
|
||||
|
@@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
. $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; 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,12 +22,12 @@ 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
|
||||
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"
|
||||
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
|
||||
|
||||
echo ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif >> /tmp/net.$netif.up
|
||||
@@ -34,9 +36,9 @@ setup_interface() {
|
||||
|
||||
[ -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
|
||||
@@ -44,13 +46,9 @@ setup_interface() {
|
||||
|
||||
PATH=$PATH:/sbin:/usr/sbin
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
if getarg rdnetdebug ; then
|
||||
exec >/tmp/dhclient.$interface.$$.out
|
||||
exec 2>>/tmp/dhclient.$interface.$$.out
|
||||
set -x
|
||||
fi
|
||||
export PS4="dhclient.$interface.$$ + "
|
||||
exec >>/run/initramfs/initlog.pipe 2>>/run/initramfs/initlog.pipe
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
# We already need a set netif here
|
||||
netif=$interface
|
||||
@@ -60,23 +58,25 @@ netif=$interface
|
||||
|
||||
case $reason in
|
||||
PREINIT)
|
||||
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)
|
||||
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
|
||||
|
||||
exit 0
|
||||
|
@@ -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,10 +16,10 @@ 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
|
||||
[ -z "$root" ] && root="dhcp"
|
||||
echo '[ -d $NEWROOT/proc -o -e /dev/root ]' > /initqueue-finished/dhcp.sh
|
||||
echo '[ -d $NEWROOT/proc -o -e /dev/root ]' > $hookdir/initqueue/finished/dhcp.sh
|
||||
fi
|
||||
|
@@ -1,21 +1,21 @@
|
||||
#!/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
|
||||
echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="?*", ATTR{type}=="1", NAME="%k"' \
|
||||
> /etc/udev/rules.d/50-ifname.rules
|
||||
return
|
||||
fi
|
||||
|
||||
{
|
||||
for p in $(getargs ifname=); do
|
||||
parse_ifname_opts $p
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="%s", ATTR{type}=="1", NAME="%s"\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 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="?*", ATTR{type}=="1", NAME!="?*", KERNEL=="%s", NAME="%%k-renamed"\n' "$ifname_if"
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="?*", ATTR{type}=="1", NAME!="?*", KERNEL=="%s", NAME="%%k-renamed"\n' "$ifname_if"
|
||||
done
|
||||
} > /etc/udev/rules.d/50-ifname.rules
|
||||
|
@@ -1,27 +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
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
# 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
|
||||
dhclient "$@" -1 -q -cf /etc/dhclient.conf -pf /tmp/dhclient.$netif.pid -lf /tmp/dhclient.$netif.lease $netif
|
||||
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
|
||||
}
|
||||
|
||||
@@ -31,17 +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
|
||||
echo ip link set $netif up
|
||||
echo wait_for_if_up $netif
|
||||
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
|
||||
|
||||
|
||||
@@ -54,12 +58,12 @@ do_static() {
|
||||
strstr $ip '*:*:*' && load_ipv6
|
||||
|
||||
{
|
||||
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
|
||||
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
|
||||
@@ -67,9 +71,9 @@ do_static() {
|
||||
|
||||
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
|
||||
@@ -78,13 +82,9 @@ do_static() {
|
||||
|
||||
PATH=$PATH:/sbin:/usr/sbin
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
if getarg rdnetdebug ; then
|
||||
exec >/tmp/ifup.$1.$$.out
|
||||
exec 2>>/tmp/ifup.$1.$$.out
|
||||
set -x
|
||||
fi
|
||||
export PS4="ifup.$1.$$ + "
|
||||
exec >>/run/initramfs/initlog.pipe 2>>/run/initramfs/initlog.pipe
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
# Huh? No $1?
|
||||
[ -z "$1" ] && exit 1
|
||||
@@ -92,11 +92,25 @@ fi
|
||||
# $netif reads easier than $1
|
||||
netif=$1
|
||||
|
||||
# enslave this interface to bond?
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
for slave in $bondslaves ; do
|
||||
if [ "$netif" = "$slave" ] ; then
|
||||
netif=$bondname
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# bridge this interface?
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
if [ "$netif" = "$ethname" ]; then
|
||||
netif="$bridgename"
|
||||
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
|
||||
: # We need to really setup bond (recursive call)
|
||||
else
|
||||
netif="$bridgename"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -115,11 +129,62 @@ if [ "$netif" = "lo" ] ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# start bond if needed
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
|
||||
if [ "$netif" = "$bondname" ] && [ ! -e /tmp/net.$bondname.up ] ; then # We are master bond device
|
||||
modprobe bonding
|
||||
ip link set $netif down
|
||||
|
||||
# Stolen from ifup-eth
|
||||
# add the bits to setup driver parameters here
|
||||
for arg in $bondoptions ; do
|
||||
key=${arg%%=*};
|
||||
value=${arg##*=};
|
||||
# %{value:0:1} is replaced with non-bash specific construct
|
||||
if [ "${key}" = "arp_ip_target" -a "${#value}" != "0" -a "+${value%%+*}" != "+" ]; then
|
||||
OLDIFS=$IFS;
|
||||
IFS=',';
|
||||
for arp_ip in $value; do
|
||||
echo +$arp_ip > /sys/class/net/${netif}/bonding/$key
|
||||
done
|
||||
IFS=$OLDIFS;
|
||||
else
|
||||
echo $value > /sys/class/net/${netif}/bonding/$key
|
||||
fi
|
||||
done
|
||||
|
||||
ip link set $netif up
|
||||
|
||||
for slave in $bondslaves ; do
|
||||
ip link set $slave down
|
||||
ifenslave $bondname $slave
|
||||
ip link set $slave up
|
||||
wait_for_if_up $slave
|
||||
done
|
||||
|
||||
# add the bits to setup the needed post enslavement parameters
|
||||
for arg in $BONDING_OPTS ; do
|
||||
key=${arg%%=*};
|
||||
value=${arg##*=};
|
||||
if [ "${key}" = "primary" ]; then
|
||||
echo $value > /sys/class/net/${netif}/bonding/$key
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# XXX need error handling like dhclient-script
|
||||
|
||||
# start bridge if necessary
|
||||
if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
|
||||
ip link set $ethname up
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
DO_BOND_SETUP=yes /sbin/ifup $bondname
|
||||
else
|
||||
ip link set $ethname up
|
||||
fi
|
||||
wait_for_if_up $ethname
|
||||
# Create bridge and add eth to bridge
|
||||
brctl addbr $bridgename
|
||||
@@ -132,9 +197,9 @@ ip=$(getarg ip)
|
||||
|
||||
if [ -z "$ip" ]; then
|
||||
if [ "$netroot" = "dhcp6" ]; then
|
||||
do_dhcp -6
|
||||
do_dhcp -6
|
||||
else
|
||||
do_dhcp -4
|
||||
do_dhcp -4
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -142,24 +207,26 @@ fi
|
||||
# looking for ip= lines
|
||||
for p in $(getargs ip=); do
|
||||
ip_to_var $p
|
||||
# skip ibft
|
||||
[ "$autoconf" = "ibft" ] && continue
|
||||
|
||||
# If this option isn't directed at our interface, skip it
|
||||
[ -n "$dev" ] && [ "$dev" != "$netif" ] && continue
|
||||
|
||||
# Store config for later use
|
||||
for i in ip srv gw mask hostname; do
|
||||
eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
|
||||
eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
|
||||
done > /tmp/net.$netif.override
|
||||
|
||||
case $autoconf in
|
||||
dhcp|on|any)
|
||||
do_dhcp -4 ;;
|
||||
dhcp6)
|
||||
do_dhcp -6 ;;
|
||||
auto6)
|
||||
do_ipv6auto ;;
|
||||
dhcp|on|any)
|
||||
do_dhcp -4 ;;
|
||||
dhcp6)
|
||||
do_dhcp -6 ;;
|
||||
auto6)
|
||||
do_ipv6auto ;;
|
||||
*)
|
||||
do_static ;;
|
||||
do_static ;;
|
||||
esac
|
||||
break
|
||||
done
|
||||
|
@@ -1,28 +0,0 @@
|
||||
#!/bin/bash
|
||||
dracut_install ip dhclient brctl arping
|
||||
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 98 "$moddir/parse-bridge.sh"
|
||||
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
|
||||
inst_hook pre-pivot 10 "$moddir/kill-dhclient.sh"
|
||||
|
||||
if ldd $(which sh) | 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,17 +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)/'
|
||||
nm -uPA "$1" | egrep -q $net_drivers && \
|
||||
nm -uPA "$1" | egrep -qv 'iw_handler_get_spy' && \
|
||||
[[ ! $1 =~ $unwanted_drivers ]]
|
||||
}
|
||||
|
||||
instmods $(filter_kernel_modules net_module_test)
|
||||
|
||||
instmods ecb arc4
|
||||
# bridge modules
|
||||
instmods bridge stp llc
|
||||
instmods ipv6
|
@@ -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
|
||||
|
70
modules.d/40network/module-setup.sh
Executable file
70
modules.d/40network/module-setup.sh
Executable file
@@ -0,0 +1,70 @@
|
||||
#!/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 dhclient ; do
|
||||
if ! type -P $program >/dev/null; then
|
||||
derror "Could not find program \"$program\" required by network."
|
||||
return 1
|
||||
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 arping tr dhclient
|
||||
dracut_install -o brctl ifenslave
|
||||
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 96 "$moddir/parse-bond.sh"
|
||||
inst_hook cmdline 97 "$moddir/parse-bridge.sh"
|
||||
inst_hook cmdline 98 "$moddir/parse-ip-opts.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
|
||||
|
||||
}
|
||||
|
@@ -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
|
||||
|
||||
# pxelinux provides macaddr '-' separated, but we need ':'
|
||||
fix_bootif() {
|
||||
@@ -6,6 +8,8 @@ fix_bootif() {
|
||||
local IFS='-'
|
||||
macaddr=$(for i in ${macaddr} ; do echo -n $i:; done)
|
||||
macaddr=${macaddr%:}
|
||||
# strip hardware type field from pxelinux
|
||||
[ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
|
||||
echo $macaddr
|
||||
}
|
||||
|
||||
@@ -20,21 +24,28 @@ fix_bootif() {
|
||||
IFACES=$ethname
|
||||
fi
|
||||
|
||||
# bond: attempt only the defined interface (override bridge defines)
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
# It is enough to fire up only one
|
||||
IFACES=${bondslaves%% *}
|
||||
fi
|
||||
|
||||
# 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/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 'ACTION=="add", SUBSYSTEM=="net", NAME=="%s", RUN+="/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 'ACTION=="add", SUBSYSTEM=="net", RUN+="/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,8 +1,10 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
PATH=$PATH:/sbin:/usr/sbin
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
# Huh? Empty $1?
|
||||
[ -z "$1" ] && exit 1
|
||||
@@ -41,16 +43,17 @@ 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";
|
||||
# FIXME!
|
||||
for f in $hookdir/cmdline/90*.sh; do
|
||||
[ -f "$f" ] && . "$f";
|
||||
done
|
||||
else
|
||||
rootok="1"
|
||||
@@ -81,21 +84,40 @@ done
|
||||
[ -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
|
||||
# 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
|
||||
[ -n "$new_routers" ] && dest=${new_routers%%,*}
|
||||
[ -n "$gw" ] && dest=$gw
|
||||
if [ -z "$dest" ] ; then
|
||||
|
||||
# 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]*) dest=$dummy;;
|
||||
[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
|
||||
@@ -108,8 +130,8 @@ source_all netroot
|
||||
if $handler $netif $netroot $NEWROOT; then
|
||||
# Network rootfs mount successful
|
||||
for iface in $IFACES ; do
|
||||
[ -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
|
||||
[ -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
|
||||
@@ -119,9 +141,9 @@ else
|
||||
# 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
|
||||
ip link set $netif down
|
||||
ip addr flush dev $netif
|
||||
echo "#empty" > /etc/resolv.conf
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
|
63
modules.d/40network/parse-bond.sh
Executable file
63
modules.d/40network/parse-bond.sh
Executable file
@@ -0,0 +1,63 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Format:
|
||||
# bond=<bondname>[:<bondslaves>:[:<options>]]
|
||||
#
|
||||
# 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 include 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
|
||||
#
|
||||
|
||||
# return if bond already parsed
|
||||
[ -n "$bondname" ] && return
|
||||
|
||||
# Check if bond parameter is valid
|
||||
if getarg bond= >/dev/null ; then
|
||||
if [ -z "$netroot" ] ; then
|
||||
die "No netboot configured, bond is invalid"
|
||||
fi
|
||||
fi
|
||||
|
||||
# We translate list of slaves to space-separated here to mwke it easier to loop over them in ifup
|
||||
# Ditto for bonding options
|
||||
parsebond() {
|
||||
local v=${1}:
|
||||
set --
|
||||
while [ -n "$v" ]; do
|
||||
set -- "$@" "${v%%:*}"
|
||||
v=${v#*:}
|
||||
done
|
||||
|
||||
unset bondname bondslaves bondoptions
|
||||
case $# in
|
||||
0) bondname=bond0; bondslaves="eth0 eth1" ;;
|
||||
1) bondname=$1; bondslaves="eth0 eth1" ;;
|
||||
2) bondname=$1; bondslaves=$(echo $2|tr "," " ") ;;
|
||||
3) bondname=$1; bondslaves=$(echo $2|tr "," " "); bondoptions=$(echo $3|tr "," " ") ;;
|
||||
*) die "bond= requires zero to four parameters" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
unset bondname bondslaves bondoptions
|
||||
|
||||
# Parse bond for bondname, bondslaves, bondmode and bondoptions
|
||||
if getarg bond >/dev/null; then
|
||||
# Read bond= parameters if they exist
|
||||
bond="$(getarg bond=)"
|
||||
if [ ! "$bond" = "bond" ]; then
|
||||
parsebond "$(getarg bond=)"
|
||||
fi
|
||||
# Simple default bond
|
||||
if [ -z "$bondname" ]; then
|
||||
bondname=bond0
|
||||
bondslaves="eth0 eth1"
|
||||
fi
|
||||
# Make it suitable for initscripts export
|
||||
bondoptions=$(echo $bondoptions|tr ";" ",")
|
||||
echo "bondname=$bondname" > /tmp/bond.info
|
||||
echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.info
|
||||
echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.info
|
||||
return
|
||||
fi
|
@@ -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
|
||||
|
||||
@@ -26,15 +28,23 @@ parsebridge() {
|
||||
|
||||
unset bridgename ethname
|
||||
case $# in
|
||||
0) bridgename=br0; ethname=eth0 ;;
|
||||
1) die "bridge= requires two parameters" ;;
|
||||
2) bridgename=$1; ethname=$2 ;;
|
||||
*) die "bridge= requires two parameters" ;;
|
||||
0) bridgename=br0; ethname=$iface ;;
|
||||
1) die "bridge= requires two parameters" ;;
|
||||
2) bridgename=$1; ethname=$2 ;;
|
||||
*) die "bridge= requires two parameters" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
unset bridgename ethname
|
||||
|
||||
iface=eth0
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
if [ -n "$bondname" ] ; then
|
||||
iface=$bondname
|
||||
fi
|
||||
fi
|
||||
|
||||
# Parse bridge for bridgename and ethname
|
||||
if getarg bridge >/dev/null; then
|
||||
# Read bridge= parameters if they exist
|
||||
@@ -45,7 +55,7 @@ if getarg bridge >/dev/null; then
|
||||
# Simple default bridge
|
||||
if [ -z "$bridgename" ]; then
|
||||
bridgename=br0
|
||||
ethname=eth0
|
||||
ethname=$iface
|
||||
fi
|
||||
echo "bridgename=$bridgename" > /tmp/bridge.info
|
||||
echo "ethname=$ethname" >> /tmp/bridge.info
|
||||
|
@@ -1,7 +1,9 @@
|
||||
#!/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!
|
||||
#
|
||||
|
@@ -1,24 +1,26 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# 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
|
||||
# routing,dns,dhcp-options,etc.
|
||||
#
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
# 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
|
||||
|
||||
@@ -38,7 +40,7 @@ fi
|
||||
if [ -z "$NEEDBOOTDEV" ] ; then
|
||||
local count=0
|
||||
for p in $(getargs ip=); do
|
||||
count=$(( $count + 1 ))
|
||||
count=$(( $count + 1 ))
|
||||
done
|
||||
[ $count -gt 1 ] && NEEDBOOTDEV=1
|
||||
fi
|
||||
@@ -49,48 +51,81 @@ if [ -n "$NEEDBOOTDEV" ] ; then
|
||||
[ -z "$BOOTDEV" ] && die "Bootdev argument is empty"
|
||||
fi
|
||||
|
||||
if [ "ibft" = "$(getarg ip=)" ]; then
|
||||
modprobe ibft
|
||||
num=0
|
||||
(
|
||||
for iface in /sys/firmware/ibft/ethernet*; do
|
||||
[ -e ${iface}/mac ] || continue
|
||||
ifname_mac=$(read a < ${iface}/mac; echo $a)
|
||||
[ -z "$ifname_mac" ] || continue
|
||||
ifname_if=ibft$num
|
||||
num=$(( $num + 1 ))
|
||||
echo "ifname=$ifname_if:$ifname_mac"
|
||||
dev=$ifname_if
|
||||
|
||||
dhcp=$(read a < ${iface}/dhcp; echo $a)
|
||||
if [ -n "$dhcp" ]; then
|
||||
echo "ip=$dev:dhcp"
|
||||
else
|
||||
ip=$(read a < ${iface}/ip-addr; echo $a)
|
||||
gw=$(read a < ${iface}/gateway; echo $a)
|
||||
mask=$(read a < ${iface}/subnet-mask; echo $a)
|
||||
hostname=$(read a < ${iface}/hostname; echo $a)
|
||||
echo "ip=$ip::$gw:$mask:$hostname:$dev:none"
|
||||
fi
|
||||
done
|
||||
) >> /etc/cmdline
|
||||
# reread cmdline
|
||||
unset CMDLINE
|
||||
fi
|
||||
|
||||
# Check ip= lines
|
||||
# XXX Would be nice if we could errorcheck ip addresses here as well
|
||||
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
|
||||
|
||||
# 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"
|
||||
;;
|
||||
dhcp|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'";;
|
||||
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" ] && die "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
|
||||
@@ -98,15 +133,15 @@ for p in $(getargs ip=); do
|
||||
|
||||
# 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,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
[ -d /etc/sysconfig/network-scripts/ ] || exit 1
|
||||
|
||||
[[ $1 = -d ]] && echo network
|
||||
|
||||
exit 255
|
@@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
|
16
modules.d/45ifcfg/module-setup.sh
Executable file
16
modules.d/45ifcfg/module-setup.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/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
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
|
||||
}
|
||||
|
@@ -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
|
||||
|
||||
# NFS root might have reached here before /tmp/net.ifaces was written
|
||||
udevadm settle --timeout=30
|
||||
@@ -7,64 +9,134 @@ udevadm settle --timeout=30
|
||||
|
||||
read IFACES < /tmp/net.ifaces
|
||||
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
fi
|
||||
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
fi
|
||||
|
||||
mkdir -p /tmp/ifcfg/
|
||||
|
||||
for netif in $IFACES ; do
|
||||
mkdir -p /tmp/ifcfg/
|
||||
# bridge?
|
||||
unset bridge
|
||||
unset bond
|
||||
if [ "$netif" = "$bridgename" ]; then
|
||||
bridge=yes
|
||||
elif [ "$netif" = "$bondname" ]; then
|
||||
# $netif can't be bridge and bond at the same time
|
||||
bond=yes
|
||||
fi
|
||||
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$netif"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
if [ -f /tmp/net.$netif.lease ]; then
|
||||
strstr "$ip" '*:*:*' &&
|
||||
echo "DHCPV6C=yes"
|
||||
echo "BOOTPROTO=dhcp"
|
||||
else
|
||||
echo "BOOTPROTO=none"
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$netif"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
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
|
||||
. /tmp/net.$netif.override
|
||||
echo "IPADDR=$ip"
|
||||
echo "NETMASK=$mask"
|
||||
[ -n "$gw" ] && echo "GATEWAY=$gw"
|
||||
fi
|
||||
. /tmp/net.$netif.override
|
||||
echo "IPADDR=$ip"
|
||||
echo "NETMASK=$mask"
|
||||
[ -n "$gw" ] && echo "GATEWAY=$gw"
|
||||
fi
|
||||
} > /tmp/ifcfg/ifcfg-$netif
|
||||
|
||||
# bridge needs different things written to ifcfg
|
||||
if [ -z "$bridge" ]; 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
|
||||
else
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
fi
|
||||
|
||||
if [ -n "$bond" ] ; then
|
||||
# bond interface
|
||||
{
|
||||
# This variable is an indicator of a bond interface for initscripts
|
||||
echo "BONDING_OPTS=\"$bondoptions\""
|
||||
echo "NAME=\"Boot Disk\""
|
||||
} >> /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=no"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=$(cat /sys/class/net/$slave/address)"
|
||||
echo "SLAVE=yes"
|
||||
echo "MASTER=$netif"
|
||||
echo "NAME=$slave"
|
||||
} >> /tmp/ifcfg/ifcfg-$slave
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "$bridge" ] ; then
|
||||
# bridge
|
||||
{
|
||||
echo "TYPE=Bridge"
|
||||
{
|
||||
echo "TYPE=Bridge"
|
||||
echo "NAME=\"Boot Disk\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
{
|
||||
echo "DEVICE=$ethname"
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=$(cat /sys/class/net/$ethname/address)"
|
||||
echo "BRIDGE=$netif"
|
||||
echo "NAME=$ethname"
|
||||
} >> /tmp/ifcfg/ifcfg-$ethname
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
{
|
||||
# Set ONBOOT=no to prevent initscripts from trying to setup already bridged bond interface
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$bondname"
|
||||
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\""
|
||||
} >> /tmp/ifcfg/ifcfg-$bondname
|
||||
for slave in $bondslaves ; do
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
# 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=no"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=$(cat /sys/class/net/$slave/address)"
|
||||
echo "SLAVE=yes"
|
||||
echo "MASTER=$bondname"
|
||||
echo "NAME=$slave"
|
||||
} >> /tmp/ifcfg/ifcfg-$slave
|
||||
done
|
||||
else
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$ethname"
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=no"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=$(cat /sys/class/net/$ethname/address)"
|
||||
echo "BRIDGE=$netif"
|
||||
echo "NAME=$ethname"
|
||||
} >> /tmp/ifcfg/ifcfg-$ethname
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Pass network opts
|
||||
mkdir /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
|
||||
echo "files /etc/sysconfig/network-scripts" > /dev/.initramfs/rwtab
|
||||
cp -a /tmp/ifcfg/* /dev/.initramfs/state/etc/sysconfig/network-scripts/ >/dev/null 2>&1
|
||||
mkdir -p /run/initramfs
|
||||
cp /tmp/net.* /run/initramfs/ >/dev/null 2>&1
|
||||
mkdir -p /run/initramfs/state/etc/sysconfig/network-scripts/
|
||||
cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/ >/dev/null 2>&1
|
||||
echo "files /etc/sysconfig/network-scripts" > /run/initramfs/rwtab
|
||||
cp -a /tmp/ifcfg/* /run/initramfs/state/etc/sysconfig/network-scripts/ >/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>,...
|
7
modules.d/50gensplash/gensplash-emergency.sh
Executable file
7
modules.d/50gensplash/gensplash-emergency.sh
Executable file
@@ -0,0 +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
|
||||
|
||||
CDROOT=0
|
||||
. /lib/gensplash-lib.sh
|
||||
splash verbose
|
7
modules.d/50gensplash/gensplash-newroot.sh
Executable file
7
modules.d/50gensplash/gensplash-newroot.sh
Executable file
@@ -0,0 +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
|
||||
|
||||
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"
|
||||
|
||||
[ -x /lib/udev/console_init ] && /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
|
||||
dwarn "${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 ]] && echo crypt
|
||||
[[ -x /sbin/plymouthd && -x /bin/plymouth && -x /usr/sbin/plymouth-set-default-theme ]]
|
@@ -1,83 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# do not ask, if we already have root
|
||||
[ -f /sysroot/proc ] && exit 0
|
||||
|
||||
# check if destination already exists
|
||||
[ -b /dev/mapper/$2 ] && exit 0
|
||||
|
||||
# we already asked for this device
|
||||
[ -f /tmp/cryptroot-asked-$2 ] && exit 0
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
# default luksname - luks-UUID
|
||||
luksname=$2
|
||||
|
||||
# if device name is /dev/dm-X, convert to /dev/mapper/name
|
||||
if [ "${1##/dev/dm-}" != "$1" ]; then
|
||||
device="/dev/mapper/$(dmsetup info -c --noheadings -o name "$1")"
|
||||
else
|
||||
device="$1"
|
||||
fi
|
||||
|
||||
if [ -f /etc/crypttab ] && ! getargs rd_NO_CRYPTTAB; then
|
||||
while read name dev rest; do
|
||||
# ignore blank lines and comments
|
||||
if [ -z "$name" -o "${name#\#}" != "$name" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# UUID used in crypttab
|
||||
if [ "${dev%%=*}" = "UUID" ]; then
|
||||
if [ "luks-${dev##UUID=}" = "$2" ]; then
|
||||
luksname="$name"
|
||||
break
|
||||
fi
|
||||
|
||||
# path used in crypttab
|
||||
else
|
||||
cdev=$(readlink -f $dev)
|
||||
mdev=$(readlink -f $device)
|
||||
if [ "$cdev" = "$mdev" ]; then
|
||||
luksname="$name"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done < /etc/crypttab
|
||||
unset name dev rest
|
||||
fi
|
||||
|
||||
LUKS=$(getargs rd_LUKS_UUID=)
|
||||
ask=1
|
||||
if [ -n "$LUKS" ]; then
|
||||
ask=0
|
||||
luuid=${2##luks-}
|
||||
for luks in $LUKS; do
|
||||
luks=${luks##luks-}
|
||||
if [ "${luuid##$luks}" != "$luuid" ] || [ "$luksname" = "$luks" ]; then
|
||||
ask=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
unset LUKS luks luuid
|
||||
|
||||
if [ $ask -gt 0 ]; then
|
||||
info "luksOpen $device $luksname"
|
||||
# flock against other interactive activities
|
||||
{ flock -s 9;
|
||||
/bin/plymouth ask-for-password \
|
||||
--prompt "$device ($luksname) is password protected" \
|
||||
--command="/sbin/cryptsetup luksOpen -T1 $device $luksname"
|
||||
} 9>/.console.lock
|
||||
fi
|
||||
unset ask device luksname
|
||||
|
||||
# mark device as asked
|
||||
>> /tmp/cryptroot-asked-$2
|
||||
|
||||
udevsettle
|
||||
|
||||
exit 0
|
||||
# vim:ts=8:sw=4:sts=4:et
|
@@ -1,16 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if grep -q nash /usr/libexec/plymouth/plymouth-populate-initrd \
|
||||
|| ! grep -q PLYMOUTH_POPULATE_SOURCE_FUNCTIONS /usr/libexec/plymouth/plymouth-populate-initrd \
|
||||
|| [ ! -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
|
||||
. "$moddir"/plymouth-populate-initrd
|
||||
else
|
||||
PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \
|
||||
/usr/libexec/plymouth/plymouth-populate-initrd -t $initdir
|
||||
fi
|
||||
|
||||
inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
|
||||
inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh
|
||||
inst_hook emergency 50 "$moddir"/plymouth-emergency.sh
|
||||
inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
|
||||
inst readlink
|
@@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Include KMS capable drm drivers
|
||||
for modname in $(find "$srcmods/kernel/drivers/gpu/drm" -name '*.ko' 2>/dev/null); do
|
||||
nm -uPA $modname | grep -q drm_crtc_init && instmods $modname
|
||||
done
|
35
modules.d/50plymouth/module-setup.sh
Executable file
35
modules.d/50plymouth/module-setup.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/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/plymouthd && -x /bin/plymouth && -x /usr/sbin/plymouth-set-default-theme ]]
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
# Include KMS capable drm drivers
|
||||
for modname in $(find "$srcmods/kernel/drivers/gpu/drm" "$srcmods/extra" -name '*.ko' 2>/dev/null); do
|
||||
grep -q drm_crtc_init $modname && instmods $modname
|
||||
done
|
||||
}
|
||||
|
||||
install() {
|
||||
if grep -q nash /usr/libexec/plymouth/plymouth-populate-initrd \
|
||||
|| ! grep -q PLYMOUTH_POPULATE_SOURCE_FUNCTIONS /usr/libexec/plymouth/plymouth-populate-initrd \
|
||||
|| [ ! -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
|
||||
. "$moddir"/plymouth-populate-initrd
|
||||
else
|
||||
PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \
|
||||
/usr/libexec/plymouth/plymouth-populate-initrd -t $initdir
|
||||
fi
|
||||
|
||||
inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
|
||||
inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh
|
||||
inst_hook emergency 50 "$moddir"/plymouth-emergency.sh
|
||||
inst readlink
|
||||
}
|
||||
|
3
modules.d/50plymouth/plymouth-emergency.sh
Normal file → Executable file
3
modules.d/50plymouth/plymouth-emergency.sh
Normal file → Executable file
@@ -1 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
[ -x /bin/plymouth ] && /bin/plymouth --hide-splash
|
||||
|
@@ -1,5 +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
|
||||
|
||||
if [ -x /bin/plymouth ]; then
|
||||
/bin/plymouth --newroot=$NEWROOT
|
||||
/bin/plymouth --newroot=$NEWROOT
|
||||
fi
|
||||
|
@@ -1,9 +1,6 @@
|
||||
#!/bin/bash
|
||||
if ldd /sbin/plymouthd |grep -q lib64; then
|
||||
LIBDIR="/usr/lib64"
|
||||
else
|
||||
LIBDIR="/usr/lib"
|
||||
fi
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
PLYMOUTH_LOGO_FILE="/usr/share/pixmaps/system-logo-white.png"
|
||||
PLYMOUTH_THEME=$(plymouth-set-default-theme)
|
||||
|
||||
@@ -15,40 +12,38 @@ dracut_install /bin/plymouth \
|
||||
mkdir -p "${initdir}/usr/share/plymouth"
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
dracut_install "${LIBDIR}/plymouth/text.so" \
|
||||
"${LIBDIR}/plymouth/details.so" \
|
||||
"/usr/share/plymouth/themes/details/details.plymouth" \
|
||||
"/usr/share/plymouth/themes/text/text.plymouth" \
|
||||
dracut_install "${usrlibdir}/plymouth/text.so" \
|
||||
"${usrlibdir}/plymouth/details.so" \
|
||||
"/usr/share/plymouth/themes/details/details.plymouth" \
|
||||
"/usr/share/plymouth/themes/text/text.plymouth" \
|
||||
|
||||
if [[ -d /usr/share/plymouth/themes/${PLYMOUTH_THEME} ]]; then
|
||||
for x in "/usr/share/plymouth/themes/${PLYMOUTH_THEME}"/* ; do
|
||||
for x in "/usr/share/plymouth/themes/${PLYMOUTH_THEME}"/* ; do
|
||||
[[ -f "$x" ]] || break
|
||||
inst $x
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -L /usr/share/plymouth/themes/default.plymouth ]; then
|
||||
inst /usr/share/plymouth/themes/default.plymouth
|
||||
inst /usr/share/plymouth/themes/default.plymouth
|
||||
# Install plugin for this theme
|
||||
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" /usr/share/plymouth/themes/default.plymouth |awk -F= {'print $2'})
|
||||
inst ${LIBDIR}/plymouth/${PLYMOUTH_PLUGIN}.so
|
||||
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" /usr/share/plymouth/themes/default.plymouth | while read a b c; do echo $b; done;)
|
||||
inst "${usrlibdir}/plymouth/${PLYMOUTH_PLUGIN}.so"
|
||||
fi
|
||||
else
|
||||
for x in /usr/share/plymouth/themes/{text,details}/* ; do
|
||||
[[ -f "$x" ]] || continue
|
||||
THEME_DIR=$(dirname "$x")
|
||||
mkdir -p "${initdir}/$THEME_DIR"
|
||||
THEME_DIR=$(dirname "$x")
|
||||
mkdir -p "${initdir}/$THEME_DIR"
|
||||
dracut_install "$x"
|
||||
done
|
||||
for x in ${LIBDIR}/plymouth/{text,details}.so ; do
|
||||
for x in "${usrlibdir}"/plymouth/{text,details}.so ; do
|
||||
[[ -f "$x" ]] || continue
|
||||
[[ "$x" != "${x%%/label.so}" ]] && continue
|
||||
dracut_install "$x"
|
||||
done
|
||||
(
|
||||
cd ${initdir}/usr/share/plymouth/themes;
|
||||
ln -s text/text.plymouth default.plymouth 2>&1;
|
||||
cd ${initdir}/usr/share/plymouth/themes;
|
||||
ln -s text/text.plymouth default.plymouth 2>&1;
|
||||
)
|
||||
fi
|
||||
|
||||
# vim:ts=8:sw=4:sts=4:et
|
||||
|
@@ -1,23 +1,24 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if ! getarg rd_NO_PLYMOUTH; then
|
||||
[ -c /dev/null ] || mknod /dev/null c 1 3
|
||||
if getargbool 1 rd.plymouth -n rd_NO_PLYMOUTH; then
|
||||
[ -c /dev/null ] || mknod -m 0666 /dev/null c 1 3
|
||||
# first trigger graphics subsystem
|
||||
udevadm trigger --attr-match=class=0x030000 >/dev/null 2>&1
|
||||
udevadm trigger --action=add --attr-match=class=0x030000 >/dev/null 2>&1
|
||||
# first trigger graphics and tty subsystem
|
||||
udevadm trigger --subsystem-match=graphics --subsystem-match=drm --subsystem-match=tty >/dev/null 2>&1
|
||||
udevadm trigger --action=add --subsystem-match=graphics --subsystem-match=drm --subsystem-match=tty >/dev/null 2>&1
|
||||
|
||||
udevadm settle --timeout=30 2>&1 | vinfo
|
||||
[ -c /dev/zero ] || mknod /dev/zero c 1 5
|
||||
[ -c /dev/systty ] || mknod /dev/systty c 4 0
|
||||
[ -c /dev/fb ] || mknod /dev/fb c 29 0
|
||||
[ -c /dev/hvc0 ] || mknod /dev/hvc0 c 229 0
|
||||
[ -c /dev/zero ] || mknod -m 0666 /dev/zero c 1 5
|
||||
[ -c /dev/tty0 ] || mknod -m 0620 /dev/tty0 c 4 0
|
||||
[ -e /dev/systty ] || ln -s tty0 /dev/systty
|
||||
[ -c /dev/fb0 ] || mknod -m 0660 /dev/fb0 c 29 0
|
||||
[ -e /dev/fb ] || ln -s fb0 /dev/fb
|
||||
|
||||
info "Starting plymouth daemon"
|
||||
[ -x /bin/plymouthd ] && /bin/plymouthd --attach-to-session
|
||||
/lib/udev/console_init tty0
|
||||
mkdir -m 0755 -p /run/plymouth
|
||||
[ -x /bin/plymouthd ] && /bin/plymouthd --attach-to-session --pid-file /run/plymouth/pid
|
||||
[ -x /lib/udev/console_init ] && /lib/udev/console_init tty0
|
||||
/bin/plymouth --show-splash 2>&1 | vinfo
|
||||
fi
|
||||
|
||||
|
||||
# vim:ts=8:sw=4:sts=4:et
|
||||
|
@@ -1,14 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# No Xen-detect? Boo!!
|
||||
XENDETECT=$(which xen-detect 2>/dev/null)
|
||||
[ -z "$XENDETECT" ] && [ -d "/usr/lib/xen-default" ] && XENDETECT="/usr/lib/xen-default/bin/xen-detect"
|
||||
[ -z "$XENDETECT" ] && exit 1
|
||||
|
||||
. $dracutfunctions
|
||||
[[ $debug ]] && set -x
|
||||
|
||||
# Yes, we are under Xen PV env.
|
||||
$XENDETECT | egrep -q -v 'PV' || exit 0
|
||||
|
||||
exit 1
|
@@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
XENDETECT=$(which xen-detect)
|
||||
[ -z "$XENDETECT" ] && [ -d "/usr/lib/xen-default" ] && XENDETECT="/usr/lib/xen-default/bin/xen-detect"
|
||||
inst $XENDETECT /sbin/xen-detect
|
||||
inst_hook pre-udev 40 "$moddir/xen-pre-udev.sh"
|
||||
|
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
for i in \
|
||||
xenbus_probe_frontend xen-pcifront \
|
||||
xen-fbfront xen-kbdfront xen-blkfront xen-netfront \
|
||||
; do
|
||||
modinfo -k $kernel $i >/dev/null 2>&1 && instmods $i
|
||||
done
|
||||
|
41
modules.d/60xen/module-setup.sh
Executable file
41
modules.d/60xen/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() {
|
||||
# No Xen-detect? Boo!!
|
||||
if ! hash xen-detect 2>/dev/null; then
|
||||
[[ -d /usr/lib/xen-default ]] && \
|
||||
hash -p /usr/lib/xen-default/bin/xen-detect xen-detect || return 1
|
||||
fi
|
||||
|
||||
. $dracutfunctions
|
||||
[[ $debug ]] && set -x
|
||||
|
||||
# Yes, we are under Xen PV env.
|
||||
xen-detect | grep -q -v PV || return 0
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
for i in \
|
||||
xenbus_probe_frontend xen-pcifront \
|
||||
xen-fbfront xen-kbdfront xen-blkfront xen-netfront \
|
||||
; do
|
||||
modinfo -k $kernel $i >/dev/null 2>&1 && instmods $i
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
install() {
|
||||
hash xen-detect 2>/dev/null || \
|
||||
hash -p /usr/lib/xen-default/bin/xen-detect xen-detect
|
||||
inst "$(hash -t xen-detect)" /sbin/xen-detect
|
||||
inst_hook pre-udev 40 "$moddir/xen-pre-udev.sh"
|
||||
}
|
||||
|
15
modules.d/60xen/xen-pre-udev.sh
Normal file → Executable file
15
modules.d/60xen/xen-pre-udev.sh
Normal file → Executable file
@@ -1,10 +1,13 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
xen-detect
|
||||
RC=$?
|
||||
if [ "$RC" = "1" ] ; then
|
||||
modprobe xenbus_probe_frontend
|
||||
modprobe xen-kbdfront
|
||||
modprobe xen-fbfront
|
||||
modprobe xen-blkfront
|
||||
modprobe xen-netfront
|
||||
modprobe xen-pcifront
|
||||
modprobe xenbus_probe_frontend
|
||||
modprobe xen-kbdfront
|
||||
modprobe xen-fbfront
|
||||
modprobe xen-blkfront
|
||||
modprobe xen-netfront
|
||||
modprobe xen-pcifront
|
||||
fi
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user