Compare commits
565 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
04bf862d97 | ||
![]() |
3f979ee495 | ||
![]() |
3944c4b136 | ||
![]() |
97ff396a97 | ||
![]() |
8ff624df9f | ||
![]() |
5711f54312 | ||
![]() |
c3cdd9f6e1 | ||
![]() |
1339095dba | ||
![]() |
4358ace43c | ||
![]() |
8b52e96f09 | ||
![]() |
0ad2471c3a | ||
![]() |
b52cfbeaa5 | ||
![]() |
6755c20855 | ||
![]() |
7c433a0b43 | ||
![]() |
d5e5855b74 | ||
![]() |
3b1d78880f | ||
![]() |
4d9d767da2 | ||
![]() |
b562bc55a8 | ||
![]() |
dfec3c2d8b | ||
![]() |
8c5d18c2cb | ||
![]() |
d6e23c46c2 | ||
![]() |
4f0c7fc917 | ||
![]() |
c4184b5cf1 | ||
![]() |
1a61d85ef2 | ||
![]() |
514aeec5b4 | ||
![]() |
6964169368 | ||
![]() |
acf82efd52 | ||
![]() |
e409c9e8f8 | ||
![]() |
0e5c01f8b8 | ||
![]() |
311aee1bff | ||
![]() |
0b7bfacfea | ||
![]() |
3ac9cdb1c5 | ||
![]() |
c071990c2c | ||
![]() |
ee84640963 | ||
![]() |
f8139a8b28 | ||
![]() |
cfa365a32d | ||
![]() |
a1b4efe6a7 | ||
![]() |
3586a7aa77 | ||
![]() |
81b67232dc | ||
![]() |
27c9d1f20f | ||
![]() |
10e59202c7 | ||
![]() |
7b56b90582 | ||
![]() |
3e3ed34f03 | ||
![]() |
50f8ae457c | ||
![]() |
a601870064 | ||
![]() |
8cd8820547 | ||
![]() |
471439f564 | ||
![]() |
e668f3bc36 | ||
![]() |
351de47882 | ||
![]() |
07d9319d54 | ||
![]() |
7c5ec0f5be | ||
![]() |
79bc77d2f4 | ||
![]() |
874b013573 | ||
![]() |
ffa0ee5d16 | ||
![]() |
a742c80778 | ||
![]() |
04ba461045 | ||
![]() |
6d58fa27a4 | ||
![]() |
822a7ae504 | ||
![]() |
b0b60c8e05 | ||
![]() |
4851deca54 | ||
![]() |
437dad70e9 | ||
![]() |
a3e464ca43 | ||
![]() |
be82884d35 | ||
![]() |
180e9d7851 | ||
![]() |
d3d52b20e9 | ||
![]() |
23446ef1e0 | ||
![]() |
ec06c5d3b5 | ||
![]() |
d3be9275c7 | ||
![]() |
13efce5d1b | ||
![]() |
f53ede36fb | ||
![]() |
97cb17c792 | ||
![]() |
3b82ac1696 | ||
![]() |
99ccbc30df | ||
![]() |
e93d0bea38 | ||
![]() |
833e0f9e83 | ||
![]() |
c902aba0d4 | ||
![]() |
2bc5054a64 | ||
![]() |
b67d810785 | ||
![]() |
bbbdba2ec3 | ||
![]() |
863e18b4cd | ||
![]() |
a18d5494eb | ||
![]() |
cbb4b50e02 | ||
![]() |
ae43adb70d | ||
![]() |
ddfefd05fc | ||
![]() |
25e08a0973 | ||
![]() |
6f92423c89 | ||
![]() |
5641b0974b | ||
![]() |
5c44f43e69 | ||
![]() |
3c20ac5377 | ||
![]() |
afcc697cb8 | ||
![]() |
636d2d46a5 | ||
![]() |
21a209735a | ||
![]() |
bee086532f | ||
![]() |
df1e8127da | ||
![]() |
481ee9e6fc | ||
![]() |
9f0878540b | ||
![]() |
9119059723 | ||
![]() |
28eae10b70 | ||
![]() |
363469d757 | ||
![]() |
dea0634544 | ||
![]() |
1bcb63f97c | ||
![]() |
b0472eac11 | ||
![]() |
d6e34d362a | ||
![]() |
7075a402d7 | ||
![]() |
5729ae8029 | ||
![]() |
a7d3ad67c7 | ||
![]() |
7e9341434f | ||
![]() |
6ac2c83570 | ||
![]() |
05b879ed2a | ||
![]() |
38e217704a | ||
![]() |
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 | ||
![]() |
c9364f6ea2 | ||
![]() |
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 |
@@ -1,2 +1,3 @@
|
||||
(setq sh-basic-offset: 4)
|
||||
(setq indent-tabs-mode nil)
|
||||
((nil . ((setq sh-basic-offset: 4)
|
||||
(setq indent-tabs-mode nil)
|
||||
)))
|
||||
|
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,46 @@
|
||||
#!/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 --reflink=auto "$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
|
||||
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
|
||||
elif [[ -f /usr/lib/kernel/cmdline ]]; then
|
||||
read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
|
||||
fi
|
||||
|
||||
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
|
||||
read -r -d '' -a 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
|
||||
|
||||
@@ -59,7 +57,7 @@ if [[ ! -f $INITRDFILE ]]; then
|
||||
fi
|
||||
|
||||
if [[ ! -f $NEW_KERNEL_IMAGE ]]; then
|
||||
cp "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE"
|
||||
cp --reflink=auto "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE"
|
||||
((ret+=$?))
|
||||
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
|
||||
|
||||
export LANG=C
|
||||
|
||||
@@ -42,12 +40,22 @@ fi
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
if [[ -f /etc/kernel/cmdline ]]; then
|
||||
readarray -t BOOT_OPTIONS < /etc/kernel/cmdline
|
||||
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
|
||||
elif [[ -f /usr/lib/kernel/cmdline ]]; then
|
||||
read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
|
||||
fi
|
||||
|
||||
if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
|
||||
readarray -t BOOT_OPTIONS < /proc/cmdline
|
||||
read -r -d '' -a line < /proc/cmdline
|
||||
for i in "${line[@]}"; do
|
||||
[[ "${i#initrd=*}" != "$i" ]] && continue
|
||||
BOOT_OPTIONS+=("$i")
|
||||
done
|
||||
fi
|
||||
if ! [[ $BOOT_OPTIONS ]]; then
|
||||
|
||||
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
|
||||
echo "Could not determine the kernel command line parameters." >&2
|
||||
echo "Please specify the kernel command line in /etc/kernel/cmdline!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -71,11 +79,11 @@ case "$COMMAND" in
|
||||
|
||||
[[ -d "$BOOT_DIR_ABS" ]] || mkdir -p "$BOOT_DIR_ABS"
|
||||
|
||||
if ! cp "$KERNEL_IMAGE" "$BOOT_DIR_ABS"/linux; then
|
||||
if ! cp --reflink=auto "$KERNEL_IMAGE" "$BOOT_DIR_ABS"/linux; then
|
||||
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+=$?))
|
||||
|
||||
{
|
||||
|
72
AUTHORS
72
AUTHORS
@@ -7,32 +7,43 @@ 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>
|
||||
Amerigo Wang <amwang@redhat.com>
|
||||
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>
|
||||
NeilBrown <neilb@suse.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>
|
||||
Cristian Rodríguez <crrodriguez@opensuse.org>
|
||||
Fabian Deutsch <fabiand@fedoraproject.org>
|
||||
Frederic Crozat <fcrozat@suse.com>
|
||||
James Lee <jlee@thestaticvoid.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>
|
||||
David Cantrell <dcantrell@redhat.com>
|
||||
Dennis Gilmore <dennis@ausil.us>
|
||||
Jon Ander Hernandez <jonan.h@gmail.com>
|
||||
@@ -40,66 +51,97 @@ 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>
|
||||
Ville Skyttä <ville.skytta@iki.fi>
|
||||
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>
|
||||
Erwan Velu <erwan.velu@enovance.com>
|
||||
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>
|
||||
Jan Synacek <jsynacek@redhat.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>
|
||||
Lukas Wunner <lukas@wunner.de>
|
||||
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>
|
||||
Chao Fan <cfan@redhat.com>
|
||||
Chris Leech <cleech@redhat.com>
|
||||
Christian Heinz <christian.ch.heinz@gmail.com>
|
||||
Christian Rodrigues <crrodriguez@opensuse.org>
|
||||
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>
|
||||
Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
|
||||
Duane Griffin <duaneg@dghda.com>
|
||||
Gerd von Egidy <gerd.von.egidy@intra2net.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>
|
||||
Jonas Jonsson <jonas@websystem.se>
|
||||
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 Nykryn <lnykryn@redhat.com>
|
||||
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>
|
||||
Moritz 'Morty' Strübe <morty@gmx.net>
|
||||
Munehiro Matsuda <haro@kgt.co.jp>
|
||||
Nicolas Chauvet <kwizart@gmail.com>
|
||||
Nikoli <nikoli@gmx.us>
|
||||
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>
|
||||
Rusty Bird <rustybird@openmailbox.org>
|
||||
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>
|
||||
Ville Skyttä <ville.skytta@iki.fi>
|
||||
Vaughan Cao <vaughan.cao@oracle.com>
|
||||
Vratislav Podzimek <vpodzime@redhat.com>
|
||||
Yanko Kaneti <yaneti@declera.com>
|
||||
jloeser <jloeser@suse.de>
|
||||
maximilian attems <max@stro.at>
|
||||
xtraeme <xtraeme@voidlinux.eu>
|
||||
|
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
|
||||
pkgconfigdatadir ?= $(datadir)/pkgconfig
|
||||
|
||||
@@ -28,14 +28,15 @@ man7pages = dracut.cmdline.7 \
|
||||
man8pages = dracut.8 \
|
||||
dracut-catimages.8 \
|
||||
mkinitrd.8 \
|
||||
modules.d/98systemd/dracut-cmdline.service.8 \
|
||||
modules.d/98systemd/dracut-initqueue.service.8 \
|
||||
modules.d/98systemd/dracut-mount.service.8 \
|
||||
modules.d/98systemd/dracut-shutdown.service.8 \
|
||||
modules.d/98systemd/dracut-pre-mount.service.8 \
|
||||
modules.d/98systemd/dracut-pre-pivot.service.8 \
|
||||
modules.d/98systemd/dracut-pre-trigger.service.8 \
|
||||
modules.d/98systemd/dracut-pre-udev.service.8
|
||||
mkinitrd-suse.8 \
|
||||
modules.d/98dracut-systemd/dracut-cmdline.service.8 \
|
||||
modules.d/98dracut-systemd/dracut-initqueue.service.8 \
|
||||
modules.d/98dracut-systemd/dracut-mount.service.8 \
|
||||
modules.d/98dracut-systemd/dracut-shutdown.service.8 \
|
||||
modules.d/98dracut-systemd/dracut-pre-mount.service.8 \
|
||||
modules.d/98dracut-systemd/dracut-pre-pivot.service.8 \
|
||||
modules.d/98dracut-systemd/dracut-pre-trigger.service.8 \
|
||||
modules.d/98dracut-systemd/dracut-pre-udev.service.8
|
||||
|
||||
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
|
||||
|
||||
@@ -47,6 +48,7 @@ DRACUT_INSTALL_OBJECTS = \
|
||||
install/dracut-install.o \
|
||||
install/hashmap.o\
|
||||
install/log.o \
|
||||
install/strv.o \
|
||||
install/util.o
|
||||
|
||||
# deps generated with gcc -MM
|
||||
@@ -56,6 +58,7 @@ 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)
|
||||
|
||||
@@ -115,7 +118,6 @@ install: all
|
||||
install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
|
||||
mkdir -p $(DESTDIR)$(pkglibdir)/dracut.conf.d
|
||||
install -m 0755 dracut-init.sh $(DESTDIR)$(pkglibdir)/dracut-init.sh
|
||||
install -m 0755 dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions.sh
|
||||
install -m 0755 dracut-version.sh $(DESTDIR)$(pkglibdir)/dracut-version.sh
|
||||
ln -fs dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions
|
||||
@@ -131,10 +133,10 @@ ifneq ($(enable_documentation),no)
|
||||
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; \
|
||||
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98dracut-systemd/dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir)/dracut-shutdown.service; \
|
||||
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 \
|
||||
@@ -145,7 +147,7 @@ endif
|
||||
dracut-pre-trigger.service \
|
||||
dracut-pre-udev.service \
|
||||
; do \
|
||||
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98systemd/$$i $(DESTDIR)$(systemdsystemunitdir); \
|
||||
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98dracut-systemd/$$i $(DESTDIR)$(systemdsystemunitdir); \
|
||||
ln -s ../$$i \
|
||||
$(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants/$$i; \
|
||||
done \
|
||||
@@ -174,33 +176,35 @@ 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 $(DESTDIR).; mv "$$rpmbuild"/*.src.rpm $(DESTDIR).;rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
|
||||
( mv "$$rpmbuild"/$$(arch)/*.rpm .; mv "$$rpmbuild"/*.src.rpm .;rm -fr -- "$$rpmbuild"; ls *.rpm )
|
||||
|
||||
syncheck:
|
||||
@ret=0;for i in dracut-initramfs-restore.sh modules.d/*/*.sh; do \
|
||||
@@ -219,7 +223,11 @@ check: all syncheck rpm
|
||||
@$(MAKE) -C test check
|
||||
|
||||
testimage: all
|
||||
./dracut.sh -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
|
||||
./dracut.sh -N -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
|
||||
@@ -228,16 +236,20 @@ testimages: all
|
||||
./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 -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
|
||||
git shortlog --numbered --summary -e |while read a rest || [ -n "$$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/
|
||||
|
215
NEWS
215
NEWS
@@ -1,3 +1,212 @@
|
||||
dracut-042
|
||||
==========
|
||||
- fixed dmsetup shutdown
|
||||
- new kernel command line option "rd.live.overlay.thin"
|
||||
This option changes the underlying mechanism for the overlay in the
|
||||
dmsquash module.
|
||||
Instead of a plain dm snapshot a dm thin snapshot is used. The advantage
|
||||
of the thin snapshot is, that the TRIM command is recognized, which
|
||||
means that at runtime, only the occupied blocks will be claimed from
|
||||
memory, and freed blocks will really be freed in ram.
|
||||
- dmsquash: Add squashfs support to rd.live.fsimg
|
||||
Previously rd.live.fsimg only supported filesystems residing in
|
||||
(compressed) archives.
|
||||
Now rd.live.fsimg can also be used when a squashfs image is used.
|
||||
This is achieved by extracting the rootfs image from the squashfs and
|
||||
then continue with the default routines for rd.live.fsimg.
|
||||
- lvm: add support for LVM system id
|
||||
- split up the systemd dracut module
|
||||
Basic systemd functionality is in 00systemd now.
|
||||
Switching root and the initrd.target is in 00systemd-initrd.
|
||||
Dracut additions to the systemd initrd are in 98dracut-systemd.
|
||||
- support for creating a UEFI boot executable via argument "--uefi"
|
||||
With an EFI stub, the kernel, the initramfs and a kernel cmdline can be
|
||||
glued together to a single UEFI executable, which can be booted by a
|
||||
UEFI BIOS.
|
||||
- network: split out kernel-network-modules, now in 90kernel-network-modules
|
||||
- support for ethernet point-to-point connections configured via DHCP
|
||||
- kernel-modules: install all HID drivers
|
||||
- dracut.pc pkg-config file
|
||||
- mount /dev, /dev/shm and /run noexec
|
||||
|
||||
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
|
||||
@@ -16,6 +225,12 @@ dracut-033
|
||||
- fixed ifup udev rules
|
||||
- ifup with dhcp, if no "ip=" specified for the interface
|
||||
|
||||
Contributions from:
|
||||
WANG Chao
|
||||
Colin Walters
|
||||
Harald Hoyer
|
||||
|
||||
|
||||
dracut-032
|
||||
==========
|
||||
- add parameter --print-cmdline
|
||||
|
@@ -1,5 +0,0 @@
|
||||
# dracut RHEL-7 branch
|
||||
|
||||
dracut is an initramfs infrastructure.
|
||||
|
||||
CentOS CI Status: [](https://ci.centos.org/job/dracut-push-rhel-7/)
|
@@ -6,11 +6,12 @@ mdadm \
|
||||
lvm2 \
|
||||
cryptsetup \
|
||||
nfs-utils \
|
||||
netbsd-iscsi \
|
||||
nbd \
|
||||
dhcp-server \
|
||||
scsi-target-utils \
|
||||
iscsi-initiator-utils
|
||||
|
||||
|
||||
TEST-04-FULL-SYSTEMD: systemd >= 187
|
||||
|
||||
How to run the testsuite:
|
||||
|
11
TODO
11
TODO
@@ -6,6 +6,12 @@ Items are ordered in priority.
|
||||
|
||||
INITRAMFS TODO
|
||||
|
||||
- search domain string
|
||||
- peerdns=no
|
||||
- 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 +28,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 +50,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,7 +1,4 @@
|
||||
#
|
||||
# -*- 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.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@@ -34,13 +31,17 @@ _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 --prelink --noprelink'
|
||||
--no-early-microcode --print-cmdline --prelink --noprelink --reproducible
|
||||
--uefi
|
||||
'
|
||||
|
||||
[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 --install-optional'
|
||||
--kernel-cmdline --sshkey --persistent-policy --install-optional
|
||||
--loginstall --uefi-stub --kernel-image
|
||||
'
|
||||
)
|
||||
|
||||
if __contains_word "$prev" ${OPTS[ARG]}; then
|
||||
|
@@ -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.
|
||||
#
|
||||
@@ -22,17 +20,22 @@
|
||||
export LC_MESSAGES=C
|
||||
|
||||
if [[ $DRACUT_KERNEL_LAZY ]] && ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then
|
||||
if [[ -d "$initdir/.kernelmodseen" ]]; then
|
||||
DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen"
|
||||
if ! [[ -d "$initdir/.kernelmodseen" ]]; then
|
||||
mkdir -p "$initdir/.kernelmodseen"
|
||||
fi
|
||||
DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen"
|
||||
fi
|
||||
|
||||
if [[ $initdir ]] && ! [[ -d $initdir ]]; then
|
||||
mkdir -p "$initdir"
|
||||
fi
|
||||
|
||||
# Generic substring function. If $2 is in $1, return 0.
|
||||
strstr() { [[ $1 = *$2* ]]; }
|
||||
# returns OK if $1 contains literal string $2 at the beginning, and isn't empty
|
||||
str_starts() { [ "${1#"$2"*}" != "$1" ]; }
|
||||
# returns OK if $1 contains literal string $2 at the end, and isn't empty
|
||||
str_ends() { [ "${1%*"$2"}" != "$1" ]; }
|
||||
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
|
||||
@@ -306,7 +309,7 @@ get_fs_env() {
|
||||
[[ $1 ]] || return
|
||||
unset ID_FS_TYPE
|
||||
ID_FS_TYPE=$(blkid -u filesystem -o export -- "$1" \
|
||||
| while read line; do
|
||||
| while read line || [ -n "$line" ]; do
|
||||
if [[ "$line" == TYPE\=* ]]; then
|
||||
printf "%s" "${line#TYPE=}";
|
||||
exit 0;
|
||||
@@ -373,6 +376,7 @@ get_persistent_dev() {
|
||||
return
|
||||
fi
|
||||
done
|
||||
printf -- "%s" "$1"
|
||||
}
|
||||
|
||||
expand_persistent_dev() {
|
||||
@@ -426,12 +430,12 @@ shorten_persistent_dev() {
|
||||
# $ find_block_device /usr
|
||||
# 8:4
|
||||
find_block_device() {
|
||||
local _dev _majmin _find_mpt
|
||||
local _majmin _dev _majmin _find_mpt
|
||||
_find_mpt="$1"
|
||||
if [[ $use_fstab != yes ]]; then
|
||||
[[ -d $_find_mpt/. ]]
|
||||
findmnt -e -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | { \
|
||||
while read _majmin _dev; do
|
||||
while read _majmin _dev || [ -n "$_dev" ]; do
|
||||
if [[ -b $_dev ]]; then
|
||||
if ! [[ $_majmin ]] || [[ $_majmin == 0:* ]]; then
|
||||
_majmin=$(get_maj_min $_dev)
|
||||
@@ -452,7 +456,7 @@ find_block_device() {
|
||||
# fall back to /etc/fstab
|
||||
|
||||
findmnt -e --fstab -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | { \
|
||||
while read _majmin _dev; do
|
||||
while read _majmin _dev || [ -n "$_dev" ]; do
|
||||
if ! [[ $_dev ]]; then
|
||||
_dev="$_majmin"
|
||||
unset _majmin
|
||||
@@ -488,7 +492,7 @@ find_mp_fstype() {
|
||||
|
||||
if [[ $use_fstab != yes ]]; then
|
||||
findmnt -e -v -n -o 'FSTYPE' --target "$1" | { \
|
||||
while read _fs; do
|
||||
while read _fs || [ -n "$_fs" ]; do
|
||||
[[ $_fs ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
printf "%s" "$_fs"
|
||||
@@ -497,7 +501,7 @@ find_mp_fstype() {
|
||||
fi
|
||||
|
||||
findmnt --fstab -e -v -n -o 'FSTYPE' --target "$1" | { \
|
||||
while read _fs; do
|
||||
while read _fs || [ -n "$_fs" ]; do
|
||||
[[ $_fs ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
printf "%s" "$_fs"
|
||||
@@ -524,7 +528,7 @@ find_dev_fstype() {
|
||||
|
||||
if [[ $use_fstab != yes ]]; then
|
||||
findmnt -e -v -n -o 'FSTYPE' --source "$_find_dev" | { \
|
||||
while read _fs; do
|
||||
while read _fs || [ -n "$_fs" ]; do
|
||||
[[ $_fs ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
printf "%s" "$_fs"
|
||||
@@ -533,7 +537,7 @@ find_dev_fstype() {
|
||||
fi
|
||||
|
||||
findmnt --fstab -e -v -n -o 'FSTYPE' --source "$_find_dev" | { \
|
||||
while read _fs; do
|
||||
while read _fs || [ -n "$_fs" ]; do
|
||||
[[ $_fs ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
printf "%s" "$_fs"
|
||||
@@ -632,7 +636,7 @@ check_block_and_slaves_all() {
|
||||
if ! lvm_internal_dev $2 && "$1" $2; then
|
||||
_ret=0
|
||||
fi
|
||||
check_vol_slaves_all "$@" && return 0
|
||||
check_vol_slaves "$@" && return 0
|
||||
if [[ -f /sys/dev/block/$2/../dev ]]; then
|
||||
check_block_and_slaves_all $1 $(<"/sys/dev/block/$2/../dev") && _ret=0
|
||||
fi
|
||||
@@ -684,14 +688,16 @@ 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
|
||||
_vg="${_vg//[[:space:]]/}"
|
||||
_vg=$(printf "%s\n" "$_vg")
|
||||
if [[ $_vg ]]; then
|
||||
for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
|
||||
do
|
||||
@@ -703,29 +709,6 @@ check_vol_slaves() {
|
||||
return 1
|
||||
}
|
||||
|
||||
check_vol_slaves_all() {
|
||||
local _lv _vg _pv
|
||||
for i in /dev/mapper/*; do
|
||||
[[ $i == /dev/mapper/control ]] && continue
|
||||
_lv=$(get_maj_min $i)
|
||||
if [[ $_lv = $2 ]]; then
|
||||
_vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
|
||||
# strip space
|
||||
_vg="${_vg//[[:space:]]/}"
|
||||
if [[ $_vg ]]; then
|
||||
for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
|
||||
do
|
||||
check_block_and_slaves_all $1 $(get_maj_min $_pv)
|
||||
done
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
|
||||
# fs_get_option <filesystem options> <search for option>
|
||||
# search for a specific option in a bunch of filesystem options
|
||||
# and return the value
|
||||
@@ -746,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
|
||||
@@ -768,33 +752,46 @@ inst_dir() {
|
||||
}
|
||||
|
||||
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() {
|
||||
@@ -802,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
|
||||
@@ -955,13 +963,41 @@ 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)
|
||||
|
||||
for f in "$@"; do
|
||||
f="${initdir}/etc/udev/rules.d/$f"
|
||||
[ -e "$f" ] || continue
|
||||
while read line; do
|
||||
while read line || [ -n "$line" ]; do
|
||||
if [ "${line%%IMPORT PATH_ID}" != "$line" ]; then
|
||||
if [ $UDEVVERSION -ge 174 ]; then
|
||||
printf '%sIMPORT{builtin}="path_id"\n' "${line%%IMPORT PATH_ID}"
|
||||
@@ -1094,7 +1130,7 @@ inst_opt_decompress() {
|
||||
# or the "check" script, if module-setup.sh is not found
|
||||
# "check $hostonly" is called
|
||||
module_check() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _ret
|
||||
local _forced=0
|
||||
local _hostonly=$hostonly
|
||||
@@ -1125,7 +1161,7 @@ module_check() {
|
||||
# or the "check" script, if module-setup.sh is not found
|
||||
# "mount_needs=1 check 0" is called
|
||||
module_check_mount() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _ret
|
||||
mount_needs=1
|
||||
[[ -d $_moddir ]] || return 1
|
||||
@@ -1150,7 +1186,7 @@ module_check_mount() {
|
||||
# execute the depends() function of module-setup.sh of <dracut module>
|
||||
# or the "depends" script, if module-setup.sh is not found
|
||||
module_depends() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _ret
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
@@ -1173,7 +1209,7 @@ module_depends() {
|
||||
# execute the cmdline() function of module-setup.sh of <dracut module>
|
||||
# or the "cmdline" script, if module-setup.sh is not found
|
||||
module_cmdline() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _ret
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
@@ -1194,7 +1230,7 @@ module_cmdline() {
|
||||
# execute the install() function of module-setup.sh of <dracut module>
|
||||
# or the "install" script, if module-setup.sh is not found
|
||||
module_install() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _ret
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
@@ -1215,7 +1251,7 @@ module_install() {
|
||||
# execute the installkernel() function of module-setup.sh of <dracut module>
|
||||
# or the "installkernel" script, if module-setup.sh is not found
|
||||
module_installkernel() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _ret
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
@@ -1237,7 +1273,7 @@ module_installkernel() {
|
||||
# device and filesystem types in "${host_fs_types[@]}"
|
||||
check_mount() {
|
||||
local _mod=$1
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _ret
|
||||
local _moddep
|
||||
|
||||
@@ -1302,7 +1338,7 @@ check_mount() {
|
||||
# that the modules were checked for the dependency tracking process
|
||||
check_module() {
|
||||
local _mod=$1
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _ret
|
||||
local _moddep
|
||||
# If we are already scheduled to be loaded, no need to check again.
|
||||
@@ -1415,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"
|
||||
@@ -1429,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
|
||||
@@ -1476,7 +1512,7 @@ for_each_kmod_dep() {
|
||||
local _func=$1 _kmod=$2 _cmd _modpath _options
|
||||
shift 2
|
||||
modprobe "$@" --ignore-install --show-depends $_kmod 2>&${_fderr} | (
|
||||
while read _cmd _modpath _options; do
|
||||
while read _cmd _modpath _options || [ -n "$_cmd" ]; do
|
||||
[[ $_cmd = insmod ]] || continue
|
||||
$_func ${_modpath} || exit $?
|
||||
done
|
||||
@@ -1492,16 +1528,16 @@ dracut_kernel_post() {
|
||||
--ignore-install --show-depends --set-version $kernel \
|
||||
< "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" 2>/dev/null \
|
||||
| sort -u \
|
||||
| while read _cmd _modpath _options; do
|
||||
| while read _cmd _modpath _options || [ -n "$_cmd" ]; do
|
||||
[[ $_cmd = insmod ]] || continue
|
||||
echo "$_modpath"
|
||||
done > "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
|
||||
|
||||
(
|
||||
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
|
||||
while read _modpath || [ -n "$_modpath" ]; do
|
||||
local _destpath=$_modpath
|
||||
[[ $_moddirname ]] && _destpath=${_destpath##$_moddirname/}
|
||||
_destpath=${_destpath##*/lib/modules/$kernel/}
|
||||
@@ -1509,16 +1545,16 @@ dracut_kernel_post() {
|
||||
done < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
|
||||
fi
|
||||
) &
|
||||
_pid=$(jobs -p | while read a ; do printf ":$a";done)
|
||||
_pid=$(jobs -p | while read a || [ -n "$a" ]; do printf ":$a";done)
|
||||
_pid=${_pid##*:}
|
||||
|
||||
if [[ $DRACUT_INSTALL ]]; then
|
||||
xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" \
|
||||
| while read line; do
|
||||
| while read line || [ -n "$line" ]; do
|
||||
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
|
||||
@@ -1553,7 +1589,7 @@ 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
|
||||
@@ -1599,8 +1635,8 @@ find_kernel_modules_by_path () {
|
||||
|
||||
_OLDIFS=$IFS
|
||||
IFS=:
|
||||
while read a rest; do
|
||||
[[ $a = */$1/* ]] || [[ $a = updates/* ]] || [[ $a = extra/* ]] || [[ $a = weak-updates/* ]] ||continue
|
||||
while read a rest || [ -n "$a" ]; do
|
||||
[[ $a = */$1/* ]] || [[ $a = updates/* ]] || continue
|
||||
printf "%s\n" "$srcmods/$a"
|
||||
done < "$srcmods/modules.dep"
|
||||
IFS=$_OLDIFS
|
||||
@@ -1643,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
|
||||
|
||||
@@ -1677,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
|
||||
@@ -1687,20 +1730,18 @@ instmods() {
|
||||
function instmods_1() {
|
||||
local _mod _mpargs
|
||||
if (($# == 0)); then # filenames from stdin
|
||||
while read _mod; do
|
||||
while read _mod || [ -n "$_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
|
||||
@@ -1712,10 +1753,28 @@ instmods() {
|
||||
# Capture all stderr from modprobe to _fderr. We could use {var}>...
|
||||
# redirections, but that would make dracut require bash4 at least.
|
||||
eval "( instmods_1 \"\$@\" ) ${_fderr}>&1" \
|
||||
| while read line; do [[ "$line" =~ $_filter_not_found ]] || echo $line;done | derror
|
||||
| while read line || [ -n "$line" ]; do [[ "$line" =~ $_filter_not_found ]] || echo $line;done | derror
|
||||
_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 ()
|
||||
|
@@ -1,34 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# functions used by dracut and other tools.
|
||||
#
|
||||
# Copyright 2005-2009 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
export LC_MESSAGES=C
|
||||
|
||||
if [[ $DRACUT_KERNEL_LAZY ]] && ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then
|
||||
if ! [[ -d "$initdir/.kernelmodseen" ]]; then
|
||||
mkdir -p "$initdir/.kernelmodseen"
|
||||
fi
|
||||
DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen"
|
||||
fi
|
||||
|
||||
if [[ $initdir ]] && ! [[ -d $initdir ]]; then
|
||||
mkdir -p "$initdir"
|
||||
fi
|
||||
|
||||
[[ $dracutbasedir ]] || export dracutbasedir=${BASH_SOURCE%/*}
|
||||
. $dracutbasedir/dracut-functions.sh
|
@@ -1,9 +1,11 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
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
|
||||
@@ -12,6 +14,8 @@ SKIP="$dracutbasedir/skipcpio"
|
||||
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
mount -o ro /boot &>/dev/null
|
||||
|
||||
if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
|
||||
IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
|
||||
fi
|
||||
@@ -20,6 +24,7 @@ fi
|
||||
cd /run/initramfs
|
||||
|
||||
[ -f .need_shutdown -a -f "$IMG" ] || exit 1
|
||||
|
||||
if $SKIP "$IMG" | zcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
|
||||
rm -f -- .need_shutdown
|
||||
elif $SKIP "$IMG" | xzcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
|
||||
|
@@ -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
|
||||
#
|
||||
@@ -150,7 +148,8 @@ dlog_init() {
|
||||
&& 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 _systemdcatfile="$DRACUT_TMPDIR/systemd-cat"
|
||||
readonly _dlogdir="$(mktemp --tmpdir="$TMPDIR/" -d -t dracut-log.XXXXXX)"
|
||||
readonly _systemdcatfile="$_dlogdir/systemd-cat"
|
||||
mkfifo "$_systemdcatfile"
|
||||
readonly _dlogfd=15
|
||||
systemd-cat -t 'dracut' --level-prefix=true <"$_systemdcatfile" &
|
||||
|
41
dracut.8.asc
41
dracut.8.asc
@@ -31,7 +31,7 @@ early userspace.
|
||||
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
|
||||
the file _/run/initramfs/rdsosreport.txt_ is created, which can be saved 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
|
||||
@@ -136,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.
|
||||
@@ -306,12 +319,6 @@ provide a valid _/etc/fstab_.
|
||||
**--no-hostonly-cmdline**:
|
||||
Do not store kernel command line arguments needed in the initramfs
|
||||
|
||||
**--hostonly-i18n**:
|
||||
Install only needed keyboard and font files according to the host configuration (default).
|
||||
|
||||
**--no-hostonly-i18n**:
|
||||
Install all keyboard and font files available.
|
||||
|
||||
**--persistent-policy** _<policy>_::
|
||||
Use _<policy>_ to address disks and partitions.
|
||||
_<policy>_ can be any directory name found in /dev/disk.
|
||||
@@ -418,6 +425,9 @@ will not be able to boot.
|
||||
Do not compress the generated initramfs. This will override any other
|
||||
compression options.
|
||||
|
||||
**--reproducible**::
|
||||
Create reproducible images.
|
||||
|
||||
**--list-modules**::
|
||||
List all available dracut modules.
|
||||
|
||||
@@ -452,6 +462,23 @@ will not be able to boot.
|
||||
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>_.
|
||||
|
||||
**--uefi::
|
||||
Instead of creating an initramfs image, dracut will create an UEFI executable,
|
||||
which can be executed by an UEFI BIOS.
|
||||
|
||||
**--uefi-stub _<FILE>_::
|
||||
Specifies the UEFI stub loader, which will load the attached kernel, initramfs and
|
||||
kernel command line and boots the kernel. The default is
|
||||
_/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
|
||||
or _/usr/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
|
||||
|
||||
**--kernel-image _<FILE>_::
|
||||
Specifies the kernel image, which to include in the UEFI executable. The default is
|
||||
_/lib/modules/<KERNEL-VERSION>/vmlinuz_ or _/boot/vmlinuz-<KERNEL-VERSION>_
|
||||
|
||||
FILES
|
||||
-----
|
||||
_/var/log/dracut.log_::
|
||||
|
@@ -81,6 +81,10 @@ rootfstype=ext3
|
||||
enable autoassembly of special devices like cryptoLUKS, dmraid, mdraid or
|
||||
lvm. Default is off as of dracut version >= 024.
|
||||
|
||||
**rd.hostonly=0**::
|
||||
removes all compiled in configuration of the host system the initramfs image
|
||||
was built on. This helps booting, if any disk layout changed, especially in
|
||||
combination with rd.auto or other parameters specifying the layout.
|
||||
|
||||
**rd.cmdline=ask**::
|
||||
prompts the user for additional kernel command line parameters
|
||||
@@ -105,13 +109,26 @@ resume=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
||||
the init system performs fsck before remount, you might want to use this
|
||||
option to avoid duplication.
|
||||
|
||||
iso-scan/filename
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Using iso-scan/filename with a Fedora/Red Hat/CentOS Live iso should just work
|
||||
by copying the original kernel cmdline parameters.
|
||||
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
menuentry 'Live Fedora 20' --class fedora --class gnu-linux --class gnu --class os {
|
||||
set isolabel=Fedora-Live-LXDE-x86_64-20-1
|
||||
set isofile="/boot/iso/Fedora-Live-LXDE-x86_64-20-1.iso"
|
||||
loopback loop $isofile
|
||||
linux (loop)/isolinux/vmlinuz0 boot=isolinux iso-scan/filename=$isofile root=live:LABEL=$isolabel ro rd.live.image quiet rhgb
|
||||
initrd (loop)/isolinux/initrd0.img
|
||||
}
|
||||
--
|
||||
|
||||
Misc
|
||||
~~~~
|
||||
**rd.emergency=**__[reboot|poweroff|halt]__::
|
||||
specify, what action to execute in case of a critical failure. rd.shell=0 also
|
||||
be specified.
|
||||
|
||||
**rd.driver.blacklist=**__<drivername>__[,__<drivername>__,...]::
|
||||
do not load kernel module <drivername>. This parameter can be specified
|
||||
multiple times.
|
||||
@@ -125,11 +142,16 @@ Misc
|
||||
have been loaded. This parameter can be specified multiple times.
|
||||
|
||||
**rd.retry=**__<seconds>__::
|
||||
specify how long dracut should wait for devices to appear.
|
||||
specify how long dracut should retry the initqueue to configure devices.
|
||||
The default is 30 seconds. After 2/3 of the time, degraded raids are force
|
||||
started. If you have hardware, which takes a very long time to announce its
|
||||
drives, you might want to extend this value.
|
||||
|
||||
**rd.timeout=**__<seconds>__::
|
||||
specify how long dracut should wait for devices to appear. The
|
||||
default is '0', which means 'forever'. Note that this timeout
|
||||
should be longer than rd.retry to allow for proper configuration.
|
||||
|
||||
**rd.noverifyssl**::
|
||||
accept self-signed certificates for ssl downloads.
|
||||
|
||||
@@ -141,7 +163,7 @@ Misc
|
||||
Debug
|
||||
~~~~~
|
||||
If you are dropped to an emergency shell, the file
|
||||
_/run/initramfs/rdsosreport.txt_ is created, which can be safed to a (to be
|
||||
_/run/initramfs/rdsosreport.txt_ is created, which can be saved 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.
|
||||
@@ -161,8 +183,8 @@ It should be attached to any report about dracut problems.
|
||||
_/run/initramfs/init.log_.
|
||||
If "quiet" is set, it also logs to the console.
|
||||
|
||||
**rd.memdebug=[0-4]**::
|
||||
Print memory usage info at various points, set the verbose level from 0 to 4.
|
||||
**rd.memdebug=[0-3]**::
|
||||
Print memory usage info at various points, set the verbose level from 0 to 3.
|
||||
+
|
||||
Higher level means more debugging output:
|
||||
+
|
||||
@@ -171,10 +193,6 @@ It should be attached to any report about dracut problems.
|
||||
1 - partial /proc/meminfo
|
||||
2 - /proc/meminfo
|
||||
3 - /proc/meminfo + /proc/slabinfo
|
||||
4 - /proc/meminfo + /proc/slabinfo + tracekomem
|
||||
NOTE: tracekomem is a shell script utilizing kernel trace to track
|
||||
the rough total memory consumption of kernel modules during
|
||||
loading. It may override other trace configurations.
|
||||
----
|
||||
|
||||
**rd.break**::
|
||||
@@ -366,6 +384,11 @@ DM RAID
|
||||
only activate the raid sets with the given UUID. This parameter can be
|
||||
specified multiple times.
|
||||
|
||||
MULTIPATH
|
||||
~~~~~~~~~
|
||||
**rd.multipath=0**::
|
||||
disable multipath detection
|
||||
|
||||
FIPS
|
||||
~~~~
|
||||
**rd.fips**::
|
||||
@@ -580,31 +603,6 @@ NFS
|
||||
**rd.nfs.domain=**__<NFSv4 domain name>__::
|
||||
Set the NFSv4 domain name. Will overwrite the settings in _/etc/idmap.conf_.
|
||||
|
||||
**rd.net.dhcp.retry=**__<cnt>__::
|
||||
If this option is set, dracut will try to connect via dhcp <cnt> times before failing.
|
||||
Default is 1.
|
||||
|
||||
**rd.net.timeout.dhcp=**__<arg>__::
|
||||
If this option is set, dhclient is called with "-timeout <arg>".
|
||||
|
||||
**rd.net.timeout.iflink=**__<seconds>__::
|
||||
Wait <seconds> until link shows up. Default is 60 seconds.
|
||||
|
||||
**rd.net.timeout.ifup=**__<seconds>__::
|
||||
Wait <seconds> until link has state "UP". Default is 20 seconds.
|
||||
|
||||
**rd.net.timeout.route=**__<seconds>__::
|
||||
Wait <seconds> until route shows up. Default is 20 seconds.
|
||||
|
||||
**rd.net.timeout.ipv6dad=**__<seconds>__::
|
||||
Wait <seconds> until IPv6 DAD is finished. Default is 50 seconds.
|
||||
|
||||
**rd.net.timeout.ipv6auto=**__<seconds>__::
|
||||
Wait <seconds> until IPv6 automatic addresses are assigned. Default is 40 seconds.
|
||||
|
||||
**rd.net.timeout.carrier=**__<seconds>__::
|
||||
Wait <seconds> until carrier is recognized. Default is 5 seconds.
|
||||
|
||||
CIFS
|
||||
~~~
|
||||
**root=**cifs://[__<username>__[:__<password>__]@]__<server-ip>__:__<root-dir>__::
|
||||
@@ -712,12 +710,6 @@ iscsistart -b --param node.session.timeo.replacement_timeout=30
|
||||
**rd.iscsi.ibft** **rd.iscsi.ibft=1**:
|
||||
Turn on iBFT autoconfiguration for the interfaces
|
||||
|
||||
**rd.iscsi.waitnet=0**:
|
||||
Turn off waiting for all interfaces to be up before trying to login to the iSCSI targets.
|
||||
|
||||
**rd.iscsi.testroute=0**:
|
||||
Turn off checking, if the route to the iSCSI target IP is possible before trying to login.
|
||||
|
||||
FCoE
|
||||
~~~~
|
||||
**fcoe=**__<edd|interface|MAC>__:__{dcb|nodcb}__::
|
||||
@@ -825,13 +817,14 @@ of your compressed filesystem image tarball.
|
||||
=====================
|
||||
|
||||
**root=**live:__<url>__::
|
||||
Boots a live image retrieved from __<url>__. Valid handlers: __http, httpd, ftp, tftp__.
|
||||
Boots a live image retrieved from __<url>__. Valid handlers: __http, https, ftp, torrent, tftp__.
|
||||
+
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
root=live:http://example.com/liveboot.img
|
||||
root=live:ftp://ftp.example.com/liveboot.img
|
||||
root=live:torrent://example.com/liveboot.img.torrent
|
||||
--
|
||||
|
||||
**rd.live.debug=**1::
|
||||
@@ -997,6 +990,8 @@ rd_NO_MD:: rd.md=0
|
||||
|
||||
rd_MD_UUID:: rd.md.uuid
|
||||
|
||||
rd_NO_MULTIPATH: rd.multipath=0
|
||||
|
||||
rd_NFS_DOMAIN:: rd.nfs.domain
|
||||
|
||||
iscsi_initiator:: rd.iscsi.initiator
|
||||
|
@@ -10,7 +10,8 @@ dracut.conf - configuration file(s) for dracut
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
_/etc/dracut.conf_ _/etc/dracut.conf.d/*.conf_
|
||||
_/etc/dracut.conf_
|
||||
_/etc/dracut.conf.d/\*.conf_
|
||||
_/usr/lib/dracut/dracut.conf.d/*.conf_
|
||||
|
||||
Description
|
||||
@@ -30,11 +31,6 @@ dracut command line options will overwrite any values set here.
|
||||
|
||||
Configuration files must have the extension .conf; other extensions are ignored.
|
||||
|
||||
[WARNING]
|
||||
====
|
||||
Space-separated lists have to have a leading and trailing space!
|
||||
====
|
||||
|
||||
*dracutmodules+=*" __<dracut modules>__ "::
|
||||
Specify a space-separated list of dracut modules to call when building the
|
||||
initramfs. Modules are located in _/usr/lib/dracut/modules.d_.
|
||||
@@ -54,6 +50,10 @@ Space-separated lists have to have a leading and trailing space!
|
||||
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.
|
||||
@@ -75,6 +75,13 @@ Space-separated lists have to have a leading and trailing space!
|
||||
Specify additional files to include in the initramfs, separated by spaces,
|
||||
if they exist.
|
||||
|
||||
*compress=*"__{bzip2|lzma|xz|gzip|lzo|lz4|<compressor [args ...]>}__"::
|
||||
Compress the generated initramfs using the passed compression program. If
|
||||
you pass it just the name of a compression program, it will call that
|
||||
program with known-working arguments. If you pass arguments, it will be called
|
||||
with exactly those arguments. Depending on what you pass, this may result in
|
||||
an initramfs that the kernel cannot decompress.
|
||||
|
||||
*do_strip=*"__{yes|no}__"::
|
||||
Strip binaries in the initramfs (default=yes)
|
||||
|
||||
@@ -85,12 +92,9 @@ Space-separated lists have to have a leading and trailing space!
|
||||
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}__"::
|
||||
*hostonly_cmdline=*"__{yes|no}__"::
|
||||
If set, store the kernel command line arguments needed in the initramfs
|
||||
|
||||
*i18n_install_all=*"__{yes|no}__"::
|
||||
If set to yes, install all available fonts and keyboard files.
|
||||
|
||||
*persistent_policy=*"__<policy>__"::
|
||||
Use _<policy>_ to address disks and partitions.
|
||||
_<policy>_ can be any directory name found in /dev/disk.
|
||||
@@ -187,6 +191,22 @@ provide a valid _/etc/fstab_.
|
||||
*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>_.
|
||||
|
||||
*uefi_stub=*"_<FILE>_"::
|
||||
Specifies the UEFI stub loader, which will load the attached kernel, initramfs and
|
||||
kernel command line and boots the kernel. The default is
|
||||
_/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
|
||||
or _/usr/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
|
||||
|
||||
*kernel_image=*"_<FILE>_"::
|
||||
Specifies the kernel image, which to include in the UEFI executable. The default is
|
||||
_/lib/modules/<KERNEL-VERSION>/vmlinuz_ or _/boot/vmlinuz-<KERNEL-VERSION>_
|
||||
|
||||
Files
|
||||
-----
|
||||
_/etc/dracut.conf_::
|
||||
|
@@ -2,8 +2,10 @@
|
||||
|
||||
# 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_optional_items+=" vi /etc/virc ps grep cat rm "
|
||||
|
@@ -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
|
||||
|
@@ -19,7 +19,7 @@ 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
|
||||
The main script, which creates the initramfs is dracut itself. 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
|
||||
|
566
dracut.sh
566
dracut.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
|
||||
#!/bin/bash --norc
|
||||
#
|
||||
# Generator script for a dracut initramfs
|
||||
# Tries to retain some degree of compatibility with the command line
|
||||
@@ -81,6 +79,10 @@ Creates initial ramdisk images for preloading modules
|
||||
exclusively include in the initramfs.
|
||||
--add-drivers [LIST] Specify a space-separated list of kernel
|
||||
modules to add to the initramfs.
|
||||
--force-drivers [LIST] Specify a space-separated list of kernel
|
||||
modules to add to the initramfs and make sure they
|
||||
are tried to be loaded via modprobe same as passing
|
||||
rd.driver.pre=DRIVER kernel parameter.
|
||||
--omit-drivers [LIST] Specify a space-separated list of kernel
|
||||
modules not to add to the initramfs.
|
||||
--filesystems [LIST] Specify a space-separated list of kernel filesystem
|
||||
@@ -141,9 +143,6 @@ Creates initial ramdisk images for preloading modules
|
||||
in the initramfs
|
||||
--no-hostonly-cmdline Do not store kernel command line arguments needed
|
||||
in the initramfs
|
||||
--hostonly-i18n Install only needed keyboard and font files according
|
||||
to the host configuration (default).
|
||||
--no-hostonly-i18n Install all keyboard and font files available.
|
||||
--persistent-policy [POLICY]
|
||||
Use [POLICY] to address disks and partitions.
|
||||
POLICY can be any directory name found in /dev/disk.
|
||||
@@ -175,10 +174,10 @@ Creates initial ramdisk images for preloading modules
|
||||
--xz Compress the generated initramfs using xz.
|
||||
Make sure that your kernel has xz support compiled
|
||||
in, otherwise you will not be able to boot.
|
||||
--lzo Compress the generated initramfs using lzop.
|
||||
--lzo Compress the generated initramfs using lzop.
|
||||
Make sure that your kernel has lzo support compiled
|
||||
in, otherwise you will not be able to boot.
|
||||
--lz4 Compress the generated initramfs using lz4.
|
||||
--lz4 Compress the generated initramfs using lz4.
|
||||
Make sure that your kernel has lz4 support compiled
|
||||
in, otherwise you will not be able to boot.
|
||||
--compress [COMPRESSION] Compress the generated initramfs with the
|
||||
@@ -194,6 +193,12 @@ Creates initial ramdisk images for preloading modules
|
||||
--printsize Print out the module install size
|
||||
--sshkey [SSHKEY] Add ssh key to initramfs (use with ssh-client module)
|
||||
--logfile [FILE] Logfile to use (overrides configuration setting)
|
||||
--reproducible Create reproducible images
|
||||
--loginstall [DIR] Log all files installed from the host to [DIR]
|
||||
--uefi Create an UEFI executable with the kernel cmdline and
|
||||
kernel combined
|
||||
--uefi-stub [FILE] Use the UEFI stub [FILE] to create an UEFI executable
|
||||
--kernel-image [FILE] location of the kernel image
|
||||
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes.
|
||||
|
||||
@@ -218,6 +223,16 @@ push() {
|
||||
done
|
||||
}
|
||||
|
||||
# Fills up host_devs stack variable and makes sure there are no duplicates
|
||||
push_host_devs() {
|
||||
local _dev
|
||||
for _dev in ${host_devs[@]}; do
|
||||
[ "$_dev" = "$1" ] && return
|
||||
done
|
||||
push host_devs "$1"
|
||||
}
|
||||
|
||||
|
||||
# function pop()
|
||||
# pops the last value from a stack
|
||||
# assigns value to second argument variable
|
||||
@@ -304,6 +319,7 @@ rearrange_params()
|
||||
--long add: \
|
||||
--long force-add: \
|
||||
--long add-drivers: \
|
||||
--long force-drivers: \
|
||||
--long omit-drivers: \
|
||||
--long modules: \
|
||||
--long omit: \
|
||||
@@ -375,8 +391,11 @@ rearrange_params()
|
||||
--long noimageifnotneeded \
|
||||
--long early-microcode \
|
||||
--long no-early-microcode \
|
||||
--long no-hostonly-i18n \
|
||||
--long hostonly-i18n \
|
||||
--long reproducible \
|
||||
--long loginstall: \
|
||||
--long uefi \
|
||||
--long uefi-stub: \
|
||||
--long kernel-image: \
|
||||
-- "$@")
|
||||
|
||||
if (( $? != 0 )); then
|
||||
@@ -471,6 +490,7 @@ while :; do
|
||||
-a|--add) push add_dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--force-add) push force_add_dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--add-drivers) push add_drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--force-drivers) push force_drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--omit-drivers) push omit_drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
-m|--modules) push dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
-o|--omit) push omit_dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
@@ -497,6 +517,7 @@ while :; do
|
||||
-L|--stdlog) stdloglvl_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--compress) compress_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--prefix) prefix_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--loginstall) loginstall_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--rebuild) if [ $rebuild_file == $outfile ]; then
|
||||
force=yes
|
||||
fi
|
||||
@@ -530,7 +551,7 @@ while :; do
|
||||
-q|--quiet) ((verbosity_mod_l--));;
|
||||
-l|--local)
|
||||
allowlocal="yes"
|
||||
[[ -f "$(readlink -f "${0%/*}")/dracut-init.sh" ]] \
|
||||
[[ -f "$(readlink -f "${0%/*}")/dracut-functions.sh" ]] \
|
||||
&& dracutbasedir="$(readlink -f "${0%/*}")"
|
||||
;;
|
||||
-H|--hostonly|--host-only)
|
||||
@@ -539,10 +560,6 @@ while :; do
|
||||
hostonly_l="no" ;;
|
||||
--hostonly-cmdline)
|
||||
hostonly_cmdline_l="yes" ;;
|
||||
--hostonly-i18n)
|
||||
i18n_install_all_l="no" ;;
|
||||
--no-hostonly-i18n)
|
||||
i18n_install_all_l="yes" ;;
|
||||
--no-hostonly-cmdline)
|
||||
hostonly_cmdline_l="no" ;;
|
||||
--persistent-policy)
|
||||
@@ -566,7 +583,12 @@ while :; do
|
||||
--printsize) printsize="yes";;
|
||||
--regenerate-all) regenerate_all="yes";;
|
||||
--noimageifnotneeded) noimageifnotneeded="yes";;
|
||||
|
||||
--reproducible) reproducible_l="yes";;
|
||||
--uefi) uefi="yes";;
|
||||
--uefi-stub)
|
||||
uefi_stub_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--kernel-image)
|
||||
kernel_image_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--) shift; break;;
|
||||
|
||||
*) # should not even reach this point
|
||||
@@ -579,7 +601,7 @@ done
|
||||
# the old fashioned way
|
||||
|
||||
while (($# > 0)); do
|
||||
if [ ${1%%=*} == "++include" ]; then
|
||||
if [ "${1%%=*}" == "++include" ]; then
|
||||
push include_src "$2"
|
||||
push include_target "$3"
|
||||
PARMS_TO_STORE+=" --include '$2' '$3'"
|
||||
@@ -635,21 +657,10 @@ if ! [[ $outfile ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
for i in /usr/sbin /sbin /usr/bin /bin; do
|
||||
rl=$i
|
||||
if [ -L "$i" ]; then
|
||||
rl=$(readlink -f $i)
|
||||
fi
|
||||
if [[ "$NPATH" != *:$rl* ]] ; then
|
||||
NPATH+=":$rl"
|
||||
fi
|
||||
done
|
||||
export PATH="${NPATH#:}"
|
||||
unset LC_MESSAGES
|
||||
unset LC_CTYPE
|
||||
export LC_ALL=C
|
||||
export LANG=C
|
||||
unset NPATH
|
||||
unset LD_LIBRARY_PATH
|
||||
unset LD_PRELOAD
|
||||
unset GREP_OPTIONS
|
||||
@@ -694,6 +705,20 @@ for f in $(dropindirs_sort ".conf" "$confdir" "$dracutbasedir/dracut.conf.d"); d
|
||||
[[ -e $f ]] && . "$f"
|
||||
done
|
||||
|
||||
DRACUT_PATH=${DRACUT_PATH:-/sbin /bin /usr/sbin /usr/bin}
|
||||
|
||||
for i in $DRACUT_PATH; do
|
||||
rl=$i
|
||||
if [ -L "$i" ]; then
|
||||
rl=$(readlink -f $i)
|
||||
fi
|
||||
if [[ "$NPATH" != *:$rl* ]] ; then
|
||||
NPATH+=":$rl"
|
||||
fi
|
||||
done
|
||||
export PATH="${NPATH#:}"
|
||||
unset NPATH
|
||||
|
||||
# these optins add to the stuff in the config file
|
||||
if (( ${#add_dracutmodules_l[@]} )); then
|
||||
while pop add_dracutmodules_l val; do
|
||||
@@ -790,13 +815,13 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||
[[ $prefix = "/" ]] && unset prefix
|
||||
[[ $hostonly_l ]] && hostonly=$hostonly_l
|
||||
[[ $hostonly_cmdline_l ]] && hostonly_cmdline=$hostonly_cmdline_l
|
||||
[[ $i18n_install_all_l ]] && i18n_install_all=$i18n_install_all_l
|
||||
[[ "$hostonly" == "yes" ]] && ! [[ $hostonly_cmdline ]] && hostonly_cmdline="yes"
|
||||
[[ $persistent_policy_l ]] && persistent_policy=$persistent_policy_l
|
||||
[[ $use_fstab_l ]] && use_fstab=$use_fstab_l
|
||||
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
|
||||
[[ $lvmconf_l ]] && lvmconf=$lvmconf_l
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
[[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware"
|
||||
[[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware /lib/firmware/$kernel"
|
||||
[[ $tmpdir_l ]] && tmpdir="$tmpdir_l"
|
||||
[[ $tmpdir ]] || tmpdir=/var/tmp
|
||||
[[ $INITRD_COMPRESS ]] && compress=$INITRD_COMPRESS
|
||||
@@ -807,16 +832,38 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||
[[ $early_microcode_l ]] && early_microcode=$early_microcode_l
|
||||
[[ $early_microcode ]] || early_microcode=no
|
||||
[[ $logfile_l ]] && logfile="$logfile_l"
|
||||
[[ $reproducible_l ]] && reproducible="$reproducible_l"
|
||||
[[ $loginstall_l ]] && loginstall="$loginstall_l"
|
||||
[[ $uefi_stub_l ]] && uefi_stub="$uefi_stub_l"
|
||||
[[ $kernel_image_l ]] && kernel_image="$kernel_image_l"
|
||||
|
||||
# eliminate IFS hackery when messing with fw_dir
|
||||
fw_dir=${fw_dir//:/ }
|
||||
|
||||
# check for logfile and try to create one if it doesn't exist
|
||||
if [[ -n "$logfile" ]];then
|
||||
if [[ ! -f "$logfile" ]];then
|
||||
touch "$logfile"
|
||||
if [ ! $? -eq 0 ] ;then
|
||||
printf "%s\n" "dracut: touch $logfile failed." >&2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# handle compression options.
|
||||
[[ $compress ]] || compress="gzip"
|
||||
case $compress in
|
||||
bzip2) compress="bzip2 -9";;
|
||||
bzip2) compress="bzip2 -9";
|
||||
command -v lbzip2 > /dev/null 2>&1 && compress="lbzip2 -9";;
|
||||
lzma) compress="lzma -9 -T0";;
|
||||
xz) compress="xz --check=crc32 --lzma2=dict=1MiB -T0";;
|
||||
gzip) compress="gzip -9"; command -v pigz > /dev/null 2>&1 && compress="pigz -9";;
|
||||
gzip) compress="gzip -n -9";
|
||||
if command -v pigz > /dev/null 2>&1; then
|
||||
compress="pigz -9 -n -T -R"
|
||||
elif command -v gzip --help 2>&1 | grep -q rsyncable; then
|
||||
compress="gzip -n -9 --rsyncable"
|
||||
fi
|
||||
;;
|
||||
lzo) compress="lzop -9";;
|
||||
lz4) compress="lz4 -l -9";;
|
||||
esac
|
||||
@@ -827,26 +874,35 @@ fi
|
||||
[[ $hostonly = yes ]] && hostonly="-h"
|
||||
[[ $hostonly != "-h" ]] && unset hostonly
|
||||
|
||||
[[ $reproducible == yes ]] && DRACUT_REPRODUCIBLE=1
|
||||
|
||||
readonly TMPDIR="$tmpdir"
|
||||
readonly DRACUT_TMPDIR="$(mktemp -p "$TMPDIR/" -d -t dracut.XXXXXX)"
|
||||
[ -d "$DRACUT_TMPDIR" ] || {
|
||||
printf "%s\n" "dracut: mktemp -p '$TMPDIR/' -d -t dracut.XXXXXX failed." >&2
|
||||
readonly initdir="$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)"
|
||||
[ -d "$initdir" ] || {
|
||||
printf "%s\n" "dracut: mktemp --tmpdir='$TMPDIR/' -d -t initramfs.XXXXXX failed." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ $early_microcode = yes ]] || ( [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]] ); then
|
||||
readonly early_cpio_dir="$(mktemp --tmpdir="$TMPDIR/" -d -t early_cpio.XXXXXX)"
|
||||
[ -d "$early_cpio_dir" ] || {
|
||||
printf "%s\n" "dracut: mktemp --tmpdir='$TMPDIR/' -d -t early_cpio.XXXXXX failed." >&2
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap '
|
||||
ret=$?;
|
||||
[[ $keep ]] && echo "Not removing $DRACUT_TMPDIR." >&2 || { [[ $DRACUT_TMPDIR ]] && rm -rf -- "$DRACUT_TMPDIR"; };
|
||||
[[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf -- "$initdir"; };
|
||||
[[ $keep ]] && echo "Not removing $early_cpio_dir." >&2 || { [[ $early_cpio_dir ]] && rm -Rf -- "$early_cpio_dir"; };
|
||||
[[ $keep ]] && echo "Not removing $uefi_outdir." >&2 || { [[ $uefi_outdir ]] && rm -Rf -- "$uefi_outdir"; };
|
||||
[[ $_dlogdir ]] && rm -Rf -- "$_dlogdir";
|
||||
exit $ret;
|
||||
' EXIT
|
||||
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap 'exit 1;' SIGINT
|
||||
|
||||
readonly initdir="${DRACUT_TMPDIR}/initramfs"
|
||||
mkdir "$initdir"
|
||||
|
||||
export DRACUT_KERNEL_LAZY="1"
|
||||
export DRACUT_RESOLVE_LAZY="1"
|
||||
|
||||
@@ -857,10 +913,14 @@ if [[ $print_cmdline ]]; then
|
||||
kmsgloglvl=0
|
||||
fi
|
||||
|
||||
if [[ -f $dracutbasedir/dracut-init.sh ]]; then
|
||||
. $dracutbasedir/dracut-init.sh
|
||||
if [[ -f $dracutbasedir/dracut-version.sh ]]; then
|
||||
. $dracutbasedir/dracut-version.sh
|
||||
fi
|
||||
|
||||
if [[ -f $dracutbasedir/dracut-functions.sh ]]; then
|
||||
. $dracutbasedir/dracut-functions.sh
|
||||
else
|
||||
printf "%s\n" "dracut: Cannot find $dracutbasedir/dracut-init.sh." >&2
|
||||
printf "%s\n" "dracut: Cannot find $dracutbasedir/dracut-functions.sh." >&2
|
||||
printf "%s\n" "dracut: Are you running from a git checkout?" >&2
|
||||
printf "%s\n" "dracut: Try passing -l as an argument to $0" >&2
|
||||
exit 1
|
||||
@@ -875,11 +935,7 @@ if ! [[ $print_cmdline ]]; then
|
||||
rm -fr -- ${initdir}/*
|
||||
fi
|
||||
|
||||
if [[ -f $dracutbasedir/dracut-version.sh ]]; then
|
||||
. $dracutbasedir/dracut-version.sh
|
||||
fi
|
||||
|
||||
# Verify bash version, current minimum is 3.1
|
||||
# Verify bash version, current minimum is 4
|
||||
if (( BASH_VERSINFO[0] < 4 )); then
|
||||
dfatal 'You need at least Bash 4 to use dracut, sorry.'
|
||||
exit 1
|
||||
@@ -888,24 +944,6 @@ fi
|
||||
dracutfunctions=$dracutbasedir/dracut-functions.sh
|
||||
export dracutfunctions
|
||||
|
||||
|
||||
|
||||
case "$(arch)" in
|
||||
i686|x86_64)
|
||||
;;
|
||||
*)
|
||||
if [[ $early_microcode = yes ]]; then
|
||||
early_microcode=no
|
||||
dinfo "Disabling early microcode for $(arch)"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ $early_microcode = yes ]] || ( [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]] ); then
|
||||
readonly early_cpio_dir="${DRACUT_TMPDIR}/earlycpio"
|
||||
mkdir "$early_cpio_dir"
|
||||
fi
|
||||
|
||||
if (( ${#drivers_l[@]} )); then
|
||||
drivers=''
|
||||
while pop drivers_l val; do
|
||||
@@ -921,6 +959,13 @@ if (( ${#add_drivers_l[@]} )); then
|
||||
fi
|
||||
add_drivers=${add_drivers/-/_}
|
||||
|
||||
if (( ${#force_drivers_l[@]} )); then
|
||||
while pop force_drivers_l val; do
|
||||
force_drivers+=" $val "
|
||||
done
|
||||
fi
|
||||
force_drivers=${force_drivers/-/_}
|
||||
|
||||
if (( ${#omit_drivers_l[@]} )); then
|
||||
while pop omit_drivers_l val; do
|
||||
omit_drivers+=" $val "
|
||||
@@ -937,6 +982,7 @@ fi
|
||||
omit_drivers_corrected=""
|
||||
for d in $omit_drivers; do
|
||||
[[ " $drivers $add_drivers " == *\ $d\ * ]] && continue
|
||||
[[ " $drivers $force_drivers " == *\ $d\ * ]] && continue
|
||||
omit_drivers_corrected+="$d|"
|
||||
done
|
||||
omit_drivers="${omit_drivers_corrected%|}"
|
||||
@@ -969,14 +1015,9 @@ esac
|
||||
abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
|
||||
|
||||
if [[ -d $srcmods ]]; then
|
||||
if ! [[ -f $srcmods/modules.dep ]]; then
|
||||
if [[ -n "$(find "$srcmods" -name '*.ko*')" ]]; then
|
||||
dfatal "$srcmods/modules.dep is missing. Did you run depmod?"
|
||||
exit 1
|
||||
else
|
||||
dwarn "$srcmods/modules.dep is missing. Did you run depmod?"
|
||||
fi
|
||||
fi
|
||||
[[ -f $srcmods/modules.dep ]] || {
|
||||
dwarn "$srcmods/modules.dep is missing. Did you run depmod?"
|
||||
}
|
||||
fi
|
||||
|
||||
if [[ ! $print_cmdline ]]; then
|
||||
@@ -998,6 +1039,78 @@ if [[ ! $print_cmdline ]]; then
|
||||
dfatal "No permission to write $outfile."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $loginstall ]]; then
|
||||
if ! mkdir -p "$loginstall"; then
|
||||
dfatal "Could not create directory to log installed files to '$loginstall'."
|
||||
exit 1
|
||||
fi
|
||||
loginstall=$(readlink -f "$loginstall")
|
||||
fi
|
||||
|
||||
if [[ $uefi = yes ]]; then
|
||||
if ! command -v objcopy &>/dev/null; then
|
||||
dfatal "Need 'objcopy' to create a UEFI executable"
|
||||
exit 1
|
||||
fi
|
||||
unset EFI_MACHINE_TYPE_NAME
|
||||
case $(arch) in
|
||||
x86_64)
|
||||
EFI_MACHINE_TYPE_NAME=x64;;
|
||||
ia32)
|
||||
EFI_MACHINE_TYPE_NAME=ia32;;
|
||||
*)
|
||||
dfatal "Architecture '$(arch)' not supported to create a UEFI executable"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if ! [[ -s $uefi_stub ]]; then
|
||||
for uefi_stub in \
|
||||
"/lib/systemd/boot/efi/linux${EFI_MACHINE_TYPE_NAME}.efi.stub" \
|
||||
"/usr/lib/gummiboot/linux${EFI_MACHINE_TYPE_NAME}.efi.stub"; do
|
||||
[[ -s $uefi_stub ]] || continue
|
||||
break
|
||||
done
|
||||
fi
|
||||
if ! [[ -s $uefi_stub ]]; then
|
||||
dfatal "Can't find a uefi stub '$uefi_stub' to create a UEFI executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [[ $kernel_image ]]; then
|
||||
for kernel_image in "/lib/modules/$kernel/vmlinuz" "/boot/vmlinuz-$kernel"; do
|
||||
[[ -s "$kernel_image" ]] || continue
|
||||
break
|
||||
done
|
||||
fi
|
||||
if ! [[ -s $kernel_image ]]; then
|
||||
dfatal "Can't find a kernel image '$kernel_image' to create a UEFI executable"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $acpi_override = yes ]] && ! check_kernel_config CONFIG_ACPI_INITRD_TABLE_OVERRIDE; then
|
||||
dwarn "Disabling ACPI override, because kernel does not support it. CONFIG_ACPI_INITRD_TABLE_OVERRIDE!=y"
|
||||
unset acpi_override
|
||||
fi
|
||||
|
||||
if [[ $early_microcode = yes ]]; then
|
||||
if [[ $hostonly ]]; then
|
||||
[[ $(get_cpu_vendor) == "AMD" ]] \
|
||||
&& ! check_kernel_config CONFIG_MICROCODE_AMD_EARLY \
|
||||
&& unset early_microcode
|
||||
[[ $(get_cpu_vendor) == "Intel" ]] \
|
||||
&& ! check_kernel_config CONFIG_MICROCODE_INTEL_EARLY \
|
||||
&& unset early_microcode
|
||||
else
|
||||
! check_kernel_config CONFIG_MICROCODE_AMD_EARLY \
|
||||
&& ! check_kernel_config CONFIG_MICROCODE_INTEL_EARLY \
|
||||
&& unset early_microcode
|
||||
fi
|
||||
[[ $early_microcode != yes ]] \
|
||||
&& dwarn "Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE_[AMD|INTEL]_EARLY!=y"
|
||||
fi
|
||||
|
||||
# Need to be able to have non-root users read stuff (rpcbind etc)
|
||||
@@ -1016,26 +1129,42 @@ declare -A host_fs_types
|
||||
|
||||
for line in "${fstab_lines[@]}"; do
|
||||
set -- $line
|
||||
dev="$1"
|
||||
#dev mp fs fsopts
|
||||
push host_devs "$1"
|
||||
host_fs_types["$1"]="$3"
|
||||
case "$dev" in
|
||||
UUID=*)
|
||||
dev=$(blkid -l -t UUID=${dev#UUID=} -o device)
|
||||
;;
|
||||
LABEL=*)
|
||||
dev=$(blkid -l -t LABEL=${dev#LABEL=} -o device)
|
||||
;;
|
||||
PARTUUID=*)
|
||||
dev=$(blkid -l -t PARTUUID=${dev#PARTUUID=} -o device)
|
||||
;;
|
||||
PARTLABEL=*)
|
||||
dev=$(blkid -l -t PARTLABEL=${dev#PARTLABEL=} -o device)
|
||||
;;
|
||||
esac
|
||||
[ -z "$dev" ] && dwarn "Bad fstab entry $@" && continue
|
||||
push_host_devs "$dev"
|
||||
host_fs_types["$dev"]="$3"
|
||||
done
|
||||
|
||||
for f in $add_fstab; do
|
||||
[[ -e $f ]] || continue
|
||||
while read dev rest; do
|
||||
push host_devs "$dev"
|
||||
while read dev rest || [ -n "$dev" ]; do
|
||||
push_host_devs "$dev"
|
||||
done < "$f"
|
||||
done
|
||||
|
||||
for dev in $add_device; do
|
||||
push host_devs "$dev"
|
||||
push_host_devs "$dev"
|
||||
done
|
||||
|
||||
if (( ${#add_device_l[@]} )); then
|
||||
while pop add_device_l val; do
|
||||
add_device+=" $val "
|
||||
push host_devs "$val"
|
||||
push_host_devs "$val"
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -1064,17 +1193,17 @@ if [[ $hostonly ]]; then
|
||||
_dev=$(find_block_device "$mp")
|
||||
_bdev=$(readlink -f "/dev/block/$_dev")
|
||||
[[ -b $_bdev ]] && _dev=$_bdev
|
||||
push host_devs $_dev
|
||||
push_host_devs $_dev
|
||||
[[ "$mp" == "/" ]] && root_dev="$_dev"
|
||||
push host_devs "$_dev"
|
||||
push_host_devs "$_dev"
|
||||
done
|
||||
|
||||
if [[ -f /proc/swaps ]] && [[ -f /etc/fstab ]]; then
|
||||
while read dev type rest; do
|
||||
while read dev type rest || [ -n "$dev" ]; do
|
||||
[[ -b $dev ]] || continue
|
||||
[[ "$type" == "partition" ]] || continue
|
||||
|
||||
while read _d _m _t _o _r; do
|
||||
while read _d _m _t _o _r || [ -n "$_d" ]; do
|
||||
[[ "$_d" == \#* ]] && continue
|
||||
[[ $_d ]] || continue
|
||||
[[ $_t != "swap" ]] && continue
|
||||
@@ -1096,31 +1225,17 @@ if [[ $hostonly ]]; then
|
||||
fi
|
||||
|
||||
_dev="$(readlink -f "$dev")"
|
||||
push host_devs "$_dev"
|
||||
push_host_devs "$_dev"
|
||||
push swap_devs "$_dev"
|
||||
break
|
||||
done < /etc/fstab
|
||||
done < /proc/swaps
|
||||
fi
|
||||
|
||||
# collect all "x-initrd.mount" entries from /etc/fstab
|
||||
if [[ -f /etc/fstab ]]; then
|
||||
while read _d _m _t _o _r || [ -n "$_d" ]; do
|
||||
[[ "$_d" == \#* ]] && continue
|
||||
[[ $_d ]] || continue
|
||||
[[ "$_o" != *x-initrd.mount* ]] && continue
|
||||
_dev=$(expand_persistent_dev "$_d")
|
||||
_dev="$(readlink -f "$_dev")"
|
||||
[[ -b $_dev ]] && push host_devs "$_dev"
|
||||
done < /etc/fstab
|
||||
fi
|
||||
|
||||
|
||||
# record all host modaliases
|
||||
declare -A host_modalias
|
||||
find /sys/devices/ -name uevent -print > "$initdir/.modalias"
|
||||
while read m; do
|
||||
while read line; do
|
||||
while read m || [ -n "$m" ]; do
|
||||
while read line || [ -n "$line" ]; do
|
||||
[[ "$line" != MODALIAS\=* ]] && continue
|
||||
modalias="${line##MODALIAS=}" && [[ $modalias ]] && host_modalias["$modalias"]=1
|
||||
break
|
||||
@@ -1129,15 +1244,14 @@ if [[ $hostonly ]]; then
|
||||
|
||||
rm -f -- "$initdir/.modalias"
|
||||
|
||||
while read _k _s _v; do
|
||||
while read _k _s _v || [ -n "$_k" ]; do
|
||||
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
|
||||
host_modalias["$_v"]=1
|
||||
done </proc/crypto
|
||||
|
||||
# check /proc/modules
|
||||
declare -A host_modules
|
||||
while read m rest; do
|
||||
[ -z "$m" ] && continue
|
||||
while read m rest || [ -n "$m" ]; do
|
||||
host_modules["$m"]=1
|
||||
done </proc/modules
|
||||
fi
|
||||
@@ -1177,18 +1291,12 @@ for dev in "${!host_fs_types[@]}"; do
|
||||
fi
|
||||
if [[ $journaldev ]]; then
|
||||
dev="$(readlink -f "$dev")"
|
||||
push host_devs "$dev"
|
||||
push_host_devs "$dev"
|
||||
_get_fs_type "$dev"
|
||||
check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")"
|
||||
fi
|
||||
done
|
||||
|
||||
# also put the additional filesystems in host_fs_types
|
||||
# so that the according modules are installed.
|
||||
for fs in $filesystems; do
|
||||
host_fs_types[$fs]="$fs"
|
||||
done
|
||||
|
||||
[[ -d $udevdir ]] \
|
||||
|| udevdir="$(pkg-config udev --variable=udevdir 2>/dev/null)"
|
||||
if ! [[ -d "$udevdir" ]]; then
|
||||
@@ -1243,14 +1351,24 @@ for_each_module_dir check_mount
|
||||
|
||||
dracut_module_included "fips" && export DRACUT_FIPS_MODE=1
|
||||
|
||||
if [[ $print_cmdline ]]; then
|
||||
modules_loaded=" "
|
||||
do_print_cmdline()
|
||||
{
|
||||
local -A _mods_to_print
|
||||
for i in $modules_loaded $mods_to_load; do
|
||||
_mods_to_print[$i]=1
|
||||
done
|
||||
|
||||
# source our modules.
|
||||
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
_d_mod=${moddir##*/}; _d_mod=${_d_mod#[0-9][0-9]}
|
||||
[[ ${_mods_to_print[$_d_mod]} ]] || continue
|
||||
module_cmdline "$_d_mod"
|
||||
done
|
||||
unset moddir
|
||||
}
|
||||
|
||||
if [[ $print_cmdline ]]; then
|
||||
do_print_cmdline
|
||||
printf "\n"
|
||||
exit 0
|
||||
fi
|
||||
@@ -1269,7 +1387,7 @@ if [[ $prefix ]]; then
|
||||
fi
|
||||
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
for d in usr/bin usr/sbin bin etc lib sbin tmp usr var $libdirs; do
|
||||
for d in usr/bin usr/sbin bin etc lib sbin tmp usr var var/tmp $libdirs; do
|
||||
[[ -e "${initdir}${prefix}/$d" ]] && continue
|
||||
if [ -L "/$d" ]; then
|
||||
inst_symlink "/$d" "${prefix}/$d"
|
||||
@@ -1316,36 +1434,35 @@ modules_loaded=" "
|
||||
# source our modules.
|
||||
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
_d_mod=${moddir##*/}; _d_mod=${_d_mod#[0-9][0-9]}
|
||||
if [[ "$mods_to_load" == *\ $_d_mod\ * ]]; then
|
||||
if [[ $show_modules = yes ]]; then
|
||||
printf "%s\n" "$_d_mod"
|
||||
else
|
||||
dinfo "*** Including module: $_d_mod ***"
|
||||
fi
|
||||
if [[ $kernel_only == yes ]]; then
|
||||
[[ "$mods_to_load" == *\ $_d_mod\ * ]] || continue
|
||||
if [[ $show_modules = yes ]]; then
|
||||
printf "%s\n" "$_d_mod"
|
||||
else
|
||||
dinfo "*** Including module: $_d_mod ***"
|
||||
fi
|
||||
if [[ $kernel_only == yes ]]; then
|
||||
module_installkernel "$_d_mod" || {
|
||||
dfatal "installkernel failed in module $_d_mod"
|
||||
exit 1
|
||||
}
|
||||
else
|
||||
module_install "$_d_mod"
|
||||
if [[ $no_kernel != yes ]]; then
|
||||
module_installkernel "$_d_mod" || {
|
||||
dfatal "installkernel failed in module $_d_mod"
|
||||
exit 1
|
||||
}
|
||||
else
|
||||
module_install "$_d_mod"
|
||||
if [[ $no_kernel != yes ]]; then
|
||||
module_installkernel "$_d_mod" || {
|
||||
dfatal "installkernel failed in module $_d_mod"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
fi
|
||||
mods_to_load=${mods_to_load// $_d_mod /}
|
||||
modules_loaded+="$_d_mod "
|
||||
fi
|
||||
mods_to_load=${mods_to_load// $_d_mod /}
|
||||
modules_loaded+="$_d_mod "
|
||||
|
||||
#print the module install size
|
||||
if [ -n "$printsize" ]; then
|
||||
_isize_new=$(du -sk ${initdir}|cut -f1)
|
||||
_isize_delta=$((_isize_new - _isize))
|
||||
printf "%s\n" "$_d_mod install size: ${_isize_delta}k"
|
||||
_isize=$_isize_new
|
||||
fi
|
||||
#print the module install size
|
||||
if [ -n "$printsize" ]; then
|
||||
_isize_new=$(du -sk ${initdir}|cut -f1)
|
||||
_isize_delta=$((_isize_new - _isize))
|
||||
printf "%s\n" "$_d_mod install size: ${_isize_delta}k"
|
||||
_isize=$_isize_new
|
||||
fi
|
||||
done
|
||||
unset moddir
|
||||
@@ -1367,6 +1484,13 @@ if [[ $no_kernel != yes ]]; then
|
||||
if [[ $add_drivers ]]; then
|
||||
hostonly='' instmods -c $add_drivers
|
||||
fi
|
||||
if [[ $force_drivers ]]; then
|
||||
hostonly='' instmods -c $force_drivers
|
||||
rm -f $initdir/etc/cmdline.d/20-force_driver.conf
|
||||
for mod in $force_drivers; do
|
||||
echo "rd.driver.pre=$mod" >>$initdir/etc/cmdline.d/20-force_drivers.conf
|
||||
done
|
||||
fi
|
||||
if [[ $filesystems ]]; then
|
||||
hostonly='' instmods -c $filesystems
|
||||
fi
|
||||
@@ -1416,34 +1540,44 @@ if [[ $kernel_only != yes ]]; then
|
||||
|
||||
if [[ $DRACUT_RESOLVE_LAZY ]] && [[ $DRACUT_INSTALL ]]; then
|
||||
dinfo "*** Resolving executable dependencies ***"
|
||||
find "$initdir" -type f \
|
||||
'(' -perm -0100 -or -perm -0010 -or -perm -0001 ')' \
|
||||
-not -path '*.ko' -print0 \
|
||||
find "$initdir" -type f -perm /0111 -not -path '*.ko' -print0 \
|
||||
| xargs -r -0 $DRACUT_INSTALL ${initdir:+-D "$initdir"} -R ${DRACUT_FIPS_MODE:+-H} --
|
||||
dinfo "*** Resolving executable dependencies done***"
|
||||
fi
|
||||
|
||||
# libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so
|
||||
for _dir in $libdirs; do
|
||||
for _f in "$_dir/libpthread.so"*; do
|
||||
[[ -e "$_f" ]] || continue
|
||||
inst_libdir_file "libgcc_s.so*"
|
||||
break 2
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
while pop include_src src && pop include_target tgt; do
|
||||
if [[ $src && $tgt ]]; then
|
||||
while pop include_src src && pop include_target target; do
|
||||
if [[ $src && $target ]]; then
|
||||
if [[ -f $src ]]; then
|
||||
inst $src $tgt
|
||||
inst $src $target
|
||||
else
|
||||
ddebug "Including directory: $src"
|
||||
mkdir -p "${initdir}/${tgt}"
|
||||
destdir="${initdir}/${target}"
|
||||
mkdir -p "$destdir"
|
||||
# check for preexisting symlinks, so we can cope with the
|
||||
# symlinks to $prefix
|
||||
for i in "$src"/*; do
|
||||
[[ -e "$i" || -h "$i" ]] || continue
|
||||
s=${initdir}/${tgt}/${i#$src/}
|
||||
if [[ -d "$i" ]]; then
|
||||
if ! [[ -e "$s" ]]; then
|
||||
mkdir -m 0755 -p "$s"
|
||||
chmod --reference="$i" "$s"
|
||||
# Objectname is a file or a directory
|
||||
for objectname in "$src"/*; do
|
||||
[[ -e "$objectname" || -h "$objectname" ]] || continue
|
||||
if [[ -d "$objectname" ]]; then
|
||||
# objectname is a directory, let's compute the final directory name
|
||||
object_destdir=${destdir}/${objectname#$src/}
|
||||
if ! [[ -e "$object_destdir" ]]; then
|
||||
mkdir -m 0755 -p "$object_destdir"
|
||||
chmod --reference="$objectname" "$object_destdir"
|
||||
fi
|
||||
cp --reflink=auto --sparse=auto -fa -t "$s" "$i"/*
|
||||
cp --reflink=auto --sparse=auto -fa -t "$object_destdir" "$objectname"/*
|
||||
else
|
||||
cp --reflink=auto --sparse=auto -fa -t "$s" "$i"
|
||||
cp --reflink=auto --sparse=auto -fa -t "$destdir" "$objectname"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
@@ -1503,16 +1637,15 @@ if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
|
||||
|
||||
# strip kernel modules, but do not touch signed modules
|
||||
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
|
||||
| while read -r -d $'\0' f; do
|
||||
| while read -r -d $'\0' f || [ -n "$f" ]; do
|
||||
SIG=$(tail -c 28 "$f")
|
||||
[[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
|
||||
done | xargs -r -0 strip -g
|
||||
|
||||
dinfo "*** Stripping files done ***"
|
||||
fi
|
||||
|
||||
if [[ $early_microcode = yes ]]; then
|
||||
dinfo "*** Generating early-microcode cpio image contents ***"
|
||||
dinfo "*** Generating early-microcode cpio image ***"
|
||||
ucode_dir=(amd-ucode intel-ucode)
|
||||
ucode_dest=(AuthenticAMD.bin GenuineIntel.bin)
|
||||
_dest_dir="$early_cpio_dir/d/kernel/x86/microcode"
|
||||
@@ -1530,27 +1663,15 @@ if [[ $early_microcode = yes ]]; then
|
||||
dinfo "*** Constructing ${ucode_dest[$idx]} ****"
|
||||
if [[ $hostonly ]]; then
|
||||
_src=$(get_ucode_file)
|
||||
[[ $_src ]] || break
|
||||
[[ -r $_fwdir/$_fw/$_src ]] || break
|
||||
if ! [[ -r $_fwdir/$_fw/$_src ]];then
|
||||
break;
|
||||
fi
|
||||
fi
|
||||
|
||||
for i in $_fwdir/$_fw/$_src; do
|
||||
[ -e "$i" ] && break
|
||||
break 2
|
||||
done
|
||||
for i in $_fwdir/$_fw/$_src; do
|
||||
[[ -e "$i" ]] || continue
|
||||
# skip gpg files
|
||||
str_ends "$i" ".asc" && continue
|
||||
cat "$i" >> $_dest_dir/${ucode_dest[$idx]}
|
||||
done
|
||||
cat $_fwdir/$_fw/$_src > $_dest_dir/${ucode_dest[$idx]}
|
||||
create_early_cpio="yes"
|
||||
fi
|
||||
done
|
||||
done
|
||||
if ! [[ $create_early_cpio = yes ]]; then
|
||||
dinfo "*** No early-microcode cpio image needed ***"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]]; then
|
||||
@@ -1559,7 +1680,7 @@ if [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]]; then
|
||||
mkdir -p $_dest_dir
|
||||
for table in $acpi_table_dir/*.aml; do
|
||||
dinfo " Adding ACPI table: $table"
|
||||
cp $table $_dest_dir
|
||||
cp -a $table $_dest_dir
|
||||
create_early_cpio="yes"
|
||||
done
|
||||
fi
|
||||
@@ -1570,53 +1691,100 @@ if ! ( echo $PARMS_TO_STORE > $initdir/lib/dracut/build-parameter.txt ); then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $hostonly_cmdline ]] ; then
|
||||
unset _stored_cmdline
|
||||
if [ -d $initdir/etc/cmdline.d ];then
|
||||
dinfo "Stored kernel commandline:"
|
||||
for conf in $initdir/etc/cmdline.d/*.conf ; do
|
||||
[ -e "$conf" ] || continue
|
||||
dinfo "$(< $conf)"
|
||||
_stored_cmdline=1
|
||||
done
|
||||
fi
|
||||
if ! [[ $_stored_cmdline ]]; then
|
||||
dinfo "No dracut internal kernel commandline stored in initrd"
|
||||
fi
|
||||
fi
|
||||
rm -f -- "$outfile"
|
||||
dinfo "*** Creating image file ***"
|
||||
dinfo "*** Creating image file '$outfile' ***"
|
||||
|
||||
if [[ $uefi = yes ]]; then
|
||||
uefi_outfile="$outfile"
|
||||
readonly uefi_outdir="$(mktemp --tmpdir="$TMPDIR/" -d -t initrd.XXXXXX)"
|
||||
# redirect initrd output
|
||||
outfile="$uefi_outdir/initrd"
|
||||
fi
|
||||
|
||||
if [[ $DRACUT_REPRODUCIBLE ]]; then
|
||||
find "$initdir" -newer "$dracutbasedir/dracut-functions.sh" -print0 \
|
||||
| xargs -r -0 touch -h -m -c -r "$dracutbasedir/dracut-functions.sh"
|
||||
|
||||
[[ "$(cpio --help)" == *--reproducible* ]] && CPIO_REPRODUCIBLE=1
|
||||
fi
|
||||
|
||||
[[ "$UID" != 0 ]] && cpio_owner_root="-R 0:0"
|
||||
|
||||
if [[ $create_early_cpio = yes ]]; then
|
||||
dinfo "*** Creating microcode section ***"
|
||||
echo 1 > "$early_cpio_dir/d/early_cpio"
|
||||
# The microcode blob is _before_ the initramfs blob, not after
|
||||
if ! (
|
||||
umask 077
|
||||
cd "$early_cpio_dir/d"
|
||||
find . -print0 | cpio --null $cpio_owner_root -H newc -o --quiet > "${DRACUT_TMPDIR}/initramfs.img"
|
||||
); then
|
||||
dfatal "dracut: creation of $outfile failed"
|
||||
exit 1
|
||||
else
|
||||
dinfo "*** Created microcode section ***"
|
||||
|
||||
if [[ $DRACUT_REPRODUCIBLE ]]; then
|
||||
find "$early_cpio_dir/d" -newer "$dracutbasedir/dracut-functions.sh" -print0 \
|
||||
| xargs -r -0 touch -h -m -c -r "$dracutbasedir/dracut-functions.sh"
|
||||
fi
|
||||
|
||||
# The microcode blob is _before_ the initramfs blob, not after
|
||||
(
|
||||
cd "$early_cpio_dir/d"
|
||||
find . -print0 | sort -z \
|
||||
| cpio ${CPIO_REPRODUCIBLE:+--reproducible} --null $cpio_owner_root -H newc -o --quiet > $outfile
|
||||
)
|
||||
fi
|
||||
|
||||
if ! (
|
||||
umask 077
|
||||
cd "$initdir"
|
||||
find . -print0 | cpio --null $cpio_owner_root -H newc -o --quiet | \
|
||||
$compress >> "${DRACUT_TMPDIR}/initramfs.img";
|
||||
umask 077; cd "$initdir"
|
||||
find . -print0 | sort -z \
|
||||
| cpio ${CPIO_REPRODUCIBLE:+--reproducible} --null $cpio_owner_root -H newc -o --quiet \
|
||||
| $compress >> "$outfile"
|
||||
); then
|
||||
dfatal "dracut: creation of $outfile failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dinfo "*** Creating image file done ***"
|
||||
dinfo "*** Creating initrd image file '$outfile' done ***"
|
||||
|
||||
if (( maxloglvl >= 5 )); then
|
||||
if [[ $allowlocal ]]; then
|
||||
"$dracutbasedir/lsinitrd.sh" "${DRACUT_TMPDIR}/initramfs.img" | ddebug
|
||||
"$dracutbasedir/lsinitrd.sh" "$outfile"| ddebug
|
||||
else
|
||||
lsinitrd "${DRACUT_TMPDIR}/initramfs.img" | ddebug
|
||||
lsinitrd "$outfile"| ddebug
|
||||
fi
|
||||
fi
|
||||
|
||||
if cp --reflink=auto "${DRACUT_TMPDIR}/initramfs.img" "$outfile" |& derror ; then
|
||||
dinfo "*** Creating initramfs image file '$outfile' done ***"
|
||||
else
|
||||
rm -f -- "$outfile"
|
||||
dfatal "dracut: creation of $outfile failed"
|
||||
exit 1
|
||||
if [[ $uefi = yes ]]; then
|
||||
if [[ $kernel_cmdline ]]; then
|
||||
echo -n "$kernel_cmdline" > "$uefi_outdir/cmdline.txt"
|
||||
elif [[ $hostonly_cmdline = yes ]] && [ -d $initdir/etc/cmdline.d ];then
|
||||
for conf in $initdir/etc/cmdline.d/*.conf ; do
|
||||
[ -e "$conf" ] || continue
|
||||
printf "%s " "$(< $conf)" >> "$uefi_outdir/cmdline.txt"
|
||||
done
|
||||
else
|
||||
do_print_cmdline > "$uefi_outdir/cmdline.txt"
|
||||
fi
|
||||
echo -ne "\x00" >> "$uefi_outdir/cmdline.txt"
|
||||
|
||||
dinfo "Using UEFI kernel cmdline:"
|
||||
dinfo $(< "$uefi_outdir/cmdline.txt")
|
||||
|
||||
[[ -s /usr/lib/os-release ]] && uefi_osrelease="/usr/lib/os-release"
|
||||
[[ -s /etc/os-release ]] && uefi_osrelease="/etc/os-release"
|
||||
|
||||
objcopy \
|
||||
${uefi_osrelease:+--add-section .osrel=$uefi_osrelease --change-section-vma .osrel=0x20000} \
|
||||
--add-section .cmdline="$uefi_outdir/cmdline.txt" --change-section-vma .cmdline=0x30000 \
|
||||
--add-section .linux="$kernel_image" --change-section-vma .linux=0x40000 \
|
||||
--add-section .initrd="$outfile" --change-section-vma .initrd=0x3000000 \
|
||||
"$uefi_stub" "$uefi_outfile"
|
||||
dinfo "*** Creating UEFI image file '$uefi_outfile' done ***"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
83
dracut.spec
83
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
|
||||
@@ -91,23 +97,20 @@ Requires: gzip xz
|
||||
Requires: kmod
|
||||
Requires: sed
|
||||
Requires: kpartx
|
||||
Requires: tar
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
Requires: util-linux >= 2.21
|
||||
Requires: systemd >= 219
|
||||
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,22 +195,14 @@ Requires: %{name} = %{version}-%{release}
|
||||
This package contains tools to assemble the local initrd and host configuration.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}
|
||||
|
||||
%if %{defined PATCH1}
|
||||
git init
|
||||
git config user.email "dracut-maint@redhat.com"
|
||||
git config user.name "Fedora dracut team"
|
||||
git add .
|
||||
git commit -a -q -m "%{version} baseline."
|
||||
|
||||
# Apply all the patches.
|
||||
git am -p1 %{patches}
|
||||
git tag %{version}
|
||||
%endif
|
||||
%autosetup -n %{name}-%{version} -S git_am
|
||||
cp %{SOURCE1} .
|
||||
|
||||
%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}
|
||||
|
||||
@@ -250,15 +245,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
|
||||
@@ -277,19 +275,17 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
|
||||
> $RPM_BUILD_ROOT/etc/system-fips
|
||||
%endif
|
||||
|
||||
# create compat symlink
|
||||
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
|
||||
%{_sbindir}/dracut
|
||||
%{_datadir}/bash-completion/completions/dracut
|
||||
%{_datadir}/bash-completion/completions/lsinitrd
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
|
||||
@@ -298,7 +294,6 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%endif
|
||||
%dir %{dracutlibdir}
|
||||
%dir %{dracutlibdir}/modules.d
|
||||
%{dracutlibdir}/dracut-init.sh
|
||||
%{dracutlibdir}/dracut-functions.sh
|
||||
%{dracutlibdir}/dracut-functions
|
||||
%{dracutlibdir}/dracut-version.sh
|
||||
@@ -313,6 +308,8 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%dir %{_sysconfdir}/dracut.conf.d
|
||||
%dir %{dracutlibdir}/dracut.conf.d
|
||||
%{_datadir}/pkgconfig/dracut.pc
|
||||
|
||||
%if %{with doc}
|
||||
%{_mandir}/man8/dracut.8*
|
||||
%{_mandir}/man8/*service.8*
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
|
||||
@@ -324,12 +321,16 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%{_mandir}/man7/dracut.modules.7*
|
||||
%{_mandir}/man7/dracut.bootup.7*
|
||||
%{_mandir}/man5/dracut.conf.5*
|
||||
%endif
|
||||
|
||||
%if %{defined _unitdir}
|
||||
%{dracutlibdir}/modules.d/00systemd-bootchart
|
||||
%else
|
||||
%{dracutlibdir}/modules.d/00bootchart
|
||||
%endif
|
||||
%{dracutlibdir}/modules.d/00bash
|
||||
%{dracutlibdir}/modules.d/00systemd
|
||||
%{dracutlibdir}/modules.d/01systemd-initrd
|
||||
%{dracutlibdir}/modules.d/03modsign
|
||||
%{dracutlibdir}/modules.d/03rescue
|
||||
%{dracutlibdir}/modules.d/04watchdog
|
||||
@@ -340,7 +341,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
|
||||
@@ -358,8 +358,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 +375,7 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/modules.d/98pollcdrom
|
||||
%{dracutlibdir}/modules.d/98selinux
|
||||
%{dracutlibdir}/modules.d/98syslog
|
||||
%{dracutlibdir}/modules.d/98systemd
|
||||
%{dracutlibdir}/modules.d/98dracut-systemd
|
||||
%{dracutlibdir}/modules.d/98usrmount
|
||||
%{dracutlibdir}/modules.d/99base
|
||||
%{dracutlibdir}/modules.d/99fs-lib
|
||||
@@ -383,7 +385,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
|
||||
@@ -406,7 +408,9 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
|
||||
%files network
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/modules.d/02systemd-networkd
|
||||
%{dracutlibdir}/modules.d/40network
|
||||
%{dracutlibdir}/modules.d/90kernel-network-modules
|
||||
%{dracutlibdir}/modules.d/95fcoe
|
||||
%{dracutlibdir}/modules.d/95iscsi
|
||||
%{dracutlibdir}/modules.d/90livenet
|
||||
@@ -430,7 +434,6 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
|
||||
%files fips-aesni
|
||||
%defattr(-,root,root,0755)
|
||||
%doc COPYING
|
||||
%{dracutlibdir}/modules.d/02fips-aesni
|
||||
|
||||
%files caps
|
||||
@@ -439,7 +442,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
|
||||
|
@@ -37,14 +37,10 @@ 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.
|
||||
|
||||
[NOTE]
|
||||
===============================
|
||||
On RHEL-7 the hostonly mode is the default mode. Generic "non-hostonly" images
|
||||
are created, if the dracut-config-generic rpm is installed. The rescue kernel
|
||||
entry in the bootloader menu is also a generic image.
|
||||
===============================
|
||||
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
|
||||
@@ -103,10 +99,9 @@ raid with encryption and LVM on top), as long as you specify the correct
|
||||
filesystem LABEL or UUID on the kernel command line for your root device, dracut
|
||||
will find it and boot from it.
|
||||
|
||||
The kernel command line usually can be configured in _/boot/grub2/grub.cfg_
|
||||
(or _/boot/efi/EFI/redhat/grub.cfg_ for EFI systems), if
|
||||
grub2 is your bootloader and it also can be edited in the real boot process in
|
||||
the grub menu.
|
||||
The kernel command line 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>>.
|
||||
@@ -251,21 +246,6 @@ specified multiple times.
|
||||
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=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
|
||||
@@ -305,7 +285,7 @@ This will reduce the size of the initramfs image significantly.
|
||||
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
|
||||
https://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html
|
||||
|
||||
|
||||
[[identifying-your-problem-area]]
|
||||
@@ -330,8 +310,7 @@ stick and mount that. Then you can store the output for later inspection.
|
||||
In all cases, the following should be mentioned and attached to your bug report:
|
||||
|
||||
* The exact kernel command-line used. Typically from the bootloader
|
||||
configuration file (e.g. _/boot/grub2/grub.cfg_ (or _/boot/efi/EFI/redhat/grub.cfg_ for EFI systems))
|
||||
or from _/proc/cmdline_.
|
||||
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
|
||||
@@ -365,17 +344,49 @@ 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.
|
||||
|
||||
. In _/boot/grub2/grub.cfg_ (or _/boot/efi/EFI/redhat/grub.cfg_ for EFI systems),
|
||||
add the following boot arguments to the ''linux16''
|
||||
. 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
|
||||
@@ -384,18 +395,20 @@ 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. _/boot/grub2/grub.cfg_ (or _/boot/efi/EFI/redhat/grub.cfg_ for EFI systems))
|
||||
(e.g. _/etc/grub.conf_)
|
||||
. Remove the boot arguments ''rhgb'' and ''quiet''
|
||||
+
|
||||
A sample _grub.cfg_ bootloader configuration file snippet is listed below.
|
||||
A sample _/etc/grub.conf_ bootloader configuration file is listed below.
|
||||
+
|
||||
----
|
||||
menuentry 'Red Hat Enterprise Linux Server (3.10.0-308.el7.x86_64) 7.0 (Maipo)' […] {
|
||||
[…]
|
||||
linux16 /vmlinuz-3.10.0-308.el7.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
|
||||
initrd16 /initramfs-3.10.0-308.el7.x86_64.img
|
||||
[…]
|
||||
}
|
||||
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
|
||||
@@ -500,7 +513,7 @@ on _pre-shutdown_ or _shutdown_.
|
||||
To do this from an already booted system:
|
||||
----
|
||||
# mkdir -p /run/initramfs/etc/cmdline.d
|
||||
# echo "rd.break=pre-shutdown" > /run/initramfs/etc/cmdline.d/debug.conf
|
||||
# echo "rd.debug rd.break=pre-shutdown rd.break=shutdown" > /run/initramfs/etc/cmdline.d/debug.conf
|
||||
# touch /run/initramfs/.need_shutdown
|
||||
----
|
||||
|
||||
|
@@ -20,7 +20,8 @@ chomp($tag);
|
||||
my @patches=&create_patches($tag, $pdir);
|
||||
my $num=$#patches + 2;
|
||||
$tag=~s/[^0-9]+?([0-9]+)/$1/;
|
||||
my $release="$num";
|
||||
my $release="$num.git$datestr";
|
||||
$release="1" if $num == 1;
|
||||
|
||||
while(<>) {
|
||||
if (/^Version:/) {
|
||||
|
@@ -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,10 +384,15 @@ 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;
|
||||
}
|
||||
|
||||
/* musl ldd */
|
||||
if (strstr(buf, "Not a valid dynamic program"))
|
||||
break;
|
||||
|
||||
/* glibc */
|
||||
if (strstr(buf, "not a dynamic executable"))
|
||||
break;
|
||||
|
||||
@@ -397,6 +414,8 @@ static int resolve_deps(const char *src)
|
||||
|
||||
p = strchr(p, '/');
|
||||
if (p) {
|
||||
char *q;
|
||||
|
||||
for (q = p; *q && *q != ' ' && *q != '\n'; q++) ;
|
||||
*q = '\0';
|
||||
|
||||
@@ -425,7 +444,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");
|
||||
@@ -464,6 +483,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;
|
||||
@@ -625,7 +674,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);
|
||||
|
||||
@@ -639,8 +694,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"
|
||||
@@ -651,6 +706,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"
|
||||
@@ -680,8 +736,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);
|
||||
}
|
||||
|
||||
@@ -703,13 +759,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);
|
||||
@@ -738,9 +796,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;
|
||||
@@ -788,13 +852,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");
|
||||
|
||||
@@ -802,34 +866,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);
|
||||
@@ -837,30 +888,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;
|
||||
}
|
||||
@@ -881,17 +939,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;
|
||||
}
|
||||
@@ -960,6 +1023,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)) {
|
||||
@@ -988,6 +1068,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
|
||||
|
||||
@@ -22,6 +20,8 @@
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <sched.h>
|
||||
#include <limits.h>
|
||||
@@ -134,8 +135,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 +571,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,7 +1,4 @@
|
||||
#
|
||||
# -*- 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.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
84
lsinitrd.sh
84
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.
|
||||
@@ -110,13 +108,19 @@ if ! [[ -f "$image" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dracutlibdirs() {
|
||||
for d in lib64/dracut lib/dracut usr/lib64/dracut usr/lib/dracut; do
|
||||
echo "$d/$1"
|
||||
done
|
||||
}
|
||||
|
||||
extract_files()
|
||||
{
|
||||
(( ${#filenames[@]} == 1 )) && nofileinfo=1
|
||||
for f in ${!filenames[@]}; do
|
||||
[[ $nofileinfo ]] || echo "initramfs:/$f"
|
||||
[[ $nofileinfo ]] || echo "========================================================================"
|
||||
$CAT $image 2>/dev/null | 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
|
||||
@@ -126,7 +130,8 @@ extract_files()
|
||||
list_modules()
|
||||
{
|
||||
echo "dracut modules:"
|
||||
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/modules.txt' 'usr/lib/dracut/modules.txt' 2>/dev/null
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
|
||||
$(dracutlibdirs modules.txt) 2>/dev/null
|
||||
((ret+=$?))
|
||||
}
|
||||
|
||||
@@ -134,9 +139,9 @@ list_files()
|
||||
{
|
||||
echo "========================================================================"
|
||||
if [ "$sorted" -eq 1 ]; then
|
||||
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
else
|
||||
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -k9
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -k9
|
||||
fi
|
||||
((ret+=$?))
|
||||
echo "========================================================================"
|
||||
@@ -144,7 +149,7 @@ list_files()
|
||||
|
||||
|
||||
if (( ${#filenames[@]} <= 0 )); then
|
||||
echo "Image: $image: $(du -h $image | while read a b; do echo $a;done)"
|
||||
echo "Image: $image: $(du -h $image | while read a b || [ -n "$a" ]; do echo $a;done)"
|
||||
echo "========================================================================"
|
||||
fi
|
||||
|
||||
@@ -171,35 +176,38 @@ case $bin in
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ $SKIP ]] ; then
|
||||
bin="$($SKIP "$image" | { read -N 6 bin && echo "$bin" ; })"
|
||||
else
|
||||
read -N 6 bin < "$image"
|
||||
fi
|
||||
case $bin in
|
||||
$'\x1f\x8b'*)
|
||||
CAT="zcat --"
|
||||
;;
|
||||
BZh*)
|
||||
CAT="bzcat --"
|
||||
;;
|
||||
$'\x71\xc7'*|070701)
|
||||
CAT="cat --"
|
||||
;;
|
||||
$'\x02\x21'*)
|
||||
CAT="lz4 -d -c"
|
||||
;;
|
||||
$'\x89'LZO$'\0'*)
|
||||
CAT="lzop -d -c"
|
||||
;;
|
||||
*)
|
||||
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
|
||||
CAT="xzcat --single-stream --"
|
||||
CAT=$({
|
||||
if [[ $SKIP ]]; then
|
||||
$SKIP "$image"
|
||||
else
|
||||
CAT="xzcat --"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
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()
|
||||
{
|
||||
@@ -216,7 +224,8 @@ ret=0
|
||||
if (( ${#filenames[@]} > 0 )); then
|
||||
extract_files
|
||||
else
|
||||
version=$($CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/dracut-*' 'usr/lib/dracut/dracut-*' 2>/dev/null)
|
||||
version=$($CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
|
||||
$(dracutlibdirs 'dracut-*') 2>/dev/null)
|
||||
((ret+=$?))
|
||||
echo "Version: $version"
|
||||
echo
|
||||
@@ -225,7 +234,8 @@ else
|
||||
echo "========================================================================"
|
||||
else
|
||||
echo -n "Arguments: "
|
||||
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/build-parameter.txt' 'usr/lib/dracut/build-parameter.txt' 2>/dev/null
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
|
||||
$(dracutlibdirs build-parameter.txt) 2>/dev/null
|
||||
echo
|
||||
list_modules
|
||||
list_files
|
||||
|
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
|
@@ -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() {
|
||||
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
|
||||
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() {
|
||||
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
|
||||
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,7 +1,6 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
[[ $mount_needs ]] && return 1
|
||||
if require_binaries $systemdutildir/systemd; then
|
||||
@@ -13,26 +12,17 @@ check() {
|
||||
return 1
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods autofs4 ipv6
|
||||
hostonly='' instmods autofs4 ipv6
|
||||
instmods -s efivarfs
|
||||
}
|
||||
|
||||
|
||||
ug_check_and_add() {
|
||||
local name="$1"
|
||||
local file="$2"
|
||||
|
||||
if egrep -q "^$name:" "$file" 2>/dev/null \
|
||||
&& ! egrep -q "^$name:" "$initdir$file" 2>/dev/null; then
|
||||
egrep "^$name:" "$file" 2>/dev/null >> "$initdir$file"
|
||||
fi
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _mods
|
||||
|
||||
@@ -41,12 +31,6 @@ install() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ug_check_and_add "wheel" "/etc/passwd"
|
||||
ug_check_and_add "wheel" "/etc/group"
|
||||
|
||||
ug_check_and_add "adm" "/etc/passwd"
|
||||
ug_check_and_add "adm" "/etc/group"
|
||||
|
||||
inst_multiple -o \
|
||||
$systemdutildir/systemd \
|
||||
$systemdutildir/systemd-cgroups-agent \
|
||||
@@ -59,6 +43,7 @@ install() {
|
||||
$systemdutildir/systemd-modules-load \
|
||||
$systemdutildir/systemd-vconsole-setup \
|
||||
$systemdutildir/system-generators/systemd-fstab-generator \
|
||||
$systemdutildir/system-generators/systemd-gpt-auto-generator \
|
||||
\
|
||||
$systemdsystemunitdir/cryptsetup.target \
|
||||
$systemdsystemunitdir/emergency.target \
|
||||
@@ -66,14 +51,14 @@ install() {
|
||||
$systemdsystemunitdir/basic.target \
|
||||
$systemdsystemunitdir/halt.target \
|
||||
$systemdsystemunitdir/kexec.target \
|
||||
$systemdsystemunitdir/initrd.target \
|
||||
$systemdsystemunitdir/initrd-fs.target \
|
||||
$systemdsystemunitdir/initrd-root-fs.target \
|
||||
$systemdsystemunitdir/local-fs.target \
|
||||
$systemdsystemunitdir/local-fs-pre.target \
|
||||
$systemdsystemunitdir/remote-fs.target \
|
||||
$systemdsystemunitdir/remote-fs-pre.target \
|
||||
$systemdsystemunitdir/multi-user.target \
|
||||
$systemdsystemunitdir/network.target \
|
||||
$systemdsystemunitdir/network-pre.target \
|
||||
$systemdsystemunitdir/network-online.target \
|
||||
$systemdsystemunitdir/nss-lookup.target \
|
||||
$systemdsystemunitdir/nss-user-lookup.target \
|
||||
$systemdsystemunitdir/poweroff.target \
|
||||
@@ -98,6 +83,7 @@ install() {
|
||||
$systemdsystemunitdir/systemd-udevd-kernel.socket \
|
||||
$systemdsystemunitdir/systemd-ask-password-plymouth.path \
|
||||
$systemdsystemunitdir/systemd-journald.socket \
|
||||
$systemdsystemunitdir/systemd-journald-audit.socket \
|
||||
$systemdsystemunitdir/systemd-ask-password-console.service \
|
||||
$systemdsystemunitdir/systemd-modules-load.service \
|
||||
$systemdsystemunitdir/systemd-halt.service \
|
||||
@@ -112,6 +98,7 @@ install() {
|
||||
$systemdsystemunitdir/systemd-journald.service \
|
||||
$systemdsystemunitdir/systemd-vconsole-setup.service \
|
||||
$systemdsystemunitdir/systemd-random-seed-load.service \
|
||||
$systemdsystemunitdir/systemd-random-seed.service \
|
||||
$systemdsystemunitdir/systemd-sysctl.service \
|
||||
\
|
||||
$systemdsystemunitdir/sysinit.target.wants/systemd-modules-load.service \
|
||||
@@ -120,6 +107,7 @@ install() {
|
||||
$systemdsystemunitdir/sockets.target.wants/systemd-udevd-control.socket \
|
||||
$systemdsystemunitdir/sockets.target.wants/systemd-udevd-kernel.socket \
|
||||
$systemdsystemunitdir/sockets.target.wants/systemd-journald.socket \
|
||||
$systemdsystemunitdir/sockets.target.wants/systemd-journald-audit.socket \
|
||||
$systemdsystemunitdir/sockets.target.wants/systemd-journald-dev-log.socket \
|
||||
$systemdsystemunitdir/sysinit.target.wants/systemd-udevd.service \
|
||||
$systemdsystemunitdir/sysinit.target.wants/systemd-udev-trigger.service \
|
||||
@@ -128,21 +116,20 @@ install() {
|
||||
$systemdsystemunitdir/sysinit.target.wants/systemd-sysctl.service \
|
||||
\
|
||||
$systemdsystemunitdir/ctrl-alt-del.target \
|
||||
$systemdsystemunitdir/reboot.target \
|
||||
$systemdsystemunitdir/systemd-reboot.service \
|
||||
$systemdsystemunitdir/syslog.socket \
|
||||
$systemdsystemunitdir/initrd-switch-root.target \
|
||||
$systemdsystemunitdir/initrd-switch-root.service \
|
||||
$systemdsystemunitdir/initrd-cleanup.service \
|
||||
$systemdsystemunitdir/initrd-udevadm-cleanup-db.service \
|
||||
$systemdsystemunitdir/initrd-parse-etc.service \
|
||||
\
|
||||
$systemdsystemunitdir/slices.target \
|
||||
$systemdsystemunitdir/system.slice \
|
||||
$systemdsystemunitdir/-.slice \
|
||||
\
|
||||
$tmpfilesdir/systemd.conf \
|
||||
\
|
||||
systemd-run systemd-escape \
|
||||
journalctl systemctl echo swapoff systemd-cgls systemd-tmpfiles
|
||||
journalctl systemctl \
|
||||
echo swapoff \
|
||||
kmod insmod rmmod modprobe modinfo depmod lsmod \
|
||||
mount umount reboot poweroff \
|
||||
systemd-cgls systemd-tmpfiles
|
||||
|
||||
inst_multiple -o \
|
||||
/usr/lib/modules-load.d/*.conf \
|
||||
@@ -152,7 +139,7 @@ install() {
|
||||
local _line i
|
||||
for i in "$1"/*.conf; do
|
||||
[[ -f $i ]] || continue
|
||||
while read _line; do
|
||||
while read _line || [ -n "$_line" ]; do
|
||||
case $_line in
|
||||
\#*)
|
||||
;;
|
||||
@@ -169,7 +156,7 @@ install() {
|
||||
[[ $_mods ]] && instmods $_mods
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
inst_multiple -o \
|
||||
inst_multiple -H -o \
|
||||
/etc/systemd/journald.conf \
|
||||
/etc/systemd/system.conf \
|
||||
/etc/hostname \
|
||||
@@ -190,30 +177,15 @@ install() {
|
||||
|
||||
# install adm user/group for journald
|
||||
inst_multiple nologin
|
||||
egrep '^systemd-journal:' "$initdir/etc/passwd" 2>/dev/null >> "$initdir/etc/passwd"
|
||||
egrep '^systemd-journal:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
egrep '^adm:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
egrep '^systemd-journal:' /etc/group >> "$initdir/etc/group"
|
||||
egrep '^wheel:' /etc/group >> "$initdir/etc/group"
|
||||
egrep '^adm:' /etc/group >> "$initdir/etc/group"
|
||||
|
||||
ln_r $systemdutildir/systemd "/init"
|
||||
ln_r $systemdutildir/systemd "/sbin/init"
|
||||
|
||||
inst_script "$moddir/dracut-emergency.sh" /bin/dracut-emergency
|
||||
inst_simple "$moddir/emergency.service" ${systemdsystemunitdir}/emergency.service
|
||||
inst_simple "$moddir/dracut-emergency.service" ${systemdsystemunitdir}/dracut-emergency.service
|
||||
inst_simple "$moddir/emergency.service" ${systemdsystemunitdir}/rescue.service
|
||||
|
||||
ln_r "${systemdsystemunitdir}/initrd.target" "${systemdsystemunitdir}/default.target"
|
||||
|
||||
inst_script "$moddir/dracut-cmdline.sh" /bin/dracut-cmdline
|
||||
inst_script "$moddir/dracut-cmdline-ask.sh" /bin/dracut-cmdline-ask
|
||||
inst_script "$moddir/dracut-pre-udev.sh" /bin/dracut-pre-udev
|
||||
inst_script "$moddir/dracut-pre-trigger.sh" /bin/dracut-pre-trigger
|
||||
inst_script "$moddir/dracut-initqueue.sh" /bin/dracut-initqueue
|
||||
inst_script "$moddir/dracut-pre-mount.sh" /bin/dracut-pre-mount
|
||||
inst_script "$moddir/dracut-mount.sh" /bin/dracut-mount
|
||||
inst_script "$moddir/dracut-pre-pivot.sh" /bin/dracut-pre-pivot
|
||||
|
||||
inst_script "$moddir/rootfs-generator.sh" $systemdutildir/system-generators/dracut-rootfs-generator
|
||||
|
||||
inst_binary true
|
||||
ln_r $(type -P true) "/usr/bin/loginctl"
|
||||
ln_r $(type -P true) "/bin/loginctl"
|
||||
@@ -226,8 +198,7 @@ install() {
|
||||
|
||||
for i in \
|
||||
emergency.target \
|
||||
dracut-emergency.service \
|
||||
rescue.service \
|
||||
rescue.target \
|
||||
systemd-ask-password-console.service \
|
||||
systemd-ask-password-plymouth.service \
|
||||
; do
|
||||
@@ -236,32 +207,14 @@ install() {
|
||||
"${systemdsystemunitdir}/${i}.wants/systemd-vconsole-setup.service"
|
||||
done
|
||||
|
||||
mkdir -p "${initdir}/$systemdsystemunitdir/initrd.target.wants"
|
||||
for i in \
|
||||
dracut-cmdline.service \
|
||||
dracut-cmdline-ask.service \
|
||||
dracut-initqueue.service \
|
||||
dracut-mount.service \
|
||||
dracut-pre-mount.service \
|
||||
dracut-pre-pivot.service \
|
||||
dracut-pre-trigger.service \
|
||||
dracut-pre-udev.service \
|
||||
; do
|
||||
inst_simple "$moddir/${i}" "$systemdsystemunitdir/${i}"
|
||||
ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/initrd.target.wants/${i}"
|
||||
done
|
||||
|
||||
inst_simple "$moddir/dracut-tmpfiles.conf" "$tmpfilesdir/dracut-tmpfiles.conf"
|
||||
|
||||
|
||||
mkdir -p "$initdir/etc/systemd"
|
||||
# We must use a volatile journal, and we don't want rate-limiting
|
||||
# turn off RateLimit for journal
|
||||
{
|
||||
echo "[Journal]"
|
||||
echo "Storage=volatile"
|
||||
echo "RateLimitInterval=0"
|
||||
echo "RateLimitBurst=0"
|
||||
} >> "$initdir/etc/systemd/journald.conf"
|
||||
|
||||
ln_r "${systemdsystemunitdir}/multi-user.target" "${systemdsystemunitdir}/default.target"
|
||||
}
|
||||
|
@@ -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()
|
||||
{
|
||||
@@ -61,8 +59,8 @@ do_rhevh_check()
|
||||
kpath=${1}
|
||||
|
||||
# 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)
|
||||
HMAC_SUM_ORIG=$(cat $NEWROOT/boot/.vmlinuz-${KERNEL}.hmac | while read a b || [ -n "$a" ]; do printf "%s\n" $a; done)
|
||||
HMAC_SUM_CALC=$(sha512hmac $kpath | while read a b || [ -n "$a" ]; do printf "%s\n" $a; done || return 1)
|
||||
if [ -z "$HMAC_SUM_ORIG" ] || [ -z "$HMAC_SUM_CALC" ] || [ "${HMAC_SUM_ORIG}" != "${HMAC_SUM_CALC}" ]; then
|
||||
warn "HMAC sum mismatch"
|
||||
return 1
|
||||
@@ -94,9 +92,9 @@ do_fips()
|
||||
if ! modprobe "${_module}"; then
|
||||
# check if kernel provides generic algo
|
||||
_found=0
|
||||
while read _k _s _v; do
|
||||
while read _k _s _v || [ -n "$_k" ]; do
|
||||
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
|
||||
[ "$_v" != "$_module" ] && [ "crypto-$_v" != "$_module" ] && continue
|
||||
[ "$_v" != "$_module" ] && continue
|
||||
_found=1
|
||||
break
|
||||
done </proc/crypto
|
||||
|
@@ -1,43 +1,36 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
local _fipsmodules _mod i
|
||||
|
||||
if [[ -f "${srcmods}/modules.fips" ]]; then
|
||||
_fipsmodules="$(cat "${srcmods}/modules.fips")"
|
||||
else
|
||||
_fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 blowfish camellia cast6 cbc ccm "
|
||||
_fipsmodules+="chainiv crc32c crct10dif_generic cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod drbg "
|
||||
_fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 "
|
||||
_fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic "
|
||||
_fipsmodules+="aes_s390 des_s390 prng sha256_s390 sha_common des_check_key sha1_s390 sha512_s390 "
|
||||
_fipsmodules+="sha384 sha512 sha512_generic tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib cmac authenc "
|
||||
fi
|
||||
local _fipsmodules _mod
|
||||
_fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 blowfish camellia cast6 cbc ccm "
|
||||
_fipsmodules+="chainiv crc32c crct10dif_generic cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod drbg "
|
||||
_fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 "
|
||||
_fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic "
|
||||
_fipsmodules+="sha384 sha512 sha512_generic tcrypt tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib"
|
||||
_fipsmodules+="aes_s390 des_s390 prng sha256_s390 sha_common des_check_key ghash_s390 sha1_s390 sha512_s390"
|
||||
|
||||
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
|
||||
|
||||
for _mod in $_fipsmodules tcrypt; do
|
||||
for _mod in $_fipsmodules; do
|
||||
if hostonly='' instmods -c -s $_mod; then
|
||||
echo $_mod >> "${initdir}/etc/fipsmodules"
|
||||
echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
|
||||
for i in $(modprobe --resolve-alias $_mod 2>/dev/null); do
|
||||
[[ $i == $_mod ]] && continue
|
||||
echo "blacklist $i" >> "${initdir}/etc/modprobe.d/fips.conf"
|
||||
done
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _dir
|
||||
inst_hook pre-trigger 01 "$moddir/fips-boot.sh"
|
||||
|
68
modules.d/01systemd-initrd/module-setup.sh
Executable file
68
modules.d/01systemd-initrd/module-setup.sh
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
[[ $mount_needs ]] && return 1
|
||||
|
||||
if ! dracut_module_included "systemd"; then
|
||||
derror "dracut-systemd needs systemd in the initramfs"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo "systemd"
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _mods
|
||||
|
||||
inst_multiple -o \
|
||||
$systemdsystemunitdir/initrd.target \
|
||||
$systemdsystemunitdir/initrd-fs.target \
|
||||
$systemdsystemunitdir/initrd-root-fs.target \
|
||||
$systemdsystemunitdir/initrd-switch-root.target \
|
||||
$systemdsystemunitdir/initrd-switch-root.service \
|
||||
$systemdsystemunitdir/initrd-cleanup.service \
|
||||
$systemdsystemunitdir/initrd-udevadm-cleanup-db.service \
|
||||
$systemdsystemunitdir/initrd-parse-etc.service
|
||||
|
||||
ln_r "${systemdsystemunitdir}/initrd.target" "${systemdsystemunitdir}/default.target"
|
||||
|
||||
if [ -e /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
VERSION+=" "
|
||||
PRETTY_NAME+=" "
|
||||
else
|
||||
VERSION=""
|
||||
PRETTY_NAME=""
|
||||
fi
|
||||
NAME=dracut
|
||||
ID=dracut
|
||||
VERSION+="dracut-$DRACUT_VERSION"
|
||||
PRETTY_NAME+="dracut-$DRACUT_VERSION (Initramfs)"
|
||||
VERSION_ID=$DRACUT_VERSION
|
||||
ANSI_COLOR="0;34"
|
||||
|
||||
{
|
||||
echo NAME=\"$NAME\"
|
||||
echo VERSION=\"$VERSION\"
|
||||
echo ID=$ID
|
||||
echo VERSION_ID=$VERSION_ID
|
||||
echo PRETTY_NAME=\"$PRETTY_NAME\"
|
||||
echo ANSI_COLOR=\"$ANSI_COLOR\"
|
||||
} > $initdir/usr/lib/initrd-release
|
||||
echo dracut-$DRACUT_VERSION > $initdir/lib/dracut/dracut-$DRACUT_VERSION
|
||||
ln -sf ../usr/lib/initrd-release $initdir/etc/initrd-release
|
||||
ln -sf initrd-release $initdir/usr/lib/os-release
|
||||
ln -sf initrd-release $initdir/etc/os-release
|
||||
}
|
||||
|
@@ -1,12 +1,10 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
capsmode=$(getarg rd.caps)
|
||||
|
||||
if [ "$capsmode" = "1" ]; then
|
||||
CAPS_INIT_DROP=$(getarg rd.caps.initdrop=)
|
||||
CAPS_USERMODEHELPER_BSET=$(capsh --drop="$CAPS_INIT_DROP" -- -c 'while read a b ; do [ "$a" = "CapBnd:" ] && echo $((0x${b:$((${#b}-8)):8})) $((0x${b:$((${#b}-16)):8})) && break; done < /proc/self/status')
|
||||
CAPS_USERMODEHELPER_BSET=$(capsh --drop="$CAPS_INIT_DROP" -- -c 'while read a b || [ -n "$a" ]; do [ "$a" = "CapBnd:" ] && echo $((0x${b:$((${#b}-8)):8})) $((0x${b:$((${#b}-16)):8})) && break; done < /proc/self/status')
|
||||
CAPS_MODULES_DISABLED=$(getarg rd.caps.disablemodules=)
|
||||
CAPS_KEXEC_DISABLED=$(getarg rd.caps.disablekexec=)
|
||||
|
||||
|
@@ -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() {
|
||||
require_binaries capsh
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook pre-pivot 00 "$moddir/caps.sh"
|
||||
|
@@ -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
|
||||
}
|
||||
|
71
modules.d/02systemd-networkd/module-setup.sh
Executable file
71
modules.d/02systemd-networkd/module-setup.sh
Executable file
@@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
[[ $mount_needs ]] && return 1
|
||||
|
||||
if ! dracut_module_included "systemd"; then
|
||||
derror "dracut-systemd needs systemd in the initramfs"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo "systemd kernel-network-modules"
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple -o \
|
||||
$systemdutildir/systemd-networkd \
|
||||
$systemdutildir/systemd-networkd-wait-online \
|
||||
$systemdsystemunitdir/systemd-networkd-wait-online.service \
|
||||
$systemdsystemunitdir/systemd-networkd.service \
|
||||
$systemdsystemunitdir/systemd-networkd.socket \
|
||||
$systemdutildir/network/99-default.link \
|
||||
networkctl ip
|
||||
|
||||
#hostnamectl timedatectl
|
||||
# $systemdutildir/systemd-timesyncd \
|
||||
# $systemdutildir/systemd-timedated \
|
||||
# $systemdutildir/systemd-hostnamed \
|
||||
# $systemdutildir/systemd-resolvd \
|
||||
# $systemdutildir/systemd-resolve-host \
|
||||
# $systemdsystemunitdir/systemd-resolved.service \
|
||||
# $systemdsystemunitdir/systemd-hostnamed.service \
|
||||
# $systemdsystemunitdir/systemd-timesyncd.service \
|
||||
# $systemdsystemunitdir/systemd-timedated.service \
|
||||
# $systemdsystemunitdir/time-sync.target \
|
||||
# /etc/systemd/resolved.conf \
|
||||
|
||||
|
||||
# inst_dir /var/lib/systemd/clock
|
||||
|
||||
egrep '^systemd-network:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
egrep '^systemd-network:' /etc/group >> "$initdir/etc/group"
|
||||
# egrep '^systemd-timesync:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
# egrep '^systemd-timesync:' /etc/group >> "$initdir/etc/group"
|
||||
|
||||
_arch=$(uname -m)
|
||||
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
|
||||
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*" \
|
||||
{"tls/$_arch/",tls/,"$_arch/",}"libnss_myhostname.so.*" \
|
||||
{"tls/$_arch/",tls/,"$_arch/",}"libnss_resolve.so.*"
|
||||
|
||||
for i in \
|
||||
systemd-networkd-wait-online.service \
|
||||
systemd-networkd.service \
|
||||
systemd-networkd.socket
|
||||
# systemd-timesyncd.service
|
||||
do
|
||||
systemctl --root "$initdir" enable "$i"
|
||||
done
|
||||
}
|
||||
|
@@ -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
|
||||
#
|
||||
|
@@ -1,12 +1,11 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Licensed under the GPLv2
|
||||
#
|
||||
# Copyright 2013 Red Hat, Inc.
|
||||
# Peter Jones <pjones@redhat.com>
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
require_binaries keyctl || return 1
|
||||
|
||||
@@ -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,78 +1,29 @@
|
||||
#!/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() {
|
||||
# Do not add watchdog hooks if systemd module is included
|
||||
# In that case, systemd will manage watchdog kick
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook cmdline 00 "$moddir/watchdog.sh"
|
||||
inst_hook cmdline 50 "$moddir/watchdog.sh"
|
||||
inst_hook pre-trigger 00 "$moddir/watchdog.sh"
|
||||
inst_hook initqueue 00 "$moddir/watchdog.sh"
|
||||
inst_hook mount 00 "$moddir/watchdog.sh"
|
||||
inst_hook mount 50 "$moddir/watchdog.sh"
|
||||
inst_hook mount 99 "$moddir/watchdog.sh"
|
||||
inst_hook pre-pivot 00 "$moddir/watchdog.sh"
|
||||
inst_hook pre-pivot 99 "$moddir/watchdog.sh"
|
||||
inst_hook cleanup 00 "$moddir/watchdog.sh"
|
||||
inst_hook cleanup 99 "$moddir/watchdog.sh"
|
||||
fi
|
||||
inst_hook cmdline 00 "$moddir/watchdog.sh"
|
||||
inst_hook cmdline 50 "$moddir/watchdog.sh"
|
||||
inst_hook pre-trigger 00 "$moddir/watchdog.sh"
|
||||
inst_hook initqueue 00 "$moddir/watchdog.sh"
|
||||
inst_hook mount 00 "$moddir/watchdog.sh"
|
||||
inst_hook mount 50 "$moddir/watchdog.sh"
|
||||
inst_hook mount 99 "$moddir/watchdog.sh"
|
||||
inst_hook pre-pivot 00 "$moddir/watchdog.sh"
|
||||
inst_hook pre-pivot 99 "$moddir/watchdog.sh"
|
||||
inst_hook cleanup 00 "$moddir/watchdog.sh"
|
||||
inst_hook cleanup 99 "$moddir/watchdog.sh"
|
||||
inst_hook emergency 02 "$moddir/watchdog-stop.sh"
|
||||
inst_multiple -o wdctl
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
local -A _drivers
|
||||
local _alldrivers _active _wdtdrv _wdtppath _dir
|
||||
[[ -d /sys/class/watchdog/ ]] || return
|
||||
for _dir in /sys/class/watchdog/*; do
|
||||
[[ -d "$_dir" ]] || continue
|
||||
[[ -f "$_dir/state" ]] || continue
|
||||
_active=$(< "$_dir/state")
|
||||
! [[ $hostonly ]] || [[ "$_active" = "active" ]] || continue
|
||||
# device/modalias will return driver of this device
|
||||
_wdtdrv=$(< "$_dir/device/modalias")
|
||||
# There can be more than one module represented by same
|
||||
# modalias. Currently load all of them.
|
||||
# TODO: Need to find a way to avoid any unwanted module
|
||||
# represented by modalias
|
||||
_wdtdrv=$(modprobe --set-version "$kernel" -R $_wdtdrv 2>/dev/null)
|
||||
if [[ $_wdtdrv ]]; then
|
||||
instmods $_wdtdrv
|
||||
for i in $_wdtdrv; do
|
||||
_drivers[$i]=1
|
||||
done
|
||||
fi
|
||||
# however in some cases, we also need to check that if there is
|
||||
# a specific driver for the parent bus/device. In such cases
|
||||
# we also need to enable driver for parent bus/device.
|
||||
_wdtppath=$(readlink -f "$_dir/device")
|
||||
while [[ -d "$_wdtppath" ]] && [[ "$_wdtppath" != "/sys" ]]; do
|
||||
_wdtppath=$(readlink -f "$_wdtppath/..")
|
||||
[[ -f "$_wdtppath/modalias" ]] || continue
|
||||
|
||||
_wdtdrv=$(< "$_wdtppath/modalias")
|
||||
_wdtdrv=$(modprobe --set-version "$kernel" -R $_wdtdrv 2>/dev/null)
|
||||
if [[ $_wdtdrv ]]; then
|
||||
instmods $_wdtdrv
|
||||
for i in $_wdtdrv; do
|
||||
_drivers[$i]=1
|
||||
done
|
||||
fi
|
||||
done
|
||||
done
|
||||
# ensure that watchdog module is loaded as early as possible
|
||||
_alldrivers="${!_drivers[*]}"
|
||||
[[ $_alldrivers ]] && echo "rd.driver.pre=${_alldrivers// /,}" > ${initdir}/etc/cmdline.d/00-watchdog.conf
|
||||
|
||||
return 0
|
||||
}
|
||||
|
@@ -1,2 +1,2 @@
|
||||
#!/bin/sh
|
||||
[ -c /dev/watchdog ] && printf 'V' > /dev/watchdog
|
||||
[ -c /dev/watchdog ] && echo -n 'V' > /dev/watchdog
|
||||
|
@@ -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() {
|
||||
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,7 +1,6 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
|
||||
@@ -10,10 +9,12 @@ check() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
if dracut_module_included "systemd"; then
|
||||
unset FONT
|
||||
@@ -39,7 +40,7 @@ install() {
|
||||
*) cmd=grep ;;
|
||||
esac
|
||||
|
||||
for INCL in $($cmd "^include " $MAP | while read a a b; do echo ${a//\"/}; done); do
|
||||
for INCL in $($cmd "^include " $MAP | while read a a b || [ -n "$a" ]; do echo ${a//\"/}; done); do
|
||||
for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
|
||||
findkeymap $FN
|
||||
done
|
||||
@@ -113,12 +114,12 @@ install() {
|
||||
rm -f -- "${initdir}${kbddir}/consoletrans/utflist"
|
||||
find "${initdir}${kbddir}/" -name README\* -delete
|
||||
find "${initdir}${kbddir}/" -name '*.gz' -print -quit \
|
||||
| while read line; do
|
||||
| while read line || [ -n "$line" ]; do
|
||||
inst_multiple gzip
|
||||
done
|
||||
|
||||
find "${initdir}${kbddir}/" -name '*.bz2' -print -quit \
|
||||
| while read line; do
|
||||
| while read line || [ -n "$line" ]; do
|
||||
inst_multiple bzip2
|
||||
done
|
||||
}
|
||||
@@ -152,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
|
||||
|
||||
|
@@ -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"
|
||||
|
||||
@@ -76,7 +74,7 @@ rm -f -- "$testfile"
|
||||
find_mount() {
|
||||
local dev mnt etc wanted_dev
|
||||
wanted_dev="$(readlink -e -q $1)"
|
||||
while read dev mnt etc; do
|
||||
while read dev mnt etc || [ -n "$dev" ]; do
|
||||
[ "$dev" = "$wanted_dev" ] && echo "$dev" && return 0
|
||||
done < /proc/mounts
|
||||
return 1
|
||||
@@ -95,7 +93,7 @@ else
|
||||
return 1
|
||||
fi
|
||||
|
||||
while read a m a; do
|
||||
while read a m a || [ -n "$m" ]; do
|
||||
[ "$m" = "$1" ] && return 0
|
||||
done < /proc/mounts
|
||||
return 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,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
|
||||
|
||||
@@ -10,6 +8,9 @@ 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
|
||||
mtu=$new_interface_mtu
|
||||
@@ -20,11 +21,7 @@ setup_interface() {
|
||||
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
|
||||
lease_time=$new_dhcp_lease_time
|
||||
|
||||
[ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override
|
||||
|
||||
@@ -42,9 +39,9 @@ setup_interface() {
|
||||
fi
|
||||
fi
|
||||
|
||||
ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif \
|
||||
${lease_time:+valid_lft $lease_time} \
|
||||
${preferred_lft:+preferred_lft ${preferred_lft}}
|
||||
ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} \
|
||||
valid_lft ${lease_time} preferred_lft ${lease_time} \
|
||||
dev $netif
|
||||
|
||||
if [ -n "$gw" ] ; then
|
||||
if [ "$mask" == "255.255.255.255" ] ; then
|
||||
@@ -95,51 +92,6 @@ setup_interface6() {
|
||||
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
}
|
||||
|
||||
function parse_option_121() {
|
||||
while [ $# -ne 0 ]; do
|
||||
mask="$1"
|
||||
shift
|
||||
|
||||
# Is the destination a multicast group?
|
||||
if [ $1 -ge 224 -a $1 -lt 240 ]; then
|
||||
multicast=1
|
||||
else
|
||||
multicast=0
|
||||
fi
|
||||
|
||||
# Parse the arguments into a CIDR net/mask string
|
||||
if [ $mask -gt 24 ]; then
|
||||
destination="$1.$2.$3.$4/$mask"
|
||||
shift; shift; shift; shift
|
||||
elif [ $mask -gt 16 ]; then
|
||||
destination="$1.$2.$3.0/$mask"
|
||||
shift; shift; shift
|
||||
elif [ $mask -gt 8 ]; then
|
||||
destination="$1.$2.0.0/$mask"
|
||||
shift; shift
|
||||
else
|
||||
destination="$1.0.0.0/$mask"
|
||||
shift
|
||||
fi
|
||||
|
||||
# Read the gateway
|
||||
gateway="$1.$2.$3.$4"
|
||||
shift; shift; shift; shift
|
||||
|
||||
# Multicast routing on Linux
|
||||
# - If you set a next-hop address for a multicast group, this breaks with Cisco switches
|
||||
# - If you simply leave it link-local and attach it to an interface, it works fine.
|
||||
if [ $multicast -eq 1 ]; then
|
||||
temp_result="$destination dev $interface"
|
||||
else
|
||||
temp_result="$destination via $gateway dev $interface"
|
||||
fi
|
||||
|
||||
echo "/sbin/ip route add $temp_result"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
case $reason in
|
||||
PREINIT)
|
||||
echo "dhcp: PREINIT $netif up"
|
||||
@@ -149,7 +101,7 @@ case $reason in
|
||||
PREINIT6)
|
||||
echo "dhcp: PREINIT6 $netif up"
|
||||
linkup $netif
|
||||
wait_for_ipv6_dad_link $netif
|
||||
wait_for_ipv6_dad $netif
|
||||
;;
|
||||
|
||||
BOUND)
|
||||
@@ -159,14 +111,14 @@ case $reason in
|
||||
read layer2 < /sys/class/net/$netif/device/layer2
|
||||
fi
|
||||
if [ "$layer2" != "0" ]; then
|
||||
if ! arping -f -q -D -c 2 -I $netif $new_ip_address ; then
|
||||
if ! arping -q -D -c 2 -I $netif $new_ip_address ; then
|
||||
warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
unset layer2
|
||||
setup_interface
|
||||
set | while read line; do
|
||||
set | while read line || [ -n "$line" ]; do
|
||||
[ "${line#new_}" = "$line" ] && continue
|
||||
echo "$line"
|
||||
done >/tmp/dhclient.$netif.dhcpopts
|
||||
@@ -174,9 +126,6 @@ case $reason in
|
||||
{
|
||||
echo '. /lib/net-lib.sh'
|
||||
echo "setup_net $netif"
|
||||
if [ -n "$new_classless_static_routes" ]; then
|
||||
parse_option_121 $new_classless_static_routes
|
||||
fi
|
||||
echo "source_hook initqueue/online $netif"
|
||||
[ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
|
||||
echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh"
|
||||
@@ -184,28 +133,13 @@ case $reason in
|
||||
|
||||
echo "[ -f /tmp/net.$netif.did-setup ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
|
||||
>/tmp/net.$netif.up
|
||||
if [ -e /sys/class/net/${netif}/address ]; then
|
||||
> /tmp/net.$(cat /sys/class/net/${netif}/address).up
|
||||
fi
|
||||
|
||||
;;
|
||||
|
||||
RENEW|REBIND)
|
||||
unset lease_time
|
||||
[ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
|
||||
[ -n "$new_max_life" ] && lease_time=$new_max_life
|
||||
preferred_lft=$lease_time
|
||||
[ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
|
||||
ip -4 addr change ${new_ip_address}/${new_subnet_mask} broadcast ${new_broadcast_address} dev ${interface} \
|
||||
${lease_time:+valid_lft $lease_time} ${preferred_lft:+preferred_lft ${preferred_lft}} \
|
||||
>/dev/null 2>&1
|
||||
;;
|
||||
|
||||
BOUND6)
|
||||
echo "dhcp: BOND6 setting $netif"
|
||||
setup_interface6
|
||||
|
||||
set | while read line; do
|
||||
set | while read line || [ -n "$line" ]; do
|
||||
[ "${line#new_}" = "$line" ] && continue
|
||||
echo "$line"
|
||||
done >/tmp/dhclient.$netif.dhcpopts
|
||||
@@ -220,22 +154,7 @@ case $reason in
|
||||
|
||||
echo "[ -f /tmp/net.$netif.did-setup ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
|
||||
>/tmp/net.$netif.up
|
||||
if [ -e /sys/class/net/${netif}/address ]; then
|
||||
> /tmp/net.$(cat /sys/class/net/${netif}/address).up
|
||||
fi
|
||||
;;
|
||||
|
||||
RENEW6|REBIND6)
|
||||
unset lease_time
|
||||
[ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
|
||||
[ -n "$new_max_life" ] && lease_time=$new_max_life
|
||||
preferred_lft=$lease_time
|
||||
[ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
|
||||
ip -6 addr change ${new_ip6_address}/${new_ip6_prefixlen} dev ${interface} scope global \
|
||||
${lease_time:+valid_lft $lease_time} ${preferred_lft:+preferred_lft ${preferred_lft}} \
|
||||
>/dev/null 2>&1
|
||||
;;
|
||||
|
||||
*) echo "dhcp: $reason";;
|
||||
esac
|
||||
|
||||
|
@@ -1,6 +1,3 @@
|
||||
|
||||
option classless-routes code 121 = array of unsigned integer 8;
|
||||
|
||||
request subnet-mask, broadcast-address, time-offset, routers,
|
||||
domain-name, domain-name-servers, domain-search, host-name,
|
||||
root-path, interface-mtu, classless-routes;
|
||||
root-path, interface-mtu;
|
||||
|
@@ -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
|
||||
|
||||
# This script is sourced, so root should be set. But let's be paranoid
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
|
@@ -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
|
||||
@@ -17,12 +15,75 @@ type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
|
||||
# $netif reads easier than $1
|
||||
netif=$1
|
||||
use_bridge='false'
|
||||
use_vlan='false'
|
||||
|
||||
# loopback is always handled the same way
|
||||
if [ "$netif" = "lo" ] ; then
|
||||
ip link set lo up
|
||||
ip addr add 127.0.0.1/8 dev lo
|
||||
exit 0
|
||||
# enslave this interface to bond?
|
||||
for i in /tmp/bond.*.info; do
|
||||
[ -e "$i" ] || continue
|
||||
unset bondslaves
|
||||
unset bondname
|
||||
. "$i"
|
||||
for slave in $bondslaves ; do
|
||||
if [ "$netif" = "$slave" ] ; then
|
||||
netif=$bondname
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
if [ -e /tmp/team.info ]; then
|
||||
. /tmp/team.info
|
||||
for slave in $teamslaves ; do
|
||||
if [ "$netif" = "$slave" ] ; then
|
||||
netif=$teammaster
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -e /tmp/vlan.info ]; then
|
||||
. /tmp/vlan.info
|
||||
if [ "$netif" = "$phydevice" ]; then
|
||||
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
|
||||
: # We need to really setup bond (recursive call)
|
||||
elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then
|
||||
: # We need to really setup team (recursive call)
|
||||
else
|
||||
netif="$vlanname"
|
||||
use_vlan='true'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# bridge this interface?
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
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)
|
||||
elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then
|
||||
: # We need to really setup team (recursive call)
|
||||
elif [ "$netif" = "$vlanname" ] && [ -n "$DO_VLAN_SETUP" ]; then
|
||||
: # We need to really setup vlan (recursive call)
|
||||
else
|
||||
netif="$bridgename"
|
||||
use_bridge='true'
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# disable manual ifup while netroot is set for simplifying our logic
|
||||
# in netroot case we prefer netroot to bringup $netif automaticlly
|
||||
[ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2"
|
||||
[ -z "$netroot" ] && [ -z "$manualup" ] && exit 0
|
||||
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
|
||||
@@ -31,37 +92,15 @@ do_dhcp() {
|
||||
# event for nfsroot
|
||||
# XXX add -V vendor class and option parsing per kernel
|
||||
|
||||
local _COUNT=0
|
||||
local _timeout=$(getargs rd.net.timeout.dhcp=)
|
||||
local _DHCPRETRY=$(getargs rd.net.dhcp.retry=)
|
||||
_DHCPRETRY=${_DHCPRETRY:-1}
|
||||
|
||||
[ -e /tmp/dhclient.$netif.pid ] && return 0
|
||||
|
||||
if ! iface_has_carrier $netif; then
|
||||
warn "No carrier detected on interface $netif"
|
||||
if ! iface_has_link $netif; then
|
||||
echo "No carrier detected"
|
||||
return 1
|
||||
fi
|
||||
|
||||
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
|
||||
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
|
||||
ip -4 addr flush dev $netif
|
||||
|
||||
while [ $_COUNT -lt $_DHCPRETRY ]; do
|
||||
info "Starting dhcp for interface $netif"
|
||||
dhclient "$@" \
|
||||
${_timeout:+-timeout $_timeout} \
|
||||
-q \
|
||||
-cf /etc/dhclient.conf \
|
||||
-pf /tmp/dhclient.$netif.pid \
|
||||
-lf /tmp/dhclient.$netif.lease \
|
||||
$netif \
|
||||
&& return 0
|
||||
_COUNT=$(($_COUNT+1))
|
||||
[ $_COUNT -lt $_DHCPRETRY ] && sleep 1
|
||||
done
|
||||
warn "dhcp for interface $netif failed"
|
||||
return 1
|
||||
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() {
|
||||
@@ -81,8 +120,6 @@ do_ipv6auto() {
|
||||
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
|
||||
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
|
||||
linkup $netif
|
||||
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
|
||||
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
|
||||
wait_for_ipv6_auto $netif
|
||||
|
||||
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
@@ -92,37 +129,17 @@ do_ipv6auto() {
|
||||
|
||||
# Handle static ip configuration
|
||||
do_static() {
|
||||
strstr $ip '*:*:*' && load_ipv6
|
||||
|
||||
if [ -z "$dev" ] && ! iface_has_carrier "$netif"; then
|
||||
warn "No carrier detected on interface $netif"
|
||||
return 1
|
||||
elif ! linkup "$netif"; then
|
||||
warn "Could not bring interface $netif up!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
ip route get "$ip" | {
|
||||
read a rest
|
||||
if [ "$a" = "local" ]; then
|
||||
warn "Not assigning $ip to interface $netif, cause it is already assigned!"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
} || return 1
|
||||
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
|
||||
wait_for_ipv6_dad $netif
|
||||
else
|
||||
if ! arping -f -q -D -c 2 -I $netif $ip; then
|
||||
warn "Duplicate address detected for $ip for interface $netif."
|
||||
return 1
|
||||
fi
|
||||
ip -4 addr flush dev $netif
|
||||
ip addr flush dev $netif
|
||||
ip addr add $ip/$mask ${srv:+peer $srv} brd + dev $netif
|
||||
fi
|
||||
|
||||
@@ -132,6 +149,106 @@ do_static() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# loopback is always handled the same way
|
||||
if [ "$netif" = "lo" ] ; then
|
||||
ip link set lo up
|
||||
ip addr add 127.0.0.1/8 dev lo
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# start bond if needed
|
||||
if [ -e /tmp/bond.${netif}.info ]; then
|
||||
. /tmp/bond.${netif}.info
|
||||
|
||||
if [ "$netif" = "$bondname" ] && [ ! -e /tmp/net.$bondname.up ] ; then # We are master bond device
|
||||
modprobe bonding
|
||||
echo "+$netif" > /sys/class/net/bonding_masters
|
||||
ip link set $netif down
|
||||
|
||||
# Stolen from ifup-eth
|
||||
# add the bits to setup driver parameters here
|
||||
for arg in $bondoptions ; do
|
||||
key=${arg%%=*};
|
||||
value=${arg##*=};
|
||||
# %{value:0:1} is replaced with non-bash specific construct
|
||||
if [ "${key}" = "arp_ip_target" -a "${#value}" != "0" -a "+${value%%+*}" != "+" ]; then
|
||||
OLDIFS=$IFS;
|
||||
IFS=',';
|
||||
for arp_ip in $value; do
|
||||
echo +$arp_ip > /sys/class/net/${netif}/bonding/$key
|
||||
done
|
||||
IFS=$OLDIFS;
|
||||
else
|
||||
echo $value > /sys/class/net/${netif}/bonding/$key
|
||||
fi
|
||||
done
|
||||
|
||||
linkup $netif
|
||||
|
||||
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
|
||||
|
||||
# add the bits to setup the needed post enslavement parameters
|
||||
for arg in $BONDING_OPTS ; do
|
||||
key=${arg%%=*};
|
||||
value=${arg##*=};
|
||||
if [ "${key}" = "primary" ]; then
|
||||
echo $value > /sys/class/net/${netif}/bonding/$key
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e /tmp/team.info ]; then
|
||||
. /tmp/team.info
|
||||
if [ "$netif" = "$teammaster" ] && [ ! -e /tmp/net.$teammaster.up ] ; then
|
||||
# We shall only bring up those _can_ come up
|
||||
# in case of some slave is gone in active-backup mode
|
||||
working_slaves=""
|
||||
for slave in $teamslaves ; do
|
||||
ip link set $slave up 2>/dev/null
|
||||
if wait_for_if_up $slave; then
|
||||
working_slaves+="$slave "
|
||||
fi
|
||||
done
|
||||
# Do not add slaves now
|
||||
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
|
||||
teamdctl $teammaster port add $slave
|
||||
done
|
||||
ip link set $teammaster up
|
||||
fi
|
||||
fi
|
||||
|
||||
# XXX need error handling like dhclient-script
|
||||
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
# start bridge if necessary
|
||||
if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
|
||||
brctl addbr $bridgename
|
||||
brctl setfd $bridgename 0
|
||||
for ethname in $bridgeslaves ; do
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
DO_BOND_SETUP=yes ifup $bondname -m
|
||||
elif [ "$ethname" = "$teammaster" ] ; then
|
||||
DO_TEAM_SETUP=yes ifup $teammaster -m
|
||||
elif [ "$ethname" = "$vlanname" ]; then
|
||||
DO_VLAN_SETUP=yes ifup $vlanname -m
|
||||
else
|
||||
linkup $ethname
|
||||
fi
|
||||
brctl addif $bridgename $ethname
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
get_vid() {
|
||||
case "$1" in
|
||||
vlan*)
|
||||
@@ -143,211 +260,33 @@ get_vid() {
|
||||
esac
|
||||
}
|
||||
|
||||
# check, if we need VLAN's for this interface
|
||||
if [ -z "$DO_VLAN_PHY" ] && [ -e /tmp/vlan.${netif}.phy ]; then
|
||||
unset DO_VLAN
|
||||
NO_AUTO_DHCP=yes DO_VLAN_PHY=yes ifup "$netif"
|
||||
modprobe -b -q 8021q
|
||||
|
||||
for i in /tmp/vlan.*.${netif}; do
|
||||
[ -e "$i" ] || continue
|
||||
read vlanname < "$i"
|
||||
if [ -n "$vlanname" ]; then
|
||||
linkup "$netif"
|
||||
ip link add dev "$vlanname" link "$netif" type vlan id "$(get_vid $vlanname)"
|
||||
ifup "$vlanname"
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check, if interface is VLAN interface
|
||||
if ! [ -e /tmp/vlan.${netif}.phy ]; then
|
||||
for i in /tmp/vlan.${netif}.*; do
|
||||
[ -e "$i" ] || continue
|
||||
export DO_VLAN=yes
|
||||
break
|
||||
done
|
||||
fi
|
||||
|
||||
# bridge this interface?
|
||||
if [ -z "$NO_BRIDGE_MASTER" ]; then
|
||||
for i in /tmp/bridge.*.info; do
|
||||
[ -e "$i" ] || continue
|
||||
unset bridgeslaves
|
||||
unset bridgename
|
||||
. "$i"
|
||||
for ethname in $bridgeslaves ; do
|
||||
[ "$netif" != "$ethname" ] && continue
|
||||
|
||||
NO_BRIDGE_MASTER=yes NO_AUTO_DHCP=yes ifup $ethname
|
||||
linkup $ethname
|
||||
if [ ! -e /tmp/bridge.$bridgename.up ]; then
|
||||
brctl addbr $bridgename
|
||||
brctl setfd $bridgename 0
|
||||
> /tmp/bridge.$bridgename.up
|
||||
fi
|
||||
brctl addif $bridgename $ethname
|
||||
ifup $bridgename
|
||||
exit 0
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
# enslave this interface to bond?
|
||||
if [ -z "$NO_BOND_MASTER" ]; then
|
||||
for i in /tmp/bond.*.info; do
|
||||
[ -e "$i" ] || continue
|
||||
unset bondslaves
|
||||
unset bondname
|
||||
. "$i"
|
||||
for slave in $bondslaves ; do
|
||||
[ "$netif" != "$slave" ] && continue
|
||||
|
||||
# already setup
|
||||
[ -e /tmp/bond.$bondname.up ] && exit 0
|
||||
|
||||
# wait for all slaves to show up
|
||||
for slave in $bondslaves ; do
|
||||
# try to create the slave (maybe vlan or bridge)
|
||||
NO_BOND_MASTER=yes NO_AUTO_DHCP=yes ifup $slave
|
||||
|
||||
if ! ip link show dev $slave >/dev/null 2>&1; then
|
||||
# wait for the last slave to show up
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
modprobe -q -b bonding
|
||||
echo "+$bondname" > /sys/class/net/bonding_masters 2>/dev/null
|
||||
ip link set $bondname down
|
||||
|
||||
# Stolen from ifup-eth
|
||||
# add the bits to setup driver parameters here
|
||||
for arg in $bondoptions ; do
|
||||
key=${arg%%=*};
|
||||
value=${arg##*=};
|
||||
# %{value:0:1} is replaced with non-bash specific construct
|
||||
if [ "${key}" = "arp_ip_target" -a "${#value}" != "0" -a "+${value%%+*}" != "+" ]; then
|
||||
OLDIFS=$IFS;
|
||||
IFS=',';
|
||||
for arp_ip in $value; do
|
||||
echo +$arp_ip > /sys/class/net/${bondname}/bonding/$key
|
||||
done
|
||||
IFS=$OLDIFS;
|
||||
else
|
||||
echo $value > /sys/class/net/${bondname}/bonding/$key
|
||||
fi
|
||||
done
|
||||
|
||||
linkup $bondname
|
||||
|
||||
for slave in $bondslaves ; do
|
||||
cat /sys/class/net/$slave/address > /tmp/net.${bondname}.${slave}.hwaddr
|
||||
ip link set $slave down
|
||||
echo "+$slave" > /sys/class/net/$bondname/bonding/slaves
|
||||
linkup $slave
|
||||
done
|
||||
|
||||
# add the bits to setup the needed post enslavement parameters
|
||||
for arg in $bondoptions ; do
|
||||
key=${arg%%=*};
|
||||
value=${arg##*=};
|
||||
if [ "${key}" = "primary" ]; then
|
||||
echo $value > /sys/class/net/${bondname}/bonding/$key
|
||||
fi
|
||||
done
|
||||
|
||||
> /tmp/bond.$bondname.up
|
||||
|
||||
NO_BOND_MASTER=yes ifup $bondname
|
||||
exit $?
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -z "$NO_TEAM_MASTER" ]; then
|
||||
for i in /tmp/team.*.info; do
|
||||
[ -e "$i" ] || continue
|
||||
unset teammaster
|
||||
unset teamslaves
|
||||
. "$i"
|
||||
for slave in $teamslaves ; do
|
||||
[ "$netif" != "$slave" ] && continue
|
||||
|
||||
[ -e /tmp/team.$teammaster.up ] && exit 0
|
||||
|
||||
# wait for all slaves to show up
|
||||
for slave in $teamslaves ; do
|
||||
# try to create the slave (maybe vlan or bridge)
|
||||
NO_TEAM_MASTER=yes NO_AUTO_DHCP=yes ifup $slave
|
||||
|
||||
if ! ip link show dev $slave >/dev/null 2>&1; then
|
||||
# wait for the last slave to show up
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -e /tmp/team.$teammaster.up ] ; then
|
||||
# We shall only bring up those _can_ come up
|
||||
# in case of some slave is gone in active-backup mode
|
||||
working_slaves=""
|
||||
for slave in $teamslaves ; do
|
||||
ip link set $slave up 2>/dev/null
|
||||
if wait_for_if_up $slave; then
|
||||
working_slaves="$working_slaves$slave "
|
||||
fi
|
||||
done
|
||||
# Do not add slaves now
|
||||
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
|
||||
teamdctl $teammaster port add $slave
|
||||
done
|
||||
|
||||
ip link set $teammaster up
|
||||
|
||||
> /tmp/team.$teammaster.up
|
||||
NO_TEAM_MASTER=yes ifup $teammaster
|
||||
exit $?
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
# all synthetic interfaces done.. now check if the interface is available
|
||||
if ! ip link show dev $netif >/dev/null 2>&1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# disable manual ifup while netroot is set for simplifying our logic
|
||||
# in netroot case we prefer netroot to bringup $netif automaticlly
|
||||
[ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2"
|
||||
|
||||
if [ -n "$manualup" ]; then
|
||||
>/tmp/net.$netif.manualup
|
||||
rm -f /tmp/net.${netif}.did-setup
|
||||
else
|
||||
[ -e /tmp/net.${netif}.did-setup ] && exit 0
|
||||
[ -z "$DO_VLAN" ] && \
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
[ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && exit 0
|
||||
if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
|
||||
modprobe 8021q
|
||||
if [ "$phydevice" = "$bondname" ] ; then
|
||||
DO_BOND_SETUP=yes ifup $phydevice -m
|
||||
elif [ "$phydevice" = "$teammaster" ] ; then
|
||||
DO_TEAM_SETUP=yes ifup $phydevice -m
|
||||
else
|
||||
linkup "$phydevice"
|
||||
fi
|
||||
ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname)"
|
||||
ip link set "$vlanname" up
|
||||
fi
|
||||
|
||||
# No ip lines default to dhcp
|
||||
ip=$(getarg ip)
|
||||
|
||||
if [ -z "$NO_AUTO_DHCP" ] && [ -z "$ip" ]; then
|
||||
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
|
||||
do_dhcp -4
|
||||
fi
|
||||
for s in $(getargs nameserver); do
|
||||
[ -n "$s" ] || continue
|
||||
echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
@@ -374,8 +313,14 @@ 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 mtu dns1 dns2; do
|
||||
for i in ip srv gw mask hostname macaddr dns1 dns2; do
|
||||
eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
|
||||
done > /tmp/net.$netif.override
|
||||
|
||||
@@ -392,36 +337,24 @@ for p in $(getargs ip=); do
|
||||
do_static ;;
|
||||
esac
|
||||
done
|
||||
ret=$?
|
||||
|
||||
# setup nameserver
|
||||
for s in "$dns1" "$dns2" $(getargs nameserver); do
|
||||
[ -n "$s" ] || continue
|
||||
echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
||||
done
|
||||
> /tmp/net.${netif}.up
|
||||
|
||||
if [ $ret -eq 0 ]; then
|
||||
> /tmp/net.${netif}.up
|
||||
|
||||
if [ -z "$DO_VLAN" ] && [ -e /sys/class/net/${netif}/address ]; then
|
||||
> /tmp/net.$(cat /sys/class/net/${netif}/address).up
|
||||
fi
|
||||
|
||||
case $autoconf in
|
||||
dhcp|on|any|dhcp6)
|
||||
case $autoconf in
|
||||
dhcp|on|any|dhcp6)
|
||||
;;
|
||||
*)
|
||||
if [ $ret -eq 0 ]; then
|
||||
setup_net $netif
|
||||
source_hook initqueue/online $netif
|
||||
if [ -z "$manualup" ]; then
|
||||
/sbin/netroot $netif
|
||||
fi
|
||||
*)
|
||||
if [ $? -eq 0 ]; then
|
||||
setup_net $netif
|
||||
source_hook initqueue/online $netif
|
||||
if [ -z "$manualup" ]; then
|
||||
/sbin/netroot $netif
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
exit $ret
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
done
|
||||
|
||||
# netif isn't the top stack? Then we should exit here.
|
||||
@@ -432,21 +365,12 @@ if [ -n "$DO_BOND_SETUP" -o -n "$DO_TEAM_SETUP" -o -n "$DO_VLAN_SETUP" ]; then
|
||||
fi
|
||||
|
||||
# no ip option directed at our interface?
|
||||
if [ -z "$NO_AUTO_DHCP" ] && [ ! -e /tmp/net.${netif}.up ]; then
|
||||
if [ -e /tmp/net.bootdev ]; then
|
||||
BOOTDEV=$(cat /tmp/net.bootdev)
|
||||
if [ "$netif" = "$BOOTDEV" ] || [ "$BOOTDEV" = "$(cat /sys/class/net/${netif}/address)" ]; then
|
||||
load_ipv6
|
||||
do_dhcp
|
||||
fi
|
||||
if [ ! -e /tmp/net.${netif}.up ]; then
|
||||
if getargs 'ip=dhcp6'; then
|
||||
load_ipv6
|
||||
do_dhcp -6
|
||||
else
|
||||
if getargs 'ip=dhcp6'; then
|
||||
load_ipv6
|
||||
do_dhcp -6
|
||||
fi
|
||||
if getargs 'ip=dhcp'; then
|
||||
do_dhcp -4
|
||||
fi
|
||||
do_dhcp -4
|
||||
fi
|
||||
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
|
||||
|
||||
for f in /tmp/dhclient.*.pid; do
|
||||
[ -e $f ] || continue
|
||||
|
@@ -1,7 +1,6 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
local _program
|
||||
|
||||
@@ -10,66 +9,21 @@ check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo "kernel-network-modules"
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
# Include wired net drivers, excluding wireless
|
||||
|
||||
net_module_filter() {
|
||||
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
|
||||
function nmf1() {
|
||||
local _fname _fcont
|
||||
while read _fname; do
|
||||
[[ $_fname =~ $_unwanted_drivers ]] && continue
|
||||
case "$_fname" in
|
||||
*.ko) _fcont="$(< $_fname)" ;;
|
||||
*.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
|
||||
*.ko.xz) _fcont="$(xz -dc $_fname)" ;;
|
||||
esac
|
||||
[[ $_fcont =~ $_net_drivers
|
||||
&& ! $_fcont =~ iw_handler_get_spy ]] \
|
||||
&& echo "$_fname"
|
||||
done
|
||||
return 0
|
||||
}
|
||||
function rotor() {
|
||||
local _f1 _f2
|
||||
while read _f1; do
|
||||
echo "$_f1"
|
||||
if read _f2; then
|
||||
echo "$_f2" 1>&${_side2}
|
||||
fi
|
||||
done | nmf1 1>&${_merge}
|
||||
return 0
|
||||
}
|
||||
# Use two parallel streams to filter alternating modules.
|
||||
set +x
|
||||
eval "( ( rotor ) ${_side2}>&1 | nmf1 ) ${_merge}>&1"
|
||||
[[ $debug ]] && set -x
|
||||
return 0
|
||||
}
|
||||
|
||||
{ find_kernel_modules_by_path drivers/net; if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then find_kernel_modules_by_path drivers/s390/net; fi; } \
|
||||
| net_module_filter | instmods
|
||||
|
||||
#instmods() will take care of hostonly
|
||||
instmods \
|
||||
=drivers/net/phy \
|
||||
=drivers/net/team \
|
||||
=drivers/net/ethernet \
|
||||
ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net
|
||||
hostonly="" instmods iscsi_ibft crc32c iscsi_boot_sysfs
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _arch _i _dir
|
||||
inst_multiple ip arping dhclient sed awk
|
||||
inst_multiple ip arping dhclient sed
|
||||
inst_multiple -o ping ping6
|
||||
inst_multiple -o brctl
|
||||
inst_multiple -o teamd teamdctl teamnl
|
||||
@@ -78,7 +32,8 @@ 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"
|
||||
@@ -91,46 +46,6 @@ install() {
|
||||
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
|
||||
inst_hook cleanup 10 "$moddir/kill-dhclient.sh"
|
||||
|
||||
# Special network nameing for idrac USB devs
|
||||
inst_rules 73-idrac.rules
|
||||
|
||||
# install all config files for teaming
|
||||
unset TEAM_MASTER
|
||||
unset TEAM_CONFIG
|
||||
unset TEAM_PORT_CONFIG
|
||||
unset HWADDR
|
||||
unset SUBCHANNELS
|
||||
for i in /etc/sysconfig/network-scripts/ifcfg-*; do
|
||||
[ -e "$i" ] || continue
|
||||
case "$i" in
|
||||
*~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
(
|
||||
. "$i"
|
||||
if ! [ "${ONBOOT}" = "no" -o "${ONBOOT}" = "NO" ] \
|
||||
&& [ -n "${TEAM_MASTER}${TEAM_CONFIG}${TEAM_PORT_CONFIG}" ]; then
|
||||
if [ -n "$TEAM_CONFIG" ] && [ -n "$DEVICE" ]; then
|
||||
mkdir -p $initdir/etc/teamd
|
||||
printf -- "%s" "$TEAM_CONFIG" > "$initdir/etc/teamd/${DEVICE}.conf"
|
||||
elif [ -n "$TEAM_PORT_CONFIG" ]; then
|
||||
inst_simple "$i"
|
||||
|
||||
HWADDR="$(echo $HWADDR | sed 'y/ABCDEF/abcdef/')"
|
||||
if [ -n "$HWADDR" ]; then
|
||||
ln_r "$i" "/etc/sysconfig/network-scripts/mac-${HWADDR}.conf"
|
||||
fi
|
||||
|
||||
SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
|
||||
if [ -n "$SUBCHANNELS" ]; then
|
||||
ln_r "$i" "/etc/sysconfig/network-scripts/ccw-${SUBCHANNELS}.conf"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
)
|
||||
done
|
||||
|
||||
_arch=$(uname -m)
|
||||
|
||||
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
|
||||
|
@@ -12,14 +12,11 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
# Write udev rules
|
||||
{
|
||||
# bridge: attempt only the defined interface
|
||||
for i in /tmp/bridge.*.info; do
|
||||
[ -e "$i" ] || continue
|
||||
unset bridgeslaves
|
||||
unset bridgename
|
||||
. "$i"
|
||||
RAW_IFACES="$RAW_IFACES $bridgeslaves"
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
IFACES="$IFACES ${bridgeslaves%% *}"
|
||||
MASTER_IFACES="$MASTER_IFACES $bridgename"
|
||||
done
|
||||
fi
|
||||
|
||||
# bond: attempt only the defined interface (override bridge defines)
|
||||
for i in /tmp/bond.*.info; do
|
||||
@@ -28,34 +25,21 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
unset bondname
|
||||
. "$i"
|
||||
# It is enough to fire up only one
|
||||
RAW_IFACES="$RAW_IFACES $bondslaves"
|
||||
IFACES="$IFACES ${bondslaves%% *}"
|
||||
MASTER_IFACES="$MASTER_IFACES ${bondname}"
|
||||
done
|
||||
|
||||
for i in /tmp/team.*.info; do
|
||||
[ -e "$i" ] || continue
|
||||
unset teamslaves
|
||||
unset teammaster
|
||||
. "$i"
|
||||
RAW_IFACES="$RAW_IFACES ${teamslaves}"
|
||||
if [ -e /tmp/team.info ]; then
|
||||
. /tmp/team.info
|
||||
IFACES="$IFACES ${teamslaves}"
|
||||
MASTER_IFACES="$MASTER_IFACES ${teammaster}"
|
||||
done
|
||||
fi
|
||||
|
||||
for j in /tmp/vlan.*.phy; do
|
||||
[ -e "$j" ] || continue
|
||||
unset phydevice
|
||||
read phydevice < "$j"
|
||||
RAW_IFACES="$RAW_IFACES $phydevice"
|
||||
for i in /tmp/vlan.*.${phydevice}; do
|
||||
[ -e "$i" ] || continue
|
||||
unset vlanname
|
||||
read vlanname < "$i"
|
||||
MASTER_IFACES="$MASTER_IFACES ${vlanname}"
|
||||
done
|
||||
done
|
||||
|
||||
MASTER_IFACES="$(trim "$MASTER_IFACES")"
|
||||
RAW_IFACES="$(trim "$RAW_IFACES")"
|
||||
if [ -e /tmp/vlan.info ]; then
|
||||
. /tmp/vlan.info
|
||||
IFACES="$IFACES $phydevice"
|
||||
MASTER_IFACES="$MASTER_IFACES ${vlanname}"
|
||||
fi
|
||||
|
||||
if [ -z "$IFACES" ]; then
|
||||
[ -e /tmp/net.ifaces ] && read IFACES < /tmp/net.ifaces
|
||||
@@ -66,14 +50,15 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
fi
|
||||
|
||||
ifup='/sbin/ifup $env{INTERFACE}'
|
||||
[ -z "$netroot" ] && ifup="$ifup -m"
|
||||
|
||||
runcmd="RUN+=\"/sbin/initqueue --name ifup-\$env{INTERFACE} --unique --onetime $ifup\""
|
||||
|
||||
# We have some specific interfaces to handle
|
||||
if [ -n "${RAW_IFACES}${IFACES}" ]; then
|
||||
if [ -n "$IFACES" ]; then
|
||||
echo 'SUBSYSTEM!="net", GOTO="net_end"'
|
||||
echo 'ACTION!="add|change|move", GOTO="net_end"'
|
||||
for iface in $IFACES $RAW_IFACES; do
|
||||
for iface in $IFACES; do
|
||||
case "$iface" in
|
||||
??:??:??:??:??:??) # MAC address
|
||||
cond="ATTR{address}==\"$iface\""
|
||||
@@ -94,7 +79,13 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
done
|
||||
echo 'LABEL="net_end"'
|
||||
|
||||
for iface in $IFACES; do
|
||||
if [ -n "$MASTER_IFACES" ]; then
|
||||
wait_ifaces=$MASTER_IFACES
|
||||
else
|
||||
wait_ifaces=$IFACES
|
||||
fi
|
||||
|
||||
for iface in $wait_ifaces; do
|
||||
if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
|
||||
echo "[ -f /tmp/net.${iface}.did-setup ]" >$hookdir/initqueue/finished/wait-$iface.sh
|
||||
fi
|
||||
|
@@ -1,18 +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
|
||||
|
||||
is_ip() {
|
||||
echo "$1" | {
|
||||
IFS=. read a b c d
|
||||
test "$a" -ge 0 -a "$a" -le 255 \
|
||||
-a "$b" -ge 0 -a "$b" -le 255 \
|
||||
-a "$c" -ge 0 -a "$c" -le 255 \
|
||||
-a "$d" -ge 0 -a "$d" -le 255 \
|
||||
2> /dev/null
|
||||
} && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
get_ip() {
|
||||
local iface="$1" ip=""
|
||||
@@ -74,14 +60,6 @@ all_ifaces_up() {
|
||||
done
|
||||
}
|
||||
|
||||
all_ifaces_setup() {
|
||||
local iface="" IFACES=""
|
||||
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
|
||||
for iface in $IFACES; do
|
||||
[ -e /tmp/net.$iface.did-setup ] || return 1
|
||||
done
|
||||
}
|
||||
|
||||
get_netroot_ip() {
|
||||
local prefix="" server="" rest=""
|
||||
splitsep "$1" ":" prefix server rest
|
||||
@@ -102,8 +80,7 @@ ifdown() {
|
||||
ip addr flush dev $netif
|
||||
echo "#empty" > /etc/resolv.conf
|
||||
rm -f -- /tmp/net.$netif.did-setup
|
||||
[ -z "$DO_VLAN" ] && \
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
rm -f -- /tmp/net.$(cat /sys/class/net/$netif/address).did-setup
|
||||
# TODO: send "offline" uevent?
|
||||
}
|
||||
@@ -112,8 +89,7 @@ setup_net() {
|
||||
local netif="$1" f="" gw_ip="" netroot_ip="" iface="" IFACES=""
|
||||
local _p
|
||||
[ -e /tmp/net.$netif.did-setup ] && return
|
||||
[ -z "$DO_VLAN" ] && \
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
[ -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"
|
||||
@@ -123,7 +99,7 @@ setup_net() {
|
||||
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
|
||||
# set up resolv.conf
|
||||
[ -e /tmp/net.$netif.resolv.conf ] && \
|
||||
awk '!array[$0]++' /tmp/net.$netif.resolv.conf > /etc/resolv.conf
|
||||
cp -f /tmp/net.$netif.resolv.conf /etc/resolv.conf
|
||||
[ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw
|
||||
|
||||
# add static route
|
||||
@@ -131,7 +107,7 @@ setup_net() {
|
||||
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
|
||||
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
|
||||
@@ -170,8 +146,7 @@ setup_net() {
|
||||
unset layer2
|
||||
|
||||
> /tmp/net.$netif.did-setup
|
||||
[ -z "$DO_VLAN" ] && \
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
> /tmp/net.$(cat /sys/class/net/$netif/address).did-setup
|
||||
}
|
||||
|
||||
@@ -214,7 +189,7 @@ set_ifname() {
|
||||
fix_bootif() {
|
||||
local macaddr=${1}
|
||||
local IFS='-'
|
||||
macaddr=$(printf '%s:' ${macaddr})
|
||||
macaddr=$(for i in ${macaddr} ; do echo -n $i:; done)
|
||||
macaddr=${macaddr%:}
|
||||
# strip hardware type field from pxelinux
|
||||
[ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
|
||||
@@ -238,51 +213,19 @@ ibft_to_cmdline() {
|
||||
|
||||
[ -e /tmp/net.${dev}.has_ibft_config ] && continue
|
||||
|
||||
[ -e ${iface}/flags ] && flags=$(read a < ${iface}/flags; echo $a)
|
||||
# Skip invalid interfaces
|
||||
(( $flags & 1 )) || continue
|
||||
[ -e ${iface}/dhcp ] && dhcp=$(read a < ${iface}/dhcp; echo $a)
|
||||
[ -e ${iface}/origin ] && origin=$(read a < ${iface}/origin; echo $a)
|
||||
[ -e ${iface}/ip-addr ] && ip=$(read a < ${iface}/ip-addr; echo $a)
|
||||
|
||||
if [ -n "$ip" ] ; then
|
||||
case "$ip" in
|
||||
*.*.*.*)
|
||||
family=ipv4
|
||||
;;
|
||||
*:*)
|
||||
family=ipv6
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ -n "$dhcp" ] || [ "$origin" -eq 3 ]; then
|
||||
if [ "$family" = "ipv6" ] ; then
|
||||
echo "ip=$dev:dhcp6"
|
||||
else
|
||||
echo "ip=$dev:dhcp"
|
||||
fi
|
||||
if [ -n "$dhcp" ]; then
|
||||
echo "ip=$dev:dhcp"
|
||||
elif [ -e ${iface}/ip-addr ]; then
|
||||
[ -e ${iface}/ip-addr ] && ip=$(read a < ${iface}/ip-addr; echo $a)
|
||||
# skip not assigned ip adresses
|
||||
[ "$ip" = "0.0.0.0" ] && continue
|
||||
[ -e ${iface}/gateway ] && gw=$(read a < ${iface}/gateway; echo $a)
|
||||
[ "$gateway" = "0.0.0.0" ] && unset $gateway
|
||||
[ -e ${iface}/subnet-mask ] && mask=$(read a < ${iface}/subnet-mask; echo $a)
|
||||
[ -e ${iface}/prefix-len ] && prefix=$(read a < ${iface}/prefix-len; echo $a)
|
||||
[ -e ${iface}/primary-dns ] && dns1=$(read a < ${iface}/primary-dns; echo $a)
|
||||
[ "$dns1" = "0.0.0.0" ] && unset $dns1
|
||||
[ -e ${iface}/secondary-dns ] && dns2=$(read a < ${iface}/secondary-dns; echo $a)
|
||||
[ "$dns2" = "0.0.0.0" ] && unset $dns2
|
||||
[ -e ${iface}/hostname ] && hostname=$(read a < ${iface}/hostname; echo $a)
|
||||
if [ "$family" = "ipv6" ] ; then
|
||||
if [ -n "$ip" ] ; then
|
||||
ip="[$ip]"
|
||||
[ -n "$prefix" ] || prefix=64
|
||||
mask="$prefix"
|
||||
fi
|
||||
if [ -n "$gw" ] ; then
|
||||
gw="[${gw}]"
|
||||
fi
|
||||
fi
|
||||
if [ -n "$ip" ] && [ -n "$mask" ]; then
|
||||
echo "ip=$ip::$gw:$mask:$hostname:$dev:none${dns1:+:$dns1}${dns2:+:$dns2}"
|
||||
else
|
||||
@@ -298,21 +241,21 @@ ibft_to_cmdline() {
|
||||
fi
|
||||
|
||||
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
|
||||
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
|
||||
@@ -438,84 +381,50 @@ ip_to_var() {
|
||||
done
|
||||
|
||||
unset ip srv gw mask hostname dev autoconf macaddr mtu dns1 dns2
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
autoconf="error"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ $# -eq 1 ]; then
|
||||
# format: ip={dhcp|on|any|dhcp6|auto6}
|
||||
# or
|
||||
# ip=<ipv4-address> means anaconda-style static config argument cluster
|
||||
autoconf="$1"
|
||||
|
||||
if strstr "$autoconf" "*.*.*.*"; then
|
||||
# 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>}
|
||||
ip="$autoconf"
|
||||
gw=$(getarg gateway=)
|
||||
mask=$(getarg netmask=)
|
||||
hostname=$(getarg hostname=)
|
||||
dev=$(getarg ksdevice=)
|
||||
autoconf="none"
|
||||
mtu=$(getarg mtu=)
|
||||
|
||||
# handle special values for ksdevice
|
||||
case "$dev" in
|
||||
bootif|BOOTIF) dev=$(fix_bootif $(getarg BOOTIF=)) ;;
|
||||
link) dev="" ;; # FIXME: do something useful with this
|
||||
ibft) dev="" ;; # ignore - ibft is handled elsewhere
|
||||
case $# in
|
||||
0) autoconf="error" ;;
|
||||
1) autoconf=$1 ;;
|
||||
2) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2 ;;
|
||||
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;
|
||||
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
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "$2" = "dhcp" -o "$2" = "on" -o "$2" = "any" -o "$2" = "dhcp6" -o "$2" = "auto6" ]; then
|
||||
# format: ip=<interface>:{dhcp|on|any|dhcp6|auto6}[:[<mtu>][:<macaddr>]]
|
||||
[ -n "$1" ] && dev="$1"
|
||||
[ -n "$2" ] && autoconf="$2"
|
||||
[ -n "$3" ] && mtu=$3
|
||||
if [ -z "$5" ]; then
|
||||
macaddr="$4"
|
||||
else
|
||||
macaddr="${4}:${5}:${6}:${7}:${8}:${9}"
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
# format: ip=<client-IP>:[<peer>]:<gateway-IP>:<netmask>:<client_hostname>:<interface>:{none|off|dhcp|on|any|dhcp6|auto6|ibft}:[:[<mtu>][:<macaddr>]]
|
||||
|
||||
[ -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
|
||||
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 -z "${10}" ]; then
|
||||
macaddr="${9}"
|
||||
elif [ -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
|
||||
;;
|
||||
*)
|
||||
if [ -n "${9}" -a -z "${10}" ]; then
|
||||
macaddr="${9}"
|
||||
elif [ -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
|
||||
return 0
|
||||
|
||||
# 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 strglob "$autoconf" "*.*.*.*"; then
|
||||
ip="$autoconf"
|
||||
gw=$(getarg gateway=)
|
||||
mask=$(getarg netmask=)
|
||||
hostname=$(getarg hostname=)
|
||||
dev=$(getarg ksdevice=)
|
||||
autoconf="none"
|
||||
mtu=$(getarg mtu=)
|
||||
|
||||
# handle special values for ksdevice
|
||||
case "$dev" in
|
||||
bootif|BOOTIF) dev=$(fix_bootif $(getarg BOOTIF=)) ;;
|
||||
link) dev="" ;; # FIXME: do something useful with this
|
||||
ibft) dev="" ;; # ignore - ibft is handled elsewhere
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
route_to_var() {
|
||||
@@ -555,13 +464,8 @@ parse_ifname_opts() {
|
||||
# udev requires MAC addresses to be lower case
|
||||
ifname_mac=$(echo $2:$3:$4:$5:$6:$7 | sed 'y/ABCDEF/abcdef/')
|
||||
;;
|
||||
21)
|
||||
# infiniband MAC addrs are 20 bytes long not 6
|
||||
ifname_if=$1
|
||||
ifname_mac=$(echo $2:$3:$4:$5:$6:$7:$8:$9:$10:$11:$12:13:$14:$15$16:$17:$18:$19:$20:$21 | sed 'y/ABCDEF/abcdef/')
|
||||
;;
|
||||
*)
|
||||
die "Invalid arguments for ifname=$1"
|
||||
die "Invalid arguments for ifname="
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -570,7 +474,7 @@ parse_ifname_opts() {
|
||||
warn "ifname=$ifname_if uses the kernel name space for interfaces"
|
||||
warn "This can fail for multiple network interfaces and is discouraged!"
|
||||
warn "Please use a custom name like \"netboot\" or \"bluesocket\""
|
||||
warn "or use the persistent interface names from udev or biosdevname and no ifname= at all."
|
||||
warn "or use biosdevname and no ifname= at all."
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -580,11 +484,7 @@ parse_ifname_opts() {
|
||||
wait_for_if_link() {
|
||||
local cnt=0
|
||||
local li
|
||||
local timeout="$(getargs rd.net.timeout.iflink=)"
|
||||
timeout=${timeout:-60}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
while [ $cnt -lt 600 ]; do
|
||||
li=$(ip -o link show dev $1 2>/dev/null)
|
||||
[ -n "$li" ] && return 0
|
||||
sleep 0.1
|
||||
@@ -596,27 +496,9 @@ wait_for_if_link() {
|
||||
wait_for_if_up() {
|
||||
local cnt=0
|
||||
local li
|
||||
local timeout="$(getargs rd.net.timeout.ifup=)"
|
||||
timeout=${timeout:-20}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
while [ $cnt -lt 200 ]; do
|
||||
li=$(ip -o link show up dev $1)
|
||||
if [ -n "$li" ]; then
|
||||
case "$li" in
|
||||
*\<UP*)
|
||||
return 0;;
|
||||
*\<*,UP\>*)
|
||||
return 0;;
|
||||
*\<*,UP,*\>*)
|
||||
return 0;;
|
||||
esac
|
||||
fi
|
||||
if strstr "$li" "LOWER_UP" \
|
||||
&& strstr "$li" "state UNKNOWN" \
|
||||
&& ! strstr "$li" "DORMANT"; then
|
||||
return 0
|
||||
fi
|
||||
[ -n "$li" ] && [ -z "${li##*state UP*}" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
@@ -625,11 +507,7 @@ wait_for_if_up() {
|
||||
|
||||
wait_for_route_ok() {
|
||||
local cnt=0
|
||||
local timeout="$(getargs rd.net.timeout.route=)"
|
||||
timeout=${timeout:-20}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
while [ $cnt -lt 200 ]; do
|
||||
li=$(ip route show)
|
||||
[ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
|
||||
sleep 0.1
|
||||
@@ -638,34 +516,12 @@ wait_for_route_ok() {
|
||||
return 1
|
||||
}
|
||||
|
||||
wait_for_ipv6_dad_link() {
|
||||
local cnt=0
|
||||
local timeout="$(getargs rd.net.timeout.ipv6dad=)"
|
||||
timeout=${timeout:-50}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \
|
||||
&& return 0
|
||||
[ -n "$(ip -6 addr show dev "$1" scope link dadfailed)" ] \
|
||||
&& return 1
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
wait_for_ipv6_dad() {
|
||||
local cnt=0
|
||||
local timeout="$(getargs rd.net.timeout.ipv6dad=)"
|
||||
timeout=${timeout:-50}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ -z "$(ip -6 addr show dev "$1" tentative)" ] \
|
||||
&& return 0
|
||||
[ -n "$(ip -6 addr show dev "$1" dadfailed)" ] \
|
||||
&& return 1
|
||||
local li
|
||||
while [ $cnt -lt 500 ]; do
|
||||
li=$(ip -6 addr show dev $1 scope link)
|
||||
strstr "$li" "tentative" || return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
@@ -674,14 +530,12 @@ wait_for_ipv6_dad() {
|
||||
|
||||
wait_for_ipv6_auto() {
|
||||
local cnt=0
|
||||
local timeout="$(getargs rd.net.timeout.ipv6auto=)"
|
||||
timeout=${timeout:-40}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ -z "$(ip -6 addr show dev "$1" tentative)" ] \
|
||||
&& [ -n "$(ip -6 route list proto ra dev "$1")" ] \
|
||||
&& return 0
|
||||
local li
|
||||
while [ $cnt -lt 400 ]; do
|
||||
li=$(ip -6 addr show dev $1)
|
||||
if ! strstr "$li" "tentative"; then
|
||||
strstr "$li" "dynamic" && return 0
|
||||
fi
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
@@ -695,42 +549,25 @@ linkup() {
|
||||
}
|
||||
|
||||
type hostname >/dev/null 2>&1 || \
|
||||
hostname() {
|
||||
cat /proc/sys/kernel/hostname
|
||||
hostname() {
|
||||
cat /proc/sys/kernel/hostname
|
||||
}
|
||||
|
||||
iface_has_carrier() {
|
||||
iface_has_link() {
|
||||
local cnt=0
|
||||
local interface="$1" flags=""
|
||||
[ -n "$interface" ] || return 2
|
||||
interface="/sys/class/net/$interface"
|
||||
[ -d "$interface" ] || return 2
|
||||
local timeout="$(getargs rd.net.timeout.carrier=)"
|
||||
timeout=${timeout:-5}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
linkup "$1"
|
||||
|
||||
li=$(ip -o link show up dev $1)
|
||||
strstr "$li" "NO-CARRIER" && _no_carrier_flag=1
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
if [ -n "$_no_carrier_flag" ]; then
|
||||
# NO-CARRIER flag was cleared
|
||||
strstr "$li" "NO-CARRIER" || return 0
|
||||
fi
|
||||
# double check the syscfs carrier flag
|
||||
[ -e "$interface/carrier" ] && [ "$(cat $interface/carrier)" = 1 ] && return 0
|
||||
while [ $cnt -lt 50 ]; do
|
||||
[ "$(cat $interface/carrier)" = 1 ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
iface_has_link() {
|
||||
iface_has_carrier "$@"
|
||||
}
|
||||
|
||||
find_iface_with_link() {
|
||||
local iface_path="" iface=""
|
||||
for iface_path in /sys/class/net/*; do
|
||||
@@ -809,21 +646,3 @@ is_kernel_ethernet_name() {
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
iface_get_subchannels() {
|
||||
local _netif
|
||||
local _subchannels
|
||||
|
||||
_netif="$1"
|
||||
|
||||
_subchannels=$({
|
||||
for i in /sys/class/net/$_netif/device/cdev[0-9]*; do
|
||||
[ -e $i ] || continue
|
||||
channel=$(readlink -f $i)
|
||||
printf -- "%s" "${channel##*/},"
|
||||
done
|
||||
})
|
||||
[ -n "$_subchannels" ] || return 1
|
||||
|
||||
printf -- "%s" ${_subchannels%,}
|
||||
}
|
||||
|
@@ -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
|
||||
@@ -14,11 +12,6 @@ command -v setup_net >/dev/null || . /lib/net-lib.sh
|
||||
# no sense in doing something if no (net)root info is available
|
||||
# or root is already there
|
||||
[ -d $NEWROOT/proc ] && exit 0
|
||||
|
||||
if [ -z "$netroot" ]; then
|
||||
netroot=$(getarg netroot=)
|
||||
fi
|
||||
|
||||
[ -z "$netroot" ] && exit 1
|
||||
|
||||
# Set or override primary interface
|
||||
@@ -40,7 +33,7 @@ esac
|
||||
# Figure out the handler for root=dhcp by recalling all netroot cmdline
|
||||
# handlers when this is not called from manually network bringing up.
|
||||
if [ -z "$2" ]; then
|
||||
if getarg "root=dhcp" || getarg "netroot=dhcp" || getarg "root=dhcp6" || getarg "netroot=dhcp6"; then
|
||||
if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then
|
||||
# Load dhcp options
|
||||
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
|
||||
|
||||
@@ -52,8 +45,6 @@ if [ -z "$2" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -f -- $hookdir/initqueue/finished/dhcp.sh
|
||||
|
||||
# Set netroot to new_root_path, so cmdline parsers don't call
|
||||
netroot=$new_root_path
|
||||
|
||||
@@ -83,7 +74,9 @@ source_hook netroot $netif
|
||||
|
||||
# Run the handler; don't store the root, it may change from device to device
|
||||
# XXX other variables to export?
|
||||
[ -n "$handler" ] && "$handler" "$netif" "$netroot" "$NEWROOT"
|
||||
save_netinfo $netif
|
||||
|
||||
if $handler $netif $netroot $NEWROOT; then
|
||||
rm -f -- $hookdir/initqueue/finished/dhcp.sh
|
||||
# Network rootfs mount successful - save interface info for ifcfg etc.
|
||||
save_netinfo $netif
|
||||
fi
|
||||
exit 0
|
||||
|
@@ -10,6 +10,14 @@
|
||||
# bond without parameters assumes bond=bond0:eth0,eth1:mode=balance-rr
|
||||
#
|
||||
|
||||
# return if bond already parsed
|
||||
[ -n "$bondname" ] && return
|
||||
|
||||
# Check if bond parameter is valid
|
||||
if getarg bond= >/dev/null ; then
|
||||
:
|
||||
fi
|
||||
|
||||
# We translate list of slaves to space-separated here to mwke it easier to loop over them in ifup
|
||||
# Ditto for bonding options
|
||||
parsebond() {
|
||||
@@ -20,6 +28,7 @@ parsebond() {
|
||||
v=${v#*:}
|
||||
done
|
||||
|
||||
unset bondname bondslaves bondoptions
|
||||
case $# in
|
||||
0) bondname=bond0; bondslaves="eth0 eth1" ;;
|
||||
1) bondname=$1; bondslaves="eth0 eth1" ;;
|
||||
@@ -29,13 +38,14 @@ parsebond() {
|
||||
esac
|
||||
}
|
||||
|
||||
unset bondname bondslaves bondoptions
|
||||
|
||||
# Parse bond for bondname, bondslaves, bondmode and bondoptions
|
||||
for bond in $(getargs bond=); do
|
||||
unset bondname
|
||||
unset bondslaves
|
||||
unset bondoptions
|
||||
if [ "$bond" != "bond" ]; then
|
||||
parsebond "$bond"
|
||||
if getarg bond >/dev/null; then
|
||||
# Read bond= parameters if they exist
|
||||
bond="$(getarg bond=)"
|
||||
if [ ! "$bond" = "bond" ]; then
|
||||
parsebond "$(getarg bond=)"
|
||||
fi
|
||||
# Simple default bond
|
||||
if [ -z "$bondname" ]; then
|
||||
@@ -47,4 +57,5 @@ for bond in $(getargs bond=); do
|
||||
echo "bondname=$bondname" > /tmp/bond.${bondname}.info
|
||||
echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.${bondname}.info
|
||||
echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.${bondname}.info
|
||||
done
|
||||
return
|
||||
fi
|
||||
|
@@ -7,6 +7,14 @@
|
||||
# bridge without parameters assumes bridge=br0:eth0
|
||||
#
|
||||
|
||||
# return if bridge already parsed
|
||||
[ -n "$bridgename" ] && return
|
||||
|
||||
# Check if bridge parameter is valid
|
||||
if getarg bridge= >/dev/null ; then
|
||||
command -v brctl >/dev/null 2>&1 || die "No 'brctl' installed"
|
||||
fi
|
||||
|
||||
parsebridge() {
|
||||
local v=${1}:
|
||||
set --
|
||||
@@ -14,6 +22,8 @@ parsebridge() {
|
||||
set -- "$@" "${v%%:*}"
|
||||
v=${v#*:}
|
||||
done
|
||||
|
||||
unset bridgename bridgeslaves
|
||||
case $# in
|
||||
0) bridgename=br0; bridgeslaves=$iface ;;
|
||||
1) die "bridge= requires two parameters" ;;
|
||||
@@ -22,13 +32,14 @@ parsebridge() {
|
||||
esac
|
||||
}
|
||||
|
||||
unset bridgename bridgeslaves
|
||||
|
||||
iface=eth0
|
||||
|
||||
# Parse bridge for bridgename and bridgeslaves
|
||||
for bridge in $(getargs bridge=); do
|
||||
unset bridgename
|
||||
unset bridgeslaves
|
||||
iface=eth0
|
||||
if bridge="$(getarg bridge)"; then
|
||||
# Read bridge= parameters if they exist
|
||||
if [ "$bridge" != "bridge" ]; then
|
||||
if [ -n "$bridge" ]; then
|
||||
parsebridge $bridge
|
||||
fi
|
||||
# Simple default bridge
|
||||
@@ -36,6 +47,7 @@ for bridge in $(getargs bridge=); do
|
||||
bridgename=br0
|
||||
bridgeslaves=$iface
|
||||
fi
|
||||
echo "bridgename=$bridgename" > /tmp/bridge.${bridgename}.info
|
||||
echo "bridgeslaves=\"$bridgeslaves\"" >> /tmp/bridge.${bridgename}.info
|
||||
done
|
||||
echo "bridgename=$bridgename" > /tmp/bridge.info
|
||||
echo "bridgeslaves=\"$bridgeslaves\"" >> /tmp/bridge.info
|
||||
return
|
||||
fi
|
||||
|
@@ -1,12 +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
|
||||
|
||||
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
|
||||
modprobe -b -q iscsi_boot_sysfs 2>/dev/null
|
||||
modprobe -b -q iscsi_ibft
|
||||
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]
|
||||
@@ -38,12 +36,8 @@ unset count
|
||||
# If needed, check if bootdev= contains anything usable
|
||||
BOOTDEV=$(getarg bootdev=)
|
||||
|
||||
if [ -n "$NEEDBOOTDEV" ] && ! getargbool 0 rd.neednet; then
|
||||
#[ -z "$BOOTDEV" ] && warn "Please supply bootdev argument for multiple ip= lines"
|
||||
echo "rd.neednet=1" > /etc/cmdline.d/dracut-neednet.conf
|
||||
info "Multiple ip= arguments: assuming rd.neednet=1"
|
||||
else
|
||||
unset NEEDBOOTDEV
|
||||
if [ -n "$NEEDBOOTDEV" ] ; then
|
||||
[ -z "$BOOTDEV" ] && warn "Please supply bootdev argument for multiple ip= lines"
|
||||
fi
|
||||
|
||||
# Check ip= lines
|
||||
@@ -52,14 +46,17 @@ for p in $(getargs ip=); do
|
||||
ip_to_var $p
|
||||
|
||||
# make first device specified the BOOTDEV
|
||||
if [ -n "$NEEDBOOTDEV" ] && [ -z "$BOOTDEV" ] && [ -n "$dev" ]; then
|
||||
if [ -z "$BOOTDEV" ] && [ -n "$dev" ]; then
|
||||
BOOTDEV="$dev"
|
||||
info "Setting bootdev to '$BOOTDEV'"
|
||||
[ -n "$NEEDBOOTDEV" ] && warn "Setting bootdev to '$BOOTDEV'"
|
||||
fi
|
||||
|
||||
# skip ibft since we did it above
|
||||
[ "$autoconf" = "ibft" ] && continue
|
||||
|
||||
# We need to have an ip= line for the specified bootdev
|
||||
[ -n "$NEEDBOOTDEV" ] && [ "$dev" = "$BOOTDEV" ] && BOOTDEVOK=1
|
||||
|
||||
# Empty autoconf defaults to 'dhcp'
|
||||
if [ -z "$autoconf" ] ; then
|
||||
warn "Empty autoconf values default to dhcp"
|
||||
@@ -79,8 +76,8 @@ for p in $(getargs ip=); do
|
||||
;;
|
||||
auto6);;
|
||||
dhcp|dhcp6|on|any) \
|
||||
#[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
|
||||
# die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
|
||||
[ -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'"
|
||||
;;
|
||||
@@ -112,16 +109,6 @@ for p in $(getargs ip=); do
|
||||
die "Server-ip or dhcp for netboot needed, but current arguments say otherwise"
|
||||
fi
|
||||
|
||||
if str_starts "$dev" "enx" && [ ${#dev} -eq 15 ]; then
|
||||
printf -- "ifname=%s:%s:%s:%s:%s:%s:%s\n" \
|
||||
"$dev" \
|
||||
"${dev:3:2}" \
|
||||
"${dev:5:2}" \
|
||||
"${dev:7:2}" \
|
||||
"${dev:9:2}" \
|
||||
"${dev:11:2}" \
|
||||
"${dev:13:2}" >> /etc/cmdline.d/80-enx.conf
|
||||
fi
|
||||
done
|
||||
|
||||
# put BOOTIF in IFACES to make sure it comes up
|
||||
|
@@ -6,6 +6,14 @@
|
||||
# teamslaves is a comma-separated list of physical (ethernet) interfaces
|
||||
#
|
||||
|
||||
# return if team already parsed
|
||||
[ -n "$teammaster" ] && return
|
||||
|
||||
# Check if team parameter is valid
|
||||
if getarg team= >/dev/null ; then
|
||||
:
|
||||
fi
|
||||
|
||||
parseteam() {
|
||||
local v=${1}:
|
||||
set --
|
||||
@@ -14,22 +22,23 @@ parseteam() {
|
||||
v=${v#*:}
|
||||
done
|
||||
|
||||
unset teammaster teamslaves
|
||||
case $# in
|
||||
2) teammaster=$1; teamslaves=$(str_replace "$2" "," " ") ;;
|
||||
*) die "team= requires two parameters" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
unset teammaster teamslaves
|
||||
|
||||
for team in $(getargs team=); do
|
||||
unset teammaster teamslaves
|
||||
parseteam "$(getarg team=)"
|
||||
|
||||
echo "teammaster=$teammaster" > /tmp/team.${teammaster}.info
|
||||
echo "teamslaves=\"$teamslaves\"" >> /tmp/team.${teammaster}.info
|
||||
if ! [ -e /etc/teamd/${teammaster}.conf ]; then
|
||||
warn "Team master $teammaster specified, but no /etc/teamd/$teammaster.conf present. Using activebackup."
|
||||
mkdir -p /etc/teamd
|
||||
printf -- "%s" '{"runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}}' > "/etc/teamd/${teammaster}.conf"
|
||||
if getarg team>/dev/null; then
|
||||
# Read team= parameters if they exist
|
||||
team="$(getarg team=)"
|
||||
if [ ! "$team" = "team" ]; then
|
||||
parseteam "$(getarg team=)"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "teammaster=$teammaster" > /tmp/team.info
|
||||
echo "teamslaves=\"$teamslaves\"" >> /tmp/team.info
|
||||
return
|
||||
fi
|
||||
|
@@ -4,6 +4,14 @@
|
||||
# vlan=<vlanname>:<phydevice>
|
||||
#
|
||||
|
||||
# return if vlan already parsed
|
||||
[ -n "$vlanname" ] && return
|
||||
|
||||
# Check if vlan parameter is valid
|
||||
if getarg vlan= >/dev/null ; then
|
||||
:
|
||||
fi
|
||||
|
||||
parsevlan() {
|
||||
local v=${1}:
|
||||
set --
|
||||
@@ -19,11 +27,16 @@ parsevlan() {
|
||||
esac
|
||||
}
|
||||
|
||||
for vlan in $(getargs vlan=); do
|
||||
unset vlanname
|
||||
unset phydevice
|
||||
parsevlan "$vlan"
|
||||
unset vlanname phydevice
|
||||
|
||||
echo "$phydevice" > /tmp/vlan.${phydevice}.phy
|
||||
echo "$vlanname" > /tmp/vlan.${vlanname}.${phydevice}
|
||||
done
|
||||
if getarg vlan >/dev/null; then
|
||||
# Read vlan= parameters if they exist
|
||||
vlan="$(getarg vlan=)"
|
||||
if [ ! "$vlan" = "vlan" ]; then
|
||||
parsevlan "$(getarg vlan=)"
|
||||
fi
|
||||
|
||||
echo "vlanname=\"$vlanname\"" > /tmp/vlan.info
|
||||
echo "phydevice=\"$phydevice\"" >> /tmp/vlan.info
|
||||
return
|
||||
fi
|
||||
|
@@ -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() {
|
||||
[[ -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,12 +1,18 @@
|
||||
#!/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
|
||||
. /tmp/bridge.info
|
||||
fi
|
||||
|
||||
if [ -e /tmp/vlan.info ]; then
|
||||
. /tmp/vlan.info
|
||||
fi
|
||||
|
||||
mkdir -m 0755 -p /tmp/ifcfg/
|
||||
mkdir -m 0755 -p /tmp/ifcfg-leases/
|
||||
|
||||
@@ -42,7 +48,7 @@ print_s390() {
|
||||
for i in /sys/class/net/$_netif/device/cdev[0-9]*; do
|
||||
[ -e $i ] || continue
|
||||
channel=$(readlink -f $i)
|
||||
printf '%s' "${channel##*/},"
|
||||
echo -n "${channel##*/},"
|
||||
done
|
||||
})
|
||||
[ -n "$SUBCHANNELS" ] || return 1
|
||||
@@ -116,16 +122,13 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
|
||||
netif=${netup%%.did-setup}
|
||||
netif=${netif##*/net.}
|
||||
strstr "$netif" ":*:*:*:*:" && continue
|
||||
strglobin "$netif" ":*:*:*:*:" && continue
|
||||
[ -e /tmp/ifcfg/ifcfg-$netif ] && continue
|
||||
unset bridge
|
||||
unset bond
|
||||
unset team
|
||||
unset bondslaves
|
||||
unset bondname
|
||||
unset bondoptions
|
||||
unset bridgename
|
||||
unset bridgeslaves
|
||||
unset uuid
|
||||
unset ip
|
||||
unset gw
|
||||
@@ -135,39 +138,24 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
unset slave
|
||||
unset ethname
|
||||
unset vlan
|
||||
unset phydevice
|
||||
|
||||
[ -e /tmp/bond.${netif}.info ] && . /tmp/bond.${netif}.info
|
||||
[ -e /tmp/bridge.${netif}.info ] && . /tmp/bridge.${netif}.info
|
||||
[ -e /tmp/team.${netif}.info ] && . /tmp/team.${netif}.info
|
||||
[ -e /tmp/net.${netif}.override ] && . /tmp/net.${netif}.override
|
||||
|
||||
uuid=$(cat /proc/sys/kernel/random/uuid)
|
||||
if [ "$netif" = "$bridgename" ]; then
|
||||
bridge=yes
|
||||
elif [ "$netif" = "$teammaster" ]; then
|
||||
team=yes
|
||||
elif [ "$netif" = "$bondname" ]; then
|
||||
# $netif can't be bridge and bond at the same time
|
||||
# $netif can't be bridge and bond at the same time
|
||||
bond=yes
|
||||
fi
|
||||
|
||||
if ! [ -e /tmp/vlan.${netif}.phy ]; then
|
||||
for i in /tmp/vlan.${netif}.*; do
|
||||
[ ! -e "$i" ] && continue
|
||||
phydevice=${i##/tmp/vlan.${netif}.}
|
||||
vlan=yes
|
||||
break
|
||||
done
|
||||
if [ "$netif" = "$vlanname" ]; then
|
||||
vlan=yes
|
||||
fi
|
||||
|
||||
# skip team interfaces for now, the host config must be in sync
|
||||
[ "$netif" = "$teammaster" ] && continue
|
||||
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "NAME=\"$netif\""
|
||||
[ -z "$vlan" ] && interface_bind "$netif" "$macaddr"
|
||||
interface_bind "$netif" "$macaddr"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "UUID=\"$uuid\""
|
||||
@@ -181,7 +169,9 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
fi
|
||||
cp /tmp/dhclient.$netif.lease /tmp/ifcfg-leases/dhclient-$uuid-$netif.lease
|
||||
else
|
||||
if strstr "$ip" '*:*:*'; then
|
||||
# If we've booted with static ip= lines, the override file is there
|
||||
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
|
||||
if strglobin "$ip" '*:*:*'; then
|
||||
echo "IPV6INIT=yes"
|
||||
echo "IPV6_AUTOCONF=no"
|
||||
echo "IPV6ADDR=\"$ip/$mask\""
|
||||
@@ -198,7 +188,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\""
|
||||
@@ -208,15 +198,18 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
} > /tmp/ifcfg/ifcfg-$netif
|
||||
|
||||
# bridge needs different things written to ifcfg
|
||||
if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ] && [ -z "$team" ]; then
|
||||
if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ]; then
|
||||
# standard interface
|
||||
echo "TYPE=Ethernet" >> /tmp/ifcfg/ifcfg-$netif
|
||||
{
|
||||
echo "TYPE=Ethernet"
|
||||
[ -n "$mtu" ] && echo "MTU=\"$mtu\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
fi
|
||||
|
||||
if [ -n "$vlan" ] ; then
|
||||
{
|
||||
echo "TYPE=Vlan"
|
||||
echo "DEVICE=\"$netif\""
|
||||
echo "NAME=\"$netif\""
|
||||
echo "VLAN=yes"
|
||||
echo "PHYSDEV=\"$phydevice\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
@@ -243,7 +236,7 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
echo "MASTER=\"$netif\""
|
||||
echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
|
||||
unset macaddr
|
||||
[ -e /tmp/net.${slave}.override ] && . /tmp/net.${slave}.override
|
||||
[ -e /tmp/net.$slave.override ] && . /tmp/net.$slave.override
|
||||
interface_bind "$slave" "$macaddr"
|
||||
) >> /tmp/ifcfg/ifcfg-$slave
|
||||
done
|
||||
@@ -266,12 +259,11 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
echo "BRIDGE=\"$bridgename\""
|
||||
echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
|
||||
unset macaddr
|
||||
[ -e /tmp/net.${slave}.override ] && . /tmp/net.${slave}.override
|
||||
[ -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
|
||||
|
@@ -1,19 +1,23 @@
|
||||
#!/bin/bash
|
||||
# module-setup for url-lib
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
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*"
|
||||
@@ -28,7 +32,7 @@ install() {
|
||||
_crt=$(grep -F --binary-files=text -z .crt $_lib)
|
||||
[[ $_crt ]] || continue
|
||||
[[ $_crt == /*/* ]] || continue
|
||||
if ! inst "$_crt"; then
|
||||
if ! inst_simple "$_crt"; then
|
||||
dwarn "Couldn't install '$_crt' SSL CA cert bundle; HTTPS might not work."
|
||||
continue
|
||||
fi
|
||||
|
@@ -76,19 +76,51 @@ 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
|
||||
|
||||
nfs_already_mounted() {
|
||||
local server="$1" path="$2" localdir="" s="" p=""
|
||||
cat /proc/mounts | while read src mnt rest; do
|
||||
cat /proc/mounts | while read src mnt rest || [ -n "$src" ]; do
|
||||
splitsep ":" "$src" s p
|
||||
if [ "$server" = "$s" ]; then
|
||||
if [ "$path" = "$p" ]; then
|
||||
@@ -106,7 +138,7 @@ nfs_fetch_url() {
|
||||
local filepath="${path%/*}" filename="${path##*/}" mntdir=""
|
||||
|
||||
# skip mount if server:/filepath is already mounted
|
||||
mntdir=$(nfs_already_mounted "$server" "$filepath")
|
||||
mntdir=$(nfs_already_mounted "$server" "$path")
|
||||
if [ -z "$mntdir" ]; then
|
||||
local mntdir="$(mkuniqdir /run nfs_mnt)"
|
||||
mount_nfs "$nfs:$server:$filepath${options:+:$options}" "$mntdir"
|
||||
|
@@ -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
|
||||
@@ -21,7 +22,7 @@ installkernel() {
|
||||
local _merge=8 _side2=9
|
||||
function nmf1() {
|
||||
local _fname _fcont
|
||||
while read _fname; do
|
||||
while read _fname || [ -n "$_fname" ]; do
|
||||
case "$_fname" in
|
||||
*.ko) _fcont="$(< $_fname)" ;;
|
||||
*.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
|
||||
@@ -34,7 +35,7 @@ installkernel() {
|
||||
}
|
||||
function rotor() {
|
||||
local _f1 _f2
|
||||
while read _f1; do
|
||||
while read _f1 || [ -n "$_f1" ]; do
|
||||
echo "$_f1"
|
||||
if read _f2; then
|
||||
echo "$_f2" 1>&${_side2}
|
||||
@@ -48,6 +49,17 @@ 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
|
||||
|
||||
instmods amdkfd hyperv_fb
|
||||
|
||||
for _modname in $(find_kernel_modules_by_path drivers/gpu/drm \
|
||||
@@ -56,8 +68,12 @@ installkernel() {
|
||||
# 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
|
||||
# if radeon.ko is installed, we want amdkfd also
|
||||
if strstr "$_modname" radeon.ko; then
|
||||
hostonly='' instmods amdkfd
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
instmods $_modname
|
||||
|
@@ -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
|
||||
require_binaries plymouthd plymouth
|
||||
require_binaries plymouthd plymouth plymouth-set-default-theme
|
||||
}
|
||||
|
||||
# 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)
|
||||
|
||||
@@ -27,7 +26,7 @@ if [[ $hostonly ]]; then
|
||||
if [ -L /usr/share/plymouth/themes/default.plymouth ]; then
|
||||
inst /usr/share/plymouth/themes/default.plymouth
|
||||
# Install plugin for this theme
|
||||
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" /usr/share/plymouth/themes/default.plymouth | while read a b c; do echo $b; done;)
|
||||
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" /usr/share/plymouth/themes/default.plymouth | while read a b c || [ -n "$b" ]; do echo $b; done;)
|
||||
inst_libdir_file "plymouth/${PLYMOUTH_PLUGIN}.so"
|
||||
fi
|
||||
else
|
||||
|
@@ -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
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user