Compare commits
490 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e97ed33775 | ||
![]() |
04942c4569 | ||
![]() |
296d013f1a | ||
![]() |
64a69cb49f | ||
![]() |
70598ac292 | ||
![]() |
2a12e97475 | ||
![]() |
8a430ab25b | ||
![]() |
2a5a7fb662 | ||
![]() |
f182cb9599 | ||
![]() |
9dc0c244b8 | ||
![]() |
b4fb539c9b | ||
![]() |
18423f7951 | ||
![]() |
6dcc5e1158 | ||
![]() |
e3e1f406bb | ||
![]() |
496e3d962d | ||
![]() |
7cddd7b838 | ||
![]() |
93342718cd | ||
![]() |
4ba44e899c | ||
![]() |
36e8ce4fb0 | ||
![]() |
4089949033 | ||
![]() |
eb8f202ed0 | ||
![]() |
c59779cf93 | ||
![]() |
1dc360790d | ||
![]() |
e0dc6cd4f6 | ||
![]() |
ebc82d38b7 | ||
![]() |
332ecaa900 | ||
![]() |
3e7a05f2a5 | ||
![]() |
733c71ce9e | ||
![]() |
a17d5cf494 | ||
![]() |
bea41b898a | ||
![]() |
e683985d10 | ||
![]() |
4b6b46bb2a | ||
![]() |
fe116c1670 | ||
![]() |
7700b3df4c | ||
![]() |
486030575d | ||
![]() |
ce8f354dbd | ||
![]() |
a262ad91e8 | ||
![]() |
681462eca8 | ||
![]() |
9492008435 | ||
![]() |
22e837b645 | ||
![]() |
0a68a26cff | ||
![]() |
8b257fcc86 | ||
![]() |
c64a94caa9 | ||
![]() |
8d40852e8c | ||
![]() |
cd72830807 | ||
![]() |
206345ce9b | ||
![]() |
4d25892179 | ||
![]() |
6df523517f | ||
![]() |
118ca9ecfc | ||
![]() |
3838dc47c3 | ||
![]() |
5c84d51b3f | ||
![]() |
517d27a75f | ||
![]() |
3ae60e559f | ||
![]() |
7c2311660f | ||
![]() |
bd44831b82 | ||
![]() |
e3eec4b8a2 | ||
![]() |
fe273e3901 | ||
![]() |
3244bf5981 | ||
![]() |
56663e7e32 | ||
![]() |
f34a2ef14d | ||
![]() |
c4d8793c67 | ||
![]() |
54e28d79b9 | ||
![]() |
2e34f38095 | ||
![]() |
9ebf4a5d3c | ||
![]() |
a3a2266046 | ||
![]() |
4aad3438f7 | ||
![]() |
442abd16d2 | ||
![]() |
8f4ee8c71b | ||
![]() |
15eed1e4f1 | ||
![]() |
36894743e3 | ||
![]() |
ae8e6ed5af | ||
![]() |
552c37e156 | ||
![]() |
1f8abe81a9 | ||
![]() |
25b987fed6 | ||
![]() |
414dc51ca2 | ||
![]() |
ca4108b78e | ||
![]() |
c440d302f1 | ||
![]() |
3ae03005b8 | ||
![]() |
99d4fd6bb7 | ||
![]() |
3a04bddeed | ||
![]() |
fa45d0d9c9 | ||
![]() |
3659d64df3 | ||
![]() |
370035d561 | ||
![]() |
2b2033e561 | ||
![]() |
78a78e4239 | ||
![]() |
856f8265aa | ||
![]() |
cf864c1b80 | ||
![]() |
26d14fb3d3 | ||
![]() |
e1e4ee9d7c | ||
![]() |
778b354360 | ||
![]() |
af67d62151 | ||
![]() |
027565d023 | ||
![]() |
66fd7e4329 | ||
![]() |
56d2aed1c8 | ||
![]() |
27dcc3a583 | ||
![]() |
5cac9e14ec | ||
![]() |
d9935e4664 | ||
![]() |
f95b78f3eb | ||
![]() |
84125ddae1 | ||
![]() |
2f0f1b0bbc | ||
![]() |
34a1ec6a36 | ||
![]() |
972d6b44ba | ||
![]() |
3947f07d93 | ||
![]() |
3c90cc2f48 | ||
![]() |
1c08ad507b | ||
![]() |
ab2f95e45e | ||
![]() |
eda73c0ad2 | ||
![]() |
f44b084660 | ||
![]() |
cfd51d2be2 | ||
![]() |
d829e7fce2 | ||
![]() |
246d285561 | ||
![]() |
192990ce85 | ||
![]() |
7a3e1a0e4a | ||
![]() |
3507635bc6 | ||
![]() |
b4692d07ee | ||
![]() |
05065741f0 | ||
![]() |
b09faad877 | ||
![]() |
7e50abfdb8 | ||
![]() |
a49cac2e65 | ||
![]() |
5058ae2d29 | ||
![]() |
2f954621cc | ||
![]() |
d681635512 | ||
![]() |
80043e21c1 | ||
![]() |
37383f7123 | ||
![]() |
7e692cfd43 | ||
![]() |
e3250e2055 | ||
![]() |
29763cb72d | ||
![]() |
d4ce0e5e09 | ||
![]() |
23ad117c49 | ||
![]() |
cea907f6bf | ||
![]() |
5f2baf7dc6 | ||
![]() |
8a203398ef | ||
![]() |
967cc19ab1 | ||
![]() |
6770af96d4 | ||
![]() |
e7ba1392e1 | ||
![]() |
c23d6ce6ea | ||
![]() |
e81836f328 | ||
![]() |
4f03054e54 | ||
![]() |
85752f0f5f | ||
![]() |
7c752ffaef | ||
![]() |
e27ecc9ae8 | ||
![]() |
8e3f653749 | ||
![]() |
e84af01462 | ||
![]() |
338bad6393 | ||
![]() |
504c0a8fec | ||
![]() |
bc140a0b29 | ||
![]() |
ccb8ce0403 | ||
![]() |
95957248a1 | ||
![]() |
99128f2b64 | ||
![]() |
80626ded3e | ||
![]() |
9efb74a32d | ||
![]() |
49fe860b22 | ||
![]() |
b96ea1e196 | ||
![]() |
4a3f3ba68c | ||
![]() |
a628b7caf5 | ||
![]() |
11b5db88c2 | ||
![]() |
e02a29e7a2 | ||
![]() |
ae488efa5e | ||
![]() |
32125a976b | ||
![]() |
068531232b | ||
![]() |
2db6d71118 | ||
![]() |
4e1f8d0c5f | ||
![]() |
28d03673f9 | ||
![]() |
ba7dab6dba | ||
![]() |
caa72f8290 | ||
![]() |
eab9b75c8a | ||
![]() |
ece72160ce | ||
![]() |
54b68829b6 | ||
![]() |
7b46244bb9 | ||
![]() |
ad8638e04e | ||
![]() |
611c895772 | ||
![]() |
4ef45f13f4 | ||
![]() |
f4eb0d9804 | ||
![]() |
5ea0be0a8c | ||
![]() |
4adeefc4ab | ||
![]() |
6cd7001b35 | ||
![]() |
fecc1d69e5 | ||
![]() |
8ca5e8c319 | ||
![]() |
267a109a81 | ||
![]() |
44537b7bf8 | ||
![]() |
e54d961160 | ||
![]() |
f1a38e5294 | ||
![]() |
6525182bfc | ||
![]() |
1ea5879085 | ||
![]() |
f232f6623d | ||
![]() |
30f6c80d7a | ||
![]() |
54483dd773 | ||
![]() |
b0d844fa74 | ||
![]() |
fbc4620f05 | ||
![]() |
7e59d55042 | ||
![]() |
5a57582050 | ||
![]() |
899f5962ac | ||
![]() |
26cd262a6a | ||
![]() |
05d2a14526 | ||
![]() |
773d6a7ded | ||
![]() |
7eb0bc7bc4 | ||
![]() |
f46c2fff71 | ||
![]() |
5580e4c176 | ||
![]() |
8dcc483053 | ||
![]() |
bb8c16d121 | ||
![]() |
486a8f33e2 | ||
![]() |
ba9f3d3326 | ||
![]() |
78c982667a | ||
![]() |
28f3f537c4 | ||
![]() |
83c9ff7dbb | ||
![]() |
827ec27a9c | ||
![]() |
0fa5dbedc5 | ||
![]() |
ce7f408dfd | ||
![]() |
c4b529f503 | ||
![]() |
c96f1b1e6b | ||
![]() |
ed2005fa5b | ||
![]() |
7a94a4326f | ||
![]() |
1427102692 | ||
![]() |
056a3f2427 | ||
![]() |
8fa1afb65c | ||
![]() |
19bb14c346 | ||
![]() |
56d57a70ec | ||
![]() |
1230f3bcff | ||
![]() |
636cc1ef63 | ||
![]() |
535f61ca4a | ||
![]() |
4e58a1ffc7 | ||
![]() |
48b7ab1b35 | ||
![]() |
9cf339ada3 | ||
![]() |
2c19a5fa78 | ||
![]() |
2e094b20a6 | ||
![]() |
fb0e5184a6 | ||
![]() |
100d575ec9 | ||
![]() |
b31250e7e6 | ||
![]() |
ddfea6b54c | ||
![]() |
12819a5799 | ||
![]() |
d4dd3521bb | ||
![]() |
e920bfb1e8 | ||
![]() |
3c530fc528 | ||
![]() |
37502d2733 | ||
![]() |
ebe7411691 | ||
![]() |
fd9f902477 | ||
![]() |
2c7f7a337a | ||
![]() |
3aaf6ccc83 | ||
![]() |
a9f4b9cdb0 | ||
![]() |
0626cbe923 | ||
![]() |
96087189e6 | ||
![]() |
51160a47b1 | ||
![]() |
68dc90c6e9 | ||
![]() |
a9d30a4066 | ||
![]() |
0cb42c27f9 | ||
![]() |
2bdf760fe0 | ||
![]() |
ce4167060c | ||
![]() |
ee4b74fb9c | ||
![]() |
f60b7d8655 | ||
![]() |
99edb47e85 | ||
![]() |
8ee1825364 | ||
![]() |
83a3cba777 | ||
![]() |
cd501ff74b | ||
![]() |
646e0506f6 | ||
![]() |
3a62030116 | ||
![]() |
be1c0381e5 | ||
![]() |
6fe0abbf12 | ||
![]() |
5f6a495bf4 | ||
![]() |
1f680ccc9b | ||
![]() |
43a85a7365 | ||
![]() |
61b4afb424 | ||
![]() |
2ac599dc75 | ||
![]() |
7f70f81153 | ||
![]() |
79b3c8bfa1 | ||
![]() |
fa795f29e2 | ||
![]() |
ab9457efd7 | ||
![]() |
103c5e1ecb | ||
![]() |
4eec1a2276 | ||
![]() |
8a2db478de | ||
![]() |
6e53596cec | ||
![]() |
dc4c1ee39d | ||
![]() |
d1c4e5c521 | ||
![]() |
a324c2111e | ||
![]() |
e8a7c9bc93 | ||
![]() |
cb802bfbc7 | ||
![]() |
a0b2c69441 | ||
![]() |
9835859f21 | ||
![]() |
9b5e2e8574 | ||
![]() |
8da51857f0 | ||
![]() |
460cddffa1 | ||
![]() |
fac3275a43 | ||
![]() |
30e6e809ed | ||
![]() |
8d21728942 | ||
![]() |
352d557d4d | ||
![]() |
751c7de98a | ||
![]() |
81aed4f28e | ||
![]() |
c84618d7ac | ||
![]() |
d61a423f7c | ||
![]() |
f52759131b | ||
![]() |
c860837303 | ||
![]() |
1982098e00 | ||
![]() |
e95e48c6ee | ||
![]() |
f57850d7e8 | ||
![]() |
c8a9a6b4a7 | ||
![]() |
66bfe863f5 | ||
![]() |
d50a99c5ce | ||
![]() |
a7316ae4f7 | ||
![]() |
6b449e8a6d | ||
![]() |
ba9368fa4f | ||
![]() |
1f28dfb2e4 | ||
![]() |
41351164f8 | ||
![]() |
855a549660 | ||
![]() |
5c5350b30b | ||
![]() |
6cc8f694b5 | ||
![]() |
abdf191b64 | ||
![]() |
b5b31c9589 | ||
![]() |
247d6d4270 | ||
![]() |
93f44f28a2 | ||
![]() |
b208aad51c | ||
![]() |
b9909e3341 | ||
![]() |
9ea68421f6 | ||
![]() |
8e5db363e8 | ||
![]() |
cd08059f49 | ||
![]() |
dade93b4eb | ||
![]() |
f49ec88a3f | ||
![]() |
ae01bd1808 | ||
![]() |
659dc319d9 | ||
![]() |
e3469d76c7 | ||
![]() |
149965bd13 | ||
![]() |
a76a22b779 | ||
![]() |
64fb0900cb | ||
![]() |
314929920f | ||
![]() |
c7e15f0891 | ||
![]() |
856d659016 | ||
![]() |
80525318b7 | ||
![]() |
e2ecc2d8c6 | ||
![]() |
b40e38db98 | ||
![]() |
21a3aab720 | ||
![]() |
ee9938572e | ||
![]() |
256c91f837 | ||
![]() |
8229d06b05 | ||
![]() |
a0cab31ab8 | ||
![]() |
d0d61e44be | ||
![]() |
75e4cbb7be | ||
![]() |
45404a2ad8 | ||
![]() |
7e916ae4e0 | ||
![]() |
ef9ddb915b | ||
![]() |
a956a464ef | ||
![]() |
87483405a0 | ||
![]() |
8c828f329b | ||
![]() |
9a3676a88f | ||
![]() |
53cf50e00f | ||
![]() |
53c1e4834f | ||
![]() |
df6e79bfd2 | ||
![]() |
5db9c5c1d9 | ||
![]() |
bb1ba3a1ca | ||
![]() |
3ad42552ca | ||
![]() |
2f461da2a0 | ||
![]() |
3aa35b727f | ||
![]() |
ac5bff2b6f | ||
![]() |
ab6f4a825e | ||
![]() |
859e3a77d0 | ||
![]() |
61a02caca4 | ||
![]() |
08f06c9341 | ||
![]() |
831625d29e | ||
![]() |
89031be373 | ||
![]() |
ab173bb4c1 | ||
![]() |
ded4c82ace | ||
![]() |
f11712ea21 | ||
![]() |
3934ca8e6c | ||
![]() |
ce052202f0 | ||
![]() |
11ee2ca8d4 | ||
![]() |
57575f3c9c | ||
![]() |
45845cb6a5 | ||
![]() |
c21c4dc2b4 | ||
![]() |
336bd09d2c | ||
![]() |
1c89fd148d | ||
![]() |
1d3496b4c1 | ||
![]() |
463e13fe81 | ||
![]() |
2b3e22d602 | ||
![]() |
ee54b8404c | ||
![]() |
d6f0467edf | ||
![]() |
bfa1db78cd | ||
![]() |
dda7ae7dcd | ||
![]() |
61c0665dad | ||
![]() |
8b2b77e460 | ||
![]() |
07cacb2455 | ||
![]() |
690905cea0 | ||
![]() |
443fb52487 | ||
![]() |
b29cb51654 | ||
![]() |
64ae4e07a4 | ||
![]() |
8064f68d60 | ||
![]() |
40da1e5a31 | ||
![]() |
b92896ece4 | ||
![]() |
271cd19dbe | ||
![]() |
7c8da72c11 | ||
![]() |
56ee31ccfe | ||
![]() |
e41f3f9025 | ||
![]() |
e38e73d5a6 | ||
![]() |
928da57447 | ||
![]() |
297b8edc05 | ||
![]() |
28609baf6e | ||
![]() |
a3bfaa1919 | ||
![]() |
7e4f74f504 | ||
![]() |
c2ab990938 | ||
![]() |
1d50dfe602 | ||
![]() |
185e940e27 | ||
![]() |
095fa15591 | ||
![]() |
cf3fd99e72 | ||
![]() |
06d418abd1 | ||
![]() |
fa9384b1c0 | ||
![]() |
0a8e91bb24 | ||
![]() |
4d7c18c7c0 | ||
![]() |
0106da599a | ||
![]() |
5d623b1775 | ||
![]() |
76a4478264 | ||
![]() |
96c6f6f3d1 | ||
![]() |
56903458d7 | ||
![]() |
8795467533 | ||
![]() |
8d89fc6bb1 | ||
![]() |
68b736b50f | ||
![]() |
aabea6f7b9 | ||
![]() |
871c8e40d1 | ||
![]() |
1aedbb7886 | ||
![]() |
cfdec163f9 | ||
![]() |
ab2676d291 | ||
![]() |
3622d6d7b0 | ||
![]() |
b6c8976811 | ||
![]() |
05214a0bed | ||
![]() |
6c8fc6e377 | ||
![]() |
8bcfd683bd | ||
![]() |
a3c0cef9a7 | ||
![]() |
2f6ed29d04 | ||
![]() |
a3044aba53 | ||
![]() |
50f5bbbbaf | ||
![]() |
c4c1c4f456 | ||
![]() |
46cc29261f | ||
![]() |
7f5701eb8d | ||
![]() |
b7d1b6f904 | ||
![]() |
58ef91ff50 | ||
![]() |
fbf338ff98 | ||
![]() |
40db1daf00 | ||
![]() |
cbd1b385a2 | ||
![]() |
6470e0a12b | ||
![]() |
da5ef1737e | ||
![]() |
ecc13ef17e | ||
![]() |
5bcf262d59 | ||
![]() |
d97eb42593 | ||
![]() |
63330a89fc | ||
![]() |
49268028b9 | ||
![]() |
b874d4b5be | ||
![]() |
283d385fbd | ||
![]() |
96cf7270da | ||
![]() |
b19bdcbea7 | ||
![]() |
4e93c3f707 | ||
![]() |
f3b14c2b6a | ||
![]() |
d8b04dc184 | ||
![]() |
b5b608e44a | ||
![]() |
78d5cf7cb4 | ||
![]() |
f4a942783a | ||
![]() |
3b9aaaab42 | ||
![]() |
fc68c87afa | ||
![]() |
63f3bcd852 | ||
![]() |
57f90974f9 | ||
![]() |
d8cc8c0499 | ||
![]() |
36b2e5e2c2 | ||
![]() |
3c4315fa13 | ||
![]() |
d97d130da9 | ||
![]() |
e0aa98a1df | ||
![]() |
84bc192946 | ||
![]() |
e684eab878 | ||
![]() |
debf483d4d | ||
![]() |
d681df8e5f | ||
![]() |
540a5169b9 | ||
![]() |
12beb05a73 | ||
![]() |
e6aafacb23 | ||
![]() |
8d3d72a68c | ||
![]() |
b2fab575dc | ||
![]() |
de74e1ef41 | ||
![]() |
f2cbd4cbd6 | ||
![]() |
5ecc117a25 | ||
![]() |
00ed3ccfd9 | ||
![]() |
6a877a79c4 | ||
![]() |
cb73315dd6 | ||
![]() |
8552a3270c | ||
![]() |
281327f72c | ||
![]() |
da119ab18c | ||
![]() |
87bd8907a6 | ||
![]() |
a242ef13e0 | ||
![]() |
2b9d8f65a6 | ||
![]() |
ffc68f357e | ||
![]() |
ace51ef520 | ||
![]() |
93b02f502e | ||
![]() |
49c062821a | ||
![]() |
c504d8b435 | ||
![]() |
39fe00ef60 | ||
![]() |
bae44febb5 | ||
![]() |
5c274467d6 | ||
![]() |
c82a11334d | ||
![]() |
f34e1d6b0e |
2
.dir-locals.el
Normal file
2
.dir-locals.el
Normal file
@@ -0,0 +1,2 @@
|
||||
(setq sh-basic-offset: 4)
|
||||
(setq indent-tabs-mode nil)
|
1
.kateconfig
Normal file
1
.kateconfig
Normal file
@@ -0,0 +1 @@
|
||||
kate: space-indent on; tab-width 4; indent-width 4; replace-tabs on; eol unix;
|
9
.kateproject
Normal file
9
.kateproject
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "Kate"
|
||||
, "files": [ { "git": 1 } ]
|
||||
, "build": {
|
||||
"directory": "build"
|
||||
, "build": "make -j $(getconf _NPROCESSORS_ONLN) all"
|
||||
, "clean": "make clean"
|
||||
}
|
||||
}
|
5
.mailmap
5
.mailmap
@@ -10,6 +10,9 @@ Andrey Borzenkov <arvidjaar@gmail.com> <arvidjaar@mail.ru>
|
||||
Dan Horák <dhorak@redhat.com> <dan@danny.cz>
|
||||
John Reiser <jreiser@bitwagon.com> <jreiser@BitWagon.com>
|
||||
Luca Berra <bluca@vodka.it> <bluca@comedia.it>
|
||||
Dave Young <dyoung@redhat.com> dyoung@redhat.com
|
||||
Dave Young <dyoung@redhat.com> <dyoung@redhat.com>
|
||||
Dave Young <dyoung@redhat.com> <dave@redhat.com>
|
||||
Frederick Grose <fgrose@sugarlabs.org> <fgrose@gmail.com>
|
||||
Frederic Crozat <fcrozat@suse.com> <fcrozat@mandriva.com>
|
||||
Shawn W Dunn <sfalken@opensuse.org> <sfalken@opensuse.org>
|
||||
Kyle McMartin <kmcmarti@redhat.com> <kyle@redhat.com>
|
||||
|
@@ -1,32 +1,44 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if [[ -f /etc/kernel/cmdline ]]; then
|
||||
readarray -t BOOT_OPTIONS < /etc/kernel/cmdline
|
||||
fi
|
||||
|
||||
if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
|
||||
readarray -t BOOT_OPTIONS < /proc/cmdline
|
||||
fi
|
||||
|
||||
unset noimageifnotneeded
|
||||
|
||||
for ((i=0; i < "${#BOOT_OPTIONS[@]}"; i++)); do
|
||||
if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then
|
||||
noimageifnotneeded="yes"
|
||||
break
|
||||
fi
|
||||
done
|
||||
COMMAND="$1"
|
||||
KERNEL_VERSION="$2"
|
||||
BOOT_DIR_ABS="$3"
|
||||
KERNEL_IMAGE="$4"
|
||||
|
||||
ret=0
|
||||
case "$1" in
|
||||
case "$COMMAND" in
|
||||
add)
|
||||
dracut ${noimageifnotneeded+--noimageifnotneeded} "$3"/initrd "$2"
|
||||
INITRD_IMAGE_PREGENERATED=${KERNEL_IMAGE%/*}/initrd
|
||||
if [[ -f ${INITRD_IMAGE_PREGENERATED} ]]; then
|
||||
# we found an initrd at the same place as the kernel
|
||||
# use this and don't generate a new one
|
||||
cp "$INITRD_IMAGE_PREGENERATED" "$BOOT_DIR_ABS/initrd" \
|
||||
&& chown root:root "$BOOT_DIR_ABS/initrd" \
|
||||
&& chmod 0600 "$BOOT_DIR_ABS/initrd" \
|
||||
&& exit 0
|
||||
fi
|
||||
|
||||
if [[ -f /etc/kernel/cmdline ]]; then
|
||||
readarray -t BOOT_OPTIONS < /etc/kernel/cmdline
|
||||
fi
|
||||
|
||||
if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
|
||||
read -ar BOOT_OPTIONS < /proc/cmdline
|
||||
fi
|
||||
|
||||
unset noimageifnotneeded
|
||||
|
||||
for ((i=0; i < "${#BOOT_OPTIONS[@]}"; i++)); do
|
||||
if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then
|
||||
noimageifnotneeded="yes"
|
||||
break
|
||||
fi
|
||||
done
|
||||
dracut ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS"/initrd "$KERNEL_VERSION"
|
||||
ret=$?
|
||||
;;
|
||||
remove)
|
||||
rm -f -- "$3"/initrd
|
||||
rm -f -- "$BOOT_DIR_ABS"/initrd
|
||||
ret=$?
|
||||
;;
|
||||
esac
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
export LANG=C
|
||||
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
export LANG=C
|
||||
|
||||
@@ -45,7 +43,7 @@ if [[ -f /etc/kernel/cmdline ]]; then
|
||||
readarray -t BOOT_OPTIONS < /etc/kernel/cmdline
|
||||
fi
|
||||
if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
|
||||
readarray -t BOOT_OPTIONS < /proc/cmdline
|
||||
read -ar BOOT_OPTIONS < /proc/cmdline
|
||||
fi
|
||||
if ! [[ $BOOT_OPTIONS ]]; then
|
||||
exit 1
|
||||
@@ -75,7 +73,7 @@ case "$COMMAND" in
|
||||
echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/linux'!" >&2
|
||||
fi
|
||||
|
||||
dracut --no-hostonly -a "rescue" "$BOOT_DIR_ABS"/initrd "$2"
|
||||
dracut --no-hostonly -a "rescue" "$BOOT_DIR_ABS"/initrd "$KERNEL_VERSION"
|
||||
((ret+=$?))
|
||||
|
||||
{
|
||||
|
54
AUTHORS
54
AUTHORS
@@ -7,32 +7,40 @@ Warren Togami <wtogami@redhat.com>
|
||||
Jeremy Katz <katzj@redhat.com>
|
||||
Dave Young <dyoung@redhat.com>
|
||||
David Dillow <dave@thedillows.org>
|
||||
Hannes Reinecke <hare@suse.de>
|
||||
Michal Soltys <soltys@ziu.info>
|
||||
Amerigo Wang <amwang@redhat.com>
|
||||
Colin Guthrie <colin@mageia.org>
|
||||
Thomas Renninger <trenn@suse.de>
|
||||
WANG Chao <chaowang@redhat.com>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Peter Jones <pjones@redhat.com>
|
||||
Andreas Thienemann <andreas@bawue.net>
|
||||
Hans de Goede <hdegoede@redhat.com>
|
||||
Alexander Tsoy <alexander@tsoy.me>
|
||||
John Reiser <jreiser@bitwagon.com>
|
||||
Luca Berra <bluca@vodka.it>
|
||||
WANG Chao <chaowang@redhat.com>
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
Daniel Drake <dsd@laptop.org>
|
||||
Dan Horák <dhorak@redhat.com>
|
||||
Baoquan He <bhe@redhat.com>
|
||||
Leho Kraav <leho@kraav.com>
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
Kamil Rytarowski <n54@gmx.com>
|
||||
Marc Grimme <grimme@atix.de>
|
||||
Peter Rajnoha <prajnoha@redhat.com>
|
||||
Radek Vykydal <rvykydal@redhat.com>
|
||||
Thorsten Behrens <tbehrens@suse.com>
|
||||
Chao Wang <chaowang@redhat.com>
|
||||
Colin Walters <walters@verbum.org>
|
||||
Frederic Crozat <fcrozat@suse.com>
|
||||
Jesse Keating <jkeating@redhat.com>
|
||||
Milan Broz <mbroz@redhat.com>
|
||||
Radek Vykydal <rvykydal@redhat.com>
|
||||
Nicolas Chauvet <kwizart@gmail.com>
|
||||
Roberto Sassu <roberto.sassu@polito.it>
|
||||
Anton Blanchard <anton@samba.org>
|
||||
Bill Nottingham <notting@redhat.com>
|
||||
Colin Walters <walters@verbum.org>
|
||||
Chapman Flack <g2@anastigmatix.net>
|
||||
Cristian Rodríguez <crrodriguez@opensuse.org>
|
||||
David Cantrell <dcantrell@redhat.com>
|
||||
Dennis Gilmore <dennis@ausil.us>
|
||||
Jon Ander Hernandez <jonan.h@gmail.com>
|
||||
@@ -40,66 +48,88 @@ Juan RP <xtraeme@gmail.com>
|
||||
Lance Albertson <lance@osuosl.org>
|
||||
Marian Ganisin <mganisin@redhat.com>
|
||||
Michael Ploujnikov <plouj@somanetworks.com>
|
||||
Peter Rajnoha <prajnoha@redhat.com>
|
||||
Peter Robinson <pbrobinson@gmail.com>
|
||||
Stefan Reimer <it@startux.de>
|
||||
Stig Telfer <stelfer@cray.com>
|
||||
Vasiliy Tolstov <v.tolstov@selfip.ru>
|
||||
Wim Muskee <wimmuskee@gmail.com>
|
||||
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
||||
Alan Pevec <apevec@redhat.com>
|
||||
Alex Harpin <development@landsofshadow.co.uk>
|
||||
Daniel Schaal <farbing@web.de>
|
||||
Frederick Grose <fgrose@sugarlabs.org>
|
||||
Hari Bathini <hbathini@linux.vnet.ibm.com>
|
||||
Ian Dall <ian@beware.dropbear.id.au>
|
||||
James Buren <ryuo@frugalware.org>
|
||||
James Lee <jlee@thestaticvoid.com>
|
||||
Joey Boggs <jboggs@redhat.com>
|
||||
Koen Kooi <koen@dominion.thruhere.net>
|
||||
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Kyle McMartin <kmcmarti@redhat.com>
|
||||
Lubomir Rintel <lkundrak@v3.sk>
|
||||
Mike Snitzer <snitzer@redhat.com>
|
||||
Minfei Huang <mhuang@redhat.com>
|
||||
Przemysław Rudy <prudy1@o2.pl>
|
||||
Stefan Reimer <it@startux.de>
|
||||
Thomas Backlund <tmb@mageia.org>
|
||||
Thomas Lange <lange@informatik.uni-koeln.de>
|
||||
Till Maas <opensource@till.name>
|
||||
Vivek Goyal <vgoyal@redhat.com>
|
||||
Vladislav Bogdanov <bubble@hoster-ok.com>
|
||||
Adam Williamson <awilliam@redhat.com>
|
||||
Alexander Todorov <atodorov@redhat.com>
|
||||
Andy Lutomirski <luto@mit.edu>
|
||||
Anssi Hannula <anssi@mageia.org>
|
||||
Antony Messerli <amesserl@rackspace.com>
|
||||
Brandon Philips <brandon@ifup.co>
|
||||
Canek Peláez Valdés <caneko@gmail.com>
|
||||
Chris Leech <cleech@redhat.com>
|
||||
Christian Heinz <christian.ch.heinz@gmail.com>
|
||||
Cong Wang <amwang@redhat.com>
|
||||
Daniel Schaal <farbing@web.de>
|
||||
Daniel Drake <drake@endlessm.com>
|
||||
Dave Jones <davej@redhat.com>
|
||||
Dave Young <dave@redhat.com>
|
||||
Dennis Schridde <devurandom@gmx.net>
|
||||
Duane Griffin <duaneg@dghda.com>
|
||||
Erwan Velu <erwan.velu@enovance.com>
|
||||
Glen Gray <slaine@slaine.org>
|
||||
Hermann Gausterer <git-dracut-2012@mrq1.org>
|
||||
James Laska <jlaska@redhat.com>
|
||||
Jan Stodola <jstodola@redhat.com>
|
||||
Jiri Pirko <jiri@resnulli.us>
|
||||
Joe Lawrence <Joe.Lawrence@stratus.com>
|
||||
Julian Wolf <juwolf@suse.com>
|
||||
Kevin Yung <Kevin.Yung@myob.com>
|
||||
Kyle McMartin <kyle@redhat.com>
|
||||
Lars R. Damerow <lars@pixar.com>
|
||||
Lennert Buytenhek <buytenh@wantstofly.org>
|
||||
Lubomir Rintel <lkundrak@v3.sk>
|
||||
Lukas Wunner <lukas@wunner.de>
|
||||
Major Hayden <major@mhtx.net>
|
||||
Marian Csontos <mcsontos@redhat.com>
|
||||
Marko Myllynen <myllynen@redhat.com>
|
||||
Matt <smoothsailing72@hotmail.com>
|
||||
Matt Smith <shadowfax@gmx.com>
|
||||
Michal Schmidt <mschmidt@redhat.com>
|
||||
Mike Gorse <mgorse@suse.com>
|
||||
Munehiro Matsuda <haro@kgt.co.jp>
|
||||
Nicolas Chauvet <kwizart@gmail.com>
|
||||
NeilBrown <neilb@suse.de>
|
||||
Nikoli <nikoli@lavabit.com>
|
||||
Olivier Blin <dev@blino.org>
|
||||
P J P <ppandit@redhat.com>
|
||||
Paolo Bonzini <pbonzini@redhat.com>
|
||||
Peter Robinson <pbrobinson@fedoraproject.org>
|
||||
Praveen_Paladugu@Dell.com <Praveen_Paladugu@Dell.com>
|
||||
Pádraig Brady <P@draigBrady.com>
|
||||
Quentin Armitage <quentin@armitage.org.uk>
|
||||
Robert Buchholz <rbu@goodpoint.de>
|
||||
Sergey Fionov <fionov@gmail.com>
|
||||
Shawn W Dunn <sfalken@opensuse.org>
|
||||
Srinivasa T N <seenutn@linux.vnet.ibm.com>
|
||||
Thilo Bangert <thilo.bangert@gmx.net>
|
||||
Thomas Backlund <tmb@mageia.org>
|
||||
Tobias Geerinckx <tobias.geerinckx@gmail.com>
|
||||
Tom Gundersen <teg@jklm.no>
|
||||
Tomasz Torcz <tomek@pipebreaker.pl>
|
||||
Vadim Kuznetsov <vadimk@gentoo.org>
|
||||
Vaughan Cao <vaughan.cao@oracle.com>
|
||||
Ville Skyttä <ville.skytta@iki.fi>
|
||||
Vratislav Podzimek <vpodzime@redhat.com>
|
||||
Yanko Kaneti <yaneti@declera.com>
|
||||
jloeser <jloeser@suse.de>
|
||||
maximilian attems <max@stro.at>
|
||||
|
68
Makefile
68
Makefile
@@ -13,7 +13,7 @@ sysconfdir ?= ${prefix}/etc
|
||||
bindir ?= ${prefix}/bin
|
||||
mandir ?= ${prefix}/share/man
|
||||
CFLAGS ?= -O2 -g -Wall
|
||||
CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64
|
||||
CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
|
||||
bashcompletiondir ?= ${datadir}/bash-completion/completions
|
||||
|
||||
man1pages = lsinitrd.1
|
||||
@@ -21,11 +21,13 @@ man1pages = lsinitrd.1
|
||||
man5pages = dracut.conf.5
|
||||
|
||||
man7pages = dracut.cmdline.7 \
|
||||
dracut.bootup.7
|
||||
dracut.bootup.7 \
|
||||
dracut.modules.7
|
||||
|
||||
man8pages = dracut.8 \
|
||||
dracut-catimages.8 \
|
||||
mkinitrd.8 \
|
||||
mkinitrd-suse.8 \
|
||||
modules.d/98systemd/dracut-cmdline.service.8 \
|
||||
modules.d/98systemd/dracut-initqueue.service.8 \
|
||||
modules.d/98systemd/dracut-mount.service.8 \
|
||||
@@ -37,15 +39,15 @@ man8pages = dracut.8 \
|
||||
|
||||
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
|
||||
|
||||
|
||||
.PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh
|
||||
|
||||
all: dracut-version.sh dracut-install
|
||||
all: dracut-version.sh dracut-install skipcpio/skipcpio
|
||||
|
||||
DRACUT_INSTALL_OBJECTS = \
|
||||
install/dracut-install.o \
|
||||
install/hashmap.o\
|
||||
install/log.o \
|
||||
install/strv.o \
|
||||
install/util.o
|
||||
|
||||
# deps generated with gcc -MM
|
||||
@@ -55,14 +57,22 @@ install/hashmap.o: install/hashmap.c install/util.h install/macro.h install/log.
|
||||
install/hashmap.h
|
||||
install/log.o: install/log.c install/log.h install/macro.h install/util.h
|
||||
install/util.o: install/util.c install/util.h install/macro.h install/log.h
|
||||
install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h install/log.h
|
||||
|
||||
install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
|
||||
|
||||
dracut-install: install/dracut-install
|
||||
ln -fs $< $@
|
||||
|
||||
SKIPCPIO_OBJECTS= \
|
||||
skipcpio/skipcpio.o
|
||||
|
||||
skipcpio/skipcpio.o: skipcpio/skipcpio.c
|
||||
skipcpio/skipcpio: skipcpio/skipcpio.o
|
||||
|
||||
indent:
|
||||
indent -i8 -nut -br -linux -l120 install/dracut-install.c
|
||||
indent -i8 -nut -br -linux -l120 skipcpio/skipcpio.c
|
||||
|
||||
doc: $(manpages) dracut.html
|
||||
|
||||
@@ -76,11 +86,13 @@ endif
|
||||
%.xml: %.asc
|
||||
asciidoc -d manpage -b docbook -o $@ $<
|
||||
|
||||
dracut.html: dracut.asc $(manpages)
|
||||
dracut.8: dracut.usage.asc dracut.8.asc
|
||||
|
||||
dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc
|
||||
asciidoc -a numbered -d book -b docbook -o dracut.xml dracut.asc
|
||||
xsltproc -o dracut.html --xinclude -nonet \
|
||||
--stringparam html.stylesheet \
|
||||
http://docs.fedoraproject.org/en-US/Common_Content/css/default.css \
|
||||
--stringparam custom.css.source dracut.css \
|
||||
--stringparam generate.css.header 1 \
|
||||
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
|
||||
rm -f -- dracut.xml
|
||||
|
||||
@@ -113,9 +125,9 @@ endif
|
||||
if [ -n "$(systemdsystemunitdir)" ]; then \
|
||||
mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
|
||||
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98systemd/dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir)/dracut-shutdown.service; \
|
||||
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants; \
|
||||
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants; \
|
||||
ln -s ../dracut-shutdown.service \
|
||||
$(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants/dracut-shutdown.service; \
|
||||
$(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants/dracut-shutdown.service; \
|
||||
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants; \
|
||||
for i in \
|
||||
dracut-cmdline.service \
|
||||
@@ -134,6 +146,9 @@ endif
|
||||
if [ -f install/dracut-install ]; then \
|
||||
install -m 0755 install/dracut-install $(DESTDIR)$(pkglibdir)/dracut-install; \
|
||||
fi
|
||||
if [ -f skipcpio/skipcpio ]; then \
|
||||
install -m 0755 skipcpio/skipcpio $(DESTDIR)$(pkglibdir)/skipcpio; \
|
||||
fi
|
||||
mkdir -p $(DESTDIR)${prefix}/lib/kernel/install.d
|
||||
install -m 0755 50-dracut.install $(DESTDIR)${prefix}/lib/kernel/install.d/50-dracut.install
|
||||
install -m 0755 51-dracut-rescue.install $(DESTDIR)${prefix}/lib/kernel/install.d/51-dracut-rescue.install
|
||||
@@ -150,29 +165,32 @@ clean:
|
||||
$(RM) */*/*~
|
||||
$(RM) $(manpages:%=%.xml) dracut.xml
|
||||
$(RM) test-*.img
|
||||
$(RM) dracut-*.rpm dracut-*.tar.bz2
|
||||
$(RM) dracut-*.rpm dracut-*.tar.bz2 dracut-*.tar.xz
|
||||
$(RM) dracut-version.sh
|
||||
$(RM) dracut-install install/dracut-install $(DRACUT_INSTALL_OBJECTS)
|
||||
$(RM) skipcpio/skipcpio $(SKIPCPIO_OBJECTS)
|
||||
$(RM) $(manpages) dracut.html
|
||||
$(MAKE) -C test clean
|
||||
|
||||
dist: dracut-$(VERSION).tar.bz2
|
||||
dist: dracut-$(VERSION).tar.xz
|
||||
|
||||
dracut-$(VERSION).tar.bz2: doc syncheck
|
||||
dracut-$(VERSION).tar.xz: doc syncheck
|
||||
@echo "DRACUT_VERSION=$(VERSION)" > dracut-version.sh
|
||||
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ > dracut-$(VERSION).tar
|
||||
mkdir -p dracut-$(VERSION)
|
||||
for i in $(manpages) dracut.html dracut-version.sh; do [ "$${i%/*}" != "$$i" ] && mkdir -p "dracut-$(VERSION)/$${i%/*}"; cp "$$i" "dracut-$(VERSION)/$$i"; done
|
||||
tar --owner=root --group=root -rf dracut-$(VERSION).tar $$(find dracut-$(VERSION) -type f)
|
||||
rm -fr -- dracut-$(VERSION).tar.bz2 dracut-$(VERSION)
|
||||
bzip2 -9 dracut-$(VERSION).tar
|
||||
rm -fr -- dracut-$(VERSION).tar.xz dracut-$(VERSION)
|
||||
xz -9 dracut-$(VERSION).tar
|
||||
rm -f -- dracut-$(VERSION).tar
|
||||
|
||||
rpm: dracut-$(VERSION).tar.bz2 syncheck
|
||||
rpm: dracut-$(VERSION).tar.xz syncheck
|
||||
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
|
||||
cp dracut-$(VERSION).tar.bz2 "$$rpmbuild"; \
|
||||
cp dracut-$(VERSION).tar.xz "$$rpmbuild"; \
|
||||
LC_MESSAGES=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
|
||||
(cd "$$rpmbuild"; rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
|
||||
(cd "$$rpmbuild"; \
|
||||
wget https://www.gnu.org/licenses/lgpl-2.1.txt; \
|
||||
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
|
||||
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
|
||||
--define "_rpmdir $$PWD" -ba dracut.spec; ) && \
|
||||
( mv "$$rpmbuild"/$$(arch)/*.rpm .; mv "$$rpmbuild"/*.src.rpm .;rm -fr -- "$$rpmbuild"; ls *.rpm )
|
||||
@@ -197,22 +215,30 @@ testimage: all
|
||||
./dracut.sh -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
|
||||
@echo wrote test-$(shell uname -r).img
|
||||
|
||||
debugtestimage: all
|
||||
./dracut.sh --debug -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
|
||||
@echo wrote test-$(shell uname -r).img
|
||||
|
||||
testimages: all
|
||||
./dracut.sh -l -a debug --kernel-only -f test-kernel-$(shell uname -r).img $(shell uname -r)
|
||||
@echo wrote test-$(shell uname -r).img
|
||||
./dracut.sh -l -a debug --no-kernel -f test-dracut.img $(shell uname -r)
|
||||
@echo wrote test-dracut.img
|
||||
|
||||
debughostimage: all
|
||||
./dracut.sh --debug -H -l -f test-$(shell uname -r).img $(shell uname -r)
|
||||
@echo wrote test-$(shell uname -r).img
|
||||
|
||||
hostimage: all
|
||||
./dracut.sh -H -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
|
||||
./dracut.sh -H -l -f test-$(shell uname -r).img $(shell uname -r)
|
||||
@echo wrote test-$(shell uname -r).img
|
||||
|
||||
AUTHORS:
|
||||
git shortlog --numbered --summary -e |while read a rest; do echo $$rest;done > AUTHORS
|
||||
|
||||
dracut.html.sign: dracut-$(VERSION).tar.bz2
|
||||
gpg-sign-all dracut-$(VERSION).tar.bz2 dracut.html
|
||||
dracut.html.sign: dracut-$(VERSION).tar.xz dracut.html
|
||||
gpg-sign-all dracut-$(VERSION).tar.xz dracut.html
|
||||
|
||||
upload: dracut.html.sign
|
||||
kup put dracut-$(VERSION).tar.bz2 dracut-$(VERSION).tar.sign /pub/linux/utils/boot/dracut/
|
||||
kup put dracut-$(VERSION).tar.xz dracut-$(VERSION).tar.sign /pub/linux/utils/boot/dracut/
|
||||
kup put dracut.html dracut.html.sign /pub/linux/utils/boot/dracut/
|
||||
|
202
NEWS
202
NEWS
@@ -1,3 +1,205 @@
|
||||
dracut-041
|
||||
==========
|
||||
- fixed the shutdown loop
|
||||
- fixed gzip compression for versions, which do not have --rsyncable
|
||||
- fixed ifcfg generation for persistent interface names
|
||||
- multipath:
|
||||
* new option to turn off multipath "rd.multipath=0" completly
|
||||
* preload scsi dh modules
|
||||
* start multipathd via systemd service
|
||||
- do not fail, if user pressed ESC during media check
|
||||
- fixed systemd-journal by symlinking /var/log to /run/initramfs/log
|
||||
- initrd-release moved to /usr/lib
|
||||
- lots of iSCSI fixes
|
||||
- new "rd.timeout" to specify the systemd JobTimeoutSec for devices
|
||||
- if $initrd/etc/cmdline.d/* has a "root=" and the kernel cmdline does not,
|
||||
generate a mount unit for it
|
||||
- increased the initqueue timeout for non systemd initramfs to 180s
|
||||
- $initrd/etc/cmdline.d/ hostonly files are now generated for NFS
|
||||
- make use of systemd-hibernate-resume, if available
|
||||
- fixed ldconfig parsing for hwcap output
|
||||
- network: add support for comma separated autoconf options like ip=eth0:auto6,dhcp
|
||||
- new parameter "rd.live.overlay.size" to specify the overlay for live images
|
||||
- changed the test suite for the new sfdisk syntax
|
||||
- added cache tools for dm-cache setups
|
||||
|
||||
dracut-040
|
||||
==========
|
||||
- fixed dracut module dependency checks
|
||||
- fixed test suite
|
||||
|
||||
dracut-039
|
||||
==========
|
||||
- DRACUT_PATH can now be used to specify the PATH used by dracut
|
||||
to search for binaries instead of the default
|
||||
/usr/sbin:/sbin:/usr/bin:/bin
|
||||
This should be set in the distribution config file
|
||||
/usr/lib/dracut/dracut.conf.d/01-dist.conf
|
||||
- add "--loginstall <DIR>" and loginstall="<DIR>" options
|
||||
to record all files, which are installed from the host fs
|
||||
- "rd.writable.fsimg" - support for read/write filesystem images
|
||||
- "rd.route" kernel command line parameter added
|
||||
- "--install-optional" and install_optional_items added
|
||||
- find plymouth pkglibdir on debian
|
||||
- torrent support for live images
|
||||
root=live:torrent://example.com/liveboot.img.torrent
|
||||
and generally added as a download handler
|
||||
- disable microcode, if the kernel does not support it
|
||||
- speed up ldconfig_paths()
|
||||
- more ARM modules
|
||||
- fixed inst*() functions and "-H" handling
|
||||
- fixed bridge setup
|
||||
- added --force-drivers parameter and force_drivers=+ config option
|
||||
to enforce driver loading at early boot time
|
||||
- documented "iso-scan/filename" usage in grub
|
||||
- various bugfixes
|
||||
|
||||
dracut-038
|
||||
==========
|
||||
- "rd.cmdline=ask" will ask the user on the console to enter additional
|
||||
kernel command line parameters
|
||||
- "rd.hostonly=0" removes all "hostonly" added custom files,
|
||||
which is useful in combination with "rd.auto" or other specific parameters,
|
||||
if you want to boot on the same hardware, but the compiled in configuration
|
||||
does not match your setup anymore
|
||||
- inst* functions and dracut-install now accept the "-H" flag, which logs all
|
||||
installed files to /lib/dracut/hostonly-files. This is used to remove those
|
||||
files, if rd.hostonly is given on the kernel command line
|
||||
- strstr now only does literal string match,
|
||||
please use strglob and strglobin for globs
|
||||
- fixed unpacking of the microcode image on shutdown
|
||||
- added systemd-gpt-auto-generator
|
||||
- fcoe: wait for lldpad to be ready
|
||||
- network: handle "ip=dhcp6"
|
||||
- network: DCHPv6: set valid_lft and preferred_lft
|
||||
- dm: support dm-cache
|
||||
- fstab: do not mount and fsck from fstab if using systemd
|
||||
- break at switch_root only for bare rd.break and not for any rd.break=...
|
||||
- nbd: make use of "--systemd-mark", otherwise it gets killed on switch_root
|
||||
- fcoe-uefi: fixed cmdline parameter generation
|
||||
- iscsi: deprecate "ip=ibft", use "rd.iscsi.ibft[=1]" from now on
|
||||
- "lsinitrd -m" now only lists the dracut modules of the image
|
||||
- a lot of small bugfixes
|
||||
|
||||
dracut-037
|
||||
==========
|
||||
- dracut: hostonly_cmdline variable and command line switch
|
||||
Toggle hostonly cmdline storing in the initramfs
|
||||
--hostonly-cmdline:
|
||||
Store kernel command line arguments needed in the initramfs
|
||||
--no-hostonly-cmdline:
|
||||
Do not store kernel command line arguments needed in the initramfs
|
||||
- dracut: --mount now understands full fstab lines
|
||||
- dracut now also includes drivers from the /lib/modules/<version>/updates directory
|
||||
- dracut: only set the owner of files to 0:0, if generated as non-root
|
||||
- dracut now directly writes to the initramfs file
|
||||
- dracut: call lz4 with the legacy flag (linux kernel does not support the new format)
|
||||
- systemd: rootfs-generator generates JobTimeout=0 units for the root device
|
||||
- systemd: added the systemd-sysctl service
|
||||
- systemd: add 80-net-setup-link.rules and .link files for persistent interface renaming
|
||||
- systemd: make dracut-shutdown.service failure non-fatal
|
||||
- network: various IPv6 fixes
|
||||
- network: DCHCP for IPv6
|
||||
- network: understand ip=.....:<dns1>:<dns2>
|
||||
- network: parse ibft nameserver settings
|
||||
- shutdown: if kexec fails, just reboot
|
||||
- lvm: handle one LV at a time with lvchange
|
||||
- module-setup.sh:
|
||||
New functions require_binaries() and require_any_binary() to be used
|
||||
in the check() section of module-setup.sh.
|
||||
- a lot of small bugfixes
|
||||
|
||||
Contributions from:
|
||||
Harald Hoyer
|
||||
Alexander Tsoy
|
||||
Till Maas
|
||||
Amadeusz Żołnowski
|
||||
Brian C. Lane
|
||||
Colin Guthrie
|
||||
Dave Young
|
||||
WANG Chao
|
||||
Shawn W Dunn
|
||||
|
||||
dracut-036
|
||||
==========
|
||||
- fixed skipcpio signature checking
|
||||
|
||||
dracut-035
|
||||
==========
|
||||
- changed dracut tarball compression to xz
|
||||
- new argument "--rebuild"
|
||||
- add lzo, lz4 compression
|
||||
- install: install all binaries with <name> found in PATH
|
||||
- lsinitrd can now handle initramfs images with an early cpio prepended
|
||||
(microcode, ACPI tables)
|
||||
- mkinitrd-suse added as a compat stub for dracut
|
||||
- lvm: install thin utils for non-hostonly
|
||||
- resume: fix swap detection in hostonly
|
||||
- avoid loading unnecessary 32-bit libraries for 64-bit initrds
|
||||
- crypt: wait for systemd password agents
|
||||
- crypt: skip crypt swaps with password files
|
||||
- network: before doing dhcp, dracut now checks, if the link has a carrier
|
||||
- network: dhclient-script.sh now sets the lease time
|
||||
- network: include usbnet drivers
|
||||
- network: include all ethernet drivers
|
||||
- network: add rd.bootif=0 to ignore BOOTIF
|
||||
- i18n: introduce i18n_install_all, to install everything i18n related
|
||||
- support SuSE DASD configurations
|
||||
- support SuSE zfcp configurations
|
||||
- support SuSE compressed KEYMAP= setting
|
||||
- usrmount: always install the module,
|
||||
so always mount /usr from within the initramfs
|
||||
- test/TEST-17-LVM-THIN: new test case for lvm thin pools
|
||||
- "halt" the machine in systemd mode for die()
|
||||
|
||||
dracut-034
|
||||
==========
|
||||
- do not run dhcp on parts of assembled network interfaces (bond, bridge)
|
||||
- add option to turn on/off prelinking
|
||||
--prelink, --noprelink
|
||||
do_prelink=[yes|no]
|
||||
- add ACPI table overriding
|
||||
- do not log to syslog/kmsg/journal for UID != 0
|
||||
- lvm/mdraid: Fix LVM on MD activation
|
||||
- bcache module removed (now in bcache-tools upstream)
|
||||
- mdadm: also install configs from /etc/mdadm.conf.d
|
||||
- fixes for mdadm-3.2.6+
|
||||
- mkinitrd: better compat support for SUSE
|
||||
- fcoe: add FCoE UEFI boot device support
|
||||
- rootfs-block: add support for the rootfallback= kernel cmdline option
|
||||
|
||||
Contributions from:
|
||||
Thomas Renninger
|
||||
Alexander Tsoy
|
||||
Peter Rajnoha
|
||||
WANG Chao
|
||||
Harald Hoyer
|
||||
|
||||
|
||||
dracut-033
|
||||
==========
|
||||
- improved hostonly device recognition
|
||||
- improved hostonly module recognition
|
||||
- add dracut.css for dracut.html
|
||||
- do not install udev rules from /etc in generic mode
|
||||
- fixed LABEL= parsing for swap devices
|
||||
- fixed iBFT network setup
|
||||
- url-lib.sh: handle 0-size files with curl
|
||||
- dracut.asc: document debugging dracut on shutdown
|
||||
- if rd.md=0, use dmraid for imsm and ddf
|
||||
- skip empty dracut modules
|
||||
- removed caching of kernel cmdline
|
||||
- fixed iso-scan, if the loop device driver is a kernel module
|
||||
- bcache: support new blkid
|
||||
- fixed ifup udev rules
|
||||
- ifup with dhcp, if no "ip=" specified for the interface
|
||||
|
||||
Contributions from:
|
||||
WANG Chao
|
||||
Colin Walters
|
||||
Harald Hoyer
|
||||
|
||||
|
||||
dracut-032
|
||||
==========
|
||||
- add parameter --print-cmdline
|
||||
|
@@ -1,14 +1,16 @@
|
||||
For the testsuite to work, you will have to install at least the following software packages:
|
||||
dash
|
||||
asciidoc
|
||||
mdadm
|
||||
lvm2
|
||||
cryptsetup
|
||||
nfs-utils
|
||||
netbsd-iscsi
|
||||
nbd
|
||||
dhcp (dhcp-server on openSUSE)
|
||||
dash \
|
||||
asciidoc \
|
||||
mdadm \
|
||||
lvm2 \
|
||||
cryptsetup \
|
||||
nfs-utils \
|
||||
netbsd-iscsi \
|
||||
nbd \
|
||||
dhcp-server \
|
||||
iscsi-initiator-utils
|
||||
|
||||
|
||||
TEST-04-FULL-SYSTEMD: systemd >= 187
|
||||
|
||||
How to run the testsuite:
|
||||
|
9
TODO
9
TODO
@@ -6,6 +6,10 @@ Items are ordered in priority.
|
||||
|
||||
INITRAMFS TODO
|
||||
|
||||
- allow dual stack configuration (IPv4, IPv6) for the same interface
|
||||
- "bind-mount" kernel drivers in real root for the rescue image,
|
||||
if the real root does not have any kernel modules for this kernel
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1046510
|
||||
- use info and warn prefix
|
||||
- generate systemd unit dracut-initramfs-restore in /run/systemd dynamically
|
||||
- put "root=" parsing hooks in separate hook dir
|
||||
@@ -22,7 +26,9 @@ INITRAMFS TODO
|
||||
|
||||
GENERATOR TODO
|
||||
|
||||
- report errors on missing files in check()
|
||||
- remove wait for swap devs, if no "resume=" is given on the kernel command line
|
||||
- remove wait for swap devs, if the "resume" dracut module is not included (omitted)
|
||||
- add presets (predefined set of modules)
|
||||
- add interpreter/plugin-scripts to be sourced at the beginning or end (can use dracut-functions)
|
||||
- add mechanism for module specific command line options
|
||||
@@ -42,3 +48,6 @@ Future Enhancement Requests
|
||||
- run ssh server to enter crypto password or perform debugging (supported by debian)
|
||||
- https://bugzilla.redhat.com/show_bug.cgi?id=524727 - dracut + encrypted root + networking
|
||||
|
||||
- lsinitrd --print-cmdline
|
||||
- dracut --print-cmdline error if additional arguments
|
||||
- library for cmdline
|
||||
|
2
configure
vendored
2
configure
vendored
@@ -1,6 +1,4 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# We don't support srcdir != builddir
|
||||
echo \#buildapi-variable-no-builddir >/dev/null
|
||||
|
@@ -1,6 +1,3 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Copyright 2013 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
@@ -34,13 +31,16 @@ _dracut() {
|
||||
--local --hostonly --no-hostonly --fstab --help --bzip2 --lzma
|
||||
--xz --no-compress --gzip --list-modules --show-modules --keep
|
||||
--printsize --regenerate-all --noimageifnotneeded --early-microcode
|
||||
--no-early-microcode --print-cmdline'
|
||||
--no-early-microcode --print-cmdline --prelink --noprelink --reproducible
|
||||
'
|
||||
|
||||
[ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers
|
||||
--omit-drivers --modules --omit --drivers --filesystems --install
|
||||
--fwdir --libdirs --fscks --add-fstab --mount --device --nofscks
|
||||
--kmoddir --conf --confdir --tmpdir --stdlog --compress --prefix
|
||||
--kernel-cmdline --sshkey --persistent-policy'
|
||||
--kernel-cmdline --sshkey --persistent-policy --install-optional
|
||||
--loginstall
|
||||
'
|
||||
)
|
||||
|
||||
if __contains_word "$prev" ${OPTS[ARG]}; then
|
||||
@@ -49,7 +49,7 @@ _dracut() {
|
||||
comps=$(compgen -d -- "$cur")
|
||||
compopt -o filenames
|
||||
;;
|
||||
-c|--conf|--sshkey|--add-fstab|--add-device|-I|--install)
|
||||
-c|--conf|--sshkey|--add-fstab|--add-device|-I|--install|--install-optional)
|
||||
comps=$(compgen -f -- "$cur")
|
||||
compopt -o filenames
|
||||
;;
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/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.
|
||||
#
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/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.
|
||||
#
|
||||
@@ -33,7 +31,56 @@ if [[ $initdir ]] && ! [[ -d $initdir ]]; then
|
||||
fi
|
||||
|
||||
# Generic substring function. If $2 is in $1, return 0.
|
||||
strstr() { [[ $1 = *$2* ]]; }
|
||||
strstr() { [[ $1 = *"$2"* ]]; }
|
||||
# Generic glob matching function. If glob pattern $2 matches anywhere in $1, OK
|
||||
strglobin() { [[ $1 = *$2* ]]; }
|
||||
# Generic glob matching function. If glob pattern $2 matches all of $1, OK
|
||||
strglob() { [[ $1 = $2 ]]; }
|
||||
|
||||
# helper function for check() in module-setup.sh
|
||||
# to check for required installed binaries
|
||||
# issues a standardized warning message
|
||||
require_binaries() {
|
||||
local _module_name="${moddir##*/}"
|
||||
local _ret=0
|
||||
|
||||
if [[ "$1" = "-m" ]]; then
|
||||
_module_name="$2"
|
||||
shift 2
|
||||
fi
|
||||
|
||||
for cmd in "$@"; do
|
||||
if ! find_binary "$cmd" &>/dev/null; then
|
||||
dinfo "dracut module '${_module_name#[0-9][0-9]}' will not be installed, because command '$cmd' could not be found!"
|
||||
((_ret++))
|
||||
fi
|
||||
done
|
||||
return $_ret
|
||||
}
|
||||
|
||||
require_any_binary() {
|
||||
local _module_name="${moddir##*/}"
|
||||
local _ret=1
|
||||
|
||||
if [[ "$1" = "-m" ]]; then
|
||||
_module_name="$2"
|
||||
shift 2
|
||||
fi
|
||||
|
||||
for cmd in "$@"; do
|
||||
if find_binary "$cmd" &>/dev/null; then
|
||||
_ret=0
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if (( $_ret != 0 )); then
|
||||
dinfo "$_module_name: Could not find any command of '$@'!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# find a binary. If we were not passed the full path directly,
|
||||
# search in the usual places to find the binary.
|
||||
@@ -57,17 +104,7 @@ fi
|
||||
|
||||
ldconfig_paths()
|
||||
{
|
||||
local a i
|
||||
declare -A a
|
||||
for i in $(
|
||||
ldconfig -pN 2>/dev/null | while read a b c d; do
|
||||
[[ "$c" != "=>" ]] && continue
|
||||
printf "%s\n" ${d%/*};
|
||||
done
|
||||
); do
|
||||
a["$i"]=1;
|
||||
done;
|
||||
printf "%s\n" ${!a[@]}
|
||||
ldconfig -pN 2>/dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq
|
||||
}
|
||||
|
||||
# Detect lib paths
|
||||
@@ -81,7 +118,7 @@ if ! [[ $libdirs ]] ; then
|
||||
[[ -d /usr/lib ]] && libdirs+=" /usr/lib"
|
||||
fi
|
||||
|
||||
libdirs+="$(ldconfig_paths)"
|
||||
libdirs+=" $(ldconfig_paths)"
|
||||
|
||||
export libdirs
|
||||
fi
|
||||
@@ -129,7 +166,13 @@ srcmods="/lib/modules/$kernel/"
|
||||
}
|
||||
export srcmods
|
||||
|
||||
if ! type dinfo >/dev/null 2>&1; then
|
||||
# is_func <command>
|
||||
# Check whether $1 is a function.
|
||||
is_func() {
|
||||
[[ "$(type -t "$1")" = "function" ]]
|
||||
}
|
||||
|
||||
if ! is_func dinfo >/dev/null 2>&1; then
|
||||
. "$dracutbasedir/dracut-logger.sh"
|
||||
dlog_init
|
||||
fi
|
||||
@@ -162,12 +205,6 @@ mksubdirs() {
|
||||
[[ -e ${1%/*} ]] || mkdir -m 0755 -p -- "${1%/*}"
|
||||
}
|
||||
|
||||
# is_func <command>
|
||||
# Check whether $1 is a function.
|
||||
is_func() {
|
||||
[[ "$(type -t "$1")" = "function" ]]
|
||||
}
|
||||
|
||||
# Function prints global variables in format name=value line by line.
|
||||
# $@ = list of global variables' name
|
||||
print_vars() {
|
||||
@@ -175,7 +212,7 @@ print_vars() {
|
||||
|
||||
for _var in "$@"
|
||||
do
|
||||
eval printf -v _value "%s" "\$$_var"
|
||||
eval printf -v _value "%s" \""\$$_var"\"
|
||||
[[ ${_value} ]] && printf '%s="%s"\n' "$_var" "$_value"
|
||||
done
|
||||
}
|
||||
@@ -296,6 +333,23 @@ get_maj_min() {
|
||||
printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))"
|
||||
}
|
||||
|
||||
|
||||
# get_devpath_block <device>
|
||||
# get the DEVPATH in /sys of a block device
|
||||
get_devpath_block() {
|
||||
local _majmin _i
|
||||
_majmin=$(get_maj_min "$1")
|
||||
|
||||
for _i in /sys/block/*/dev /sys/block/*/*/dev; do
|
||||
[[ -e "$_i" ]] || continue
|
||||
if [[ "$_majmin" == "$(<"$_i")" ]]; then
|
||||
printf "%s" "${_i%/dev}"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# get a persistent path from a device
|
||||
get_persistent_dev() {
|
||||
local i _tmp _dev
|
||||
@@ -313,6 +367,7 @@ get_persistent_dev() {
|
||||
/dev/disk/by-id/* \
|
||||
/dev/disk/by-path/* \
|
||||
; do
|
||||
[[ -e "$i" ]] || continue
|
||||
[[ $i == /dev/mapper/control ]] && continue
|
||||
[[ $i == /dev/mapper/mpath* ]] && continue
|
||||
_tmp=$(get_maj_min "$i")
|
||||
@@ -321,21 +376,46 @@ get_persistent_dev() {
|
||||
return
|
||||
fi
|
||||
done
|
||||
printf -- "%s" "$1"
|
||||
}
|
||||
|
||||
expand_persistent_dev() {
|
||||
local _dev=$1
|
||||
|
||||
case "$_dev" in
|
||||
LABEL=*)
|
||||
_dev="/dev/disk/by-label/${_dev#LABEL=}"
|
||||
;;
|
||||
UUID=*)
|
||||
_dev="${_dev#UUID=}"
|
||||
_dev="${_dev,,}"
|
||||
_dev="/dev/disk/by-uuid/${_dev}"
|
||||
;;
|
||||
PARTUUID=*)
|
||||
_dev="${_dev#PARTUUID=}"
|
||||
_dev="${_dev,,}"
|
||||
_dev="/dev/disk/by-partuuid/${_dev}"
|
||||
;;
|
||||
PARTLABEL=*)
|
||||
_dev="/dev/disk/by-partlabel/${_dev#PARTLABEL=}"
|
||||
;;
|
||||
esac
|
||||
printf "%s" "$_dev"
|
||||
}
|
||||
|
||||
shorten_persistent_dev() {
|
||||
local dev="$1"
|
||||
case "$dev" in
|
||||
local _dev="$1"
|
||||
case "$_dev" in
|
||||
/dev/disk/by-uuid/*)
|
||||
printf "%s" "UUID=${dev##*/}";;
|
||||
printf "%s" "UUID=${_dev##*/}";;
|
||||
/dev/disk/by-label/*)
|
||||
printf "%s" "LABEL=${dev##*/}";;
|
||||
printf "%s" "LABEL=${_dev##*/}";;
|
||||
/dev/disk/by-partuuid/*)
|
||||
printf "%s" "PARTUUID=${dev##*/}";;
|
||||
printf "%s" "PARTUUID=${_dev##*/}";;
|
||||
/dev/disk/by-partlabel/*)
|
||||
printf "%s" "PARTLABEL=${dev##*/}";;
|
||||
printf "%s" "PARTLABEL=${_dev##*/}";;
|
||||
*)
|
||||
printf "%s" "$dev";;
|
||||
printf "%s" "$_dev";;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -537,7 +617,7 @@ host_fs_all()
|
||||
check_block_and_slaves() {
|
||||
local _x
|
||||
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
|
||||
"$1" $2 && return
|
||||
if ! lvm_internal_dev $2; then "$1" $2 && return; fi
|
||||
check_vol_slaves "$@" && return 0
|
||||
if [[ -f /sys/dev/block/$2/../dev ]]; then
|
||||
check_block_and_slaves $1 $(<"/sys/dev/block/$2/../dev") && return 0
|
||||
@@ -553,7 +633,7 @@ check_block_and_slaves() {
|
||||
check_block_and_slaves_all() {
|
||||
local _x _ret=1
|
||||
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
|
||||
if "$1" $2; then
|
||||
if ! lvm_internal_dev $2 && "$1" $2; then
|
||||
_ret=0
|
||||
fi
|
||||
check_vol_slaves "$@" && return 0
|
||||
@@ -608,10 +688,12 @@ for_each_host_dev_and_slaves()
|
||||
# but you cannot create the logical volume without the volume group.
|
||||
# And the volume group might be bigger than the devices the LV needs.
|
||||
check_vol_slaves() {
|
||||
local _lv _vg _pv
|
||||
local _lv _vg _pv _dm
|
||||
for i in /dev/mapper/*; do
|
||||
[[ $i == /dev/mapper/control ]] && continue
|
||||
_lv=$(get_maj_min $i)
|
||||
_dm=/sys/dev/block/$_lv/dm
|
||||
[[ -f $_dm/uuid && $(<$_dm/uuid) =~ LVM-* ]] || continue
|
||||
if [[ $_lv = $2 ]]; then
|
||||
_vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
|
||||
# strip space
|
||||
@@ -647,13 +729,14 @@ fs_get_option() {
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
if ! [[ $DRACUT_INSTALL ]]; then
|
||||
DRACUT_INSTALL=$(find_binary dracut-install)
|
||||
fi
|
||||
|
||||
if ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/dracut-install ]]; then
|
||||
DRACUT_INSTALL=$dracutbasedir/dracut-install
|
||||
elif ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/install/dracut-install ]]; then
|
||||
DRACUT_INSTALL=$dracutbasedir/install/dracut-install
|
||||
fi
|
||||
|
||||
if ! [[ -x $DRACUT_INSTALL ]]; then
|
||||
@@ -664,38 +747,51 @@ fi
|
||||
[[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
|
||||
inst_dir() {
|
||||
[[ -e ${initdir}/"$1" ]] && return 0 # already there
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} -d "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} -d "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} -d "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -d "$@" || :
|
||||
}
|
||||
|
||||
inst() {
|
||||
local _hostonly_install
|
||||
if [[ "$1" == "-H" ]]; then
|
||||
_hostonly_install="-H"
|
||||
shift
|
||||
fi
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
#dinfo "$DRACUT_INSTALL -l $@"
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_simple() {
|
||||
local _hostonly_install
|
||||
if [[ "$1" == "-H" ]]; then
|
||||
_hostonly_install="-H"
|
||||
shift
|
||||
fi
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -e $1 ]] || return 1 # no source
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_symlink() {
|
||||
local _hostonly_install
|
||||
if [[ "$1" == "-H" ]]; then
|
||||
_hostonly_install="-H"
|
||||
shift
|
||||
fi
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -L $1 ]] || return 1
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_multiple() {
|
||||
local ret
|
||||
#dinfo "initdir=$initdir $DRACUT_INSTALL -l $@"
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
ret=$?
|
||||
(($ret != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
return $ret
|
||||
local _ret
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
|
||||
_ret=$?
|
||||
(($_ret != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||
return $_ret
|
||||
}
|
||||
|
||||
dracut_install() {
|
||||
@@ -703,20 +799,31 @@ dracut_install() {
|
||||
}
|
||||
|
||||
inst_library() {
|
||||
local _hostonly_install
|
||||
if [[ "$1" == "-H" ]]; then
|
||||
_hostonly_install="-H"
|
||||
shift
|
||||
fi
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -e $1 ]] || return 1 # no source
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_binary() {
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
|
||||
}
|
||||
|
||||
inst_script() {
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
|
||||
}
|
||||
|
||||
mark_hostonly() {
|
||||
for i in "$@"; do
|
||||
echo "$i" >> "$initdir/lib/dracut/hostonly-files"
|
||||
done
|
||||
}
|
||||
|
||||
# find symlinks linked to given library file
|
||||
@@ -830,8 +937,8 @@ inst_rules() {
|
||||
inst_dir "$_target"
|
||||
for _rule in "$@"; do
|
||||
if [ "${_rule#/}" = "$_rule" ]; then
|
||||
for r in ${udevdir}/rules.d /etc/udev/rules.d; do
|
||||
if [[ -f $r/$_rule ]]; then
|
||||
for r in ${udevdir}/rules.d ${hostonly:+/etc/udev/rules.d}; do
|
||||
if [[ -e $r/$_rule ]]; then
|
||||
_found="$r/$_rule"
|
||||
inst_rule_programs "$_found"
|
||||
inst_rule_group_owner "$_found"
|
||||
@@ -840,7 +947,10 @@ inst_rules() {
|
||||
fi
|
||||
done
|
||||
fi
|
||||
for r in '' ./ $dracutbasedir/rules.d/; do
|
||||
for r in '' $dracutbasedir/rules.d/; do
|
||||
# skip rules without an absolute path
|
||||
[[ "${r}$_rule" != /* ]] && continue
|
||||
|
||||
if [[ -f ${r}$_rule ]]; then
|
||||
_found="${r}$_rule"
|
||||
inst_rule_programs "$_found"
|
||||
@@ -853,6 +963,34 @@ inst_rules() {
|
||||
done
|
||||
}
|
||||
|
||||
inst_rules_wildcard() {
|
||||
local _target=/etc/udev/rules.d _rule _found
|
||||
|
||||
inst_dir "${udevdir}/rules.d"
|
||||
inst_dir "$_target"
|
||||
for _rule in ${udevdir}/rules.d/$1 ${dracutbasedir}/rules.d/$1 ; do
|
||||
if [[ -e $_rule ]]; then
|
||||
inst_rule_programs "$_rule"
|
||||
inst_rule_group_owner "$_rule"
|
||||
inst_rule_initqueue "$_rule"
|
||||
inst_simple "$_rule"
|
||||
_found=$_rule
|
||||
fi
|
||||
done
|
||||
if [ -n ${hostonly} ] ; then
|
||||
for _rule in ${_target}/$1 ; do
|
||||
if [[ -f $_rule ]]; then
|
||||
inst_rule_programs "$_rule"
|
||||
inst_rule_group_owner "$_rule"
|
||||
inst_rule_initqueue "$_rule"
|
||||
inst_simple "$_rule"
|
||||
_found=$_rule
|
||||
fi
|
||||
done
|
||||
fi
|
||||
[[ $_found ]] || dinfo "Skipping udev rule: $_rule"
|
||||
}
|
||||
|
||||
prepare_udev_rules() {
|
||||
[ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version)
|
||||
|
||||
@@ -1010,7 +1148,7 @@ module_check() {
|
||||
. $_moddir/module-setup.sh
|
||||
is_func check || return 0
|
||||
[ $_forced -ne 0 ] && unset hostonly
|
||||
check $hostonly
|
||||
moddir=$_moddir check $hostonly
|
||||
_ret=$?
|
||||
unset check depends cmdline install installkernel
|
||||
fi
|
||||
@@ -1036,7 +1174,7 @@ module_check_mount() {
|
||||
unset check depends cmdline install installkernel
|
||||
check() { false; }
|
||||
. $_moddir/module-setup.sh
|
||||
check 0
|
||||
moddir=$_moddir check 0
|
||||
_ret=$?
|
||||
unset check depends cmdline install installkernel
|
||||
fi
|
||||
@@ -1060,7 +1198,7 @@ module_depends() {
|
||||
unset check depends cmdline install installkernel
|
||||
depends() { true; }
|
||||
. $_moddir/module-setup.sh
|
||||
depends
|
||||
moddir=$_moddir depends
|
||||
_ret=$?
|
||||
unset check depends cmdline install installkernel
|
||||
return $_ret
|
||||
@@ -1081,7 +1219,7 @@ module_cmdline() {
|
||||
unset check depends cmdline install installkernel
|
||||
cmdline() { true; }
|
||||
. $_moddir/module-setup.sh
|
||||
cmdline
|
||||
moddir=$_moddir cmdline
|
||||
_ret=$?
|
||||
unset check depends cmdline install installkernel
|
||||
return $_ret
|
||||
@@ -1102,7 +1240,7 @@ module_install() {
|
||||
unset check depends cmdline install installkernel
|
||||
install() { true; }
|
||||
. $_moddir/module-setup.sh
|
||||
install
|
||||
moddir=$_moddir install
|
||||
_ret=$?
|
||||
unset check depends cmdline install installkernel
|
||||
return $_ret
|
||||
@@ -1123,7 +1261,7 @@ module_installkernel() {
|
||||
unset check depends cmdline install installkernel
|
||||
installkernel() { true; }
|
||||
. $_moddir/module-setup.sh
|
||||
installkernel
|
||||
moddir=$_moddir installkernel
|
||||
_ret=$?
|
||||
unset check depends cmdline install installkernel
|
||||
return $_ret
|
||||
@@ -1170,13 +1308,17 @@ check_mount() {
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
for _moddep in $(module_depends $_mod); do
|
||||
# handle deps as if they were manually added
|
||||
[[ " $add_dracutmodules " == *\ $_moddep\ * ]] || \
|
||||
add_dracutmodules+=" $_moddep "
|
||||
[[ " $force_add_dracutmodules " == *\ $_moddep\ * ]] || \
|
||||
force_add_dracutmodules+=" $_moddep "
|
||||
[[ " $dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $dracutmodules " != *\ $_moddep\ * ]] \
|
||||
&& dracutmodules+=" $_moddep "
|
||||
[[ " $add_dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $add_dracutmodules " != *\ $_moddep\ * ]] \
|
||||
&& add_dracutmodules+=" $_moddep "
|
||||
[[ " $force_add_dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $force_add_dracutmodules " != *\ $_moddep\ * ]] \
|
||||
&& force_add_dracutmodules+=" $_moddep "
|
||||
# if a module we depend on fail, fail also
|
||||
if ! check_module $_moddep; then
|
||||
derror "dracut module '$_mod' depends on '$_moddep', which can't be installed"
|
||||
@@ -1214,7 +1356,7 @@ check_module() {
|
||||
fi
|
||||
|
||||
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
|
||||
if [[ " $force_add_dracutmodules " == *\ $_mod\ * ]]; then
|
||||
if [[ " $dracutmodules $force_add_dracutmodules " == *\ $_mod\ * ]]; then
|
||||
module_check $_mod 1; ret=$?
|
||||
else
|
||||
module_check $_mod 0; ret=$?
|
||||
@@ -1225,7 +1367,11 @@ check_module() {
|
||||
# module not in our list
|
||||
if [[ $dracutmodules = all ]]; then
|
||||
# check, if we can and should install this module
|
||||
module_check $_mod || return 1
|
||||
module_check $_mod; ret=$?
|
||||
if [[ $ret != 0 ]]; then
|
||||
[[ $2 ]] && return 1
|
||||
[[ $ret != 255 ]] && return 1
|
||||
fi
|
||||
else
|
||||
# skip this module
|
||||
return 1
|
||||
@@ -1234,10 +1380,15 @@ check_module() {
|
||||
|
||||
for _moddep in $(module_depends $_mod); do
|
||||
# handle deps as if they were manually added
|
||||
[[ " $add_dracutmodules " == *\ $_moddep\ * ]] || \
|
||||
add_dracutmodules+=" $_moddep "
|
||||
[[ " $force_add_dracutmodules " == *\ $_moddep\ * ]] || \
|
||||
force_add_dracutmodules+=" $_moddep "
|
||||
[[ " $dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $dracutmodules " != *\ $_moddep\ * ]] \
|
||||
&& dracutmodules+=" $_moddep "
|
||||
[[ " $add_dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $add_dracutmodules " != *\ $_moddep\ * ]] \
|
||||
&& add_dracutmodules+=" $_moddep "
|
||||
[[ " $force_add_dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $force_add_dracutmodules " != *\ $_moddep\ * ]] \
|
||||
&& force_add_dracutmodules+=" $_moddep "
|
||||
# if a module we depend on fail, fail also
|
||||
if ! check_module $_moddep; then
|
||||
derror "dracut module '$_mod' depends on '$_moddep', which can't be installed"
|
||||
@@ -1260,17 +1411,28 @@ for_each_module_dir() {
|
||||
local _func
|
||||
_func=$1
|
||||
for _moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
[[ -d $_moddir ]] || continue;
|
||||
[[ -e $_moddir/install || -e $_moddir/installkernel || \
|
||||
-e $_moddir/module-setup.sh ]] || continue
|
||||
_mod=${_moddir##*/}; _mod=${_mod#[0-9][0-9]}
|
||||
$_func $_mod 1
|
||||
done
|
||||
|
||||
# Report any missing dracut modules, the user has specified
|
||||
_modcheck="$add_dracutmodules $force_add_dracutmodules"
|
||||
[[ $dracutmodules != all ]] && _modcheck="$m $dracutmodules"
|
||||
[[ $dracutmodules != all ]] && _modcheck="$_modcheck $dracutmodules"
|
||||
for _mod in $_modcheck; do
|
||||
[[ " $mods_to_load " == *\ $_mod\ * ]] && continue
|
||||
[[ " $omit_dracutmodules " == *\ $_mod\ * ]] && continue
|
||||
|
||||
[[ " $force_add_dracutmodules " != *\ $_mod\ * ]] \
|
||||
&& [[ " $dracutmodules " != *\ $_mod\ * ]] \
|
||||
&& [[ " $omit_dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& continue
|
||||
|
||||
derror "dracut module '$_mod' cannot be found or installed."
|
||||
[[ " $force_add_dracutmodules " == *\ $_mod\ * ]] && exit 1
|
||||
[[ " $dracutmodules " == *\ $_mod\ * ]] && exit 1
|
||||
[[ " $add_dracutmodules " == *\ $_mod\ * ]] && exit 1
|
||||
done
|
||||
}
|
||||
|
||||
@@ -1289,7 +1451,7 @@ install_kmod_with_fw() {
|
||||
|
||||
if [[ $omit_drivers ]]; then
|
||||
local _kmod=${1##*/}
|
||||
_kmod=${_kmod%.ko}
|
||||
_kmod=${_kmod%.ko*}
|
||||
_kmod=${_kmod/-/_}
|
||||
if [[ "$_kmod" =~ $omit_drivers ]]; then
|
||||
dinfo "Omitting driver $_kmod"
|
||||
@@ -1303,7 +1465,7 @@ install_kmod_with_fw() {
|
||||
|
||||
if [[ $silent_omit_drivers ]]; then
|
||||
local _kmod=${1##*/}
|
||||
_kmod=${_kmod%.ko}
|
||||
_kmod=${_kmod%.ko*}
|
||||
_kmod=${_kmod/-/_}
|
||||
[[ "$_kmod" =~ $silent_omit_drivers ]] && return 0
|
||||
[[ "${1##*/lib/modules/$kernel/}" =~ $silent_omit_drivers ]] && return 0
|
||||
@@ -1362,7 +1524,7 @@ dracut_kernel_post() {
|
||||
local _pid
|
||||
|
||||
if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && [[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" ]]; then
|
||||
xargs -r modprobe -a ${_moddirname+-d ${_moddirname}/} \
|
||||
xargs -r modprobe -a ${_moddirname:+-d ${_moddirname}/} \
|
||||
--ignore-install --show-depends --set-version $kernel \
|
||||
< "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" 2>/dev/null \
|
||||
| sort -u \
|
||||
@@ -1373,7 +1535,7 @@ dracut_kernel_post() {
|
||||
|
||||
(
|
||||
if [[ $DRACUT_INSTALL ]] && [[ -z $_moddirname ]]; then
|
||||
xargs -r $DRACUT_INSTALL ${initdir+-D "$initdir"} -a < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
|
||||
xargs -r $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} -a < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
|
||||
else
|
||||
while read _modpath; do
|
||||
local _destpath=$_modpath
|
||||
@@ -1392,7 +1554,7 @@ dracut_kernel_post() {
|
||||
for _fwdir in $fw_dir; do
|
||||
echo $_fwdir/$line;
|
||||
done;
|
||||
done | xargs -r $DRACUT_INSTALL ${initdir+-D "$initdir"} -a -o
|
||||
done | xargs -r $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} -a -o
|
||||
else
|
||||
for _fw in $(xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"); do
|
||||
for _fwdir in $fw_dir; do
|
||||
@@ -1407,13 +1569,6 @@ dracut_kernel_post() {
|
||||
wait $_pid
|
||||
fi
|
||||
|
||||
for _f in modules.builtin.bin modules.builtin; do
|
||||
[[ $srcmods/$_f ]] && break
|
||||
done || {
|
||||
dfatal "No modules.builtin.bin and modules.builtin found!"
|
||||
return 1
|
||||
}
|
||||
|
||||
for _f in modules.builtin.bin modules.builtin modules.order; do
|
||||
[[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
|
||||
done
|
||||
@@ -1428,23 +1583,47 @@ dracut_kernel_post() {
|
||||
[[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && rm -fr -- "$DRACUT_KERNEL_LAZY_HASHDIR"
|
||||
}
|
||||
|
||||
[[ "$kernel_current" ]] || export kernel_current=$(uname -r)
|
||||
|
||||
module_is_host_only() {
|
||||
local _mod=$1
|
||||
local _modenc a i _k _s _v _aliases
|
||||
_mod=${_mod##*/}
|
||||
_mod=${_mod%.ko}
|
||||
_mod=${_mod%.ko*}
|
||||
_modenc=${_mod//-/_}
|
||||
|
||||
[[ " $add_drivers " == *\ ${_mod}\ * ]] && return 0
|
||||
|
||||
# check if module is loaded
|
||||
for i in /sys/module/${_mod//-/_}; do
|
||||
[[ -d $i ]] && return 0
|
||||
done
|
||||
[[ ${host_modules["$_modenc"]} ]] && return 0
|
||||
|
||||
# check if module is loadable on the current kernel
|
||||
# this covers the case, where a new module is introduced
|
||||
# or a module was renamed
|
||||
# or a module changed from builtin to a module
|
||||
modinfo -F filename "$_mod" &>/dev/null || return 0
|
||||
[[ "$kernel_current" ]] || export kernel_current=$(uname -r)
|
||||
|
||||
if [[ "$kernel_current" != "$kernel" ]]; then
|
||||
# check if module is loadable on the current kernel
|
||||
# this covers the case, where a new module is introduced
|
||||
# or a module was renamed
|
||||
# or a module changed from builtin to a module
|
||||
|
||||
if [[ -d /lib/modules/$kernel_current ]]; then
|
||||
# if the modinfo can be parsed, but the module
|
||||
# is not loaded, then we can safely return 1
|
||||
modinfo -F filename "$_mod" &>/dev/null && return 1
|
||||
fi
|
||||
|
||||
_aliases=$(modinfo -k $kernel -F alias $_mod 2>/dev/null)
|
||||
|
||||
# if the module has no aliases, install it
|
||||
[[ $_aliases ]] || return 0
|
||||
|
||||
# finally check all modalias
|
||||
for a in $_aliases; do
|
||||
for i in "${!host_modalias[@]}"; do
|
||||
[[ $i == $a ]] && return 0
|
||||
done
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
@@ -1457,7 +1636,7 @@ find_kernel_modules_by_path () {
|
||||
_OLDIFS=$IFS
|
||||
IFS=:
|
||||
while read a rest; do
|
||||
[[ $a = */$1/* ]] || continue
|
||||
[[ $a = */$1/* ]] || [[ $a = updates/* ]] || continue
|
||||
printf "%s\n" "$srcmods/$a"
|
||||
done < "$srcmods/modules.dep"
|
||||
IFS=$_OLDIFS
|
||||
@@ -1500,11 +1679,18 @@ instmods() {
|
||||
--*) _mpargs+=" $_mod" ;;
|
||||
*)
|
||||
_mod=${_mod##*/}
|
||||
# Check for aliased modules
|
||||
_modalias=$(modinfo -k $kernel -F filename $_mod 2> /dev/null)
|
||||
_modalias=${_modalias%.ko*}
|
||||
if [[ $_modalias ]] && [ "${_modalias##*/}" != "${_mod%.ko*}" ] ; then
|
||||
_mod=${_modalias##*/}
|
||||
fi
|
||||
|
||||
# if we are already installed, skip this module and go on
|
||||
# to the next one.
|
||||
if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \
|
||||
[[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko}.ko" ]]; then
|
||||
read _ret <"$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko}.ko"
|
||||
[[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko*}" ]]; then
|
||||
read _ret <"$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko*}"
|
||||
return $_ret
|
||||
fi
|
||||
|
||||
@@ -1534,7 +1720,7 @@ instmods() {
|
||||
((_ret+=$?))
|
||||
else
|
||||
[[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \
|
||||
echo $_mod >> "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist"
|
||||
echo ${_mod%.ko*} >> "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@@ -1546,18 +1732,16 @@ instmods() {
|
||||
if (($# == 0)); then # filenames from stdin
|
||||
while read _mod; do
|
||||
inst1mod "${_mod%.ko*}" || {
|
||||
if [[ "$_check" == "yes" ]]; then
|
||||
[[ "$_silent" == "no" ]] && dfatal "Failed to install module $_mod"
|
||||
return 1
|
||||
if [[ "$_check" == "yes" ]] && [[ "$_silent" == "no" ]]; then
|
||||
dfatal "Failed to install module $_mod"
|
||||
fi
|
||||
}
|
||||
done
|
||||
fi
|
||||
while (($# > 0)); do # filenames as arguments
|
||||
inst1mod ${1%.ko*} || {
|
||||
if [[ "$_check" == "yes" ]]; then
|
||||
[[ "$_silent" == "no" ]] && dfatal "Failed to install module $1"
|
||||
return 1
|
||||
if [[ "$_check" == "yes" ]] && [[ "$_silent" == "no" ]]; then
|
||||
dfatal "Failed to install module $1"
|
||||
fi
|
||||
}
|
||||
shift
|
||||
@@ -1573,6 +1757,24 @@ instmods() {
|
||||
_ret=$?
|
||||
return $_ret
|
||||
}
|
||||
|
||||
check_kernel_config()
|
||||
{
|
||||
local _config_opt="$1"
|
||||
local _config_file
|
||||
[[ -f /boot/config-$kernel ]] \
|
||||
&& _config_file="/boot/config-$kernel"
|
||||
[[ -f /lib/modules/$kernel/config ]] \
|
||||
&& _config_file="/lib/modules/$kernel/config"
|
||||
|
||||
# no kernel config file, so return true
|
||||
[[ $_config_file ]] || return 0
|
||||
|
||||
grep -q -F "${_config_opt}=" "$_config_file" && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
# get_cpu_vendor
|
||||
# Only two values are returned: AMD or Intel
|
||||
get_cpu_vendor ()
|
||||
@@ -1606,3 +1808,15 @@ get_ucode_file ()
|
||||
printf "%02x-%02x-%02x" ${family} ${model} ${stepping}
|
||||
fi
|
||||
}
|
||||
|
||||
# Not every device in /dev/mapper should be examined.
|
||||
# If it is an LVM device, touch only devices which have /dev/VG/LV symlink.
|
||||
lvm_internal_dev() {
|
||||
local dev_dm_dir=/sys/dev/block/$1/dm
|
||||
[[ ! -f $dev_dm_dir/uuid || $(<$dev_dm_dir/uuid) != LVM-* ]] && return 1 # Not an LVM device
|
||||
local DM_VG_NAME DM_LV_NAME DM_LV_LAYER
|
||||
eval $(dmsetup splitname --nameprefixes --noheadings --rows "$(<$dev_dm_dir/name)" 2>/dev/null)
|
||||
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 0 # Better skip this!
|
||||
[[ ${DM_LV_LAYER} ]] || [[ ! -L /dev/${DM_VG_NAME}/${DM_LV_NAME} ]]
|
||||
}
|
||||
|
||||
|
@@ -1,11 +1,17 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
set -e
|
||||
|
||||
# do some sanity checks first
|
||||
[ -e /run/initramfs/bin/sh ] && exit 0
|
||||
[ -e /run/initramfs/.need_shutdown ] || exit 0
|
||||
|
||||
KERNEL_VERSION="$(uname -r)"
|
||||
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
SKIP="$dracutbasedir/skipcpio"
|
||||
[[ -x $SKIP ]] || SKIP=cat
|
||||
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
|
||||
@@ -16,9 +22,11 @@ fi
|
||||
cd /run/initramfs
|
||||
|
||||
[ -f .need_shutdown -a -f "$IMG" ] || exit 1
|
||||
if zcat "$IMG" | cpio -id --quiet >/dev/null; then
|
||||
if $SKIP "$IMG" | zcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
|
||||
rm -f -- .need_shutdown
|
||||
elif xzcat "$IMG" | cpio -id --quiet >/dev/null; then
|
||||
elif $SKIP "$IMG" | xzcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
|
||||
rm -f -- .need_shutdown
|
||||
elif $SKIP "$IMG" | lz4 -d -c | cpio -id --no-absolute-filenames --quiet >/dev/null; then
|
||||
rm -f -- .need_shutdown
|
||||
else
|
||||
# something failed, so we clean up
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/bash
|
||||
# -*- 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
|
||||
#
|
||||
@@ -140,16 +138,25 @@ dlog_init() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( $UID != 0 )); then
|
||||
kmsgloglvl=0
|
||||
sysloglvl=0
|
||||
fi
|
||||
|
||||
if (( $sysloglvl > 0 )); then
|
||||
if [[ -d /run/systemd/journal ]] && type -P systemd-cat &>/dev/null && (( $UID == 0 )) ; then
|
||||
if [[ -d /run/systemd/journal ]] \
|
||||
&& type -P systemd-cat &>/dev/null \
|
||||
&& systemctl --quiet is-active systemd-journald.socket &>/dev/null \
|
||||
&& { echo "dracut-$DRACUT_VERSION" | systemd-cat -t 'dracut' &>/dev/null; } ; then
|
||||
readonly _dlogdir="$(mktemp --tmpdir="$TMPDIR/" -d -t dracut-log.XXXXXX)"
|
||||
readonly _systemdcatfile="$_dlogdir/systemd-cat"
|
||||
mkfifo "$_systemdcatfile"
|
||||
readonly _dlogfd=15
|
||||
systemd-cat -t 'dracut' <"$_systemdcatfile" &
|
||||
systemd-cat -t 'dracut' --level-prefix=true <"$_systemdcatfile" &
|
||||
exec 15>"$_systemdcatfile"
|
||||
elif ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null; then
|
||||
# We cannot log to syslog, so turn this facility off.
|
||||
kmsgloglvl=$sysloglvl
|
||||
sysloglvl=0
|
||||
ret=1
|
||||
errmsg="No '/dev/log' or 'logger' included for syslog logging"
|
||||
@@ -321,7 +328,7 @@ _do_dlog() {
|
||||
|
||||
if (( $lvl <= $sysloglvl )); then
|
||||
if [[ "$_dlogfd" ]]; then
|
||||
echo "<$(_dlvl2syslvl $lvl)>$msg" >&$_dlogfd
|
||||
printf -- "<%s>%s\n" "$(($(_dlvl2syslvl $lvl) & 7))" "$msg" >&$_dlogfd
|
||||
else
|
||||
logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) -- "$msg"
|
||||
fi
|
||||
|
143
dracut.8.asc
143
dracut.8.asc
@@ -10,7 +10,7 @@ dracut - low-level tool for generating an initramfs image
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
*dracut* ['OPTION...'] [<image> [_<kernel version>_]]
|
||||
*dracut* [__OPTION...__] [__<image>__ [__<kernel version>__]]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
@@ -33,57 +33,14 @@ For a complete list of kernel command line options see *dracut.cmdline*(7).
|
||||
If you are dropped to an emergency shell, while booting your initramfs,
|
||||
the file _/run/initramfs/rdsosreport.txt_ is created, which can be safed to a
|
||||
(to be mounted by hand) partition (usually /boot) or a USB stick.
|
||||
Additional debugging info can be produced by adding **rd.debug** to the kernel command line.
|
||||
_/run/initramfs/rdsosreport.txt_ contains all logs and the output of some tools.
|
||||
It should be attached to any report about dracut problems.
|
||||
Additional debugging info can be produced by adding **rd.debug** to the kernel
|
||||
command line. _/run/initramfs/rdsosreport.txt_ contains all logs and the output
|
||||
of some tools. It should be attached to any report about dracut problems.
|
||||
|
||||
EXAMPLE
|
||||
-------
|
||||
|
||||
To create a initramfs image, the most simple command is:
|
||||
----
|
||||
# dracut
|
||||
----
|
||||
|
||||
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-_++<kernel version>++_.img and
|
||||
contains the kernel modules of the currently active kernel with version
|
||||
_++<kernel version>++_.
|
||||
|
||||
If the initramfs image already exists, dracut will display an error message, and
|
||||
to overwrite the existing image, you have to use the --force option.
|
||||
----
|
||||
# dracut --force
|
||||
----
|
||||
|
||||
If you want to specify another filename for the resulting image you would issue
|
||||
a command like:
|
||||
----
|
||||
# dracut foobar.img
|
||||
----
|
||||
|
||||
To generate an image for a specific kernel version, the command would be:
|
||||
----
|
||||
# dracut foobar.img 2.6.40-1.rc5.f20
|
||||
----
|
||||
|
||||
A shortcut to generate the image at the default location for a specific kernel
|
||||
version is:
|
||||
----
|
||||
# dracut --kver 2.6.40-1.rc5.f20
|
||||
----
|
||||
|
||||
If you want to create lighter, smaller initramfs images, you may want to specify
|
||||
the --hostonly or -H option. Using this option, the resulting image will
|
||||
contain only those dracut modules, kernel modules and filesystems, which are
|
||||
needed to boot this specific machine. This has the drawback, that you can't put
|
||||
the disk on another controller or machine, and that you can't switch to another
|
||||
root filesystem, without recreating the initramfs image. The usage of the
|
||||
--hostonly option is only for experts and you will have to keep the broken
|
||||
pieces. At least keep a copy of a general purpose image (and corresponding
|
||||
kernel) as a fallback to rescue your system.
|
||||
USAGE
|
||||
-----
|
||||
|
||||
include::dracut.usage.asc[]
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
@@ -179,6 +136,19 @@ example:
|
||||
----
|
||||
===============================
|
||||
|
||||
**--force-drivers** _<list of kernel modules>_::
|
||||
See add-drivers above. But in this case it is ensured that the drivers
|
||||
are tried to be loaded early via modprobe.
|
||||
+
|
||||
[NOTE]
|
||||
===============================
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes. For
|
||||
example:
|
||||
----
|
||||
# dracut --force-drivers "kmodule1 kmodule2" ...
|
||||
----
|
||||
===============================
|
||||
|
||||
**--omit-drivers** _<list of kernel modules>_::
|
||||
specify a space-separated list of kernel modules not to add to the
|
||||
initramfs.
|
||||
@@ -269,6 +239,12 @@ example:
|
||||
**--nostrip**::
|
||||
do not strip binaries in the initramfs
|
||||
|
||||
**--prelink**::
|
||||
prelink binaries in the initramfs (default)
|
||||
|
||||
**--noprelink**::
|
||||
do not prelink binaries in the initramfs
|
||||
|
||||
**--hardlink**::
|
||||
hardlink files in the initramfs (default)
|
||||
|
||||
@@ -312,6 +288,12 @@ Default:
|
||||
|
||||
**--sshkey** _<sshkey file>_:: ssh key file used with ssh-client module.
|
||||
|
||||
**--logfile** _<logfile>_:: logfile to use; overrides any setting from
|
||||
the configuration files.
|
||||
+
|
||||
Default:
|
||||
_/var/log/dracut.log_
|
||||
|
||||
**-l, --local**::
|
||||
activates the local mode. dracut will use modules from the current working
|
||||
directory instead of the system-wide installed modules in
|
||||
@@ -331,7 +313,13 @@ provide a valid _/etc/fstab_.
|
||||
**-N, --no-hostonly**::
|
||||
Disable Host-Only mode
|
||||
|
||||
**--persistent-policy** _<policy>_::
|
||||
**--hostonly-cmdline**:
|
||||
Store kernel command line arguments needed in the initramfs
|
||||
|
||||
**--no-hostonly-cmdline**:
|
||||
Do not store kernel command line arguments needed in the initramfs
|
||||
|
||||
**--persistent-policy** _<policy>_::
|
||||
Use _<policy>_ to address disks and partitions.
|
||||
_<policy>_ can be any directory name found in /dev/disk.
|
||||
E.g. "by-uuid", "by-label"
|
||||
@@ -339,12 +327,16 @@ provide a valid _/etc/fstab_.
|
||||
**--fstab**::
|
||||
Use _/etc/fstab_ instead of _/proc/self/mountinfo_.
|
||||
|
||||
**--add-fstab** _<filename>_ ::
|
||||
**--add-fstab** _<filename>_::
|
||||
Add entries of _<filename>_ to the initramfs /etc/fstab.
|
||||
|
||||
**--mount** "_<device>_ _<mountpoint>_ _<filesystem type>_ _<filesystem options>_"::
|
||||
Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ and _<filesystem
|
||||
options>_ in the initramfs
|
||||
**--mount** "_<device>_ _<mountpoint>_ _<filesystem type>_ [_<filesystem options>_ [_<dump frequency>_ [_<fsck order>_]]]"::
|
||||
Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ in the
|
||||
initramfs. _<filesystem options>_, _<dump options>_ and _<fsck order>_ can
|
||||
be specified, see fstab manpage for the details.
|
||||
The default _<filesystem options>_ is "defaults".
|
||||
The default _<dump frequency>_ is "0".
|
||||
the default _<fsck order>_ is "2".
|
||||
|
||||
**--add-device** _<device>_ ::
|
||||
Bring up _<device>_ in initramfs, _<device>_ should be the device name.
|
||||
@@ -352,13 +344,13 @@ provide a valid _/etc/fstab_.
|
||||
LVM or an encrypted partition.
|
||||
[NB --device can be used for compatibility with earlier releases]
|
||||
|
||||
**-i, --include** _<SOURCE>_ _<TARGET>_::
|
||||
**-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. This parameter can be specified
|
||||
multiple times.
|
||||
|
||||
**-I, --install** _<file list>_::
|
||||
**-I, --install** _<file list>_::
|
||||
install the space separated list of files into the initramfs.
|
||||
+
|
||||
[NOTE]
|
||||
@@ -370,6 +362,9 @@ example:
|
||||
----
|
||||
===============================
|
||||
|
||||
**--install-optional** _<file list>_::
|
||||
install the space separated list of files into the initramfs, if they exist.
|
||||
|
||||
**--gzip**::
|
||||
Compress the generated initramfs using gzip. This will be done by default,
|
||||
unless another compression option or --no-compress is passed. Equivalent to
|
||||
@@ -399,7 +394,24 @@ will not be able to boot. Equivalent to "lzma --compress=lzma -9"
|
||||
[WARNING]
|
||||
====
|
||||
Make sure your kernel has xz decompression support compiled in, otherwise you
|
||||
will not be able to boot. Equivalent to "lzma --compress=xz --check=crc32 --lzma2=dict=1MiB"
|
||||
will not be able to boot. Equivalent to
|
||||
"lzma --compress=xz --check=crc32 --lzma2=dict=1MiB"
|
||||
====
|
||||
|
||||
**--lzo**::
|
||||
Compress the generated initramfs using lzop.
|
||||
[WARNING]
|
||||
====
|
||||
Make sure your kernel has lzo decompression support compiled in, otherwise you
|
||||
will not be able to boot.
|
||||
====
|
||||
|
||||
**--lz4**::
|
||||
Compress the generated initramfs using lz4.
|
||||
[WARNING]
|
||||
====
|
||||
Make sure your kernel has lz4 decompression support compiled in, otherwise you
|
||||
will not be able to boot.
|
||||
====
|
||||
|
||||
**--compress** _<compressor>_::
|
||||
@@ -413,6 +425,9 @@ will not be able to boot. Equivalent to "lzma --compress=xz --check=crc32 --lzma
|
||||
Do not compress the generated initramfs. This will override any other
|
||||
compression options.
|
||||
|
||||
**--reproducible**::
|
||||
Create reproducible images.
|
||||
|
||||
**--list-modules**::
|
||||
List all available dracut modules.
|
||||
|
||||
@@ -444,8 +459,11 @@ will not be able to boot. Equivalent to "lzma --compress=xz --check=crc32 --lzma
|
||||
----
|
||||
|
||||
**--regenerate-all**::
|
||||
Regenerate all initramfs images at the default location with the kernel versions found on the system.
|
||||
Additional parameters are passed through.
|
||||
Regenerate all initramfs images at the default location with the kernel
|
||||
versions found on the system. Additional parameters are passed through.
|
||||
|
||||
**--loginstall _<DIR>_::
|
||||
Log all files installed from the host to _<DIR>_.
|
||||
|
||||
FILES
|
||||
-----
|
||||
@@ -473,9 +491,10 @@ _/etc/conf.d/_::
|
||||
set in the configuration files.
|
||||
|
||||
_/etc/cmdline_::
|
||||
Can contain additional command line options. Deprecated, better use /etc/cmdline.d/*.conf.
|
||||
Can contain additional command line options. Deprecated, better use
|
||||
/etc/cmdline.d/*.conf.
|
||||
|
||||
_/etc/cmdline.d/*.conf::
|
||||
_/etc/cmdline.d/*.conf_::
|
||||
Can contain additional command line options.
|
||||
|
||||
AVAILABILITY
|
||||
|
883
dracut.asc
883
dracut.asc
@@ -1,7 +1,7 @@
|
||||
dracut
|
||||
======
|
||||
Harald Hoyer <harald@redhat.com>
|
||||
v2.0, March 2011
|
||||
v3.0, October 2013
|
||||
|
||||
:language: bash
|
||||
|
||||
@@ -125,12 +125,14 @@ started looks like <<dracutbootup7>>.
|
||||
|
||||
== Dracut on shutdown
|
||||
|
||||
On a systemd driven system, the dracut initramfs is also used for the shutdown procedure.
|
||||
On a systemd driven system, the dracut initramfs is also used for the shutdown
|
||||
procedure.
|
||||
|
||||
The following steps are executed during a shutdown:
|
||||
|
||||
* systemd switches to the shutdown.target
|
||||
* systemd starts /lib/systemd/system/shutdown.target.wants/dracut-shutdown.service
|
||||
* systemd starts
|
||||
/lib/systemd/system/shutdown.target.wants/dracut-shutdown.service
|
||||
* dracut-shutdown.service executes /usr/lib/dracut/dracut-initramfs-restore
|
||||
which unpacks the initramfs to /run/initramfs
|
||||
* systemd finishes shutdown.target
|
||||
@@ -138,875 +140,19 @@ The following steps are executed during a shutdown:
|
||||
* systemd tries to unmount everything and mounts the remaining read-only
|
||||
* systemd checks, if there is a /run/initramfs/shutdown executable
|
||||
* if yes, it does a pivot_root to /run/initramfs and executes ./shutdown.
|
||||
The old root is then mounted on /oldroot. /usr/lib/dracut/modules.d/99shutdown/shutdown.sh is the shutdown executable.
|
||||
* shutdown will try to umount every /oldroot mount and calls the various shutdown hooks from the dracut modules
|
||||
The old root is then mounted on /oldroot.
|
||||
/usr/lib/dracut/modules.d/99shutdown/shutdown.sh is the shutdown executable.
|
||||
* shutdown will try to umount every /oldroot mount and calls the various
|
||||
shutdown hooks from the dracut modules
|
||||
|
||||
This ensures, that all devices are disassembled and unmounted cleanly.
|
||||
|
||||
= User Manual
|
||||
|
||||
== Creating an initramfs Image
|
||||
To create a initramfs image, the most simple command is:
|
||||
----
|
||||
# dracut
|
||||
----
|
||||
|
||||
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-_++<kernel version>++_.img and
|
||||
contains the kernel modules of the currently active kernel with version
|
||||
_++<kernel version>++_.
|
||||
|
||||
If the initramfs image already exists, dracut will display an error message, and
|
||||
to overwrite the existing image, you have to use the --force option.
|
||||
----
|
||||
# dracut --force
|
||||
----
|
||||
|
||||
If you want to specify another filename for the resulting image you would issue
|
||||
a command like:
|
||||
----
|
||||
# dracut foobar.img
|
||||
----
|
||||
|
||||
To generate an image for a specific kernel version, the command would be:
|
||||
----
|
||||
# dracut foobar.img 2.6.40-1.rc5.f20
|
||||
----
|
||||
|
||||
A shortcut to generate the image at the default location for a specific kernel
|
||||
version is:
|
||||
----
|
||||
# dracut --kver 2.6.40-1.rc5.f20
|
||||
----
|
||||
|
||||
If you want to create lighter, smaller initramfs images, you may want to specify
|
||||
the --host-only or -H option. Using this option, the resulting image will
|
||||
contain only those dracut modules, kernel modules and filesystems, which are
|
||||
needed to boot this specific machine. This has the drawback, that you can't put
|
||||
the disk on another controller or machine, and that you can't switch to another
|
||||
root filesystem, without recreating the initramfs image. The usage of the
|
||||
--host-only 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.
|
||||
|
||||
=== Inspecting the Contents
|
||||
To see the contents of the image created by dracut, you can use the lsinitrd tool.
|
||||
----
|
||||
# lsinitrd /boot/initramfs-$(uname -r).img | less
|
||||
----
|
||||
|
||||
To display the contents of a file in the initramfs also use the lsinitrd tool:
|
||||
----
|
||||
# lsinitrd /boot/initramfs-$(uname -r).img /etc/ld.so.conf
|
||||
include ld.so.conf.d/*.conf
|
||||
----
|
||||
|
||||
=== Adding dracut Modules
|
||||
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
|
||||
_/etc/dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_. See <<dracutconf5>>.
|
||||
You can also add dracut modules on the command line
|
||||
by using the -a or --add option:
|
||||
----
|
||||
# dracut --add bootchart initramfs-bootchart.img
|
||||
----
|
||||
|
||||
To see a list of available dracut modules, use the --list-modules option:
|
||||
----
|
||||
# dracut --list-modules
|
||||
----
|
||||
|
||||
or, if you have a dracut version earlier than +008+, issue the command:
|
||||
----
|
||||
# for mod in /usr/lib/dracut/modules.d/*; do echo ${mod##*/??}; done
|
||||
----
|
||||
|
||||
=== Omitting dracut Modules
|
||||
Sometimes you don't want a dracut module to be included for reasons of speed,
|
||||
size or functionality. To do this, either specify the omit_dracutmodules
|
||||
variable in the _dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_ configuration
|
||||
file (see <<dracutconf5>>), or use the -o or --omit option
|
||||
on the command line:
|
||||
----
|
||||
# dracut -o "multipath lvm" no-multipath-lvm.img
|
||||
----
|
||||
|
||||
=== Adding Kernel Modules
|
||||
If you need a special kernel module in the initramfs, which is not
|
||||
automatically picked up by dracut, you have the use the --add-drivers option
|
||||
on the command line or the drivers vaiable in the _/etc/dracut.conf_
|
||||
or _/etc/dracut.conf.d/myconf.conf_ configuration file (see <<dracutconf5>>):
|
||||
----
|
||||
# dracut --add-drivers mymod initramfs-with-mymod.img
|
||||
----
|
||||
|
||||
== Boot parameters
|
||||
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 LABEL or UUID on the kernel command line for your root device, dracut
|
||||
will find it and boot from it.
|
||||
|
||||
The kernel command line usually can be configured in _/boot/grub/grub.conf_, if
|
||||
grub is your bootloader and it also can be edited in the real boot process in
|
||||
the grub menu.
|
||||
|
||||
The kernel command line can also be provided by the dhcp server with the
|
||||
root-path option. See <<NetworkBoot>>.
|
||||
|
||||
For a full reference of all kernel command line parameters, see <<dracut8>>.
|
||||
|
||||
=== Specifying the root Device
|
||||
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 root= option. The most basic one is root=_++<path to device
|
||||
node>++_:
|
||||
----
|
||||
root=/dev/sda2
|
||||
----
|
||||
|
||||
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:
|
||||
----
|
||||
root=UUID=19e9dda3-5a38-484d-a9b0-fa6b067d0331
|
||||
----
|
||||
|
||||
or
|
||||
|
||||
----
|
||||
root=LABEL=myrootpartitionlabel
|
||||
----
|
||||
|
||||
To see all UUIDs or LABELs on your system, do:
|
||||
----
|
||||
# ls -l /dev/disk/by-uuid
|
||||
----
|
||||
|
||||
or
|
||||
|
||||
----
|
||||
# ls -l /dev/disk/by-label
|
||||
----
|
||||
|
||||
If your root partition is on the network see <<NetworkBoot>>.
|
||||
|
||||
=== Keyboard Settings
|
||||
If you have to input passwords for encrypted disk volumes, you might want to set
|
||||
the keyboard layout and specify a display font.
|
||||
|
||||
A typical german kernel command would contain:
|
||||
----
|
||||
vconsole.font=latarcyrheb-sun16 vconsole.keymap=de-latin1-nodeadkeys locale.LANG=de_DE.UTF-8
|
||||
----
|
||||
|
||||
Setting these options can override the setting stored on your system, if you use
|
||||
a modern init system, like systemd.
|
||||
|
||||
For dracut versions prior to version +008+ the line would look like:
|
||||
----
|
||||
LANG=de_DE.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=de-latin1-nodeadkeys
|
||||
----
|
||||
|
||||
=== Blacklisting Kernel Modules
|
||||
Sometimes it is required to prevent the automatic kernel module loading of a
|
||||
specific kernel module. To do this, just add rd.blacklist=_++<kernel module
|
||||
name>++_, with _++<kernel module name>++_ not containing the _.ko_
|
||||
suffix, to the kernel command line. For example:
|
||||
----
|
||||
rd.driver.blacklist=mptsas rd.driver.blacklist=nouveau
|
||||
----
|
||||
|
||||
The option can be specified multiple times on the kernel command line.
|
||||
|
||||
=== Speeding up the Boot Process
|
||||
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 LVM volume or not on a raid partition, or
|
||||
that it lives inside a specific crypto LUKS encrypted volume. By default, dracut
|
||||
searches everywhere. A typical dracut kernel command line for a plain primary or
|
||||
logical partition would contain:
|
||||
----
|
||||
rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0
|
||||
----
|
||||
|
||||
On systems with dracut version prior to +008+ the line would look like:
|
||||
----
|
||||
rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM
|
||||
----
|
||||
|
||||
This turns off every automatic assembly of LVM, MD raids, DM raids and crypto LUKS.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
[[Injecting]]
|
||||
=== Injecting custom Files
|
||||
To add your own files to the initramfs image, you have several possibilities.
|
||||
|
||||
The --include option let you specify a source path and a target path. For example
|
||||
----
|
||||
# dracut --include cmdline-preset /etc/cmdline.d/mycmdline.conf initramfs-cmdline-pre.img
|
||||
----
|
||||
will create an initramfs image, where the file cmdline-preset will be copied
|
||||
inside the initramfs to _/etc/cmdline.d/mycmdline.conf_. --include can only be specified once.
|
||||
|
||||
|
||||
----
|
||||
# mkdir rd.live.overlay
|
||||
# mkdir rd.live.overlay/etc
|
||||
# mkdir rd.live.overlay/etc/conf.d
|
||||
# mkdir rd.live.overlay/etc/cmdline.d
|
||||
# echo "ip=auto" >> rd.live.overlay/etc/cmdline.d/mycmdline.conf
|
||||
# echo export FOO=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
|
||||
# echo export BAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
|
||||
# tree rd.live.overlay/
|
||||
rd.live.overlay/
|
||||
└── etc
|
||||
├── cmdline.d
|
||||
│ └── mycmdline.conf
|
||||
└── conf.d
|
||||
└── testvar.conf
|
||||
|
||||
# dracut --include rd.live.overlay / initramfs-rd.live.overlay.img
|
||||
----
|
||||
|
||||
This will put the contents of the rd.live.overlay directory into the root of the
|
||||
initramfs image.
|
||||
|
||||
The --install 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.
|
||||
|
||||
|
||||
----
|
||||
# dracut --install 'strace fsck.ext3 ssh' initramfs-dbg.img
|
||||
----
|
||||
|
||||
This will create an initramfs with the strace, fsck.ext3 and ssh executables,
|
||||
together with the libraries needed to start those. The --install option can be
|
||||
specified multiple times.
|
||||
|
||||
|
||||
[[NetworkBoot]]
|
||||
== Network Boot
|
||||
|
||||
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.
|
||||
|
||||
On a Red Hat Enterprise Linux or Fedora system, this means, you have to install
|
||||
the _dracut-network_ rpm package:
|
||||
|
||||
|
||||
----
|
||||
# yum install dracut-network
|
||||
----
|
||||
|
||||
The resulting initramfs image can be served by a boot manager residing on your
|
||||
local hard drive or it can be served by a PXE/TFTP server.
|
||||
|
||||
How to setup your PXE/TFTP server can be found in the
|
||||
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/[Red
|
||||
Hat Enterprise Linux Storage Administration Guide].
|
||||
|
||||
If you specify ip=auto on the kernel command line, then dracut asks a dhcp
|
||||
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 TFTP/DHCP server. If you can't pass a
|
||||
kernel command line, then you can inject _/etc/cmdline.d/mycmdline.conf_, with a method described
|
||||
in <<Injecting>>.
|
||||
|
||||
|
||||
|
||||
|
||||
=== Reducing the Image Size
|
||||
|
||||
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.
|
||||
|
||||
You can also specify the exact dracut and kernel modules to produce a very tiny
|
||||
initramfs image.
|
||||
|
||||
For example for a NFS image, you would do:
|
||||
|
||||
|
||||
----
|
||||
# dracut -m "nfs network base" initramfs-nfs-only.img
|
||||
----
|
||||
|
||||
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 --host-only option:
|
||||
|
||||
|
||||
----
|
||||
# dracut -m "nfs network base" --host-only initramfs-nfs-host-only.img
|
||||
----
|
||||
|
||||
This will reduce the size of the initramfs image significantly.
|
||||
|
||||
|
||||
|
||||
=== NFS Root Device
|
||||
|
||||
FIXME
|
||||
|
||||
=== iSCSI Root Device
|
||||
|
||||
FIXME
|
||||
|
||||
=== FCoE Root Device
|
||||
|
||||
FIXME
|
||||
|
||||
== Troubleshooting
|
||||
|
||||
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:
|
||||
http://fedoraproject.org/wiki/How_to_debug_Dracut_problems
|
||||
|
||||
|
||||
[[identifying-your-problem-area]]
|
||||
=== Identifying your problem area
|
||||
. Remove ''rhgb'' and ''quiet'' from the kernel command line
|
||||
. Add ''rd.shell'' to the kernel command line. This will present a shell should
|
||||
dracut be unable to locate your root device
|
||||
. Add ''rd.shell rd.debug log_buf_len=1M'' to the kernel command line so that
|
||||
dracut shell commands are printed as they are executed
|
||||
. With dracut >= 002-11, you can inspect the rd.debug output with:
|
||||
+
|
||||
----
|
||||
# less /run/initramfs/init.log
|
||||
# dmesg | less
|
||||
----
|
||||
. With dracut >= 022 and systemd, you can inspect the rd.debug output with:
|
||||
----
|
||||
# journalctl -ab
|
||||
----
|
||||
. With dracut >= 025 the file /run/initramfs/rdsosreport.txt is generated, which contains all the logs and the output of all significant tools, which are mentioned later.
|
||||
|
||||
If you want to save that output, simply mount /boot by hand or insert an USB stick and mount that.
|
||||
Then you can store the output for later inspection.
|
||||
|
||||
[[information-to-include-in-your-report]]
|
||||
=== Information to include in your report
|
||||
|
||||
[[all-bug-reports]]
|
||||
==== All bug reports
|
||||
In all cases, the following should be mentioned and attached to your bug report:
|
||||
|
||||
* The exact kernel command-line used. Typically from the bootloader
|
||||
configuration file (e.g. _/etc/grub.conf_) or from _/proc/cmdline_.
|
||||
* A copy of your disk partition information from _/etc/fstab_, which might be
|
||||
obtained booting an old working initramfs or a rescue medium.
|
||||
* A device listing from device-mapper. This can be obtained by running the
|
||||
command
|
||||
+
|
||||
----
|
||||
# dmsetup ls --tree
|
||||
----
|
||||
+
|
||||
* A list of block device attributes. This can be obtained by running the commands:
|
||||
+
|
||||
----
|
||||
# blkid -p
|
||||
# blkid -p -o udev
|
||||
----
|
||||
* Turn on dracut debugging (see _the 'debugging dracut' section_), and attach
|
||||
all relevant information from the boot log. This can be obtained by running the
|
||||
command
|
||||
+
|
||||
----
|
||||
# dmesg|grep dracut
|
||||
----
|
||||
+
|
||||
* If you use a dracut configuration file, please include _/etc/dracut.conf_ and
|
||||
all files in _/etc/dracut.conf.d/*.conf_
|
||||
|
||||
[[logical-volume-management-related-problems]]
|
||||
==== Logical Volume Management related problems
|
||||
As well as the information from <<all-bug-reports>> include the following
|
||||
information:
|
||||
|
||||
* Include physical volume information by running the command:
|
||||
+
|
||||
----
|
||||
# lvm pvdisplay
|
||||
----
|
||||
+
|
||||
* Include volume group information by running the command:
|
||||
+
|
||||
----
|
||||
# lvm vgdisplay
|
||||
----
|
||||
+
|
||||
* Include logical volume information by running the command:
|
||||
+
|
||||
----
|
||||
# lvm lvdisplay
|
||||
----
|
||||
|
||||
[[software-raid-related-problems]]
|
||||
==== Software RAID related problems
|
||||
As well as the information from <<all-bug-reports>>, include the following
|
||||
information:
|
||||
|
||||
* If using software RAID disk partitions, please include the output of
|
||||
+
|
||||
----
|
||||
# cat /proc/mdstat
|
||||
----
|
||||
|
||||
[[network-root-device-related-problems]]
|
||||
==== Network root device related problems
|
||||
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 <<all-bug-reports>>, include the
|
||||
following information:
|
||||
|
||||
|
||||
* Please include the output of
|
||||
+
|
||||
----
|
||||
# /sbin/ifup <interfacename>
|
||||
# ip addr show
|
||||
----
|
||||
|
||||
[[debugging-dracut]]
|
||||
=== Debugging dracut
|
||||
|
||||
|
||||
[[configure-a-serial-console]]
|
||||
==== Configure a serial console
|
||||
|
||||
Successfully debugging dracut will require some form of console
|
||||
logging during the system boot. This section documents configuring a
|
||||
serial console connection to record boot messages.
|
||||
|
||||
. First, enable serial console output for both the kernel and the bootloader.
|
||||
. Open the file _/etc/grub.conf_ for editing. Below the line ''timeout=5'', add
|
||||
the following:
|
||||
+
|
||||
----
|
||||
serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
----
|
||||
+
|
||||
. Also in _/etc/grub.conf_, add the following boot arguemnts to the ''kernel''
|
||||
line:
|
||||
+
|
||||
----
|
||||
console=tty0 console=ttyS0,9600
|
||||
----
|
||||
+
|
||||
. When finished, the _/etc/grub.conf_ file should look similar to the example
|
||||
below.
|
||||
+
|
||||
----
|
||||
default=0
|
||||
timeout=5
|
||||
serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
title Fedora (2.6.29.5-191.fc11.x86_64)
|
||||
root (hd0,0)
|
||||
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 console=ttyS0,9600
|
||||
initrd /dracut-2.6.29.5-191.fc11.x86_64.img
|
||||
----
|
||||
+
|
||||
. More detailed information on how to configure the kernel for console output
|
||||
can be found at
|
||||
http://www.faqs.org/docs/Linux-HOWTO/Remote-Serial-Console-HOWTO.html#CONFIGURE-KERNEL.
|
||||
. Redirecting non-interactive output
|
||||
+
|
||||
--
|
||||
NOTE: You can redirect all non-interactive output to _/dev/kmsg_ and the kernel
|
||||
will put it out on the console when it reaches the kernel buffer by doing
|
||||
|
||||
----
|
||||
# exec >/dev/kmsg 2>&1 </dev/console
|
||||
----
|
||||
--
|
||||
|
||||
[[using-the-dracut-shell]]
|
||||
==== Using the dracut shell
|
||||
|
||||
dracut offers a shell for interactive debugging in the event dracut fails to
|
||||
locate your root filesystem. To enable the shell:
|
||||
|
||||
. Add the boot parameter ''rd.shell'' to your bootloader configuration file
|
||||
(e.g. _/etc/grub.conf_)
|
||||
. Remove the boot arguments ''rhgb'' and ''quiet''
|
||||
+
|
||||
A sample _/etc/grub.conf_ bootloader configuration file is listed below.
|
||||
+
|
||||
----
|
||||
default=0
|
||||
timeout=5
|
||||
serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
title Fedora (2.6.29.5-191.fc11.x86_64)
|
||||
root (hd0,0)
|
||||
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
|
||||
initrd /dracut-2.6.29.5-191.fc11.x86_64.img
|
||||
----
|
||||
+
|
||||
. If system boot fails, you will be dropped into a shell as seen in the example below.
|
||||
+
|
||||
----
|
||||
No root device found
|
||||
Dropping to debug shell.
|
||||
|
||||
#
|
||||
----
|
||||
+
|
||||
. Use this shell prompt to gather the information requested above (see <<all-bug-reports>>).
|
||||
|
||||
[[accessing-the-root-volume-from-the-dracut-shell]]
|
||||
==== Accessing the root volume from the dracut shell
|
||||
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:
|
||||
|
||||
* A block device (e.g. _/dev/sda7_)
|
||||
* A LVM logical volume (e.g. _/dev/VolGroup00/LogVol00_)
|
||||
* An encrypted device (e.g. _/dev/mapper/luks-4d5972ea-901c-4584-bd75-1da802417d83_)
|
||||
* A network attached device (e.g. netroot=iscsi:@192.168.0.4::3260::iqn.2009-02.org.fedoraproject:for.all)
|
||||
|
||||
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 _/dev/root_ 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.
|
||||
|
||||
. Inspect your partitions using parted
|
||||
+
|
||||
----
|
||||
# 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
|
||||
----
|
||||
+
|
||||
. You recall that your root volume was a LVM logical volume. Scan and activate
|
||||
any logical volumes.
|
||||
+
|
||||
----
|
||||
# lvm vgscan
|
||||
# lvm vgchange -ay
|
||||
----
|
||||
+
|
||||
. You should see any logical volumes now using the command blkid:
|
||||
+
|
||||
----
|
||||
# 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"
|
||||
----
|
||||
+
|
||||
. 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.
|
||||
+
|
||||
----
|
||||
# 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.
|
||||
----
|
||||
+
|
||||
. Next, make a symbolic link to the unlocked root volume
|
||||
+
|
||||
----
|
||||
# ln -s /dev/mapper/luks-$UUID /dev/root
|
||||
----
|
||||
+
|
||||
. With the root volume available, you may continue booting the system by exiting
|
||||
the dracut shell
|
||||
+
|
||||
----
|
||||
# exit
|
||||
----
|
||||
|
||||
[[additional-dracut-boot-parameters]]
|
||||
==== Additional dracut boot parameters
|
||||
For more debugging options, see <<dracutkerneldebug>> in <<dracutcmdline7>>.
|
||||
|
||||
= Developer Manual
|
||||
|
||||
== dracut Components
|
||||
|
||||
dracut uses a modular system to build and extend the initramfs image. All
|
||||
modules are located in _/usr/lib/dracut/modules.d_ or in _<git-src>/modules.d_.
|
||||
The most basic dracut module is _99base_. In _99base_ the initial shell script
|
||||
init is defined, which gets run by the kernel after initramfs loading. Although
|
||||
you can replace init with your own version of _99base_, 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 <<stages>>.
|
||||
|
||||
The main script, which creates the initramfs is dracut itsself. It parses all
|
||||
arguments and sets up the directory, in which everything is installed. It then
|
||||
executes all check, install, installkernel 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 check, install and installkernel are found in in the file _dracut-functions_.
|
||||
These shell functions are available to all module installer (install,
|
||||
installkernel) scripts, without the need to source _dracut-functions_.
|
||||
|
||||
A module can check the preconditions for install and installkernel with the
|
||||
check script. Also dependencies can be expressed with check. If a module passed
|
||||
check, install and installkernel 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 installkernel. All
|
||||
other files found in a module directory are module specific and mostly are hook
|
||||
scripts and udev rules.
|
||||
|
||||
|
||||
[[stages]]
|
||||
== Boot Process Stages
|
||||
|
||||
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 init.
|
||||
Common used functions are in _dracut-lib.sh_, which can be sourced by any script.
|
||||
|
||||
=== Hook: cmdline
|
||||
|
||||
The _cmdline_ 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.
|
||||
|
||||
In this hook the most important environment variable is defined: root. The
|
||||
second one is rootok, which indicates, that a module claimed to be able to parse
|
||||
the root defined. So for example, **root=**__iscsi:....__ will be claimed by the
|
||||
iscsi dracut module, which then sets rootok.
|
||||
|
||||
=== Hook: pre-udev
|
||||
|
||||
This hook is executed right after the cmdline hook and a check if root and
|
||||
rootok were set. Here modules can take action with the final root, and before
|
||||
udev has been run.
|
||||
|
||||
=== Start Udev
|
||||
|
||||
Now udev is started and the logging for udev is setup.
|
||||
|
||||
=== Hook: pre-trigger
|
||||
|
||||
In this hook, you can set udev environment variables with **udevadm control
|
||||
--property=KEY=_value_** or control the further execution of udev with
|
||||
udevadm.
|
||||
|
||||
=== Trigger Udev
|
||||
|
||||
udev is triggered by calling udevadm trigger, which sends add events for all
|
||||
devices and subsystems.
|
||||
|
||||
=== Main Loop
|
||||
|
||||
In the main loop of dracut loops until udev has settled and
|
||||
all scripts in _initqueue/finished_ returned true.
|
||||
In this loop there are three hooks, where scripts can be inserted
|
||||
by calling /sbin/initqueue.
|
||||
|
||||
==== Initqueue
|
||||
|
||||
This hook gets executed every time a script is inserted here, regardless of the
|
||||
udev state.
|
||||
|
||||
==== Initqueue settled
|
||||
|
||||
This hooks (initqueue/settled) gets executed every time udev has settled.
|
||||
|
||||
|
||||
==== Initqueue timeout
|
||||
|
||||
This hooks (initqueue/timeout) gets executed, when the main loop counter becomes half of the
|
||||
rd.retry counter.
|
||||
|
||||
==== Initqueue finished
|
||||
|
||||
This hook (initqueue/finished) is called after udev has settled and
|
||||
if all scripts herein return 0 the main loop will be ended.
|
||||
Abritary scripts can be added here, to loop in the
|
||||
initqueue until something happens, which a dracut module wants to wait for.
|
||||
|
||||
=== Hook: pre-mount
|
||||
|
||||
Before the root device is mounted all scripts in the hook pre-mount are
|
||||
executed. In some cases (e.g. NFS) the real root device is already mounted,
|
||||
though.
|
||||
|
||||
=== Hook: mount
|
||||
|
||||
This hook is mainly to mount the real root device.
|
||||
|
||||
=== Hook: pre-pivot
|
||||
|
||||
This hook is called before cleanup hook, This is a good place for
|
||||
actions other than cleanups which need to be called before pivot.
|
||||
|
||||
=== Hook: cleanup
|
||||
|
||||
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.
|
||||
|
||||
|
||||
=== Cleanup and switch_root
|
||||
|
||||
Init (or systemd) kills all udev processes, cleans up the environment,
|
||||
sets up the arguments for the real init process and finally calls switch_root.
|
||||
switch_root removes the whole filesystem hierarchy of the initramfs,
|
||||
chroot()s to the real root device and calls /sbin/init with the specified arguments.
|
||||
|
||||
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.
|
||||
|
||||
== Network Infrastructure
|
||||
|
||||
FIXME
|
||||
|
||||
== Writing a Module
|
||||
|
||||
A simple example module is _96insmodpost_, which modprobes a kernel module after
|
||||
udev has settled and the basic device drivers have been loaded.
|
||||
|
||||
All module installation information is in the file module-setup.sh.
|
||||
|
||||
First we create a check() function, which just exits with 0 indicating that this
|
||||
module should be included by default.
|
||||
|
||||
check():
|
||||
----
|
||||
return 0
|
||||
----
|
||||
|
||||
The we create the install() function, which installs a cmdline hook with
|
||||
priority number 20 called _parse-insmodpost.sh_. It also installs the
|
||||
_insmodpost.sh_ script in _/sbin_.
|
||||
|
||||
install():
|
||||
----
|
||||
inst_hook cmdline 20 "$moddir/parse-insmodpost.sh"
|
||||
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
|
||||
----
|
||||
|
||||
The _pase-instmodpost.sh_ parses the kernel command line for a argument
|
||||
rd.driver.post, blacklists the module from being autoloaded and installs the
|
||||
hook _insmodpost.sh_ in the _initqueue/settled_.
|
||||
|
||||
_parse-insmodpost.sh_:
|
||||
----
|
||||
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
|
||||
|
||||
----
|
||||
|
||||
_insmodpost.sh_, which is called in the _initqueue/settled_ hook will just
|
||||
modprobe the kernel modules specified in all rd.driver.post kernel command line
|
||||
parameters. It runs after udev has settled and is only called once (--onetime).
|
||||
|
||||
_insmodpost.sh_:
|
||||
----
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
for p in $(getargs rd.driver.post=); do
|
||||
modprobe $p
|
||||
done
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
||||
=== check()
|
||||
|
||||
_check()_ is called by dracut to evaluate the inclusion of a dracut module in
|
||||
the initramfs.
|
||||
|
||||
$hostonly:: 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.
|
||||
|
||||
check() should return with:
|
||||
|
||||
0:: Include the dracut module in the initramfs.
|
||||
|
||||
1:: Do not include the dracut module. The requirements are not fullfilled
|
||||
(missing tools, etc.)
|
||||
|
||||
255:: Only include the dracut module, if another module requires it or if
|
||||
explicitly specified in the config file or on the argument list.
|
||||
|
||||
|
||||
|
||||
=== depends()
|
||||
|
||||
The function depends() should echo all other dracut module names the module
|
||||
depends on.
|
||||
|
||||
|
||||
|
||||
=== install()
|
||||
|
||||
inst_multiple
|
||||
|
||||
inst
|
||||
|
||||
inst_hook
|
||||
|
||||
inst_rules
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=== installkernel()
|
||||
|
||||
instmods
|
||||
|
||||
|
||||
|
||||
=== Creation Functions
|
||||
|
||||
FIXME
|
||||
|
||||
|
||||
=== Initramfs Functions
|
||||
|
||||
FIXME
|
||||
|
||||
|
||||
=== Network Modules
|
||||
|
||||
FIXME
|
||||
|
||||
:leveloffset: 1
|
||||
[[dracutbootup7]]
|
||||
include::dracut.bootup.7.asc[]
|
||||
|
||||
:leveloffset: 1
|
||||
[[dracut8]]
|
||||
include::dracut.8.asc[]
|
||||
|
||||
:leveloffset: 1
|
||||
[[dracutconf5]]
|
||||
include::dracut.conf.5.asc[]
|
||||
|
||||
@@ -1019,6 +165,15 @@ include::lsinitrd.1.asc[]
|
||||
[[mkinitrd8]]
|
||||
include::mkinitrd.8.asc[]
|
||||
|
||||
= Developer Manual
|
||||
|
||||
:leveloffset: 1
|
||||
[[dracutmodules7]]
|
||||
include::dracut.modules.7.asc[]
|
||||
|
||||
[[dracutbootup7]]
|
||||
include::dracut.bootup.7.asc[]
|
||||
|
||||
:leveloffset: 0
|
||||
[appendix]
|
||||
License
|
||||
|
@@ -11,7 +11,8 @@ dracut.bootup - boot ordering in the initramfs
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
This flow chart illustrates the ordering of the services, if systemd is used in the dracut initramfs.
|
||||
This flow chart illustrates the ordering of the services, if systemd is used in
|
||||
the dracut initramfs.
|
||||
----
|
||||
|
||||
systemd-journal.socket
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -10,17 +10,19 @@ dracut.conf - configuration file(s) for dracut
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
_/etc/dracut.conf_ _/etc/dracut.conf.d/*.conf_ _/usr/lib/dracut/dracut.conf.d/*.conf_
|
||||
_/etc/dracut.conf_ _/etc/dracut.conf.d/*.conf_
|
||||
_/usr/lib/dracut/dracut.conf.d/*.conf_
|
||||
|
||||
Description
|
||||
-----------
|
||||
_dracut.conf_ is loaded during the initialisation phase of dracut. Command line
|
||||
parameter will overwrite any values set here.
|
||||
|
||||
_*.conf_ files are read from /usr/lib/dracut/dracut.conf.d and /etc/dracut.conf.d.
|
||||
Files with the same name in /etc/dracut.conf.d will replace files in /usr/lib/dracut/dracut.conf.d.
|
||||
The files are then read in alphanumerical order and will overwrite parameters set in
|
||||
_/etc/dracut.conf_. Each line specifies an attribute and a value. A '#'
|
||||
_*.conf_ files are read from /usr/lib/dracut/dracut.conf.d and
|
||||
/etc/dracut.conf.d. Files with the same name in /etc/dracut.conf.d will replace
|
||||
files in /usr/lib/dracut/dracut.conf.d.
|
||||
The files are then read in alphanumerical order and will overwrite parameters
|
||||
set in _/etc/dracut.conf_. 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.
|
||||
|
||||
@@ -47,6 +49,10 @@ Configuration files must have the extension .conf; other extensions are ignored.
|
||||
Specify a space-separated list of kernel modules to add to the initramfs.
|
||||
The kernel modules have to be specified without the ".ko" suffix.
|
||||
|
||||
*force_drivers+=*" __<list of kernel modules>__ "::
|
||||
See add_drivers above. But in this case it is ensured that the drivers
|
||||
are tried to be loaded early via modprobe.
|
||||
|
||||
*omit_drivers+=*" __<kernel modules>__ "::
|
||||
Specify a space-separated list of kernel modules not to add to the
|
||||
initramfs. The kernel modules have to be specified without the ".ko" suffix.
|
||||
@@ -64,13 +70,23 @@ Configuration files must have the extension .conf; other extensions are ignored.
|
||||
*install_items+=*" __<file>__[ __<file>__ ...] "::
|
||||
Specify additional files to include in the initramfs, separated by spaces.
|
||||
|
||||
*install_optional_items+=*" __<file>__[ __<file>__ ...] "::
|
||||
Specify additional files to include in the initramfs, separated by spaces,
|
||||
if they exist.
|
||||
|
||||
*do_strip=*"__{yes|no}__"::
|
||||
Strip binaries in the initramfs (default=yes)
|
||||
|
||||
*do_prelink=*"__{yes|no}__"::
|
||||
Prelink binaries in the initramfs (default=yes)
|
||||
|
||||
*hostonly=*"__{yes|no}__"::
|
||||
Host-Only mode: Install only what is needed for booting the local host
|
||||
instead of a generic host and generate host-specific configuration.
|
||||
|
||||
*hostonly_cmdline*"__{yes|no}__"::
|
||||
If set, store the kernel command line arguments needed in the initramfs
|
||||
|
||||
*persistent_policy=*"__<policy>__"::
|
||||
Use _<policy>_ to address disks and partitions.
|
||||
_<policy>_ can be any directory name found in /dev/disk.
|
||||
@@ -81,7 +97,8 @@ Configuration files must have the extension .conf; other extensions are ignored.
|
||||
|
||||
[WARNING]
|
||||
====
|
||||
If chrooted to another root other than the real root device, use --fstab and provide a valid _/etc/fstab_.
|
||||
If chrooted to another root other than the real root device, use --fstab and
|
||||
provide a valid _/etc/fstab_.
|
||||
====
|
||||
|
||||
*use_fstab=*"__{yes|no}__"::
|
||||
@@ -119,9 +136,24 @@ If chrooted to another root other than the real root device, use --fstab and pro
|
||||
*kernel_only=*"__{yes|no}__"::
|
||||
Only install kernel drivers and firmware files. (default=no)
|
||||
|
||||
*no_kernel=*"{yes|no}"::
|
||||
*no_kernel=*"__{yes|no}__"::
|
||||
Do not install kernel drivers and firmware files (default=no)
|
||||
|
||||
*acpi_override=*"__{yes|no}__"::
|
||||
[WARNING] ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING! +
|
||||
Override BIOS provided ACPI tables. For further documentation read
|
||||
Documentation/acpi/initrd_table_override.txt in the kernel sources.
|
||||
Search for ACPI table files (must have .aml suffix) in acpi_table_dir=
|
||||
directory (see below) and add them to a separate uncompressed cpio
|
||||
archive. This cpio archive gets glued (concatenated, uncompressed one
|
||||
must be the first one) to the compressed cpio archive. The first,
|
||||
uncompressed cpio archive is for data which the kernel must be able
|
||||
to access very early (and cannot make use of uncompress alogrithms yet)
|
||||
like microcode or ACPI tables (default=no).
|
||||
|
||||
*acpi_table_dir=*"__<dir>__"::
|
||||
Directory to search for ACPI tables if acpi_override= is set to yes.
|
||||
|
||||
*early_microcode=*"{yes|no}"::
|
||||
Combine early microcode with ramdisk (default=no)
|
||||
|
||||
@@ -140,6 +172,23 @@ If chrooted to another root other than the real root device, use --fstab and pro
|
||||
*show_modules=*"__{yes|no}__"::
|
||||
Print the name of the included modules to standard output during build.
|
||||
|
||||
*i18n_vars="__<variable mapping>__"::
|
||||
Distribution specific variable mapping.
|
||||
See dracut/modules.d/10i18n/README for a detailed description.
|
||||
|
||||
*i18n_default_font=*"__<fontname>__"::
|
||||
The font <fontname> to install, if not specified otherwise.
|
||||
Default is "LatArCyrHeb-16".
|
||||
|
||||
*i18n_install_all=*"__{yes|no}__"::
|
||||
Install everything regardless of generic or hostonly mode.
|
||||
|
||||
*reproducible=*"__{yes|no}__"::
|
||||
Create reproducible images.
|
||||
|
||||
*loginstall=*"__<DIR>__"::
|
||||
Log all files installed from the host to _<DIR>_.
|
||||
|
||||
Files
|
||||
-----
|
||||
_/etc/dracut.conf_::
|
||||
|
@@ -2,13 +2,17 @@
|
||||
|
||||
# i18n
|
||||
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
|
||||
i18n_default_font="latarcyrheb-sun16"
|
||||
i18n_default_font="eurlatgr"
|
||||
i18n_install_all="yes"
|
||||
|
||||
|
||||
stdloglvl=3
|
||||
sysloglvl=5
|
||||
install_items+=" vi /etc/virc ps grep cat rm "
|
||||
install_optional_items+=" vi /etc/virc ps grep cat rm "
|
||||
prefix="/"
|
||||
systemdutildir=/usr/lib/systemd
|
||||
systemdsystemunitdir=/usr/lib/systemd/system
|
||||
systemdsystemconfdir=/etc/systemd/system
|
||||
udevdir=/usr/lib/udev
|
||||
hostonly="yes"
|
||||
early_microcode="yes"
|
||||
|
@@ -1,3 +1,24 @@
|
||||
# SUSE specifc dracut settings
|
||||
#
|
||||
# SUSE by default always builds a as small as possible initrd for performance
|
||||
# and resource reasons.
|
||||
# If you like to build a generic initrd which works on other platforms than
|
||||
# on the one dracut/mkinitrd got called comment out below setting(s).
|
||||
hostonly="yes"
|
||||
hostonly_cmdline="yes"
|
||||
|
||||
compress="xz -0 --check=crc32 --memlimit-compress=50%"
|
||||
|
||||
i18n_vars="/etc/sysconfig/language:RC_LANG-LANG,RC_LC_ALL-LC_ALL /etc/sysconfig/console:CONSOLE_UNICODEMAP-FONT_UNIMAP,CONSOLE_FONT-FONT,CONSOLE_SCREENMAP-FONT_MAP /etc/sysconfig/keyboard:KEYTABLE-KEYMAP"
|
||||
omit_drivers+=" i2o_scsi"
|
||||
|
||||
# Below adds additional tools to the initrd which are not urgently necessary to
|
||||
# bring up the system, but help to debug problems.
|
||||
# See /usr/lib/dracut/modules.d/95debug/module-setup.sh which additional tools
|
||||
# are installed and add more if you need them. This specifically helps if you
|
||||
# use:
|
||||
# rd.break=[cmdline|pre-udev|pre-trigger|initqueue|pre-mount|
|
||||
# mount|pre-pivot|cleanup]
|
||||
# boot parameter or if you are forced to enter the dracut emergency shell.
|
||||
|
||||
# add_dracutmodules+=debug
|
||||
|
1120
dracut.css
Normal file
1120
dracut.css
Normal file
File diff suppressed because it is too large
Load Diff
299
dracut.modules.7.asc
Normal file
299
dracut.modules.7.asc
Normal file
@@ -0,0 +1,299 @@
|
||||
DRACUT.MODULES(7)
|
||||
=================
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
|
||||
NAME
|
||||
----
|
||||
dracut.modules - dracut modules
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
dracut uses a modular system to build and extend the initramfs image. All
|
||||
modules are located in _/usr/lib/dracut/modules.d_ or in _<git-src>/modules.d_.
|
||||
The most basic dracut module is _99base_. In _99base_ the initial shell script
|
||||
init is defined, which gets run by the kernel after initramfs loading. Although
|
||||
you can replace init with your own version of _99base_, 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 <<stages>>.
|
||||
|
||||
The main script, which creates the initramfs is dracut itsself. It parses all
|
||||
arguments and sets up the directory, in which everything is installed. It then
|
||||
executes all check, install, installkernel 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 check, install and installkernel are found in in the file _dracut-functions_.
|
||||
These shell functions are available to all module installer (install,
|
||||
installkernel) scripts, without the need to source _dracut-functions_.
|
||||
|
||||
A module can check the preconditions for install and installkernel with the
|
||||
check script. Also dependencies can be expressed with check. If a module passed
|
||||
check, install and installkernel 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 installkernel. All
|
||||
other files found in a module directory are module specific and mostly are hook
|
||||
scripts and udev rules.
|
||||
|
||||
|
||||
[[stages]]
|
||||
== Boot Process Stages
|
||||
|
||||
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 init.
|
||||
Common used functions are in _dracut-lib.sh_, which can be sourced by any script.
|
||||
|
||||
=== Hook: cmdline
|
||||
|
||||
The _cmdline_ 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.
|
||||
|
||||
In this hook the most important environment variable is defined: root. The
|
||||
second one is rootok, which indicates, that a module claimed to be able to parse
|
||||
the root defined. So for example, **root=**__iscsi:....__ will be claimed by the
|
||||
iscsi dracut module, which then sets rootok.
|
||||
|
||||
=== Hook: pre-udev
|
||||
|
||||
This hook is executed right after the cmdline hook and a check if root and
|
||||
rootok were set. Here modules can take action with the final root, and before
|
||||
udev has been run.
|
||||
|
||||
=== Start Udev
|
||||
|
||||
Now udev is started and the logging for udev is setup.
|
||||
|
||||
=== Hook: pre-trigger
|
||||
|
||||
In this hook, you can set udev environment variables with **udevadm control
|
||||
--property=KEY=_value_** or control the further execution of udev with
|
||||
udevadm.
|
||||
|
||||
=== Trigger Udev
|
||||
|
||||
udev is triggered by calling udevadm trigger, which sends add events for all
|
||||
devices and subsystems.
|
||||
|
||||
=== Main Loop
|
||||
|
||||
In the main loop of dracut loops until udev has settled and
|
||||
all scripts in _initqueue/finished_ returned true.
|
||||
In this loop there are three hooks, where scripts can be inserted
|
||||
by calling /sbin/initqueue.
|
||||
|
||||
==== Initqueue
|
||||
|
||||
This hook gets executed every time a script is inserted here, regardless of the
|
||||
udev state.
|
||||
|
||||
==== Initqueue settled
|
||||
|
||||
This hooks (initqueue/settled) gets executed every time udev has settled.
|
||||
|
||||
==== Initqueue timeout
|
||||
|
||||
This hooks (initqueue/timeout) gets executed, when the main loop counter becomes
|
||||
half of the rd.retry counter.
|
||||
|
||||
==== Initqueue finished
|
||||
|
||||
This hook (initqueue/finished) is called after udev has settled and
|
||||
if all scripts herein return 0 the main loop will be ended.
|
||||
Abritary scripts can be added here, to loop in the
|
||||
initqueue until something happens, which a dracut module wants to wait for.
|
||||
|
||||
=== Hook: pre-mount
|
||||
|
||||
Before the root device is mounted all scripts in the hook pre-mount are
|
||||
executed. In some cases (e.g. NFS) the real root device is already mounted,
|
||||
though.
|
||||
|
||||
=== Hook: mount
|
||||
|
||||
This hook is mainly to mount the real root device.
|
||||
|
||||
=== Hook: pre-pivot
|
||||
|
||||
This hook is called before cleanup hook, This is a good place for
|
||||
actions other than cleanups which need to be called before pivot.
|
||||
|
||||
=== Hook: cleanup
|
||||
|
||||
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.
|
||||
|
||||
|
||||
=== Cleanup and switch_root
|
||||
|
||||
Init (or systemd) kills all udev processes, cleans up the environment,
|
||||
sets up the arguments for the real init process and finally calls switch_root.
|
||||
switch_root removes the whole filesystem hierarchy of the initramfs,
|
||||
chroot()s to the real root device and calls /sbin/init with the specified
|
||||
arguments.
|
||||
|
||||
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.
|
||||
|
||||
== Network Infrastructure
|
||||
|
||||
FIXME
|
||||
|
||||
== Writing a Module
|
||||
|
||||
A simple example module is _96insmodpost_, which modprobes a kernel module after
|
||||
udev has settled and the basic device drivers have been loaded.
|
||||
|
||||
All module installation information is in the file module-setup.sh.
|
||||
|
||||
First we create a check() function, which just exits with 0 indicating that this
|
||||
module should be included by default.
|
||||
|
||||
check():
|
||||
----
|
||||
return 0
|
||||
----
|
||||
|
||||
The we create the install() function, which installs a cmdline hook with
|
||||
priority number 20 called _parse-insmodpost.sh_. It also installs the
|
||||
_insmodpost.sh_ script in _/sbin_.
|
||||
|
||||
install():
|
||||
----
|
||||
inst_hook cmdline 20 "$moddir/parse-insmodpost.sh"
|
||||
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
|
||||
----
|
||||
|
||||
The _pase-instmodpost.sh_ parses the kernel command line for a argument
|
||||
rd.driver.post, blacklists the module from being autoloaded and installs the
|
||||
hook _insmodpost.sh_ in the _initqueue/settled_.
|
||||
|
||||
_parse-insmodpost.sh_:
|
||||
----
|
||||
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
|
||||
|
||||
----
|
||||
|
||||
_insmodpost.sh_, which is called in the _initqueue/settled_ hook will just
|
||||
modprobe the kernel modules specified in all rd.driver.post kernel command line
|
||||
parameters. It runs after udev has settled and is only called once (--onetime).
|
||||
|
||||
_insmodpost.sh_:
|
||||
----
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
for p in $(getargs rd.driver.post=); do
|
||||
modprobe $p
|
||||
done
|
||||
|
||||
----
|
||||
|
||||
|
||||
=== module-setup.sh: check()
|
||||
|
||||
_check()_ is called by dracut to evaluate the inclusion of a dracut module in
|
||||
the initramfs.
|
||||
|
||||
$hostonly:: 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.
|
||||
|
||||
check() should return with:
|
||||
|
||||
0:: Include the dracut module in the initramfs.
|
||||
|
||||
1:: Do not include the dracut module. The requirements are not fullfilled
|
||||
(missing tools, etc.)
|
||||
|
||||
255:: Only include the dracut module, if another module requires it or if
|
||||
explicitly specified in the config file or on the argument list.
|
||||
|
||||
|
||||
=== module-setup.sh: depends()
|
||||
|
||||
The function depends() should echo all other dracut module names the module
|
||||
depends on.
|
||||
|
||||
=== module-setup.sh: cmdline()
|
||||
|
||||
This function should print the kernel command line options needed to boot the
|
||||
current machine setup. It should start with a space and should not print a
|
||||
newline.
|
||||
|
||||
=== module-setup.sh: install()
|
||||
|
||||
The install() function is called to install everything non-kernel related.
|
||||
To install binaries, scripts, and other files, you can use the functions
|
||||
mentioned in <<creation>>.
|
||||
|
||||
To address a file in the current module directory, use the variable "$moddir".
|
||||
|
||||
=== module-setup.sh: installkernel()
|
||||
|
||||
In installkernel() all kernel related files should be installed. You can use all
|
||||
of the functions mentioned in <<creation>> to install files.
|
||||
|
||||
=== [[creation]]Creation Functions
|
||||
|
||||
==== inst_multiple [-o] <file> [ <file> ...]
|
||||
|
||||
installs multiple binaries and files. If executables are specified without a
|
||||
path, dracut will search the path PATH=/usr/sbin:/sbin:/usr/bin:/bin for the
|
||||
binary. If the option "-o" is given as the first parameter, a missing file does
|
||||
not lead to an error.
|
||||
|
||||
==== inst <src> [<dst>]
|
||||
|
||||
installs _one_ file <src> either to the same place in the initramfs or to an
|
||||
optional <dst>.
|
||||
|
||||
==== inst_hook <hookdir> <prio> <src>
|
||||
|
||||
installs an executable/script <src> in the dracut hook <hookdir> with priority
|
||||
<prio>.
|
||||
|
||||
==== inst_rules <udevrule> [ <udevrule> ...]
|
||||
|
||||
installs one ore more udev rules. Non-existant udev rules are reported, but do
|
||||
not let dracut fail.
|
||||
|
||||
==== instmods <kernelmodule> [ <kernelmodule> ... ]
|
||||
|
||||
instmods should be used only in the installkernel() function.
|
||||
|
||||
instmods installs one or more kernel modules in the initramfs. <kernelmodule>
|
||||
can also be a whole subsystem, if prefixed with a "=", like "=drivers/net/team".
|
||||
|
||||
instmods will not install the kernel module, if $hostonly is set and the kernel
|
||||
module is not currently needed by any /sys/*...*/uevent MODALIAS.
|
||||
To install a kernel module regardless of the hostonly mode use the form:
|
||||
----
|
||||
hostonly='' instmods <kernelmodule>
|
||||
----
|
||||
|
||||
=== Initramfs Functions
|
||||
|
||||
FIXME
|
||||
|
||||
|
||||
=== Network Modules
|
||||
|
||||
FIXME
|
||||
|
||||
AUTHOR
|
||||
------
|
||||
Harald Hoyer
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
*dracut*(8)
|
68
dracut.spec
68
dracut.spec
@@ -1,4 +1,5 @@
|
||||
%define dracutlibdir %{_prefix}/lib/dracut
|
||||
%bcond_without doc
|
||||
|
||||
# Variables must be defined
|
||||
%define with_nbd 1
|
||||
@@ -28,7 +29,9 @@ URL: https://dracut.wiki.kernel.org/
|
||||
|
||||
# Source can be generated by
|
||||
# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{version};sf=tgz
|
||||
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.bz2
|
||||
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.xz
|
||||
Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
|
||||
|
||||
|
||||
BuildRequires: bash git
|
||||
|
||||
@@ -45,6 +48,7 @@ BuildRequires: pkgconfig
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%endif
|
||||
|
||||
%if %{with doc}
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
BuildRequires: docbook-style-xsl docbook-dtds libxslt
|
||||
%endif
|
||||
@@ -54,6 +58,8 @@ BuildRequires: docbook-style-xsl docbook-dtds libxslt
|
||||
%endif
|
||||
|
||||
BuildRequires: asciidoc
|
||||
%endif
|
||||
|
||||
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel}
|
||||
# no "provides", because dracut does not offer
|
||||
@@ -97,16 +103,14 @@ Requires: util-linux >= 2.21
|
||||
Requires: systemd >= 199
|
||||
Requires: procps-ng
|
||||
Conflicts: grubby < 8.23
|
||||
Conflicts: initscripts < 8.63-1
|
||||
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
|
||||
Conflicts: bcache-tools < 0-0.14.20130909git
|
||||
%else
|
||||
Requires: udev > 166
|
||||
Requires: util-linux-ng >= 2.21
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
Conflicts: initscripts < 8.63-1
|
||||
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
|
||||
%endif
|
||||
|
||||
Conflicts: mdadm < 3.2.6-14
|
||||
|
||||
%description
|
||||
@@ -192,6 +196,7 @@ This package contains tools to assemble the local initrd and host configuration.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}
|
||||
cp %{SOURCE1} .
|
||||
|
||||
%if %{defined PATCH1}
|
||||
git init
|
||||
@@ -205,7 +210,10 @@ git am -p1 %{patches}
|
||||
%endif
|
||||
|
||||
%build
|
||||
%configure --systemdsystemunitdir=%{_unitdir} --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) --libdir=%{_prefix}/lib
|
||||
%configure --systemdsystemunitdir=%{_unitdir} --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) --libdir=%{_prefix}/lib \
|
||||
%if %{without doc}
|
||||
--disable-documentation
|
||||
%endif
|
||||
|
||||
make %{?_smp_mflags}
|
||||
|
||||
@@ -248,15 +256,18 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log
|
||||
touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/40-fips.conf
|
||||
rm -f $RPM_BUILD_ROOT%{_mandir}/man?/*suse*
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/40-fips.conf
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999
|
||||
rm -f -- $RPM_BUILD_ROOT%{_bindir}/mkinitrd
|
||||
rm -f -- $RPM_BUILD_ROOT%{_bindir}/lsinitrd
|
||||
@@ -271,19 +282,27 @@ echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-generic-i
|
||||
echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-rescue.conf
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
> $RPM_BUILD_ROOT/etc/system-fips
|
||||
%endif
|
||||
|
||||
# create compat symlink
|
||||
mkdir -p $RPM_BUILD_ROOT/sbin
|
||||
ln -s /usr/bin/dracut $RPM_BUILD_ROOT/sbin/dracut
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
|
||||
ln -sr $RPM_BUILD_ROOT%{_bindir}/dracut $RPM_BUILD_ROOT%{_sbindir}/dracut
|
||||
|
||||
%clean
|
||||
rm -rf -- $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,0755)
|
||||
%doc README HACKING TODO COPYING AUTHORS NEWS dracut.html dracut.png dracut.svg
|
||||
%if %{with doc}
|
||||
%doc README HACKING TODO AUTHORS NEWS dracut.html dracut.png dracut.svg
|
||||
%endif
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
%license COPYING lgpl-2.1.txt
|
||||
%{_bindir}/dracut
|
||||
# compat symlink
|
||||
/sbin/dracut
|
||||
%{_sbindir}/dracut
|
||||
%{_datadir}/bash-completion/completions/dracut
|
||||
%{_datadir}/bash-completion/completions/lsinitrd
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
|
||||
@@ -298,12 +317,15 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/dracut-logger.sh
|
||||
%{dracutlibdir}/dracut-initramfs-restore
|
||||
%{dracutlibdir}/dracut-install
|
||||
%{dracutlibdir}/skipcpio
|
||||
%config(noreplace) %{_sysconfdir}/dracut.conf
|
||||
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel}
|
||||
%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
%endif
|
||||
%dir %{_sysconfdir}/dracut.conf.d
|
||||
%dir %{dracutlibdir}/dracut.conf.d
|
||||
|
||||
%if %{with doc}
|
||||
%{_mandir}/man8/dracut.8*
|
||||
%{_mandir}/man8/*service.8*
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
|
||||
@@ -312,8 +334,11 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%endif
|
||||
%{_mandir}/man7/dracut.kernel.7*
|
||||
%{_mandir}/man7/dracut.cmdline.7*
|
||||
%{_mandir}/man7/dracut.modules.7*
|
||||
%{_mandir}/man7/dracut.bootup.7*
|
||||
%{_mandir}/man5/dracut.conf.5*
|
||||
%endif
|
||||
|
||||
%if %{defined _unitdir}
|
||||
%{dracutlibdir}/modules.d/00systemd-bootchart
|
||||
%else
|
||||
@@ -330,7 +355,6 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/modules.d/50drm
|
||||
%{dracutlibdir}/modules.d/50plymouth
|
||||
%{dracutlibdir}/modules.d/80cms
|
||||
%{dracutlibdir}/modules.d/90bcache
|
||||
%{dracutlibdir}/modules.d/90btrfs
|
||||
%{dracutlibdir}/modules.d/90crypt
|
||||
%{dracutlibdir}/modules.d/90dm
|
||||
@@ -348,8 +372,10 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/modules.d/95rootfs-block
|
||||
%{dracutlibdir}/modules.d/95dasd
|
||||
%{dracutlibdir}/modules.d/95dasd_mod
|
||||
%{dracutlibdir}/modules.d/95dasd_rules
|
||||
%{dracutlibdir}/modules.d/95fstab-sys
|
||||
%{dracutlibdir}/modules.d/95zfcp
|
||||
%{dracutlibdir}/modules.d/95zfcp_rules
|
||||
%{dracutlibdir}/modules.d/95terminfo
|
||||
%{dracutlibdir}/modules.d/95udev-rules
|
||||
%{dracutlibdir}/modules.d/95virtfs
|
||||
@@ -373,7 +399,7 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%dir %{_sharedstatedir}/initramfs
|
||||
%if %{defined _unitdir}
|
||||
%{_unitdir}/dracut-shutdown.service
|
||||
%{_unitdir}/shutdown.target.wants/dracut-shutdown.service
|
||||
%{_unitdir}/sysinit.target.wants/dracut-shutdown.service
|
||||
%{_unitdir}/dracut-cmdline.service
|
||||
%{_unitdir}/dracut-initqueue.service
|
||||
%{_unitdir}/dracut-mount.service
|
||||
@@ -407,17 +433,19 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/modules.d/95ssh-client
|
||||
%{dracutlibdir}/modules.d/45ifcfg
|
||||
%{dracutlibdir}/modules.d/95znet
|
||||
%{dracutlibdir}/modules.d/95fcoe-uefi
|
||||
%{dracutlibdir}/modules.d/99uefi-lib
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
%files fips
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/modules.d/01fips
|
||||
%{dracutlibdir}/dracut.conf.d/40-fips.conf
|
||||
%config(missingok) /etc/system-fips
|
||||
%endif
|
||||
|
||||
%files fips-aesni
|
||||
%defattr(-,root,root,0755)
|
||||
%doc COPYING
|
||||
%{dracutlibdir}/modules.d/02fips-aesni
|
||||
|
||||
%files caps
|
||||
@@ -426,7 +454,11 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
|
||||
%files tools
|
||||
%defattr(-,root,root,0755)
|
||||
%{_mandir}/man8/dracut-catimages.8*
|
||||
|
||||
%if %{with doc}
|
||||
%doc %{_mandir}/man8/dracut-catimages.8*
|
||||
%endif
|
||||
|
||||
%{_bindir}/dracut-catimages
|
||||
%dir /boot/dracut
|
||||
%dir /var/lib/dracut
|
||||
|
522
dracut.usage.asc
Normal file
522
dracut.usage.asc
Normal file
@@ -0,0 +1,522 @@
|
||||
To create a initramfs image, the most simple command is:
|
||||
----
|
||||
# dracut
|
||||
----
|
||||
|
||||
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-_++<kernel version>++_.img and
|
||||
contains the kernel modules of the currently active kernel with version
|
||||
_++<kernel version>++_.
|
||||
|
||||
If the initramfs image already exists, dracut will display an error message, and
|
||||
to overwrite the existing image, you have to use the --force option.
|
||||
----
|
||||
# dracut --force
|
||||
----
|
||||
|
||||
If you want to specify another filename for the resulting image you would issue
|
||||
a command like:
|
||||
----
|
||||
# dracut foobar.img
|
||||
----
|
||||
|
||||
To generate an image for a specific kernel version, the command would be:
|
||||
----
|
||||
# dracut foobar.img 2.6.40-1.rc5.f20
|
||||
----
|
||||
|
||||
A shortcut to generate the image at the default location for a specific kernel
|
||||
version is:
|
||||
----
|
||||
# dracut --kver 2.6.40-1.rc5.f20
|
||||
----
|
||||
|
||||
If you want to create lighter, smaller initramfs images, you may want to specify
|
||||
the --hostonly or -H option. Using this option, the resulting image will
|
||||
contain only those dracut modules, kernel modules and filesystems, which are
|
||||
needed to boot this specific machine. This has the drawback, that you can't put
|
||||
the disk on another controller or machine, and that you can't switch to another
|
||||
root filesystem, without recreating the initramfs image. The usage of the
|
||||
--hostonly option is only for experts and you will have to keep the broken
|
||||
pieces. At least keep a copy of a general purpose image (and corresponding
|
||||
kernel) as a fallback to rescue your system.
|
||||
|
||||
=== Inspecting the Contents
|
||||
To see the contents of the image created by dracut, you can use the lsinitrd
|
||||
tool.
|
||||
----
|
||||
# lsinitrd | less
|
||||
----
|
||||
|
||||
To display the contents of a file in the initramfs also use the lsinitrd tool:
|
||||
----
|
||||
# lsinitrd -f /etc/ld.so.conf
|
||||
include ld.so.conf.d/*.conf
|
||||
----
|
||||
|
||||
=== Adding dracut Modules
|
||||
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
|
||||
_/etc/dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_. See *dracut.conf*(5).
|
||||
You can also add dracut modules on the command line
|
||||
by using the -a or --add option:
|
||||
----
|
||||
# dracut --add bootchart initramfs-bootchart.img
|
||||
----
|
||||
|
||||
To see a list of available dracut modules, use the --list-modules option:
|
||||
----
|
||||
# dracut --list-modules
|
||||
----
|
||||
|
||||
=== Omitting dracut Modules
|
||||
Sometimes you don't want a dracut module to be included for reasons of speed,
|
||||
size or functionality. To do this, either specify the omit_dracutmodules
|
||||
variable in the _dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_ configuration
|
||||
file (see *dracut.conf*(5)), or use the -o or --omit option
|
||||
on the command line:
|
||||
----
|
||||
# dracut -o "multipath lvm" no-multipath-lvm.img
|
||||
----
|
||||
|
||||
=== Adding Kernel Modules
|
||||
If you need a special kernel module in the initramfs, which is not
|
||||
automatically picked up by dracut, you have the use the --add-drivers option
|
||||
on the command line or the drivers vaiable in the _/etc/dracut.conf_
|
||||
or _/etc/dracut.conf.d/myconf.conf_ configuration file (see *dracut.conf*(5)):
|
||||
----
|
||||
# dracut --add-drivers mymod initramfs-with-mymod.img
|
||||
----
|
||||
|
||||
=== Boot parameters
|
||||
An initramfs generated without the "hostonly" mode, 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 LABEL or UUID on the kernel command line for your root device, dracut
|
||||
will find it and boot from it.
|
||||
|
||||
The kernel command line usually can be configured in _/boot/grub/grub.conf_ or
|
||||
_/boot/grub2/grub.cfg_, if grub is your bootloader and it also can be edited in
|
||||
the real boot process in the grub menu.
|
||||
|
||||
The kernel command line can also be provided by the dhcp server with the
|
||||
root-path option. See <<NetworkBoot>>.
|
||||
|
||||
For a full reference of all kernel command line parameters,
|
||||
see *dracut.cmdline*(5).
|
||||
|
||||
To get a quick start for the suitable kernel command line on your system,
|
||||
use the __--print-cmdline__ option:
|
||||
----
|
||||
# dracut --print-cmdline
|
||||
root=UUID=8b8b6f91-95c7-4da2-831b-171e12179081 rootflags=rw,relatime,discard,data=ordered rootfstype=ext4
|
||||
----
|
||||
|
||||
==== Specifying the root Device
|
||||
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 root= option. The most basic one is root=_++<path to device
|
||||
node>++_:
|
||||
----
|
||||
root=/dev/sda2
|
||||
----
|
||||
|
||||
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:
|
||||
----
|
||||
root=UUID=19e9dda3-5a38-484d-a9b0-fa6b067d0331
|
||||
----
|
||||
|
||||
or
|
||||
|
||||
----
|
||||
root=LABEL=myrootpartitionlabel
|
||||
----
|
||||
|
||||
To see all UUIDs or LABELs on your system, do:
|
||||
----
|
||||
# ls -l /dev/disk/by-uuid
|
||||
----
|
||||
|
||||
or
|
||||
|
||||
----
|
||||
# ls -l /dev/disk/by-label
|
||||
----
|
||||
|
||||
If your root partition is on the network see <<NetworkBoot>>.
|
||||
|
||||
==== Keyboard Settings
|
||||
If you have to input passwords for encrypted disk volumes, you might want to set
|
||||
the keyboard layout and specify a display font.
|
||||
|
||||
A typical german kernel command would contain:
|
||||
----
|
||||
rd.vconsole.font=latarcyrheb-sun16 rd.vconsole.keymap=de-latin1-nodeadkeys rd.locale.LANG=de_DE.UTF-8
|
||||
----
|
||||
|
||||
Setting these options can override the setting stored on your system, if you use
|
||||
a modern init system, like systemd.
|
||||
|
||||
==== Blacklisting Kernel Modules
|
||||
Sometimes it is required to prevent the automatic kernel module loading of a
|
||||
specific kernel module. To do this, just add rd.blacklist=_++<kernel module
|
||||
name>++_, with _++<kernel module name>++_ not containing the _.ko_
|
||||
suffix, to the kernel command line. For example:
|
||||
----
|
||||
rd.driver.blacklist=mptsas rd.driver.blacklist=nouveau
|
||||
----
|
||||
|
||||
The option can be specified multiple times on the kernel command line.
|
||||
|
||||
==== Speeding up the Boot Process
|
||||
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 LVM volume or not on a raid partition, or
|
||||
that it lives inside a specific crypto LUKS encrypted volume. By default, dracut
|
||||
searches everywhere. A typical dracut kernel command line for a plain primary or
|
||||
logical partition would contain:
|
||||
----
|
||||
rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0
|
||||
----
|
||||
|
||||
This turns off every automatic assembly of LVM, MD raids, DM raids and
|
||||
crypto LUKS.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
[[Injecting]]
|
||||
=== Injecting custom Files
|
||||
To add your own files to the initramfs image, you have several possibilities.
|
||||
|
||||
The --include option let you specify a source path and a target path.
|
||||
For example
|
||||
----
|
||||
# dracut --include cmdline-preset /etc/cmdline.d/mycmdline.conf initramfs-cmdline-pre.img
|
||||
----
|
||||
will create an initramfs image, where the file cmdline-preset will be copied
|
||||
inside the initramfs to _/etc/cmdline.d/mycmdline.conf_. --include can only
|
||||
be specified once.
|
||||
|
||||
|
||||
----
|
||||
# mkdir -p rd.live.overlay/etc/cmdline.d
|
||||
# mkdir -p rd.live.overlay/etc/conf.d
|
||||
# echo "ip=dhcp" >> rd.live.overlay/etc/cmdline.d/mycmdline.conf
|
||||
# echo export FOO=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
|
||||
# echo export BAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
|
||||
# tree rd.live.overlay/
|
||||
rd.live.overlay/
|
||||
`-- etc
|
||||
|-- cmdline.d
|
||||
| `-- mycmdline.conf
|
||||
`-- conf.d
|
||||
`-- testvar.conf
|
||||
|
||||
# dracut --include rd.live.overlay / initramfs-rd.live.overlay.img
|
||||
----
|
||||
|
||||
This will put the contents of the rd.live.overlay directory into the root of the
|
||||
initramfs image.
|
||||
|
||||
The --install 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.
|
||||
|
||||
|
||||
----
|
||||
# dracut --install 'strace fsck.ext3 ssh' initramfs-dbg.img
|
||||
----
|
||||
|
||||
This will create an initramfs with the strace, fsck.ext3 and ssh executables,
|
||||
together with the libraries needed to start those. The --install option can be
|
||||
specified multiple times.
|
||||
|
||||
|
||||
[[NetworkBoot]]
|
||||
=== Network Boot
|
||||
|
||||
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.
|
||||
|
||||
If you specify ip=dhcp on the kernel command line, then dracut asks a dhcp
|
||||
server about the ip adress for the machine. The dhcp server can also serve an
|
||||
additional root-path, which will set the root device for dracut. With this
|
||||
mechanism, you have static configuration on your client machine and a
|
||||
centralized boot configuration on your TFTP/DHCP server. If you can't pass a
|
||||
kernel command line, then you can inject _/etc/cmdline.d/mycmdline.conf_, with a
|
||||
method described in <<Injecting>>.
|
||||
|
||||
==== Reducing the Image Size
|
||||
|
||||
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.
|
||||
|
||||
You can also specify the exact dracut and kernel modules to produce a very tiny
|
||||
initramfs image.
|
||||
|
||||
For example for a NFS image, you would do:
|
||||
|
||||
|
||||
----
|
||||
# dracut -m "nfs network base" initramfs-nfs-only.img
|
||||
----
|
||||
|
||||
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 --host-only option:
|
||||
|
||||
|
||||
----
|
||||
# dracut -m "nfs network base" --host-only initramfs-nfs-host-only.img
|
||||
----
|
||||
|
||||
This will reduce the size of the initramfs image significantly.
|
||||
|
||||
|
||||
== Troubleshooting
|
||||
|
||||
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:
|
||||
https://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html
|
||||
|
||||
|
||||
[[identifying-your-problem-area]]
|
||||
=== Identifying your problem area
|
||||
. Remove ''rhgb'' and ''quiet'' from the kernel command line
|
||||
. Add ''rd.shell'' to the kernel command line. This will present a shell should
|
||||
dracut be unable to locate your root device
|
||||
. Add ''rd.shell rd.debug log_buf_len=1M'' to the kernel command line so that
|
||||
dracut shell commands are printed as they are executed
|
||||
. The file /run/initramfs/rdsosreport.txt is generated,
|
||||
which contains all the logs and the output of all significant tools, which are
|
||||
mentioned later.
|
||||
|
||||
If you want to save that output, simply mount /boot by hand or insert an USB
|
||||
stick and mount that. Then you can store the output for later inspection.
|
||||
|
||||
[[information-to-include-in-your-report]]
|
||||
=== Information to include in your report
|
||||
|
||||
[[all-bug-reports]]
|
||||
==== All bug reports
|
||||
In all cases, the following should be mentioned and attached to your bug report:
|
||||
|
||||
* The exact kernel command-line used. Typically from the bootloader
|
||||
configuration file (e.g. _/etc/grub.conf_) or from _/proc/cmdline_.
|
||||
* A copy of your disk partition information from _/etc/fstab_, which might be
|
||||
obtained booting an old working initramfs or a rescue medium.
|
||||
* Turn on dracut debugging (see _the 'debugging dracut' section_), and attach
|
||||
the file /run/initramfs/rdsosreport.txt.
|
||||
* If you use a dracut configuration file, please include _/etc/dracut.conf_ and
|
||||
all files in _/etc/dracut.conf.d/*.conf_
|
||||
|
||||
[[network-root-device-related-problems]]
|
||||
==== Network root device related problems
|
||||
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 <<all-bug-reports>>, include the
|
||||
following information:
|
||||
|
||||
|
||||
* Please include the output of
|
||||
+
|
||||
----
|
||||
# /sbin/ifup <interfacename>
|
||||
# ip addr show
|
||||
----
|
||||
|
||||
[[debugging-dracut]]
|
||||
=== Debugging dracut
|
||||
|
||||
|
||||
[[configure-a-serial-console]]
|
||||
==== Configure a serial console
|
||||
|
||||
Successfully debugging dracut will require some form of console
|
||||
logging during the system boot. This section documents configuring a
|
||||
serial console connection to record boot messages.
|
||||
|
||||
. First, enable serial console output for both the kernel and the bootloader.
|
||||
. Open the file _/etc/grub.conf_ for editing. Below the line ''timeout=5'', add
|
||||
the following:
|
||||
+
|
||||
----
|
||||
serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
----
|
||||
+
|
||||
. Also in _/etc/grub.conf_, add the following boot arguemnts to the ''kernel''
|
||||
line:
|
||||
+
|
||||
----
|
||||
console=tty0 console=ttyS0,9600
|
||||
----
|
||||
+
|
||||
. When finished, the _/etc/grub.conf_ file should look similar to the example
|
||||
below.
|
||||
+
|
||||
----
|
||||
default=0
|
||||
timeout=5
|
||||
serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
title Fedora (2.6.29.5-191.fc11.x86_64)
|
||||
root (hd0,0)
|
||||
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 console=ttyS0,9600
|
||||
initrd /dracut-2.6.29.5-191.fc11.x86_64.img
|
||||
----
|
||||
+
|
||||
. More detailed information on how to configure the kernel for console output
|
||||
can be found at
|
||||
http://www.faqs.org/docs/Linux-HOWTO/Remote-Serial-Console-HOWTO.html#CONFIGURE-KERNEL.
|
||||
. Redirecting non-interactive output
|
||||
+
|
||||
--
|
||||
NOTE: You can redirect all non-interactive output to _/dev/kmsg_ and the kernel
|
||||
will put it out on the console when it reaches the kernel buffer by doing
|
||||
|
||||
----
|
||||
# exec >/dev/kmsg 2>&1 </dev/console
|
||||
----
|
||||
--
|
||||
|
||||
[[using-the-dracut-shell]]
|
||||
==== Using the dracut shell
|
||||
|
||||
dracut offers a shell for interactive debugging in the event dracut fails to
|
||||
locate your root filesystem. To enable the shell:
|
||||
|
||||
. Add the boot parameter ''rd.shell'' to your bootloader configuration file
|
||||
(e.g. _/etc/grub.conf_)
|
||||
. Remove the boot arguments ''rhgb'' and ''quiet''
|
||||
+
|
||||
A sample _/etc/grub.conf_ bootloader configuration file is listed below.
|
||||
+
|
||||
----
|
||||
default=0
|
||||
timeout=5
|
||||
serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
title Fedora (2.6.29.5-191.fc11.x86_64)
|
||||
root (hd0,0)
|
||||
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
|
||||
initrd /dracut-2.6.29.5-191.fc11.x86_64.img
|
||||
----
|
||||
+
|
||||
. If system boot fails, you will be dropped into a shell as seen in the example
|
||||
below.
|
||||
+
|
||||
----
|
||||
No root device found
|
||||
Dropping to debug shell.
|
||||
|
||||
#
|
||||
----
|
||||
+
|
||||
. Use this shell prompt to gather the information requested above
|
||||
(see <<all-bug-reports>>).
|
||||
|
||||
[[accessing-the-root-volume-from-the-dracut-shell]]
|
||||
==== Accessing the root volume from the dracut shell
|
||||
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:
|
||||
|
||||
* A block device (e.g. _/dev/sda7_)
|
||||
* A LVM logical volume (e.g. _/dev/VolGroup00/LogVol00_)
|
||||
* An encrypted device
|
||||
(e.g. _/dev/mapper/luks-4d5972ea-901c-4584-bd75-1da802417d83_)
|
||||
* A network attached device
|
||||
(e.g. _netroot=iscsi:@192.168.0.4::3260::iqn.2009-02.org.example:for.all_)
|
||||
|
||||
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 _/dev/root_ 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.
|
||||
|
||||
. Inspect your partitions using parted
|
||||
+
|
||||
----
|
||||
# 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
|
||||
----
|
||||
+
|
||||
. You recall that your root volume was a LVM logical volume. Scan and activate
|
||||
any logical volumes.
|
||||
+
|
||||
----
|
||||
# lvm vgscan
|
||||
# lvm vgchange -ay
|
||||
----
|
||||
+
|
||||
. You should see any logical volumes now using the command blkid:
|
||||
+
|
||||
----
|
||||
# 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"
|
||||
----
|
||||
+
|
||||
. 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.
|
||||
+
|
||||
----
|
||||
# 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.
|
||||
----
|
||||
+
|
||||
. Next, make a symbolic link to the unlocked root volume
|
||||
+
|
||||
----
|
||||
# ln -s /dev/mapper/luks-$UUID /dev/root
|
||||
----
|
||||
+
|
||||
. With the root volume available, you may continue booting the system by exiting
|
||||
the dracut shell
|
||||
+
|
||||
----
|
||||
# exit
|
||||
----
|
||||
|
||||
[[additional-dracut-boot-parameters]]
|
||||
==== Additional dracut boot parameters
|
||||
For more debugging options, see *dracut.cmdline*(7).
|
||||
|
||||
|
||||
[[debugging-dracut-on-shutdown]]
|
||||
==== Debugging dracut on shutdown
|
||||
|
||||
To debug the shutdown sequence on systemd systems, you can _rd.break_
|
||||
on _pre-shutdown_ or _shutdown_.
|
||||
|
||||
To do this from an already booted system:
|
||||
----
|
||||
# mkdir -p /run/initramfs/etc/cmdline.d
|
||||
# echo "rd.debug rd.break=pre-shutdown rd.break=shutdown" > /run/initramfs/etc/cmdline.d/debug.conf
|
||||
# touch /run/initramfs/.need_shutdown
|
||||
----
|
||||
|
||||
This will give you a dracut shell after the system pivot'ed back in the
|
||||
initramfs.
|
||||
|
1
install/.kateconfig
Normal file
1
install/.kateconfig
Normal file
@@ -0,0 +1 @@
|
||||
kate: space-indent on; tab-width 8; indent-width 8; replace-tabs on; eol unix;
|
@@ -1,5 +1,3 @@
|
||||
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
|
||||
/* dracut-install.c -- install files and executables
|
||||
|
||||
Copyright (C) 2012 Harald Hoyer
|
||||
@@ -44,6 +42,7 @@
|
||||
#include "log.h"
|
||||
#include "hashmap.h"
|
||||
#include "util.h"
|
||||
#include "strv.h"
|
||||
|
||||
static bool arg_hmac = false;
|
||||
static bool arg_createdir = false;
|
||||
@@ -52,8 +51,11 @@ static bool arg_optional = false;
|
||||
static bool arg_all = false;
|
||||
static bool arg_resolvelazy = false;
|
||||
static bool arg_resolvedeps = false;
|
||||
static bool arg_hostonly = false;
|
||||
static char *destrootdir = NULL;
|
||||
|
||||
static char *logdir = NULL;
|
||||
static char *logfile = NULL;
|
||||
FILE *logfile_f = NULL;
|
||||
static Hashmap *items = NULL;
|
||||
static Hashmap *items_failed = NULL;
|
||||
|
||||
@@ -63,12 +65,12 @@ static size_t dir_len(char const *file)
|
||||
{
|
||||
size_t length;
|
||||
|
||||
if(!file)
|
||||
if (!file)
|
||||
return 0;
|
||||
|
||||
/* Strip the basename and any redundant slashes before it. */
|
||||
for (length = strlen(file)-1; 0 < length; length--)
|
||||
if (file[length] == '/' && file[length-1] != '/')
|
||||
for (length = strlen(file) - 1; 0 < length; length--)
|
||||
if (file[length] == '/' && file[length - 1] != '/')
|
||||
break;
|
||||
return length;
|
||||
}
|
||||
@@ -101,9 +103,9 @@ static char *convert_abs_rel(const char *from, const char *target)
|
||||
/* dir_len() skips double /'s e.g. //lib64, so we can't skip just one
|
||||
* character - need to skip all leading /'s */
|
||||
rl = strlen(target);
|
||||
for (i = dirlen+1; i < rl; ++i)
|
||||
if (target_dir_p[i] != '/')
|
||||
break;
|
||||
for (i = dirlen + 1; i < rl; ++i)
|
||||
if (target_dir_p[i] != '/')
|
||||
break;
|
||||
ret = asprintf(&realtarget, "%s/%s", realpath_p, &target_dir_p[i]);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
@@ -220,7 +222,8 @@ static int cp(const char *src, const char *dst)
|
||||
if (ret == 0) {
|
||||
struct timeval tv[2];
|
||||
if (fchown(dest_desc, sb.st_uid, sb.st_gid) != 0)
|
||||
fchown(dest_desc, (__uid_t)-1, sb.st_gid);
|
||||
if(fchown(dest_desc, (__uid_t) - 1, sb.st_gid) != 0)
|
||||
log_error("Failed to chown %s: %m", dst);
|
||||
tv[0].tv_sec = sb.st_atime;
|
||||
tv[0].tv_usec = 0;
|
||||
tv[1].tv_sec = sb.st_mtime;
|
||||
@@ -239,14 +242,16 @@ static int cp(const char *src, const char *dst)
|
||||
normal_copy:
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode,timestamps", "-fL", src, dst, NULL);
|
||||
execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode,timestamps", "-fL", src, dst,
|
||||
NULL);
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
while (waitpid(pid, &ret, 0) < 0) {
|
||||
if (errno != EINTR) {
|
||||
ret = -1;
|
||||
log_error("Failed: cp --reflink=auto --sparse=auto --preserve=mode,timestamps -fL %s %s", src, dst);
|
||||
log_error("Failed: cp --reflink=auto --sparse=auto --preserve=mode,timestamps -fL %s %s", src,
|
||||
dst);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -286,7 +291,7 @@ static int library_install(const char *src, const char *lib)
|
||||
libc.so.6 (libc6,64bit, hwcap: 0x0000001000000000, OS ABI: Linux 2.6.32) => /lib64/power6/libc.so.6
|
||||
libc.so.6 (libc6,64bit, hwcap: 0x0000000000000200, OS ABI: Linux 2.6.32) => /lib64/power6x/libc.so.6
|
||||
libc.so.6 (libc6,64bit, OS ABI: Linux 2.6.32) => /lib64/libc.so.6
|
||||
*/
|
||||
*/
|
||||
|
||||
free(p);
|
||||
p = strdup(lib);
|
||||
@@ -324,18 +329,25 @@ static int resolve_deps(const char *src)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
_cleanup_free_ char *buf = malloc(LINE_MAX);
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
size_t linesize = LINE_MAX;
|
||||
_cleanup_pclose_ FILE *fptr = NULL;
|
||||
_cleanup_free_ char *cmd = NULL;
|
||||
|
||||
buf = malloc(LINE_MAX);
|
||||
if (buf == NULL)
|
||||
return -errno;
|
||||
|
||||
if (strstr(src, ".so") == 0) {
|
||||
_cleanup_close_ int fd = -1;
|
||||
fd = open(src, O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0)
|
||||
return -errno;
|
||||
|
||||
read(fd, buf, LINE_MAX);
|
||||
ret = read(fd, buf, LINE_MAX);
|
||||
if (ret == -1)
|
||||
return -errno;
|
||||
|
||||
buf[LINE_MAX - 1] = '\0';
|
||||
if (buf[0] == '#' && buf[1] == '!') {
|
||||
/* we have a shebang */
|
||||
@@ -363,7 +375,7 @@ static int resolve_deps(const char *src)
|
||||
fptr = popen(cmd, "r");
|
||||
|
||||
while (!feof(fptr)) {
|
||||
char *p, *q;
|
||||
char *p;
|
||||
|
||||
if (getline(&buf, &linesize, fptr) <= 0)
|
||||
continue;
|
||||
@@ -372,7 +384,7 @@ static int resolve_deps(const char *src)
|
||||
|
||||
if (strstr(buf, "you do not have execution permission")) {
|
||||
log_error("%s", buf);
|
||||
ret+=1;
|
||||
ret += 1;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -391,8 +403,14 @@ static int resolve_deps(const char *src)
|
||||
if (strstr(buf, destrootdir))
|
||||
break;
|
||||
|
||||
p = strchr(buf, '/');
|
||||
p = strstr(buf, "=>");
|
||||
if (!p)
|
||||
p = buf;
|
||||
|
||||
p = strchr(p, '/');
|
||||
if (p) {
|
||||
char *q;
|
||||
|
||||
for (q = p; *q && *q != ' ' && *q != '\n'; q++) ;
|
||||
*q = '\0';
|
||||
|
||||
@@ -421,7 +439,7 @@ static int hmac_install(const char *src, const char *dst, const char *hmacpath)
|
||||
if (endswith(src, ".hmac"))
|
||||
return 0;
|
||||
|
||||
if (!hmacpath) {
|
||||
if (!hmacpath) {
|
||||
hmac_install(src, dst, "/lib/fipscheck");
|
||||
hmac_install(src, dst, "/lib64/fipscheck");
|
||||
hmac_install(src, dst, "/lib/hmaccalc");
|
||||
@@ -460,6 +478,36 @@ static int hmac_install(const char *src, const char *dst, const char *hmacpath)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mark_hostonly(const char *path)
|
||||
{
|
||||
_cleanup_free_ char *fulldstpath = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
int ret;
|
||||
|
||||
ret = asprintf(&fulldstpath, "%s/lib/dracut/hostonly-files", destrootdir);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
f = fopen(fulldstpath, "a");
|
||||
|
||||
if (f == NULL) {
|
||||
log_error("Could not open '%s' for writing.", fulldstpath);
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(f, "%s\n", path);
|
||||
}
|
||||
|
||||
void dracut_log_cp(const char *path)
|
||||
{
|
||||
int ret;
|
||||
ret = fprintf(logfile_f, "%s\n", path);
|
||||
if (ret < 0)
|
||||
log_error("Could not append '%s' to logfile '%s': %m", path, logfile);
|
||||
}
|
||||
|
||||
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst)
|
||||
{
|
||||
struct stat sb, db;
|
||||
@@ -621,7 +669,13 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
|
||||
log_debug("dracut_install ret = %d", ret);
|
||||
log_info("cp '%s' '%s'", src, fulldstpath);
|
||||
|
||||
if (arg_hostonly)
|
||||
mark_hostonly(dst);
|
||||
|
||||
ret += cp(src, fulldstpath);
|
||||
if (ret == 0 && logfile_f)
|
||||
dracut_log_cp(src);
|
||||
|
||||
log_debug("dracut_install ret = %d", ret);
|
||||
|
||||
@@ -635,8 +689,8 @@ static void item_free(char *i)
|
||||
}
|
||||
|
||||
static void usage(int status)
|
||||
{
|
||||
/* */
|
||||
{
|
||||
/* */
|
||||
printf("Usage: %s -D DESTROOTDIR [OPTION]... -a SOURCE...\n"
|
||||
"or: %s -D DESTROOTDIR [OPTION]... SOURCE DEST\n"
|
||||
"\n"
|
||||
@@ -647,6 +701,7 @@ static void usage(int status)
|
||||
" -o --optional If SOURCE does not exist, do not fail\n"
|
||||
" -d --dir SOURCE is a directory\n"
|
||||
" -l --ldd Also install shebang executables and libraries\n"
|
||||
" -L --logdir <DIR> Log files, which were installed from the host to <DIR>\n"
|
||||
" -R --resolvelazy Only install shebang executables and libraries\n"
|
||||
" for all SOURCE files\n"
|
||||
" -H --fips Also install all '.SOURCE.hmac' files\n"
|
||||
@@ -676,8 +731,8 @@ static void usage(int status)
|
||||
" |-- libdl.so -> libdl-2.15.90.so\n"
|
||||
" |-- libdl.so.2 -> libdl-2.15.90.so\n"
|
||||
" |-- libtinfo.so.5 -> libtinfo.so.5.9\n"
|
||||
" `-- libtinfo.so.5.9\n"
|
||||
, program_invocation_short_name, program_invocation_short_name, program_invocation_short_name);
|
||||
" `-- libtinfo.so.5.9\n", program_invocation_short_name, program_invocation_short_name,
|
||||
program_invocation_short_name);
|
||||
exit(status);
|
||||
}
|
||||
|
||||
@@ -699,13 +754,15 @@ static int parse_argv(int argc, char *argv[])
|
||||
{"ldd", no_argument, NULL, 'l'},
|
||||
{"resolvelazy", no_argument, NULL, 'R'},
|
||||
{"optional", no_argument, NULL, 'o'},
|
||||
{"hostonly", no_argument, NULL, 'H'},
|
||||
{"all", no_argument, NULL, 'a'},
|
||||
{"fips", no_argument, NULL, 'H'},
|
||||
{"fips", no_argument, NULL, 'f'},
|
||||
{"destrootdir", required_argument, NULL, 'D'},
|
||||
{"logdir", required_argument, NULL, 'L'},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
while ((c = getopt_long(argc, argv, "adhloD:HR", options, NULL)) != -1) {
|
||||
while ((c = getopt_long(argc, argv, "adfhlL:oD:HR", options, NULL)) != -1) {
|
||||
switch (c) {
|
||||
case ARG_VERSION:
|
||||
puts(PROGRAM_VERSION_STRING);
|
||||
@@ -734,9 +791,15 @@ static int parse_argv(int argc, char *argv[])
|
||||
case 'D':
|
||||
destrootdir = strdup(optarg);
|
||||
break;
|
||||
case 'H':
|
||||
case 'L':
|
||||
logdir = strdup(optarg);
|
||||
break;
|
||||
case 'f':
|
||||
arg_hmac = true;
|
||||
break;
|
||||
case 'H':
|
||||
arg_hostonly = true;
|
||||
break;
|
||||
case 'h':
|
||||
usage(EXIT_SUCCESS);
|
||||
break;
|
||||
@@ -784,13 +847,13 @@ static int resolve_lazy(int argc, char **argv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *find_binary(const char *src)
|
||||
static char **find_binary(const char *src)
|
||||
{
|
||||
_cleanup_free_ char *path = NULL;
|
||||
char *p, *q;
|
||||
bool end = false;
|
||||
char *path = NULL;
|
||||
_cleanup_strv_free_ char **p = NULL;
|
||||
char **ret = NULL;
|
||||
char **q;
|
||||
char *newsrc = NULL;
|
||||
int ret;
|
||||
|
||||
path = getenv("PATH");
|
||||
|
||||
@@ -798,34 +861,21 @@ static char *find_binary(const char *src)
|
||||
log_error("PATH is not set");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
path = strdup(path);
|
||||
p = path;
|
||||
|
||||
if (path == NULL) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
log_debug("PATH=%s", path);
|
||||
|
||||
do {
|
||||
p = strv_split(path, ":");
|
||||
|
||||
STRV_FOREACH(q, p) {
|
||||
struct stat sb;
|
||||
int r;
|
||||
|
||||
for (q = p; *q && *q != ':'; q++) ;
|
||||
|
||||
if (*q == '\0')
|
||||
end = true;
|
||||
else
|
||||
*q = '\0';
|
||||
|
||||
ret = asprintf(&newsrc, "%s/%s", p, src);
|
||||
if (ret < 0) {
|
||||
r = asprintf(&newsrc, "%s/%s", *q, src);
|
||||
if (r < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
p = q + 1;
|
||||
|
||||
if (stat(newsrc, &sb) != 0) {
|
||||
log_debug("stat(%s) != 0", newsrc);
|
||||
free(newsrc);
|
||||
@@ -833,30 +883,37 @@ static char *find_binary(const char *src)
|
||||
continue;
|
||||
}
|
||||
|
||||
end = true;
|
||||
strv_push(&ret, newsrc);
|
||||
|
||||
} while (!end);
|
||||
};
|
||||
|
||||
if (newsrc)
|
||||
log_debug("find_binary(%s) == %s", src, newsrc);
|
||||
if (ret) {
|
||||
STRV_FOREACH(q, ret) {
|
||||
log_debug("find_binary(%s) == %s", src, *q);
|
||||
}
|
||||
}
|
||||
|
||||
return newsrc;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int install_one(const char *src, const char *dst)
|
||||
{
|
||||
int r = EXIT_SUCCESS;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
if (strchr(src, '/') == NULL) {
|
||||
char *newsrc = find_binary(src);
|
||||
if (newsrc) {
|
||||
log_debug("dracut_install '%s' '%s'", newsrc, dst);
|
||||
ret = dracut_install(newsrc, dst, arg_createdir, arg_resolvedeps, true);
|
||||
if (ret == 0) {
|
||||
log_debug("dracut_install '%s' '%s' OK", newsrc, dst);
|
||||
char **p = find_binary(src);
|
||||
if (p) {
|
||||
char **q = NULL;
|
||||
STRV_FOREACH(q, p) {
|
||||
char *newsrc = *q;
|
||||
log_debug("dracut_install '%s' '%s'", newsrc, dst);
|
||||
ret = dracut_install(newsrc, dst, arg_createdir, arg_resolvedeps, true);
|
||||
if (ret == 0) {
|
||||
log_debug("dracut_install '%s' '%s' OK", newsrc, dst);
|
||||
}
|
||||
}
|
||||
free(newsrc);
|
||||
strv_free(p);
|
||||
} else {
|
||||
ret = -1;
|
||||
}
|
||||
@@ -877,17 +934,22 @@ static int install_all(int argc, char **argv)
|
||||
int r = EXIT_SUCCESS;
|
||||
int i;
|
||||
for (i = 0; i < argc; i++) {
|
||||
int ret;
|
||||
int ret = 0;
|
||||
log_debug("Handle '%s'", argv[i]);
|
||||
|
||||
if (strchr(argv[i], '/') == NULL) {
|
||||
_cleanup_free_ char *newsrc = find_binary(argv[i]);
|
||||
if (newsrc) {
|
||||
log_debug("dracut_install '%s'", newsrc);
|
||||
ret = dracut_install(newsrc, newsrc, arg_createdir, arg_resolvedeps, true);
|
||||
if (ret == 0) {
|
||||
log_debug("dracut_install '%s' OK", newsrc);
|
||||
char **p = find_binary(argv[i]);
|
||||
if (p) {
|
||||
char **q = NULL;
|
||||
STRV_FOREACH(q, p) {
|
||||
char *newsrc = *q;
|
||||
log_debug("dracut_install '%s'", newsrc);
|
||||
ret = dracut_install(newsrc, newsrc, arg_createdir, arg_resolvedeps, true);
|
||||
if (ret == 0) {
|
||||
log_debug("dracut_install '%s' OK", newsrc);
|
||||
}
|
||||
}
|
||||
strv_free(p);
|
||||
} else {
|
||||
ret = -1;
|
||||
}
|
||||
@@ -956,6 +1018,23 @@ int main(int argc, char **argv)
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (logdir) {
|
||||
int ret;
|
||||
|
||||
ret = asprintf(&logfile, "%s/%d.log", logdir, getpid());
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
logfile_f = fopen(logfile, "a");
|
||||
if (logfile_f == NULL) {
|
||||
log_error("Could not open %s for logging: %m", logfile);
|
||||
r = EXIT_FAILURE;
|
||||
goto finish;
|
||||
}
|
||||
}
|
||||
|
||||
r = EXIT_SUCCESS;
|
||||
|
||||
if (((optind + 1) < argc) && (strcmp(argv[optind + 1], destrootdir) == 0)) {
|
||||
@@ -984,6 +1063,8 @@ int main(int argc, char **argv)
|
||||
r = EXIT_SUCCESS;
|
||||
|
||||
finish:
|
||||
if (logfile_f)
|
||||
fclose(logfile_f);
|
||||
|
||||
while ((i = hashmap_steal_first(items)))
|
||||
item_free(i);
|
||||
|
@@ -1,5 +1,3 @@
|
||||
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
|
||||
/***
|
||||
This file is part of systemd.
|
||||
|
||||
|
@@ -1,5 +1,3 @@
|
||||
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
|
||||
#ifndef foohashmaphfoo
|
||||
#define foohashmaphfoo
|
||||
|
||||
|
@@ -1,5 +1,3 @@
|
||||
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
|
||||
/***
|
||||
This file is part of systemd.
|
||||
|
||||
@@ -103,11 +101,10 @@ void log_set_facility(int facility) {
|
||||
static int write_to_console(
|
||||
int level,
|
||||
const char*file,
|
||||
int line,
|
||||
unsigned int line,
|
||||
const char *func,
|
||||
const char *buffer) {
|
||||
|
||||
char location[64];
|
||||
struct iovec iovec[5];
|
||||
unsigned n = 0;
|
||||
|
||||
@@ -119,7 +116,9 @@ static int write_to_console(
|
||||
IOVEC_SET_STRING(iovec[n++], "dracut-install: ");
|
||||
|
||||
if (show_location) {
|
||||
snprintf(location, sizeof(location), "(%s:%u) ", file, line);
|
||||
char location[64];
|
||||
if (snprintf(location, sizeof(location), "(%s:%u) ", file, line) <= 0)
|
||||
return -errno;
|
||||
IOVEC_SET_STRING(iovec[n++], location);
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,3 @@
|
||||
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
|
||||
#ifndef foologhfoo
|
||||
#define foologhfoo
|
||||
|
||||
|
@@ -1,5 +1,3 @@
|
||||
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/***
|
||||
@@ -207,7 +205,7 @@ static inline size_t IOVEC_INCREMENT(struct iovec *i, unsigned n, size_t k) {
|
||||
for (j = 0; j < n; j++) {
|
||||
size_t sub;
|
||||
|
||||
if (_unlikely_(k <= 0))
|
||||
if (_unlikely_(k == 0))
|
||||
break;
|
||||
|
||||
sub = MIN(i[j].iov_len, k);
|
||||
|
585
install/strv.c
Normal file
585
install/strv.c
Normal file
@@ -0,0 +1,585 @@
|
||||
/***
|
||||
This file is part of systemd.
|
||||
|
||||
Copyright 2010 Lennart Poettering
|
||||
|
||||
systemd is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
systemd is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "strv.h"
|
||||
|
||||
char *strv_find(char **l, const char *name) {
|
||||
char **i;
|
||||
|
||||
assert(name);
|
||||
|
||||
STRV_FOREACH(i, l)
|
||||
if (streq(*i, name))
|
||||
return *i;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *strv_find_prefix(char **l, const char *name) {
|
||||
char **i;
|
||||
|
||||
assert(name);
|
||||
|
||||
STRV_FOREACH(i, l)
|
||||
if (startswith(*i, name))
|
||||
return *i;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void strv_free(char **l) {
|
||||
char **k;
|
||||
|
||||
if (!l)
|
||||
return;
|
||||
|
||||
for (k = l; *k; k++)
|
||||
free(*k);
|
||||
|
||||
free(l);
|
||||
}
|
||||
|
||||
char **strv_copy(char * const *l) {
|
||||
char **r, **k;
|
||||
|
||||
k = r = new(char*, strv_length(l) + 1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
if (l)
|
||||
for (; *l; k++, l++) {
|
||||
*k = strdup(*l);
|
||||
if (!*k) {
|
||||
strv_free(r);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
*k = NULL;
|
||||
return r;
|
||||
}
|
||||
|
||||
unsigned int strv_length(char * const *l) {
|
||||
unsigned n = 0;
|
||||
|
||||
if (!l)
|
||||
return 0;
|
||||
|
||||
for (; *l; l++)
|
||||
n++;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
char **strv_new_ap(const char *x, va_list ap) {
|
||||
const char *s;
|
||||
char **a;
|
||||
unsigned n = 0, i = 0;
|
||||
va_list aq;
|
||||
|
||||
/* As a special trick we ignore all listed strings that equal
|
||||
* (const char*) -1. This is supposed to be used with the
|
||||
* STRV_IFNOTNULL() macro to include possibly NULL strings in
|
||||
* the string list. */
|
||||
|
||||
if (x) {
|
||||
n = x == (const char*) -1 ? 0 : 1;
|
||||
|
||||
va_copy(aq, ap);
|
||||
while ((s = va_arg(aq, const char*))) {
|
||||
if (s == (const char*) -1)
|
||||
continue;
|
||||
|
||||
n++;
|
||||
}
|
||||
|
||||
va_end(aq);
|
||||
}
|
||||
|
||||
a = new(char*, n+1);
|
||||
if (!a)
|
||||
return NULL;
|
||||
|
||||
if (x) {
|
||||
if (x != (const char*) -1) {
|
||||
a[i] = strdup(x);
|
||||
if (!a[i])
|
||||
goto fail;
|
||||
i++;
|
||||
}
|
||||
|
||||
while ((s = va_arg(ap, const char*))) {
|
||||
|
||||
if (s == (const char*) -1)
|
||||
continue;
|
||||
|
||||
a[i] = strdup(s);
|
||||
if (!a[i])
|
||||
goto fail;
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
a[i] = NULL;
|
||||
|
||||
return a;
|
||||
|
||||
fail:
|
||||
strv_free(a);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char **strv_new(const char *x, ...) {
|
||||
char **r;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, x);
|
||||
r = strv_new_ap(x, ap);
|
||||
va_end(ap);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
char **strv_merge(char **a, char **b) {
|
||||
char **r, **k;
|
||||
|
||||
if (!a)
|
||||
return strv_copy(b);
|
||||
|
||||
if (!b)
|
||||
return strv_copy(a);
|
||||
|
||||
r = new(char*, strv_length(a) + strv_length(b) + 1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
for (k = r; *a; k++, a++) {
|
||||
*k = strdup(*a);
|
||||
if (!*k)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (; *b; k++, b++) {
|
||||
*k = strdup(*b);
|
||||
if (!*k)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
*k = NULL;
|
||||
return r;
|
||||
|
||||
fail:
|
||||
strv_free(r);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char **strv_merge_concat(char **a, char **b, const char *suffix) {
|
||||
char **r, **k;
|
||||
|
||||
/* Like strv_merge(), but appends suffix to all strings in b, before adding */
|
||||
|
||||
if (!b)
|
||||
return strv_copy(a);
|
||||
|
||||
r = new(char*, strv_length(a) + strv_length(b) + 1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
k = r;
|
||||
if (a)
|
||||
for (; *a; k++, a++) {
|
||||
*k = strdup(*a);
|
||||
if (!*k)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (; *b; k++, b++) {
|
||||
*k = strappend(*b, suffix);
|
||||
if (!*k)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
*k = NULL;
|
||||
return r;
|
||||
|
||||
fail:
|
||||
strv_free(r);
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
char **strv_split(const char *s, const char *separator) {
|
||||
char *state;
|
||||
char *w;
|
||||
size_t l;
|
||||
unsigned n, i;
|
||||
char **r;
|
||||
|
||||
assert(s);
|
||||
|
||||
n = 0;
|
||||
FOREACH_WORD_SEPARATOR(w, l, s, separator, state)
|
||||
n++;
|
||||
|
||||
r = new(char*, n+1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
i = 0;
|
||||
FOREACH_WORD_SEPARATOR(w, l, s, separator, state) {
|
||||
r[i] = strndup(w, l);
|
||||
if (!r[i]) {
|
||||
strv_free(r);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
r[i] = NULL;
|
||||
return r;
|
||||
}
|
||||
|
||||
char **strv_split_quoted(const char *s) {
|
||||
char *state;
|
||||
char *w;
|
||||
size_t l;
|
||||
unsigned n, i;
|
||||
char **r;
|
||||
|
||||
assert(s);
|
||||
|
||||
n = 0;
|
||||
FOREACH_WORD_QUOTED(w, l, s, state)
|
||||
n++;
|
||||
|
||||
r = new(char*, n+1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
i = 0;
|
||||
FOREACH_WORD_QUOTED(w, l, s, state) {
|
||||
r[i] = cunescape_length(w, l);
|
||||
if (!r[i]) {
|
||||
strv_free(r);
|
||||
return NULL;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
r[i] = NULL;
|
||||
return r;
|
||||
}
|
||||
|
||||
char **strv_split_newlines(const char *s) {
|
||||
char **l;
|
||||
unsigned int n;
|
||||
|
||||
assert(s);
|
||||
|
||||
/* Special version of strv_split() that splits on newlines and
|
||||
* suppresses an empty string at the end */
|
||||
|
||||
l = strv_split(s, NEWLINE);
|
||||
if (!l)
|
||||
return NULL;
|
||||
|
||||
n = strv_length(l);
|
||||
if (n == 0)
|
||||
return l;
|
||||
|
||||
if (isempty(l[n-1])) {
|
||||
free(l[n-1]);
|
||||
l[n-1] = NULL;
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
char *strv_join(char **l, const char *separator) {
|
||||
char *r, *e;
|
||||
char **s;
|
||||
size_t n, k;
|
||||
|
||||
if (!separator)
|
||||
separator = " ";
|
||||
|
||||
k = strlen(separator);
|
||||
|
||||
n = 0;
|
||||
STRV_FOREACH(s, l) {
|
||||
if (n != 0)
|
||||
n += k;
|
||||
n += strlen(*s);
|
||||
}
|
||||
|
||||
r = new(char, n+1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
e = r;
|
||||
STRV_FOREACH(s, l) {
|
||||
if (e != r)
|
||||
e = stpcpy(e, separator);
|
||||
|
||||
e = stpcpy(e, *s);
|
||||
}
|
||||
|
||||
*e = 0;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
char **strv_append(char **l, const char *s) {
|
||||
char **r, **k;
|
||||
|
||||
if (!l)
|
||||
return strv_new(s, NULL);
|
||||
|
||||
if (!s)
|
||||
return strv_copy(l);
|
||||
|
||||
r = new(char*, strv_length(l)+2);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
for (k = r; *l; k++, l++) {
|
||||
*k = strdup(*l);
|
||||
if (!*k)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
k[0] = strdup(s);
|
||||
if (!k[0])
|
||||
goto fail;
|
||||
|
||||
k[1] = NULL;
|
||||
return r;
|
||||
|
||||
fail:
|
||||
strv_free(r);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int strv_push(char ***l, char *value) {
|
||||
char **c;
|
||||
unsigned n;
|
||||
|
||||
if (!value)
|
||||
return 0;
|
||||
|
||||
n = strv_length(*l);
|
||||
c = realloc(*l, sizeof(char*) * (n + 2));
|
||||
if (!c)
|
||||
return -ENOMEM;
|
||||
|
||||
c[n] = value;
|
||||
c[n+1] = NULL;
|
||||
|
||||
*l = c;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int strv_extend(char ***l, const char *value) {
|
||||
char *v;
|
||||
int r;
|
||||
|
||||
if (!value)
|
||||
return 0;
|
||||
|
||||
v = strdup(value);
|
||||
if (!v)
|
||||
return -ENOMEM;
|
||||
|
||||
r = strv_push(l, v);
|
||||
if (r < 0)
|
||||
free(v);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
char **strv_uniq(char **l) {
|
||||
char **i;
|
||||
|
||||
/* Drops duplicate entries. The first identical string will be
|
||||
* kept, the others dropped */
|
||||
|
||||
STRV_FOREACH(i, l)
|
||||
strv_remove(i+1, *i);
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
char **strv_remove(char **l, const char *s) {
|
||||
char **f, **t;
|
||||
|
||||
if (!l)
|
||||
return NULL;
|
||||
|
||||
assert(s);
|
||||
|
||||
/* Drops every occurrence of s in the string list, edits
|
||||
* in-place. */
|
||||
|
||||
for (f = t = l; *f; f++) {
|
||||
|
||||
if (streq(*f, s)) {
|
||||
free(*f);
|
||||
continue;
|
||||
}
|
||||
|
||||
*(t++) = *f;
|
||||
}
|
||||
|
||||
*t = NULL;
|
||||
return l;
|
||||
}
|
||||
|
||||
char **strv_remove_prefix(char **l, const char *s) {
|
||||
char **f, **t;
|
||||
|
||||
if (!l)
|
||||
return NULL;
|
||||
|
||||
assert(s);
|
||||
|
||||
/* Drops every occurrence of a string prefixed with s in the
|
||||
* string list, edits in-place. */
|
||||
|
||||
for (f = t = l; *f; f++) {
|
||||
|
||||
if (startswith(*f, s)) {
|
||||
free(*f);
|
||||
continue;
|
||||
}
|
||||
|
||||
*(t++) = *f;
|
||||
}
|
||||
|
||||
*t = NULL;
|
||||
return l;
|
||||
}
|
||||
|
||||
char **strv_parse_nulstr(const char *s, size_t l) {
|
||||
const char *p;
|
||||
unsigned c = 0, i = 0;
|
||||
char **v;
|
||||
|
||||
assert(s || l == 0);
|
||||
|
||||
if (l == 0)
|
||||
return new0(char*, 1);
|
||||
|
||||
for (p = s; p < s + l; p++)
|
||||
if (*p == 0)
|
||||
c++;
|
||||
|
||||
if (s[l-1] != 0)
|
||||
c++;
|
||||
|
||||
v = new0(char*, c+1);
|
||||
if (!v)
|
||||
return NULL;
|
||||
|
||||
p = s;
|
||||
while (p < s + l) {
|
||||
const char *e;
|
||||
|
||||
e = memchr(p, 0, s + l - p);
|
||||
|
||||
v[i] = strndup(p, e ? e - p : s + l - p);
|
||||
if (!v[i]) {
|
||||
strv_free(v);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
i++;
|
||||
|
||||
if (!e)
|
||||
break;
|
||||
|
||||
p = e + 1;
|
||||
}
|
||||
|
||||
assert(i == c);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
char **strv_split_nulstr(const char *s) {
|
||||
const char *i;
|
||||
char **r = NULL;
|
||||
|
||||
NULSTR_FOREACH(i, s)
|
||||
if (strv_extend(&r, i) < 0) {
|
||||
strv_free(r);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!r)
|
||||
return strv_new(NULL, NULL);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
bool strv_overlap(char **a, char **b) {
|
||||
char **i, **j;
|
||||
|
||||
STRV_FOREACH(i, a) {
|
||||
STRV_FOREACH(j, b) {
|
||||
if (streq(*i, *j))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static int str_compare(const void *_a, const void *_b) {
|
||||
const char **a = (const char**) _a, **b = (const char**) _b;
|
||||
|
||||
return strcmp(*a, *b);
|
||||
}
|
||||
|
||||
char **strv_sort(char **l) {
|
||||
|
||||
if (strv_isempty(l))
|
||||
return l;
|
||||
|
||||
qsort(l, strv_length(l), sizeof(char*), str_compare);
|
||||
return l;
|
||||
}
|
||||
|
||||
void strv_print(char **l) {
|
||||
char **s;
|
||||
|
||||
if (!l)
|
||||
return;
|
||||
|
||||
STRV_FOREACH(s, l)
|
||||
puts(*s);
|
||||
}
|
116
install/strv.h
Normal file
116
install/strv.h
Normal file
@@ -0,0 +1,116 @@
|
||||
#pragma once
|
||||
|
||||
/***
|
||||
This file is part of systemd.
|
||||
|
||||
Copyright 2010 Lennart Poettering
|
||||
|
||||
systemd is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
systemd is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
char *strv_find(char **l, const char *name) _pure_;
|
||||
char *strv_find_prefix(char **l, const char *name) _pure_;
|
||||
|
||||
void strv_free(char **l);
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(char**, strv_free);
|
||||
#define _cleanup_strv_free_ _cleanup_(strv_freep)
|
||||
|
||||
char **strv_copy(char * const *l);
|
||||
unsigned int strv_length(char * const *l) _pure_;
|
||||
|
||||
char **strv_merge(char **a, char **b);
|
||||
char **strv_merge_concat(char **a, char **b, const char *suffix);
|
||||
char **strv_append(char **l, const char *s);
|
||||
int strv_extend(char ***l, const char *value);
|
||||
int strv_push(char ***l, char *value);
|
||||
|
||||
char **strv_remove(char **l, const char *s);
|
||||
char **strv_remove_prefix(char **l, const char *s);
|
||||
char **strv_uniq(char **l);
|
||||
|
||||
#define strv_contains(l, s) (!!strv_find((l), (s)))
|
||||
|
||||
char **strv_new(const char *x, ...) _sentinel_;
|
||||
char **strv_new_ap(const char *x, va_list ap);
|
||||
|
||||
static inline const char* STRV_IFNOTNULL(const char *x) {
|
||||
return x ? x : (const char *) -1;
|
||||
}
|
||||
|
||||
static inline bool strv_isempty(char * const *l) {
|
||||
return !l || !*l;
|
||||
}
|
||||
|
||||
char **strv_split(const char *s, const char *separator);
|
||||
char **strv_split_quoted(const char *s);
|
||||
char **strv_split_newlines(const char *s);
|
||||
|
||||
char *strv_join(char **l, const char *separator);
|
||||
|
||||
char **strv_parse_nulstr(const char *s, size_t l);
|
||||
char **strv_split_nulstr(const char *s);
|
||||
|
||||
bool strv_overlap(char **a, char **b) _pure_;
|
||||
|
||||
#define STRV_FOREACH(s, l) \
|
||||
for ((s) = (l); (s) && *(s); (s)++)
|
||||
|
||||
#define STRV_FOREACH_BACKWARDS(s, l) \
|
||||
STRV_FOREACH(s, l) \
|
||||
; \
|
||||
for ((s)--; (l) && ((s) >= (l)); (s)--)
|
||||
|
||||
#define STRV_FOREACH_PAIR(x, y, l) \
|
||||
for ((x) = (l), (y) = (x+1); (x) && *(x) && *(y); (x) += 2, (y) = (x + 1))
|
||||
|
||||
char **strv_sort(char **l);
|
||||
void strv_print(char **l);
|
||||
|
||||
#define STRV_MAKE(...) ((char**) ((const char*[]) { __VA_ARGS__, NULL }))
|
||||
|
||||
#define STRV_MAKE_EMPTY ((char*[1]) { NULL })
|
||||
|
||||
#define strv_from_stdarg_alloca(first) \
|
||||
({ \
|
||||
char **_l; \
|
||||
\
|
||||
if (!first) \
|
||||
_l = (char**) &first; \
|
||||
else { \
|
||||
unsigned _n; \
|
||||
va_list _ap; \
|
||||
\
|
||||
_n = 1; \
|
||||
va_start(_ap, first); \
|
||||
while (va_arg(_ap, char*)) \
|
||||
_n++; \
|
||||
va_end(_ap); \
|
||||
\
|
||||
_l = newa(char*, _n+1); \
|
||||
_l[_n = 0] = (char*) first; \
|
||||
va_start(_ap, first); \
|
||||
for (;;) { \
|
||||
_l[++_n] = va_arg(_ap, char*); \
|
||||
if (!_l[_n]) \
|
||||
break; \
|
||||
} \
|
||||
va_end(_ap); \
|
||||
} \
|
||||
_l; \
|
||||
})
|
241
install/util.c
241
install/util.c
@@ -1,5 +1,3 @@
|
||||
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
|
||||
/***
|
||||
This file is part of systemd.
|
||||
|
||||
@@ -224,7 +222,7 @@ char *strappend(const char *s, const char *suffix) {
|
||||
char *strjoin(const char *x, ...) {
|
||||
va_list ap;
|
||||
size_t l;
|
||||
char *r, *p;
|
||||
char *r;
|
||||
|
||||
va_start(ap, x);
|
||||
|
||||
@@ -257,6 +255,8 @@ char *strjoin(const char *x, ...) {
|
||||
return NULL;
|
||||
|
||||
if (x) {
|
||||
char *p;
|
||||
|
||||
p = stpcpy(r, x);
|
||||
|
||||
va_start(ap, x);
|
||||
@@ -277,3 +277,238 @@ char *strjoin(const char *x, ...) {
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
char *cunescape_length_with_prefix(const char *s, size_t length, const char *prefix) {
|
||||
char *r, *t;
|
||||
const char *f;
|
||||
size_t pl;
|
||||
|
||||
assert(s);
|
||||
|
||||
/* Undoes C style string escaping, and optionally prefixes it. */
|
||||
|
||||
pl = prefix ? strlen(prefix) : 0;
|
||||
|
||||
r = new(char, pl+length+1);
|
||||
if (!r)
|
||||
return r;
|
||||
|
||||
if (prefix)
|
||||
memcpy(r, prefix, pl);
|
||||
|
||||
for (f = s, t = r + pl; f < s + length; f++) {
|
||||
|
||||
if (*f != '\\') {
|
||||
*(t++) = *f;
|
||||
continue;
|
||||
}
|
||||
|
||||
f++;
|
||||
|
||||
switch (*f) {
|
||||
|
||||
case 'a':
|
||||
*(t++) = '\a';
|
||||
break;
|
||||
case 'b':
|
||||
*(t++) = '\b';
|
||||
break;
|
||||
case 'f':
|
||||
*(t++) = '\f';
|
||||
break;
|
||||
case 'n':
|
||||
*(t++) = '\n';
|
||||
break;
|
||||
case 'r':
|
||||
*(t++) = '\r';
|
||||
break;
|
||||
case 't':
|
||||
*(t++) = '\t';
|
||||
break;
|
||||
case 'v':
|
||||
*(t++) = '\v';
|
||||
break;
|
||||
case '\\':
|
||||
*(t++) = '\\';
|
||||
break;
|
||||
case '"':
|
||||
*(t++) = '"';
|
||||
break;
|
||||
case '\'':
|
||||
*(t++) = '\'';
|
||||
break;
|
||||
|
||||
case 's':
|
||||
/* This is an extension of the XDG syntax files */
|
||||
*(t++) = ' ';
|
||||
break;
|
||||
|
||||
case 'x': {
|
||||
/* hexadecimal encoding */
|
||||
int a, b;
|
||||
|
||||
a = unhexchar(f[1]);
|
||||
b = unhexchar(f[2]);
|
||||
|
||||
if (a < 0 || b < 0) {
|
||||
/* Invalid escape code, let's take it literal then */
|
||||
*(t++) = '\\';
|
||||
*(t++) = 'x';
|
||||
} else {
|
||||
*(t++) = (char) ((a << 4) | b);
|
||||
f += 2;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7': {
|
||||
/* octal encoding */
|
||||
int a, b, c;
|
||||
|
||||
a = unoctchar(f[0]);
|
||||
b = unoctchar(f[1]);
|
||||
c = unoctchar(f[2]);
|
||||
|
||||
if (a < 0 || b < 0 || c < 0) {
|
||||
/* Invalid escape code, let's take it literal then */
|
||||
*(t++) = '\\';
|
||||
*(t++) = f[0];
|
||||
} else {
|
||||
*(t++) = (char) ((a << 6) | (b << 3) | c);
|
||||
f += 2;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 0:
|
||||
/* premature end of string.*/
|
||||
*(t++) = '\\';
|
||||
goto finish;
|
||||
|
||||
default:
|
||||
/* Invalid escape code, let's take it literal then */
|
||||
*(t++) = '\\';
|
||||
*(t++) = *f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
finish:
|
||||
*t = 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
char *cunescape_length(const char *s, size_t length) {
|
||||
return cunescape_length_with_prefix(s, length, NULL);
|
||||
}
|
||||
|
||||
|
||||
/* Split a string into words, but consider strings enclosed in '' and
|
||||
* "" as words even if they include spaces. */
|
||||
char *split_quoted(const char *c, size_t *l, char **state) {
|
||||
const char *current, *e;
|
||||
bool escaped = false;
|
||||
|
||||
assert(c);
|
||||
assert(l);
|
||||
assert(state);
|
||||
|
||||
current = *state ? *state : c;
|
||||
|
||||
current += strspn(current, WHITESPACE);
|
||||
|
||||
if (*current == 0)
|
||||
return NULL;
|
||||
|
||||
else if (*current == '\'') {
|
||||
current ++;
|
||||
|
||||
for (e = current; *e; e++) {
|
||||
if (escaped)
|
||||
escaped = false;
|
||||
else if (*e == '\\')
|
||||
escaped = true;
|
||||
else if (*e == '\'')
|
||||
break;
|
||||
}
|
||||
|
||||
*l = e-current;
|
||||
*state = (char*) (*e == 0 ? e : e+1);
|
||||
|
||||
} else if (*current == '\"') {
|
||||
current ++;
|
||||
|
||||
for (e = current; *e; e++) {
|
||||
if (escaped)
|
||||
escaped = false;
|
||||
else if (*e == '\\')
|
||||
escaped = true;
|
||||
else if (*e == '\"')
|
||||
break;
|
||||
}
|
||||
|
||||
*l = e-current;
|
||||
*state = (char*) (*e == 0 ? e : e+1);
|
||||
|
||||
} else {
|
||||
for (e = current; *e; e++) {
|
||||
if (escaped)
|
||||
escaped = false;
|
||||
else if (*e == '\\')
|
||||
escaped = true;
|
||||
else if (strchr(WHITESPACE, *e))
|
||||
break;
|
||||
}
|
||||
*l = e-current;
|
||||
*state = (char*) e;
|
||||
}
|
||||
|
||||
return (char*) current;
|
||||
}
|
||||
|
||||
/* Split a string into words. */
|
||||
char *split(const char *c, size_t *l, const char *separator, char **state) {
|
||||
char *current;
|
||||
|
||||
current = *state ? *state : (char*) c;
|
||||
|
||||
if (!*current || *c == 0)
|
||||
return NULL;
|
||||
|
||||
current += strspn(current, separator);
|
||||
*l = strcspn(current, separator);
|
||||
*state = current+*l;
|
||||
|
||||
return (char*) current;
|
||||
}
|
||||
|
||||
int unhexchar(char c) {
|
||||
|
||||
if (c >= '0' && c <= '9')
|
||||
return c - '0';
|
||||
|
||||
if (c >= 'a' && c <= 'f')
|
||||
return c - 'a' + 10;
|
||||
|
||||
if (c >= 'A' && c <= 'F')
|
||||
return c - 'A' + 10;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int unoctchar(char c) {
|
||||
|
||||
if (c >= '0' && c <= '7')
|
||||
return c - '0';
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@@ -1,5 +1,3 @@
|
||||
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
|
||||
#ifndef fooutilhfoo
|
||||
#define fooutilhfoo
|
||||
|
||||
@@ -134,8 +132,16 @@ static inline bool isempty(const char *p) {
|
||||
return !p || !p[0];
|
||||
}
|
||||
|
||||
|
||||
static inline const char *startswith(const char *s, const char *prefix) {
|
||||
if (strncmp(s, prefix, strlen(prefix)) == 0)
|
||||
return s + strlen(prefix);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool endswith(const char *s, const char *postfix);
|
||||
bool startswith(const char *s, const char *prefix);
|
||||
|
||||
|
||||
bool startswith_no_case(const char *s, const char *prefix);
|
||||
|
||||
bool first_word(const char *s, const char *word);
|
||||
@@ -562,4 +568,16 @@ void warn_melody(void);
|
||||
|
||||
char *strjoin(const char *x, ...) _sentinel_;
|
||||
|
||||
#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \
|
||||
static inline void func##p(type *p) { \
|
||||
if (*p) \
|
||||
func(*p); \
|
||||
} \
|
||||
struct __useless_struct_to_allow_trailing_semicolon__
|
||||
|
||||
char *split_quoted(const char *c, size_t *l, char **state);
|
||||
char *cunescape_length(const char *s, size_t length);
|
||||
int unhexchar(char c) _const_;
|
||||
int unoctchar(char c) _const_;
|
||||
|
||||
#endif
|
||||
|
@@ -1,6 +1,3 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Copyright 2013 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
|
148
lsinitrd.sh
148
lsinitrd.sh
@@ -1,6 +1,4 @@
|
||||
#!/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.
|
||||
@@ -27,20 +25,26 @@ usage()
|
||||
echo
|
||||
echo "-h, --help print a help message and exit."
|
||||
echo "-s, --size sort the contents of the initramfs by size."
|
||||
echo "-m, --mod list modules."
|
||||
echo "-f, --file <filename> print the contents of <filename>."
|
||||
echo "-k, --kver <kernel version> inspect the initramfs of <kernel version>."
|
||||
echo
|
||||
} >&2
|
||||
}
|
||||
|
||||
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
|
||||
sorted=0
|
||||
modules=0
|
||||
declare -A filenames
|
||||
|
||||
unset POSIXLY_CORRECT
|
||||
TEMP=$(getopt \
|
||||
-o "shf:k:" \
|
||||
-o "shmf:k:" \
|
||||
--long kver: \
|
||||
--long file: \
|
||||
--long mod \
|
||||
--long help \
|
||||
--long size \
|
||||
-- "$@")
|
||||
@@ -58,6 +62,7 @@ while (($# > 0)); do
|
||||
-f|--file) filenames[${2#/}]=1; shift;;
|
||||
-s|--size) sorted=1;;
|
||||
-h|--help) usage; exit 0;;
|
||||
-m|--mod) modules=1;;
|
||||
--) shift;break;;
|
||||
*) usage; exit 1;;
|
||||
esac
|
||||
@@ -103,50 +108,129 @@ if ! [[ -f "$image" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
read -N 6 bin < "$image"
|
||||
case $bin in
|
||||
$'\x1f\x8b'*)
|
||||
CAT="zcat";;
|
||||
BZh*)
|
||||
CAT="bzcat";;
|
||||
$'\x71\xc7'*|070701)
|
||||
CAT="cat";;
|
||||
*)
|
||||
CAT="xzcat";
|
||||
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
|
||||
CAT="xzcat --single-stream"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
ret=0
|
||||
|
||||
if (( ${#filenames[@]} > 0 )); then
|
||||
extract_files()
|
||||
{
|
||||
(( ${#filenames[@]} == 1 )) && nofileinfo=1
|
||||
for f in ${!filenames[@]}; do
|
||||
[[ $nofileinfo ]] || echo "initramfs:/$f"
|
||||
[[ $nofileinfo ]] || echo "========================================================================"
|
||||
$CAT -- $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
|
||||
$CAT $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
|
||||
((ret+=$?))
|
||||
[[ $nofileinfo ]] || echo "========================================================================"
|
||||
[[ $nofileinfo ]] || echo
|
||||
done
|
||||
else
|
||||
echo "Image: $image: $(du -h $image | while read a b; do echo $a;done)"
|
||||
echo "========================================================================"
|
||||
version=$($CAT -- "$image" | cpio --extract --verbose --quiet --to-stdout -- '*lib/dracut/dracut-*' 2>/dev/null)
|
||||
((ret+=$?))
|
||||
echo "$version with dracut modules:"
|
||||
$CAT -- "$image" | cpio --extract --verbose --quiet --to-stdout -- '*lib/dracut/modules.txt' 2>/dev/null
|
||||
}
|
||||
|
||||
list_modules()
|
||||
{
|
||||
echo "dracut modules:"
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/modules.txt' 'usr/lib/dracut/modules.txt' 2>/dev/null
|
||||
((ret+=$?))
|
||||
}
|
||||
|
||||
list_files()
|
||||
{
|
||||
echo "========================================================================"
|
||||
if [ "$sorted" -eq 1 ]; then
|
||||
$CAT -- "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
else
|
||||
$CAT -- "$image" | cpio --extract --verbose --quiet --list | sort -k9
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -k9
|
||||
fi
|
||||
((ret+=$?))
|
||||
echo "========================================================================"
|
||||
}
|
||||
|
||||
|
||||
if (( ${#filenames[@]} <= 0 )); then
|
||||
echo "Image: $image: $(du -h $image | while read a b; do echo $a;done)"
|
||||
echo "========================================================================"
|
||||
fi
|
||||
|
||||
read -N 6 bin < "$image"
|
||||
case $bin in
|
||||
$'\x71\xc7'*|070701)
|
||||
CAT="cat --"
|
||||
is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2>/dev/null)
|
||||
if [[ "$is_early" ]]; then
|
||||
if (( ${#filenames[@]} > 0 )); then
|
||||
extract_files
|
||||
else
|
||||
echo "Early CPIO image"
|
||||
list_files
|
||||
fi
|
||||
SKIP="$dracutbasedir/skipcpio"
|
||||
if ! [[ -x $SKIP ]]; then
|
||||
echo
|
||||
echo "'$SKIP' not found, cannot display remaining contents!" >&2
|
||||
echo
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
CAT=$({
|
||||
if [[ $SKIP ]]; then
|
||||
$SKIP "$image"
|
||||
else
|
||||
cat "$image"
|
||||
fi } | {
|
||||
read -N 6 bin
|
||||
case $bin in
|
||||
$'\x1f\x8b'*)
|
||||
echo "zcat --"
|
||||
;;
|
||||
BZh*)
|
||||
echo "bzcat --"
|
||||
;;
|
||||
$'\x71\xc7'*|070701)
|
||||
echo "cat --"
|
||||
;;
|
||||
$'\x02\x21'*)
|
||||
echo "lz4 -d -c"
|
||||
;;
|
||||
$'\x89'LZO$'\0'*)
|
||||
echo "lzop -d -c"
|
||||
;;
|
||||
*)
|
||||
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
|
||||
echo "xzcat --single-stream --"
|
||||
else
|
||||
echo "xzcat --"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
})
|
||||
|
||||
skipcpio()
|
||||
{
|
||||
$SKIP "$@" | $ORIG_CAT
|
||||
}
|
||||
|
||||
if [[ $SKIP ]]; then
|
||||
ORIG_CAT="$CAT"
|
||||
CAT=skipcpio
|
||||
fi
|
||||
|
||||
ret=0
|
||||
|
||||
if (( ${#filenames[@]} > 0 )); then
|
||||
extract_files
|
||||
else
|
||||
version=$($CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/dracut-*' 'usr/lib/dracut/dracut-*' 2>/dev/null)
|
||||
((ret+=$?))
|
||||
echo "Version: $version"
|
||||
echo
|
||||
if [ "$modules" -eq 1 ]; then
|
||||
list_modules
|
||||
echo "========================================================================"
|
||||
else
|
||||
echo -n "Arguments: "
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/build-parameter.txt' 'usr/lib/dracut/build-parameter.txt' 2>/dev/null
|
||||
echo
|
||||
list_modules
|
||||
list_files
|
||||
fi
|
||||
fi
|
||||
|
||||
exit $ret
|
||||
|
175
mkinitrd-dracut.sh
Normal file → Executable file
175
mkinitrd-dracut.sh
Normal file → Executable file
@@ -1,6 +1,11 @@
|
||||
#!/bin/bash --norc
|
||||
kver=$(uname -r)
|
||||
|
||||
boot_dir="/boot"
|
||||
quiet=0
|
||||
host_only=0
|
||||
force=0
|
||||
|
||||
error() { echo "$@" >&2; }
|
||||
|
||||
usage () {
|
||||
@@ -24,36 +29,105 @@ read_arg() {
|
||||
# $1 = arg name
|
||||
# $2 = arg value
|
||||
# $3 = arg parameter
|
||||
local rematch='^[^=]*=(.*)$'
|
||||
param="$1"
|
||||
local rematch='^[^=]*=(.*)$' result
|
||||
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
|
||||
read "$param" <<< "${BASH_REMATCH[1]}"
|
||||
else
|
||||
for ((i=3; $i <= $#; i++)); do
|
||||
# Only read next arg if it not an arg itself.
|
||||
if [[ ${@:$i:1} = -* ]];then
|
||||
break
|
||||
fi
|
||||
result="$result ${@:$i:1}"
|
||||
# There is no way to shift our callers args, so
|
||||
# return "no of args" to indicate they should do it instead.
|
||||
done
|
||||
read "$1" <<< "$result"
|
||||
return $(($i - 3))
|
||||
fi
|
||||
}
|
||||
|
||||
# Taken over from SUSE mkinitrd
|
||||
default_kernel_images() {
|
||||
local regex kernel_image kernel_version version_version initrd_image
|
||||
local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
|
||||
|
||||
case "$(uname -m)" in
|
||||
s390|s390x)
|
||||
regex='image'
|
||||
;;
|
||||
ppc|ppc64)
|
||||
regex='vmlinux'
|
||||
;;
|
||||
i386|x86_64)
|
||||
regex='vmlinuz'
|
||||
;;
|
||||
arm*)
|
||||
regex='[uz]Image'
|
||||
;;
|
||||
aarch64)
|
||||
regex='Image'
|
||||
;;
|
||||
*) regex='vmlinu.'
|
||||
;;
|
||||
esac
|
||||
|
||||
# user mode linux
|
||||
if grep -q UML /proc/cpuinfo; then
|
||||
regex='linux'
|
||||
fi
|
||||
|
||||
kernel_images=""
|
||||
initrd_images=""
|
||||
for kernel_image in $(ls $boot_dir \
|
||||
| sed -ne "\|^$regex\(-[0-9.]\+-[0-9]\+-[a-z0-9]\+$\)\?|p" \
|
||||
| grep -v kdump$ ) ; do
|
||||
|
||||
# Note that we cannot check the RPM database here -- this
|
||||
# script is itself called from within the binary kernel
|
||||
# packages, and rpm does not allow recursive calls.
|
||||
|
||||
[ -L "$boot_dir/$kernel_image" ] && continue
|
||||
[ "${kernel_image%%.gz}" != "$kernel_image" ] && continue
|
||||
kernel_version=$(/usr/bin/get_kernel_version \
|
||||
$boot_dir/$kernel_image 2> /dev/null)
|
||||
initrd_image=$(echo $kernel_image | sed -e "s|${regex}|initrd|")
|
||||
if [ "$kernel_image" != "$initrd_image" -a \
|
||||
-n "$kernel_version" -a \
|
||||
-d "/lib/modules/$kernel_version" ]; then
|
||||
kernel_images="$kernel_images $boot_dir/$kernel_image"
|
||||
initrd_images="$initrd_images $boot_dir/$initrd_image"
|
||||
fi
|
||||
done
|
||||
for kernel_image in $kernel_images;do
|
||||
kernels="$kernels ${kernel_image#*-}"
|
||||
done
|
||||
for initrd_image in $initrd_images;do
|
||||
targets="$targets $initrd_image"
|
||||
done
|
||||
host_only=1
|
||||
force=1
|
||||
}
|
||||
|
||||
while (($# > 0)); do
|
||||
case ${1%%=*} in
|
||||
--with-usb) read_arg usbmodule "$@" || shift
|
||||
--with-usb) read_arg usbmodule "$@" || shift $?
|
||||
basicmodules="$basicmodules ${usbmodule:-usb-storage}"
|
||||
unset usbmodule;;
|
||||
--with-avail) read_arg modname "$@" || shift
|
||||
--with-avail) read_arg modname "$@" || shift $?
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--with) read_arg modname "$@" || shift
|
||||
--with) read_arg modname "$@" || shift $?
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--version)
|
||||
echo "mkinitrd: dracut compatibility wrapper"
|
||||
exit 0;;
|
||||
-v|--verbose) dracut_args="${dracut_args} -v";;
|
||||
-f|--force) dracut_args="${dracut_args} -f";;
|
||||
--preload) read_arg modname "$@" || shift
|
||||
-f|--force) force=1;;
|
||||
--preload) read_arg modname "$@" || shift $?
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--image-version) img_vers=yes;;
|
||||
--rootfs) read_arg rootfs "$@" || shift
|
||||
--rootfs|-d) read_arg rootfs "$@" || shift $?
|
||||
dracut_args="${dracut_args} --filesystems $rootfs";;
|
||||
--nocompress) dracut_args="$dracut_args --no-compress";;
|
||||
--help) usage -n;;
|
||||
@@ -80,10 +154,31 @@ while (($# > 0)); do
|
||||
--looppath*) ;;
|
||||
--dsdt*) ;;
|
||||
--bootchart) ;;
|
||||
*) if [[ ! $target ]]; then
|
||||
target=$1
|
||||
elif [[ ! $kernel ]]; then
|
||||
kernel=$1
|
||||
-s) ;;
|
||||
--quiet|-q) quiet=1;;
|
||||
-b) read_arg boot_dir "$@" || shift $?
|
||||
if [ ! -d $boot_dir ];then
|
||||
error "Boot directory $boot_dir does not exist"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-k) # Would be nice to get a list of images here
|
||||
read_arg kernel_images "$@" || shift $?
|
||||
for kernel_image in $kernel_images;do
|
||||
kernels="$kernels ${kernel_image#*-}"
|
||||
done
|
||||
host_only=1
|
||||
force=1
|
||||
;;
|
||||
-i) read_arg initrd_images "$@" || shift $?
|
||||
for initrd_image in $initrd_images;do
|
||||
targets="$targets $boot_dir/$initrd_image"
|
||||
done
|
||||
;;
|
||||
*) if [[ ! $targets ]]; then
|
||||
targets=$1
|
||||
elif [[ ! $kernels ]]; then
|
||||
kernels=$1
|
||||
else
|
||||
usage
|
||||
fi;;
|
||||
@@ -91,11 +186,41 @@ while (($# > 0)); do
|
||||
shift
|
||||
done
|
||||
|
||||
[[ $target && $kernel ]] || usage
|
||||
[[ $img_vers ]] && target="$target-$kernel"
|
||||
[[ $targets && $kernels ]] || default_kernel_images
|
||||
[[ $targets && $kernels ]] || (error "No kernel found in $boot_dir" && usage)
|
||||
|
||||
if [[ $basicmodules ]]; then
|
||||
dracut $dracut_args --add-drivers "$basicmodules" "$target" "$kernel"
|
||||
else
|
||||
dracut $dracut_args "$target" "$kernel"
|
||||
fi
|
||||
# We can have several targets/kernels, transform the list to an array
|
||||
targets=( $targets )
|
||||
[[ $kernels ]] && kernels=( $kernels )
|
||||
|
||||
[[ $host_only == 1 ]] && dracut_args="${dracut_args} -H"
|
||||
[[ $force == 1 ]] && dracut_args="${dracut_args} -f"
|
||||
|
||||
echo "Creating: target|kernel|dracut args|basicmodules "
|
||||
for ((i=0 ; $i<${#targets[@]} ; i++)); do
|
||||
|
||||
if [[ $img_vers ]];then
|
||||
target="${targets[$i]}-${kernels[$i]}"
|
||||
else
|
||||
target="${targets[$i]}"
|
||||
fi
|
||||
kernel="${kernels[$i]}"
|
||||
|
||||
# Duplicate code: No way found how to redirect output based on $quiet
|
||||
if [[ $quiet == 1 ]];then
|
||||
echo "$target|$kernel|$dracut_args|$basicmodules"
|
||||
if [[ $basicmodules ]]; then
|
||||
dracut $dracut_args --add-drivers "$basicmodules" "$target" \
|
||||
"$kernel" &>/dev/null
|
||||
else
|
||||
dracut $dracut_args "$target" "$kernel" &>/dev/null
|
||||
fi
|
||||
else
|
||||
if [[ $basicmodules ]]; then
|
||||
dracut $dracut_args --add-drivers "$basicmodules" "$target" \
|
||||
"$kernel"
|
||||
else
|
||||
dracut $dracut_args "$target" "$kernel"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
105
mkinitrd-suse.8.asc
Normal file
105
mkinitrd-suse.8.asc
Normal file
@@ -0,0 +1,105 @@
|
||||
MKINITRD(8)
|
||||
===========
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
|
||||
NAME
|
||||
----
|
||||
mkinitrd-suse - is a compat wrapper, which calls dracut to generate an initramfs
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
*mkinitrd* ['OPTION...']
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
*mkinitrd* creates an initramfs image <initrd-image> for the kernel with
|
||||
version <kernel-version> by calling *dracut*.
|
||||
|
||||
[IMPORTANT]
|
||||
This version of mkinitrd is provided for compability with older
|
||||
versions of mkinitrd. If a more fine grained control over the
|
||||
resulting image is needed, *dracut* should be called directly.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
**-R, --version**::
|
||||
print info about the version
|
||||
|
||||
**-k** _<kernel_list>_::
|
||||
List of kernel images for which initrd files are created (relative
|
||||
to _boot_dir_), defaults to _vmlinux_ on ppc/ppc64, _image_ on s390/s390x
|
||||
and _vmlinuz_ for everything else.
|
||||
|
||||
**-i** _<initrd_list>_::
|
||||
List of file names (relative to _boot_dir_) for the initrd; positions
|
||||
have to match the _kernel_list_. Defaults to _initrd_.
|
||||
|
||||
**-m** _<module_list>_::
|
||||
Modules to include in initrd, defaults to _INITRD_MODULES_ variable
|
||||
in */etc/sysconfig/kernel*.
|
||||
|
||||
**-f** _<feature_list>_::
|
||||
Features to be enabled for the initrd. In general mkinitrd
|
||||
configures the initrd for the root device it is started from. With
|
||||
this option additional feature can be enabled.
|
||||
|
||||
**-b** _<bootdir>_::
|
||||
Boot directory, defaults to */boot*, where the initrd is created.
|
||||
|
||||
**-d** _<root_device>_::
|
||||
Root device, defaults to the device from which the root_dir is
|
||||
mounted; overwrites the rootdev enviroment variable if set
|
||||
|
||||
**-s** _<size>_::
|
||||
Add splash animation and bootscreen to initrd.
|
||||
|
||||
**-D** _<interface>::
|
||||
Run dhcp on the specified interface (for example "eth0").
|
||||
|
||||
**-I** _<interface>::
|
||||
Configure the specified interface statically.
|
||||
|
||||
**-a** _<acpi_dsdt>::
|
||||
Attach compiled ACPI DSDT (Differentiated System Description Table)
|
||||
to initrd. This replaces the DSDT of the BIOS. Defaults to the
|
||||
_ACPI_DSDT_ variable in */etc/sysconfig/kernel*.
|
||||
|
||||
**-M** _<map>::
|
||||
System.map file to use.
|
||||
|
||||
**-B**::
|
||||
Don’t run the *update-bootloader(8)* script after the initrd(s) have
|
||||
been created. This is useful if you call mkinitrd(8) for anything
|
||||
else than the running system.
|
||||
|
||||
**-A**::
|
||||
Create a so called "monster initrd" which includes all available
|
||||
features and modules. This calls dracut with --no-hostonly and
|
||||
--no-hostonly-cmdline parameters internally, instead of the default
|
||||
--hostonly and --hostonly-cmdline.
|
||||
|
||||
**-v, --verbose**::
|
||||
increase verbosity level
|
||||
|
||||
**-L**::
|
||||
Disable logging to _/var/log/YaST2/mkinitrd.log_. This is useful for
|
||||
testing if you don’t want to clutter the system log.
|
||||
|
||||
**--help**::
|
||||
print a help message and exit.
|
||||
|
||||
AVAILABILITY
|
||||
------------
|
||||
The mkinitrd command is part of the dracut package and is available from
|
||||
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]
|
||||
|
||||
AUTHORS
|
||||
-------
|
||||
Harald Hoyer, Hannes Reinecke
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
*dracut*(8)
|
||||
*update-bootloader*(8)
|
348
mkinitrd-suse.sh
Executable file
348
mkinitrd-suse.sh
Executable file
@@ -0,0 +1,348 @@
|
||||
#!/bin/bash --norc
|
||||
#
|
||||
# mkinitrd compability wrapper for SUSE.
|
||||
#
|
||||
# Copyright (c) 2013 SUSE Linux Products GmbH. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
boot_dir="/boot"
|
||||
quiet=0
|
||||
logfile=/var/log/YaST2/mkinitrd.log
|
||||
dracut_cmd=dracut
|
||||
|
||||
error() { echo "$@" >&2; }
|
||||
|
||||
usage () {
|
||||
[[ $1 = '-n' ]] && cmd=echo || cmd=error
|
||||
|
||||
$cmd "usage: ${0##*/} [options]"
|
||||
$cmd ""
|
||||
$cmd " Create initial ramdisk images that contain all kernel modules needed"
|
||||
$cmd " in the early boot process, before the root file system becomes"
|
||||
$cmd " available."
|
||||
$cmd " This usually includes SCSI and/or RAID modules, a file system module"
|
||||
$cmd " for the root file system, or a network interface driver module for dhcp."
|
||||
$cmd ""
|
||||
$cmd " options:"
|
||||
$cmd " -f \"feature list\" Features to be enabled when generating initrd."
|
||||
$cmd " Available features are:"
|
||||
$cmd " iscsi, md, multipath, lvm, lvm2,"
|
||||
$cmd " ifup, fcoe, dcbd"
|
||||
$cmd " -k \"kernel list\" List of kernel images for which initrd files are"
|
||||
$cmd " created. Defaults to all kernels found in /boot."
|
||||
$cmd " -i \"initrd list\" List of file names for the initrd; position have"
|
||||
$cmd " match to \"kernel list\". Defaults to all kernels"
|
||||
$cmd " found in /boot."
|
||||
$cmd " -b boot_dir Boot directory. Defaults to /boot."
|
||||
$cmd " -t tmp_dir Temporary directory. Defaults to /var/tmp."
|
||||
$cmd " -M map System.map file to use."
|
||||
$cmd " -A Create a so called \"monster initrd\" which"
|
||||
$cmd " includes all features and modules possible."
|
||||
$cmd " -B Do not update bootloader configuration."
|
||||
$cmd " -v Verbose mode."
|
||||
$cmd " -L Disable logging."
|
||||
$cmd " -h This help screen."
|
||||
$cmd " -m \"module list\" Modules to include in initrd. Defaults to the"
|
||||
$cmd " INITRD_MODULES variable in /etc/sysconfig/kernel"
|
||||
$cmd " -u \"DomU module list\" Modules to include in initrd. Defaults to the"
|
||||
$cmd " DOMU_INITRD_MODULES variable in"
|
||||
$cmd " /etc/sysconfig/kernel."
|
||||
$cmd " -d root_device Root device. Defaults to the device from"
|
||||
$cmd " which / is mounted. Overrides the rootdev"
|
||||
$cmd " enviroment variable if set."
|
||||
$cmd " -j device Journal device"
|
||||
$cmd " -D interface Run dhcp on the specified interface."
|
||||
$cmd " -I interface Configure the specified interface statically."
|
||||
$cmd " -a acpi_dsdt Obsolete, do not use."
|
||||
$cmd " -s size Add splash animation and bootscreen to initrd."
|
||||
|
||||
[[ $1 = '-n' ]] && exit 0
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Little helper function for reading args from the commandline.
|
||||
# it automatically handles -a b and -a=b variants, and returns 1 if
|
||||
# we need to shift $3.
|
||||
read_arg() {
|
||||
# $1 = arg name
|
||||
# $2 = arg value
|
||||
# $3 = arg parameter
|
||||
param="$1"
|
||||
local rematch='^[^=]*=(.*)$' result
|
||||
if [[ $2 =~ $rematch ]]; then
|
||||
read "$param" <<< "${BASH_REMATCH[1]}"
|
||||
else
|
||||
for ((i=3; $i <= $#; i++)); do
|
||||
# Only read next arg if it not an arg itself.
|
||||
if [[ ${@:$i:1} = -* ]];then
|
||||
break
|
||||
fi
|
||||
result="$result ${@:$i:1}"
|
||||
# There is no way to shift our callers args, so
|
||||
# return "no of args" to indicate they should do it instead.
|
||||
done
|
||||
read "$1" <<< "$result"
|
||||
return $(($i - 3))
|
||||
fi
|
||||
}
|
||||
|
||||
# Helper functions to calculate ipconfig command line
|
||||
calc_netmask() {
|
||||
local prefix=$1
|
||||
|
||||
[ -z "$prefix" ] && return
|
||||
mask=$(echo "(2 ^ 32) - (2 ^ $prefix)" | bc -l)
|
||||
byte1=$(( mask >> 24 ))
|
||||
byte2=$(( mask >> 16 ))
|
||||
byte3=$(( mask >> 8 ))
|
||||
byte4=$(( mask & 0xff ))
|
||||
netmask=$(printf "%d.%d.%d.%d" $(( byte1 & 0xff )) $(( byte2 & 0xff )) $(( byte3 & 0xff )) $byte4);
|
||||
|
||||
echo $netmask
|
||||
}
|
||||
|
||||
ipconfig() {
|
||||
local interface=$1
|
||||
local iplink macaddr broadcast gateway ipaddr prefix netmask
|
||||
|
||||
iplink=$(ip addr show dev $interface | sed -n 's/ *inet \(.*\) brd.*/\1/p')
|
||||
macaddr=$(ip addr show dev $interface | sed -n 's/.*ether \(.*\) brd.*/\1/p')
|
||||
broadcast=$(ip addr show dev $interface | sed -n 's/.*brd \(.*\) scope.*/\1/p')
|
||||
gateway=$(ip route show dev $interface | sed -n 's/default via \([0-9\.]*\).*/\1/p')
|
||||
|
||||
ipaddr=${iplink%%/*}
|
||||
prefix=${iplink##*/}
|
||||
netmask=$(calc_netmask $prefix)
|
||||
|
||||
echo "${ipaddr}:${serveraddr}:${gateway}:${netmask}:${hostname}:${interface}:none::${macaddr}"
|
||||
}
|
||||
|
||||
is_xen_kernel() {
|
||||
local kversion=$1
|
||||
local root_dir=$2
|
||||
local cfg
|
||||
|
||||
for cfg in ${root_dir}/boot/config-$kversion $root_dir/lib/modules/$kversion/build/.config
|
||||
do
|
||||
test -r $cfg || continue
|
||||
grep -q "^CONFIG_XEN=y\$" $cfg
|
||||
return
|
||||
done
|
||||
test $kversion != "${kversion%-xen*}"
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
# Taken over from SUSE mkinitrd
|
||||
default_kernel_images() {
|
||||
local regex kernel_image kernel_version version_version initrd_image
|
||||
local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
|
||||
|
||||
case "$(uname -m)" in
|
||||
s390|s390x)
|
||||
regex='image'
|
||||
;;
|
||||
ppc|ppc64)
|
||||
regex='vmlinux'
|
||||
;;
|
||||
i386|x86_64)
|
||||
regex='vmlinuz'
|
||||
;;
|
||||
arm*)
|
||||
regex='[uz]Image'
|
||||
;;
|
||||
aarch64)
|
||||
regex='Image'
|
||||
;;
|
||||
*) regex='vmlinu.'
|
||||
;;
|
||||
esac
|
||||
|
||||
kernel_images=""
|
||||
initrd_images=""
|
||||
for kernel_image in $(ls $boot_dir \
|
||||
| sed -ne "\|^$regex\(-[0-9.]\+-[0-9]\+-[a-z0-9]\+$\)\?|p" \
|
||||
| grep -v kdump$ ) ; do
|
||||
|
||||
# Note that we cannot check the RPM database here -- this
|
||||
# script is itself called from within the binary kernel
|
||||
# packages, and rpm does not allow recursive calls.
|
||||
|
||||
[ -L "$boot_dir/$kernel_image" ] && continue
|
||||
[ "${kernel_image%%.gz}" != "$kernel_image" ] && continue
|
||||
kernel_version=$(/usr/bin/get_kernel_version \
|
||||
$boot_dir/$kernel_image 2> /dev/null)
|
||||
initrd_image=$(echo $kernel_image | sed -e "s|${regex}|initrd|")
|
||||
if [ "$kernel_image" != "$initrd_image" -a \
|
||||
-n "$kernel_version" -a \
|
||||
-d "/lib/modules/$kernel_version" ]; then
|
||||
kernel_images="$kernel_images $boot_dir/$kernel_image"
|
||||
initrd_images="$initrd_images $boot_dir/$initrd_image"
|
||||
fi
|
||||
done
|
||||
for kernel_image in $kernel_images;do
|
||||
kernels="$kernels ${kernel_image#*-}"
|
||||
done
|
||||
for initrd_image in $initrd_images;do
|
||||
targets="$targets $initrd_image"
|
||||
done
|
||||
}
|
||||
|
||||
while (($# > 0)); do
|
||||
case ${1%%=*} in
|
||||
-f) read_arg feature_list "$@" || shift $?
|
||||
# Could be several features
|
||||
;;
|
||||
-k) # Would be nice to get a list of images here
|
||||
read_arg kernel_images "$@" || shift $?
|
||||
for kernel_image in $kernel_images;do
|
||||
kernels="$kernels ${kernel_image#*-}"
|
||||
done
|
||||
;;
|
||||
-i) read_arg initrd_images "$@" || shift $?
|
||||
for initrd_image in $initrd_images;do
|
||||
# Check if the initrd_image contains a path.
|
||||
# if not, then add the default boot_dir
|
||||
dname=`dirname $initrd_image`
|
||||
if [ "$dname" == "." ]; then
|
||||
targets="$targets $boot_dir/$initrd_image";
|
||||
else
|
||||
targets="$targets $initrd_image";
|
||||
fi
|
||||
done
|
||||
;;
|
||||
-b) read_arg boot_dir "$@" || shift $?
|
||||
if [ ! -d $boot_dir ];then
|
||||
error "Boot directory $boot_dir does not exist"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-t) read_arg tmp_dir "$@" || shift $?
|
||||
dracut_args="${dracut_args} --tmpdir $tmp_dir"
|
||||
;;
|
||||
-M) read_arg map_file "$@" || shift $?
|
||||
;;
|
||||
-A) host_only=0;;
|
||||
-B) skip_update_bootloader=1;;
|
||||
-v|--verbose) dracut_args="${dracut_args} -v";;
|
||||
-L) logfile=;;
|
||||
-h|--help) usage -n;;
|
||||
-m) read_arg module_list "$@" || shift $? ;;
|
||||
-u) read_arg domu_module_list "$@" || shift $?
|
||||
echo "mkinitrd: DomU modules not yet supported" ;;
|
||||
-d) read_arg rootfs "$@" || shift $?
|
||||
dracut_args="${dracut_args} --filesystems $rootfs" ;;
|
||||
-D) read_arg dhcp_if "$@" || shift $?
|
||||
dracut_cmdline="${dracut_cmdline} ip=${dhcp_if}:dhcp"
|
||||
;;
|
||||
-I) read_arg static_if "$@" || shift $?
|
||||
dracut_cmdline="${dracut_cmdline} ip=$(ipconfig $static_if)":
|
||||
;;
|
||||
-a) read_arg acpi_dsdt "$@" || shift $?
|
||||
echo "Obsolete -a param, use acpi_table_dir= and acpi_override= variables in /etc/dracut.conf.d/"
|
||||
exit 1
|
||||
;;
|
||||
-s) read_arg boot_splash "$@" || shift $?
|
||||
echo "mkinitrd: boot splash not yet supported"
|
||||
exit 1
|
||||
;;
|
||||
-V) echo "mkinitrd: vendor scipts are no longer supported"
|
||||
exit 1;;
|
||||
--dracut)
|
||||
read_arg dracut_cmd "$@" || shift $? ;;
|
||||
--version|-R)
|
||||
echo "mkinitrd: dracut compatibility wrapper"
|
||||
exit 0;;
|
||||
--quiet|-q) quiet=1;;
|
||||
*) if [[ ! $targets ]]; then
|
||||
targets=$1
|
||||
elif [[ ! $kernels ]]; then
|
||||
kernels=$1
|
||||
else
|
||||
usage
|
||||
fi;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
[[ $targets && $kernels ]] || default_kernel_images
|
||||
if [[ ! $targets || ! $kernels ]];then
|
||||
error "No kernel found in $boot_dir"
|
||||
fi
|
||||
|
||||
# We can have several targets/kernels, transform the list to an array
|
||||
targets=( $targets )
|
||||
[[ $kernels ]] && kernels=( $kernels )
|
||||
|
||||
[[ $logfile ]] && dracut_args="${dracut_args} --logfile $logfile"
|
||||
dracut_args="${dracut_args} --force"
|
||||
|
||||
[[ $dracut_cmdline ]] && dracut_args="${dracut_args} --kernel-cmdline ${dracut_cmdline}"
|
||||
[ -z "$(type -p update-bootloader)" ] && skip_update_bootloader=1
|
||||
|
||||
# Update defaults from /etc/sysconfig/kernel
|
||||
if [ -f /etc/sysconfig/kernel ] ; then
|
||||
. /etc/sysconfig/kernel
|
||||
fi
|
||||
[[ $module_list ]] || module_list="${INITRD_MODULES}"
|
||||
[[ $domu_module_list ]] || domu_module_list="${DOMU_INITRD_MODULES}"
|
||||
shopt -s extglob
|
||||
|
||||
for ((i=0 ; $i<${#targets[@]} ; i++)); do
|
||||
|
||||
if [[ $img_vers ]];then
|
||||
target="${targets[$i]}-${kernels[$i]}"
|
||||
else
|
||||
target="${targets[$i]}"
|
||||
fi
|
||||
kernel="${kernels[$i]}"
|
||||
|
||||
if is_xen_kernel $kernel $rootfs ; then
|
||||
modules_all="${module_list} ${domu_module_list}"
|
||||
else
|
||||
modules_all="${module_list}"
|
||||
fi
|
||||
|
||||
# Remove leading and trailing spaces needs (set above): shopt -s extglob
|
||||
modules_all=${modules_all%%+([[:space:]])}
|
||||
modules_all=${modules_all##+([[:space:]])}
|
||||
|
||||
echo "Creating initrd: $target"
|
||||
|
||||
# Duplicate code: No way found how to redirect output based on $quiet
|
||||
if [[ $quiet == 1 ]];then
|
||||
# Duplicate code: --force-drivers must not be called with empty string
|
||||
# -> dracut bug workarounded ugly, because of complex whitespace
|
||||
# expansion magics
|
||||
if [ -n "${modules_all}" ];then
|
||||
$dracut_cmd $dracut_args --force-drivers "${modules_all}" "$target" "$kernel" &>/dev/null
|
||||
else
|
||||
$dracut_cmd $dracut_args "$target" "$kernel" &>/dev/null
|
||||
fi
|
||||
else
|
||||
if [ -n "${modules_all}" ];then
|
||||
$dracut_cmd $dracut_args --force-drivers "${modules_all}" "$target" "$kernel"
|
||||
else
|
||||
$dracut_cmd $dracut_args "$target" "$kernel"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$skip_update_bootloader" ] ; then
|
||||
echo 2>&1 "Did not refresh the bootloader. You might need to refresh it manually."
|
||||
else
|
||||
update-bootloader --refresh
|
||||
fi
|
@@ -41,8 +41,8 @@ OPTIONS
|
||||
|
||||
**--preload=<module>**::
|
||||
preload the kernel module <module> in the initramfs before any other kernel
|
||||
modules are loaded. This can be used to ensure a certain device naming, which
|
||||
should in theory be avoided and the use of symbolic links in /dev is
|
||||
modules are loaded. This can be used to ensure a certain device naming,
|
||||
which should in theory be avoided and the use of symbolic links in /dev is
|
||||
encouraged.
|
||||
|
||||
**--nocompress**::
|
||||
|
@@ -1,15 +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
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
[ -x /bin/bash ]
|
||||
require_binaries /bin/bash
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
# If another shell is already installed, do not use bash
|
||||
[[ -x $initdir/bin/sh ]] && return
|
||||
|
@@ -1,17 +1,18 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
[ -x /sbin/bootchartd ] || return 1
|
||||
require_binaries /sbin/bootchartd || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_symlink /init /sbin/init
|
||||
inst_dir /lib/bootchart/tmpfs
|
||||
|
@@ -1,15 +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
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
[ -x /bin/dash ]
|
||||
require_binaries /bin/dash
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
# If another shell is already installed, do not use dash
|
||||
[[ -x $initdir/bin/sh ]] && return
|
||||
|
@@ -1,17 +1,18 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
[ -x $systemdutildir/systemd-bootchart ] || return 1
|
||||
require_binaries $systemdutildir/systemd-bootchart || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_symlink /init /sbin/init
|
||||
inst_multiple $systemdutildir/systemd-bootchart
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
|
||||
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
|
||||
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
mount_boot()
|
||||
{
|
||||
@@ -60,8 +58,8 @@ do_rhevh_check()
|
||||
KERNEL=$(uname -r)
|
||||
kpath=${1}
|
||||
|
||||
# If we're on RHEV-H, the kernel is in /dev/.initramfs/live/vmlinuz0
|
||||
HMAC_SUM_ORIG=$(cat /boot/.vmlinuz-${KERNEL}.hmac | while read a b; do printf "%s\n" $a; done)
|
||||
# If we're on RHEV-H, the kernel is in /run/initramfs/live/vmlinuz0
|
||||
HMAC_SUM_ORIG=$(cat $NEWROOT/boot/.vmlinuz-${KERNEL}.hmac | while read a b; do printf "%s\n" $a; done)
|
||||
HMAC_SUM_CALC=$(sha512hmac $kpath | while read a b; do printf "%s\n" $a; done || return 1)
|
||||
if [ -z "$HMAC_SUM_ORIG" ] || [ -z "$HMAC_SUM_CALC" ] || [ "${HMAC_SUM_ORIG}" != "${HMAC_SUM_CALC}" ]; then
|
||||
warn "HMAC sum mismatch"
|
||||
@@ -96,7 +94,6 @@ do_fips()
|
||||
_found=0
|
||||
while read _k _s _v; do
|
||||
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
|
||||
[ "$_k" = "driver" ] && _v=$(str_replace "$_v" "_" "-")
|
||||
[ "$_v" != "$_module" ] && continue
|
||||
_found=1
|
||||
break
|
||||
@@ -112,10 +109,10 @@ do_fips()
|
||||
rmmod tcrypt
|
||||
|
||||
info "Checking integrity of kernel"
|
||||
if [ -e "$NEWROOT/dev/.initramfs/live/vmlinuz0" ]; then
|
||||
do_rhevh_check "$NEWROOT/dev/.initramfs/live/vmlinuz0" || return 1
|
||||
elif [ -e "$NEWROOT/dev/.initramfs/live/isolinux/vmlinuz0" ]; then
|
||||
do_rhevh_check "$NEWROOT/dev/.initramfs/live/isolinux/vmlinuz0" || return 1
|
||||
if [ -e "/run/initramfs/live/vmlinuz0" ]; then
|
||||
do_rhevh_check /run/initramfs/live/vmlinuz0 || return 1
|
||||
elif [ -e "/run/initramfs/live/isolinux/vmlinuz0" ]; then
|
||||
do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1
|
||||
else
|
||||
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
|
||||
fi
|
||||
|
@@ -1,19 +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
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
local _fipsmodules _mod
|
||||
_fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 blowfish camellia cast6 cbc ccm "
|
||||
_fipsmodules+="chainiv crc32c cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod "
|
||||
_fipsmodules+="chainiv crc32c crct10dif_generic cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod "
|
||||
_fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 "
|
||||
_fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic "
|
||||
_fipsmodules+="sha384 sha512 sha512_generic tcrypt tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib"
|
||||
@@ -28,6 +29,7 @@ installkernel() {
|
||||
done
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _dir
|
||||
inst_hook pre-trigger 01 "$moddir/fips-boot.sh"
|
||||
@@ -38,8 +40,10 @@ install() {
|
||||
|
||||
inst_libdir_file libsoftokn3.so libsoftokn3.so \
|
||||
libsoftokn3.chk libfreebl3.so libfreebl3.chk \
|
||||
libssl.so 'hmaccalc/sha512hmac.hmac' libssl.so.10
|
||||
libssl.so 'hmaccalc/sha512hmac.hmac' libssl.so.10 \
|
||||
libfreeblpriv3.so libfreeblpriv3.chk
|
||||
|
||||
inst_multiple -o prelink
|
||||
inst_simple /etc/system-fips
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/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)
|
||||
|
||||
|
@@ -1,19 +1,24 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
type -P capsh >/dev/null 2>&1
|
||||
require_binaries capsh
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_hook pre-pivot 00 "$moddir/caps.sh"
|
||||
inst $(type -P capsh 2>/dev/null) /usr/sbin/capsh
|
||||
# capsh wants bash and we need bash also
|
||||
inst /bin/bash
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook pre-pivot 00 "$moddir/caps.sh"
|
||||
inst $(type -P capsh 2>/dev/null) /usr/sbin/capsh
|
||||
# capsh wants bash and we need bash also
|
||||
inst /bin/bash
|
||||
else
|
||||
dwarning "caps: does not work with systemd in the initramfs"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@@ -1,15 +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
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
local _fipsmodules _mod
|
||||
_fipsmodules="aesni-intel ghash_clmulni_intel"
|
||||
@@ -24,6 +25,7 @@ installkernel() {
|
||||
done
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
return 0
|
||||
}
|
||||
|
2
modules.d/03modsign/load-modsign-keys.sh
Normal file → Executable file
2
modules.d/03modsign/load-modsign-keys.sh
Normal file → Executable file
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Licensed under the GPLv2
|
||||
#
|
||||
|
9
modules.d/03modsign/module-setup.sh
Normal file → Executable file
9
modules.d/03modsign/module-setup.sh
Normal file → Executable file
@@ -1,14 +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
|
||||
#
|
||||
# Licensed under the GPLv2
|
||||
#
|
||||
# Copyright 2013 Red Hat, Inc.
|
||||
# Peter Jones <pjones@redhat.com>
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
[[ -x /usr/bin/keyctl ]] || return 1
|
||||
require_binaries keyctl || return 1
|
||||
|
||||
# do not include module in hostonly mode,
|
||||
# if no keys are present
|
||||
@@ -20,13 +19,15 @@ check() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_dir /lib/modules/keys
|
||||
inst_binary /usr/bin/keyctl
|
||||
inst_binary keyctl
|
||||
|
||||
inst_hook pre-trigger 01 "$moddir/load-modsign-keys.sh"
|
||||
|
||||
|
@@ -1,16 +1,17 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
# do not add this module by default
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple -o ps grep more cat rm strace free showmount \
|
||||
ping netstat rpcinfo vi scp ping6 ssh \
|
||||
|
@@ -1,15 +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
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_hook cmdline 00 "$moddir/watchdog.sh"
|
||||
inst_hook cmdline 50 "$moddir/watchdog.sh"
|
||||
|
@@ -1,17 +1,18 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
type -P busybox >/dev/null || return 1
|
||||
require_binaries busybox || return 1
|
||||
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _i _progs _path _busybox
|
||||
_busybox=$(type -P busybox)
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
[ -n "$DRACUT_SYSTEMD" ] && exit 0
|
||||
|
||||
|
@@ -1,27 +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
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
|
||||
require_binaries setfont loadkeys kbd_mode || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
if dracut_module_included "systemd"; then
|
||||
[[ -f /etc/vconsole.conf ]] || return 0
|
||||
unset FONT
|
||||
unset KEYMAP
|
||||
. /etc/vconsole.conf
|
||||
# if vconsole.conf has no settings, do not include anything
|
||||
[[ $FONT ]] || [[ $KEYMAP ]] || return 0
|
||||
[[ -f /etc/vconsole.conf ]] && . /etc/vconsole.conf
|
||||
fi
|
||||
|
||||
inst_multiple -o $systemdutildir/systemd-vconsole-setup
|
||||
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
|
||||
DEFAULT_FONT="${i18n_default_font:-LatArCyrHeb-16}"
|
||||
I18N_CONF="/etc/locale.conf"
|
||||
@@ -153,6 +153,9 @@ install() {
|
||||
# Gentoo user may have KEYMAP set to something like "-u pl2",
|
||||
KEYMAP=${KEYMAP#-* }
|
||||
|
||||
# openSUSE user may have KEYMAP set to something like ".gz"
|
||||
KEYMAP=${KEYMAP/.gz/}
|
||||
|
||||
# KEYTABLE is a bit special - it defines base keymap name and UNICODE
|
||||
# determines whether non-UNICODE or UNICODE version is used
|
||||
|
||||
@@ -202,10 +205,20 @@ install() {
|
||||
inst_simple ${kbddir}/unimaps/${FONT_UNIMAP}.uni
|
||||
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}
|
||||
if dracut_module_included "systemd" && [[ -f ${I18N_CONF} ]]; then
|
||||
inst_simple ${I18N_CONF}
|
||||
else
|
||||
mksubdirs ${initdir}${I18N_CONF}
|
||||
print_vars LC_ALL LANG >> ${initdir}${I18N_CONF}
|
||||
fi
|
||||
|
||||
if dracut_module_included "systemd" && [[ -f ${VCONFIG_CONF} ]]; then
|
||||
inst_simple ${VCONFIG_CONF}
|
||||
else
|
||||
mksubdirs ${initdir}${VCONFIG_CONF}
|
||||
print_vars KEYMAP EXT_KEYMAPS UNICODE FONT FONT_MAP FONT_UNIMAP >> ${initdir}${VCONFIG_CONF}
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -229,16 +242,13 @@ install() {
|
||||
return 0
|
||||
}
|
||||
|
||||
if checks
|
||||
then
|
||||
if checks; then
|
||||
install_base
|
||||
|
||||
if [[ ${hostonly} ]]
|
||||
then
|
||||
if [[ ${hostonly} ]] && ! [[ ${i18n_install_all} == "yes" ]]; then
|
||||
install_local_i18n || install_all_kbd
|
||||
else
|
||||
install_all_kbd
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
@@ -1,42 +1,33 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
inst_key_val() {
|
||||
local _value
|
||||
local _file
|
||||
local _default
|
||||
_default=$1
|
||||
shift
|
||||
_file=$1
|
||||
shift
|
||||
_value=$(getarg $@)
|
||||
_file="$1"; shift
|
||||
_key="$1"; shift
|
||||
_default="$1"; shift
|
||||
_value="$(getarg $@)"
|
||||
[ -z "${_value}" ] && _value=$_default
|
||||
if [ -n "${_value}" ]; then
|
||||
printf '%s="%s"\n' $2 ${_value} >> $_file
|
||||
printf '%s="%s"\n' ${_key} ${_value} >> $_file
|
||||
fi
|
||||
unset _file
|
||||
unset _value
|
||||
}
|
||||
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.keymap KEYMAP -d KEYTABLE
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.font FONT -d SYSFONT
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.font.map FONT_MAP -d CONTRANS
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.font.unimap FONT_UNIMAP -d UNIMAP
|
||||
inst_key_val 1 /etc/vconsole.conf vconsole.font.unicode UNICODE vconsole.unicode
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.keymap.ext EXT_KEYMAP
|
||||
inst_key_val /etc/vconsole.conf KEYMAP '' rd.vconsole.keymap KEYMAP -d KEYTABLE
|
||||
inst_key_val /etc/vconsole.conf FONT '' rd.vconsole.font FONT -d SYSFONT
|
||||
inst_key_val /etc/vconsole.conf FONT_MAP '' rd.vconsole.font.map FONT_MAP -d CONTRANS
|
||||
inst_key_val /etc/vconsole.conf FONT_UNIMAP '' rd.vconsole.font.unimap FONT_UNIMAP -d UNIMAP
|
||||
inst_key_val /etc/vconsole.conf UNICODE 1 rd.vconsole.font.unicode UNICODE vconsole.unicode
|
||||
inst_key_val /etc/vconsole.conf EXT_KEYMAP '' rd.vconsole.keymap.ext EXT_KEYMAP
|
||||
|
||||
inst_key_val '' /etc/locale.conf locale.LANG LANG
|
||||
inst_key_val '' /etc/locale.conf locale.LC_ALL LC_ALL
|
||||
inst_key_val /etc/locale.conf LANG '' rd.locale.LANG LANG
|
||||
inst_key_val /etc/locale.conf LC_ALL '' rd.locale.LC_ALL LC_ALL
|
||||
|
||||
if [ -f /etc/locale.conf ]; then
|
||||
. /etc/locale.conf
|
||||
export LANG
|
||||
export LC_ALL
|
||||
fi
|
||||
|
||||
if [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
rm -f -- /etc/udev/rules.d/10-console.rules
|
||||
rm -f -- /lib/udev/rules.d/10-console.rules
|
||||
rm -f -- /lib/udev/console_init
|
||||
fi
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
ROOT="$1"
|
||||
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if getargbool 0 rd.convertfs; then
|
||||
if getargbool 0 rd.debug; then
|
||||
|
@@ -1,16 +1,17 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
[[ $mount_needs ]] && return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple bash find ldconfig mv rm cp ln
|
||||
inst_hook pre-pivot 99 "$moddir/do-convertfs.sh"
|
||||
|
@@ -1,6 +1,15 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
|
||||
# We already need a set netif here
|
||||
netif=$interface
|
||||
|
||||
# Huh? Interface configured?
|
||||
[ -f "/tmp/net.$netif.up" ] && exit 0
|
||||
|
||||
setup_interface() {
|
||||
ip=$new_ip_address
|
||||
@@ -12,6 +21,7 @@ setup_interface() {
|
||||
search=$(printf -- "$new_domain_search")
|
||||
namesrv=$new_domain_name_servers
|
||||
hostname=$new_host_name
|
||||
lease_time=$new_dhcp_lease_time
|
||||
|
||||
[ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override
|
||||
|
||||
@@ -29,9 +39,11 @@ setup_interface() {
|
||||
fi
|
||||
fi
|
||||
|
||||
ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif
|
||||
ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} \
|
||||
valid_lft ${lease_time} preferred_lft ${lease_time} \
|
||||
dev $netif
|
||||
|
||||
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
[ -n "$gw" ] && echo ip route replace default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
|
||||
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
|
||||
if [ -n "$namesrv" ] ; then
|
||||
@@ -42,27 +54,49 @@ setup_interface() {
|
||||
|
||||
# Note: hostname can be fqdn OR short hostname, so chop off any
|
||||
# trailing domain name and explicity add any domain if set.
|
||||
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
}
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
setup_interface6() {
|
||||
domain=$new_domain_name
|
||||
search=$(printf -- "$new_domain_search")
|
||||
namesrv=$new_domain_name_servers
|
||||
hostname=$new_host_name
|
||||
[ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
|
||||
[ -n "$new_max_life" ] && lease_time=$new_max_life
|
||||
preferred_lft=$lease_time
|
||||
[ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
|
||||
|
||||
export PS4="dhclient.$interface.$$ + "
|
||||
exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
[ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override
|
||||
|
||||
# We already need a set netif here
|
||||
netif=$interface
|
||||
ip -6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \
|
||||
dev ${netif} scope global \
|
||||
${lease_time:+valid_lft $lease_time} \
|
||||
${preferred_lft:+preferred_lft ${preferred_lft}}
|
||||
|
||||
# Huh? Interface configured?
|
||||
[ -f "/tmp/net.$netif.up" ] && exit 0
|
||||
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
|
||||
if [ -n "$namesrv" ] ; then
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
done
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
|
||||
# Note: hostname can be fqdn OR short hostname, so chop off any
|
||||
# trailing domain name and explicity add any domain if set.
|
||||
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
}
|
||||
|
||||
case $reason in
|
||||
PREINIT)
|
||||
echo "dhcp: PREINIT $netif up"
|
||||
linkup $netif
|
||||
;;
|
||||
|
||||
PREINIT6)
|
||||
echo "dhcp: PREINIT $netif up"
|
||||
linkup $netif
|
||||
;;
|
||||
|
||||
BOUND)
|
||||
echo "dhcp: BOND setting $netif"
|
||||
unset layer2
|
||||
@@ -87,12 +121,31 @@ case $reason in
|
||||
echo "setup_net $netif"
|
||||
echo "source_hook initqueue/online $netif"
|
||||
[ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
|
||||
echo "> /tmp/setup_net_$netif.ok"
|
||||
echo "> /tmp/setup_net_\$(cat /sys/class/net/$netif/address).ok"
|
||||
echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh"
|
||||
} > $hookdir/initqueue/setup_net_$netif.sh
|
||||
|
||||
echo "[ -f /tmp/setup_net_$netif.ok ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
|
||||
echo "[ -f /tmp/net.$netif.did-setup ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
|
||||
>/tmp/net.$netif.up
|
||||
;;
|
||||
|
||||
BOUND6)
|
||||
echo "dhcp: BOND6 setting $netif"
|
||||
setup_interface6
|
||||
|
||||
set | while read line; do
|
||||
[ "${line#new_}" = "$line" ] && continue
|
||||
echo "$line"
|
||||
done >/tmp/dhclient.$netif.dhcpopts
|
||||
|
||||
{
|
||||
echo '. /lib/net-lib.sh'
|
||||
echo "setup_net $netif"
|
||||
echo "source_hook initqueue/online $netif"
|
||||
[ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
|
||||
echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh"
|
||||
} > $hookdir/initqueue/setup_net_$netif.sh
|
||||
|
||||
echo "[ -f /tmp/net.$netif.did-setup ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
|
||||
>/tmp/net.$netif.up
|
||||
;;
|
||||
*) echo "dhcp: $reason";;
|
||||
|
@@ -1,21 +1,23 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# Don't continue if root is ok
|
||||
[ -n "$rootok" ] && return
|
||||
|
||||
# This script is sourced, so root should be set. But let's be paranoid
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
[ -z "$netroot" ] && netroot=$(getarg netroot=)
|
||||
|
||||
if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] ; then
|
||||
if [ -z "$netroot" ]; then
|
||||
for netroot in $(getargs netroot=); do
|
||||
[ "$netroot" = "dhcp" ] && break
|
||||
[ "$netroot" = "dhcp6" ] && break
|
||||
done
|
||||
[ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] || unset netroot
|
||||
fi
|
||||
|
||||
if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ]; then
|
||||
# Tell ip= checker that we need dhcp
|
||||
NEEDDHCP="1"
|
||||
|
||||
# Done, all good!
|
||||
rootok=1
|
||||
if [ "$netroot" != "dhcp" ] ; then
|
||||
if [ "$netroot" != "dhcp" ] && [ "$netroot" != "dhcp6" ]; then
|
||||
netroot=$root
|
||||
fi
|
||||
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# if there are no ifname parameters, just use NAME=KERNEL
|
||||
if ! getarg ifname= >/dev/null ; then
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# We don't need to check for ip= errors here, that is handled by the
|
||||
# cmdline parser script
|
||||
@@ -60,7 +58,7 @@ fi
|
||||
# bridge this interface?
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
for ethname in $ethnames ; do
|
||||
for ethname in $bridgeslaves ; do
|
||||
if [ "$netif" = "$ethname" ]; then
|
||||
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
|
||||
: # We need to really setup bond (recursive call)
|
||||
@@ -80,19 +78,33 @@ fi
|
||||
# in netroot case we prefer netroot to bringup $netif automaticlly
|
||||
[ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2"
|
||||
[ -z "$netroot" ] && [ -z "$manualup" ] && exit 0
|
||||
[ -n "$manualup" ] && >/tmp/net.$netif.manualup
|
||||
if [ -n "$manualup" ]; then
|
||||
>/tmp/net.$netif.manualup
|
||||
else
|
||||
[ -e /tmp/net.${netif}.did-setup ] && exit 0
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
[ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && exit 0
|
||||
fi
|
||||
|
||||
# Run dhclient
|
||||
do_dhcp() {
|
||||
# dhclient-script will mark the netif up and generate the online
|
||||
# event for nfsroot
|
||||
# XXX add -V vendor class and option parsing per kernel
|
||||
|
||||
[ -e /tmp/dhclient.$netif.pid ] && return 0
|
||||
|
||||
if ! iface_has_link $netif; then
|
||||
echo "No carrier detected"
|
||||
return 1
|
||||
fi
|
||||
echo "Starting dhcp for interface $netif"
|
||||
dhclient "$@" -1 -q -cf /etc/dhclient.conf -pf /tmp/dhclient.$netif.pid -lf /tmp/dhclient.$netif.lease $netif \
|
||||
|| echo "dhcp failed"
|
||||
}
|
||||
|
||||
load_ipv6() {
|
||||
[ -d /proc/sys/net/ipv6 ] && return
|
||||
modprobe ipv6
|
||||
i=0
|
||||
while [ ! -d /proc/sys/net/ipv6 ]; do
|
||||
@@ -117,23 +129,23 @@ do_ipv6auto() {
|
||||
|
||||
# Handle static ip configuration
|
||||
do_static() {
|
||||
strstr $ip '*:*:*' && load_ipv6
|
||||
strglobin $ip '*:*:*' && load_ipv6
|
||||
|
||||
linkup $netif
|
||||
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
|
||||
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
|
||||
if strstr $ip '*:*:*'; then
|
||||
if strglobin $ip '*:*:*'; then
|
||||
# note no ip addr flush for ipv6
|
||||
ip addr add $ip/$mask ${srv+peer $srv} dev $netif
|
||||
ip addr add $ip/$mask ${srv:+peer $srv} dev $netif
|
||||
wait_for_ipv6_dad $netif
|
||||
else
|
||||
ip addr flush dev $netif
|
||||
ip addr add $ip/$mask ${srv+peer $srv} brd + dev $netif
|
||||
ip addr add $ip/$mask ${srv:+peer $srv} brd + dev $netif
|
||||
fi
|
||||
|
||||
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
[ -n "$gw" ] && echo ip route replace default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
|
||||
> /tmp/setup_net_${netif}.ok
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -175,6 +187,7 @@ if [ -e /tmp/bond.${netif}.info ]; then
|
||||
|
||||
for slave in $bondslaves ; do
|
||||
ip link set $slave down
|
||||
cat /sys/class/net/$slave/address > /tmp/net.${netif}.${slave}.hwaddr
|
||||
echo "+$slave" > /sys/class/net/$bondname/bonding/slaves
|
||||
linkup $slave
|
||||
done
|
||||
@@ -203,7 +216,7 @@ if [ -e /tmp/team.info ]; then
|
||||
fi
|
||||
done
|
||||
# Do not add slaves now
|
||||
teamd -d -U -n -t $teammaster -f /etc/teamd/$teammaster.conf
|
||||
teamd -d -U -n -N -t $teammaster -f /etc/teamd/$teammaster.conf
|
||||
for slave in $working_slaves; do
|
||||
# team requires the slaves to be down before joining team
|
||||
ip link set $slave down
|
||||
@@ -221,7 +234,7 @@ if [ -e /tmp/bridge.info ]; then
|
||||
if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
|
||||
brctl addbr $bridgename
|
||||
brctl setfd $bridgename 0
|
||||
for ethname in $ethnames ; do
|
||||
for ethname in $bridgeslaves ; do
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
DO_BOND_SETUP=yes ifup $bondname -m
|
||||
elif [ "$ethname" = "$teammaster" ] ; then
|
||||
@@ -260,18 +273,15 @@ if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
|
||||
ip link set "$vlanname" up
|
||||
fi
|
||||
|
||||
# setup nameserver
|
||||
namesrv=$(getargs nameserver)
|
||||
if [ -n "$namesrv" ] ; then
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
done
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
|
||||
# No ip lines default to dhcp
|
||||
ip=$(getarg ip)
|
||||
|
||||
if [ -z "$ip" ]; then
|
||||
namesrv=$(getargs nameserver)
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
||||
done
|
||||
|
||||
if [ "$netroot" = "dhcp6" ]; then
|
||||
do_dhcp -6
|
||||
else
|
||||
@@ -303,21 +313,32 @@ for p in $(getargs ip=); do
|
||||
[ "$use_bridge" != 'true' ] && \
|
||||
[ "$use_vlan" != 'true' ] && continue
|
||||
|
||||
# setup nameserver
|
||||
namesrv="$dns1 $dns2 $(getargs nameserver)"
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
||||
done
|
||||
|
||||
# Store config for later use
|
||||
for i in ip srv gw mask hostname macaddr; do
|
||||
for i in ip srv gw mask hostname macaddr dns1 dns2; do
|
||||
eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
|
||||
done > /tmp/net.$netif.override
|
||||
|
||||
case $autoconf in
|
||||
dhcp|on|any)
|
||||
do_dhcp -4 ;;
|
||||
dhcp6)
|
||||
do_dhcp -6 ;;
|
||||
auto6)
|
||||
do_ipv6auto ;;
|
||||
*)
|
||||
do_static ;;
|
||||
esac
|
||||
for autoopt in $(str_replace "$autoconf" "," " "); do
|
||||
case $autoopt in
|
||||
dhcp|on|any)
|
||||
do_dhcp -4 ;;
|
||||
dhcp6)
|
||||
load_ipv6
|
||||
do_dhcp -6 ;;
|
||||
auto6)
|
||||
do_ipv6auto ;;
|
||||
*)
|
||||
do_static ;;
|
||||
esac
|
||||
done
|
||||
|
||||
> /tmp/net.${netif}.up
|
||||
|
||||
case $autoconf in
|
||||
dhcp|on|any|dhcp6)
|
||||
@@ -333,6 +354,24 @@ for p in $(getargs ip=); do
|
||||
;;
|
||||
esac
|
||||
|
||||
break
|
||||
exit 0
|
||||
done
|
||||
|
||||
# netif isn't the top stack? Then we should exit here.
|
||||
# eg. netif is bond0. br0 is on top of it. dhcp br0 is correct but dhcp
|
||||
# bond0 doesn't make sense.
|
||||
if [ -n "$DO_BOND_SETUP" -o -n "$DO_TEAM_SETUP" -o -n "$DO_VLAN_SETUP" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# no ip option directed at our interface?
|
||||
if [ ! -e /tmp/net.${netif}.up ]; then
|
||||
if getargs 'ip=dhcp6'; then
|
||||
load_ipv6
|
||||
do_dhcp -6
|
||||
else
|
||||
do_dhcp -4
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
for f in /tmp/dhclient.*.pid; do
|
||||
[ -e $f ] || continue
|
||||
|
@@ -1,31 +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
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
local _program
|
||||
|
||||
for _program in ip arping dhclient ; do
|
||||
if ! type -P $_program >/dev/null; then
|
||||
derror "Could not find program \"$_program\" required by network."
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
require_binaries ip arping dhclient || return 1
|
||||
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
[ -d /etc/sysconfig/network-scripts/ ] && echo ifcfg
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
# Include wired net drivers, excluding wireless
|
||||
local _arch=$(uname -m)
|
||||
|
||||
net_module_filter() {
|
||||
local _net_drivers='eth_type_trans|register_virtio_device'
|
||||
local _unwanted_drivers='/(wireless|isdn|uwb)/'
|
||||
local _net_drivers='eth_type_trans|register_virtio_device|usbnet_open'
|
||||
local _unwanted_drivers='/(wireless|isdn|uwb|net/ethernet|net/phy|net/team)/'
|
||||
local _ret
|
||||
# subfunctions inherit following FDs
|
||||
local _merge=8 _side2=9
|
||||
@@ -65,9 +61,14 @@ installkernel() {
|
||||
| net_module_filter | instmods
|
||||
|
||||
#instmods() will take care of hostonly
|
||||
instmods =drivers/net/phy ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net =drivers/net/team
|
||||
instmods \
|
||||
=drivers/net/phy \
|
||||
=drivers/net/team \
|
||||
=drivers/net/ethernet \
|
||||
ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _arch _i _dir
|
||||
inst_multiple ip arping dhclient sed
|
||||
@@ -79,10 +80,12 @@ install() {
|
||||
inst_script "$moddir/netroot.sh" "/sbin/netroot"
|
||||
inst_script "$moddir/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst_simple "$moddir/net-lib.sh" "/lib/net-lib.sh"
|
||||
inst_simple "$moddir/dhclient.conf" "/etc/dhclient.conf"
|
||||
inst_simple -H "/etc/dhclient.conf"
|
||||
cat "$moddir/dhclient.conf" >> "${initdir}/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 92 "$moddir/parse-ibft.sh"
|
||||
inst_hook cmdline 95 "$moddir/parse-vlan.sh"
|
||||
inst_hook cmdline 96 "$moddir/parse-bond.sh"
|
||||
inst_hook cmdline 96 "$moddir/parse-team.sh"
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
getargbool 0 rd.neednet && NEEDNET=1
|
||||
|
||||
@@ -16,7 +14,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
# bridge: attempt only the defined interface
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
IFACES="$IFACES ${ethnames%% *}"
|
||||
IFACES="$IFACES ${bridgeslaves%% *}"
|
||||
MASTER_IFACES="$MASTER_IFACES $bridgename"
|
||||
fi
|
||||
|
||||
@@ -54,23 +52,30 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
ifup='/sbin/ifup $env{INTERFACE}'
|
||||
[ -z "$netroot" ] && ifup="$ifup -m"
|
||||
|
||||
runcmd="RUN+=\"/sbin/initqueue --onetime $ifup\""
|
||||
runcmd="RUN+=\"/sbin/initqueue --name ifup-\$env{INTERFACE} --unique --onetime $ifup\""
|
||||
|
||||
# We have some specific interfaces to handle
|
||||
if [ -n "$IFACES" ]; then
|
||||
echo 'SUBSYSTEM!="net", GOTO="net_end"'
|
||||
echo 'ACTION=="remove", GOTO="net_end"'
|
||||
echo 'ACTION!="add|change|move", GOTO="net_end"'
|
||||
for iface in $IFACES; do
|
||||
case "$iface" in
|
||||
??:??:??:??:??:??) # MAC address
|
||||
cond="ATTR{address}==\"$iface\"" ;;
|
||||
cond="ATTR{address}==\"$iface\""
|
||||
echo "$cond, $runcmd, GOTO=\"net_end\""
|
||||
;;
|
||||
??-??-??-??-??-??) # MAC address in BOOTIF form
|
||||
cond="ATTR{address}==\"$(fix_bootif $iface)\"" ;;
|
||||
cond="ATTR{address}==\"$(fix_bootif $iface)\""
|
||||
echo "$cond, $runcmd, GOTO=\"net_end\""
|
||||
;;
|
||||
*) # an interface name
|
||||
cond="ENV{INTERFACE}==\"$iface\"" ;;
|
||||
cond="ENV{INTERFACE}==\"$iface\""
|
||||
echo "$cond, $runcmd, GOTO=\"net_end\""
|
||||
cond="NAME==\"$iface\""
|
||||
echo "$cond, $runcmd, GOTO=\"net_end\""
|
||||
;;
|
||||
esac
|
||||
# The GOTO prevents us from trying to ifup the same device twice
|
||||
echo "$cond, $runcmd, GOTO=\"net_end\""
|
||||
done
|
||||
echo 'LABEL="net_end"'
|
||||
|
||||
@@ -82,7 +87,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
for iface in $wait_ifaces; do
|
||||
if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
|
||||
echo "[ -f /tmp/setup_net_${iface}.ok ]" >$hookdir/initqueue/finished/wait-$iface.sh
|
||||
echo "[ -f /tmp/net.${iface}.did-setup ]" >$hookdir/initqueue/finished/wait-$iface.sh
|
||||
fi
|
||||
done
|
||||
# Default: We don't know the interface to use, handle all
|
||||
|
384
modules.d/40network/net-lib.sh
Normal file → Executable file
384
modules.d/40network/net-lib.sh
Normal file → Executable file
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
get_ip() {
|
||||
local iface="$1" ip=""
|
||||
@@ -28,30 +26,6 @@ iface_for_mac() {
|
||||
done
|
||||
}
|
||||
|
||||
iface_has_link() {
|
||||
local interface="$1" flags=""
|
||||
[ -n "$interface" ] || return 2
|
||||
interface="/sys/class/net/$interface"
|
||||
[ -d "$interface" ] || return 2
|
||||
flags=$(cat $interface/flags)
|
||||
echo $(($flags|0x41)) > $interface/flags # 0x41: IFF_UP|IFF_RUNNING
|
||||
[ "$(cat $interface/carrier)" = 1 ] || return 1
|
||||
# XXX Do we need to reset the flags here? anaconda never bothered..
|
||||
}
|
||||
|
||||
find_iface_with_link() {
|
||||
local iface_path="" iface=""
|
||||
for iface_path in /sys/class/net/*; do
|
||||
iface=${iface_path##*/}
|
||||
str_starts "$iface" "lo" && continue
|
||||
if iface_has_link $iface; then
|
||||
echo "$iface"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# get the iface name for the given identifier - either a MAC, IP, or iface name
|
||||
iface_name() {
|
||||
case $1 in
|
||||
@@ -106,12 +80,17 @@ ifdown() {
|
||||
ip addr flush dev $netif
|
||||
echo "#empty" > /etc/resolv.conf
|
||||
rm -f -- /tmp/net.$netif.did-setup
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
rm -f -- /tmp/net.$(cat /sys/class/net/$netif/address).did-setup
|
||||
# TODO: send "offline" uevent?
|
||||
}
|
||||
|
||||
setup_net() {
|
||||
local netif="$1" f="" gw_ip="" netroot_ip="" iface="" IFACES=""
|
||||
local _p
|
||||
[ -e /tmp/net.$netif.did-setup ] && return
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
[ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && return
|
||||
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
|
||||
[ -z "$IFACES" ] && IFACES="$netif"
|
||||
# run the scripts written by ifup
|
||||
@@ -123,6 +102,20 @@ setup_net() {
|
||||
[ -e /tmp/net.$netif.resolv.conf ] && \
|
||||
cp -f /tmp/net.$netif.resolv.conf /etc/resolv.conf
|
||||
|
||||
# add static route
|
||||
for _p in $(getargs rd.route); do
|
||||
route_to_var "$_p" || continue
|
||||
[ -n "$route_dev" ] && [ "$route_dev" != "$netif" ] && continue
|
||||
ip route add "$route_mask" ${route_gw:+via "$route_gw"} ${route_dev:+dev "$route_dev"}
|
||||
if strstr ":" "$route_mask"; then
|
||||
printf -- "%s\n" "$route_mask ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}" \
|
||||
> /tmp/net.route6."$netif"
|
||||
else
|
||||
printf -- "%s\n" "$route_mask ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}" \
|
||||
> /tmp/net.route."$netif"
|
||||
fi
|
||||
done
|
||||
|
||||
# Handle STP Timeout: arping the default gateway.
|
||||
# (or the root server, if a) it's local or b) there's no gateway.)
|
||||
# Note: This assumes that if no router is present the
|
||||
@@ -147,12 +140,14 @@ setup_net() {
|
||||
read layer2 < /sys/class/net/$netif/device/layer2
|
||||
fi
|
||||
|
||||
if [ "$layer2" != "0" ] && [ -n "$dest" ] && ! arping -q -f -w 60 -I $netif $dest ; then
|
||||
info "Resolving $dest via ARP on $netif failed"
|
||||
if [ "$layer2" != "0" ] && [ -n "$dest" ] && ! strstr "$dest" ":"; then
|
||||
arping -q -f -w 60 -I $netif $dest || info "Resolving $dest via ARP on $netif failed"
|
||||
fi
|
||||
unset layer2
|
||||
|
||||
> /tmp/net.$netif.did-setup
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
> /tmp/net.$(cat /sys/class/net/$netif/address).did-setup
|
||||
}
|
||||
|
||||
save_netinfo() {
|
||||
@@ -203,11 +198,14 @@ fix_bootif() {
|
||||
}
|
||||
|
||||
ibft_to_cmdline() {
|
||||
local iface="" mac="" dev=""
|
||||
local dhcp="" ip="" gw="" mask="" hostname=""
|
||||
local iface=""
|
||||
modprobe -q iscsi_ibft
|
||||
(
|
||||
for iface in /sys/firmware/ibft/ethernet*; do
|
||||
local mac="" dev=""
|
||||
local dhcp="" ip="" gw="" mask="" hostname=""
|
||||
local dns1 dns2
|
||||
|
||||
[ -e ${iface}/mac ] || continue
|
||||
mac=$(read a < ${iface}/mac; echo $a)
|
||||
[ -z "$mac" ] && continue
|
||||
@@ -216,10 +214,6 @@ ibft_to_cmdline() {
|
||||
[ -e /tmp/net.${dev}.has_ibft_config ] && continue
|
||||
|
||||
[ -e ${iface}/dhcp ] && dhcp=$(read a < ${iface}/dhcp; echo $a)
|
||||
if [ -e ${iface}/vlan ]; then
|
||||
vlan=$(read a < ${iface}/vlan; echo $a)
|
||||
echo "vlan=$vlan:$dev"
|
||||
fi
|
||||
|
||||
if [ -n "$dhcp" ]; then
|
||||
echo "ip=$dev:dhcp"
|
||||
@@ -229,9 +223,11 @@ ibft_to_cmdline() {
|
||||
[ "$ip" = "0.0.0.0" ] && continue
|
||||
[ -e ${iface}/gateway ] && gw=$(read a < ${iface}/gateway; echo $a)
|
||||
[ -e ${iface}/subnet-mask ] && mask=$(read a < ${iface}/subnet-mask; echo $a)
|
||||
[ -e ${iface}/primary-dns ] && dns1=$(read a < ${iface}/primary-dns; echo $a)
|
||||
[ -e ${iface}/secondary-dns ] && dns2=$(read a < ${iface}/secondary-dns; echo $a)
|
||||
[ -e ${iface}/hostname ] && hostname=$(read a < ${iface}/hostname; echo $a)
|
||||
if [ -n "$ip" ] && [ -n "$mask" ]; then
|
||||
echo "ip=$ip::$gw:$mask:$hostname:$dev:none"
|
||||
echo "ip=$ip::$gw:$mask:$hostname:$dev:none${dns1:+:$dns1}${dns2:+:$dns2}"
|
||||
else
|
||||
warn "${iface} does not contain a valid iBFT configuration"
|
||||
warn "ip-addr=$ip"
|
||||
@@ -244,11 +240,28 @@ ibft_to_cmdline() {
|
||||
ls -l ${iface} | vinfo
|
||||
fi
|
||||
|
||||
echo $mac > /tmp/net.${dev}.has_ibft_config
|
||||
if [ -e ${iface}/vlan ]; then
|
||||
vlan=$(read a < ${iface}/vlan; echo $a)
|
||||
if [ "$vlan" -ne "0" ]; then
|
||||
case "$vlan" in
|
||||
[0-9]*)
|
||||
echo "vlan=$dev.$vlan:$dev"
|
||||
echo $mac > /tmp/net.${dev}.${vlan}.has_ibft_config
|
||||
;;
|
||||
*)
|
||||
echo "vlan=$vlan:$dev"
|
||||
echo $mac > /tmp/net.${vlan}.has_ibft_config
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo $mac > /tmp/net.${dev}.has_ibft_config
|
||||
fi
|
||||
else
|
||||
echo $mac > /tmp/net.${dev}.has_ibft_config
|
||||
fi
|
||||
|
||||
done
|
||||
) >> /etc/cmdline.d/40-ibft.conf
|
||||
# reread cmdline
|
||||
unset CMDLINE
|
||||
}
|
||||
|
||||
parse_iscsi_root()
|
||||
@@ -256,66 +269,63 @@ parse_iscsi_root()
|
||||
local v
|
||||
v=${1#iscsi:}
|
||||
|
||||
# extract authentication info
|
||||
# extract authentication info
|
||||
case "$v" in
|
||||
*@*:*:*:*:*)
|
||||
authinfo=${v%%@*}
|
||||
v=${v#*@}
|
||||
# allow empty authinfo to allow having an @ in iscsi_target_name like this:
|
||||
# netroot=iscsi:@192.168.1.100::3260::iqn.2009-01.com.example:testdi@sk
|
||||
if [ -n "$authinfo" ]; then
|
||||
OLDIFS="$IFS"
|
||||
IFS=:
|
||||
set $authinfo
|
||||
IFS="$OLDIFS"
|
||||
if [ $# -gt 4 ]; then
|
||||
warn "Wrong authentication info in iscsi: parameter!"
|
||||
return 1
|
||||
fi
|
||||
iscsi_username=$1
|
||||
iscsi_password=$2
|
||||
if [ $# -gt 2 ]; then
|
||||
iscsi_in_username=$3
|
||||
iscsi_in_password=$4
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*@*:*:*:*:*)
|
||||
authinfo=${v%%@*}
|
||||
v=${v#*@}
|
||||
# allow empty authinfo to allow having an @ in iscsi_target_name like this:
|
||||
# netroot=iscsi:@192.168.1.100::3260::iqn.2009-01.com.example:testdi@sk
|
||||
if [ -n "$authinfo" ]; then
|
||||
OLDIFS="$IFS"
|
||||
IFS=:
|
||||
set $authinfo
|
||||
IFS="$OLDIFS"
|
||||
if [ $# -gt 4 ]; then
|
||||
warn "Wrong authentication info in iscsi: parameter!"
|
||||
return 1
|
||||
fi
|
||||
iscsi_username=$1
|
||||
iscsi_password=$2
|
||||
if [ $# -gt 2 ]; then
|
||||
iscsi_in_username=$3
|
||||
iscsi_in_password=$4
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# extract target ip
|
||||
# extract target ip
|
||||
case "$v" in
|
||||
[[]*[]]:*)
|
||||
iscsi_target_ip=${v#[[]}
|
||||
iscsi_target_ip=${iscsi_target_ip%%[]]*}
|
||||
v=${v#[[]$iscsi_target_ip[]]:}
|
||||
;;
|
||||
*)
|
||||
iscsi_target_ip=${v%%[:]*}
|
||||
v=${v#$iscsi_target_ip:}
|
||||
;;
|
||||
[[]*[]]:*)
|
||||
iscsi_target_ip=${v#[[]}
|
||||
iscsi_target_ip=${iscsi_target_ip%%[]]*}
|
||||
v=${v#[[]$iscsi_target_ip[]]:}
|
||||
;;
|
||||
*)
|
||||
iscsi_target_ip=${v%%[:]*}
|
||||
v=${v#$iscsi_target_ip:}
|
||||
;;
|
||||
esac
|
||||
|
||||
# extract target name
|
||||
unset iscsi_target_name
|
||||
# extract target name
|
||||
case "$v" in
|
||||
*:iqn.*)
|
||||
iscsi_target_name=iqn.${v##*:iqn.}
|
||||
v=${v%:iqn.*}:
|
||||
;;
|
||||
*:eui.*)
|
||||
iscsi_target_name=iqn.${v##*:eui.}
|
||||
v=${v%:iqn.*}:
|
||||
;;
|
||||
*:naa.*)
|
||||
iscsi_target_name=iqn.${v##*:naa.}
|
||||
v=${v%:iqn.*}:
|
||||
;;
|
||||
*)
|
||||
warn "Invalid iscii target name, should begin with 'iqn.' or 'eui.' or 'naa.'"
|
||||
return 1
|
||||
;;
|
||||
*:iqn.*)
|
||||
iscsi_target_name=iqn.${v##*:iqn.}
|
||||
v=${v%:iqn.*}:
|
||||
;;
|
||||
*:eui.*)
|
||||
iscsi_target_name=eui.${v##*:eui.}
|
||||
v=${v%:eui.*}:
|
||||
;;
|
||||
*:naa.*)
|
||||
iscsi_target_name=naa.${v##*:naa.}
|
||||
v=${v%:naa.*}:
|
||||
;;
|
||||
esac
|
||||
|
||||
# parse the rest
|
||||
# parse the rest
|
||||
OLDIFS="$IFS"
|
||||
IFS=:
|
||||
set $v
|
||||
@@ -323,17 +333,34 @@ parse_iscsi_root()
|
||||
|
||||
iscsi_protocol=$1; shift # ignored
|
||||
iscsi_target_port=$1; shift
|
||||
if [ $# -eq 3 ]; then
|
||||
iscsi_iface_name=$1; shift
|
||||
|
||||
if [ -n "$iscsi_target_name" ]; then
|
||||
if [ $# -eq 3 ]; then
|
||||
iscsi_iface_name=$1; shift
|
||||
fi
|
||||
if [ $# -eq 2 ]; then
|
||||
iscsi_netdev_name=$1; shift
|
||||
fi
|
||||
iscsi_lun=$1; shift
|
||||
if [ $# -ne 0 ]; then
|
||||
warn "Invalid parameter in iscsi: parameter!"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
if [ $# -eq 2 ]; then
|
||||
iscsi_netdev_name=$1; shift
|
||||
|
||||
|
||||
if [ $# -gt 3 ] && [ -n "$1$2" ]; then
|
||||
if [ -z "$3" ] || [ "$3" -ge 0 ] 2>/dev/null ; then
|
||||
iscsi_iface_name=$1; shift
|
||||
iscsi_netdev_name=$1; shift
|
||||
fi
|
||||
fi
|
||||
|
||||
iscsi_lun=$1; shift
|
||||
if [ $# -ne 0 ]; then
|
||||
warn "Invalid parameter in iscsi: parameter!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
iscsi_target_name=$(printf "%s:" "$@")
|
||||
iscsi_target_name=${iscsi_target_name%:}
|
||||
}
|
||||
|
||||
ip_to_var() {
|
||||
@@ -353,7 +380,7 @@ ip_to_var() {
|
||||
fi
|
||||
done
|
||||
|
||||
unset ip srv gw mask hostname dev autoconf macaddr mtu
|
||||
unset ip srv gw mask hostname dev autoconf macaddr mtu dns1 dns2
|
||||
case $# in
|
||||
0) autoconf="error" ;;
|
||||
1) autoconf=$1 ;;
|
||||
@@ -361,17 +388,28 @@ ip_to_var() {
|
||||
3) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2; [ -n "$3" ] && mtu=$3 ;;
|
||||
4) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2; [ -n "$3" ] && mtu=$3; [ -n "$4" ] && macaddr=$4 ;;
|
||||
*) [ -n "$1" ] && ip=$1; [ -n "$2" ] && srv=$2; [ -n "$3" ] && gw=$3; [ -n "$4" ] && mask=$4;
|
||||
[ -n "$5" ] && hostname=$5; [ -n "$6" ] && dev=$6; [ -n "$7" ] && autoconf=$7; [ -n "$8" ] && mtu=$8;
|
||||
if [ -n "${9}" -a -n "${10}" -a -n "${11}" -a -n "${12}" -a -n "${13}" -a -n "${14}" ]; then
|
||||
macaddr="${9}:${10}:${11}:${12}:${13}:${14}"
|
||||
fi
|
||||
;;
|
||||
[ -n "$5" ] && hostname=$5; [ -n "$6" ] && dev=$6; [ -n "$7" ] && autoconf=$7;
|
||||
case "$8" in
|
||||
[0-9]*:*|[0-9]*.[0-9]*.[0-9]*.[0-9]*)
|
||||
dns1="$8"
|
||||
[ -n "$9" ] && dns2="$9"
|
||||
;;
|
||||
[0-9]*)
|
||||
mtu="$8"
|
||||
;;
|
||||
*)
|
||||
if [ -n "${9}" -a -n "${10}" -a -n "${11}" -a -n "${12}" -a -n "${13}" -a -n "${14}" ]; then
|
||||
macaddr="${9}:${10}:${11}:${12}:${13}:${14}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
# ip=<ipv4-address> means anaconda-style static config argument cluster:
|
||||
# ip=<ip> gateway=<gw> netmask=<nm> hostname=<host> mtu=<mtu>
|
||||
# ksdevice={link|bootif|ibft|<MAC>|<ifname>}
|
||||
if strstr "$autoconf" "*.*.*.*"; then
|
||||
if strglob "$autoconf" "*.*.*.*"; then
|
||||
ip="$autoconf"
|
||||
gw=$(getarg gateway=)
|
||||
mask=$(getarg netmask=)
|
||||
@@ -389,6 +427,33 @@ ip_to_var() {
|
||||
fi
|
||||
}
|
||||
|
||||
route_to_var() {
|
||||
local v=${1}:
|
||||
local i
|
||||
set --
|
||||
while [ -n "$v" ]; do
|
||||
if [ "${v#\[*:*:*\]:}" != "$v" ]; then
|
||||
# handle IPv6 address
|
||||
i="${v%%\]:*}"
|
||||
i="${i##\[}"
|
||||
set -- "$@" "$i"
|
||||
v=${v#\[$i\]:}
|
||||
else
|
||||
set -- "$@" "${v%%:*}"
|
||||
v=${v#*:}
|
||||
fi
|
||||
done
|
||||
|
||||
unset route_mask route_gw route_dev
|
||||
case $# in
|
||||
2) [ -n "$1" ] && route_mask="$1"; [ -n "$2" ] && route_gw="$2"
|
||||
return 0;;
|
||||
3) [ -n "$1" ] && route_mask="$1"; [ -n "$2" ] && route_gw="$2"; [ -n "$3" ] && route_dev="$3"
|
||||
return 0;;
|
||||
*) return 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
parse_ifname_opts() {
|
||||
local IFS=:
|
||||
set $1
|
||||
@@ -433,7 +498,7 @@ wait_for_if_up() {
|
||||
local li
|
||||
while [ $cnt -lt 200 ]; do
|
||||
li=$(ip -o link show up dev $1)
|
||||
[ -n "$li" ] && return 0
|
||||
[ -n "$li" ] && [ -z "${li##*state UP*}" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
@@ -451,12 +516,26 @@ wait_for_route_ok() {
|
||||
return 1
|
||||
}
|
||||
|
||||
wait_for_ipv6_dad() {
|
||||
local cnt=0
|
||||
local li
|
||||
while [ $cnt -lt 500 ]; do
|
||||
li=$(ip -6 addr show dev $1)
|
||||
strstr "$li" "tentative" || return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
wait_for_ipv6_auto() {
|
||||
local cnt=0
|
||||
local li
|
||||
while [ $cnt -lt 400 ]; do
|
||||
li=$(ip -6 addr show dev $1)
|
||||
strstr "$li" "dynamic" && return 0
|
||||
if ! strstr "$li" "tentative"; then
|
||||
strstr "$li" "dynamic" && return 0
|
||||
fi
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
@@ -470,6 +549,95 @@ linkup() {
|
||||
}
|
||||
|
||||
type hostname >/dev/null 2>&1 || \
|
||||
hostname() {
|
||||
cat /proc/sys/kernel/hostname
|
||||
hostname() {
|
||||
cat /proc/sys/kernel/hostname
|
||||
}
|
||||
|
||||
iface_has_link() {
|
||||
local interface="$1" flags=""
|
||||
[ -n "$interface" ] || return 2
|
||||
interface="/sys/class/net/$interface"
|
||||
[ -d "$interface" ] || return 2
|
||||
linkup "$1"
|
||||
[ "$(cat $interface/carrier)" = 1 ] || return 1
|
||||
# XXX Do we need to reset the flags here? anaconda never bothered..
|
||||
}
|
||||
|
||||
find_iface_with_link() {
|
||||
local iface_path="" iface=""
|
||||
for iface_path in /sys/class/net/*; do
|
||||
iface=${iface_path##*/}
|
||||
str_starts "$iface" "lo" && continue
|
||||
if iface_has_link $iface; then
|
||||
echo "$iface"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
is_persistent_ethernet_name() {
|
||||
local _netif="$1"
|
||||
local _name_assign_type="0"
|
||||
|
||||
[ -f "/sys/class/net/$_netif/name_assign_type" ] \
|
||||
&& _name_assign_type=$(cat "/sys/class/net/$_netif/name_assign_type")
|
||||
|
||||
# NET_NAME_ENUM 1
|
||||
[ "$_name_assign_type" = "1" ] && return 1
|
||||
|
||||
# NET_NAME_PREDICTABLE 2
|
||||
[ "$_name_assign_type" = "2" ] && return 0
|
||||
|
||||
case "$_netif" in
|
||||
# udev persistent interface names
|
||||
eno[0-9]|eno[0-9][0-9]|eno[0-9][0-9][0-9]*)
|
||||
;;
|
||||
ens[0-9]|ens[0-9][0-9]|ens[0-9][0-9][0-9]*)
|
||||
;;
|
||||
enp[0-9]s[0-9]*|enp[0-9][0-9]s[0-9]*|enp[0-9][0-9][0-9]*s[0-9]*)
|
||||
;;
|
||||
enP*p[0-9]s[0-9]*|enP*p[0-9][0-9]s[0-9]*|enP*p[0-9][0-9][0-9]*s[0-9]*)
|
||||
;;
|
||||
# biosdevname
|
||||
em[0-9]|em[0-9][0-9]|em[0-9][0-9][0-9]*)
|
||||
;;
|
||||
p[0-9]p[0-9]*|p[0-9][0-9]p[0-9]*|p[0-9][0-9][0-9]*p[0-9]*)
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
|
||||
is_kernel_ethernet_name() {
|
||||
local _netif="$1"
|
||||
local _name_assign_type="1"
|
||||
|
||||
if [ -e "/sys/class/net/$_netif/name_assign_type" ]; then
|
||||
_name_assign_type=$(cat "/sys/class/net/$_netif/name_assign_type")
|
||||
|
||||
case "$_name_assign_type" in
|
||||
2|3|4)
|
||||
# NET_NAME_PREDICTABLE 2
|
||||
# NET_NAME_USER 3
|
||||
# NET_NAME_RENAMED 4
|
||||
return 1
|
||||
;;
|
||||
1|*)
|
||||
# NET_NAME_ENUM 1
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# fallback to error prone manual name check
|
||||
case "$_netif" in
|
||||
eth[0-9]|eth[0-9][0-9]|eth[0-9][0-9][0-9]*)
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
esac
|
||||
|
||||
}
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
command -v getarg >/dev/null || . /lib/dracut-lib.sh
|
||||
@@ -51,6 +49,7 @@ if [ -z "$2" ]; then
|
||||
netroot=$new_root_path
|
||||
|
||||
# FIXME!
|
||||
unset rootok
|
||||
for f in $hookdir/cmdline/90*.sh; do
|
||||
[ -f "$f" ] && . "$f";
|
||||
done
|
||||
|
@@ -1,11 +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:
|
||||
# bridge=<bridgename>:<ethnames>
|
||||
# bridge=<bridgename>:<bridgeslaves>
|
||||
#
|
||||
# <ethnames> is a comma-separated list of physical (ethernet) interfaces
|
||||
# <bridgeslaves> is a comma-separated list of physical (ethernet) interfaces
|
||||
# bridge without parameters assumes bridge=br0:eth0
|
||||
#
|
||||
|
||||
@@ -25,20 +23,20 @@ parsebridge() {
|
||||
v=${v#*:}
|
||||
done
|
||||
|
||||
unset bridgename ethnames
|
||||
unset bridgename bridgeslaves
|
||||
case $# in
|
||||
0) bridgename=br0; ethnames=$iface ;;
|
||||
0) bridgename=br0; bridgeslaves=$iface ;;
|
||||
1) die "bridge= requires two parameters" ;;
|
||||
2) bridgename=$1; ethnames=$(str_replace "$2" "," " ") ;;
|
||||
2) bridgename=$1; bridgeslaves=$(str_replace "$2" "," " ") ;;
|
||||
*) die "bridge= requires two parameters" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
unset bridgename ethnames
|
||||
unset bridgename bridgeslaves
|
||||
|
||||
iface=eth0
|
||||
|
||||
# Parse bridge for bridgename and ethnames
|
||||
# Parse bridge for bridgename and bridgeslaves
|
||||
if bridge="$(getarg bridge)"; then
|
||||
# Read bridge= parameters if they exist
|
||||
if [ -n "$bridge" ]; then
|
||||
@@ -47,9 +45,9 @@ if bridge="$(getarg bridge)"; then
|
||||
# Simple default bridge
|
||||
if [ -z "$bridgename" ]; then
|
||||
bridgename=br0
|
||||
ethnames=$iface
|
||||
bridgeslaves=$iface
|
||||
fi
|
||||
echo "bridgename=$bridgename" > /tmp/bridge.info
|
||||
echo "ethnames=\"$ethnames\"" >> /tmp/bridge.info
|
||||
echo "bridgeslaves=\"$bridgeslaves\"" >> /tmp/bridge.info
|
||||
return
|
||||
fi
|
||||
|
8
modules.d/40network/parse-ibft.sh
Executable file
8
modules.d/40network/parse-ibft.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
command -v getarg >/dev/null || . /lib/dracut-lib.sh
|
||||
command -v ibft_to_cmdline >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
if getargbool 0 rd.iscsi.ibft -d "ip=ibft"; then
|
||||
ibft_to_cmdline
|
||||
fi
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Format:
|
||||
# ifname=<interface>:<mac>
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Format:
|
||||
# ip=[dhcp|on|any]
|
||||
@@ -15,7 +13,6 @@
|
||||
#
|
||||
|
||||
command -v getarg >/dev/null || . /lib/dracut-lib.sh
|
||||
command -v ibft_to_cmdline >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
if [ -n "$netroot" ] && [ -z "$(getarg ip=)" ] && [ -z "$(getarg BOOTIF=)" ]; then
|
||||
# No ip= argument(s) for netroot provided, defaulting to DHCP
|
||||
@@ -26,6 +23,10 @@ fi
|
||||
if [ -z "$NEEDBOOTDEV" ] ; then
|
||||
count=0
|
||||
for p in $(getargs ip=); do
|
||||
case "$p" in
|
||||
ibft)
|
||||
continue;;
|
||||
esac
|
||||
count=$(( $count + 1 ))
|
||||
done
|
||||
[ $count -gt 1 ] && NEEDBOOTDEV=1
|
||||
@@ -39,9 +40,6 @@ if [ -n "$NEEDBOOTDEV" ] ; then
|
||||
[ -z "$BOOTDEV" ] && warn "Please supply bootdev argument for multiple ip= lines"
|
||||
fi
|
||||
|
||||
# If ibft is requested, read ibft vals and write ip=XXX cmdline args
|
||||
[ "ibft" = "$(getarg ip=)" ] && ibft_to_cmdline
|
||||
|
||||
# Check ip= lines
|
||||
# XXX Would be nice if we could errorcheck ip addresses here as well
|
||||
for p in $(getargs ip=); do
|
||||
@@ -66,24 +64,26 @@ for p in $(getargs ip=); do
|
||||
fi
|
||||
|
||||
# Error checking for autoconf in combination with other values
|
||||
case $autoconf in
|
||||
error) die "Error parsing option 'ip=$p'";;
|
||||
bootp|rarp|both) die "Sorry, ip=$autoconf is currenty unsupported";;
|
||||
none|off)
|
||||
[ -z "$ip" ] && \
|
||||
die "For argument 'ip=$p'\nValue '$autoconf' without static configuration does not make sense"
|
||||
[ -z "$mask" ] && \
|
||||
die "Sorry, automatic calculation of netmask is not yet supported"
|
||||
;;
|
||||
auto6);;
|
||||
dhcp|dhcp6|on|any) \
|
||||
[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
|
||||
die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
|
||||
[ -n "$ip" ] && \
|
||||
die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoconf'"
|
||||
;;
|
||||
*) die "For argument 'ip=$p'\nSorry, unknown value '$autoconf'";;
|
||||
esac
|
||||
for autoopt in $(str_replace "$autoconf" "," " "); do
|
||||
case $autoopt in
|
||||
error) die "Error parsing option 'ip=$p'";;
|
||||
bootp|rarp|both) die "Sorry, ip=$autoopt is currenty unsupported";;
|
||||
none|off)
|
||||
[ -z "$ip" ] && \
|
||||
die "For argument 'ip=$p'\nValue '$autoopt' without static configuration does not make sense"
|
||||
[ -z "$mask" ] && \
|
||||
die "Sorry, automatic calculation of netmask is not yet supported"
|
||||
;;
|
||||
auto6);;
|
||||
dhcp|dhcp6|on|any) \
|
||||
[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
|
||||
die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
|
||||
[ -n "$ip" ] && \
|
||||
die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoopt'"
|
||||
;;
|
||||
*) die "For argument 'ip=$p'\nSorry, unknown value '$autoopt'";;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -n "$dev" ] ; then
|
||||
# We don't like duplicate device configs
|
||||
@@ -112,7 +112,7 @@ for p in $(getargs ip=); do
|
||||
done
|
||||
|
||||
# put BOOTIF in IFACES to make sure it comes up
|
||||
if BOOTIF="$(getarg BOOTIF=)"; then
|
||||
if getargbool 1 "rd.bootif" && BOOTIF="$(getarg BOOTIF=)"; then
|
||||
BOOTDEV=$(fix_bootif $BOOTIF)
|
||||
IFACES="$BOOTDEV $IFACES"
|
||||
fi
|
||||
|
0
modules.d/40network/parse-vlan.sh
Normal file → Executable file
0
modules.d/40network/parse-vlan.sh
Normal file → Executable file
@@ -1,15 +1,18 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
[[ -d /etc/sysconfig/network-scripts ]] && return 0
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo "network"
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#!/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
|
||||
type is_persistent_ethernet_name >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
|
||||
udevadm settle --timeout=30
|
||||
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
@@ -55,9 +55,9 @@ print_s390() {
|
||||
|
||||
SUBCHANNELS=${SUBCHANNELS%,}
|
||||
echo "SUBCHANNELS=\"${SUBCHANNELS}\""
|
||||
CONFIG_LINE=$(get_config_line_by_subchannel $SUBCHANNELS)
|
||||
|
||||
[ $? -ne 0 -o -z "$CONFIG_LINE" ] && return
|
||||
CONFIG_LINE=$(get_config_line_by_subchannel $SUBCHANNELS)
|
||||
[ $? -ne 0 -o -z "$CONFIG_LINE" ] && return 0
|
||||
|
||||
OLD_IFS=$IFS
|
||||
IFS=","
|
||||
@@ -77,6 +77,44 @@ print_s390() {
|
||||
OPTIONS=${OPTIONS## }
|
||||
echo "NETTYPE=\"${NETTYPE}\""
|
||||
echo "OPTIONS=\"${OPTIONS}\""
|
||||
return 0
|
||||
}
|
||||
|
||||
hw_bind() {
|
||||
local _netif="$1"
|
||||
local _macaddr="$2"
|
||||
|
||||
[ -n "$_macaddr" ] \
|
||||
&& echo "MACADDR=\"$_macaddr\""
|
||||
|
||||
print_s390 "$_netif" \
|
||||
&& return 0
|
||||
|
||||
[ -n "$_macaddr" ] && return 0
|
||||
|
||||
is_persistent_ethernet_name "$_netif" && return 0
|
||||
|
||||
[ -f "/sys/class/net/$_netif/addr_assign_type" ] \
|
||||
&& [ "$(cat "/sys/class/net/$_netif/addr_assign_type")" != "0" ] \
|
||||
&& return 1
|
||||
|
||||
[ -f "/sys/class/net/$_netif/address" ] \
|
||||
|| return 1
|
||||
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$_netif/address)\""
|
||||
}
|
||||
|
||||
interface_bind() {
|
||||
local _netif="$1"
|
||||
local _macaddr="$2"
|
||||
|
||||
# see, if we can bind it to some hw parms
|
||||
if hw_bind "$_netif" "$_macaddr"; then
|
||||
# only print out DEVICE, if it's user assigned
|
||||
is_kernel_ethernet_name "$_netif" && return 0
|
||||
fi
|
||||
|
||||
echo "DEVICE=\"$_netif\""
|
||||
}
|
||||
|
||||
for netup in /tmp/net.*.did-setup ; do
|
||||
@@ -84,6 +122,7 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
|
||||
netif=${netup%%.did-setup}
|
||||
netif=${netif##*/net.}
|
||||
strglobin "$netif" ":*:*:*:*:" && continue
|
||||
[ -e /tmp/ifcfg/ifcfg-$netif ] && continue
|
||||
unset bridge
|
||||
unset bond
|
||||
@@ -110,16 +149,17 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
if [ "$netif" = "$vlanname" ]; then
|
||||
vlan=yes
|
||||
fi
|
||||
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
|
||||
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=\"$netif\""
|
||||
echo "NAME=\"$netif\""
|
||||
interface_bind "$netif" "$macaddr"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "UUID=\"$uuid\""
|
||||
strstr "$(ip -6 addr show dev $netif)" 'inet6' && echo "IPV6INIT=yes"
|
||||
if [ -f /tmp/dhclient.$netif.lease ]; then
|
||||
[ -f /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
|
||||
strstr "$ip" '*:*:*' && echo "IPV6INIT=yes"
|
||||
if [ -f /tmp/net.$netif.has_ibft_config ]; then
|
||||
echo "BOOTPROTO=ibft"
|
||||
else
|
||||
@@ -129,7 +169,7 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
else
|
||||
# If we've booted with static ip= lines, the override file is there
|
||||
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
|
||||
if strstr "$ip" '*:*:*'; then
|
||||
if strglobin "$ip" '*:*:*'; then
|
||||
echo "IPV6INIT=yes"
|
||||
echo "IPV6_AUTOCONF=no"
|
||||
echo "IPV6ADDR=\"$ip/$mask\""
|
||||
@@ -146,7 +186,7 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if strstr "$gw" '*:*:*'; then
|
||||
if strglobin "$gw" '*:*:*'; then
|
||||
echo "IPV6_DEFAULTGW=\"$gw\""
|
||||
elif [ -n "$gw" ]; then
|
||||
echo "GATEWAY=\"$gw\""
|
||||
@@ -159,14 +199,7 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ]; then
|
||||
# standard interface
|
||||
{
|
||||
if [ -n "$macaddr" ]; then
|
||||
echo "MACADDR=\"$macaddr\""
|
||||
else
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$netif/address)\""
|
||||
fi
|
||||
print_s390 $netif
|
||||
echo "TYPE=Ethernet"
|
||||
echo "NAME=\"$netif\""
|
||||
[ -n "$mtu" ] && echo "MTU=\"$mtu\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
fi
|
||||
@@ -191,17 +224,19 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
|
||||
for slave in $bondslaves ; do
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
{
|
||||
(
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=\"$slave\""
|
||||
echo "NAME=\"$slave\""
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\""
|
||||
echo "SLAVE=yes"
|
||||
echo "MASTER=\"$netif\""
|
||||
echo "NAME=\"$slave\""
|
||||
} >> /tmp/ifcfg/ifcfg-$slave
|
||||
echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
|
||||
unset macaddr
|
||||
[ -e /tmp/net.$slave.override ] && . /tmp/net.$slave.override
|
||||
interface_bind "$slave" "$macaddr"
|
||||
) >> /tmp/ifcfg/ifcfg-$slave
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -211,50 +246,30 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
echo "TYPE=Bridge"
|
||||
echo "NAME=\"$netif\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=\"$bondname\""
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
# This variable is an indicator of a bond interface for initscripts
|
||||
echo "BONDING_OPTS=\"$bondoptions\""
|
||||
echo "BRIDGE=\"$netif\""
|
||||
echo "NAME=\"$bondname\""
|
||||
} >> /tmp/ifcfg/ifcfg-$bondname
|
||||
for slave in $bondslaves ; do
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=\"$slave\""
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\""
|
||||
echo "SLAVE=yes"
|
||||
echo "MASTER=\"$bondname\""
|
||||
echo "NAME=\"$slave\""
|
||||
} >> /tmp/ifcfg/ifcfg-$slave
|
||||
done
|
||||
else
|
||||
for slave in $bridgeslaves ; do
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
{
|
||||
(
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=\"$ethname\""
|
||||
echo "NAME=\"$slave\""
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$ethname/address)\""
|
||||
echo "BRIDGE=\"$netif\""
|
||||
echo "NAME=\"$ethname\""
|
||||
} >> /tmp/ifcfg/ifcfg-$ethname
|
||||
fi
|
||||
echo "BRIDGE=\"$bridgename\""
|
||||
echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
|
||||
unset macaddr
|
||||
[ -e /tmp/net.$slave.override ] && . /tmp/net.$slave.override
|
||||
interface_bind "$slave" "$macaddr"
|
||||
) >> /tmp/ifcfg/ifcfg-$slave
|
||||
done
|
||||
fi
|
||||
i=1
|
||||
for ns in $(getargs nameserver); do
|
||||
echo "DNS${i}=\"${ns}\"" >> /tmp/ifcfg/ifcfg-$netif
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
[ -f /tmp/net.route6."$netif" ] && cp /tmp/net.route6."$netif" /tmp/ifcfg/route6-"$netif"
|
||||
[ -f /tmp/net.route."$netif" ] && cp /tmp/net.route."$netif" /tmp/ifcfg/route-"$netif"
|
||||
done
|
||||
|
||||
# Pass network opts
|
||||
|
@@ -1,19 +1,23 @@
|
||||
#!/bin/bash
|
||||
# module-setup for url-lib
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
command -v curl >/dev/null || return 1
|
||||
require_binaries curl || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo network
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _dir _crt _found _lib
|
||||
inst_simple "$moddir/url-lib.sh" "/lib/url-lib.sh"
|
||||
inst_multiple -o ctorrent
|
||||
inst_multiple curl
|
||||
# also install libs for curl https
|
||||
inst_libdir_file "libnsspem.so*"
|
||||
|
@@ -64,7 +64,7 @@ curl_fetch_url() {
|
||||
local url="$1" outloc="$2"
|
||||
echo "$url" > /proc/self/fd/0
|
||||
if [ -n "$outloc" ]; then
|
||||
curl $curl_args --output "$outloc" -- "$url" || return $?
|
||||
curl $curl_args --output - -- "$url" > "$outloc" || return $?
|
||||
else
|
||||
local outdir="$(mkuniqdir /tmp curl_fetch_url)"
|
||||
( cd "$outdir"; curl $curl_args --remote-name "$url" || return $? )
|
||||
@@ -76,12 +76,44 @@ curl_fetch_url() {
|
||||
fi
|
||||
if [ -z "$2" ]; then echo "$outloc" ; fi
|
||||
}
|
||||
add_url_handler curl_fetch_url http https ftp
|
||||
add_url_handler curl_fetch_url http https ftp tftp
|
||||
|
||||
set_http_header() {
|
||||
echo "header = \"$1: $2\"" >> $CURL_HOME/.curlrc
|
||||
}
|
||||
|
||||
### TORRENT ##########################################################
|
||||
|
||||
ctorrent_args="-E 0 -e 0"
|
||||
|
||||
ctorrent_fetch_url() {
|
||||
local url="$1" outloc="$2"
|
||||
url=${url#*//}
|
||||
torrent_outloc="$outloc.torrent"
|
||||
echo "$url" > /proc/self/fd/0
|
||||
if [ -n "$outloc" ]; then
|
||||
curl $curl_args --output - -- "$url" > "$torrent_outloc" || return $?
|
||||
else
|
||||
local outdir="$(mkuniqdir /tmp torrent_fetch_url)"
|
||||
( cd "$outdir"; curl $curl_args --remote-name "$url" || return $? )
|
||||
torrent_outloc="$outdir/$(ls -A $outdir)"
|
||||
outloc=${torrent_outloc%.*}
|
||||
fi
|
||||
if ! [ -f "$torrent_outloc" ]; then
|
||||
warn "Downloading '$url' failed!"
|
||||
return 253
|
||||
fi
|
||||
ctorrent $ctorrent_args -s $outloc $torrent_outloc >&2
|
||||
if ! [ -f "$outloc" ]; then
|
||||
warn "Torrent download of '$url' failed!"
|
||||
return 253
|
||||
fi
|
||||
if [ -z "$2" ]; then echo "$outloc" ; fi
|
||||
}
|
||||
|
||||
command -v ctorrent >/dev/null \
|
||||
&& add_url_handler ctorrent_fetch_url torrent
|
||||
|
||||
### NFS ##############################################################
|
||||
|
||||
[ -e /lib/nfs-lib.sh ] && . /lib/nfs-lib.sh
|
||||
|
18
modules.d/50drm/module-setup.sh
Normal file → Executable file
18
modules.d/50drm/module-setup.sh
Normal file → Executable file
@@ -1,15 +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
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
local _modname
|
||||
# Include KMS capable drm drivers
|
||||
@@ -48,13 +49,24 @@ installkernel() {
|
||||
return 0
|
||||
}
|
||||
|
||||
if [[ "$(uname -p)" == arm* ]]; then
|
||||
# arm specific modules needed by drm
|
||||
instmods \
|
||||
"=drivers/gpu/drm/i2c" \
|
||||
"=drivers/gpu/drm/panel" \
|
||||
"=drivers/pwm" \
|
||||
"=drivers/video/backlight" \
|
||||
"=drivers/video/fbdev/omap2/displays-new" \
|
||||
${NULL}
|
||||
fi
|
||||
|
||||
for _modname in $(find_kernel_modules_by_path drivers/gpu/drm \
|
||||
| drm_module_filter) ; do
|
||||
# if the hardware is present, include module even if it is not currently loaded,
|
||||
# as we could e.g. be in the installer; nokmsboot boot parameter will disable
|
||||
# loading of the driver if needed
|
||||
if [[ $hostonly ]] && modinfo -F alias $_modname | sed -e 's,\?,\.,g' -e 's,\*,\.\*,g' \
|
||||
| grep -qxf - /sys/bus/pci/devices/*/modalias 2>/dev/null; then
|
||||
| grep -qxf - /sys/bus/{pci/devices,soc/devices/soc?}/*/modalias 2>/dev/null; then
|
||||
hostonly='' instmods $_modname
|
||||
continue
|
||||
fi
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
CDROOT=0
|
||||
. /lib/gensplash-lib.sh
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
CDROOT=0
|
||||
. /lib/gensplash-lib.sh
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if getargbool 1 rd.splash -d -n rd_NO_SPLASH; then
|
||||
info "Starting Gentoo Splash"
|
||||
|
@@ -1,17 +1,18 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
# TODO: splash_geninitramfs
|
||||
# TODO: /usr/share/splashutils/initrd.splash
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _opts
|
||||
local _splash_theme
|
||||
|
@@ -1,23 +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
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
type -P plymouthd >/dev/null && type -P plymouth >/dev/null
|
||||
require_binaries plymouthd plymouth
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo drm
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
if grep -q nash /usr/libexec/plymouth/plymouth-populate-initrd \
|
||||
|| [ ! -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
|
||||
PKGLIBDIR="/usr/lib/plymouth"
|
||||
if type -P dpkg-architecture &>/dev/null; then
|
||||
PKGLIBDIR="/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/plymouth"
|
||||
fi
|
||||
[ -x /usr/libexec/plymouth/plymouth-populate-initrd ] && PKGLIBDIR="/usr/libexec/plymouth"
|
||||
|
||||
if grep -q nash ${PKGLIBDIR}/plymouth-populate-initrd \
|
||||
|| [ ! -x ${PKGLIBDIR}/plymouth-populate-initrd ]; then
|
||||
. "$moddir"/plymouth-populate-initrd.sh
|
||||
else
|
||||
PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \
|
||||
/usr/libexec/plymouth/plymouth-populate-initrd -t "$initdir"
|
||||
${PKGLIBDIR}/plymouth-populate-initrd -t "$initdir"
|
||||
fi
|
||||
|
||||
inst_hook emergency 50 "$moddir"/plymouth-emergency.sh
|
||||
|
@@ -1,4 +1,3 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
plymouth --hide-splash 2>/dev/null || :
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if type plymouth >/dev/null 2>&1 && [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
plymouth --newroot=$NEWROOT
|
||||
|
@@ -1,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
# -*- 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)
|
||||
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if type plymouthd >/dev/null 2>&1 && [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
if getargbool 1 plymouth.enable && getargbool 1 rd.plymouth -d -n rd_NO_PLYMOUTH; then
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
@@ -9,6 +7,7 @@ mkdir -m 0755 -p /run/initramfs/state/etc/sysconfig/network-scripts
|
||||
function cms_write_config()
|
||||
{
|
||||
. /tmp/cms.conf
|
||||
SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
|
||||
OLDIFS=$IFS
|
||||
IFS=,
|
||||
read -a subch_array <<< "indexzero,$SUBCHANNELS"
|
||||
@@ -26,7 +25,7 @@ function cms_write_config()
|
||||
|
||||
IFCFGFILE=/run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-$DEVICE
|
||||
|
||||
strstr "$IPADDR" '*:*:*' && ipv6=1
|
||||
strglobin "$IPADDR" '*:*:*' && ipv6=1
|
||||
|
||||
# to please NetworkManager on startup in loader before loader reconfigures net
|
||||
cat > /etc/sysconfig/network << EOF
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
@@ -8,7 +6,7 @@ DEVICE=$1
|
||||
|
||||
. /tmp/cms.conf
|
||||
|
||||
strstr "$IPADDR" '*:*:*' && ipv6=1
|
||||
strglobin "$IPADDR" '*:*:*' && ipv6=1
|
||||
|
||||
if [ "$ipv6" ] && ! str_starts "$IPADDR" "["; then
|
||||
IPADDR="[$IPADDR]"
|
||||
@@ -32,7 +30,6 @@ fi
|
||||
echo "nameserver=$i"
|
||||
done
|
||||
} > /etc/cmdline.d/80-cms.conf
|
||||
unset CMDLINE
|
||||
|
||||
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
|
||||
IFACES="$IFACES $DEVICE"
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
@@ -44,146 +42,147 @@ function dasd_settle() {
|
||||
}
|
||||
|
||||
function dasd_settle_all() {
|
||||
for dasdccw in $(while read line; do echo ${line%%(*}; done < /proc/dasd/devices) ; do
|
||||
for dasdccw in $(while read line; do echo "${line%%(*}"; done < /proc/dasd/devices) ; do
|
||||
if ! dasd_settle $dasdccw ; then
|
||||
echo $"Could not access DASD $dasdccw in time"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
# prints a canonocalized device bus ID for a given devno of any format
|
||||
function canonicalize_devno()
|
||||
{
|
||||
case ${#1} in
|
||||
3) echo "0.0.0${1}" ;;
|
||||
4) echo "0.0.${1}" ;;
|
||||
*) echo "${1}" ;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
function canonicalize_devno()
|
||||
{
|
||||
case ${#1} in
|
||||
3) echo "0.0.0${1}" ;;
|
||||
4) echo "0.0.${1}" ;;
|
||||
*) echo "${1}" ;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
|
||||
# read file from CMS and write it to /tmp
|
||||
function readcmsfile() # $1=dasdport $2=filename
|
||||
{
|
||||
local dev
|
||||
local numcpus
|
||||
local devname
|
||||
local ret=0
|
||||
if [ $# -ne 2 ]; then return; fi
|
||||
function readcmsfile() # $1=dasdport $2=filename
|
||||
{
|
||||
local dev
|
||||
local numcpus
|
||||
local devname
|
||||
local ret=0
|
||||
if [ $# -ne 2 ]; then return; fi
|
||||
# precondition: udevd created dasda block device node
|
||||
if ! dasd_cio_free -d $1 ; then
|
||||
echo $"DASD $1 could not be cleared from device blacklist"
|
||||
return 1
|
||||
fi
|
||||
if ! dasd_cio_free -d $1 ; then
|
||||
echo $"DASD $1 could not be cleared from device blacklist"
|
||||
return 1
|
||||
fi
|
||||
|
||||
modprobe dasd_mod dasd=$CMSDASD
|
||||
modprobe dasd_eckd_mod
|
||||
udevadm settle
|
||||
modprobe dasd_mod dasd=$CMSDASD
|
||||
modprobe dasd_eckd_mod
|
||||
udevadm settle
|
||||
|
||||
# precondition: dasd_eckd_mod driver incl. dependencies loaded,
|
||||
# dasd_mod must be loaded without setting any DASD online
|
||||
dev=$(canonicalize_devno $1)
|
||||
numcpus=$(
|
||||
while read line; do
|
||||
if strstr "$line" "# processors"; then
|
||||
echo ${line##*:};
|
||||
break;
|
||||
fi;
|
||||
done < /proc/cpuinfo
|
||||
)
|
||||
dev=$(canonicalize_devno $1)
|
||||
numcpus=$(
|
||||
while read line; do
|
||||
if strstr "$line" "# processors"; then
|
||||
echo ${line##*:};
|
||||
break;
|
||||
fi;
|
||||
done < /proc/cpuinfo
|
||||
)
|
||||
|
||||
if [ ${numcpus} -eq 1 ]; then
|
||||
echo 1 > /sys/bus/ccw/devices/$dev/online
|
||||
else
|
||||
if ! sysecho /sys/bus/ccw/devices/$dev/online 1; then
|
||||
echo $"DASD $dev could not be set online"
|
||||
return 1
|
||||
fi
|
||||
udevadm settle
|
||||
if ! dasd_settle $dev ; then
|
||||
echo $"Could not access DASD $dev in time"
|
||||
return 1
|
||||
fi
|
||||
if [ ${numcpus} -eq 1 ]; then
|
||||
echo 1 > /sys/bus/ccw/devices/$dev/online
|
||||
else
|
||||
if ! sysecho /sys/bus/ccw/devices/$dev/online 1; then
|
||||
echo $"DASD $dev could not be set online"
|
||||
return 1
|
||||
fi
|
||||
|
||||
udevadm settle
|
||||
|
||||
devname=$(cd /sys/bus/ccw/devices/$dev/block; set -- *; [ -b /dev/$1 ] && echo $1)
|
||||
devname=${devname:-dasda}
|
||||
|
||||
[[ -d /mnt ]] || mkdir /mnt
|
||||
if cmsfs-fuse --to=UTF-8 -a /dev/$devname /mnt; then
|
||||
cat /mnt/$2 > /run/initramfs/$2
|
||||
umount /mnt || umount -l /mnt
|
||||
udevadm settle
|
||||
else
|
||||
echo $"Could not read conf file $2 on CMS DASD $1."
|
||||
ret=1
|
||||
if ! dasd_settle $dev ; then
|
||||
echo $"Could not access DASD $dev in time"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! sysecho /sys/bus/ccw/devices/$dev/online 0; then
|
||||
echo $"DASD $dev could not be set offline again"
|
||||
udevadm settle
|
||||
|
||||
devname=$(cd /sys/bus/ccw/devices/$dev/block; set -- *; [ -b /dev/$1 ] && echo $1)
|
||||
devname=${devname:-dasda}
|
||||
|
||||
[[ -d /mnt ]] || mkdir /mnt
|
||||
if cmsfs-fuse --to=UTF-8 -a /dev/$devname /mnt; then
|
||||
cat /mnt/$2 > /run/initramfs/$2
|
||||
umount /mnt || umount -l /mnt
|
||||
udevadm settle
|
||||
else
|
||||
echo $"Could not read conf file $2 on CMS DASD $1."
|
||||
ret=1
|
||||
fi
|
||||
|
||||
if ! sysecho /sys/bus/ccw/devices/$dev/online 0; then
|
||||
echo $"DASD $dev could not be set offline again"
|
||||
#return 1
|
||||
fi
|
||||
udevadm settle
|
||||
fi
|
||||
udevadm settle
|
||||
|
||||
# unbind all dasds to unload the dasd modules for a clean start
|
||||
( cd /sys/bus/ccw/drivers/dasd-eckd; for i in *.*; do echo $i > unbind;done)
|
||||
udevadm settle
|
||||
modprobe -r dasd_eckd_mod
|
||||
udevadm settle
|
||||
modprobe -r dasd_diag_mod
|
||||
udevadm settle
|
||||
modprobe -r dasd_mod
|
||||
udevadm settle
|
||||
return $ret
|
||||
}
|
||||
( cd /sys/bus/ccw/drivers/dasd-eckd; for i in *.*; do echo $i > unbind;done)
|
||||
udevadm settle
|
||||
modprobe -r dasd_eckd_mod
|
||||
udevadm settle
|
||||
modprobe -r dasd_diag_mod
|
||||
udevadm settle
|
||||
modprobe -r dasd_mod
|
||||
udevadm settle
|
||||
return $ret
|
||||
}
|
||||
|
||||
processcmsfile()
|
||||
{
|
||||
source /tmp/cms.conf
|
||||
processcmsfile()
|
||||
{
|
||||
source /tmp/cms.conf
|
||||
SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
|
||||
|
||||
if [[ $NETTYPE ]]; then
|
||||
(
|
||||
echo -n $NETTYPE,$SUBCHANNELS
|
||||
[[ $PORTNAME ]] && echo -n ",portname=$PORTNAME"
|
||||
[[ $LAYER2 ]] && echo -n ",layer2=$LAYER2"
|
||||
[[ "$NETTYPE" = "ctc" ]] && [[ $CTCPROT ]] && echo -n ",protocol=$CTCPROT"
|
||||
echo
|
||||
) >> /etc/ccw.conf
|
||||
if [[ $NETTYPE ]]; then
|
||||
(
|
||||
echo -n $NETTYPE,$SUBCHANNELS
|
||||
[[ $PORTNAME ]] && echo -n ",portname=$PORTNAME"
|
||||
[[ $LAYER2 ]] && echo -n ",layer2=$LAYER2"
|
||||
[[ "$NETTYPE" = "ctc" ]] && [[ $CTCPROT ]] && echo -n ",protocol=$CTCPROT"
|
||||
echo
|
||||
) >> /etc/ccw.conf
|
||||
|
||||
OLDIFS=$IFS
|
||||
IFS=,
|
||||
read -a subch_array <<< "indexzero,$SUBCHANNELS"
|
||||
IFS=$OLDIFS
|
||||
devbusid=${subch_array[1]}
|
||||
if [ "$NETTYPE" = "ctc" ]; then
|
||||
driver="ctcm"
|
||||
else
|
||||
driver=$NETTYPE
|
||||
fi
|
||||
OLDIFS=$IFS
|
||||
IFS=,
|
||||
read -a subch_array <<< "indexzero,$SUBCHANNELS"
|
||||
IFS=$OLDIFS
|
||||
devbusid=${subch_array[1]}
|
||||
if [ "$NETTYPE" = "ctc" ]; then
|
||||
driver="ctcm"
|
||||
else
|
||||
driver=$NETTYPE
|
||||
fi
|
||||
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$env{INTERFACE} /sbin/cmsifup $env{INTERFACE}"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$env{INTERFACE} /sbin/cmsifup $env{INTERFACE}"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
|
||||
# remove the default net rules
|
||||
rm -f -- /etc/udev/rules.d/91-default-net.rules
|
||||
[[ -f /etc/udev/rules.d/90-net.rules ]] \
|
||||
|| printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
|
||||
udevadm control --reload
|
||||
znet_cio_free
|
||||
fi
|
||||
rm -f -- /etc/udev/rules.d/91-default-net.rules
|
||||
[[ -f /etc/udev/rules.d/90-net.rules ]] \
|
||||
|| printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
|
||||
udevadm control --reload
|
||||
znet_cio_free
|
||||
fi
|
||||
|
||||
if [[ $DASD ]]; then
|
||||
echo $DASD | normalize_dasd_arg > /etc/dasd.conf
|
||||
echo "options dasd_mod dasd=$DASD" > /etc/modprobe.d/dasd_mod.conf
|
||||
dasd_cio_free
|
||||
fi
|
||||
if [[ $DASD ]] && [[ $DASD != "none" ]]; then
|
||||
echo $DASD | normalize_dasd_arg > /etc/dasd.conf
|
||||
echo "options dasd_mod dasd=$DASD" > /etc/modprobe.d/dasd_mod.conf
|
||||
dasd_cio_free
|
||||
fi
|
||||
|
||||
unset _do_zfcp
|
||||
for i in ${!FCP_*}; do
|
||||
echo "${!i}" | while read port rest; do
|
||||
case $port in
|
||||
unset _do_zfcp
|
||||
for i in ${!FCP_*}; do
|
||||
echo "${!i}" | while read port rest; do
|
||||
case $port in
|
||||
*.*.*)
|
||||
;;
|
||||
*.*)
|
||||
@@ -192,23 +191,23 @@ function dasd_settle_all() {
|
||||
*)
|
||||
port="0.0.$port"
|
||||
;;
|
||||
esac
|
||||
echo $port $rest >> /etc/zfcp.conf
|
||||
done
|
||||
_do_zfcp=1
|
||||
esac
|
||||
echo $port $rest >> /etc/zfcp.conf
|
||||
done
|
||||
[[ $_do_zfcp ]] && zfcp_cio_free
|
||||
unset _do_zfcp
|
||||
}
|
||||
_do_zfcp=1
|
||||
done
|
||||
[[ $_do_zfcp ]] && zfcp_cio_free
|
||||
unset _do_zfcp
|
||||
}
|
||||
|
||||
[[ $CMSDASD ]] || CMSDASD=$(getarg "CMSDASD=")
|
||||
[[ $CMSCONFFILE ]] || CMSCONFFILE=$(getarg "CMSCONFFILE=")
|
||||
[[ $CMSDASD ]] || CMSDASD=$(getarg "CMSDASD=")
|
||||
[[ $CMSCONFFILE ]] || CMSCONFFILE=$(getarg "CMSCONFFILE=")
|
||||
|
||||
# Parse configuration
|
||||
if [ -n "$CMSDASD" -a -n "$CMSCONFFILE" ]; then
|
||||
if readcmsfile $CMSDASD $CMSCONFFILE; then
|
||||
ln -s /run/initramfs/$CMSCONFFILE /tmp/$CMSCONFFILE
|
||||
ln -s /run/initramfs/$CMSCONFFILE /tmp/cms.conf
|
||||
processcmsfile
|
||||
fi
|
||||
if [ -n "$CMSDASD" -a -n "$CMSCONFFILE" ]; then
|
||||
if readcmsfile $CMSDASD $CMSCONFFILE; then
|
||||
ln -s /run/initramfs/$CMSCONFFILE /tmp/$CMSCONFFILE
|
||||
ln -s /run/initramfs/$CMSCONFFILE /tmp/cms.conf
|
||||
processcmsfile
|
||||
fi
|
||||
fi
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user