Compare commits
518 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
53337dfdc3 | ||
![]() |
b2cf61d97f | ||
![]() |
12d0213885 | ||
![]() |
fc88af5413 | ||
![]() |
5a04bd2dd3 | ||
![]() |
de0c0872fc | ||
![]() |
22d6863ef1 | ||
![]() |
3ad3b3a40d | ||
![]() |
6209edeb5c | ||
![]() |
66b920c651 | ||
![]() |
8b2afb08ba | ||
![]() |
44fd1c1355 | ||
![]() |
5f6be51595 | ||
![]() |
61f4564358 | ||
![]() |
805686930b | ||
![]() |
e0c0791594 | ||
![]() |
d24e67e24d | ||
![]() |
886b04abfe | ||
![]() |
c7d8334d26 | ||
![]() |
3c67644fe6 | ||
![]() |
5c94cf41e8 | ||
![]() |
d1a36d3d80 | ||
![]() |
3697891b75 | ||
![]() |
0eca191405 | ||
![]() |
3420a70dee | ||
![]() |
215365441e | ||
![]() |
563c434ecb | ||
![]() |
8849dd8d1a | ||
![]() |
2b61be32b8 | ||
![]() |
9ffe2e4c4b | ||
![]() |
6feaaabc22 | ||
![]() |
c3bb9d18dc | ||
![]() |
543b8014fc | ||
![]() |
909961d048 | ||
![]() |
0dc87f7b9e | ||
![]() |
ce9af251af | ||
![]() |
4a76c187d0 | ||
![]() |
373eadaa9c | ||
![]() |
0620677238 | ||
![]() |
82e780af25 | ||
![]() |
7f63374713 | ||
![]() |
ece67c7e2d | ||
![]() |
50a01dd4b2 | ||
![]() |
87c4c17850 | ||
![]() |
10f9e569c5 | ||
![]() |
33e27fab59 | ||
![]() |
625f11dca7 | ||
![]() |
44ca04c843 | ||
![]() |
060e1f192e | ||
![]() |
7359ba8aca | ||
![]() |
9f9bf8a178 | ||
![]() |
a02d17f7af | ||
![]() |
a876c27085 | ||
![]() |
49717458e8 | ||
![]() |
e5ac28a5be | ||
![]() |
b544bd6bfa | ||
![]() |
86b756346a | ||
![]() |
12bef83cda | ||
![]() |
b3bbf5fb6a | ||
![]() |
562cb77b5a | ||
![]() |
4bdd7eb23a | ||
![]() |
8f99fadabe | ||
![]() |
8743b07356 | ||
![]() |
69f4e7cdc3 | ||
![]() |
fd883a58d1 | ||
![]() |
851a801178 | ||
![]() |
1ffbcadad4 | ||
![]() |
f35d479d2b | ||
![]() |
3534789cc4 | ||
![]() |
57eefcf705 | ||
![]() |
3c244c7ca3 | ||
![]() |
abfd547a85 | ||
![]() |
ba92d1fcad | ||
![]() |
0267f3c355 | ||
![]() |
3d4dea58f9 | ||
![]() |
ec18a3eb83 | ||
![]() |
bb6770f1a4 | ||
![]() |
2c5bb67d83 | ||
![]() |
3fdc734a5c | ||
![]() |
b92af86bd5 | ||
![]() |
f5721c5921 | ||
![]() |
0eb87d7810 | ||
![]() |
5eb736103d | ||
![]() |
aaea54c732 | ||
![]() |
2f217abdb3 | ||
![]() |
8a51ee1fa6 | ||
![]() |
e942d86c9d | ||
![]() |
4982e16dd5 | ||
![]() |
2aa652349c | ||
![]() |
ea779750c3 | ||
![]() |
020212534b | ||
![]() |
1c41cc90c5 | ||
![]() |
4d03404f49 | ||
![]() |
85eb96802c | ||
![]() |
782ac8f1f6 | ||
![]() |
b7d3caef67 | ||
![]() |
bf273e3e86 | ||
![]() |
e740723069 | ||
![]() |
afef455718 | ||
![]() |
2257d54583 | ||
![]() |
49b614961d | ||
![]() |
b80ee08093 | ||
![]() |
5912f4fbc0 | ||
![]() |
3a60c036db | ||
![]() |
b37c90c8e0 | ||
![]() |
ec4539c606 | ||
![]() |
02acedd09e | ||
![]() |
3ca9aa1d7b | ||
![]() |
fd15dbad6e | ||
![]() |
be30d98751 | ||
![]() |
fc53987bec | ||
![]() |
7790644362 | ||
![]() |
8cd50230d9 | ||
![]() |
2cfd778a45 | ||
![]() |
97b86d37f9 | ||
![]() |
ae4fbb3db4 | ||
![]() |
64ee2a5386 | ||
![]() |
4baedd019b | ||
![]() |
31612c7337 | ||
![]() |
112f03f9e2 | ||
![]() |
6a37c6f630 | ||
![]() |
ac0e8f7dcc | ||
![]() |
1f21fac646 | ||
![]() |
4fbccde504 | ||
![]() |
651fe01e79 | ||
![]() |
96c313333d | ||
![]() |
122657b2fe | ||
![]() |
2d83bce21b | ||
![]() |
bb69aff14d | ||
![]() |
7fcc495588 | ||
![]() |
8059bcb2c8 | ||
![]() |
36af0518b3 | ||
![]() |
ba4bcf5f4f | ||
![]() |
56606b0a1b | ||
![]() |
fd4b04da66 | ||
![]() |
5b965f6308 | ||
![]() |
fd3698aa42 | ||
![]() |
3402142e34 | ||
![]() |
6b499ec14b | ||
![]() |
09356085b6 | ||
![]() |
1dc61299f7 | ||
![]() |
7b8c78ff43 | ||
![]() |
85378f44af | ||
![]() |
af3cd22425 | ||
![]() |
f450ebfdf2 | ||
![]() |
f5046e56bc | ||
![]() |
007df5adc1 | ||
![]() |
29f335070a | ||
![]() |
7ee8dfca6a | ||
![]() |
cd8db54a3d | ||
![]() |
23d303f8a0 | ||
![]() |
c864f8938c | ||
![]() |
f9b9faf433 | ||
![]() |
f0c606f91d | ||
![]() |
a4cc196467 | ||
![]() |
beb3e54ece | ||
![]() |
d174e18d2a | ||
![]() |
4c4cd24b7c | ||
![]() |
7e140a407b | ||
![]() |
6e7db0467a | ||
![]() |
34600bbead | ||
![]() |
cdebbcc684 | ||
![]() |
07c944b48c | ||
![]() |
92798d7d1b | ||
![]() |
d0c9fd6609 | ||
![]() |
1c6dd0ddfd | ||
![]() |
2aa97ff299 | ||
![]() |
7c77835cd6 | ||
![]() |
c2ecc4d131 | ||
![]() |
e6e78b14dd | ||
![]() |
957ab750f0 | ||
![]() |
f7844c296a | ||
![]() |
79f9b17feb | ||
![]() |
f9f1314acb | ||
![]() |
77854c6d2d | ||
![]() |
6e5878188b | ||
![]() |
90b9c00695 | ||
![]() |
718ad799ac | ||
![]() |
df1e5f06a5 | ||
![]() |
dd3cac269b | ||
![]() |
0ce54e8033 | ||
![]() |
43df4ee274 | ||
![]() |
baa4acd402 | ||
![]() |
e010f45524 | ||
![]() |
51b6784217 | ||
![]() |
f6597b0d51 | ||
![]() |
2536a9eaff | ||
![]() |
8c0fcdd931 | ||
![]() |
6bc9942b41 | ||
![]() |
c94bd1cd82 | ||
![]() |
428ef5e471 | ||
![]() |
a490409702 | ||
![]() |
77fa33017d | ||
![]() |
ae9aa8f174 | ||
![]() |
4148f08bd3 | ||
![]() |
d97f88f28b | ||
![]() |
94b0d89f17 | ||
![]() |
b130927514 | ||
![]() |
eb0d3fb9c1 | ||
![]() |
3a04fdff87 | ||
![]() |
d8d0b03cb4 | ||
![]() |
a201be999e | ||
![]() |
c5dd11f99f | ||
![]() |
11e82f3ecc | ||
![]() |
c305877c58 | ||
![]() |
d15441cef4 | ||
![]() |
88a83e0db1 | ||
![]() |
4cbe12a31f | ||
![]() |
a15a7a1a34 | ||
![]() |
0c4b5cabcf | ||
![]() |
e72c1310fa | ||
![]() |
2e3e2e0820 | ||
![]() |
032ecd95c9 | ||
![]() |
c0efaeca11 | ||
![]() |
f07e695fc5 | ||
![]() |
7b584edac0 | ||
![]() |
94157eec8e | ||
![]() |
895dd4eb25 | ||
![]() |
a2faaf8652 | ||
![]() |
cdf927d3ba | ||
![]() |
005a7bda8d | ||
![]() |
f5a14d0f30 | ||
![]() |
56ea45bd5a | ||
![]() |
3e1248da7d | ||
![]() |
82d9fbf193 | ||
![]() |
4fdc34e503 | ||
![]() |
f732667d14 | ||
![]() |
a19ab29197 | ||
![]() |
f1c7833a56 | ||
![]() |
9dd4d42265 | ||
![]() |
d75b029a8c | ||
![]() |
2d98cb6f63 | ||
![]() |
ad4f8d13f1 | ||
![]() |
e601a1ee46 | ||
![]() |
352d6110d0 | ||
![]() |
80f5e83ed5 | ||
![]() |
37b1f66f00 | ||
![]() |
0315e16955 | ||
![]() |
f0ad24623a | ||
![]() |
27f5e75893 | ||
![]() |
a26e12cefc | ||
![]() |
1b3b55894e | ||
![]() |
e08c644ee6 | ||
![]() |
a4cdc25210 | ||
![]() |
91f49acd1c | ||
![]() |
0ba7a48695 | ||
![]() |
8e84fa7262 | ||
![]() |
8df14af245 | ||
![]() |
e8857c59b1 | ||
![]() |
abc9879c9d | ||
![]() |
640458bbf6 | ||
![]() |
682b297207 | ||
![]() |
e25c536c70 | ||
![]() |
d76a2cfe21 | ||
![]() |
00ca6bed37 | ||
![]() |
2b5ddc7722 | ||
![]() |
0342a7d11c | ||
![]() |
10616019de | ||
![]() |
25f6841344 | ||
![]() |
ec12017055 | ||
![]() |
4042816955 | ||
![]() |
5a420e6183 | ||
![]() |
7193b6f0cb | ||
![]() |
95729721cc | ||
![]() |
fac7505b69 | ||
![]() |
231917e9b5 | ||
![]() |
3dbc6c3d44 | ||
![]() |
8bf6861b58 | ||
![]() |
8e10fa7d27 | ||
![]() |
ddc7bf456a | ||
![]() |
c3a9a8cf3d | ||
![]() |
b8ca67280f | ||
![]() |
3f114d3e31 | ||
![]() |
6aa59dd8ab | ||
![]() |
f8e90c8f70 | ||
![]() |
2fabaaa62d | ||
![]() |
cbef7cf3da | ||
![]() |
f274cf4c81 | ||
![]() |
2097e38490 | ||
![]() |
3736ed7ca4 | ||
![]() |
fb3a30efbf | ||
![]() |
8109b6c0d4 | ||
![]() |
1ce0eeffab | ||
![]() |
74668e212d | ||
![]() |
f32b5e582e | ||
![]() |
f506c4268b | ||
![]() |
b470a79c18 | ||
![]() |
dafdf37268 | ||
![]() |
90c679e753 | ||
![]() |
d376b98537 | ||
![]() |
cc914eaa8b | ||
![]() |
f3dcb60619 | ||
![]() |
2ec7fa190e | ||
![]() |
b7b8eedab5 | ||
![]() |
f1ed92c348 | ||
![]() |
5667978e7b | ||
![]() |
0850cf532d | ||
![]() |
9e587f0008 | ||
![]() |
07b65603ff | ||
![]() |
01126a209a | ||
![]() |
567c455753 | ||
![]() |
d4caa86aba | ||
![]() |
d85b7e4edd | ||
![]() |
0561f953c4 | ||
![]() |
9bc5282e30 | ||
![]() |
2b50b67c50 | ||
![]() |
75d758e8f1 | ||
![]() |
9a52c3fdb0 | ||
![]() |
560402c3dc | ||
![]() |
e0a0fa6174 | ||
![]() |
eddca44221 | ||
![]() |
9012f3996b | ||
![]() |
1f621aba37 | ||
![]() |
5d99b4d0eb | ||
![]() |
60a34d8b11 | ||
![]() |
72cba8aecd | ||
![]() |
1b61cfdbec | ||
![]() |
455329cf71 | ||
![]() |
b800edd698 | ||
![]() |
d3532978de | ||
![]() |
40fc0ad40d | ||
![]() |
501d82f796 | ||
![]() |
d643156d56 | ||
![]() |
d8a454a537 | ||
![]() |
b12f8188a4 | ||
![]() |
7c0bc0b2fd | ||
![]() |
5d05ffbd87 | ||
![]() |
a9345f6800 | ||
![]() |
90f269f6af | ||
![]() |
8f7c332e48 | ||
![]() |
bdd194bb8c | ||
![]() |
5a18b24a8b | ||
![]() |
f9f4264d03 | ||
![]() |
8c8aecdc63 | ||
![]() |
95ea16aa60 | ||
![]() |
c552c99ef8 | ||
![]() |
28545cda45 | ||
![]() |
9cf7b1c529 | ||
![]() |
92e6a8f879 | ||
![]() |
a96900a82c | ||
![]() |
d8e47e201a | ||
![]() |
630334950c | ||
![]() |
c67b624637 | ||
![]() |
62f3a10d5d | ||
![]() |
1edf54e275 | ||
![]() |
c8ebb80590 | ||
![]() |
d87ae13721 | ||
![]() |
c3f241849d | ||
![]() |
c17c5b7604 | ||
![]() |
34c73b339b | ||
![]() |
6f7823bce6 | ||
![]() |
805b46c2a8 | ||
![]() |
d437970c01 | ||
![]() |
f8b38ecd7c | ||
![]() |
5387ed24c8 | ||
![]() |
9e1c7f3dea | ||
![]() |
2c9debec02 | ||
![]() |
895c2f65d4 | ||
![]() |
3fce68bd1d | ||
![]() |
1a604e2a4a | ||
![]() |
0b86c0607f | ||
![]() |
095b77bee8 | ||
![]() |
d85c71fb69 | ||
![]() |
ebac18baad | ||
![]() |
ad64c6864c | ||
![]() |
cdb714c539 | ||
![]() |
994d003540 | ||
![]() |
63356d544b | ||
![]() |
2d4344bca9 | ||
![]() |
41cfdfc4d3 | ||
![]() |
510a22116b | ||
![]() |
2c10b29999 | ||
![]() |
7b59d15d96 | ||
![]() |
dd8ff5311f | ||
![]() |
6dc1cd052b | ||
![]() |
7310a8484e | ||
![]() |
3483509ef6 | ||
![]() |
aa225ca3b0 | ||
![]() |
6510ab3f9d | ||
![]() |
73f5cc7c37 | ||
![]() |
119bb1b81d | ||
![]() |
18ff79021c | ||
![]() |
060732d927 | ||
![]() |
9ea66e5682 | ||
![]() |
9eb77ff864 | ||
![]() |
10d01cc45d | ||
![]() |
a1b3c13e3a | ||
![]() |
dbdd7ad4c1 | ||
![]() |
9fb16311a4 | ||
![]() |
748293ff56 | ||
![]() |
d18e808358 | ||
![]() |
865390c7ca | ||
![]() |
d4b1d669d7 | ||
![]() |
9c0deb9f68 | ||
![]() |
ce15ca57a2 | ||
![]() |
cfac3a5675 | ||
![]() |
48cc484a4b | ||
![]() |
e4b1460433 | ||
![]() |
760a4370f0 | ||
![]() |
33e9727ee7 | ||
![]() |
87ea36797f | ||
![]() |
b29b9e9627 | ||
![]() |
819b24fe2e | ||
![]() |
d586ff7001 | ||
![]() |
6e70e9f1b1 | ||
![]() |
8eef563f71 | ||
![]() |
7b1d342e60 | ||
![]() |
9c4662d02b | ||
![]() |
0b920b83f2 | ||
![]() |
891ca19c49 | ||
![]() |
7bfe7daa51 | ||
![]() |
0412f42771 | ||
![]() |
5feb62872e | ||
![]() |
cdf03476d1 | ||
![]() |
10f3b19606 | ||
![]() |
e7b4442cfc | ||
![]() |
6d2574d509 | ||
![]() |
aa05b741e3 | ||
![]() |
f9cbd928ce | ||
![]() |
47f3a3d56d | ||
![]() |
e9053b1886 | ||
![]() |
4e3133e622 | ||
![]() |
4e3332ffa8 | ||
![]() |
e770ad31a6 | ||
![]() |
802f8b6218 | ||
![]() |
ecf7e74f4a | ||
![]() |
785d1a1ede | ||
![]() |
22fceeac80 | ||
![]() |
fb7b8be883 | ||
![]() |
f4053eb0c8 | ||
![]() |
7356c828b0 | ||
![]() |
95013ffce9 | ||
![]() |
836e2ffac6 | ||
![]() |
67bcc49304 | ||
![]() |
dbb8a98b29 | ||
![]() |
0f807f49cf | ||
![]() |
79ed45e021 | ||
![]() |
9edabfa600 | ||
![]() |
5cd1a9fb13 | ||
![]() |
dc00256e12 | ||
![]() |
ba3f4cdadc | ||
![]() |
51b36f56d8 | ||
![]() |
dff9baf3b4 | ||
![]() |
ba2e760b91 | ||
![]() |
b56448ba09 | ||
![]() |
1ebf454884 | ||
![]() |
fdbe7f9fbf | ||
![]() |
38ef319390 | ||
![]() |
45907c1d4d | ||
![]() |
35bd0b4ac1 | ||
![]() |
a6faf453a8 | ||
![]() |
16efdfa25c | ||
![]() |
1914a2eba1 | ||
![]() |
786ca932e8 | ||
![]() |
b28e4b20f0 | ||
![]() |
c46ed697a2 | ||
![]() |
fa06924239 | ||
![]() |
d1c8083b3a | ||
![]() |
702e7e83ed | ||
![]() |
767fbf81b6 | ||
![]() |
18d36fabf5 | ||
![]() |
433a9ec014 | ||
![]() |
bbe1434fca | ||
![]() |
03d132a76c | ||
![]() |
ddcdee9147 | ||
![]() |
c409108b04 | ||
![]() |
6eff0ebcf8 | ||
![]() |
07c671cc51 | ||
![]() |
c3446a7ce0 | ||
![]() |
7135c81931 | ||
![]() |
38cd8125f6 | ||
![]() |
791f392ca6 | ||
![]() |
6032ade3cc | ||
![]() |
0ce79d4c72 | ||
![]() |
860b64b92d | ||
![]() |
0f62da0405 | ||
![]() |
1211d6a3fb | ||
![]() |
457e7b7a4a | ||
![]() |
e918f337b6 | ||
![]() |
8a2edb1e4d | ||
![]() |
4026cd3b01 | ||
![]() |
30e49d5175 | ||
![]() |
29e269a522 | ||
![]() |
62d52ad2be | ||
![]() |
c35cbd2e56 | ||
![]() |
939b7e11d5 | ||
![]() |
9553a679f6 | ||
![]() |
1149ed2a3e | ||
![]() |
68dd8af21d | ||
![]() |
bf1a2262ea | ||
![]() |
be30c816d4 | ||
![]() |
a2472e6e60 | ||
![]() |
24ea839079 | ||
![]() |
f824f52675 | ||
![]() |
3c8ca29650 | ||
![]() |
21ee81bfbd | ||
![]() |
7b3c6e1bb0 | ||
![]() |
b955dbf4a9 | ||
![]() |
911c2de9c3 | ||
![]() |
560f45b15f | ||
![]() |
951c6655f1 | ||
![]() |
a47c3f50b6 | ||
![]() |
db36338053 | ||
![]() |
093bc9b5cf | ||
![]() |
8b5a6b91be | ||
![]() |
dd9288bb62 | ||
![]() |
66c27a6d85 | ||
![]() |
1acf52b60e | ||
![]() |
f3cbff1113 | ||
![]() |
c93df5e0ea | ||
![]() |
58d57fc977 | ||
![]() |
77630365ae | ||
![]() |
f1739d4236 | ||
![]() |
33920ee6b0 | ||
![]() |
08ff88f234 | ||
![]() |
28d0fc9347 | ||
![]() |
7c50ed83a3 | ||
![]() |
1ed4b9f100 |
9
.astylerc
Normal file
9
.astylerc
Normal file
@@ -0,0 +1,9 @@
|
||||
lineend=linux
|
||||
style=linux
|
||||
indent=spaces=8
|
||||
convert-tabs
|
||||
min-conditional-indent=0
|
||||
max-instatement-indent=120
|
||||
align-pointer=name
|
||||
max-code-length=120
|
||||
|
@@ -1,7 +1,25 @@
|
||||
;;; Directory Local Variables
|
||||
;;; For more information see (info "(emacs) Directory Variables")
|
||||
|
||||
((sh-mode
|
||||
(indent-tabs-mode)
|
||||
(sh-basic-offset . 4)))
|
||||
; Directory Local Variables
|
||||
; For more information see (info "(emacs) Directory Variables")
|
||||
; Sets emacs variables based on mode.
|
||||
; A list of (major-mode . ((var1 . value1) (var2 . value2)))
|
||||
; Mode can be nil, which gives default values.
|
||||
; Characters width is set to 109 for .c and XML but for everything else 79.
|
||||
; If you update this file make sure to update .vimrc and .editorconfig too.
|
||||
|
||||
((c-mode . ((fill-column . 109)
|
||||
(c-basic-offset . 8)
|
||||
(eval . (c-set-offset 'substatement-open 0))
|
||||
(eval . (c-set-offset 'statement-case-open 0))
|
||||
(eval . (c-set-offset 'case-label 0))
|
||||
(eval . (c-set-offset 'arglist-intro '++))
|
||||
(eval . (c-set-offset 'arglist-close 0))
|
||||
(eval . (c-set-offset 'arglist-cont-nonempty '(c-lineup-gcc-asm-reg c-lineup-arglist)))))
|
||||
(nxml-mode . ((nxml-child-indent . 2)
|
||||
(fill-column . 109)))
|
||||
(meson-mode . ((meson-indent-basic . 8)))
|
||||
(sh-mode . ((sh-basic-offset . 4)
|
||||
(sh-indentation . 4)))
|
||||
(awk-mode . ((c-basic-offset . 8)))
|
||||
(nil . ((indent-tabs-mode . nil)
|
||||
(tab-width . 4)
|
||||
(fill-column . 79))) )
|
||||
|
39
.editorconfig
Normal file
39
.editorconfig
Normal file
@@ -0,0 +1,39 @@
|
||||
# EditorConfig configuration for dracut
|
||||
# http://EditorConfig.org
|
||||
|
||||
# If you update this file make sure to update .dir-locals.el and .vimrc too.
|
||||
|
||||
# Top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file, utf-8 charset
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
switch_case_indent = true
|
||||
function_next_line = false
|
||||
binary_next_line = true
|
||||
space_redirects = true
|
||||
|
||||
# Match config files, set indent to spaces with width of eight.
|
||||
[*.{c,h}]
|
||||
indent_style = space
|
||||
indent_size = 8
|
||||
|
||||
# Match config files, set indent to spaces with width of four.
|
||||
[*.sh]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
switch_case_indent = true
|
||||
function_next_line = false
|
||||
binary_next_line = true
|
||||
space_redirects = true
|
||||
|
||||
# Match xml man pages, set indent to spaces with width of two.
|
||||
[man/*.xml]
|
||||
indent_style = space
|
||||
indent_size = 2
|
9
.github/CODEOWNERS
vendored
Normal file
9
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
# This is a comment.
|
||||
# Each line is a file pattern followed by one or more owners.
|
||||
|
||||
# These owners will be the default owners for everything in
|
||||
# the repo. Unless a later match takes precedence,
|
||||
# @global-owner1 and @global-owner2 will be requested for
|
||||
# review when someone opens a pull request.
|
||||
* @haraldh @danimo @johannbg
|
||||
|
3
.github/labeler.yml
vendored
3
.github/labeler.yml
vendored
@@ -1,6 +1,3 @@
|
||||
needs review:
|
||||
- "*"
|
||||
|
||||
repository:
|
||||
- ./*
|
||||
|
||||
|
1
.github/stale.yml
vendored
1
.github/stale.yml
vendored
@@ -8,6 +8,7 @@ exemptLabels:
|
||||
- enhancement
|
||||
- regression
|
||||
- wiki
|
||||
- bug
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: stale
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
|
54
.github/workflows/container.yml
vendored
Normal file
54
.github/workflows/container.yml
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
name: Container
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 11 * * *' # every day at 4:40
|
||||
push:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- 'test/container/**'
|
||||
- '.github/workflows/container.yml'
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- 'test/container/**'
|
||||
- '.github/workflows/container.yml'
|
||||
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
push_to_registry:
|
||||
name: Build and push containers image to GitHub Packages
|
||||
runs-on: ubuntu-latest
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.config.dockerfile }}
|
||||
cancel-in-progress: true
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- { dockerfile: 'Dockerfile-Fedora-33', tag: 'fedora:33' }
|
||||
- { dockerfile: 'Dockerfile-Fedora-latest', tag: 'fedora:latest' }
|
||||
- { dockerfile: 'Dockerfile-Fedora-rawhide', tag: 'fedora:rawhide' }
|
||||
- { dockerfile: 'Dockerfile-OpenSuse-latest', tag: 'opensuse:latest' }
|
||||
- { dockerfile: 'Dockerfile-Arch', tag: 'arch:latest' }
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
# with:
|
||||
# buildkitd-flags: --debug
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build and Push Container
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
file: test/container/${{ matrix.config.dockerfile }}
|
||||
tags: ghcr.io/dracutdevs/${{ matrix.config.tag }}
|
||||
push: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
|
56
.github/workflows/fedora-31.yml
vendored
56
.github/workflows/fedora-31.yml
vendored
@@ -1,56 +0,0 @@
|
||||
## The test container is created with https://github.com/dracutdevs/fedora-container
|
||||
|
||||
name: Fedora-31
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
tags:
|
||||
- '*'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: quay.io/haraldh/dracut-fedora:31
|
||||
options: "--privileged"
|
||||
timeout-minutes: 45
|
||||
strategy:
|
||||
matrix:
|
||||
test: [
|
||||
"01",
|
||||
"02",
|
||||
"03",
|
||||
"04",
|
||||
"10",
|
||||
"11",
|
||||
"12",
|
||||
"13",
|
||||
"14",
|
||||
"15",
|
||||
"17",
|
||||
"20",
|
||||
"21",
|
||||
"30",
|
||||
"31",
|
||||
"35",
|
||||
"36",
|
||||
"40",
|
||||
"41",
|
||||
"50",
|
||||
"51",
|
||||
"60",
|
||||
"61",
|
||||
"99",
|
||||
]
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: "Checkout Repository"
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: "TEST-${{ matrix.test }}"
|
||||
run: ./fedora-test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}
|
56
.github/workflows/fedora-32.yml
vendored
56
.github/workflows/fedora-32.yml
vendored
@@ -1,56 +0,0 @@
|
||||
## The test container is created with https://github.com/dracutdevs/fedora-container
|
||||
|
||||
name: Fedora-32
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
tags:
|
||||
- '*'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: quay.io/haraldh/dracut-fedora:32
|
||||
options: "--privileged"
|
||||
timeout-minutes: 45
|
||||
strategy:
|
||||
matrix:
|
||||
test: [
|
||||
"01",
|
||||
"02",
|
||||
"03",
|
||||
"04",
|
||||
"10",
|
||||
"11",
|
||||
"12",
|
||||
"13",
|
||||
"14",
|
||||
"15",
|
||||
"17",
|
||||
"20",
|
||||
"21",
|
||||
"30",
|
||||
"31",
|
||||
"35",
|
||||
"36",
|
||||
"40",
|
||||
"41",
|
||||
"50",
|
||||
"51",
|
||||
"60",
|
||||
"61",
|
||||
"99",
|
||||
]
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: "Checkout Repository"
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: "TEST-${{ matrix.test }}"
|
||||
run: ./fedora-test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}
|
81
.github/workflows/integration.yml
vendored
Normal file
81
.github/workflows/integration.yml
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
name: Integration Test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
basic:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }}
|
||||
cancel-in-progress: true
|
||||
strategy:
|
||||
matrix:
|
||||
container: [
|
||||
"fedora:33",
|
||||
"fedora:rawhide",
|
||||
"opensuse:latest",
|
||||
"arch:latest",
|
||||
]
|
||||
test: [
|
||||
"04",
|
||||
]
|
||||
fail-fast: false
|
||||
container:
|
||||
image: ghcr.io/dracutdevs/${{ matrix.container }}
|
||||
options: "--privileged -v /dev:/dev"
|
||||
steps:
|
||||
- name: "Checkout Repository"
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: "${{ matrix.container }} TEST-${{ matrix.test }}"
|
||||
run: ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }}
|
||||
cancel-in-progress: true
|
||||
strategy:
|
||||
matrix:
|
||||
container: [
|
||||
"fedora:latest",
|
||||
]
|
||||
test: [
|
||||
"01",
|
||||
"02",
|
||||
"03",
|
||||
"04",
|
||||
"10",
|
||||
"11",
|
||||
"12",
|
||||
"13",
|
||||
"14",
|
||||
"15",
|
||||
"17",
|
||||
"20",
|
||||
"21",
|
||||
"30",
|
||||
"31",
|
||||
"35",
|
||||
"36",
|
||||
"40",
|
||||
"41",
|
||||
"98",
|
||||
]
|
||||
fail-fast: false
|
||||
container:
|
||||
image: ghcr.io/dracutdevs/${{ matrix.container }}
|
||||
options: "--privileged -v /dev:/dev"
|
||||
steps:
|
||||
- name: "Checkout Repository"
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: "${{ matrix.container }} TEST-${{ matrix.test }}"
|
||||
run: ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}
|
18
.github/workflows/labels.yml
vendored
18
.github/workflows/labels.yml
vendored
@@ -1,15 +1,11 @@
|
||||
name: Label the Pull Requests automatically via Cron
|
||||
name: "Pull Request Labeler"
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '*/15 * * * *'
|
||||
on: pull_request_target
|
||||
|
||||
jobs:
|
||||
label:
|
||||
runs-on: ubuntu-18.04
|
||||
triage:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: paulfantom/periodic-labeler@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||
LABEL_MAPPINGS_FILE: .github/labeler.yml
|
||||
- uses: actions/labeler@main
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
38
.github/workflows/lint.yml
vendored
Normal file
38
.github/workflows/lint.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
name: Lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
lint-c:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: install tools
|
||||
run: sudo apt-get install astyle
|
||||
|
||||
- name: indent
|
||||
run: make indent-c
|
||||
|
||||
- name: check formatting
|
||||
run: git diff --exit-code
|
||||
|
||||
lint-shell:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: shfmt
|
||||
uses: luizm/action-sh-checker@v0.2.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SHFMT_OPTS: -s # arguments to shfmt.
|
||||
with:
|
||||
sh_checker_shellcheck_disable: false
|
||||
sh_checker_comment: true
|
19
.github/workflows/pr.yml
vendored
Normal file
19
.github/workflows/pr.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
name: Commisery
|
||||
on:
|
||||
pull_request:
|
||||
types: [edited, opened, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
commit-message:
|
||||
name: Conventional Commit Message Checker (Commisery)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check-out the repo under $GITHUB_WORKSPACE
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Run Commisery
|
||||
uses: dracutdevs/commisery-action@master
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
pull_request: ${{ github.event.number }}
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@@ -22,3 +22,6 @@ test*.img
|
||||
/*.sign
|
||||
*.o
|
||||
skipcpio/skipcpio
|
||||
/util/util
|
||||
/dracut-util
|
||||
.idea/
|
||||
|
1
.mailmap
1
.mailmap
@@ -34,3 +34,4 @@ Xunlei Pang <xlpang@redhat.com> <xpang@redhat.com>
|
||||
Daniel Molkentin <daniel.molkentin@suse.com> <dmolkentin@suse.com>
|
||||
Thomas Blume <thomas.blume@suse.com> <Thomas.Blume@suse.com>
|
||||
Brian C. Lane <bcl@redhat.com> <bcl@brianlane.com>
|
||||
Tomasz Paweł Gajc <tpgxyz@gmail.com> <tpgxyz@gmail.com>
|
||||
|
55
.packit.yml
Normal file
55
.packit.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
# This file is part of dracut.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# The name of the upstream package
|
||||
upstream_package_name: dracut
|
||||
|
||||
# The upstream tag versioning scheme
|
||||
upstream_tag_template: "{version}"
|
||||
|
||||
# The URL of the upstream project
|
||||
upstream_project_url: https://github.com/dracutdevs/dracut
|
||||
|
||||
# Relative path to a spec file within the upstream repository
|
||||
specfile_path: pkgbuild/dracut.spec
|
||||
|
||||
# Name of the downstream package
|
||||
downstream_package_name: dracut
|
||||
|
||||
# The URL of the downstream project
|
||||
dist_git_base_url: https://src.fedoraproject.org/
|
||||
|
||||
# Sync file(s) from upstream repo to dist-git
|
||||
synced_files:
|
||||
# The dracut spec file is maintained upstream so we sync it downstream.
|
||||
- dracut.spec
|
||||
# We sync the packit file downstream be able to optionally use the sync-from-downstream command
|
||||
- .packit.yaml
|
||||
|
||||
# We want new releases to be automatically built on rawhide and have few jobs
|
||||
# on copr.
|
||||
create_pr: false
|
||||
jobs:
|
||||
- job: propose_downstream
|
||||
trigger: release
|
||||
metadata:
|
||||
dist_git_branches: master
|
||||
|
||||
- job: tests
|
||||
trigger: pull_request
|
||||
metadata:
|
||||
targets:
|
||||
- fedora-rawhide
|
||||
|
||||
- job: copr_build
|
||||
trigger: pull_request
|
||||
metadata:
|
||||
targets:
|
||||
- fedora-development
|
||||
|
||||
- job: copr_build
|
||||
trigger: commit
|
||||
metadata:
|
||||
targets:
|
||||
- fedora-all
|
||||
- fedora-development
|
34
.shellcheckrc
Normal file
34
.shellcheckrc
Normal file
@@ -0,0 +1,34 @@
|
||||
# SC2039: In POSIX sh, 'local' is undefined.
|
||||
# https://github.com/koalaman/shellcheck/wiki/SC2039
|
||||
disable=SC2039
|
||||
|
||||
# SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
|
||||
# https://github.com/koalaman/shellcheck/wiki/SC2166
|
||||
disable=SC2166
|
||||
|
||||
# SC2154: Variable is referenced but not assigned
|
||||
# https://github.com/koalaman/shellcheck/wiki/SC2154
|
||||
disable=SC2154
|
||||
|
||||
# SC1091: Not following <file>
|
||||
# https://github.com/koalaman/shellcheck/wiki/SC1091
|
||||
disable=SC1091
|
||||
|
||||
# SC2174: When used with -p, -m only applies to the deepest directory.
|
||||
# https://github.com/koalaman/shellcheck/wiki/SC2174
|
||||
disable=SC2174
|
||||
|
||||
# SC3043: In POSIX sh, 'local' is undefined.
|
||||
# https://github.com/koalaman/shellcheck/wiki/SC3043
|
||||
# ... but dash supports it
|
||||
disable=SC3043
|
||||
|
||||
# SC3013: In POSIX sh, -ef is undefined.
|
||||
# https://github.com/koalaman/shellcheck/wiki/SC3013
|
||||
# ... but dash supports it
|
||||
disable=SC3013
|
||||
|
||||
# SC3045: In POSIX sh, read -p is undefined.
|
||||
# https://github.com/koalaman/shellcheck/wiki/SC3045
|
||||
# ... but dash supports it
|
||||
disable=SC3045
|
56
.travis.yml
56
.travis.yml
@@ -1,56 +0,0 @@
|
||||
language: generic
|
||||
dist: bionic
|
||||
sudo: required
|
||||
services:
|
||||
- docker
|
||||
env:
|
||||
matrix:
|
||||
- IMAGE=latest
|
||||
- IMAGE=latest TESTS=01
|
||||
- IMAGE=latest TESTS=12
|
||||
- IMAGE=latest TESTS=20
|
||||
- IMAGE=latest TESTS=21
|
||||
- IMAGE=latest TESTS=50
|
||||
- IMAGE=latest TESTS=51
|
||||
- IMAGE=latest TESTS=30
|
||||
- IMAGE=latest TESTS=31
|
||||
- IMAGE=latest TESTS=35
|
||||
- IMAGE=latest TESTS=36
|
||||
- IMAGE=latest TESTS=40
|
||||
- IMAGE=latest TESTS=41
|
||||
- IMAGE=latest TESTS=60
|
||||
- IMAGE=latest TESTS=61
|
||||
- IMAGE=latest TESTS=99
|
||||
- IMAGE=latest TESTS=02
|
||||
- IMAGE=latest TESTS=03
|
||||
- IMAGE=latest TESTS=04
|
||||
- IMAGE=latest TESTS=10
|
||||
- IMAGE=latest TESTS=11
|
||||
- IMAGE=latest TESTS=13
|
||||
- IMAGE=latest TESTS=14
|
||||
- IMAGE=latest TESTS=15
|
||||
- IMAGE=latest TESTS=17
|
||||
|
||||
before_script:
|
||||
- docker pull quay.io/haraldh/dracut-fedora:$IMAGE
|
||||
- |
|
||||
sudo modprobe kvm-intel nested=1 || :
|
||||
sudo modprobe kvm-amd nested=1 || :
|
||||
dmesg | tail || :
|
||||
- git fetch --tags --unshallow
|
||||
- |
|
||||
git describe --abbrev=0 --tags || :
|
||||
git describe --tags || :
|
||||
|
||||
script:
|
||||
## The test container is created with https://github.com/dracutdevs/fedora-container
|
||||
- docker run --privileged -it -v $(pwd)/:/dracut quay.io/haraldh/dracut-fedora:$IMAGE /dracut/fedora-test.sh $IMAGE-$$ "$TESTS"
|
||||
|
||||
notifications:
|
||||
webhooks:
|
||||
urls:
|
||||
- https://webhooks.gitter.im/e/effa917ca3e0ed5fd00e
|
||||
on_success: change # options: [always|never|change] default: always
|
||||
on_failure: always # options: [always|never|change] default: always
|
||||
on_start: never # options: [always|never|change] default: always
|
||||
|
15
.vimrc
Normal file
15
.vimrc
Normal file
@@ -0,0 +1,15 @@
|
||||
" Vim can use per directory configuration files like this.
|
||||
" To enable that feature two lines are needed in your ~/.vimrc
|
||||
" set exrc " enables per-directory .vimrc files
|
||||
" set secure " disable unsafe commands in local .vimrc files
|
||||
" Characters width is set to 109 for .c and XML but for everything else 79.
|
||||
" If you update this file make sure to update .dir-locals.el & .editorconfig
|
||||
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set expandtab
|
||||
set makeprg=GCC_COLORS=\ make
|
||||
set tw=79
|
||||
au BufRead,BufNewFile *.xml set tw=109 shiftwidth=2 smarttab
|
||||
au FileType sh set tw=80 shiftwidth=4 smarttab
|
||||
au FileType c set tw=109 shiftwidth=8 tabstop=8 smarttab expandtab
|
60
AUTHORS
60
AUTHORS
@@ -1,20 +1,20 @@
|
||||
Harald Hoyer <harald@redhat.com>
|
||||
Victor Lowther <victor.lowther@gmail.com>
|
||||
Jóhann B. Guðmundsson <johannbg@gmail.com>
|
||||
Amadeusz Żołnowski <aidecoe@aidecoe.name>
|
||||
Daniel Molkentin <daniel.molkentin@suse.com>
|
||||
Hannes Reinecke <hare@suse.com>
|
||||
Daniel Molkentin <dmolkentin@suse.com>
|
||||
Will Woods <wwoods@redhat.com>
|
||||
Kairui Song <kasong@redhat.com>
|
||||
Philippe Seewer <philippe.seewer@bfh.ch>
|
||||
Warren Togami <wtogami@redhat.com>
|
||||
Kairui Song <kasong@redhat.com>
|
||||
Dave Young <dyoung@redhat.com>
|
||||
Jeremy Katz <katzj@redhat.com>
|
||||
David Dillow <dave@thedillows.org>
|
||||
Lukas Nykryn <lnykryn@redhat.com>
|
||||
David Dillow <dave@thedillows.org>
|
||||
Lubomir Rintel <lkundrak@v3.sk>
|
||||
Michal Soltys <soltys@ziu.info>
|
||||
Colin Guthrie <colin@mageia.org>
|
||||
Jóhann B. Guðmundsson <johannbg@gmail.com>
|
||||
Amerigo Wang <amwang@redhat.com>
|
||||
Thomas Renninger <trenn@suse.com>
|
||||
Alexander Tsoy <alexander@tsoy.me>
|
||||
@@ -26,34 +26,40 @@ Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Hans de Goede <hdegoede@redhat.com>
|
||||
Jonathan Lebon <jonathan@jlebon.com>
|
||||
Peter Jones <pjones@redhat.com>
|
||||
Andreas Thienemann <andreas@bawue.net>
|
||||
Peter Robinson <pbrobinson@fedoraproject.org>
|
||||
Andreas Thienemann <andreas@bawue.net>
|
||||
Frantisek Sumsal <frantisek@sumsal.cz>
|
||||
Fabian Vogt <fvogt@suse.com>
|
||||
Nicolas Chauvet <kwizart@gmail.com>
|
||||
Zoltán Böszörményi <zboszor@pr.hu>
|
||||
Beniamino Galvani <bgalvani@redhat.com>
|
||||
Colin Walters <walters@verbum.org>
|
||||
John Reiser <jreiser@bitwagon.com>
|
||||
Luca Berra <bluca@vodka.it>
|
||||
Nicolas Chauvet <kwizart@gmail.com>
|
||||
Tomasz Paweł Gajc <tpgxyz@gmail.com>
|
||||
Xunlei Pang <xlpang@redhat.com>
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
Daniel Drake <drake@endlessm.com>
|
||||
Renaud Métrich <rmetrich@redhat.com>
|
||||
Angelo "pallotron" Failla <pallotron@fb.com>
|
||||
Thomas Blume <thomas.blume@suse.com>
|
||||
Ville Skyttä <ville.skytta@iki.fi>
|
||||
Beniamino Galvani <bgalvani@redhat.com>
|
||||
Böszörményi Zoltán <zboszor@pr.hu>
|
||||
Cristian Rodríguez <crrodriguez@opensuse.org>
|
||||
Dan Horák <dhorak@redhat.com>
|
||||
Renaud Métrich <rmetrich@redhat.com>
|
||||
Javier Martinez Canillas <javierm@redhat.com>
|
||||
Ondrej Mosnacek <omosnace@redhat.com>
|
||||
Baoquan He <bhe@redhat.com>
|
||||
Brendan Germain <brendan.germain@nasdaqomx.com>
|
||||
Javier Martinez Canillas <javierm@redhat.com>
|
||||
David Tardon <dtardon@redhat.com>
|
||||
Dusty Mabe <dusty@dustymabe.com>
|
||||
Jonas Witschel <diabonas@gmx.de>
|
||||
Leho Kraav <leho@kraav.com>
|
||||
Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
|
||||
Moritz Maxeiner <moritz@ucworks.org>
|
||||
Nathan Rini <nate@ucar.edu>
|
||||
Ondrej Mosnacek <omosnace@redhat.com>
|
||||
Radek Vykydal <rvykydal@redhat.com>
|
||||
Đoàn Trần Công Danh <congdanhqx@gmail.com>
|
||||
Fabian Deutsch <fabiand@fedoraproject.org>
|
||||
Kamil Rytarowski <n54@gmx.com>
|
||||
Lidong Zhong <lidong.zhong@suse.com>
|
||||
@@ -64,22 +70,17 @@ Peter Rajnoha <prajnoha@redhat.com>
|
||||
Thorsten Behrens <tbehrens@suse.com>
|
||||
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
|
||||
q66 <daniel@octaforge.org>
|
||||
Đoàn Trần Công Danh <congdanhqx@gmail.com>
|
||||
Adam Williamson <awilliam@redhat.com>
|
||||
Chao Wang <chaowang@redhat.com>
|
||||
David Tardon <dtardon@redhat.com>
|
||||
Frederic Crozat <fcrozat@suse.com>
|
||||
James Lee <jlee@thestaticvoid.com>
|
||||
Jesse Keating <jkeating@redhat.com>
|
||||
Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
|
||||
Milan Broz <mbroz@redhat.com>
|
||||
Mimi Zohar <zohar@linux.vnet.ibm.com>
|
||||
Norbert Lange <norbert.lange@andritz.com>
|
||||
Roberto Sassu <roberto.sassu@polito.it>
|
||||
Stefan Reimer <it@startux.de>
|
||||
Takashi Iwai <tiwai@suse.de>
|
||||
Tomasz Paweł Gajc <tpgxyz@gmail.com>
|
||||
tpgxyz <tpgxyz@gmail.com>
|
||||
Adam Williamson <awilliam@redhat.com>
|
||||
Anton Blanchard <anton@samba.org>
|
||||
Bill Nottingham <notting@redhat.com>
|
||||
Chapman Flack <g2@anastigmatix.net>
|
||||
@@ -109,6 +110,7 @@ Wim Muskee <wimmuskee@gmail.com>
|
||||
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
||||
Alan Pevec <apevec@redhat.com>
|
||||
Alex Harpin <development@landsofshadow.co.uk>
|
||||
Alexey Shabalin <shaba@altlinux.org>
|
||||
Ankit Kumar <ankit@linux.vnet.ibm.com>
|
||||
Antony Messerli <amesserl@rackspace.com>
|
||||
Chao Fan <cfan@redhat.com>
|
||||
@@ -117,7 +119,6 @@ Daniel Kahn Gillmor <dkg@fifthhorseman.net>
|
||||
Daniel Schaal <farbing@web.de>
|
||||
Denis Silakov <dsilakov@virtuozzo.com>
|
||||
Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
|
||||
Dusty Mabe <dusty@dustymabe.com>
|
||||
Erwan Velu <erwan.velu@enovance.com>
|
||||
Evgeny Vereshchagin <evvers@ya.ru>
|
||||
Guido Trentalancia <guido@trentalancia.net>
|
||||
@@ -131,14 +132,18 @@ Julian Wolf <juwolf@suse.com>
|
||||
Koen Kooi <koen@dominion.thruhere.net>
|
||||
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Kyle McMartin <kmcmarti@redhat.com>
|
||||
Luiz Angelo Daros de Luca <luizluca@gmail.com>
|
||||
Lukas Wunner <lukas@wunner.de>
|
||||
Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
||||
Marko Myllynen <myllynen@redhat.com>
|
||||
Matthew Thode <mthode@mthode.org>
|
||||
Michal Koutný <mkoutny@suse.com>
|
||||
Mike Snitzer <snitzer@redhat.com>
|
||||
Minfei Huang <mhuang@redhat.com>
|
||||
Nikoli <nikoli@gmx.us>
|
||||
Patrick Talbert <ptalbert@redhat.com>
|
||||
Pedro Monreal <pmgdeb@gmail.com>
|
||||
Petr Pavlu <petr.pavlu@suse.com>
|
||||
Pingfan Liu <piliu@redhat.com>
|
||||
Przemysław Rudy <prudy1@o2.pl>
|
||||
Robert LeBlanc <robert@leblancnet.us>
|
||||
@@ -152,6 +157,7 @@ Vladislav Bogdanov <bubble@hoster-ok.com>
|
||||
Érico Rolim <erico.erc@gmail.com>
|
||||
наб <nabijaczleweli@nabijaczleweli.xyz>
|
||||
A. Wilcox <AWilcox@Wilcox-Tech.com>
|
||||
Adam Alves <adamoa@gmail.com>
|
||||
Alexander Kurtz <alexander@kurtz.be>
|
||||
Alexander Miroshnichenko <alex@millerson.name>
|
||||
Alexander Sosedkin <asosedkin@redhat.com>
|
||||
@@ -159,7 +165,9 @@ Alexander Todorov <atodorov@redhat.com>
|
||||
Alexey Kodanev <alexey.kodanev@oracle.com>
|
||||
Andreas Schwab <schwab@suse.de>
|
||||
Andreas Stieger <astieger@suse.com>
|
||||
Andrew J. Hesford <ajh@sideband.org>
|
||||
Andy Lutomirski <luto@mit.edu>
|
||||
Anjali Kulkarni <anjali.k.kulkarni@oracle.com>
|
||||
Anssi Hannula <anssi@mageia.org>
|
||||
Antz <antzz@protonmail.ch>
|
||||
Arnaud Rebillout <arnaud.rebillout@collabora.com>
|
||||
@@ -177,9 +185,9 @@ Chad Dupuis <chad.dupuis@cavium.com>
|
||||
Christian Heinz <christian.ch.heinz@gmail.com>
|
||||
Cong Wang <amwang@redhat.com>
|
||||
Dan Fuhry <dfuhry@datto.com>
|
||||
Daniel Molkentin <daniel.molkentin@suse.com>
|
||||
Dave Jones <davej@redhat.com>
|
||||
David Disseldorp <ddiss@suse.de>
|
||||
David Hildenbrand <david@redhat.com>
|
||||
David Michael <david.michael@coreos.com>
|
||||
Denis Volkov <denis@simpletexting.net>
|
||||
Dennis Schridde <devurandom@gmx.net>
|
||||
@@ -192,6 +200,7 @@ Enno Boland <g@s01.de>
|
||||
Enzo Matsumiya <ematsumiya@suse.de>
|
||||
Eugene S. Sobolev <sobolev@protei.ru>
|
||||
Eugene Syromiatnikov <esyr@redhat.com>
|
||||
Evgeni Golov <evgeni@golov.de>
|
||||
Fabian Vogt <fvogt@suse.de>
|
||||
Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
|
||||
Florian Gamböck <mail@floga.de>
|
||||
@@ -210,18 +219,22 @@ Ignaz Forster <iforster@suse.com>
|
||||
Jacob Wen <jian.w.wen@oracle.com>
|
||||
James Laska <jlaska@redhat.com>
|
||||
Jan Stodola <jstodola@redhat.com>
|
||||
Jaroslav Jindrak <dzejrou@gmail.com>
|
||||
Jason Dana <jasondana@quarksecurity.com>
|
||||
Jens Heise <46450477+heisej@users.noreply.github.com>
|
||||
Jeremy Linton <lintonrjeremy@gmail.com>
|
||||
Jiri Pirko <jiri@resnulli.us>
|
||||
Joe Lawrence <Joe.Lawrence@stratus.com>
|
||||
Johannes Thumshirn <jthumshirn@suse.com>
|
||||
Jonas Jelten <jj@sft.lol>
|
||||
Jonas Jonsson <jonas@websystem.se>
|
||||
Jonas Witschel <diabonas@archlinux.org>
|
||||
Kevin Yung <Kevin.Yung@myob.com>
|
||||
Lars R. Damerow <lars@pixar.com>
|
||||
Lee Duncan <lduncan@suse.com>
|
||||
Lennart Poettering <lennart@poettering.net>
|
||||
Lennert Buytenhek <buytenh@wantstofly.org>
|
||||
Lev Veyde <lveyde@redhat.com>
|
||||
Lianbo Jiang <lijiang@redhat.com>
|
||||
Lucas C. Villa Real <lucasvr@gmail.com>
|
||||
Major Hayden <major@mhtx.net>
|
||||
@@ -231,7 +244,6 @@ Marian Csontos <mcsontos@redhat.com>
|
||||
Mark Fasheh <mfasheh@suse.de>
|
||||
Matt <smoothsailing72@hotmail.com>
|
||||
Matt Smith <shadowfax@gmx.com>
|
||||
Matthew Thode <mthode@mthode.org>
|
||||
Mei Liu <liumbj@linux.vnet.ibm.com>
|
||||
Michael Chapman <mike@very.puzzling.org>
|
||||
Michael McCracken <michael.mccracken@gmail.com>
|
||||
@@ -241,6 +253,7 @@ Mike Gorse <mgorse@suse.com>
|
||||
Moritz 'Morty' Strübe <morty@gmx.net>
|
||||
Munehiro Matsuda <haro@kgt.co.jp>
|
||||
Nicolas Porcel <nicolasporcel06@gmail.com>
|
||||
Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
|
||||
Olivier Blin <dev@blino.org>
|
||||
Ondrej Dubaj <odubaj@redhat.com>
|
||||
P J P <ppandit@redhat.com>
|
||||
@@ -250,7 +263,7 @@ Pavel Zhukov <pzhukov@redhat.com>
|
||||
Pawel Wieczorkiewicz <pwieczorkiewicz@suse.de>
|
||||
Pekka Wallendahl <wyrmiyu@gmail.com>
|
||||
Peter Georg <peter.georg@physik.uni-regensburg.de>
|
||||
Petr Pavlu <petr.pavlu@suse.com>
|
||||
Peter Levine <plevine457@gmail.com>
|
||||
Petr Tesarik <ptesarik@suse.com>
|
||||
Petr Vorel <pvorel@suse.cz>
|
||||
Prarit Bhargava <prarit@redhat.com>
|
||||
@@ -262,9 +275,11 @@ Ruben Kerkhof <ruben@rubenkerkhof.com>
|
||||
Rumbaut Thomas <Thomas.Rumbaut@digipolis.gent>
|
||||
Rusty Bird <rustybird@openmailbox.org>
|
||||
Sebastian Mitterle <smitterl@redhat.com>
|
||||
Sergei Iudin <tsipa740@gmail.com>
|
||||
Sergey Fionov <fionov@gmail.com>
|
||||
Shawn W Dunn <sfalken@opensuse.org>
|
||||
Srinivasa T N <seenutn@linux.vnet.ibm.com>
|
||||
Stefan Berger <stefanb@linux.ibm.com>
|
||||
Stijn Hoop <stijn@sandcat.nl>
|
||||
Sullivan (CTR), Austin <austin.sullivan.ctr@progeny.net>
|
||||
Thierry Vignaud <thierry.vignaud@gmail.com>
|
||||
@@ -277,10 +292,13 @@ Tomasz Torcz <tomek@pipebreaker.pl>
|
||||
Tong Li <tonli@redhat.com>
|
||||
Vadim Kuznetsov <vadimk@gentoo.org>
|
||||
Vaughan Cao <vaughan.cao@oracle.com>
|
||||
Vladius25 <vkorol2509@icloud.com>
|
||||
Vratislav Podzimek <vpodzime@redhat.com>
|
||||
Yang Liu <50459973+ly4096x@users.noreply.github.com>
|
||||
Yanko Kaneti <yaneti@declera.com>
|
||||
Zhiguo Deng <bjzgdeng@linux.vnet.ibm.com>
|
||||
Ziyue Yang <ziyang@redhat.com>
|
||||
foopub <45460217+foopub@users.noreply.github.com>
|
||||
gaoyi <ymuemc@163.com>
|
||||
honza801 <honza801@gmail.com>
|
||||
jbash aka John Bashinski <jbash@velvet.com>
|
||||
@@ -295,6 +313,6 @@ mulhern <amulhern@redhat.com>
|
||||
mwberry <mwberry@users.noreply.github.com>
|
||||
nabijaczleweli <nabijaczleweli@gmail.com>
|
||||
privb0x23 <privb0x23@users.noreply.github.com>
|
||||
tpg <tpgxyz@gmail.com>
|
||||
realtime-neil <neil@rtr.ai>
|
||||
xtraeme <xtraeme@voidlinux.eu>
|
||||
Дамјан Георгиевски <gdamjan@gmail.com>
|
||||
|
23
HACKING
23
HACKING
@@ -1,23 +0,0 @@
|
||||
Right now, most of the testing is done using a qemu/kvm guest and
|
||||
generating the initramfs on another box but the support is all present
|
||||
to build for the "running" machine. For the former, you can boot the guest
|
||||
using qemu's -kernel and -initrd options.
|
||||
|
||||
dracut exists and will build an image. It is command-line equivalent
|
||||
to most mkinitrd implementations and should be pretty straight-forward
|
||||
to use.
|
||||
|
||||
To use, just run dracut with an output file name and, optionally, a
|
||||
kernel version (it defaults to using the current). The appropriate
|
||||
modules will be copied over and things should be good to go. If you'd
|
||||
like to customize the list of modules copied in, edit /etc/dracut.conf
|
||||
and set
|
||||
dracutmodules="foo bar baz"
|
||||
|
||||
Note that dracut calls functional components in modules.d "modules"
|
||||
while kernel modules are called "drivers".
|
||||
|
||||
Requirements:
|
||||
* udev
|
||||
* nfs module: nfs daemon and rpc helper
|
||||
* iscsi: iscsi
|
165
Makefile
165
Makefile
@@ -9,8 +9,14 @@ ifeq ($(DRACUT_FULL_VERSION),)
|
||||
DRACUT_FULL_VERSION = $(DRACUT_VERSION)
|
||||
endif
|
||||
|
||||
HAVE_SHELLCHECK ?= $(shell which shellcheck >/dev/null 2>&1 && echo yes)
|
||||
HAVE_SHFMT ?= $(shell which shfmt >/dev/null 2>&1 && echo yes)
|
||||
HAVE_RPMBUILD ?= $(shell which rpmbuild >/dev/null 2>&1 && echo yes)
|
||||
|
||||
-include Makefile.inc
|
||||
|
||||
KVERSION ?= $(shell uname -r)
|
||||
|
||||
prefix ?= /usr
|
||||
libdir ?= ${prefix}/lib
|
||||
datadir ?= ${prefix}/share
|
||||
@@ -22,18 +28,16 @@ CFLAGS ?= -O2 -g -Wall -std=gnu99 -D_FILE_OFFSET_BITS=64 -Wformat -Werror=format
|
||||
bashcompletiondir ?= ${datadir}/bash-completion/completions
|
||||
pkgconfigdatadir ?= $(datadir)/pkgconfig
|
||||
|
||||
man1pages = lsinitrd.1
|
||||
man1pages = man/lsinitrd.1
|
||||
|
||||
man5pages = dracut.conf.5
|
||||
man5pages = man/dracut.conf.5
|
||||
|
||||
man7pages = dracut.cmdline.7 \
|
||||
dracut.bootup.7 \
|
||||
dracut.modules.7
|
||||
man7pages = man/dracut.cmdline.7 \
|
||||
man/dracut.bootup.7 \
|
||||
man/dracut.modules.7
|
||||
|
||||
man8pages = dracut.8 \
|
||||
dracut-catimages.8 \
|
||||
mkinitrd.8 \
|
||||
mkinitrd-suse.8 \
|
||||
man8pages = man/dracut.8 \
|
||||
man/dracut-catimages.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 \
|
||||
@@ -45,47 +49,58 @@ man8pages = dracut.8 \
|
||||
|
||||
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
|
||||
|
||||
.PHONY: install clean archive rpm srpm testimage test all check AUTHORS doc dracut-version.sh
|
||||
.PHONY: install clean archive rpm srpm testimage test all check AUTHORS CONTRIBUTORS doc dracut-version.sh
|
||||
|
||||
all: dracut-version.sh dracut.pc dracut-install skipcpio/skipcpio
|
||||
all: dracut-version.sh dracut.pc dracut-install src/skipcpio/skipcpio dracut-util
|
||||
|
||||
%.o : %.c
|
||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(KMOD_CFLAGS) $< -o $@
|
||||
|
||||
DRACUT_INSTALL_OBJECTS = \
|
||||
install/dracut-install.o \
|
||||
install/hashmap.o\
|
||||
install/log.o \
|
||||
install/strv.o \
|
||||
install/util.o
|
||||
src/install/dracut-install.o \
|
||||
src/install/hashmap.o\
|
||||
src/install/log.o \
|
||||
src/install/strv.o \
|
||||
src/install/util.o
|
||||
|
||||
# deps generated with gcc -MM
|
||||
install/dracut-install.o: install/dracut-install.c install/log.h install/macro.h \
|
||||
install/hashmap.h install/util.h
|
||||
install/hashmap.o: install/hashmap.c install/util.h install/macro.h install/log.h \
|
||||
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
|
||||
src/install/dracut-install.o: src/install/dracut-install.c src/install/log.h src/install/macro.h \
|
||||
src/install/hashmap.h src/install/util.h
|
||||
src/install/hashmap.o: src/install/hashmap.c src/install/util.h src/install/macro.h src/install/log.h \
|
||||
src/install/hashmap.h
|
||||
src/install/log.o: src/install/log.c src/install/log.h src/install/macro.h src/install/util.h
|
||||
src/install/util.o: src/install/util.c src/install/util.h src/install/macro.h src/install/log.h
|
||||
src/install/strv.o: src/install/strv.c src/install/strv.h src/install/util.h src/install/macro.h src/install/log.h
|
||||
|
||||
install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
|
||||
src/install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
|
||||
$(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(FTS_LIBS) $(KMOD_LIBS)
|
||||
|
||||
logtee: logtee.c
|
||||
logtee: src/logtee/logtee.c
|
||||
$(CC) $(LDFLAGS) -o $@ $<
|
||||
|
||||
dracut-install: install/dracut-install
|
||||
dracut-install: src/install/dracut-install
|
||||
ln -fs $< $@
|
||||
|
||||
SKIPCPIO_OBJECTS= \
|
||||
skipcpio/skipcpio.o
|
||||
SKIPCPIO_OBJECTS = src/skipcpio/skipcpio.o
|
||||
skipcpio/skipcpio.o: src/skipcpio/skipcpio.c
|
||||
skipcpio/skipcpio: $(SKIPCPIO_OBJECTS)
|
||||
|
||||
skipcpio/skipcpio.o: skipcpio/skipcpio.c
|
||||
skipcpio/skipcpio: skipcpio/skipcpio.o
|
||||
UTIL_OBJECTS = src/util/util.o
|
||||
util/util.o: src/util/util.c
|
||||
util/util: $(UTIL_OBJECTS)
|
||||
|
||||
indent:
|
||||
indent -i8 -nut -br -linux -l120 install/dracut-install.c
|
||||
indent -i8 -nut -br -linux -l120 skipcpio/skipcpio.c
|
||||
dracut-util: src/util/util
|
||||
cp -a $< $@
|
||||
|
||||
.PHONY: indent-c
|
||||
indent-c:
|
||||
astyle -n --quiet --options=.astylerc $(wildcard *.[ch] */*.[ch] src/*/*.[ch])
|
||||
|
||||
.PHONY: indent
|
||||
indent: indent-c
|
||||
ifeq ($(HAVE_SHFMT),yes)
|
||||
shfmt -w -s .
|
||||
endif
|
||||
|
||||
doc: $(manpages) dracut.html
|
||||
|
||||
@@ -101,17 +116,18 @@ endif
|
||||
@rm -f -- "$@"
|
||||
asciidoc -a "version=$(DRACUT_FULL_VERSION)" -d manpage -b docbook -o "$@" $<
|
||||
|
||||
dracut.8: dracut.usage.asc dracut.8.asc
|
||||
dracut.8: man/dracut.8.asc \
|
||||
man/dracut.usage.asc
|
||||
|
||||
dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc
|
||||
dracut.html: man/dracut.asc $(manpages) docs/dracut.css man/dracut.usage.asc
|
||||
@rm -f -- dracut.xml
|
||||
asciidoc -a "mainversion=$(DRACUT_MAIN_VERSION)" \
|
||||
-a "version=$(DRACUT_FULL_VERSION)" \
|
||||
-a numbered \
|
||||
-d book -b docbook -o dracut.xml dracut.asc
|
||||
-d book -b docbook -o dracut.xml man/dracut.asc
|
||||
@rm -f -- dracut.html
|
||||
xsltproc -o dracut.html --xinclude -nonet \
|
||||
--stringparam custom.css.source dracut.css \
|
||||
--stringparam custom.css.source docs/dracut.css \
|
||||
--stringparam generate.css.header 1 \
|
||||
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
|
||||
@rm -f -- dracut.xml
|
||||
@@ -132,7 +148,6 @@ install: all
|
||||
mkdir -p $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man5 $(DESTDIR)$(mandir)/man7 $(DESTDIR)$(mandir)/man8
|
||||
install -m 0755 dracut.sh $(DESTDIR)$(bindir)/dracut
|
||||
install -m 0755 dracut-catimages.sh $(DESTDIR)$(bindir)/dracut-catimages
|
||||
install -m 0755 mkinitrd-dracut.sh $(DESTDIR)$(bindir)/mkinitrd
|
||||
install -m 0755 lsinitrd.sh $(DESTDIR)$(bindir)/lsinitrd
|
||||
install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
|
||||
@@ -172,24 +187,27 @@ endif
|
||||
$(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants/$$i; \
|
||||
done \
|
||||
fi
|
||||
if [ -f install/dracut-install ]; then \
|
||||
install -m 0755 install/dracut-install $(DESTDIR)$(pkglibdir)/dracut-install; \
|
||||
if [ -f src/install/dracut-install ]; then \
|
||||
install -m 0755 src/install/dracut-install $(DESTDIR)$(pkglibdir)/dracut-install; \
|
||||
fi
|
||||
if [ -f skipcpio/skipcpio ]; then \
|
||||
install -m 0755 skipcpio/skipcpio $(DESTDIR)$(pkglibdir)/skipcpio; \
|
||||
if [ -f src/skipcpio/skipcpio ]; then \
|
||||
install -m 0755 src/skipcpio/skipcpio $(DESTDIR)$(pkglibdir)/skipcpio; \
|
||||
fi
|
||||
if [ -f dracut-util ]; then \
|
||||
install -m 0755 dracut-util $(DESTDIR)$(pkglibdir)/dracut-util; \
|
||||
fi
|
||||
mkdir -p $(DESTDIR)${prefix}/lib/kernel/install.d
|
||||
install -m 0755 50-dracut.install $(DESTDIR)${prefix}/lib/kernel/install.d/50-dracut.install
|
||||
install -m 0755 51-dracut-rescue.install $(DESTDIR)${prefix}/lib/kernel/install.d/51-dracut-rescue.install
|
||||
install -m 0755 install.d/50-dracut.install $(DESTDIR)${prefix}/lib/kernel/install.d/50-dracut.install
|
||||
install -m 0755 install.d/51-dracut-rescue.install $(DESTDIR)${prefix}/lib/kernel/install.d/51-dracut-rescue.install
|
||||
mkdir -p $(DESTDIR)${bashcompletiondir}
|
||||
install -m 0644 dracut-bash-completion.sh $(DESTDIR)${bashcompletiondir}/dracut
|
||||
install -m 0644 lsinitrd-bash-completion.sh $(DESTDIR)${bashcompletiondir}/lsinitrd
|
||||
install -m 0644 shell-completion/bash/dracut $(DESTDIR)${bashcompletiondir}/dracut
|
||||
install -m 0644 shell-completion/bash/lsinitrd $(DESTDIR)${bashcompletiondir}/lsinitrd
|
||||
mkdir -p $(DESTDIR)${pkgconfigdatadir}
|
||||
install -m 0644 dracut.pc $(DESTDIR)${pkgconfigdatadir}/dracut.pc
|
||||
|
||||
dracut-version.sh:
|
||||
@rm -f dracut-version.sh
|
||||
@echo "DRACUT_VERSION=$(DRACUT_FULL_VERSION)" > dracut-version.sh
|
||||
@printf "#!/bin/sh\n# shellcheck disable=SC2034\nDRACUT_VERSION=%s\n" "$(DRACUT_FULL_VERSION)" > dracut-version.sh
|
||||
|
||||
clean:
|
||||
$(RM) *~
|
||||
@@ -199,9 +217,11 @@ clean:
|
||||
$(RM) test-*.img
|
||||
$(RM) dracut-*.rpm dracut-*.tar.bz2 dracut-*.tar.xz
|
||||
$(RM) dracut-version.sh
|
||||
$(RM) dracut-install install/dracut-install $(DRACUT_INSTALL_OBJECTS)
|
||||
$(RM) dracut-install src/install/dracut-install $(DRACUT_INSTALL_OBJECTS)
|
||||
$(RM) skipcpio/skipcpio $(SKIPCPIO_OBJECTS)
|
||||
$(RM) dracut-util util/util $(UTIL_OBJECTS)
|
||||
$(RM) $(manpages) dracut.html
|
||||
$(RM) dracut.pc
|
||||
$(MAKE) -C test clean
|
||||
|
||||
dist: dracut-$(DRACUT_MAIN_VERSION).tar.xz
|
||||
@@ -216,10 +236,11 @@ dracut-$(DRACUT_MAIN_VERSION).tar.xz: doc syncheck
|
||||
xz -9 dracut-$(DRACUT_MAIN_VERSION).tar
|
||||
rm -f -- dracut-$(DRACUT_MAIN_VERSION).tar
|
||||
|
||||
ifeq ($(HAVE_RPMBUILD),yes)
|
||||
rpm: dracut-$(DRACUT_MAIN_VERSION).tar.xz syncheck
|
||||
rpmbuild=$$(mktemp -d -p /var/tmp rpmbuild-dracut.XXXXXX); src=$$(pwd); \
|
||||
cp dracut-$(DRACUT_MAIN_VERSION).tar.xz "$$rpmbuild"; \
|
||||
LC_MESSAGES=C $$src/git2spec.pl $(DRACUT_MAIN_VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
|
||||
LC_MESSAGES=C $$src/tools/git2spec.pl $(DRACUT_MAIN_VERSION) "$$rpmbuild" < pkgbuild/dracut.spec > $$rpmbuild/dracut.spec; \
|
||||
(cd "$$rpmbuild"; \
|
||||
wget https://www.gnu.org/licenses/lgpl-2.1.txt; \
|
||||
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
|
||||
@@ -230,13 +251,18 @@ rpm: dracut-$(DRACUT_MAIN_VERSION).tar.xz syncheck
|
||||
srpm: dracut-$(DRACUT_MAIN_VERSION).tar.xz syncheck
|
||||
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
|
||||
cp dracut-$(DRACUT_MAIN_VERSION).tar.xz "$$rpmbuild"; \
|
||||
LC_MESSAGES=C $$src/git2spec.pl $(DRACUT_MAIN_VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
|
||||
LC_MESSAGES=C $$src/tools/git2spec.pl $(DRACUT_MAIN_VERSION) "$$rpmbuild" < pkgbuild/dracut.spec > $$rpmbuild/dracut.spec; \
|
||||
(cd "$$rpmbuild"; \
|
||||
[ -f $$src/lgpl-2.1.txt ] && cp $$src/lgpl-2.1.txt . || 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" -bs dracut.spec; ) && \
|
||||
( mv "$$rpmbuild"/*.src.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
|
||||
else
|
||||
.PHONY: rpm srpm
|
||||
rpm: syncheck
|
||||
srpm: syncheck
|
||||
endif
|
||||
|
||||
syncheck:
|
||||
@ret=0;for i in dracut-initramfs-restore.sh modules.d/*/*.sh; do \
|
||||
@@ -246,44 +272,53 @@ syncheck:
|
||||
[ $$V ] && echo "checking for [[: $$i"; if grep -Fq '[[ ' "$$i" ; then ret=$$(($$ret+1)); echo "$$i contains [["; fi; \
|
||||
[ $$V ] && echo "checking for echo -n: $$i"; if grep -Fq 'echo -n ' "$$i" ; then ret=$$(($$ret+1)); echo "$$i contains echo -n"; fi \
|
||||
done;exit $$ret
|
||||
@ret=0;for i in *.sh mkinitrd-dracut.sh modules.d/*/*.sh \
|
||||
modules.d/*/module-setup.sh; do \
|
||||
@ret=0;for i in *.sh modules.d/*/*.sh modules.d/*/module-setup.sh; do \
|
||||
[ $$V ] && echo "bash syntax check: $$i"; bash -n "$$i" ; ret=$$(($$ret+$$?)); \
|
||||
done;exit $$ret
|
||||
ifeq ($(HAVE_SHELLCHECK),yes)
|
||||
ifeq ($(HAVE_SHFMT),yes)
|
||||
shellcheck $$(shfmt -f .)
|
||||
else
|
||||
find . -name '*.sh' -print0 | xargs -0 shellcheck
|
||||
endif
|
||||
endif
|
||||
|
||||
check: all syncheck rpm
|
||||
@[ "$$EUID" == "0" ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; }
|
||||
@$(MAKE) -C test check
|
||||
|
||||
testimage: all
|
||||
./dracut.sh -N -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
|
||||
@echo wrote test-$(shell uname -r).img
|
||||
./dracut.sh -N -l -a debug -f test-$(KVERSION).img $(KVERSION)
|
||||
@echo wrote test-$(KVERSION).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
|
||||
./dracut.sh --debug -l -a debug -f test-$(KVERSION).img $(KVERSION)
|
||||
@echo wrote test-$(KVERSION).img
|
||||
|
||||
testimages: all
|
||||
./dracut.sh -l -a debug --kernel-only -f test-kernel-$(shell uname -r).img $(shell uname -r)
|
||||
@echo wrote test-$(shell uname -r).img
|
||||
./dracut.sh -l -a debug --no-kernel -f test-dracut.img $(shell uname -r)
|
||||
./dracut.sh -l -a debug --kernel-only -f test-kernel-$(KVERSION).img $(KVERSION)
|
||||
@echo wrote test-$(KVERSION).img
|
||||
./dracut.sh -l -a debug --no-kernel -f test-dracut.img $(KVERSION)
|
||||
@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
|
||||
./dracut.sh --debug -H -l -f test-$(KVERSION).img $(KVERSION)
|
||||
@echo wrote test-$(KVERSION).img
|
||||
|
||||
hostimage: all
|
||||
./dracut.sh -H -l -f test-$(shell uname -r).img $(shell uname -r)
|
||||
@echo wrote test-$(shell uname -r).img
|
||||
./dracut.sh -H -l -f test-$(KVERSION).img $(KVERSION)
|
||||
@echo wrote test-$(KVERSION).img
|
||||
|
||||
efi: all
|
||||
./dracut.sh --uefi -H -l -f linux-$(shell uname -r).efi $(shell uname -r)
|
||||
@echo wrote linux-$(shell uname -r).efi
|
||||
./dracut.sh --uefi -H -l -f linux-$(KVERSION).efi $(KVERSION)
|
||||
@echo wrote linux-$(KVERSION).efi
|
||||
|
||||
AUTHORS:
|
||||
git shortlog --numbered --summary -e |while read a rest || [ -n "$$rest" ]; do echo $$rest;done > AUTHORS
|
||||
|
||||
CONTRIBUTORS:
|
||||
@git shortlog $(DRACUT_MAIN_VERSION).. --numbered --summary -e |while read a rest || [ -n "$$rest" ]; do echo "- $$rest";done
|
||||
|
||||
dracut.html.sign: dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut.html
|
||||
gpg-sign-all dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut.html
|
||||
|
||||
|
316
NEWS → NEWS.md
316
NEWS → NEWS.md
@@ -1,3 +1,319 @@
|
||||
[Rendered view](https://github.com/dracutdevs/dracut/blob/master/NEWS.md)
|
||||
|
||||
dracut-054
|
||||
==========
|
||||
|
||||
With this release dracut has undergone a major overhaul.
|
||||
|
||||
A lot of systemd related modules have been added.
|
||||
|
||||
The integration test suite has finally ironed out the flaky behaviour due to the parallel device probing of the kernel,
|
||||
which bit sometimes in the non-kvm github CI. So, if you see any `/dev/sda` in a setup script with more than two hard drives,
|
||||
chances are, that the script works on the wrong disk. Same goes for network interfaces.
|
||||
|
||||
This release is also fully `shellcheck`'ed with `ShellCheck-0.7.2` and indented with `shfmt` and `astyle`.
|
||||
|
||||
The dracut project builds test containers every day for:
|
||||
* `opensuse/tumbleweed-dnf:latest`
|
||||
* `archlinux:latest`
|
||||
* `fedora:rawhide`
|
||||
* `fedora:latest`
|
||||
* `fedora:33`
|
||||
|
||||
These containers can easily be used to run the integration tests locally without root permissions via `podman`.
|
||||
We hope this serves as a blueprint for your distribution's CI process.
|
||||
|
||||
More information can be found in [docs/HACKING.md](https://github.com/dracutdevs/dracut/blob/master/HACKING.md).
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
* make testsuite pass on OpenSuse and Arch ([8b2afb08](https://github.com/dracutdevs/dracut/commit/8b2afb08baea7fc6e15ece94e287dcc4a008bcc4))
|
||||
* cope with distributions with `/usr/etc` files ([3ad3b3a4](https://github.com/dracutdevs/dracut/commit/3ad3b3a40d419c4386b2924f6ac25ab0c355d131))
|
||||
* deprecate gummiboot ([5c94cf41](https://github.com/dracutdevs/dracut/commit/5c94cf41e8937b6fbb72c96bc54c84fdf224c711))
|
||||
* set vimrc and emacs indention according to .editorconfig ([9012f399](https://github.com/dracutdevs/dracut/commit/9012f3996b1e5f0788f8e80dfdd5c9ab0636c355))
|
||||
* correctly handle kernel parameters ([501d82f7](https://github.com/dracutdevs/dracut/commit/501d82f79675a6bf9b37e8250152515863a80236))
|
||||
* remove dracut.pc on `make clean` ([d643156d](https://github.com/dracutdevs/dracut/commit/d643156d561d3aca816d75e403149db073617292))
|
||||
* honor KVERSION environment in the Makefile ([d8a454a5](https://github.com/dracutdevs/dracut/commit/d8a454a537c6de95033dec7d83c622fdc46c2a4f))
|
||||
* always use mkdir -p ([9cf7b1c5](https://github.com/dracutdevs/dracut/commit/9cf7b1c529442d5abd6eaec4399d4ee77b95145e))
|
||||
* **dracut.sh:**
|
||||
* prevent symbolic links containing `//` ([de0c0872](https://github.com/dracutdevs/dracut/commit/de0c0872fc858fa9ca952f79ea9f00be17c37a4c))
|
||||
* adding missing globalvars for udev ([f35d479d](https://github.com/dracutdevs/dracut/commit/f35d479d2b718da54886a66d3b7af2132215f80a))
|
||||
* sysctl global variables ([3ca9aa1d](https://github.com/dracutdevs/dracut/commit/3ca9aa1d7b24b82e01d16613b86ec3be97c8a1bb))
|
||||
* add global vars for modules-load ([ec4539c6](https://github.com/dracutdevs/dracut/commit/ec4539c6066edf25e52ed8e2d35c4be7ef39f729))
|
||||
* omission is an addition to other omissions in conf files ([96c31333](https://github.com/dracutdevs/dracut/commit/96c313333d1a4f5e2c524a3a11c5b3aab24afc20))
|
||||
* harden dracut against GZIP environment variable ([d8e47e20](https://github.com/dracutdevs/dracut/commit/d8e47e201af4646e2a82e11220ea9c993bd2ed48))
|
||||
* add a missing tmpfilesconfdir global variable ([8849dd8d](https://github.com/dracutdevs/dracut/commit/8849dd8d1a74a46cb761c4d8041e4582d4686724))
|
||||
* include `modules.builtin.alias` in the initramfs ([7f633747](https://github.com/dracutdevs/dracut/commit/7f6337471312486934f9592c1c7c05ed68694454))
|
||||
* install all depmod relevant configuration files ([50a01dd4](https://github.com/dracutdevs/dracut/commit/50a01dd4b28471c0dfa810a705e219963bd5ec3c))
|
||||
* add `modules.builtin.modinfo` to the initramfs ([87c4c178](https://github.com/dracutdevs/dracut/commit/87c4c17850e8bb982f6c07a6d3f58124bb2875de))
|
||||
* search for btrfs devices from actual mount poiont ([3fdc734a](https://github.com/dracutdevs/dracut/commit/3fdc734a5cc8c0b94c1da49439181d540c8a5c43))
|
||||
* **dracut-functions.sh:**
|
||||
* implement a cache for get_maj_min ([c3bb9d18](https://github.com/dracutdevs/dracut/commit/c3bb9d18dceed7db6d16f9c2a7f682c5934099d7))
|
||||
* word splitting issue for sed in get_ucode_file ([122657b2](https://github.com/dracutdevs/dracut/commit/122657b2fedf13991597830cca4d4ddbc8038233))
|
||||
* **dracut-logger.sh:** double dash trigger unknown logger warnings during run ([4fbccde5](https://github.com/dracutdevs/dracut/commit/4fbccde50456f513d388cdfd858018cd889890dc))
|
||||
* **dracut-install:**
|
||||
* handle $LIB in ldd output parsing ([d1a36d3d](https://github.com/dracutdevs/dracut/commit/d1a36d3d80b0ed71ee814659e18a020c53cee05e))
|
||||
* handle builtin modules ([2536a9ea](https://github.com/dracutdevs/dracut/commit/2536a9eaffbc9cc14c85579a2f537d3f3a1d5659))
|
||||
* **base:**
|
||||
* suppress calls to getarg in build phase ([6feaaabc](https://github.com/dracutdevs/dracut/commit/6feaaabc221ffbf79f652cbee3eea58f02449c50))
|
||||
* source hooks without exec ([8059bcb2](https://github.com/dracutdevs/dracut/commit/8059bcb2c8df4d60cc2f548d3c53db25d815a7be))
|
||||
* wait_for_dev quote shell variables ([b800edd6](https://github.com/dracutdevs/dracut/commit/b800edd69817b5e46d5f240b96d3b3648267ea21))
|
||||
* adding crc32c for ext3 ([61f45643](https://github.com/dracutdevs/dracut/commit/61f456435879f084a1bf2c8885eaf37070035abf))
|
||||
* **crypt:**
|
||||
* install all crypto modules in the generic initrd ([10f9e569](https://github.com/dracutdevs/dracut/commit/10f9e569c52654ff54678a626a0f5dd14233716d))
|
||||
* include cryptsetups tmpfile ([a4cc1964](https://github.com/dracutdevs/dracut/commit/a4cc196467e45f093fab7876c1c6b40798058920))
|
||||
* **crypt-gpg:**
|
||||
* cope with different scdaemon location ([44fd1c13](https://github.com/dracutdevs/dracut/commit/44fd1c13555f2e12bb566c246948629ada27d14d))
|
||||
* **dbus-broker:**
|
||||
* enable the service ([df1e5f06](https://github.com/dracutdevs/dracut/commit/df1e5f06a5449dcec6749baf742eac6eb1f0aa53))
|
||||
* **dbus-daemon:**
|
||||
* only error out in install() ([ae4fbb3d](https://github.com/dracutdevs/dracut/commit/ae4fbb3db4136e6e03a1c74d05ecc2a73b916401))
|
||||
* **dracut-systemd:**
|
||||
* don't refuse root=tmpfs when systemd is used ([a96900a8](https://github.com/dracutdevs/dracut/commit/a96900a82c3a8ec1ed2c6b2cc8862f912093fa0c))
|
||||
* **examples:** remove the examples directory and reference to it ([b37c90c8](https://github.com/dracutdevs/dracut/commit/b37c90c8e00155a1f31237ae6cf91a81677c4df5))
|
||||
* **fips:**
|
||||
* add dh and ecdh ciphers ([543b8014](https://github.com/dracutdevs/dracut/commit/543b8014fc10fc6a92ba83db0dfc994fc1d2129b))
|
||||
* remove old udev version requirements ([be30d987](https://github.com/dracutdevs/dracut/commit/be30d98751cff4ace660215305e2468943a45754))
|
||||
* **i18n:**
|
||||
* skip if data is missing ([651fe01e](https://github.com/dracutdevs/dracut/commit/651fe01e7937d86bbd471d9621581bed44f23dfa))
|
||||
* **img-lib:**
|
||||
* ignored null byte in input ([85eb9680](https://github.com/dracutdevs/dracut/commit/85eb96802cb82ec179bd3bc429b0dad2518946c5))
|
||||
* **integrity:**
|
||||
* properly set up EVM when using an x509 cert ([4bdd7eb2](https://github.com/dracutdevs/dracut/commit/4bdd7eb23a8187c3f19797e47eee8c672cea33ae))
|
||||
* **iscsi:**
|
||||
* replace sed call with bash internals ([66b920c6](https://github.com/dracutdevs/dracut/commit/66b920c65143f4cac80385a51704ae9483305569))
|
||||
* add iscsid.service requirements ([bb6770f1](https://github.com/dracutdevs/dracut/commit/bb6770f1a413bdc7fd570b260ee28ace1255a195))
|
||||
* only rely on socket activiation ([0eb87d78](https://github.com/dracutdevs/dracut/commit/0eb87d78108aae9aa4692f1edfb33ded50e26409))
|
||||
* **kernel-modules:**
|
||||
* optionally add /usr/lib/modules.d to initramfs ([92e6a8f8](https://github.com/dracutdevs/dracut/commit/92e6a8f87914322994387e559cf2a00b1760b301))
|
||||
* add watchdog drivers for generic initrd ([3a60c036](https://github.com/dracutdevs/dracut/commit/3a60c036db7caccda95475d33c8d4ce1f615d2c8))
|
||||
* **mdraid:**
|
||||
* remove dependency statements ([86b75634](https://github.com/dracutdevs/dracut/commit/86b756346a6b7c5cb5f6fda4d12e2a58b6144e40))
|
||||
* **memstrack:**
|
||||
* correct dependencies ([c2ecc4d1](https://github.com/dracutdevs/dracut/commit/c2ecc4d131876383b47820a2e8d1a6f8a11716d9))
|
||||
* **multipath:**
|
||||
* stop multipath before udev db cleanup ([3c244c7c](https://github.com/dracutdevs/dracut/commit/3c244c7ca3555b526883dc20104c469b39085cbe))
|
||||
* revise multipathd-stop ([7b8c78ff](https://github.com/dracutdevs/dracut/commit/7b8c78ff43a1f8e3690969e980d3d9d1dcb00c87))
|
||||
* **nbd:**
|
||||
* assume nbd version >= 3.8 ([6209edeb](https://github.com/dracutdevs/dracut/commit/6209edeb5c7783d94867829bf052aa53c78a1efe))
|
||||
* remove old udev version requirements ([fd15dbad](https://github.com/dracutdevs/dracut/commit/fd15dbad6ebad86a3753a03f98706010f3e36cf7))
|
||||
* make nbd work again with systemd ([77906443](https://github.com/dracutdevs/dracut/commit/7790644362622097aa69107920fd26b688c855d3))
|
||||
* **network:**
|
||||
* use wicked unit instead of find_binary ([57eefcf7](https://github.com/dracutdevs/dracut/commit/57eefcf70587f06b8874a3b3cf31e9ab70c03227))
|
||||
* user variable for sdnetworkd instead of path ([4982e16d](https://github.com/dracutdevs/dracut/commit/4982e16dd53dcbbcfbd3a6b59013a0d6f893f840))
|
||||
* correct regression in iface_has_carrier ([36af0518](https://github.com/dracutdevs/dracut/commit/36af0518b3fe59442de206c24bbe03be6fc17095))
|
||||
* **network-legacy:**
|
||||
* add missing options to dhclient.conf ([abfd547a](https://github.com/dracutdevs/dracut/commit/abfd547a85230a4520df65280aaf195f319df464))
|
||||
* silence getargs ([60a34d8b](https://github.com/dracutdevs/dracut/commit/60a34d8b11dd50b2cd4e0e2208bd7c5e0fc48b71))
|
||||
* **network-manager:**
|
||||
* cope with distributions not using `libexec` ([22d6863e](https://github.com/dracutdevs/dracut/commit/22d6863ef1b2eb2a22264f2bfdb2b9329ab5dfdb))
|
||||
* set timeout via command line option ([8a51ee1f](https://github.com/dracutdevs/dracut/commit/8a51ee1fa61bd3da342be53e35730837afd2caad))
|
||||
* run after dracut-cmdline ([4d03404f](https://github.com/dracutdevs/dracut/commit/4d03404f499064b354a58223895cc47dbb461da5))
|
||||
* create /run directories ([49b61496](https://github.com/dracutdevs/dracut/commit/49b614961dc8684f8512febbf80da489909e4b7f))
|
||||
* use /run/NetworkManager/initrd/neednet in initqueue ([6a37c6f6](https://github.com/dracutdevs/dracut/commit/6a37c6f6302f950df608db3fd45acf9342ee3de2))
|
||||
* only run NetworkManager if rd.neednet=1 ([ac0e8f7d](https://github.com/dracutdevs/dracut/commit/ac0e8f7dcc81432311906c3fca0d4211f6a2f68c))
|
||||
* nm-run.service: don't kill forked processes ([1f21fac6](https://github.com/dracutdevs/dracut/commit/1f21fac646daa46cbe184ef8ff7705842f06ba15))
|
||||
* no default deps for nm-run.service ([ba4bcf5f](https://github.com/dracutdevs/dracut/commit/ba4bcf5f4f11ad624c647ddf4f566997186135e7))
|
||||
* nm-lib.sh does not require bash ([3402142e](https://github.com/dracutdevs/dracut/commit/3402142e344298c8f20fc52a2b064344788f1668))
|
||||
* **squash:**
|
||||
* post install should be the last step before stripping ([8c8aecdc](https://github.com/dracutdevs/dracut/commit/8c8aecdc63c9389038e78ee712d4809e49add5e1))
|
||||
* **systemd:**
|
||||
* include all nss libraries ([b3bbf5fb](https://github.com/dracutdevs/dracut/commit/b3bbf5fb6a95cfb69272da0711b5c5e0c6621de9))
|
||||
* include hosts and nsswitch.conf in hostonly mode ([5912f4fb](https://github.com/dracutdevs/dracut/commit/5912f4fbc036cc36b9507c16dddef1ded1556572))
|
||||
* remove old systemd version requirements ([fc53987b](https://github.com/dracutdevs/dracut/commit/fc53987bec1bc71b054d99072f62c1770a44bcca))
|
||||
* **systemd-hostnamed:** extra quote ([2aa65234](https://github.com/dracutdevs/dracut/commit/2aa652349ca83198581cccb516a241a8d0e1b4d9))
|
||||
* **systemd-modules:** remove dependency on systemd meta module ([afef4557](https://github.com/dracutdevs/dracut/commit/afef455718db69cff3797ca1a6d8bfebd2e86ab3))
|
||||
* **systemd-modules-load:**
|
||||
* misc repairs ([782ac8f1](https://github.com/dracutdevs/dracut/commit/782ac8f1f6b68edfe59630e9e4ac1673636f3a5e))
|
||||
* **systemd-networkd:**
|
||||
* make systemd-networkd a proper network provider ([ea779750](https://github.com/dracutdevs/dracut/commit/ea779750c371102c04252b48f1b7d9c7ece7cf93), closes [#737](https://github.com/dracutdevs/dracut/issues/737))
|
||||
* **systemd-resolved:** remove nss libraries ([12bef83c](https://github.com/dracutdevs/dracut/commit/12bef83cdaf329e3ee2cc1f282bd9c128ec0fc56))
|
||||
* **systemd-sysctl:**
|
||||
* sysctl global variables ([02acedd0](https://github.com/dracutdevs/dracut/commit/02acedd09eb7222eaaf0f5256f3ddec26d658360))
|
||||
* **systemd-sysusers:**
|
||||
* misc fixes and cleanup ([7359ba8a](https://github.com/dracutdevs/dracut/commit/7359ba8acab2652cfff6b845f84a936cdec30f9d))
|
||||
* **systemd-udev:** use global vars instead of fixed path ([fd883a58](https://github.com/dracutdevs/dracut/commit/fd883a58d1360f0c6c32f64462fafdd7a54af1ee))
|
||||
* **systemd-udevd:** add udev id program files ([562cb77b](https://github.com/dracutdevs/dracut/commit/562cb77b5a28e3f31bc6d327c7712fba661e9a27))
|
||||
* **systemd-verity:**
|
||||
* incorrect reference to cryptsetup target ([ba92d1fc](https://github.com/dracutdevs/dracut/commit/ba92d1fcad68758004d7b1102fe1905c0f25e63e))
|
||||
* re-naming module to veritysetup ([0267f3c3](https://github.com/dracutdevs/dracut/commit/0267f3c3554efd8f027afaf462347167402f5d6c))
|
||||
* **tpm2-tss:** add tpm2 requirement ([8f99fada](https://github.com/dracutdevs/dracut/commit/8f99fadabea8f279a9fe28473dba424eb38f8d60))
|
||||
* **udev-rules:**
|
||||
* remove sourcing of network link files ([69f4e7cd](https://github.com/dracutdevs/dracut/commit/69f4e7cdc3f7da24e40496b0b2f0f5022cc3376d))
|
||||
* add btrfs udev rules by default ([567c4557](https://github.com/dracutdevs/dracut/commit/567c4557537fe7f477f0f54237df00ebc79e56be))
|
||||
* **url-lib:**
|
||||
* fix passing args ([5f6be515](https://github.com/dracutdevs/dracut/commit/5f6be51595eab878314d031d9bfebe844b639302))
|
||||
* **zipl:**
|
||||
* don't depend on grub2 ([6b499ec1](https://github.com/dracutdevs/dracut/commit/6b499ec14b3ff35d5298617b436b64563a2d8c2f))
|
||||
|
||||
#### Performance
|
||||
|
||||
* disable initrd compression when squash module is enabled ([7c0bc0b2](https://github.com/dracutdevs/dracut/commit/7c0bc0b2fd167da42035020dae49af94844f053c))
|
||||
|
||||
#### Features
|
||||
|
||||
* support ZSTD-compressed kernel modules ([ce9af251](https://github.com/dracutdevs/dracut/commit/ce9af251af5fca08ea206ef980005853a4dac36e))
|
||||
* also restore the initramfs from /lib/modules ([33e27fab](https://github.com/dracutdevs/dracut/commit/33e27fab59db60b1ca05a0c5b8a51fccb98578e5))
|
||||
* extend Makefile indent target ([e0a0fa61](https://github.com/dracutdevs/dracut/commit/e0a0fa61749152fd5bc837770a02cf22d7e02d40))
|
||||
* customize .editorconfig according to shfmt ([1f621aba](https://github.com/dracutdevs/dracut/commit/1f621aba3728a621b83b3b697eae6caadae9d287))
|
||||
* squash module follow --compress option ([5d05ffbd](https://github.com/dracutdevs/dracut/commit/5d05ffbd87bc27e27f517ebc3454d50729c687e6))
|
||||
* **bluetooth:** implement bluetooth support in initrd ([64ee2a53](https://github.com/dracutdevs/dracut/commit/64ee2a53864576fbedabe6b18fb9aae01b999199))
|
||||
* **btrfs:** add 64-btrfs-dm.rules rules ([d4caa86a](https://github.com/dracutdevs/dracut/commit/d4caa86aba35b51dc1adda3ee3a5bae677420082))
|
||||
* **mkinitrd:** remove mkinitrd ([43df4ee2](https://github.com/dracutdevs/dracut/commit/43df4ee274e7135aff87868bf3bf2fbab47aa8b4))
|
||||
* **nbd:** support ipv6 link local nbds ([b12f8188](https://github.com/dracutdevs/dracut/commit/b12f8188a4ffac312694ebd48a5c99ba885e6467))
|
||||
* **network-manager:** run as daemon with D-Bus ([112f03f9](https://github.com/dracutdevs/dracut/commit/112f03f9e225a790cbc6378c70773c6af5e7ee34))
|
||||
* **qemu:** include the virtio_mem kernel module ([f3dcb606](https://github.com/dracutdevs/dracut/commit/f3dcb60619671f2d353caaa42d38207172c8b3ba))
|
||||
* **skipcpio:** speed up and harden skipcpio ([63033495](https://github.com/dracutdevs/dracut/commit/630334950c9a7a714fdf31b6ff545d804b5df2f2))
|
||||
* **squash:**
|
||||
* use busybox for early setup if available ([90f269f6](https://github.com/dracutdevs/dracut/commit/90f269f6afe409925bad86f0bd7e9322ad9b4fb0))
|
||||
* install and depmod modules seperately ([5a18b24a](https://github.com/dracutdevs/dracut/commit/5a18b24a8b9c20c98f711963ce5407ceb2f3d57b))
|
||||
* **systemd-ac-power:** introducing the systemd-ac-power module ([e7407230](https://github.com/dracutdevs/dracut/commit/e74072306958262f22a9ecf10b928647ebdacf8f))
|
||||
* **systemd-hostnamed:** introducing the systemd-hostnamed module ([bf273e3e](https://github.com/dracutdevs/dracut/commit/bf273e3e8632faff68fe19f9d7d7cc42e5a7c480))
|
||||
* **systemd-initrd:** add initrd-usr-fs.target ([5eb73610](https://github.com/dracutdevs/dracut/commit/5eb736103d06197f37283bc27815c050adec81ea))
|
||||
* **systemd-journald:** introducing the systemd-journald module ([3697891b](https://github.com/dracutdevs/dracut/commit/3697891b754493ecd6b19dbf279701bad3460fcd))
|
||||
* **systemd-ldconfig:** introducing the systemd-ldconfig module ([563c434e](https://github.com/dracutdevs/dracut/commit/563c434ecba68c628344c1a684f656cdd8f9f214))
|
||||
* **systemd-network-management:** introducing systemd-network-management module ([e942d86c](https://github.com/dracutdevs/dracut/commit/e942d86c9ddad19f9307d58cb2d99169f6e94edb))
|
||||
* **systemd-resolved:** introducing the systemd-resolved module ([b7d3caef](https://github.com/dracutdevs/dracut/commit/b7d3caef6780305c553851169ca30b0b05b6ff31))
|
||||
* **systemd-rfkill:** introducing the systemd-rfkill module ([21536544](https://github.com/dracutdevs/dracut/commit/215365441e1042793d62c4c9e146be5916ed5aeb))
|
||||
* **systemd-sysext:** introducing the systemd-sysext module ([fc88af54](https://github.com/dracutdevs/dracut/commit/fc88af54134ec021be58465b52d1271453c30c55))
|
||||
* **systemd-timedated:** introducing the systemd-timedated module ([1c41cc90](https://github.com/dracutdevs/dracut/commit/1c41cc90c52636e03abdf6d0c4fa0f557b7eb449))
|
||||
* **systemd-timesyncd:** introducing the systemd-timesyncd module ([2257d545](https://github.com/dracutdevs/dracut/commit/2257d54583d24ca69d10b5e600b986d412a21714))
|
||||
* **systemd-tmpfiles:** introducing the systemd-tmpfiles module ([2b61be32](https://github.com/dracutdevs/dracut/commit/2b61be32b890e70b1fce45d984327c27302da9bc))
|
||||
* **systemd-udevd:** introducing the systemd-udevd module ([3534789c](https://github.com/dracutdevs/dracut/commit/3534789cc42331bc22cf44d26a1d04db4e010ad9))
|
||||
* **systemd-verity:** introducing the systemd-verity module ([3d4dea58](https://github.com/dracutdevs/dracut/commit/3d4dea58f9821e58841d5c738b9935193c680181))
|
||||
* **tpm2-tss:** introducing the tpm2-tss module ([8743b073](https://github.com/dracutdevs/dracut/commit/8743b0735692ab3f333815ba311cecdc29d45ecd))
|
||||
|
||||
#### Contributors
|
||||
|
||||
- Harald Hoyer <harald@redhat.com>
|
||||
- Jóhann B. Guðmundsson <johannbg@gmail.com>
|
||||
- Kairui Song <kasong@redhat.com>
|
||||
- Dusty Mabe <dusty@dustymabe.com>
|
||||
- Beniamino Galvani <bgalvani@redhat.com>
|
||||
- Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
|
||||
- Renaud Métrich <rmetrich@redhat.com>
|
||||
- Adam Alves <adamoa@gmail.com>
|
||||
- Daniel Molkentin <daniel.molkentin@suse.com>
|
||||
- David Hildenbrand <david@redhat.com>
|
||||
- David Tardon <dtardon@redhat.com>
|
||||
- Jaroslav Jindrak <dzejrou@gmail.com>
|
||||
- Jonas Jelten <jj@sft.lol>
|
||||
- Lennart Poettering <lennart@poettering.net>
|
||||
- Lev Veyde <lveyde@redhat.com>
|
||||
- Peter Robinson <pbrobinson@fedoraproject.org>
|
||||
- Stefan Berger <stefanb@linux.ibm.com>
|
||||
- Đoàn Trần Công Danh <congdanhqx@gmail.com>
|
||||
|
||||
dracut-053
|
||||
==========
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
* **dracut.sh:**
|
||||
* unfreeze /boot on exit ([d87ae137](https://github.com/dracutdevs/dracut/commit/d87ae13721d04a8a2192d896af224ac6965caf70))
|
||||
* proper return code for inst_multiple in dracut-init.sh ([d437970c](https://github.com/dracutdevs/dracut/commit/d437970c013e3287de263a1e60a117b15239896c))
|
||||
* **fcoe:**
|
||||
* rename rd.nofcoe to rd.fcoe ([6f7823bc](https://github.com/dracutdevs/dracut/commit/6f7823bce65dd4b52497dbb94892b637fd06471a))
|
||||
* rd.nofcoe=0 should disable fcoe ([805b46c2](https://github.com/dracutdevs/dracut/commit/805b46c2a81e04d69fc3af912942568516d05ee7))
|
||||
* **i18n:**
|
||||
* get rid of `eval` calls ([5387ed24](https://github.com/dracutdevs/dracut/commit/5387ed24c8b33da1214232d57ab1831e117aaba0))
|
||||
* create the keyboard symlinks again ([9e1c7f3d](https://github.com/dracutdevs/dracut/commit/9e1c7f3deadd387adaa97b189593b4ba3d7c6d5a))
|
||||
* **network-manager:**
|
||||
* run as a service if systemd module is present ([c17c5b76](https://github.com/dracutdevs/dracut/commit/c17c5b7604c8d61dd1c00ee22d44c3a5d7d6dfee))
|
||||
* rework how NM is started in debug mode ([34c73b33](https://github.com/dracutdevs/dracut/commit/34c73b339baa025dfd8916379c4d191be34a8af5))
|
||||
* **drm:** skip empty modalias files in drm module setup ([c3f24184](https://github.com/dracutdevs/dracut/commit/c3f241849de6434d063ef92e6880f6b0335c1800))
|
||||
|
||||
|
||||
dracut-052
|
||||
==========
|
||||
|
||||
#### Features
|
||||
|
||||
- **dracut:**
|
||||
- allow overriding the systemctl command for sysroot with `$SYSTEMCTL` for cross compilation
|
||||
- add additional global variables
|
||||
|
||||
Variables like `dbusconfdir` or `systemdnetwork` are now exported
|
||||
to the individual modules as global variables. If they are not set
|
||||
in the distribution dracut config files, they are set via `pkg-config`
|
||||
|
||||
- A `--no-uefi` option as been added to the CLI options to disable a default `uefi=yes`
|
||||
set by a configuration file.
|
||||
|
||||
- **kernel-modules:** add modules from `drivers/memory` for arm
|
||||
- **network-legacy:** send dhcp in parallel on all devices via the `single-dhcp` option
|
||||
- **dbus:** introduce a meta module for dbus
|
||||
- **dbus-broker:** introduce the dbus-broker module
|
||||
- **dbus-daemon:** introduce the dbus-daemon module
|
||||
- **systemd-ask-password:** introduce the systemd-ask-password module
|
||||
- **systemd-coredump:** introduce the systemd-coredump module
|
||||
- **systemd-modules-load:** introduce the systemd-modules-load module
|
||||
- **systemd-repart:** introduce the systemd-repart module
|
||||
- **systemd-sysctl:** introduce the systemd-sysctl module
|
||||
- **systemd-sysusers:** introduce the systemd-sysuser module
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
- first round of shellcheck for all shell scripts
|
||||
- revise all module checks to not error out about missing dependencies
|
||||
- use the top-level `/efi` path to address the EFI partition
|
||||
- correct the squash quirk
|
||||
- use `find_binary` instead of other methods, because `find_binary` honors `dracutsysrootdir`
|
||||
- quote globbing in module-setup.sh for `inst_multiple`
|
||||
- move ldconfig after library workaround
|
||||
- do not set cmdline for uefi images unless asked
|
||||
- **dracut:** don't override `PATH`, if `dracutsysrootdir` is set
|
||||
- **dracut-functions.sh:** check kernel config from `dracutsysrootdir`
|
||||
- **dracut-init.sh:** make inst_libdir_file work with `dracutsysrootdir` set
|
||||
- **dracut-install:** allow globbing for multiple sources
|
||||
- **06dbus:**
|
||||
- do not hardcode path to dbus utils
|
||||
- do not hardcode path to systemd unit
|
||||
- **uefi** use efivars fs over the deprecated sysfs entries
|
||||
- **keyring** adding shared keyring mode to systemd unit `dracut-pre-pivot.service`
|
||||
- **35network-manager:** avoid restarting NetworkManager
|
||||
- **90kernel-modules:** install generic crypto modules with hostonly unset
|
||||
- **99squash:** use kernel config instead of modprobe to check modules
|
||||
- **dbus-daemon:** use uid/gid from sysroot if `dracutsysrootdir` is set
|
||||
- **kernel-modules:** add reset controllers for arm
|
||||
- **kernel-network-modules:** also install modules from mdio subdirectory
|
||||
- **mdraid:**
|
||||
- remove the `offroot` option (long deprecated)
|
||||
- add the grow continue service `mdadm-grow-continue`
|
||||
- **network-legacy:** silent the check for dhcp leaseinfo
|
||||
- **network-manager:** allow override network manager version
|
||||
- **plymouth:** install binaries with dependencies
|
||||
- **shutdown:** add timeout to umount calls
|
||||
- **watchdog:** fix dependencies in `module-setup.sh`
|
||||
|
||||
#### Contributors
|
||||
|
||||
- Harald Hoyer <harald@redhat.com>
|
||||
- Jóhann B. Guðmundsson <johannbg@gmail.com>
|
||||
- Zoltán Böszörményi <zboszor@pr.hu>
|
||||
- Alexey Shabalin <shaba@altlinux.org>
|
||||
- Daniel Molkentin <daniel.molkentin@suse.com>
|
||||
- Luiz Angelo Daros de Luca <luizluca@gmail.com>
|
||||
- Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
||||
- Alexander Tsoy <alexander@tsoy.me>
|
||||
- Anjali Kulkarni <anjali.k.kulkarni@oracle.com>
|
||||
- Beniamino Galvani <bgalvani@redhat.com>
|
||||
- David Tardon <dtardon@redhat.com>
|
||||
- Javier Martinez Canillas <javierm@redhat.com>
|
||||
- Kairui Song <kasong@redhat.com>
|
||||
- Lukas Nykryn <lnykryn@redhat.com>
|
||||
- Matthew Thode <mthode@mthode.org>
|
||||
- Nicolas Chauvet <kwizart@gmail.com>
|
||||
- Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
|
||||
- Ondrej Mosnacek <omosnace@redhat.com>
|
||||
- Peter Levine <plevine457@gmail.com>
|
||||
- Petr Pavlu <petr.pavlu@suse.com>
|
||||
- Vladius25 <vkorol2509@icloud.com>
|
||||
- Yang Liu <50459973+ly4096x@users.noreply.github.com>
|
||||
- foopub <45460217+foopub@users.noreply.github.com>
|
||||
- realtime-neil <neil@rtr.ai>
|
||||
|
||||
|
||||
dracut-051
|
||||
==========
|
||||
|
46
README.md
46
README.md
@@ -3,10 +3,10 @@ dracut
|
||||
|
||||
dracut is an event driven initramfs infrastructure.
|
||||
|
||||
[](.github/CODE_OF_CONDUCT.md)
|
||||
[](https://travis-ci.org/dracutdevs/dracut)
|
||||
[](https://github.com/dracutdevs/dracut/actions?query=workflow%3AFedora-31)
|
||||
[](.github/CODE_OF_CONDUCT.md)
|
||||
[](https://github.com/dracutdevs/dracut/actions?query=workflow%3AFedora-32)
|
||||
[](https://github.com/dracutdevs/dracut/actions?query=workflow%3AFedora-33)
|
||||
[](https://github.com/dracutdevs/dracut/actions?query=workflow%3AFedora-latest)
|
||||
|
||||
dracut (the tool) is used to create an initramfs image by copying tools
|
||||
and files from an installed system and combining it with the
|
||||
@@ -29,32 +29,6 @@ specific functionality into the initramfs. They live in the modules.d
|
||||
subdirectory, and use functionality provided by dracut-functions to do their
|
||||
work.
|
||||
|
||||
Some general rules for writing modules:
|
||||
* Use one of the inst family of functions to actually install files
|
||||
on to the initramfs. They handle mangling the pathnames and (for binaries,
|
||||
scripts, and kernel modules) installing dependencies as appropriate so
|
||||
you do not have to.
|
||||
* Scripts that end up on the initramfs should be POSIX compliant. dracut
|
||||
will try to use /bin/dash as /bin/sh for the initramfs if it is available,
|
||||
so you should install it on your system -- dash aims for strict POSIX
|
||||
compliance to the extent possible.
|
||||
* Hooks MUST be POSIX compliant -- they are sourced by the init script,
|
||||
and having a bashism break your user's ability to boot really sucks.
|
||||
* Generator modules should have a two digit numeric prefix -- they run in
|
||||
ascending sort order. Anything in the 90-99 range is stuff that dracut
|
||||
relies on, so try not to break those hooks.
|
||||
* Hooks must have a .sh extension.
|
||||
* Generator modules are described in more detail in README.modules.
|
||||
* We have some breakpoints for debugging your hooks. If you pass 'rdbreak'
|
||||
as a kernel parameter, the initramfs will drop to a shell just before
|
||||
switching to a new root. You can pass 'rdbreak=hookpoint', and the initramfs
|
||||
will break just before hooks in that hookpoint run.
|
||||
|
||||
Also, there is an attempt to keep things as distribution-agnostic as
|
||||
possible. Every distribution has their own tool here and it's not
|
||||
something which is really interesting to have separate across them.
|
||||
So contributions to help decrease the distro-dependencies are welcome.
|
||||
|
||||
Currently dracut lives on github.com and kernel.org.
|
||||
|
||||
The tarballs can be found here:
|
||||
@@ -62,15 +36,7 @@ The tarballs can be found here:
|
||||
ftp://ftp.kernel.org/pub/linux/utils/boot/dracut/
|
||||
|
||||
Git:
|
||||
git://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
http://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
https://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
|
||||
git@github.com:dracutdevs/dracut.git
|
||||
|
||||
Git Web:
|
||||
https://github.com/dracutdevs/dracut.git
|
||||
|
||||
https://github.com/dracutdevs/dracut.git
|
||||
http://git.kernel.org/?p=boot/dracut/dracut.git
|
||||
|
||||
Project Documentation:
|
||||
@@ -79,8 +45,8 @@ Project Documentation:
|
||||
Project Wiki:
|
||||
http://dracut.wiki.kernel.org
|
||||
|
||||
See the TODO file for things which still need to be done and HACKING for
|
||||
some instructions on how to get started. There is also a mailing list
|
||||
See the github issue tracker for things which still need to be done and HACKING.md
|
||||
for some instructions on how to get started. There is also a mailing list
|
||||
that is being used for the discussion -- initramfs@vger.kernel.org.
|
||||
It is a typical vger list, send mail to majordomo@vger.kernel.org with body
|
||||
of 'subscribe initramfs email@host.com'
|
||||
|
112
README.modules
112
README.modules
@@ -1,112 +0,0 @@
|
||||
Most of the functionality that dracut implements are actually implemented
|
||||
by dracut modules. dracut modules live in modules.d, and have the following
|
||||
structure:
|
||||
|
||||
dracut_install_dir/modules.d/
|
||||
00modname/
|
||||
module-setup.sh
|
||||
check
|
||||
<other files as needed by the hook>
|
||||
|
||||
00modname: The name of the module prefixed by a two-digit numeric sort code.
|
||||
The numeric code must be present and in the range of 00 - 99.
|
||||
Modules with lower numbers are installed first. This is important
|
||||
because the dracut install functions (which install files onto
|
||||
the initrd) refuse to overwrite already installed files. This makes
|
||||
it easy for an earlier module to override the functionality of a
|
||||
later module, so that you can have a distro or system specific
|
||||
module override or modify the functionality of a generic module
|
||||
without having to patch the more generic module.
|
||||
|
||||
module-setup.sh:
|
||||
dracut sources this script to install the functionality that a
|
||||
module implements onto the initrd. For the most part, this amounts
|
||||
to copying files from the host system onto the initrd in a controlled
|
||||
manner.
|
||||
|
||||
install():
|
||||
This function of module-setup.sh is called to install all
|
||||
non-kernel files. dracut supplies several install functions that are
|
||||
specialized for different file types. Browse through dracut-functions
|
||||
fore more details. dracut also provides a $moddir variable if you
|
||||
need to install a file from the module directory, such as an initrd
|
||||
hook, a udev rule, or a specialized executable.
|
||||
|
||||
installkernel():
|
||||
This function of module-setup.sh is called to install all
|
||||
kernel related files.
|
||||
|
||||
|
||||
check():
|
||||
dracut calls this function to check and see if a module can be installed
|
||||
on the initrd.
|
||||
|
||||
When called without options, check should check to make sure that
|
||||
any files it needs to install into the initrd from the host system
|
||||
are present. It should exit with a 0 if they are, and a 1 if they are
|
||||
not.
|
||||
|
||||
When called with $hostonly set, it should perform the same check
|
||||
that it would without it set, and it should also check to see if the
|
||||
functionality the module implements is being used on the host system.
|
||||
For example, if this module handles installing support for LUKS
|
||||
encrypted volumes, it should return 0 if all the tools to handle
|
||||
encrpted volumes are available and the host system has the root
|
||||
partition on an encrypted volume, 1 otherwise.
|
||||
|
||||
depends():
|
||||
This function should output a list of dracut modules
|
||||
that it relies upon. An example would be the nfs and iscsi modules,
|
||||
which rely on the network module to detect and configure network
|
||||
interfaces.
|
||||
|
||||
Any other files in the module will not be touched by dracut directly.
|
||||
|
||||
You are encouraged to provide a README that describes what the module is for.
|
||||
|
||||
|
||||
HOOKS
|
||||
=====
|
||||
|
||||
init has the following hook points to inject scripts:
|
||||
|
||||
/lib/dracut/hooks/cmdline/*.sh
|
||||
scripts for command line parsing
|
||||
|
||||
/lib/dracut/hooks/pre-udev/*.sh
|
||||
scripts to run before udev is started
|
||||
|
||||
/lib/dracut/hooks/pre-trigger/*.sh
|
||||
scripts to run before the main udev trigger is pulled
|
||||
|
||||
/lib/dracut/hooks/initqueue/*.sh
|
||||
runs in parallel to the udev trigger
|
||||
Udev events can add scripts here with /sbin/initqueue.
|
||||
If /sbin/initqueue is called with the "--onetime" option, the script
|
||||
will be removed after it was run.
|
||||
If /lib/dracut/hooks/initqueue/work is created and udev >= 143 then
|
||||
this loop can process the jobs in parallel to the udevtrigger.
|
||||
If the udev queue is empty and no root device is found or no root
|
||||
filesystem was mounted, the user will be dropped to a shell after
|
||||
a timeout.
|
||||
Scripts can remove themselves from the initqueue by "rm $job".
|
||||
|
||||
/lib/dracut/hooks/pre-mount/*.sh
|
||||
scripts to run before the root filesystem is mounted
|
||||
Network filesystems like NFS that do not use device files are an
|
||||
exception. Root can be mounted already at this point.
|
||||
|
||||
/lib/dracut/hooks/mount/*.sh
|
||||
scripts to mount the root filesystem
|
||||
If the udev queue is empty and no root device is found or no root
|
||||
filesystem was mounted, the user will be dropped to a shell after
|
||||
a timeout.
|
||||
|
||||
/lib/dracut/hooks/pre-pivot/*.sh
|
||||
scripts to run before latter initramfs cleanups
|
||||
|
||||
/lib/dracut/hooks/cleanup/*.sh
|
||||
scripts to run before the real init is executed and the initramfs
|
||||
disappears
|
||||
All processes started before should be killed here.
|
||||
|
@@ -1,45 +0,0 @@
|
||||
For the testsuite to work, you will have to install at least the following software packages:
|
||||
dash \
|
||||
asciidoc \
|
||||
mdadm \
|
||||
lvm2 \
|
||||
dmraid \
|
||||
cryptsetup \
|
||||
nfs-utils \
|
||||
nbd \
|
||||
dhcp-server \
|
||||
scsi-target-utils \
|
||||
iscsi-initiator-utils \
|
||||
strace \
|
||||
syslinux \
|
||||
python-imgcreate \
|
||||
genisoimage \
|
||||
btrfs-progs \
|
||||
kmod-devel \
|
||||
gcc \
|
||||
bzip2 \
|
||||
xz \
|
||||
tar \
|
||||
wget \
|
||||
rpm-build \
|
||||
${NULL}
|
||||
|
||||
TEST-04-FULL-SYSTEMD: systemd >= 187
|
||||
|
||||
How to run the testsuite:
|
||||
|
||||
$ sudo make clean check
|
||||
|
||||
in verbose mode:
|
||||
$ sudo make V=1 clean check
|
||||
|
||||
only specific test:
|
||||
$ sudo make TESTS="01 20 40" clean check
|
||||
only runs the 01, 20 and 40 tests.
|
||||
|
||||
debug a specific test case:
|
||||
$ cd TEST-01-BASIC
|
||||
$ sudo make clean setup run
|
||||
... change some kernel parameters ...
|
||||
$ sudo make run
|
||||
to run the test without doing the setup
|
51
TODO
51
TODO
@@ -1,51 +0,0 @@
|
||||
Current TODO list, broken into things which are relevant for the
|
||||
initramfs itself (/init et al) vs the generator.
|
||||
A lot of things are/should be marked with "FIXME" in the code.
|
||||
|
||||
Items are ordered in priority.
|
||||
|
||||
INITRAMFS TODO
|
||||
|
||||
- search domain string
|
||||
- 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
|
||||
- call "root=" parsing hooks after getting new rootpath from dhcp
|
||||
- put mount hook in main initqueue loop / careful about resume!
|
||||
- the hard-coded list of udev rules that we care about is kind of lame.
|
||||
- panic fallback
|
||||
- progress indication for fsck https://bugzilla.redhat.com/show_bug.cgi?id=827118
|
||||
- domain, searchdomain https://bugzilla.redhat.com/show_bug.cgi?id=840778
|
||||
- probably fix "--include" https://bugzilla.redhat.com/show_bug.cgi?id=849338
|
||||
|
||||
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
|
||||
- pkg-config integration, to make it easy for other packages to use us.
|
||||
- default module specification could use some work
|
||||
- udev rule copying, as mentioned above, is a bit too hard-coded
|
||||
|
||||
- dracut-install parse LD_SHOW_AUXV="" AT_PLATFORM for lib install
|
||||
|
||||
CODE TODO
|
||||
|
||||
- document more functions
|
||||
- make function vars local, and prefix with "_"
|
||||
|
||||
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
|
74
configure
vendored
74
configure
vendored
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# We don't support srcdir != builddir
|
||||
echo \#buildapi-variable-no-builddir >/dev/null
|
||||
echo \#buildapi-variable-no-builddir > /dev/null
|
||||
|
||||
prefix=/usr
|
||||
|
||||
@@ -19,9 +19,9 @@ read_arg() {
|
||||
# $3 = arg parameter
|
||||
local rematch='^[^=]*=(.*)$'
|
||||
if [[ $2 =~ $rematch ]]; then
|
||||
read "$1" <<< "${BASH_REMATCH[1]}"
|
||||
read -r "$1" <<< "${BASH_REMATCH[1]}"
|
||||
else
|
||||
read "$1" <<< "$3"
|
||||
read -r "$1" <<< "$3"
|
||||
# There is no way to shift our callers args, so
|
||||
# return 1 to indicate they should do it instead.
|
||||
return 1
|
||||
@@ -31,24 +31,24 @@ read_arg() {
|
||||
|
||||
while (($# > 0)); do
|
||||
case "${1%%=*}" in
|
||||
--prefix) read_arg prefix "$@" || shift;;
|
||||
--libdir) read_arg libdir "$@" || shift;;
|
||||
--datadir) read_arg datadir "$@" || shift;;
|
||||
--sysconfdir) read_arg sysconfdir "$@" || shift;;
|
||||
--sbindir) read_arg sbindir "$@" || shift;;
|
||||
--mandir) read_arg mandir "$@" || shift;;
|
||||
--disable-documentation) enable_documentation=no;;
|
||||
--program-prefix) read_arg programprefix "$@" || shift;;
|
||||
--exec-prefix) read_arg execprefix "$@" || shift;;
|
||||
--bindir) read_arg bindir "$@" || shift;;
|
||||
--includedir) read_arg includedir "$@" || shift;;
|
||||
--libexecdir) read_arg libexecdir "$@" || shift;;
|
||||
--localstatedir) read_arg localstatedir "$@" || shift;;
|
||||
--sharedstatedir) read_arg sharedstatedir "$@" || shift;;
|
||||
--infodir) read_arg infodir "$@" || shift;;
|
||||
--systemdsystemunitdir) read_arg systemdsystemunitdir "$@" || shift;;
|
||||
--bashcompletiondir) read_arg bashcompletiondir "$@" || shift;;
|
||||
*) echo "Ignoring unknown option '$1'";;
|
||||
--prefix) read_arg prefix "$@" || shift ;;
|
||||
--libdir) read_arg libdir "$@" || shift ;;
|
||||
--datadir) read_arg datadir "$@" || shift ;;
|
||||
--sysconfdir) read_arg sysconfdir "$@" || shift ;;
|
||||
--sbindir) read_arg sbindir "$@" || shift ;;
|
||||
--mandir) read_arg mandir "$@" || shift ;;
|
||||
--disable-documentation) enable_documentation=no ;;
|
||||
--program-prefix) read_arg programprefix "$@" || shift ;;
|
||||
--exec-prefix) read_arg execprefix "$@" || shift ;;
|
||||
--bindir) read_arg bindir "$@" || shift ;;
|
||||
--includedir) read_arg includedir "$@" || shift ;;
|
||||
--libexecdir) read_arg libexecdir "$@" || shift ;;
|
||||
--localstatedir) read_arg localstatedir "$@" || shift ;;
|
||||
--sharedstatedir) read_arg sharedstatedir "$@" || shift ;;
|
||||
--infodir) read_arg infodir "$@" || shift ;;
|
||||
--systemdsystemunitdir) read_arg systemdsystemunitdir "$@" || shift ;;
|
||||
--bashcompletiondir) read_arg bashcompletiondir "$@" || shift ;;
|
||||
*) echo "Ignoring unknown option '$1'" ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
@@ -58,24 +58,25 @@ if ! ${PKG_CONFIG} --exists --print-errors " libkmod >= 23 "; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat <<EOF >conftest.c
|
||||
cat << EOF > conftest.c
|
||||
#include <fts.h>
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
|
||||
${CC} $CFLAGS $LDFLAGS conftest.c >/dev/null 2>&1
|
||||
# shellcheck disable=SC2086
|
||||
${CC} $CFLAGS $LDFLAGS conftest.c > /dev/null 2>&1
|
||||
ret=$?
|
||||
rm -f conftest.c a.out
|
||||
|
||||
# musl doesn't have fts.h included
|
||||
if test $ret -ne 0; then
|
||||
echo "dracut needs fts development files." >&2
|
||||
exit 1
|
||||
echo "dracut needs fts development files." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat <<EOF >conftest.c
|
||||
cat << EOF > conftest.c
|
||||
#include <fts.h>
|
||||
int main(void) {
|
||||
fts_open(0, 0, 0);
|
||||
@@ -85,22 +86,23 @@ EOF
|
||||
|
||||
found=no
|
||||
for lib in "-lc" "-lfts"; do
|
||||
${CC} $CFLAGS $LDFLAGS conftest.c -Wl,$lib >/dev/null 2>&1
|
||||
ret=$?
|
||||
if test $ret -eq 0; then
|
||||
FTS_LIBS="$lib"
|
||||
found=yes
|
||||
break;
|
||||
fi
|
||||
# shellcheck disable=SC2086
|
||||
${CC} $CFLAGS $LDFLAGS conftest.c -Wl,$lib > /dev/null 2>&1
|
||||
ret=$?
|
||||
if test $ret -eq 0; then
|
||||
FTS_LIBS="$lib"
|
||||
found=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
rm -f conftest.c a.out
|
||||
|
||||
if test $found = no; then
|
||||
echo "dracut couldn't find usable fts library" >&2
|
||||
exit 1
|
||||
echo "dracut couldn't find usable fts library" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat > Makefile.inc.$$ <<EOF
|
||||
cat > Makefile.inc.$$ << EOF
|
||||
prefix ?= ${prefix}
|
||||
libdir ?= ${libdir:-${prefix}/lib}
|
||||
datadir ?= ${datadir:-${prefix}/share}
|
||||
|
213
docs/BASH.md
Normal file
213
docs/BASH.md
Normal file
@@ -0,0 +1,213 @@
|
||||
# BASH Notes
|
||||
|
||||
## basename
|
||||
Don't use `basename`, use:
|
||||
```shell
|
||||
file=${path##*/}
|
||||
```
|
||||
|
||||
## dirname
|
||||
Don't use `dirname`, use:
|
||||
```shell
|
||||
dir=${path%/*}
|
||||
```
|
||||
|
||||
## shopt
|
||||
If you set `shopt` in a function, reset to its default state with `trap`:
|
||||
```shell
|
||||
func() {
|
||||
trap "$(shopt -p nullglob globstar)" RETURN
|
||||
shopt -q -s nullglob globstar
|
||||
}
|
||||
```
|
||||
|
||||
## find, grep, print0, -0, -z
|
||||
|
||||
Don't use `find` in `for` loops, because filenames can contain spaces.
|
||||
Try to use `globstar` and `nullglob` or null byte terminated strings.
|
||||
|
||||
Instead of:
|
||||
```shell
|
||||
func() {
|
||||
for file in $(find /usr/lib* -type f -name 'lib*.a' -print0 ); do
|
||||
echo $file
|
||||
done
|
||||
}
|
||||
```
|
||||
|
||||
use:
|
||||
```shell
|
||||
func() {
|
||||
trap "$(shopt -p nullglob globstar)" RETURN
|
||||
shopt -q -s nullglob globstar
|
||||
|
||||
for file in /usr/lib*/**/lib*.a; do
|
||||
[[ -f $file ]] || continue
|
||||
echo "$file"
|
||||
done
|
||||
}
|
||||
```
|
||||
|
||||
Or collect the filenames in an array, if you need them more than once:
|
||||
```shell
|
||||
func() {
|
||||
trap "$(shopt -p nullglob globstar)" RETURN
|
||||
shopt -q -s nullglob globstar
|
||||
|
||||
filenames=( /usr/lib*/**/lib*.a )
|
||||
|
||||
for file in "${filenames[@]}"; do
|
||||
[[ -f $file ]] || continue
|
||||
echo "$file"
|
||||
done
|
||||
}
|
||||
```
|
||||
|
||||
Or, if you really want to use `find`, use `-print0` and an array:
|
||||
```shell
|
||||
func() {
|
||||
mapfile -t -d '' filenames < <(find /usr/lib* -type f -name 'lib*.a' -print0)
|
||||
for file in "${filenames[@]}"; do
|
||||
echo "$file"
|
||||
done
|
||||
}
|
||||
```
|
||||
|
||||
Note: `-d ''` is the same as `-d $'\0'` and sets the null byte as the delimiter.
|
||||
|
||||
or:
|
||||
```shell
|
||||
func() {
|
||||
find /usr/lib* -type f -name 'lib*.a' -print0 | while read -r -d '' file; do
|
||||
echo "$file"
|
||||
done
|
||||
}
|
||||
```
|
||||
|
||||
or
|
||||
```shell
|
||||
func() {
|
||||
while read -r -d '' file; do
|
||||
echo "$file"
|
||||
done < <(find /usr/lib* -type f -name 'lib*.a' -print0)
|
||||
}
|
||||
```
|
||||
|
||||
Use the tool options for null terminated strings, like `-print0`, `-0`, `-z`, etc.
|
||||
|
||||
## prefix or suffix array elements
|
||||
|
||||
Instead of:
|
||||
```shell
|
||||
func() {
|
||||
other-cmd $(for k in "$@"; do echo "prefix-$k"; done)
|
||||
}
|
||||
```
|
||||
do
|
||||
```shell
|
||||
func() {
|
||||
other-cmd "${@/#/prefix-}"
|
||||
}
|
||||
```
|
||||
|
||||
or suffix:
|
||||
```shell
|
||||
func() {
|
||||
other-cmd "${@/%/-suffix}"
|
||||
}
|
||||
```
|
||||
|
||||
## Join array elements with a separator char
|
||||
|
||||
Here we have an associate array `_drivers`, where we want to print the keys separated by ',':
|
||||
```shell
|
||||
if [[ ${!_drivers[*]} ]]; then
|
||||
echo "rd.driver.pre=$(IFS=, ;echo "${!_drivers[*]}")" > "${initdir}"/etc/cmdline.d/00-watchdog.conf
|
||||
fi
|
||||
```
|
||||
|
||||
## Optional parameters to commands
|
||||
|
||||
If you want to call a command `cmd` with an option, if a variable is set, rather than doing:
|
||||
|
||||
```shell
|
||||
func() {
|
||||
local param="$1"
|
||||
|
||||
if [[ $param ]]; then
|
||||
param="--this-special-option $param"
|
||||
fi
|
||||
|
||||
cmd $param
|
||||
}
|
||||
```
|
||||
|
||||
do it like this:
|
||||
|
||||
```shell
|
||||
func() {
|
||||
local param="$1"
|
||||
|
||||
cmd ${param:+--this-special-option "$param"}
|
||||
}
|
||||
|
||||
# cmd --this-special-option 'abc'
|
||||
func 'abc'
|
||||
|
||||
# cmd
|
||||
func ''
|
||||
|
||||
# cmd
|
||||
func
|
||||
```
|
||||
|
||||
If you want to specify the option even with an empty string do this:
|
||||
|
||||
```shell
|
||||
func() {
|
||||
local -a special_params
|
||||
|
||||
if [[ ${1+_} ]]; then
|
||||
# only declare `param` if $1 is set (even as null string)
|
||||
local param="$1"
|
||||
fi
|
||||
|
||||
# check if `param` is set (even as null string)
|
||||
if [[ ${param+_} ]]; then
|
||||
special_params=( --this-special-option "${param}" )
|
||||
fi
|
||||
|
||||
cmd ${param+"${special_params[@]}"}
|
||||
}
|
||||
|
||||
# cmd --this-special-option 'abc'
|
||||
func 'abc'
|
||||
|
||||
# cmd --this-special-option ''
|
||||
func ''
|
||||
|
||||
# cmd
|
||||
func
|
||||
```
|
||||
|
||||
Or more simple, if you only have to set an option:
|
||||
```shell
|
||||
func() {
|
||||
if [[ ${1+_} ]]; then
|
||||
# only declare `param` if $1 is set (even as null string)
|
||||
local param="$1"
|
||||
fi
|
||||
|
||||
cmd ${param+--this-special-option}
|
||||
}
|
||||
|
||||
# cmd --this-special-option
|
||||
func 'abc'
|
||||
|
||||
# cmd --this-special-option
|
||||
func ''
|
||||
|
||||
# cmd
|
||||
func
|
||||
```
|
||||
|
278
docs/HACKING.md
Normal file
278
docs/HACKING.md
Normal file
@@ -0,0 +1,278 @@
|
||||
# Dracut Developer Guidelines
|
||||
|
||||
## git
|
||||
|
||||
Currently dracut lives on github.com and kernel.org.
|
||||
|
||||
* https://github.com/dracutdevs/dracut.git
|
||||
* https://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
|
||||
Pull requests should be filed preferably on github nowadays.
|
||||
|
||||
### Code Format
|
||||
|
||||
It is recommended, that you install a plugin for your editor, which reads in `.editorconfig`.
|
||||
Additionally `emacs` and `vim` config files are provided for convenience.
|
||||
|
||||
To reformat C files use `astyle`:
|
||||
```console
|
||||
$ astyle --options=.astylerc <FILE>
|
||||
```
|
||||
|
||||
For convenience there is also a Makefile `indent-c` target `make indent-c`.
|
||||
|
||||
To reformat shell files use `shfmt`:
|
||||
|
||||
```console
|
||||
$ shfmt_version=3.2.4
|
||||
$ wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O shfmt
|
||||
$ chmod u+x shfmt
|
||||
$ ./shfmt -w -s .
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```console
|
||||
$ GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt
|
||||
$ $GOPATH/bin/shfmt -w -s .
|
||||
```
|
||||
|
||||
or if `shfmt` is already in your `PATH`, use `make indent`.
|
||||
|
||||
Some IDEs already have support for shfmt.
|
||||
|
||||
For convenience the `make indent` Makefile target also calls shfmt, if it is in `$PATH`.
|
||||
|
||||
### Commit Messages
|
||||
|
||||
Commit messages should answer these questions:
|
||||
|
||||
* What?: a short summary of what you changed in the subject line.
|
||||
* Why?: what the intended outcome of the change is (arguably the most important piece of information that should go into a message).
|
||||
* How?: if multiple approaches for achieving your goal were available, you also want to explain why you chose the used implementation strategy.
|
||||
Note that you should not explain how your change achieves your goal in your commit message.
|
||||
That should be obvious from the code itself.
|
||||
If you cannot achieve that clarity with the used programming language, use comments within the code instead.
|
||||
|
||||
The commit message is primarily the place for documenting the why.
|
||||
|
||||
Commit message titles should follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
|
||||
|
||||
Format is `<type>[optional scope]: <description>`, where `type` is one of:
|
||||
|
||||
* fix: A bug fix
|
||||
* feat: A new feature
|
||||
* perf: A code change that improves performance
|
||||
* refactor: A code change that neither fixes a bug nor adds a feature
|
||||
* style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
|
||||
* test: Adding missing tests or correcting existing tests
|
||||
* docs: Documentation only changes
|
||||
* revert: Reverts a previous commit
|
||||
* chore: Other changes that don't modify src or test files
|
||||
* build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
|
||||
* ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
|
||||
|
||||
`scope` should be the module name (without numbers) or:
|
||||
|
||||
* cli: for the dracut command line interface
|
||||
* rt: for the dracut initramfs runtime logic
|
||||
* functions: for general purpose dracut functions
|
||||
|
||||
Commit messages are checked with [Commisery](https://github.com/tomtom-international/commisery).
|
||||
|
||||
## Writing modules
|
||||
|
||||
Some general rules for writing modules:
|
||||
|
||||
* Use one of the inst family of functions to actually install files
|
||||
on to the initramfs. They handle mangling the pathnames and (for binaries,
|
||||
scripts, and kernel modules) installing dependencies as appropriate so
|
||||
you do not have to.
|
||||
* Scripts that end up on the initramfs should be POSIX compliant. dracut
|
||||
will try to use /bin/dash as /bin/sh for the initramfs if it is available,
|
||||
so you should install it on your system -- dash aims for strict POSIX
|
||||
compliance to the extent possible.
|
||||
* Hooks MUST be POSIX compliant -- they are sourced by the init script,
|
||||
and having a bashism break your user's ability to boot really sucks.
|
||||
* Generator modules should have a two digit numeric prefix -- they run in
|
||||
ascending sort order. Anything in the 90-99 range is stuff that dracut
|
||||
relies on, so try not to break those hooks.
|
||||
* Hooks must have a .sh extension.
|
||||
* Generator modules are described in more detail later on.
|
||||
* We have some breakpoints for debugging your hooks. If you pass 'rdbreak'
|
||||
as a kernel parameter, the initramfs will drop to a shell just before
|
||||
switching to a new root. You can pass 'rdbreak=hookpoint', and the initramfs
|
||||
will break just before hooks in that hookpoint run.
|
||||
|
||||
Also, there is an attempt to keep things as distribution-agnostic as
|
||||
possible. Every distribution has their own tool here and it's not
|
||||
something which is really interesting to have separate across them.
|
||||
So contributions to help decrease the distro-dependencies are welcome.
|
||||
|
||||
Most of the functionality that dracut implements are actually implemented
|
||||
by dracut modules. dracut modules live in modules.d, and have the following
|
||||
structure:
|
||||
|
||||
```
|
||||
dracut_install_dir/modules.d/
|
||||
00modname/
|
||||
module-setup.sh
|
||||
check
|
||||
<other files as needed by the hook>
|
||||
```
|
||||
|
||||
`00modname`: The name of the module prefixed by a two-digit numeric sort code.
|
||||
The numeric code must be present and in the range of 00 - 99.
|
||||
Modules with lower numbers are installed first. This is important
|
||||
because the dracut install functions (which install files onto
|
||||
the initrd) refuse to overwrite already installed files. This makes
|
||||
it easy for an earlier module to override the functionality of a
|
||||
later module, so that you can have a distro or system specific
|
||||
module override or modify the functionality of a generic module
|
||||
without having to patch the more generic module.
|
||||
|
||||
`module-setup.sh`:
|
||||
dracut sources this script to install the functionality that a
|
||||
module implements onto the initrd. For the most part, this amounts
|
||||
to copying files from the host system onto the initrd in a controlled
|
||||
manner.
|
||||
|
||||
`install()`:
|
||||
This function of module-setup.sh is called to install all
|
||||
non-kernel files. dracut supplies several install functions that are
|
||||
specialized for different file types. Browse through dracut-functions
|
||||
fore more details. dracut also provides a $moddir variable if you
|
||||
need to install a file from the module directory, such as an initrd
|
||||
hook, a udev rule, or a specialized executable.
|
||||
|
||||
`installkernel()`:
|
||||
This function of module-setup.sh is called to install all
|
||||
kernel related files.
|
||||
|
||||
|
||||
`check()`:
|
||||
dracut calls this function to check and see if a module can be installed
|
||||
on the initrd.
|
||||
|
||||
When called without options, check should check to make sure that
|
||||
any files it needs to install into the initrd from the host system
|
||||
are present. It should exit with a 0 if they are, and a 1 if they are
|
||||
not.
|
||||
|
||||
When called with $hostonly set, it should perform the same check
|
||||
that it would without it set, and it should also check to see if the
|
||||
functionality the module implements is being used on the host system.
|
||||
For example, if this module handles installing support for LUKS
|
||||
encrypted volumes, it should return 0 if all the tools to handle
|
||||
encrpted volumes are available and the host system has the root
|
||||
partition on an encrypted volume, 1 otherwise.
|
||||
|
||||
`depends()`:
|
||||
This function should output a list of dracut modules
|
||||
that it relies upon. An example would be the nfs and iscsi modules,
|
||||
which rely on the network module to detect and configure network
|
||||
interfaces.
|
||||
|
||||
Any other files in the module will not be touched by dracut directly.
|
||||
|
||||
You are encouraged to provide a README that describes what the module is for.
|
||||
|
||||
|
||||
### Hooks
|
||||
|
||||
init has the following hook points to inject scripts:
|
||||
|
||||
`/lib/dracut/hooks/cmdline/*.sh`
|
||||
scripts for command line parsing
|
||||
|
||||
`/lib/dracut/hooks/pre-udev/*.sh`
|
||||
scripts to run before udev is started
|
||||
|
||||
`/lib/dracut/hooks/pre-trigger/*.sh`
|
||||
scripts to run before the main udev trigger is pulled
|
||||
|
||||
`/lib/dracut/hooks/initqueue/*.sh`
|
||||
runs in parallel to the udev trigger
|
||||
Udev events can add scripts here with /sbin/initqueue.
|
||||
If /sbin/initqueue is called with the "--onetime" option, the script
|
||||
will be removed after it was run.
|
||||
If /lib/dracut/hooks/initqueue/work is created and udev >= 143 then
|
||||
this loop can process the jobs in parallel to the udevtrigger.
|
||||
If the udev queue is empty and no root device is found or no root
|
||||
filesystem was mounted, the user will be dropped to a shell after
|
||||
a timeout.
|
||||
Scripts can remove themselves from the initqueue by "rm $job".
|
||||
|
||||
`/lib/dracut/hooks/pre-mount/*.sh`
|
||||
scripts to run before the root filesystem is mounted
|
||||
Network filesystems like NFS that do not use device files are an
|
||||
exception. Root can be mounted already at this point.
|
||||
|
||||
`/lib/dracut/hooks/mount/*.sh`
|
||||
scripts to mount the root filesystem
|
||||
If the udev queue is empty and no root device is found or no root
|
||||
filesystem was mounted, the user will be dropped to a shell after
|
||||
a timeout.
|
||||
|
||||
`/lib/dracut/hooks/pre-pivot/*.sh`
|
||||
scripts to run before latter initramfs cleanups
|
||||
|
||||
`/lib/dracut/hooks/cleanup/*.sh`
|
||||
scripts to run before the real init is executed and the initramfs
|
||||
disappears
|
||||
All processes started before should be killed here.
|
||||
|
||||
|
||||
## Testsuite
|
||||
|
||||
### Rootless in a container with podman
|
||||
|
||||
```console
|
||||
$ cd <DRACUT_SOURCE>
|
||||
$ podman pull [CONTAINER]
|
||||
$ podman run --rm -it \
|
||||
--cap-add=SYS_PTRACE --user 0 \
|
||||
-v /dev:/dev -v ./:/dracut:z \
|
||||
[CONTAINER] \
|
||||
bash -l
|
||||
# cd /dracut
|
||||
# ./configure
|
||||
# make -j $(getconf _NPROCESSORS_ONLN)
|
||||
# cd test
|
||||
# make V=1 SKIP="16 60 61" clean check
|
||||
```
|
||||
|
||||
with `[CONTAINER]` being one of the
|
||||
[github `dracutdevs` containers](https://github.com/orgs/dracutdevs/packages),
|
||||
e.g. `ghcr.io/dracutdevs/fedora:latest`.
|
||||
|
||||
### On bare metal
|
||||
|
||||
For the testsuite to pass, you will have to install at least the software packages
|
||||
mentioned in the `test/container` Dockerfiles.
|
||||
|
||||
```
|
||||
$ sudo make clean check
|
||||
```
|
||||
|
||||
in verbose mode:
|
||||
```
|
||||
$ sudo make V=1 clean check
|
||||
```
|
||||
|
||||
only specific test:
|
||||
```
|
||||
$ sudo make TESTS="01 20 40" clean check
|
||||
```
|
||||
only runs the 01, 20 and 40 tests.
|
||||
|
||||
debug a specific test case:
|
||||
```
|
||||
$ cd TEST-01-BASIC
|
||||
$ sudo make clean setup run
|
||||
```
|
||||
... change some kernel parameters in `test.sh` ...
|
||||
```
|
||||
$ sudo make run
|
||||
```
|
||||
to run the test without doing the setup.
|
@@ -46,25 +46,3 @@ documented in the dracut(8) man page.
|
||||
For the Plymouth boot splash to be added to the initramfs image,
|
||||
this gitlab PR is needed for Plymouth:
|
||||
https://gitlab.freedesktop.org/plymouth/plymouth/merge_requests/72
|
||||
|
||||
Extensions to be used with Yocto
|
||||
================================
|
||||
|
||||
examples/yocto/classes/dracut.bbclass:
|
||||
Bitbake class for running dracut during the "do_rootfs" stage of
|
||||
creating a distribution image and from the postinstall script of
|
||||
a package. A kernel recipe needs this line to activate it:
|
||||
|
||||
inherit dracut
|
||||
|
||||
examples/yocto/postinst-intercepts/execute_dracut
|
||||
The "intercept" script used during "do_rootfs" mentioned above.
|
||||
|
||||
examples/yocto/recipes/cross-compiler-ldd_git.bb
|
||||
Package recipe for the cross-compiler-ldd script from the above link.
|
||||
|
||||
All the above three need to be added to a Yocto layer to their
|
||||
proper locations.
|
||||
|
||||
They were tested on Yocto 2.7 with MACHINE="intel-core2-32" and
|
||||
MACHINE="genericx86-64".
|
70
docs/RELEASE.md
Normal file
70
docs/RELEASE.md
Normal file
@@ -0,0 +1,70 @@
|
||||
# Conducting A Successful Release
|
||||
|
||||
This documents contains the necessary steps to conduct a successful release.
|
||||
|
||||
1. Add all items to `NEWS.md`
|
||||
|
||||
Get a first template with [`clog`](https://github.com/clog-tool/clog-cli)
|
||||
```console
|
||||
$ clog -F -r https://github.com/dracutdevs/dracut
|
||||
```
|
||||
|
||||
2. Update the contributors list in NEWS.md
|
||||
|
||||
Produce the list with:
|
||||
```console
|
||||
$ make CONTRIBUTORS
|
||||
```
|
||||
|
||||
Append the list to the section in `NEWS.md`
|
||||
|
||||
3. Update AUTHORS
|
||||
|
||||
```console
|
||||
$ make AUTHORS
|
||||
```
|
||||
|
||||
4. Check in AUTHORS and NEWS.md
|
||||
|
||||
```console
|
||||
$ git ci -m "docs: update NEWS.md and AUTHORS" NEWS.md AUTHORS
|
||||
```
|
||||
|
||||
5. Tag the release and push
|
||||
|
||||
```console
|
||||
$ VERSION=052
|
||||
$ git tag -s "$VERSION"
|
||||
$ git push --tags
|
||||
```
|
||||
|
||||
Add the section from `NEWS.md` to the git tag message.
|
||||
|
||||
6. Push git to kernel.org
|
||||
|
||||
With:
|
||||
```console
|
||||
$ git remote add kernelorg ssh://gitolite@ra.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
```
|
||||
|
||||
Push to kernel.org git:
|
||||
```console
|
||||
$ git push --atomic kernelorg master "$VERSION"
|
||||
```
|
||||
|
||||
|
||||
7. Sign and upload tarballs to kernel.org
|
||||
|
||||
```console
|
||||
$ make upload
|
||||
```
|
||||
|
||||
This requires `kup` and a kernel.org account.
|
||||
Wait until the tarballs are synced to http://www.kernel.org/pub/linux/utils/boot/dracut/ .
|
||||
|
||||
8. Create a new release on github (https://github.com/dracutdevs/dracut/releases/new)
|
||||
- Add the section from `NEWS.md` to the release.
|
||||
- Attach the tarballs and signature file from http://www.kernel.org/pub/linux/utils/boot/dracut/ to the github release.
|
||||
|
||||
9. Close the github milestone and open a new one (https://github.com/dracutdevs/dracut/milestones)
|
||||
10. Ensure that announcement was sent and reached the linux-initramfs mailinglist (https://www.spinics.net/lists/linux-initramfs/)
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
@@ -1,89 +0,0 @@
|
||||
#
|
||||
# Copyright 2013 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/>.
|
||||
#
|
||||
|
||||
__contains_word () {
|
||||
local word=$1; shift
|
||||
for w in $*; do [[ $w = $word ]] && return 0; done
|
||||
return 1
|
||||
}
|
||||
|
||||
_dracut() {
|
||||
local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
local -A OPTS=(
|
||||
[STANDALONE]='-f -v -q -l -H -h -M -N
|
||||
--ro-mnt --force --kernel-only --no-kernel --strip --nostrip
|
||||
--hardlink --nohardlink --noprefix --mdadmconf --nomdadmconf
|
||||
--lvmconf --nolvmconf --debug --profile --verbose --quiet
|
||||
--local --hostonly --no-hostonly --fstab --help --bzip2 --lzma
|
||||
--xz --zstd --no-compress --gzip --list-modules --show-modules --keep
|
||||
--printsize --regenerate-all --noimageifnotneeded --early-microcode
|
||||
--no-early-microcode --print-cmdline --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
|
||||
--loginstall --uefi-stub --kernel-image
|
||||
'
|
||||
)
|
||||
|
||||
if __contains_word "$prev" ${OPTS[ARG]}; then
|
||||
case $prev in
|
||||
--kmoddir|-k|--fwdir|--confdir|--tmpdir)
|
||||
comps=$(compgen -d -- "$cur")
|
||||
compopt -o filenames
|
||||
;;
|
||||
-c|--conf|--sshkey|--add-fstab|--add-device|-I|--install|--install-optional)
|
||||
comps=$(compgen -f -- "$cur")
|
||||
compopt -o filenames
|
||||
;;
|
||||
-a|-m|-o|--add|--modules|--omit)
|
||||
comps=$(dracut --list-modules 2>/dev/null)
|
||||
;;
|
||||
--persistent-policy)
|
||||
comps=$(cd /dev/disk/; echo *)
|
||||
;;
|
||||
--kver)
|
||||
comps=$(cd /lib/modules; echo [0-9]*)
|
||||
;;
|
||||
*)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ $cur = -* ]]; then
|
||||
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
|
||||
local args
|
||||
_count_args
|
||||
if [[ $args -eq 1 ]]; then
|
||||
_filedir
|
||||
return 0
|
||||
elif [[ $args -eq 2 ]]; then
|
||||
comps=$(cd /lib/modules; echo [0-9]*)
|
||||
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
complete -F _dracut dracut
|
@@ -16,9 +16,8 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
dwarning() {
|
||||
echo "Warning: $@" >&2
|
||||
echo "Warning: $*" >&2
|
||||
}
|
||||
|
||||
dinfo() {
|
||||
@@ -26,11 +25,11 @@ dinfo() {
|
||||
}
|
||||
|
||||
derror() {
|
||||
echo "Error: $@" >&2
|
||||
echo "Error: $*" >&2
|
||||
}
|
||||
|
||||
usage() {
|
||||
# 80x25 linebreak here ^
|
||||
# 80x25 linebreak here ^
|
||||
cat << EOF
|
||||
Usage: $0 [OPTION]... <initramfs> <base image> [<image>...]
|
||||
Creates initial ramdisk image by concatenating several images from the command
|
||||
@@ -49,27 +48,46 @@ line and /boot/dracut/
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
imagedir=/boot/dracut/
|
||||
overlay=/var/lib/dracut/overlay
|
||||
|
||||
while (($# > 0)); do
|
||||
case $1 in
|
||||
-f|--force) force=yes;;
|
||||
-i|--imagedir) imagedir=$2;shift;;
|
||||
-o|--overlaydir) overlay=$2;shift;;
|
||||
--nooverlay) no_overlay=yes;shift;;
|
||||
--noimagedir) no_imagedir=yes;shift;;
|
||||
-h|--help) usage; exit 1 ;;
|
||||
--debug) debug="yes";;
|
||||
-v|--verbose) beverbose="yes";;
|
||||
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
|
||||
-f | --force) force=yes ;;
|
||||
-i | --imagedir)
|
||||
imagedir=$2
|
||||
shift
|
||||
;;
|
||||
-o | --overlaydir)
|
||||
overlay=$2
|
||||
shift
|
||||
;;
|
||||
--nooverlay)
|
||||
no_overlay=yes
|
||||
shift
|
||||
;;
|
||||
--noimagedir)
|
||||
no_imagedir=yes
|
||||
shift
|
||||
;;
|
||||
-h | --help)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
--debug) export debug="yes" ;;
|
||||
-v | --verbose) beverbose="yes" ;;
|
||||
-*)
|
||||
printf "\nUnknown option: %s\n\n" "$1" >&2
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
*) break ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
outfile=$1; shift
|
||||
outfile=$1
|
||||
shift
|
||||
|
||||
if [[ -z $outfile ]]; then
|
||||
derror "No output file specified."
|
||||
@@ -77,7 +95,8 @@ if [[ -z $outfile ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
baseimage=$1; shift
|
||||
baseimage=$1
|
||||
shift
|
||||
|
||||
if [[ -z $baseimage ]]; then
|
||||
derror "No base image specified."
|
||||
@@ -103,8 +122,11 @@ fi
|
||||
if [[ ! $no_overlay ]]; then
|
||||
ofile="$imagedir/90-overlay.img"
|
||||
dinfo "Creating image $ofile from directory $overlay"
|
||||
type pigz &>/dev/null && gzip=pigz || gzip=gzip
|
||||
( cd "$overlay"; find . |cpio --quiet -H newc -o |$gzip -9 > "$ofile"; )
|
||||
type pigz &> /dev/null && gzip=pigz || gzip=gzip
|
||||
(
|
||||
cd "$overlay" || return 1
|
||||
find . | cpio --quiet -H newc -o | $gzip -9 > "$ofile"
|
||||
)
|
||||
fi
|
||||
|
||||
if [[ ! $no_imagedir ]]; then
|
||||
@@ -113,7 +135,7 @@ if [[ ! $no_imagedir ]]; then
|
||||
done
|
||||
fi
|
||||
|
||||
images+=($@)
|
||||
images+=("$@")
|
||||
|
||||
dinfo "Using base image $baseimage"
|
||||
cat -- "$baseimage" > "$outfile"
|
||||
|
@@ -22,16 +22,16 @@ export LC_MESSAGES=C
|
||||
# is_func <command>
|
||||
# Check whether $1 is a function.
|
||||
is_func() {
|
||||
[[ "$(type -t "$1")" = "function" ]]
|
||||
[[ "$(type -t "$1")" == "function" ]]
|
||||
}
|
||||
|
||||
|
||||
# Generic substring function. If $2 is in $1, return 0.
|
||||
strstr() { [[ $1 = *"$2"* ]]; }
|
||||
strstr() { [[ $1 == *"$2"* ]]; }
|
||||
# Generic glob matching function. If glob pattern $2 matches anywhere in $1, OK
|
||||
strglobin() { [[ $1 = *$2* ]]; }
|
||||
strglobin() { [[ $1 == *$2* ]]; }
|
||||
# Generic glob matching function. If glob pattern $2 matches all of $1, OK
|
||||
strglob() { [[ $1 = $2 ]]; }
|
||||
# shellcheck disable=SC2053
|
||||
strglob() { [[ $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
|
||||
@@ -46,42 +46,42 @@ find_binary() {
|
||||
local p
|
||||
[[ -z ${1##/*} ]] || _delim="/"
|
||||
|
||||
if [[ "$1" == *.so* ]]; then
|
||||
for l in libdirs ; do
|
||||
if [[ $1 == *.so* ]]; then
|
||||
# shellcheck disable=SC2154
|
||||
for l in $libdirs; do
|
||||
_path="${l}${_delim}${1}"
|
||||
if { $DRACUT_LDD "${dracutsysrootdir}${_path}" &>/dev/null; }; then
|
||||
if { $DRACUT_LDD "${dracutsysrootdir}${_path}" &> /dev/null; }; then
|
||||
printf "%s\n" "${_path}"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
_path="${_delim}${1}"
|
||||
if { $DRACUT_LDD "${dracutsysrootdir}${_path}" &>/dev/null; }; then
|
||||
if { $DRACUT_LDD "${dracutsysrootdir}${_path}" &> /dev/null; }; then
|
||||
printf "%s\n" "${_path}"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
if [[ "$1" == */* ]]; then
|
||||
if [[ $1 == */* ]]; then
|
||||
_path="${_delim}${1}"
|
||||
if [[ -L ${dracutsysrootdir}${_path} ]] || [[ -x ${dracutsysrootdir}${_path} ]]; then
|
||||
printf "%s\n" "${_path}"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
for p in $DRACUT_PATH ; do
|
||||
for p in $DRACUT_PATH; do
|
||||
_path="${p}${_delim}${1}"
|
||||
if [[ -L ${dracutsysrootdir}${_path} ]] || [[ -x ${dracutsysrootdir}${_path} ]]; then
|
||||
if [[ -L ${dracutsysrootdir}${_path} ]] || [[ -x ${dracutsysrootdir}${_path} ]]; then
|
||||
printf "%s\n" "${_path}"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
[[ -n "$dracutsysrootdir" ]] && return 1
|
||||
[[ -n $dracutsysrootdir ]] && return 1
|
||||
type -P "${1##*/}"
|
||||
}
|
||||
|
||||
ldconfig_paths()
|
||||
{
|
||||
$DRACUT_LDCONFIG ${dracutsysrootdir:+-r ${dracutsysrootdir} -f /etc/ld.so.conf} -pN 2>/dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq
|
||||
ldconfig_paths() {
|
||||
$DRACUT_LDCONFIG ${dracutsysrootdir:+-r ${dracutsysrootdir} -f /etc/ld.so.conf} -pN 2> /dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq
|
||||
}
|
||||
|
||||
# Version comparision function. Assumes Linux style version scheme.
|
||||
@@ -89,31 +89,40 @@ ldconfig_paths()
|
||||
# $2 = comparision op (gt, ge, eq, le, lt, ne)
|
||||
# $3 = version b
|
||||
vercmp() {
|
||||
local _n1=(${1//./ }) _op=$2 _n2=(${3//./ }) _i _res
|
||||
local _n1
|
||||
read -r -a _n1 <<< "${1//./ }"
|
||||
local _op=$2
|
||||
local _n2
|
||||
read -r -a _n2 <<< "${3//./ }"
|
||||
local _i _res
|
||||
|
||||
for ((_i=0; ; _i++))
|
||||
do
|
||||
if [[ ! ${_n1[_i]}${_n2[_i]} ]]; then _res=0
|
||||
elif ((${_n1[_i]:-0} > ${_n2[_i]:-0})); then _res=1
|
||||
elif ((${_n1[_i]:-0} < ${_n2[_i]:-0})); then _res=2
|
||||
else continue
|
||||
for ((_i = 0; ; _i++)); do
|
||||
if [[ ! ${_n1[_i]}${_n2[_i]} ]]; then
|
||||
_res=0
|
||||
elif ((${_n1[_i]:-0} > ${_n2[_i]:-0})); then
|
||||
_res=1
|
||||
elif ((${_n1[_i]:-0} < ${_n2[_i]:-0})); then
|
||||
_res=2
|
||||
else
|
||||
continue
|
||||
fi
|
||||
break
|
||||
done
|
||||
|
||||
case $_op in
|
||||
gt) ((_res == 1));;
|
||||
ge) ((_res != 2));;
|
||||
eq) ((_res == 0));;
|
||||
le) ((_res != 1));;
|
||||
lt) ((_res == 2));;
|
||||
ne) ((_res != 0));;
|
||||
gt) ((_res == 1)) ;;
|
||||
ge) ((_res != 2)) ;;
|
||||
eq) ((_res == 0)) ;;
|
||||
le) ((_res != 1)) ;;
|
||||
lt) ((_res == 2)) ;;
|
||||
ne) ((_res != 0)) ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Create all subdirectories for given path without creating the last element.
|
||||
# $1 = path
|
||||
mksubdirs() {
|
||||
# shellcheck disable=SC2174
|
||||
[[ -e ${1%/*} ]] || mkdir -m 0755 -p -- "${1%/*}"
|
||||
}
|
||||
|
||||
@@ -122,8 +131,7 @@ mksubdirs() {
|
||||
print_vars() {
|
||||
local _var _value
|
||||
|
||||
for _var in "$@"
|
||||
do
|
||||
for _var in "$@"; do
|
||||
eval printf -v _value "%s" \""\$$_var"\"
|
||||
[[ ${_value} ]] && printf '%s="%s"\n' "$_var" "$_value"
|
||||
done
|
||||
@@ -136,10 +144,11 @@ print_vars() {
|
||||
# $ normalize_path ///test/test//
|
||||
# /test/test
|
||||
normalize_path() {
|
||||
# shellcheck disable=SC2064
|
||||
trap "$(shopt -p extglob)" RETURN
|
||||
shopt -q -s extglob
|
||||
set -- "${1//+(\/)//}"
|
||||
shopt -q -u extglob
|
||||
printf "%s\n" "${1%/}"
|
||||
local p=${1//+(\/)//}
|
||||
printf "%s\n" "${p%/}"
|
||||
}
|
||||
|
||||
# convert_abs_rel <from> <to>
|
||||
@@ -155,48 +164,47 @@ convert_abs_rel() {
|
||||
set -- "$(normalize_path "$1")" "$(normalize_path "$2")"
|
||||
|
||||
# corner case #1 - self looping link
|
||||
[[ "$1" == "$2" ]] && { printf "%s\n" "${1##*/}"; return; }
|
||||
[[ $1 == "$2" ]] && {
|
||||
printf "%s\n" "${1##*/}"
|
||||
return
|
||||
}
|
||||
|
||||
# corner case #2 - own dir link
|
||||
[[ "${1%/*}" == "$2" ]] && { printf ".\n"; return; }
|
||||
[[ ${1%/*} == "$2" ]] && {
|
||||
printf ".\n"
|
||||
return
|
||||
}
|
||||
|
||||
IFS="/" __current=($1)
|
||||
IFS="/" __absolute=($2)
|
||||
IFS=/ read -r -a __current <<< "$1"
|
||||
IFS=/ read -r -a __absolute <<< "$2"
|
||||
|
||||
__abssize=${#__absolute[@]}
|
||||
__cursize=${#__current[@]}
|
||||
|
||||
while [[ "${__absolute[__level]}" == "${__current[__level]}" ]]
|
||||
do
|
||||
(( __level++ ))
|
||||
if (( __level > __abssize || __level > __cursize ))
|
||||
then
|
||||
while [[ ${__absolute[__level]} == "${__current[__level]}" ]]; do
|
||||
((__level++))
|
||||
if ((__level > __abssize || __level > __cursize)); then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
for ((__i = __level; __i < __cursize-1; __i++))
|
||||
do
|
||||
if ((__i > __level))
|
||||
then
|
||||
for ((__i = __level; __i < __cursize - 1; __i++)); do
|
||||
if ((__i > __level)); then
|
||||
__newpath=$__newpath"/"
|
||||
fi
|
||||
__newpath=$__newpath".."
|
||||
done
|
||||
|
||||
for ((__i = __level; __i < __abssize; __i++))
|
||||
do
|
||||
if [[ -n $__newpath ]]
|
||||
then
|
||||
for ((__i = __level; __i < __abssize; __i++)); do
|
||||
if [[ -n $__newpath ]]; then
|
||||
__newpath=$__newpath"/"
|
||||
fi
|
||||
__newpath=$__newpath${__absolute[__i]}
|
||||
done
|
||||
|
||||
printf "%s\n" "$__newpath"
|
||||
printf -- "%s\n" "$__newpath"
|
||||
}
|
||||
|
||||
|
||||
# get_fs_env <device>
|
||||
# Get and the ID_FS_TYPE variable from udev for a device.
|
||||
# Example:
|
||||
@@ -206,12 +214,12 @@ get_fs_env() {
|
||||
[[ $1 ]] || return
|
||||
unset ID_FS_TYPE
|
||||
ID_FS_TYPE=$(blkid -u filesystem -o export -- "$1" \
|
||||
| while read line || [ -n "$line" ]; do
|
||||
if [[ "$line" == TYPE\=* ]]; then
|
||||
printf "%s" "${line#TYPE=}";
|
||||
exit 0;
|
||||
| while read -r line || [ -n "$line" ]; do
|
||||
if [[ $line == "TYPE="* ]]; then
|
||||
printf "%s" "${line#TYPE=}"
|
||||
exit 0
|
||||
fi
|
||||
done)
|
||||
done)
|
||||
if [[ $ID_FS_TYPE ]]; then
|
||||
printf "%s" "$ID_FS_TYPE"
|
||||
return 0
|
||||
@@ -226,11 +234,15 @@ get_fs_env() {
|
||||
# 8:2
|
||||
get_maj_min() {
|
||||
local _majmin
|
||||
_majmin="$(stat -L -c '%t:%T' "$1" 2>/dev/null)"
|
||||
printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))"
|
||||
out="$(grep -m1 -oP "^$1 \K\S+$" "${get_maj_min_cache_file:?}")"
|
||||
if [ -z "$out" ]; then
|
||||
_majmin="$(stat -L -c '%t:%T' "$1" 2> /dev/null)"
|
||||
out="$(printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))")"
|
||||
echo "$1 $out" >> "${get_maj_min_cache_file:?}"
|
||||
fi
|
||||
echo -n "$out"
|
||||
}
|
||||
|
||||
|
||||
# get_devpath_block <device>
|
||||
# get the DEVPATH in /sys of a block device
|
||||
get_devpath_block() {
|
||||
@@ -238,8 +250,8 @@ get_devpath_block() {
|
||||
_majmin=$(get_maj_min "$1")
|
||||
|
||||
for _i in /sys/block/*/dev /sys/block/*/*/dev; do
|
||||
[[ -e "$_i" ]] || continue
|
||||
if [[ "$_majmin" == "$(<"$_i")" ]]; then
|
||||
[[ -e $_i ]] || continue
|
||||
if [[ $_majmin == "$(< "$_i")" ]]; then
|
||||
printf "%s" "${_i%/dev}"
|
||||
return 0
|
||||
fi
|
||||
@@ -254,10 +266,10 @@ get_persistent_dev() {
|
||||
_dev=$(get_maj_min "$1")
|
||||
[ -z "$_dev" ] && return
|
||||
|
||||
if [[ -n "$persistent_policy" ]]; then
|
||||
_pol="/dev/disk/${persistent_policy}/*"
|
||||
if [[ -n $persistent_policy ]]; then
|
||||
_pol="/dev/disk/${persistent_policy}/*"
|
||||
else
|
||||
_pol=
|
||||
_pol=
|
||||
fi
|
||||
|
||||
for i in \
|
||||
@@ -268,9 +280,8 @@ get_persistent_dev() {
|
||||
/dev/disk/by-partuuid/* \
|
||||
/dev/disk/by-partlabel/* \
|
||||
/dev/disk/by-id/* \
|
||||
/dev/disk/by-path/* \
|
||||
; do
|
||||
[[ -e "$i" ]] || continue
|
||||
/dev/disk/by-path/*; do
|
||||
[[ -e $i ]] || continue
|
||||
[[ $i == /dev/mapper/control ]] && continue
|
||||
[[ $i == /dev/mapper/mpath* ]] && continue
|
||||
_tmp=$(get_maj_min "$i")
|
||||
@@ -310,15 +321,20 @@ shorten_persistent_dev() {
|
||||
local _dev="$1"
|
||||
case "$_dev" in
|
||||
/dev/disk/by-uuid/*)
|
||||
printf "%s" "UUID=${_dev##*/}";;
|
||||
printf "%s" "UUID=${_dev##*/}"
|
||||
;;
|
||||
/dev/disk/by-label/*)
|
||||
printf "%s" "LABEL=${_dev##*/}";;
|
||||
printf "%s" "LABEL=${_dev##*/}"
|
||||
;;
|
||||
/dev/disk/by-partuuid/*)
|
||||
printf "%s" "PARTUUID=${_dev##*/}";;
|
||||
printf "%s" "PARTUUID=${_dev##*/}"
|
||||
;;
|
||||
/dev/disk/by-partlabel/*)
|
||||
printf "%s" "PARTLABEL=${_dev##*/}";;
|
||||
printf "%s" "PARTLABEL=${_dev##*/}"
|
||||
;;
|
||||
*)
|
||||
printf "%s" "$_dev";;
|
||||
printf "%s" "$_dev"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -335,13 +351,14 @@ shorten_persistent_dev() {
|
||||
find_block_device() {
|
||||
local _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 || [ -n "$_dev" ]; do
|
||||
findmnt -e -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | {
|
||||
while read -r _majmin _dev || [ -n "$_dev" ]; do
|
||||
if [[ -b $_dev ]]; then
|
||||
if ! [[ $_majmin ]] || [[ $_majmin == 0:* ]]; then
|
||||
_majmin=$(get_maj_min $_dev)
|
||||
_majmin=$(get_maj_min "$_dev")
|
||||
fi
|
||||
if [[ $_majmin ]]; then
|
||||
printf "%s\n" "$_majmin"
|
||||
@@ -350,22 +367,24 @@ find_block_device() {
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
if [[ $_dev = *:* ]]; then
|
||||
if [[ $_dev == *:* ]]; then
|
||||
printf "%s\n" "$_dev"
|
||||
return 0
|
||||
fi
|
||||
done; return 1; } && return 0
|
||||
done
|
||||
return 1
|
||||
} && return 0
|
||||
fi
|
||||
# fall back to /etc/fstab
|
||||
|
||||
findmnt -e --fstab -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | { \
|
||||
while read _majmin _dev || [ -n "$_dev" ]; do
|
||||
findmnt -e --fstab -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | {
|
||||
while read -r _majmin _dev || [ -n "$_dev" ]; do
|
||||
if ! [[ $_dev ]]; then
|
||||
_dev="$_majmin"
|
||||
unset _majmin
|
||||
fi
|
||||
if [[ -b $_dev ]]; then
|
||||
[[ $_majmin ]] || _majmin=$(get_maj_min $_dev)
|
||||
[[ $_majmin ]] || _majmin=$(get_maj_min "$_dev")
|
||||
if [[ $_majmin ]]; then
|
||||
printf "%s\n" "$_majmin"
|
||||
else
|
||||
@@ -373,11 +392,13 @@ find_block_device() {
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
if [[ $_dev = *:* ]]; then
|
||||
if [[ $_dev == *:* ]]; then
|
||||
printf "%s\n" "$_dev"
|
||||
return 0
|
||||
fi
|
||||
done; return 1; } && return 0
|
||||
done
|
||||
return 1
|
||||
} && return 0
|
||||
|
||||
return 1
|
||||
}
|
||||
@@ -394,22 +415,26 @@ find_mp_fstype() {
|
||||
local _fs
|
||||
|
||||
if [[ $use_fstab != yes ]]; then
|
||||
findmnt -e -v -n -o 'FSTYPE' --target "$1" | { \
|
||||
while read _fs || [ -n "$_fs" ]; do
|
||||
findmnt -e -v -n -o 'FSTYPE' --target "$1" | {
|
||||
while read -r _fs || [ -n "$_fs" ]; do
|
||||
[[ $_fs ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
[[ $_fs == "autofs" ]] && continue
|
||||
printf "%s" "$_fs"
|
||||
return 0
|
||||
done; return 1; } && return 0
|
||||
done
|
||||
return 1
|
||||
} && return 0
|
||||
fi
|
||||
|
||||
findmnt --fstab -e -v -n -o 'FSTYPE' --target "$1" | { \
|
||||
while read _fs || [ -n "$_fs" ]; do
|
||||
findmnt --fstab -e -v -n -o 'FSTYPE' --target "$1" | {
|
||||
while read -r _fs || [ -n "$_fs" ]; do
|
||||
[[ $_fs ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
[[ $_fs == "autofs" ]] && continue
|
||||
printf "%s" "$_fs"
|
||||
return 0
|
||||
done; return 1; } && return 0
|
||||
done
|
||||
return 1
|
||||
} && return 0
|
||||
|
||||
return 1
|
||||
}
|
||||
@@ -425,27 +450,31 @@ find_mp_fstype() {
|
||||
find_dev_fstype() {
|
||||
local _find_dev _fs
|
||||
_find_dev="$1"
|
||||
if ! [[ "$_find_dev" = /dev* ]]; then
|
||||
if ! [[ $_find_dev == /dev* ]]; then
|
||||
[[ -b "/dev/block/$_find_dev" ]] && _find_dev="/dev/block/$_find_dev"
|
||||
fi
|
||||
|
||||
if [[ $use_fstab != yes ]]; then
|
||||
findmnt -e -v -n -o 'FSTYPE' --source "$_find_dev" | { \
|
||||
while read _fs || [ -n "$_fs" ]; do
|
||||
findmnt -e -v -n -o 'FSTYPE' --source "$_find_dev" | {
|
||||
while read -r _fs || [ -n "$_fs" ]; do
|
||||
[[ $_fs ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
[[ $_fs == "autofs" ]] && continue
|
||||
printf "%s" "$_fs"
|
||||
return 0
|
||||
done; return 1; } && return 0
|
||||
done
|
||||
return 1
|
||||
} && return 0
|
||||
fi
|
||||
|
||||
findmnt --fstab -e -v -n -o 'FSTYPE' --source "$_find_dev" | { \
|
||||
while read _fs || [ -n "$_fs" ]; do
|
||||
findmnt --fstab -e -v -n -o 'FSTYPE' --source "$_find_dev" | {
|
||||
while read -r _fs || [ -n "$_fs" ]; do
|
||||
[[ $_fs ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
[[ $_fs == "autofs" ]] && continue
|
||||
printf "%s" "$_fs"
|
||||
return 0
|
||||
done; return 1; } && return 0
|
||||
done
|
||||
return 1
|
||||
} && return 0
|
||||
|
||||
return 1
|
||||
}
|
||||
@@ -460,7 +489,7 @@ find_dev_fstype() {
|
||||
# rw,relatime,discard,data=ordered
|
||||
find_mp_fsopts() {
|
||||
if [[ $use_fstab != yes ]]; then
|
||||
findmnt -e -v -n -o 'OPTIONS' --target "$1" 2>/dev/null && return 0
|
||||
findmnt -e -v -n -o 'OPTIONS' --target "$1" 2> /dev/null && return 0
|
||||
fi
|
||||
|
||||
findmnt --fstab -e -v -n -o 'OPTIONS' --target "$1"
|
||||
@@ -470,47 +499,45 @@ find_mp_fsopts() {
|
||||
# Echo the filesystem options for a given device.
|
||||
# /proc/self/mountinfo is taken as the primary source of information
|
||||
# and /etc/fstab is used as a fallback.
|
||||
# if `use_fstab == yes`, then only `/etc/fstab` is used.
|
||||
#
|
||||
# Example:
|
||||
# $ find_dev_fsopts /dev/sda2
|
||||
# rw,relatime,discard,data=ordered
|
||||
find_dev_fsopts() {
|
||||
local _find_dev _opts
|
||||
local _find_dev
|
||||
_find_dev="$1"
|
||||
if ! [[ "$_find_dev" = /dev* ]]; then
|
||||
if ! [[ $_find_dev == /dev* ]]; then
|
||||
[[ -b "/dev/block/$_find_dev" ]] && _find_dev="/dev/block/$_find_dev"
|
||||
fi
|
||||
|
||||
if [[ $use_fstab != yes ]]; then
|
||||
findmnt -e -v -n -o 'OPTIONS' --source "$_find_dev" 2>/dev/null && return 0
|
||||
findmnt -e -v -n -o 'OPTIONS' --source "$_find_dev" 2> /dev/null && return 0
|
||||
fi
|
||||
|
||||
findmnt --fstab -e -v -n -o 'OPTIONS' --source "$_find_dev"
|
||||
}
|
||||
|
||||
|
||||
# finds the major:minor of the block device backing the root filesystem.
|
||||
find_root_block_device() { find_block_device /; }
|
||||
|
||||
# for_each_host_dev_fs <func>
|
||||
# Execute "<func> <dev> <filesystem>" for every "<dev> <fs>" pair found
|
||||
# in ${host_fs_types[@]}
|
||||
for_each_host_dev_fs()
|
||||
{
|
||||
for_each_host_dev_fs() {
|
||||
local _func="$1"
|
||||
local _dev
|
||||
local _ret=1
|
||||
|
||||
[[ "${#host_fs_types[@]}" ]] || return 2
|
||||
|
||||
|
||||
for _dev in "${!host_fs_types[@]}"; do
|
||||
$_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0
|
||||
done
|
||||
return $_ret
|
||||
}
|
||||
|
||||
host_fs_all()
|
||||
{
|
||||
host_fs_all() {
|
||||
printf "%s\n" "${host_fs_types[@]}"
|
||||
}
|
||||
|
||||
@@ -521,15 +548,15 @@ host_fs_all()
|
||||
check_block_and_slaves() {
|
||||
local _x
|
||||
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
|
||||
if ! lvm_internal_dev $2; then "$1" $2 && return; fi
|
||||
if ! lvm_internal_dev "$2"; then "$1" "$2" && return; fi
|
||||
check_vol_slaves "$@" && return 0
|
||||
if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then
|
||||
check_block_and_slaves $1 $(<"/sys/dev/block/$2/../dev") && return 0
|
||||
check_block_and_slaves "$1" "$(< "/sys/dev/block/$2/../dev")" && return 0
|
||||
fi
|
||||
for _x in /sys/dev/block/$2/slaves/*; do
|
||||
for _x in /sys/dev/block/"$2"/slaves/*; do
|
||||
[[ -f $_x/dev ]] || continue
|
||||
[[ $_x/subsystem -ef /sys/class/block ]] || continue
|
||||
check_block_and_slaves $1 $(<"$_x/dev") && return 0
|
||||
check_block_and_slaves "$1" "$(< "$_x/dev")" && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
@@ -537,50 +564,48 @@ check_block_and_slaves() {
|
||||
check_block_and_slaves_all() {
|
||||
local _x _ret=1
|
||||
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
|
||||
if ! lvm_internal_dev $2 && "$1" $2; then
|
||||
if ! lvm_internal_dev "$2" && "$1" "$2"; then
|
||||
_ret=0
|
||||
fi
|
||||
check_vol_slaves_all "$@" && return 0
|
||||
if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then
|
||||
check_block_and_slaves_all $1 $(<"/sys/dev/block/$2/../dev") && _ret=0
|
||||
check_block_and_slaves_all "$1" "$(< "/sys/dev/block/$2/../dev")" && _ret=0
|
||||
fi
|
||||
for _x in /sys/dev/block/$2/slaves/*; do
|
||||
for _x in /sys/dev/block/"$2"/slaves/*; do
|
||||
[[ -f $_x/dev ]] || continue
|
||||
[[ $_x/subsystem -ef /sys/class/block ]] || continue
|
||||
check_block_and_slaves_all $1 $(<"$_x/dev") && _ret=0
|
||||
check_block_and_slaves_all "$1" "$(< "$_x/dev")" && _ret=0
|
||||
done
|
||||
return $_ret
|
||||
}
|
||||
# for_each_host_dev_and_slaves <func>
|
||||
# Execute "<func> <dev>" for every "<dev>" found
|
||||
# in ${host_devs[@]} and their slaves
|
||||
for_each_host_dev_and_slaves_all()
|
||||
{
|
||||
for_each_host_dev_and_slaves_all() {
|
||||
local _func="$1"
|
||||
local _dev
|
||||
local _ret=1
|
||||
|
||||
[[ "${host_devs[@]}" ]] || return 2
|
||||
[[ "${host_devs[*]}" ]] || return 2
|
||||
|
||||
for _dev in "${host_devs[@]}"; do
|
||||
[[ -b "$_dev" ]] || continue
|
||||
if check_block_and_slaves_all $_func $(get_maj_min $_dev); then
|
||||
[[ -b $_dev ]] || continue
|
||||
if check_block_and_slaves_all "$_func" "$(get_maj_min "$_dev")"; then
|
||||
_ret=0
|
||||
fi
|
||||
done
|
||||
return $_ret
|
||||
}
|
||||
|
||||
for_each_host_dev_and_slaves()
|
||||
{
|
||||
for_each_host_dev_and_slaves() {
|
||||
local _func="$1"
|
||||
local _dev
|
||||
|
||||
[[ "${host_devs[@]}" ]] || return 2
|
||||
[[ "${host_devs[*]}" ]] || return 2
|
||||
|
||||
for _dev in "${host_devs[@]}"; do
|
||||
[[ -b "$_dev" ]] || continue
|
||||
check_block_and_slaves $_func $(get_maj_min $_dev) && return 0
|
||||
[[ -b $_dev ]] || continue
|
||||
check_block_and_slaves "$_func" "$(get_maj_min "$_dev")" && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
@@ -592,50 +617,43 @@ 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 _dm _majmin
|
||||
local _vg _pv _dm _majmin
|
||||
_majmin="$2"
|
||||
_lv="/dev/block/$_majmin"
|
||||
_dm=/sys/dev/block/$_majmin/dm
|
||||
[[ -f $_dm/uuid && $(<$_dm/uuid) =~ LVM-* ]] || return 1
|
||||
_vg=$(dmsetup splitname --noheadings -o vg_name $(<"$_dm/name") )
|
||||
[[ -f $_dm/uuid && $(< "$_dm"/uuid) =~ LVM-* ]] || return 1
|
||||
_vg=$(dmsetup splitname --noheadings -o vg_name "$(< "$_dm/name")")
|
||||
# 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 $1 $(get_maj_min $_pv) && return 0
|
||||
for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2> /dev/null); do
|
||||
check_block_and_slaves "$1" "$(get_maj_min "$_pv")" && return 0
|
||||
done
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
check_vol_slaves_all() {
|
||||
local _lv _vg _pv _majmin
|
||||
local _vg _pv _majmin
|
||||
_majmin="$2"
|
||||
_lv="/dev/block/$_majmin"
|
||||
_dm="/sys/dev/block/$_majmin/dm"
|
||||
[[ -f $_dm/uuid && $(<$_dm/uuid) =~ LVM-* ]] || return 1
|
||||
_vg=$(dmsetup splitname --noheadings -o vg_name $(<"$_dm/name") )
|
||||
[[ -f $_dm/uuid && $(< "$_dm"/uuid) =~ LVM-* ]] || return 1
|
||||
_vg=$(dmsetup splitname --noheadings -o vg_name "$(< "$_dm/name")")
|
||||
# strip space
|
||||
_vg="${_vg//[[:space:]]/}"
|
||||
if [[ $_vg ]]; then
|
||||
# when filter/global_filter is set, lvm may be failed
|
||||
lvm lvs --noheadings -o vg_name $_vg 2>/dev/null 1>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
return 1
|
||||
if ! lvm lvs --noheadings -o vg_name "$_vg" 2> /dev/null 1> /dev/null; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
|
||||
do
|
||||
check_block_and_slaves_all $1 $(get_maj_min $_pv)
|
||||
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
|
||||
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
|
||||
@@ -644,20 +662,21 @@ fs_get_option() {
|
||||
local _option=$2
|
||||
local OLDIFS="$IFS"
|
||||
IFS=,
|
||||
# shellcheck disable=SC2086
|
||||
set -- $_fsopts
|
||||
IFS="$OLDIFS"
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
$_option=*)
|
||||
echo ${1#${_option}=}
|
||||
echo "${1#${_option}=}"
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
check_kernel_config()
|
||||
{
|
||||
check_kernel_config() {
|
||||
local _config_opt="$1"
|
||||
local _config_file
|
||||
[[ -f $dracutsysrootdir/boot/config-$kernel ]] \
|
||||
@@ -668,20 +687,19 @@ check_kernel_config()
|
||||
# no kernel config file, so return true
|
||||
[[ $_config_file ]] || return 0
|
||||
|
||||
grep -q -F "${_config_opt}=" "$_config_file" && return 0
|
||||
grep -q -F "${_config_opt}=" "$dracutsysrootdir$_config_file" && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
# 0 if the kernel module is either built-in or available
|
||||
# 1 if the kernel module is not enabled
|
||||
check_kernel_module() {
|
||||
modprobe -S $kernel --dry-run $1 &>/dev/null || return 1
|
||||
modprobe -S "$kernel" --dry-run "$1" &> /dev/null || return 1
|
||||
}
|
||||
|
||||
# get_cpu_vendor
|
||||
# Only two values are returned: AMD or Intel
|
||||
get_cpu_vendor ()
|
||||
{
|
||||
get_cpu_vendor() {
|
||||
if grep -qE AMD /proc/cpuinfo; then
|
||||
printf "AMD"
|
||||
fi
|
||||
@@ -692,22 +710,24 @@ get_cpu_vendor ()
|
||||
|
||||
# get_host_ucode
|
||||
# Get the hosts' ucode file based on the /proc/cpuinfo
|
||||
get_ucode_file ()
|
||||
{
|
||||
local family=`grep -E "cpu family" /proc/cpuinfo | head -1 | sed s/.*:\ //`
|
||||
local model=`grep -E "model" /proc/cpuinfo |grep -v name | head -1 | sed s/.*:\ //`
|
||||
local stepping=`grep -E "stepping" /proc/cpuinfo | head -1 | sed s/.*:\ //`
|
||||
get_ucode_file() {
|
||||
local family
|
||||
local model
|
||||
local stepping
|
||||
family=$(grep -E "cpu family" /proc/cpuinfo | head -1 | sed "s/.*:\ //")
|
||||
model=$(grep -E "model" /proc/cpuinfo | grep -v name | head -1 | sed "s/.*:\ //")
|
||||
stepping=$(grep -E "stepping" /proc/cpuinfo | head -1 | sed "s/.*:\ //")
|
||||
|
||||
if [[ "$(get_cpu_vendor)" == "AMD" ]]; then
|
||||
if [[ $family -ge 21 ]]; then
|
||||
printf "microcode_amd_fam%xh.bin" $family
|
||||
printf "microcode_amd_fam%xh.bin" "$family"
|
||||
else
|
||||
printf "microcode_amd.bin"
|
||||
fi
|
||||
fi
|
||||
if [[ "$(get_cpu_vendor)" == "Intel" ]]; then
|
||||
# The /proc/cpuinfo are in decimal.
|
||||
printf "%02x-%02x-%02x" ${family} ${model} ${stepping}
|
||||
printf "%02x-%02x-%02x" "${family}" "${model}" "${stepping}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -715,9 +735,9 @@ get_ucode_file ()
|
||||
# If it is an LVM device, touch only devices which have /dev/VG/LV symlink.
|
||||
lvm_internal_dev() {
|
||||
local dev_dm_dir=/sys/dev/block/$1/dm
|
||||
[[ ! -f $dev_dm_dir/uuid || $(<$dev_dm_dir/uuid) != LVM-* ]] && return 1 # Not an LVM device
|
||||
[[ ! -f $dev_dm_dir/uuid || $(< "$dev_dm_dir"/uuid) != LVM-* ]] && return 1 # Not an LVM device
|
||||
local DM_VG_NAME DM_LV_NAME DM_LV_LAYER
|
||||
eval $(dmsetup splitname --nameprefixes --noheadings --rows "$(<$dev_dm_dir/name)" 2>/dev/null)
|
||||
eval "$(dmsetup splitname --nameprefixes --noheadings --rows "$(< "$dev_dm_dir"/name)" 2> /dev/null)"
|
||||
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 0 # Better skip this!
|
||||
[[ ${DM_LV_LAYER} ]] || [[ ! -L /dev/${DM_VG_NAME}/${DM_LV_NAME} ]]
|
||||
}
|
||||
@@ -725,21 +745,23 @@ lvm_internal_dev() {
|
||||
btrfs_devs() {
|
||||
local _mp="$1"
|
||||
btrfs device usage "$_mp" \
|
||||
| while read _dev _rest; do
|
||||
str_starts "$_dev" "/" || continue
|
||||
_dev=${_dev%,}
|
||||
printf -- "%s\n" "$_dev"
|
||||
| while read -r _dev _; do
|
||||
str_starts "$_dev" "/" || continue
|
||||
_dev=${_dev%,}
|
||||
printf -- "%s\n" "$_dev"
|
||||
done
|
||||
}
|
||||
|
||||
iface_for_remote_addr() {
|
||||
# shellcheck disable=SC2046
|
||||
set -- $(ip -o route get to "$1")
|
||||
echo $3
|
||||
echo "$3"
|
||||
}
|
||||
|
||||
local_addr_for_remote_addr() {
|
||||
# shellcheck disable=SC2046
|
||||
set -- $(ip -o route get to "$1")
|
||||
echo $5
|
||||
echo "$5"
|
||||
}
|
||||
|
||||
peer_for_addr() {
|
||||
@@ -748,8 +770,8 @@ peer_for_addr() {
|
||||
|
||||
# quote periods in IPv4 address
|
||||
qtd=${addr//./\\.}
|
||||
ip -o addr show | \
|
||||
sed -n 's%^.* '"$qtd"' peer \([0-9a-f.:]\{1,\}\(/[0-9]*\)\?\).*$%\1%p'
|
||||
ip -o addr show \
|
||||
| sed -n 's%^.* '"$qtd"' peer \([0-9a-f.:]\{1,\}\(/[0-9]*\)\?\).*$%\1%p'
|
||||
}
|
||||
|
||||
netmask_for_addr() {
|
||||
@@ -765,12 +787,12 @@ gateway_for_iface() {
|
||||
local ifname=$1 addr=$2
|
||||
|
||||
case $addr in
|
||||
*.*) proto=4;;
|
||||
*:*) proto=6;;
|
||||
*) return;;
|
||||
*.*) proto=4 ;;
|
||||
*:*) proto=6 ;;
|
||||
*) return ;;
|
||||
esac
|
||||
ip -o -$proto route show | \
|
||||
sed -n "s/^default via \([0-9a-z.:]\{1,\}\) dev $ifname .*\$/\1/p"
|
||||
ip -o -$proto route show \
|
||||
| sed -n "s/^default via \([0-9a-z.:]\{1,\}\) dev $ifname .*\$/\1/p"
|
||||
}
|
||||
|
||||
# This works only for ifcfg-style network configuration!
|
||||
@@ -796,7 +818,7 @@ is_unbracketed_ipv6_address() {
|
||||
# remote address can be reached
|
||||
ip_params_for_remote_addr() {
|
||||
local remote_addr=$1
|
||||
local ifname local_addr peer netmask= gateway ifmac
|
||||
local ifname local_addr peer netmask gateway ifmac
|
||||
|
||||
[[ $remote_addr ]] || return 1
|
||||
ifname=$(iface_for_remote_addr "$remote_addr")
|
||||
@@ -808,21 +830,24 @@ ip_params_for_remote_addr() {
|
||||
# ifname clause to bind the interface name to a MAC address
|
||||
if [ -d "/sys/class/net/$ifname/bonding" ]; then
|
||||
dinfo "Found bonded interface '${ifname}'. Make sure to provide an appropriate 'bond=' cmdline."
|
||||
elif [ -e "/sys/class/net/$ifname/address" ] ; then
|
||||
elif [ -e "/sys/class/net/$ifname/address" ]; then
|
||||
ifmac=$(cat "/sys/class/net/$ifname/address")
|
||||
[[ $ifmac ]] && printf 'ifname=%s:%s ' "${ifname}" "${ifmac}"
|
||||
fi
|
||||
|
||||
bootproto=$(bootproto_for_iface "$ifname")
|
||||
case $bootproto in
|
||||
dhcp|dhcp6|auto6) ;;
|
||||
dhcp | dhcp6 | auto6) ;;
|
||||
dhcp4)
|
||||
bootproto=dhcp;;
|
||||
static*|"")
|
||||
bootproto=;;
|
||||
bootproto=dhcp
|
||||
;;
|
||||
static* | "")
|
||||
bootproto=
|
||||
;;
|
||||
*)
|
||||
derror "bootproto \"$bootproto\" is unsupported by dracut, trying static configuration"
|
||||
bootproto=;;
|
||||
bootproto=
|
||||
;;
|
||||
esac
|
||||
if [[ $bootproto ]]; then
|
||||
printf 'ip=%s:%s ' "${ifname}" "${bootproto}"
|
||||
@@ -841,7 +866,7 @@ ip_params_for_remote_addr() {
|
||||
is_unbracketed_ipv6_address "$peer" && peer="[$peer]"
|
||||
is_unbracketed_ipv6_address "$gateway" && gateway="[$gateway]"
|
||||
printf 'ip=%s:%s:%s:%s::%s:none ' \
|
||||
"${local_addr}" "${peer}" "${gateway}" "${netmask}" "${ifname}"
|
||||
"${local_addr}" "${peer}" "${gateway}" "${netmask}" "${ifname}"
|
||||
fi
|
||||
|
||||
}
|
||||
@@ -877,7 +902,7 @@ block_is_fcoe() {
|
||||
until [[ -d "$_dir/sys" ]]; do
|
||||
_dir="$_dir/.."
|
||||
if [[ -d "$_dir/subsystem" ]]; then
|
||||
subsystem=$(basename $(readlink $_dir/subsystem))
|
||||
subsystem=$(basename "$(readlink "$_dir"/subsystem)")
|
||||
[[ $subsystem == "fcoe" ]] && return 0
|
||||
fi
|
||||
done
|
||||
|
429
dracut-init.sh
429
dracut-init.sh
@@ -19,7 +19,7 @@
|
||||
#
|
||||
export LC_MESSAGES=C
|
||||
|
||||
if [[ "$EUID" = "0" ]] && ! [[ $DRACUT_NO_XATTR ]]; then
|
||||
if [[ $EUID == "0" ]] && ! [[ $DRACUT_NO_XATTR ]]; then
|
||||
export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,xattr,links -dfr"
|
||||
else
|
||||
export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,links -dfr"
|
||||
@@ -28,21 +28,23 @@ fi
|
||||
# is_func <command>
|
||||
# Check whether $1 is a function.
|
||||
is_func() {
|
||||
[[ "$(type -t "$1")" = "function" ]]
|
||||
[[ "$(type -t "$1")" == "function" ]]
|
||||
}
|
||||
|
||||
if ! [[ $dracutbasedir ]]; then
|
||||
dracutbasedir=${BASH_SOURCE[0]%/*}
|
||||
[[ $dracutbasedir = dracut-functions* ]] && dracutbasedir="."
|
||||
[[ $dracutbasedir == dracut-functions* ]] && dracutbasedir="."
|
||||
[[ $dracutbasedir ]] || dracutbasedir="."
|
||||
dracutbasedir="$(readlink -f $dracutbasedir)"
|
||||
fi
|
||||
|
||||
if ! is_func dinfo >/dev/null 2>&1; then
|
||||
if ! is_func dinfo > /dev/null 2>&1; then
|
||||
# shellcheck source=./dracut-logger.sh
|
||||
. "$dracutbasedir/dracut-logger.sh"
|
||||
dlog_init
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
if ! [[ $initdir ]]; then
|
||||
dfatal "initdir not set"
|
||||
exit 1
|
||||
@@ -57,10 +59,12 @@ if ! [[ $kernel ]]; then
|
||||
export kernel
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
srcmods="$dracutsysrootdir/lib/modules/$kernel/"
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
[[ $drivers_dir ]] && {
|
||||
if ! command -v kmod &>/dev/null && vercmp "$(modprobe --version | cut -d' ' -f3)" lt 3.7; then
|
||||
if ! command -v kmod &> /dev/null && vercmp "$(modprobe --version | cut -d' ' -f3)" lt 3.7; then
|
||||
dfatal 'To use --kmoddir option module-init-tools >= 3.7 is required.'
|
||||
exit 1
|
||||
fi
|
||||
@@ -83,11 +87,12 @@ DRACUT_LDD=${DRACUT_LDD:-ldd}
|
||||
DRACUT_TESTBIN=${DRACUT_TESTBIN:-/bin/sh}
|
||||
DRACUT_LDCONFIG=${DRACUT_LDCONFIG:-ldconfig}
|
||||
|
||||
. $dracutbasedir/dracut-functions.sh
|
||||
# shellcheck source=./dracut-functions.sh
|
||||
. "$dracutbasedir"/dracut-functions.sh
|
||||
|
||||
# Detect lib paths
|
||||
if ! [[ $libdirs ]] ; then
|
||||
if [[ "$($DRACUT_LDD $dracutsysrootdir$DRACUT_TESTBIN)" == */lib64/* ]] &>/dev/null \
|
||||
if ! [[ $libdirs ]]; then
|
||||
if [[ $("$DRACUT_LDD" "$dracutsysrootdir$DRACUT_TESTBIN") == */lib64/* ]] &> /dev/null \
|
||||
&& [[ -d $dracutsysrootdir/lib64 ]]; then
|
||||
libdirs+=" /lib64"
|
||||
[[ -d $dracutsysrootdir/usr/lib64 ]] && libdirs+=" /usr/lib64"
|
||||
@@ -105,41 +110,42 @@ fi
|
||||
# to check for required installed binaries
|
||||
# issues a standardized warning message
|
||||
require_binaries() {
|
||||
# shellcheck disable=SC2154
|
||||
local _module_name="${moddir##*/}"
|
||||
local _ret=0
|
||||
|
||||
if [[ "$1" = "-m" ]]; then
|
||||
if [[ $1 == "-m" ]]; then
|
||||
_module_name="$2"
|
||||
shift 2
|
||||
fi
|
||||
|
||||
for cmd in "$@"; do
|
||||
if ! find_binary "$cmd" &>/dev/null; then
|
||||
if ! find_binary "$cmd" &> /dev/null; then
|
||||
dinfo "dracut module '${_module_name#[0-9][0-9]}' will not be installed, because command '$cmd' could not be found!"
|
||||
((_ret++))
|
||||
fi
|
||||
done
|
||||
return $_ret
|
||||
return "$_ret"
|
||||
}
|
||||
|
||||
require_any_binary() {
|
||||
local _module_name="${moddir##*/}"
|
||||
local _ret=1
|
||||
|
||||
if [[ "$1" = "-m" ]]; then
|
||||
if [[ $1 == "-m" ]]; then
|
||||
_module_name="$2"
|
||||
shift 2
|
||||
fi
|
||||
|
||||
for cmd in "$@"; do
|
||||
if find_binary "$cmd" &>/dev/null; then
|
||||
if find_binary "$cmd" &> /dev/null; then
|
||||
_ret=0
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if (( $_ret != 0 )); then
|
||||
dinfo "$_module_name: Could not find any command of '$@'!"
|
||||
if ((_ret != 0)); then
|
||||
dinfo "$_module_name: Could not find any command of '$*'!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -147,19 +153,27 @@ require_any_binary() {
|
||||
}
|
||||
|
||||
dracut_need_initqueue() {
|
||||
>"$initdir/lib/dracut/need-initqueue"
|
||||
: > "$initdir/lib/dracut/need-initqueue"
|
||||
}
|
||||
|
||||
dracut_module_included() {
|
||||
# shellcheck disable=SC2154
|
||||
[[ " $mods_to_load $modules_loaded " == *\ $*\ * ]]
|
||||
}
|
||||
|
||||
dracut_no_switch_root() {
|
||||
>"$initdir/lib/dracut/no-switch-root"
|
||||
: > "$initdir/lib/dracut/no-switch-root"
|
||||
}
|
||||
|
||||
dracut_module_path() {
|
||||
echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }
|
||||
local _dir
|
||||
|
||||
# shellcheck disable=SC2231
|
||||
for _dir in "${dracutbasedir}"/modules.d/??${1}; do
|
||||
echo "$_dir"
|
||||
return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
if ! [[ $DRACUT_INSTALL ]]; then
|
||||
@@ -179,70 +193,78 @@ fi
|
||||
# DRACUT_INSTALL="dracut-install --debug"
|
||||
# in which case the string cannot be tested for being executable.
|
||||
DRINSTALLPARTS=0
|
||||
for i in $DRACUT_INSTALL ; do
|
||||
DRINSTALLPARTS=$(($DRINSTALLPARTS+1))
|
||||
for i in $DRACUT_INSTALL; do
|
||||
DRINSTALLPARTS=$((DRINSTALLPARTS + 1))
|
||||
done
|
||||
|
||||
if [[ $DRINSTALLPARTS = 1 ]] && ! command -v "$DRACUT_INSTALL" > /dev/null 2>&1 ; then
|
||||
if [[ $DRINSTALLPARTS == 1 ]] && ! command -v "$DRACUT_INSTALL" > /dev/null 2>&1; then
|
||||
dfatal "dracut-install not found!"
|
||||
exit 10
|
||||
fi
|
||||
|
||||
if [[ $hostonly == "-h" ]]; then
|
||||
if ! [[ $DRACUT_KERNEL_MODALIASES ]] || ! [[ -f "$DRACUT_KERNEL_MODALIASES" ]]; then
|
||||
if ! [[ $DRACUT_KERNEL_MODALIASES ]] || ! [[ -f $DRACUT_KERNEL_MODALIASES ]]; then
|
||||
export DRACUT_KERNEL_MODALIASES="${DRACUT_TMPDIR}/modaliases"
|
||||
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${srcmods:+--kerneldir "$srcmods"} --modalias > "$DRACUT_KERNEL_MODALIASES"
|
||||
"$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${srcmods:+--kerneldir "$srcmods"} --modalias > "$DRACUT_KERNEL_MODALIASES"
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
|
||||
inst_dir() {
|
||||
[[ -e ${initdir}/"$1" ]] && return 0 # already there
|
||||
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -d "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -d "$@" || :
|
||||
[[ -e ${initdir}/"$1" ]] && return 0 # already there
|
||||
if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -d "$@"; then
|
||||
derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -d "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
inst() {
|
||||
local _hostonly_install
|
||||
if [[ "$1" == "-H" ]]; then
|
||||
if [[ $1 == "-H" ]]; then
|
||||
_hostonly_install="-H"
|
||||
shift
|
||||
fi
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
# shellcheck disable=SC2154
|
||||
if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
|
||||
derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
inst_simple() {
|
||||
local _hostonly_install
|
||||
if [[ "$1" == "-H" ]]; then
|
||||
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 ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" || :
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -e $1 ]] || return 1 # no source
|
||||
if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"; then
|
||||
derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" || :
|
||||
fi
|
||||
}
|
||||
|
||||
inst_symlink() {
|
||||
local _hostonly_install
|
||||
if [[ "$1" == "-H" ]]; then
|
||||
if [[ $1 == "-H" ]]; then
|
||||
_hostonly_install="-H"
|
||||
shift
|
||||
fi
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -L $1 ]] || return 1
|
||||
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||
if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
|
||||
derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||
fi
|
||||
}
|
||||
|
||||
inst_multiple() {
|
||||
local _ret
|
||||
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
|
||||
_ret=$?
|
||||
(($_ret != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||
return $_ret
|
||||
if "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"; then
|
||||
return 0
|
||||
else
|
||||
_ret=$?
|
||||
derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||
return $_ret
|
||||
fi
|
||||
}
|
||||
|
||||
dracut_install() {
|
||||
@@ -250,45 +272,54 @@ dracut_install() {
|
||||
}
|
||||
|
||||
dracut_instmods() {
|
||||
local _silent=0;
|
||||
local i;
|
||||
[[ $no_kernel = yes ]] && return
|
||||
local _silent=0
|
||||
local i
|
||||
# shellcheck disable=SC2154
|
||||
[[ $no_kernel == yes ]] && return
|
||||
for i in "$@"; do
|
||||
[[ $i == "--silent" ]] && _silent=1
|
||||
done
|
||||
|
||||
$DRACUT_INSTALL \
|
||||
# shellcheck disable=SC2154
|
||||
if ! "$DRACUT_INSTALL" \
|
||||
${dracutsysrootdir:+-r "$dracutsysrootdir"} \
|
||||
${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@"
|
||||
(($? != 0)) && (($_silent == 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@" || :
|
||||
${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@"; then
|
||||
if ((_silent == 0)); then
|
||||
derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@" || :
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
inst_library() {
|
||||
local _hostonly_install
|
||||
if [[ "$1" == "-H" ]]; then
|
||||
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 ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -e $1 ]] || return 1 # no source
|
||||
if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
|
||||
derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||
fi
|
||||
}
|
||||
|
||||
inst_binary() {
|
||||
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
|
||||
if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"; then
|
||||
derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
|
||||
fi
|
||||
}
|
||||
|
||||
inst_script() {
|
||||
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
|
||||
if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"; then
|
||||
derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
|
||||
fi
|
||||
}
|
||||
|
||||
inst_fsck_help() {
|
||||
local _helper="/run/dracut/fsck/fsck_help_$1.txt"
|
||||
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper || :
|
||||
if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" "$_helper"; then
|
||||
derror "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" "$_helper" || :
|
||||
fi
|
||||
}
|
||||
|
||||
# Use with form hostonly="$(optional_hostonly)" inst_xxxx <args>
|
||||
@@ -296,8 +327,9 @@ inst_fsck_help() {
|
||||
# be applied, else will ignore hostonly mode and try to install all
|
||||
# given modules.
|
||||
optional_hostonly() {
|
||||
if [[ $hostonly_mode = "strict" ]]; then
|
||||
printf -- "$hostonly"
|
||||
# shellcheck disable=SC2154
|
||||
if [[ $hostonly_mode == "strict" ]]; then
|
||||
printf -- "%s" "$hostonly"
|
||||
else
|
||||
printf ""
|
||||
fi
|
||||
@@ -320,58 +352,70 @@ mark_hostonly() {
|
||||
# output: libfoo.so.8 libfoo.so
|
||||
# (Only if libfoo.so.8 and libfoo.so exists on host system.)
|
||||
rev_lib_symlinks() {
|
||||
local _fn
|
||||
local _orig
|
||||
local _links
|
||||
|
||||
[[ ! $1 ]] && return 0
|
||||
|
||||
local fn="$1" orig="$(readlink -f "$1")" links=''
|
||||
_fn="$1"
|
||||
_orig="$(readlink -f "$1")"
|
||||
_links=()
|
||||
|
||||
[[ ${fn} == *.so.* ]] || return 1
|
||||
[[ ${_fn} == *.so.* ]] || return 1
|
||||
|
||||
until [[ ${fn##*.} == so ]]; do
|
||||
fn="${fn%.*}"
|
||||
[[ -L ${fn} && $(readlink -f "${fn}") == ${orig} ]] && links+=" ${fn}"
|
||||
until [[ ${_fn##*.} == so ]]; do
|
||||
_fn="${_fn%.*}"
|
||||
[[ -L ${_fn} ]] && [[ $(readlink -f "${_fn}") == "${_orig}" ]] && _links+=("${_fn}")
|
||||
done
|
||||
|
||||
echo "${links}"
|
||||
echo "${_links[*]}}"
|
||||
}
|
||||
|
||||
# attempt to install any programs specified in a udev rule
|
||||
inst_rule_programs() {
|
||||
local _prog _bin
|
||||
|
||||
# shellcheck disable=SC2013
|
||||
for _prog in $(sed -nr 's/.*PROGRAM==?"([^ "]+).*/\1/p' "$1"); do
|
||||
_bin=""
|
||||
if [ -x ${udevdir}/$_prog ]; then
|
||||
_bin=${udevdir}/$_prog
|
||||
elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then
|
||||
# shellcheck disable=SC2154
|
||||
if [[ -x ${udevdir}/$_prog ]]; then
|
||||
_bin="${udevdir}"/$_prog
|
||||
elif [[ ${_prog/\$env\{/} == "$_prog" ]]; then
|
||||
_bin=$(find_binary "$_prog") || {
|
||||
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
|
||||
continue;
|
||||
continue
|
||||
}
|
||||
fi
|
||||
|
||||
[[ $_bin ]] && inst_binary "$_bin"
|
||||
done
|
||||
|
||||
# shellcheck disable=SC2013
|
||||
for _prog in $(sed -nr 's/.*RUN[+=]=?"([^ "]+).*/\1/p' "$1"); do
|
||||
_bin=""
|
||||
if [ -x ${udevdir}/$_prog ]; then
|
||||
if [[ -x ${udevdir}/$_prog ]]; then
|
||||
_bin=${udevdir}/$_prog
|
||||
elif [[ "${_prog/\$env\{/}" == "$_prog" ]] && [[ "${_prog}" != "/sbin/initqueue" ]]; then
|
||||
elif [[ ${_prog/\$env\{/} == "$_prog" ]] && [[ ${_prog} != "/sbin/initqueue" ]]; then
|
||||
_bin=$(find_binary "$_prog") || {
|
||||
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
|
||||
continue;
|
||||
continue
|
||||
}
|
||||
fi
|
||||
|
||||
[[ $_bin ]] && inst_binary "$_bin"
|
||||
done
|
||||
|
||||
# shellcheck disable=SC2013
|
||||
for _prog in $(sed -nr 's/.*IMPORT\{program\}==?"([^ "]+).*/\1/p' "$1"); do
|
||||
_bin=""
|
||||
if [ -x ${udevdir}/$_prog ]; then
|
||||
if [[ -x ${udevdir}/$_prog ]]; then
|
||||
_bin=${udevdir}/$_prog
|
||||
elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then
|
||||
elif [[ ${_prog/\$env\{/} == "$_prog" ]]; then
|
||||
_bin=$(find_binary "$_prog") || {
|
||||
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
|
||||
continue;
|
||||
continue
|
||||
}
|
||||
fi
|
||||
|
||||
@@ -383,14 +427,17 @@ inst_rule_programs() {
|
||||
inst_rule_group_owner() {
|
||||
local i
|
||||
|
||||
# shellcheck disable=SC2013
|
||||
for i in $(sed -nr 's/.*OWNER=?"([^ "]+).*/\1/p' "$1"); do
|
||||
if ! grep -Eq "^$i:" "$initdir/etc/passwd" 2>/dev/null; then
|
||||
grep -E "^$i:" $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
if ! grep -Eq "^$i:" "$initdir/etc/passwd" 2> /dev/null; then
|
||||
grep -E "^$i:" "$dracutsysrootdir"/etc/passwd 2> /dev/null >> "$initdir/etc/passwd"
|
||||
fi
|
||||
done
|
||||
|
||||
# shellcheck disable=SC2013
|
||||
for i in $(sed -nr 's/.*GROUP=?"([^ "]+).*/\1/p' "$1"); do
|
||||
if ! grep -Eq "^$i:" "$initdir/etc/group" 2>/dev/null; then
|
||||
grep -E "^$i:" $dracutsysrootdir/etc/group 2>/dev/null >> "$initdir/etc/group"
|
||||
if ! grep -Eq "^$i:" "$initdir/etc/group" 2> /dev/null; then
|
||||
grep -E "^$i:" "$dracutsysrootdir"/etc/group 2> /dev/null >> "$initdir/etc/group"
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -410,7 +457,7 @@ inst_rules() {
|
||||
inst_dir "$_target"
|
||||
for _rule in "$@"; do
|
||||
if [ "${_rule#/}" = "$_rule" ]; then
|
||||
for r in $dracutsysrootdir${udevdir}/rules.d ${hostonly:+$dracutsysrootdir/etc/udev/rules.d}; do
|
||||
for r in "$dracutsysrootdir${udevdir}/rules.d" ${hostonly:+"$dracutsysrootdir"/etc/udev/rules.d}; do
|
||||
[[ -e $r/$_rule ]] || continue
|
||||
_found="$r/$_rule"
|
||||
inst_rule_programs "$_found"
|
||||
@@ -419,7 +466,7 @@ inst_rules() {
|
||||
inst_simple "$_found"
|
||||
done
|
||||
fi
|
||||
for r in '' $dracutsysrootdir$dracutbasedir/rules.d/; do
|
||||
for r in '' "$dracutsysrootdir$dracutbasedir/rules.d/"; do
|
||||
# skip rules without an absolute path
|
||||
[[ "${r}$_rule" != /* ]] && continue
|
||||
[[ -f ${r}$_rule ]] || continue
|
||||
@@ -438,7 +485,7 @@ inst_rules_wildcard() {
|
||||
|
||||
inst_dir "${udevdir}/rules.d"
|
||||
inst_dir "$_target"
|
||||
for _rule in ${udevdir}/rules.d/$1 ${dracutbasedir}/rules.d/$1 ; do
|
||||
for _rule in ${udevdir}/rules.d/$1 ${dracutbasedir}/rules.d/$1; do
|
||||
[[ -e $_rule ]] || continue
|
||||
inst_rule_programs "$_rule"
|
||||
inst_rule_group_owner "$_rule"
|
||||
@@ -446,8 +493,8 @@ inst_rules_wildcard() {
|
||||
inst_simple "$_rule"
|
||||
_found=$_rule
|
||||
done
|
||||
if [[ -n ${hostonly} ]] ; then
|
||||
for _rule in ${_target}/$1 ; do
|
||||
if [[ -n ${hostonly} ]]; then
|
||||
for _rule in ${_target}/$1; do
|
||||
[[ -f $_rule ]] || continue
|
||||
inst_rule_programs "$_rule"
|
||||
inst_rule_group_owner "$_rule"
|
||||
@@ -460,7 +507,11 @@ inst_rules_wildcard() {
|
||||
}
|
||||
|
||||
prepare_udev_rules() {
|
||||
[ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version)
|
||||
if [ -z "$UDEVVERSION" ]; then
|
||||
UDEVVERSION=$(udevadm --version)
|
||||
export UDEVVERSION
|
||||
fi
|
||||
|
||||
if [ -z "$UDEVVERSION" ]; then
|
||||
derror "Failed to detect udev version!"
|
||||
return 1
|
||||
@@ -473,17 +524,18 @@ prepare_udev_rules() {
|
||||
for f in "$@"; do
|
||||
f="${initdir}/etc/udev/rules.d/$f"
|
||||
[ -e "$f" ] || continue
|
||||
while read line || [ -n "$line" ]; do
|
||||
while read -r line || [ -n "$line" ]; do
|
||||
if [ "${line%%IMPORT PATH_ID}" != "$line" ]; then
|
||||
if [ $UDEVVERSION -ge 174 ]; then
|
||||
if ((UDEVVERSION >= 174)); then
|
||||
printf '%sIMPORT{builtin}="path_id"\n' "${line%%IMPORT PATH_ID}"
|
||||
else
|
||||
printf '%sIMPORT{program}="path_id %%p"\n' "${line%%IMPORT PATH_ID}"
|
||||
fi
|
||||
elif [ "${line%%IMPORT BLKID}" != "$line" ]; then
|
||||
if [ $UDEVVERSION -ge 176 ]; then
|
||||
if ((UDEVVERSION >= 176)); then
|
||||
printf '%sIMPORT{builtin}="blkid"\n' "${line%%IMPORT BLKID}"
|
||||
else
|
||||
# shellcheck disable=SC2016
|
||||
printf '%sIMPORT{program}="/sbin/blkid -o udev -p $tempnode"\n' "${line%%IMPORT BLKID}"
|
||||
fi
|
||||
else
|
||||
@@ -498,15 +550,18 @@ prepare_udev_rules() {
|
||||
# $1 = type of hook, $2 = hook priority (lower runs first), $3 = hook
|
||||
# All hooks should be POSIX/SuS compliant, they will be sourced by init.
|
||||
inst_hook() {
|
||||
local hook
|
||||
if ! [[ -f $3 ]]; then
|
||||
dfatal "Cannot install a hook ($3) that does not exist."
|
||||
dfatal "Aborting initrd creation."
|
||||
exit 1
|
||||
elif ! [[ "$hookdirs" == *$1* ]]; then
|
||||
elif ! [[ $hookdirs == *$1* ]]; then
|
||||
dfatal "No such hook type $1. Aborting initrd creation."
|
||||
exit 1
|
||||
fi
|
||||
inst_simple "$3" "/lib/dracut/hooks/${1}/${2}-${3##*/}"
|
||||
hook="/lib/dracut/hooks/${1}/${2}-${3##*/}"
|
||||
inst_simple "$3" "$hook"
|
||||
chmod u+x "$initdir/$hook"
|
||||
}
|
||||
|
||||
# install any of listed files
|
||||
@@ -525,7 +580,7 @@ inst_hook() {
|
||||
inst_any() {
|
||||
local to f
|
||||
|
||||
[[ $1 = '-d' ]] && to="$2" && shift 2
|
||||
[[ $1 == '-d' ]] && to="$2" && shift 2
|
||||
|
||||
for f in "$@"; do
|
||||
[[ -e $f ]] || continue
|
||||
@@ -536,33 +591,32 @@ inst_any() {
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
# inst_libdir_file [-n <pattern>] <file> [<file>...]
|
||||
# Install a <file> located on a lib directory to the initramfs image
|
||||
# -n <pattern> install matching files
|
||||
inst_libdir_file() {
|
||||
local _files
|
||||
if [[ "$1" == "-n" ]]; then
|
||||
local -a _files
|
||||
if [[ $1 == "-n" ]]; then
|
||||
local _pattern=$2
|
||||
shift 2
|
||||
for _dir in $libdirs; do
|
||||
for _i in "$@"; do
|
||||
for _f in "$_dir"/$_i; do
|
||||
[[ "$_f" =~ $_pattern ]] || continue
|
||||
[[ -e "$dracutsysrootdir$_f" ]] && _files+="$_f "
|
||||
for _f in "$dracutsysrootdir$_dir"/$_i; do
|
||||
[[ ${_f#$dracutsysrootdir} =~ $_pattern ]] || continue
|
||||
[[ -e $_f ]] && _files+=("${_f#$dracutsysrootdir}")
|
||||
done
|
||||
done
|
||||
done
|
||||
else
|
||||
for _dir in $libdirs; do
|
||||
for _i in "$@"; do
|
||||
for _f in "$_dir"/$_i; do
|
||||
[[ -e "$dracutsysrootdir$_f" ]] && _files+="$_f "
|
||||
for _f in "$dracutsysrootdir$_dir"/$_i; do
|
||||
[[ -e $_f ]] && _files+=("${_f#$dracutsysrootdir}")
|
||||
done
|
||||
done
|
||||
done
|
||||
fi
|
||||
[[ $_files ]] && inst_multiple $_files
|
||||
[[ ${#_files[@]} -gt 0 ]] && inst_multiple "${_files[@]}"
|
||||
}
|
||||
|
||||
# get a command to decompress the given file
|
||||
@@ -571,6 +625,7 @@ get_decompress_cmd() {
|
||||
*.gz) echo 'gzip -f -d' ;;
|
||||
*.bz2) echo 'bzip2 -d' ;;
|
||||
*.xz) echo 'xz -f -d' ;;
|
||||
*.zst) echo 'zstd -f -d ' ;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -582,11 +637,10 @@ get_decompress_cmd() {
|
||||
inst_decompress() {
|
||||
local _src _cmd
|
||||
|
||||
for _src in $@
|
||||
do
|
||||
_cmd=$(get_decompress_cmd ${_src})
|
||||
[[ -z "${_cmd}" ]] && return 1
|
||||
inst_simple ${_src}
|
||||
for _src in "$@"; do
|
||||
_cmd=$(get_decompress_cmd "${_src}")
|
||||
[[ -z ${_cmd} ]] && return 1
|
||||
inst_simple "${_src}"
|
||||
# Decompress with chosen tool. We assume that tool changes name e.g.
|
||||
# from 'name.gz' to 'name'.
|
||||
${_cmd} "${initdir}${_src}"
|
||||
@@ -599,7 +653,7 @@ inst_decompress() {
|
||||
inst_opt_decompress() {
|
||||
local _src
|
||||
|
||||
for _src in $@; do
|
||||
for _src in "$@"; do
|
||||
inst_decompress "${_src}" || inst "${_src}"
|
||||
done
|
||||
}
|
||||
@@ -619,16 +673,21 @@ module_check() {
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
# if we do not have a check script, we are unconditionally included
|
||||
[[ -x $_moddir/check ]] || return 0
|
||||
[ $_forced -ne 0 ] && unset hostonly
|
||||
$_moddir/check $hostonly
|
||||
[[ $_forced != 0 ]] && unset hostonly
|
||||
# don't quote $hostonly to leave argument empty
|
||||
# shellcheck disable=SC2086
|
||||
"$_moddir"/check $hostonly
|
||||
_ret=$?
|
||||
else
|
||||
unset check depends cmdline install installkernel
|
||||
check() { true; }
|
||||
. $_moddir/module-setup.sh
|
||||
# shellcheck disable=SC1090
|
||||
. "$_moddir"/module-setup.sh
|
||||
is_func check || return 0
|
||||
[ $_forced -ne 0 ] && unset hostonly
|
||||
moddir=$_moddir check $hostonly
|
||||
[[ $_forced != 0 ]] && unset hostonly
|
||||
# don't quote $hostonly to leave argument empty
|
||||
# shellcheck disable=SC2086
|
||||
moddir="$_moddir" check $hostonly
|
||||
_ret=$?
|
||||
unset check depends cmdline install installkernel
|
||||
fi
|
||||
@@ -643,24 +702,25 @@ module_check() {
|
||||
module_check_mount() {
|
||||
local _moddir=$2
|
||||
local _ret
|
||||
mount_needs=1
|
||||
export mount_needs=1
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
# if we do not have a check script, we are unconditionally included
|
||||
[[ -x $_moddir/check ]] || return 0
|
||||
mount_needs=1 $_moddir/check 0
|
||||
mount_needs=1 "$_moddir"/check 0
|
||||
_ret=$?
|
||||
else
|
||||
unset check depends cmdline install installkernel
|
||||
check() { false; }
|
||||
. $_moddir/module-setup.sh
|
||||
# shellcheck disable=SC1090
|
||||
. "$_moddir"/module-setup.sh
|
||||
moddir=$_moddir check 0
|
||||
_ret=$?
|
||||
unset check depends cmdline install installkernel
|
||||
fi
|
||||
unset mount_needs
|
||||
return $_ret
|
||||
return "$_ret"
|
||||
}
|
||||
|
||||
# module_depends <dracut module> [<module path>]
|
||||
@@ -674,12 +734,13 @@ module_depends() {
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
# if we do not have a check script, we have no deps
|
||||
[[ -x $_moddir/check ]] || return 0
|
||||
$_moddir/check -d
|
||||
"$_moddir"/check -d
|
||||
return $?
|
||||
else
|
||||
unset check depends cmdline install installkernel
|
||||
depends() { true; }
|
||||
. $_moddir/module-setup.sh
|
||||
# shellcheck disable=SC1090
|
||||
. "$_moddir"/module-setup.sh
|
||||
moddir=$_moddir depends
|
||||
_ret=$?
|
||||
unset check depends cmdline install installkernel
|
||||
@@ -696,13 +757,15 @@ module_cmdline() {
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
# shellcheck disable=SC1090
|
||||
[[ -x $_moddir/cmdline ]] && . "$_moddir/cmdline"
|
||||
return $?
|
||||
else
|
||||
unset check depends cmdline install installkernel
|
||||
cmdline() { true; }
|
||||
. $_moddir/module-setup.sh
|
||||
moddir=$_moddir cmdline
|
||||
# shellcheck disable=SC1090
|
||||
. "$_moddir"/module-setup.sh
|
||||
moddir="$_moddir" cmdline
|
||||
_ret=$?
|
||||
unset check depends cmdline install installkernel
|
||||
return $_ret
|
||||
@@ -718,13 +781,15 @@ module_install() {
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
# shellcheck disable=SC1090
|
||||
[[ -x $_moddir/install ]] && . "$_moddir/install"
|
||||
return $?
|
||||
else
|
||||
unset check depends cmdline install installkernel
|
||||
install() { true; }
|
||||
. $_moddir/module-setup.sh
|
||||
moddir=$_moddir install
|
||||
# shellcheck disable=SC1090
|
||||
. "$_moddir"/module-setup.sh
|
||||
moddir="$_moddir" install
|
||||
_ret=$?
|
||||
unset check depends cmdline install installkernel
|
||||
return $_ret
|
||||
@@ -740,13 +805,15 @@ module_installkernel() {
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
# shellcheck disable=SC1090
|
||||
[[ -x $_moddir/installkernel ]] && . "$_moddir/installkernel"
|
||||
return $?
|
||||
else
|
||||
unset check depends cmdline install installkernel
|
||||
installkernel() { true; }
|
||||
. $_moddir/module-setup.sh
|
||||
moddir=$_moddir installkernel
|
||||
# shellcheck disable=SC1090
|
||||
. "$_moddir"/module-setup.sh
|
||||
moddir="$_moddir" installkernel
|
||||
_ret=$?
|
||||
unset check depends cmdline install installkernel
|
||||
return $_ret
|
||||
@@ -763,6 +830,7 @@ check_mount() {
|
||||
local _moddep
|
||||
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
# shellcheck disable=SC2154
|
||||
[ "${#host_fs_types[@]}" -le 0 ] && return 1
|
||||
|
||||
# If we are already scheduled to be loaded, no need to check again.
|
||||
@@ -774,27 +842,29 @@ check_mount() {
|
||||
|
||||
[[ $2 ]] || mods_checked_as_dep+=" $_mod "
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
if [[ " $omit_dracutmodules " == *\ $_mod\ * ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
|
||||
module_check_mount $_mod $_moddir; ret=$?
|
||||
module_check_mount "$_mod" "$_moddir"
|
||||
ret=$?
|
||||
|
||||
# explicit module, so also accept ret=255
|
||||
[[ $ret = 0 || $ret = 255 ]] || return 1
|
||||
[[ $ret == 0 || $ret == 255 ]] || return 1
|
||||
else
|
||||
# module not in our list
|
||||
if [[ $dracutmodules = all ]]; then
|
||||
if [[ $dracutmodules == all ]]; then
|
||||
# check, if we can and should install this module
|
||||
module_check_mount $_mod $_moddir || return 1
|
||||
module_check_mount "$_mod" "$_moddir" || return 1
|
||||
else
|
||||
# skip this module
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
for _moddep in $(module_depends $_mod $_moddir); do
|
||||
for _moddep in $(module_depends "$_mod" "$_moddir"); do
|
||||
# handle deps as if they were manually added
|
||||
[[ " $dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $dracutmodules " != *\ $_moddep\ * ]] \
|
||||
@@ -806,14 +876,14 @@ check_mount() {
|
||||
&& [[ " $force_add_dracutmodules " != *\ $_moddep\ * ]] \
|
||||
&& force_add_dracutmodules+=" $_moddep "
|
||||
# if a module we depend on fail, fail also
|
||||
if ! check_module $_moddep; then
|
||||
if ! check_module "$_moddep"; then
|
||||
derror "dracut module '$_mod' depends on '$_moddep', which can't be installed"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
[[ " $mods_to_load " == *\ $_mod\ * ]] || \
|
||||
mods_to_load+=" $_mod "
|
||||
[[ " $mods_to_load " == *\ $_mod\ * ]] \
|
||||
|| mods_to_load+=" $_mod "
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -845,17 +915,20 @@ check_module() {
|
||||
|
||||
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
|
||||
if [[ " $dracutmodules $force_add_dracutmodules " == *\ $_mod\ * ]]; then
|
||||
module_check $_mod 1 $_moddir; ret=$?
|
||||
module_check "$_mod" 1 "$_moddir"
|
||||
ret=$?
|
||||
else
|
||||
module_check $_mod 0 $_moddir; ret=$?
|
||||
module_check "$_mod" 0 "$_moddir"
|
||||
ret=$?
|
||||
fi
|
||||
# explicit module, so also accept ret=255
|
||||
[[ $ret = 0 || $ret = 255 ]] || return 1
|
||||
[[ $ret == 0 || $ret == 255 ]] || return 1
|
||||
else
|
||||
# module not in our list
|
||||
if [[ $dracutmodules = all ]]; then
|
||||
if [[ $dracutmodules == all ]]; then
|
||||
# check, if we can and should install this module
|
||||
module_check $_mod 0 $_moddir; ret=$?
|
||||
module_check "$_mod" 0 "$_moddir"
|
||||
ret=$?
|
||||
if [[ $ret != 0 ]]; then
|
||||
[[ $2 ]] && return 1
|
||||
[[ $ret != 255 ]] && return 1
|
||||
@@ -866,7 +939,7 @@ check_module() {
|
||||
fi
|
||||
fi
|
||||
|
||||
for _moddep in $(module_depends $_mod $_moddir); do
|
||||
for _moddep in $(module_depends "$_mod" "$_moddir"); do
|
||||
# handle deps as if they were manually added
|
||||
[[ " $dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $dracutmodules " != *\ $_moddep\ * ]] \
|
||||
@@ -878,14 +951,14 @@ check_module() {
|
||||
&& [[ " $force_add_dracutmodules " != *\ $_moddep\ * ]] \
|
||||
&& force_add_dracutmodules+=" $_moddep "
|
||||
# if a module we depend on fail, fail also
|
||||
if ! check_module $_moddep; then
|
||||
if ! check_module "$_moddep"; then
|
||||
derror "dracut module '$_mod' depends on '$_moddep', which can't be installed"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
[[ " $mods_to_load " == *\ $_mod\ * ]] || \
|
||||
mods_to_load+=" $_mod "
|
||||
[[ " $mods_to_load " == *\ $_mod\ * ]] \
|
||||
|| mods_to_load+=" $_mod "
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -899,11 +972,12 @@ for_each_module_dir() {
|
||||
local _func
|
||||
_func=$1
|
||||
for _moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
[[ -d $_moddir ]] || continue;
|
||||
[[ -e $_moddir/install || -e $_moddir/installkernel || \
|
||||
-e $_moddir/module-setup.sh ]] || continue
|
||||
_mod=${_moddir##*/}; _mod=${_mod#[0-9][0-9]}
|
||||
$_func $_mod 1 $_moddir
|
||||
[[ -d $_moddir ]] || continue
|
||||
[[ -e $_moddir/install || -e $_moddir/installkernel || -e \
|
||||
$_moddir/module-setup.sh ]] || continue
|
||||
_mod=${_moddir##*/}
|
||||
_mod=${_mod#[0-9][0-9]}
|
||||
$_func "$_mod" 1 "$_moddir"
|
||||
done
|
||||
|
||||
# Report any missing dracut modules, the user has specified
|
||||
@@ -925,13 +999,13 @@ for_each_module_dir() {
|
||||
}
|
||||
|
||||
dracut_kernel_post() {
|
||||
for _f in modules.builtin.bin modules.builtin modules.order; do
|
||||
for _f in modules.builtin modules.builtin.alias modules.builtin.modinfo modules.order; do
|
||||
[[ -e $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
|
||||
done
|
||||
|
||||
# generate module dependencies for the initrd
|
||||
if [[ -d $initdir/lib/modules/$kernel ]] && \
|
||||
! depmod -a -b "$initdir" $kernel; then
|
||||
if [[ -d $initdir/lib/modules/$kernel ]] \
|
||||
&& ! depmod -a -b "$initdir" "$kernel"; then
|
||||
dfatal "\"depmod -a $kernel\" failed."
|
||||
exit 1
|
||||
fi
|
||||
@@ -949,13 +1023,13 @@ instmods() {
|
||||
local _silent
|
||||
local _ret
|
||||
|
||||
[[ $no_kernel = yes ]] && return
|
||||
[[ $no_kernel == yes ]] && return
|
||||
|
||||
if [[ $1 = '-c' ]]; then
|
||||
if [[ $1 == '-c' ]]; then
|
||||
unset _optional
|
||||
shift
|
||||
fi
|
||||
if [[ $1 = '-s' ]]; then
|
||||
if [[ $1 == '-s' ]]; then
|
||||
_silent=1
|
||||
shift
|
||||
fi
|
||||
@@ -969,7 +1043,7 @@ instmods() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
$DRACUT_INSTALL \
|
||||
"$DRACUT_INSTALL" \
|
||||
${initdir:+-D "$initdir"} \
|
||||
${dracutsysrootdir:+-r "$dracutsysrootdir"} \
|
||||
${loginstall:+-L "$loginstall"} \
|
||||
@@ -981,18 +1055,18 @@ instmods() {
|
||||
-m "$@"
|
||||
_ret=$?
|
||||
|
||||
if (($_ret != 0)) && [[ -z "$_silent" ]]; then
|
||||
if ((_ret != 0)) && [[ -z $_silent ]]; then
|
||||
derror "FAILED: " \
|
||||
$DRACUT_INSTALL \
|
||||
${initdir:+-D "$initdir"} \
|
||||
${dracutsysrootdir:+-r "$dracutsysrootdir"} \
|
||||
${loginstall:+-L "$loginstall"} \
|
||||
${hostonly:+-H} \
|
||||
${omit_drivers:+-N "$omit_drivers"} \
|
||||
${srcmods:+--kerneldir "$srcmods"} \
|
||||
${_optional:+-o} \
|
||||
${_silent:+--silent} \
|
||||
-m "$@"
|
||||
"$DRACUT_INSTALL" \
|
||||
${initdir:+-D "$initdir"} \
|
||||
${dracutsysrootdir:+-r "$dracutsysrootdir"} \
|
||||
${loginstall:+-L "$loginstall"} \
|
||||
${hostonly:+-H} \
|
||||
${omit_drivers:+-N "$omit_drivers"} \
|
||||
${srcmods:+--kerneldir "$srcmods"} \
|
||||
${_optional:+-o} \
|
||||
${_silent:+--silent} \
|
||||
-m "$@"
|
||||
fi
|
||||
|
||||
[[ "$optional" ]] && return 0
|
||||
@@ -1007,7 +1081,7 @@ else
|
||||
ln_r() {
|
||||
local _source=$1
|
||||
local _dest=$2
|
||||
[[ -d "${_dest%/*}" ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/}
|
||||
[[ -d ${_dest%/*} ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/}
|
||||
ln -sfn -- "$(convert_abs_rel "${_dest}" "${_source}")" "${initdir}/${_dest}"
|
||||
}
|
||||
fi
|
||||
@@ -1016,20 +1090,21 @@ is_qemu_virtualized() {
|
||||
# 0 if a virt environment was detected
|
||||
# 1 if a virt environment could not be detected
|
||||
# 255 if any error was encountered
|
||||
if type -P systemd-detect-virt >/dev/null 2>&1; then
|
||||
vm=$(systemd-detect-virt --vm >/dev/null 2>&1)
|
||||
(($? != 0)) && return 255
|
||||
[[ $vm = "qemu" ]] && return 0
|
||||
[[ $vm = "kvm" ]] && return 0
|
||||
[[ $vm = "bochs" ]] && return 0
|
||||
if type -P systemd-detect-virt > /dev/null 2>&1; then
|
||||
if ! vm=$(systemd-detect-virt --vm > /dev/null 2>&1); then
|
||||
return 255
|
||||
fi
|
||||
[[ $vm == "qemu" ]] && return 0
|
||||
[[ $vm == "kvm" ]] && return 0
|
||||
[[ $vm == "bochs" ]] && return 0
|
||||
fi
|
||||
|
||||
for i in /sys/class/dmi/id/*_vendor; do
|
||||
[[ -f $i ]] || continue
|
||||
read vendor < $i
|
||||
[[ "$vendor" == "QEMU" ]] && return 0
|
||||
[[ "$vendor" == "Red Hat" ]] && return 0
|
||||
[[ "$vendor" == "Bochs" ]] && return 0
|
||||
read -r vendor < "$i"
|
||||
[[ $vendor == "QEMU" ]] && return 0
|
||||
[[ $vendor == "Red Hat" ]] && return 0
|
||||
[[ $vendor == "Bochs" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
@@ -10,28 +10,38 @@ KERNEL_VERSION="$(uname -r)"
|
||||
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
SKIP="$dracutbasedir/skipcpio"
|
||||
[[ -x $SKIP ]] || SKIP=cat
|
||||
[[ -x $SKIP ]] || SKIP="cat"
|
||||
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
[[ -f /etc/machine-id ]] && read -r MACHINE_ID < /etc/machine-id
|
||||
|
||||
mount -o ro /boot &>/dev/null || true
|
||||
mount -o ro /boot &> /dev/null || true
|
||||
|
||||
if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
|
||||
if [[ -d /efi/loader/entries || -L /efi/loader/entries ]] \
|
||||
&& [[ $MACHINE_ID ]] \
|
||||
&& [[ -d /efi/${MACHINE_ID} || -L /efi/${MACHINE_ID} ]]; then
|
||||
IMG="/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
|
||||
elif [[ -d /boot/loader/entries || -L /boot/loader/entries ]] \
|
||||
&& [[ $MACHINE_ID ]] \
|
||||
&& [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]]; then
|
||||
IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
|
||||
elif [[ -f /boot/initramfs-${KERNEL_VERSION}.img ]]; then
|
||||
IMG="/boot/initramfs-${KERNEL_VERSION}.img"
|
||||
elif [[ -f /lib/modules/${KERNEL_VERSION}/initrd ]]; then
|
||||
IMG="/lib/modules/${KERNEL_VERSION}/initrd"
|
||||
else
|
||||
echo "No initramfs image found to restore!"
|
||||
exit 1
|
||||
fi
|
||||
[[ -f $IMG ]] || IMG="/boot/initramfs-${KERNEL_VERSION}.img"
|
||||
|
||||
cd /run/initramfs
|
||||
|
||||
[ -f .need_shutdown -a -f "$IMG" ] || exit 1
|
||||
|
||||
if $SKIP "$IMG" | zcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
|
||||
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
|
||||
elif $SKIP "$IMG" | xzcat | cpio -id --no-absolute-filenames --quiet > /dev/null; then
|
||||
rm -f -- .need_shutdown
|
||||
elif $SKIP "$IMG" | lz4 -d -c | cpio -id --no-absolute-filenames --quiet >/dev/null; then
|
||||
elif $SKIP "$IMG" | lz4 -d -c | cpio -id --no-absolute-filenames --quiet > /dev/null; then
|
||||
rm -f -- .need_shutdown
|
||||
elif $SKIP "$IMG" | zstd -d -c | cpio -id --no-absolute-filenames --quiet >/dev/null; then
|
||||
elif $SKIP "$IMG" | zstd -d -c | cpio -id --no-absolute-filenames --quiet > /dev/null; then
|
||||
rm -f -- .need_shutdown
|
||||
else
|
||||
# something failed, so we clean up
|
||||
@@ -41,17 +51,16 @@ else
|
||||
fi
|
||||
|
||||
if [[ -d squash ]]; then
|
||||
unsquashfs -no-xattrs -f -d . squash/root.img >/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Squash module is enabled for this initramfs but failed to unpack squash/root.img" >&2
|
||||
if ! unsquashfs -no-xattrs -f -d . squash-root.img > /dev/null; then
|
||||
echo "Squash module is enabled for this initramfs but failed to unpack squash-root.img" >&2
|
||||
rm -f -- /run/initramfs/shutdown
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e /etc/selinux/config -a -x /usr/sbin/setfiles ] ; then
|
||||
if [ -e /etc/selinux/config -a -x /usr/sbin/setfiles ]; then
|
||||
. /etc/selinux/config
|
||||
/usr/sbin/setfiles -v -r /run/initramfs /etc/selinux/${SELINUXTYPE}/contexts/files/file_contexts /run/initramfs > /dev/null
|
||||
/usr/sbin/setfiles -v -r /run/initramfs /etc/selinux/"${SELINUXTYPE}"/contexts/files/file_contexts /run/initramfs > /dev/null
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
182
dracut-logger.sh
182
dracut-logger.sh
@@ -17,9 +17,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
__DRACUT_LOGGER__=1
|
||||
|
||||
export __DRACUT_LOGGER__=1
|
||||
|
||||
## @brief Logging facility module for dracut both at build- and boot-time.
|
||||
#
|
||||
@@ -86,7 +84,6 @@ __DRACUT_LOGGER__=1
|
||||
#
|
||||
# @see dlog_init()
|
||||
|
||||
|
||||
## @brief Initializes dracut Logger.
|
||||
#
|
||||
# @retval 1 if something has gone wrong
|
||||
@@ -105,7 +102,8 @@ __DRACUT_LOGGER__=1
|
||||
# See file doc comment for details.
|
||||
dlog_init() {
|
||||
local __oldumask
|
||||
local ret=0; local errmsg
|
||||
local ret=0
|
||||
local errmsg
|
||||
[ -z "$stdloglvl" ] && stdloglvl=4
|
||||
[ -z "$sysloglvl" ] && sysloglvl=0
|
||||
[ -z "$kmsgloglvl" ] && kmsgloglvl=0
|
||||
@@ -114,23 +112,23 @@ dlog_init() {
|
||||
|
||||
if [ -z "$fileloglvl" ]; then
|
||||
[ -w "$logfile" ] && fileloglvl=4 || fileloglvl=0
|
||||
elif (( $fileloglvl > 0 )); then
|
||||
elif ((fileloglvl > 0)); then
|
||||
if [[ $logfile ]]; then
|
||||
__oldumask=$(umask)
|
||||
umask 0377
|
||||
! [ -e "$logfile" ] && >"$logfile"
|
||||
umask $__oldumask
|
||||
if [ -w "$logfile" -a -f "$logfile" ]; then
|
||||
# Mark new run in the log file
|
||||
echo >>"$logfile"
|
||||
if command -v date >/dev/null; then
|
||||
echo "=== $(date) ===" >>"$logfile"
|
||||
! [ -e "$logfile" ] && : > "$logfile"
|
||||
umask "$__oldumask"
|
||||
if [[ -w $logfile ]] && [[ -f $logfile ]]; then
|
||||
# Mark new run in the log file
|
||||
echo >> "$logfile"
|
||||
if command -v date > /dev/null; then
|
||||
echo "=== $(date) ===" >> "$logfile"
|
||||
else
|
||||
echo "===============================================" >>"$logfile"
|
||||
echo "===============================================" >> "$logfile"
|
||||
fi
|
||||
echo >>"$logfile"
|
||||
echo >> "$logfile"
|
||||
else
|
||||
# We cannot log to file, so turn this facility off.
|
||||
# We cannot log to file, so turn this facility off.
|
||||
fileloglvl=0
|
||||
ret=1
|
||||
errmsg="'$logfile' is not a writable file"
|
||||
@@ -138,22 +136,22 @@ dlog_init() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( $UID != 0 )); then
|
||||
if ((UID != 0)); then
|
||||
kmsgloglvl=0
|
||||
sysloglvl=0
|
||||
fi
|
||||
|
||||
if (( $sysloglvl > 0 )); then
|
||||
if ((sysloglvl > 0)); then
|
||||
if [[ -d /run/systemd/journal ]] \
|
||||
&& type -P systemd-cat &>/dev/null \
|
||||
&& systemctl --quiet is-active systemd-journald.socket &>/dev/null \
|
||||
&& { echo "dracut-$DRACUT_VERSION" | systemd-cat -t 'dracut' &>/dev/null; } ; then
|
||||
&& 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"
|
||||
mkfifo "$_systemdcatfile"
|
||||
readonly _dlogfd=15
|
||||
systemd-cat -t 'dracut' --level-prefix=true <"$_systemdcatfile" &
|
||||
exec 15>"$_systemdcatfile"
|
||||
elif ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null; then
|
||||
systemd-cat -t 'dracut' --level-prefix=true < "$_systemdcatfile" &
|
||||
exec 15> "$_systemdcatfile"
|
||||
elif ! [[ -S /dev/log ]] && [[ -w /dev/log ]] || ! command -v logger > /dev/null; then
|
||||
# We cannot log to syslog, so turn this facility off.
|
||||
kmsgloglvl=$sysloglvl
|
||||
sysloglvl=0
|
||||
@@ -162,7 +160,7 @@ dlog_init() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if (($sysloglvl > 0)) || (($kmsgloglvl > 0 )); then
|
||||
if ((sysloglvl > 0)) || ((kmsgloglvl > 0)); then
|
||||
if [ -n "$dracutbasedir" ]; then
|
||||
readonly syslogfacility=user
|
||||
else
|
||||
@@ -171,44 +169,44 @@ dlog_init() {
|
||||
export syslogfacility
|
||||
fi
|
||||
|
||||
local lvl; local maxloglvl_l=0
|
||||
local lvl
|
||||
local maxloglvl_l=0
|
||||
for lvl in $stdloglvl $sysloglvl $fileloglvl $kmsgloglvl; do
|
||||
(( $lvl > $maxloglvl_l )) && maxloglvl_l=$lvl
|
||||
((lvl > maxloglvl_l)) && maxloglvl_l=$lvl
|
||||
done
|
||||
readonly maxloglvl=$maxloglvl_l
|
||||
export maxloglvl
|
||||
|
||||
|
||||
if (($stdloglvl < 6)) && (($kmsgloglvl < 6)) && (($fileloglvl < 6)) && (($sysloglvl < 6)); then
|
||||
if ((stdloglvl < 6)) && ((kmsgloglvl < 6)) && ((fileloglvl < 6)) && ((sysloglvl < 6)); then
|
||||
unset dtrace
|
||||
dtrace() { :; };
|
||||
dtrace() { :; }
|
||||
fi
|
||||
|
||||
if (($stdloglvl < 5)) && (($kmsgloglvl < 5)) && (($fileloglvl < 5)) && (($sysloglvl < 5)); then
|
||||
if ((stdloglvl < 5)) && ((kmsgloglvl < 5)) && ((fileloglvl < 5)) && ((sysloglvl < 5)); then
|
||||
unset ddebug
|
||||
ddebug() { :; };
|
||||
ddebug() { :; }
|
||||
fi
|
||||
|
||||
if (($stdloglvl < 4)) && (($kmsgloglvl < 4)) && (($fileloglvl < 4)) && (($sysloglvl < 4)); then
|
||||
if ((stdloglvl < 4)) && ((kmsgloglvl < 4)) && ((fileloglvl < 4)) && ((sysloglvl < 4)); then
|
||||
unset dinfo
|
||||
dinfo() { :; };
|
||||
dinfo() { :; }
|
||||
fi
|
||||
|
||||
if (($stdloglvl < 3)) && (($kmsgloglvl < 3)) && (($fileloglvl < 3)) && (($sysloglvl < 3)); then
|
||||
if ((stdloglvl < 3)) && ((kmsgloglvl < 3)) && ((fileloglvl < 3)) && ((sysloglvl < 3)); then
|
||||
unset dwarn
|
||||
dwarn() { :; };
|
||||
dwarn() { :; }
|
||||
unset dwarning
|
||||
dwarning() { :; };
|
||||
dwarning() { :; }
|
||||
fi
|
||||
|
||||
if (($stdloglvl < 2)) && (($kmsgloglvl < 2)) && (($fileloglvl < 2)) && (($sysloglvl < 2)); then
|
||||
if ((stdloglvl < 2)) && ((kmsgloglvl < 2)) && ((fileloglvl < 2)) && ((sysloglvl < 2)); then
|
||||
unset derror
|
||||
derror() { :; };
|
||||
derror() { :; }
|
||||
fi
|
||||
|
||||
if (($stdloglvl < 1)) && (($kmsgloglvl < 1)) && (($fileloglvl < 1)) && (($sysloglvl < 1)); then
|
||||
if ((stdloglvl < 1)) && ((kmsgloglvl < 1)) && ((fileloglvl < 1)) && ((sysloglvl < 1)); then
|
||||
unset dfatal
|
||||
dfatal() { :; };
|
||||
dfatal() { :; }
|
||||
fi
|
||||
|
||||
[ -n "$errmsg" ] && derror "$errmsg"
|
||||
@@ -224,13 +222,13 @@ dlog_init() {
|
||||
# @result Echoes first letter of level name.
|
||||
_lvl2char() {
|
||||
case "$1" in
|
||||
1) echo F;;
|
||||
2) echo E;;
|
||||
3) echo W;;
|
||||
4) echo I;;
|
||||
5) echo D;;
|
||||
6) echo T;;
|
||||
*) return 1;;
|
||||
1) echo F ;;
|
||||
2) echo E ;;
|
||||
3) echo W ;;
|
||||
4) echo I ;;
|
||||
5) echo D ;;
|
||||
6) echo T ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -241,15 +239,15 @@ _lvl2char() {
|
||||
# @retval 0 if @a lvl is correct.
|
||||
# @result Echoes logger priority.
|
||||
_lvl2syspri() {
|
||||
printf $syslogfacility.
|
||||
printf -- "%s" "$syslogfacility."
|
||||
case "$1" in
|
||||
1) echo crit;;
|
||||
2) echo error;;
|
||||
3) echo warning;;
|
||||
4) echo info;;
|
||||
5) echo debug;;
|
||||
6) echo debug;;
|
||||
*) return 1;;
|
||||
1) echo crit ;;
|
||||
2) echo error ;;
|
||||
3) echo warning ;;
|
||||
4) echo info ;;
|
||||
5) echo debug ;;
|
||||
6) echo debug ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -279,16 +277,16 @@ _dlvl2syslvl() {
|
||||
local lvl
|
||||
|
||||
case "$1" in
|
||||
1) lvl=2;;
|
||||
2) lvl=3;;
|
||||
3) lvl=4;;
|
||||
4) lvl=6;;
|
||||
5) lvl=7;;
|
||||
6) lvl=7;;
|
||||
*) return 1;;
|
||||
1) lvl=2 ;;
|
||||
2) lvl=3 ;;
|
||||
3) lvl=4 ;;
|
||||
4) lvl=6 ;;
|
||||
5) lvl=7 ;;
|
||||
6) lvl=7 ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
|
||||
[ "$syslogfacility" = user ] && echo $((8+$lvl)) || echo $((24+$lvl))
|
||||
[ "$syslogfacility" = user ] && echo $((8 + lvl)) || echo $((24 + lvl))
|
||||
}
|
||||
|
||||
## @brief Prints to stderr and/or writes to file, to syslog and/or /dev/kmsg
|
||||
@@ -318,27 +316,29 @@ _dlvl2syslvl() {
|
||||
# - @c INFO to @c info
|
||||
# - @c DEBUG and @c TRACE both to @c debug
|
||||
_do_dlog() {
|
||||
local lvl="$1"; shift
|
||||
local lvlc=$(_lvl2char "$lvl") || return 0
|
||||
local lvlc
|
||||
local lvl="$1"
|
||||
shift
|
||||
lvlc=$(_lvl2char "$lvl") || return 0
|
||||
local msg="$*"
|
||||
local lmsg="$lvlc: $*"
|
||||
|
||||
(( $lvl <= $stdloglvl )) && printf -- 'dracut: %s\n' "$msg" >&2
|
||||
((lvl <= stdloglvl)) && printf -- 'dracut: %s\n' "$msg" >&2
|
||||
|
||||
if (( $lvl <= $sysloglvl )); then
|
||||
if ((lvl <= sysloglvl)); then
|
||||
if [[ "$_dlogfd" ]]; then
|
||||
printf -- "<%s>%s\n" "$(($(_dlvl2syslvl $lvl) & 7))" "$msg" >&$_dlogfd
|
||||
printf -- "<%s>%s\n" "$(($(_dlvl2syslvl "$lvl") & 7))" "$msg" >&$_dlogfd
|
||||
else
|
||||
logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) -- "$msg"
|
||||
logger -t "dracut[$$]" -p "$(_lvl2syspri "$lvl")" -- "$msg"
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( $lvl <= $fileloglvl )) && [[ -w "$logfile" ]] && [[ -f "$logfile" ]]; then
|
||||
echo "$lmsg" >>"$logfile"
|
||||
if ((lvl <= fileloglvl)) && [[ -w $logfile ]] && [[ -f $logfile ]]; then
|
||||
echo "$lmsg" >> "$logfile"
|
||||
fi
|
||||
|
||||
(( $lvl <= $kmsgloglvl )) && \
|
||||
echo "<$(_dlvl2syslvl $lvl)>dracut[$$] $msg" >/dev/kmsg
|
||||
((lvl <= kmsgloglvl)) \
|
||||
&& echo "<$(_dlvl2syslvl "$lvl")>dracut[$$] $msg" > /dev/kmsg
|
||||
}
|
||||
|
||||
## @brief Internal helper function for _do_dlog()
|
||||
@@ -359,12 +359,12 @@ _do_dlog() {
|
||||
# echo "This is a warning" | dwarn
|
||||
dlog() {
|
||||
[ -z "$maxloglvl" ] && return 0
|
||||
(( $1 <= $maxloglvl )) || return 0
|
||||
(($1 <= maxloglvl)) || return 0
|
||||
|
||||
if (( $# > 1 )); then
|
||||
if (($# > 1)); then
|
||||
_do_dlog "$@"
|
||||
else
|
||||
while read line || [ -n "$line" ]; do
|
||||
while read -r line || [ -n "$line" ]; do
|
||||
_do_dlog "$1" "$line"
|
||||
done
|
||||
fi
|
||||
@@ -377,7 +377,9 @@ dlog() {
|
||||
dtrace() {
|
||||
set +x
|
||||
dlog 6 "$@"
|
||||
[ -n "$debug" ] && set -x || :
|
||||
if [ -n "$debug" ]; then
|
||||
set -x
|
||||
fi
|
||||
}
|
||||
|
||||
## @brief Logs message at DEBUG level (5)
|
||||
@@ -387,7 +389,9 @@ dtrace() {
|
||||
ddebug() {
|
||||
set +x
|
||||
dlog 5 "$@"
|
||||
[ -n "$debug" ] && set -x || :
|
||||
if [ -n "$debug" ]; then
|
||||
set -x
|
||||
fi
|
||||
}
|
||||
|
||||
## @brief Logs message at INFO level (4)
|
||||
@@ -397,7 +401,9 @@ ddebug() {
|
||||
dinfo() {
|
||||
set +x
|
||||
dlog 4 "$@"
|
||||
[ -n "$debug" ] && set -x || :
|
||||
if [ -n "$debug" ]; then
|
||||
set -x
|
||||
fi
|
||||
}
|
||||
|
||||
## @brief Logs message at WARN level (3)
|
||||
@@ -407,7 +413,9 @@ dinfo() {
|
||||
dwarn() {
|
||||
set +x
|
||||
dlog 3 "$@"
|
||||
[ -n "$debug" ] && set -x || :
|
||||
if [ -n "$debug" ]; then
|
||||
set -x
|
||||
fi
|
||||
}
|
||||
|
||||
## @brief It's an alias to dwarn() function.
|
||||
@@ -417,7 +425,9 @@ dwarn() {
|
||||
dwarning() {
|
||||
set +x
|
||||
dwarn "$@"
|
||||
[ -n "$debug" ] && set -x || :
|
||||
if [ -n "$debug" ]; then
|
||||
set -x
|
||||
fi
|
||||
}
|
||||
|
||||
## @brief Logs message at ERROR level (2)
|
||||
@@ -427,7 +437,9 @@ dwarning() {
|
||||
derror() {
|
||||
set +x
|
||||
dlog 2 "$@"
|
||||
[ -n "$debug" ] && set -x || :
|
||||
if [ -n "$debug" ]; then
|
||||
set -x
|
||||
fi
|
||||
}
|
||||
|
||||
## @brief Logs message at FATAL level (1)
|
||||
@@ -437,5 +449,7 @@ derror() {
|
||||
dfatal() {
|
||||
set +x
|
||||
dlog 1 "$@"
|
||||
[ -n "$debug" ] && set -x || :
|
||||
if [ -n "$debug" ]; then
|
||||
set -x
|
||||
fi
|
||||
}
|
||||
|
@@ -10,9 +10,35 @@ stdloglvl=3
|
||||
sysloglvl=5
|
||||
install_optional_items+=" vi /etc/virc ps grep cat rm "
|
||||
prefix="/"
|
||||
environment=/usr/lib/environment.d
|
||||
environmentconfdir=/etc/environment.d
|
||||
dbus=/usr/share/dbus-1
|
||||
dbusinterfaces=/usr/share/dbus-1/interfaces
|
||||
dbusservices=/usr/share/dbus-1/services
|
||||
dbussession=/usr/share/dbus-1/session.d
|
||||
dbussystem=/usr/share/dbus-1/system.d
|
||||
dbussystemservices=/usr/share/dbus-1/system-services
|
||||
dbusconfdir=/etc/dbus-1
|
||||
dbusinterfacesconfdir=/etc/dbus-1/interfaces
|
||||
dbusservicesconfdir=/etc/dbus-1/services
|
||||
dbussessionconfdir=/etc/dbus-1/session.d
|
||||
dbussystem=confdir/etc/dbus-1/system.d
|
||||
dbussystemservicesconfdir=/etc/dbus-1/system-services
|
||||
sysctld=/usr/lib/sysctl.d
|
||||
sysctlconfdir=/etc/sysctl.d
|
||||
systemdutildir=/usr/lib/systemd
|
||||
systemdutilconfdir=/etc/systemd
|
||||
systemdcatalog=/usr/lib/systemd/catalog
|
||||
systemdntpunits=/usr/lib/systemd/ntp-units.d
|
||||
systemdntpunitsconfdir=/etc/systemd/ntp-units.d
|
||||
systemdportable=/usr/lib/systemd/portable
|
||||
systemdportableconfdir=/etc/systemd/portable
|
||||
systemdsystemunitdir=/usr/lib/systemd/system
|
||||
systemdsystemconfdir=/etc/systemd/system
|
||||
systemduser=/usr/lib/systemd/user
|
||||
systemduserconfdir=/etc/systemd/user
|
||||
sysusers=/usr/lib/sysusers.d
|
||||
sysusersconfdir=/etc/sysusers.d
|
||||
udevdir=/usr/lib/udev
|
||||
hostonly="yes"
|
||||
hostonly_cmdline="no"
|
||||
|
@@ -1,6 +0,0 @@
|
||||
/var/log/dracut.log {
|
||||
missingok
|
||||
notifempty
|
||||
size 30k
|
||||
create 0600 root root
|
||||
}
|
@@ -1,116 +0,0 @@
|
||||
DRACUT_PN ??= "${PN}"
|
||||
|
||||
def dracut_compression_type(d):
|
||||
rdtype = d.getVar("INITRAMFS_FSTYPES", True).split('.')
|
||||
if len(rdtype) != 2:
|
||||
return ['','','']
|
||||
if rdtype[0] != 'cpio':
|
||||
return ['','','']
|
||||
cmptypes = [['gz','--gzip','gzip'],['bz2', '--bzip2','bzip2'],['lzma','--lzma','xz'],['xz','--xz','xz'],['lzo','--lzo','lzo'],['lz4','--lz4','lz4'],['zstd','--zstd','zstd']]
|
||||
for cmp in cmptypes:
|
||||
if rdtype[1] == cmp[0]:
|
||||
return cmp
|
||||
return ['','','']
|
||||
|
||||
def dracut_compression_opt(d):
|
||||
cmp = dracut_compression_type(d)
|
||||
return cmp[1]
|
||||
|
||||
def dracut_compression_pkg(d):
|
||||
cmp = dracut_compression_type(d)
|
||||
return cmp[2]
|
||||
|
||||
def dracut_compression_pkg_native(d):
|
||||
cmp = dracut_compression_type(d)
|
||||
if cmp[2] == '':
|
||||
return ''
|
||||
return cmp[2] + '-native'
|
||||
|
||||
DRACUT_COMPRESS_OPT ??= "${@dracut_compression_opt(d)}"
|
||||
DRACUT_COMPRESS_PKG ??= "${@dracut_compression_pkg(d)}"
|
||||
DRACUT_COMPRESS_PKG_NATIVE ??= "${@dracut_compression_pkg_native(d)}"
|
||||
|
||||
DRACUT_OPTS ??= "--early-microcode ${DRACUT_COMPRESS_OPT}"
|
||||
|
||||
python __anonymous () {
|
||||
pkg = d.getVar("DRACUT_PN", True)
|
||||
if pkg != 'dracut':
|
||||
d.appendVar("RDEPENDS_%s" % pkg, " dracut %s " % d.getVar("DRACUT_COMPRESS_PKG", True))
|
||||
if not pkg.startswith('kernel'):
|
||||
d.appendVarFlag("do_configure", "depends", "virtual/kernel:do_shared_workdir")
|
||||
d.appendVarFlag("do_compile", "depends", "virtual/kernel:do_compile_kernelmodules")
|
||||
}
|
||||
|
||||
export BUILD_TIME_KERNEL_VERSION = "${@oe.utils.read_file('${STAGING_KERNEL_BUILDDIR}/kernel-abiversion')}"
|
||||
|
||||
dracut_postinst () {
|
||||
MY_KERNEL_VERSION=$(readlink $D/boot/bzimage | sed 's,^.*bzImage-,,')
|
||||
if [[ -z "$MY_KERNEL_VERSION" ]]; then
|
||||
MY_KERNEL_VERSION="${KERNEL_VERSION}"
|
||||
fi
|
||||
if [[ -z "$MY_KERNEL_VERSION" ]]; then
|
||||
MY_KERNEL_VERSION="${BUILD_TIME_KERNEL_VERSION}"
|
||||
fi
|
||||
if [[ -z "$MY_KERNEL_VERSION" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "$D" ]; then
|
||||
#DEBUGOPTS="--debug --keep"
|
||||
DEBUGOPTS="--keep"
|
||||
|
||||
$INTERCEPT_DIR/postinst_intercept execute_dracut ${PKG} mlprefix=${MLPREFIX} \
|
||||
prefix= \
|
||||
MY_KERNEL_VERSION=$MY_KERNEL_VERSION \
|
||||
DEBUGOPTS="\"$DEBUGOPTS\"" \
|
||||
DRACUT_OPTS="\"${DRACUT_OPTS}\"" \
|
||||
systemdutildir=${systemd_unitdir} \
|
||||
systemdsystemunitdir=${systemd_system_unitdir} \
|
||||
systemdsystemconfdir=${sysconfdir}/systemd/system \
|
||||
udevdir=${libdir}/udev \
|
||||
DRACUT_TMPDIR=${WORKDIR}/dracut-tmpdir \
|
||||
DRACUT_ARCH="${TUNE_ARCH}" \
|
||||
DRACUT_COMPRESS_GZIP=$NATIVE_ROOT${bindir}/gzip \
|
||||
DRACUT_COMPRESS_BZIP2=$NATIVE_ROOT${bindir}/bzip2 \
|
||||
DRACUT_COMPRESS_LZMA=$NATIVE_ROOT${bindir}/lzma \
|
||||
DRACUT_LDD="\"PATH='$PATH' ${STAGING_BINDIR_CROSS}/ldd --root $D\"" \
|
||||
DRACUT_LDCONFIG=$NATIVE_ROOT${bindir}/ldconfig \
|
||||
DRACUT_INSTALL="\"$NATIVE_ROOT${libdir}/dracut/dracut-install\"" \
|
||||
PLYMOUTH_LDD="\"${STAGING_BINDIR_CROSS}/ldd --root $D\"" \
|
||||
PLYMOUTH_LDD_PATH="'$PATH'" \
|
||||
PLYMOUTH_PLUGIN_PATH=${libdir}/plymouth \
|
||||
PLYMOUTH_THEME_NAME=${PLYMOUTH_THEME_NAME:-spinner} \
|
||||
PLYMOUTH_THEME=${PLYMOUTH_THEME_NAME:-spinner}
|
||||
else
|
||||
depmod -a $MY_KERNEL_VERSION
|
||||
echo RUNNING: dracut -f ${DRACUT_OPTS} /boot/initramfs.img $MY_KERNEL_VERSION
|
||||
echo "dracut: $(dracut --help | grep 'Version:')"
|
||||
dracut -f ${DRACUT_OPTS} /boot/initramfs.img $MY_KERNEL_VERSION
|
||||
fi
|
||||
}
|
||||
|
||||
dracut_populate_packages[vardeps] += "dracut_postinst"
|
||||
|
||||
python dracut_populate_packages() {
|
||||
localdata = d.createCopy()
|
||||
|
||||
pkg = d.getVar('DRACUT_PN', True)
|
||||
|
||||
postinst = d.getVar('pkg_postinst_%s' % pkg, True)
|
||||
if not postinst:
|
||||
postinst = '#!/bin/sh\n'
|
||||
postinst += localdata.getVar('dracut_postinst', True)
|
||||
d.setVar('pkg_postinst_%s' % pkg, postinst)
|
||||
}
|
||||
|
||||
PACKAGESPLITFUNCS_prepend = "dracut_populate_packages "
|
||||
|
||||
DRACUT_DEPENDS = " \
|
||||
binutils-cross-${TUNE_ARCH} gcc-cross-${TUNE_ARCH} \
|
||||
ldconfig-native coreutils-native findutils-native \
|
||||
cpio-native util-linux-native kmod-native ${DRACUT_COMPRESS_PKG_NATIVE} \
|
||||
dracut-native pkgconfig-native cross-compiler-ldd \
|
||||
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
|
||||
"
|
||||
DEPENDS_append_class-target = " ${DRACUT_DEPENDS}"
|
||||
PACKAGE_WRITE_DEPS_append = " ${DRACUT_DEPENDS}"
|
@@ -1,44 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [[ -z "$DRACUT_TMPDIR" ]]; then
|
||||
echo "DRACUT_TMPDIR is unset, exiting"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# We have to unset "prefix" as dracut uses it to move files around.
|
||||
# Yocto has it set as part of the build environment.
|
||||
export prefix=
|
||||
|
||||
# DRACUT settings
|
||||
export UDEVVERSION=241
|
||||
export SYSTEMD_VERSION=241
|
||||
export DRACUT_TESTBIN=/bin/bash.bash
|
||||
export DRACUT_INSTALL_PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
|
||||
# PLYMOUTH settings
|
||||
export PLYMOUTH_SYSROOT=$D
|
||||
|
||||
export \
|
||||
systemdutildir systemdsystemunitdir systemdsystemconfdir udevdir \
|
||||
DRACUT_ARCH DRACUT_TESTBIN DRACUT_LDD DRACUT_LDCONFIG DRACUT_INSTALL \
|
||||
DRACUT_COMPRESS_GZIP DRACUT_COMPRESS_BZIP2 DRACUT_COMPRESS_LZMA \
|
||||
PLYMOUTH_LDD PLYMOUTH_LDD_PATH PLYMOUTH_PLUGIN_PATH \
|
||||
PLYMOUTH_THEME_NAME PLYMOUTH_THEME
|
||||
|
||||
# List environment for debugging
|
||||
echo ROOTFS-POSTINST-ENVIRONMENT
|
||||
echo -----------
|
||||
env
|
||||
echo -----------
|
||||
|
||||
[[ -d $DRACUT_TMPDIR ]] || mkdir -p $DRACUT_TMPDIR
|
||||
|
||||
# Execute depmod and dracut
|
||||
echo "$(date) - RUNNING: depmod -b $D -a $MY_KERNEL_VERSION"
|
||||
depmod -b $D -a $MY_KERNEL_VERSION
|
||||
echo "dracut: $(dracut --sysroot $D --help | grep 'Version:')"
|
||||
echo "$(date) - RUNNING: dracut -f --sysroot $D --tmpdir $DRACUT_TMPDIR $DRACUT_OPTS $DEBUGOPTS -k $D/lib/modules/$MY_KERNEL_VERSION $D/boot/initramfs.img $MY_KERNEL_VERSION"
|
||||
dracut -f --sysroot $D --tmpdir $DRACUT_TMPDIR $DRACUT_OPTS $DEBUGOPTS -k $D/lib/modules/$MY_KERNEL_VERSION $D/boot/initramfs.img $MY_KERNEL_VERSION
|
||||
echo "$(date) - DONE: dracut"
|
@@ -1,19 +0,0 @@
|
||||
diff --git a/cross-compile-ldd b/cross-compile-ldd
|
||||
index ef2ca20..332d57f 100644
|
||||
--- a/cross-compile-ldd
|
||||
+++ b/cross-compile-ldd
|
||||
@@ -337,13 +337,13 @@ do_scan_etc_ldsoconf() {
|
||||
# Build up the full list of search directories
|
||||
declare -a needed_search_path
|
||||
do_trace "Adding basic lib dirs\n"
|
||||
-ld_library_path="${ld_library_path}:"
|
||||
while [ -n "${ld_library_path}" ]; do
|
||||
d="${ld_library_path%%:*}"
|
||||
if [ -n "${d}" ]; then
|
||||
do_trace "-> adding search dir '%s'\n" "${d}"
|
||||
needed_search_path+=( "${d}" )
|
||||
fi
|
||||
+ [[ "$ld_library_path" == "${ld_library_path#*:}" ]] && break
|
||||
ld_library_path="${ld_library_path#*:}"
|
||||
done
|
||||
do_trace "Done adding basic lib dirs\n"
|
@@ -1,33 +0,0 @@
|
||||
SUMMARY = "Cross-compiler LDD"
|
||||
HOMEPAGE = "https://gist.github.com/c403786c1394f53f44a3b61214489e6f"
|
||||
BUGTRACKER = ""
|
||||
LICENSE = "GPLv2"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://cross-compile-ldd;beginline=53;endline=57;md5=2b29d19d18a430b931dda3750e865c84"
|
||||
|
||||
SRCBRANCH = "master"
|
||||
SRCREV = "eb44581caf7dd60b149a6691abef46264c46e866"
|
||||
SRC_URI = " \
|
||||
git://gist.github.com/c403786c1394f53f44a3b61214489e6f.git;protocol=https;branch=${SRCBRANCH} \
|
||||
file://cross-compile-ldd-fix-infinite-loop.patch \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit siteinfo
|
||||
|
||||
SYSROOT_PREPROCESS_FUNCS += " cross_ldd_populate_sysroot "
|
||||
|
||||
cross_ldd_populate_sysroot() {
|
||||
mkdir -p ${SYSROOT_DESTDIR}${bindir_crossscripts}
|
||||
cat ${S}/cross-compile-ldd | \
|
||||
sed \
|
||||
-e "s,^prefix=.*$,prefix=${TARGET_SYS}," \
|
||||
-e "s,^bits=.*$,bits=${SITEINFO_BITS}," \
|
||||
-e "s,^ld_library_path=.*$,ld_library_path=${LD_LIBRARY_PATH:-/lib:/usr/lib}," \
|
||||
>${SYSROOT_DESTDIR}${bindir_crossscripts}/ldd
|
||||
chmod +x ${SYSROOT_DESTDIR}${bindir_crossscripts}/ldd
|
||||
}
|
||||
|
||||
DEPENDS = "coreutils-native sed-native binutils-cross-${TARGET_ARCH} gcc-cross-${TARGET_ARCH}"
|
||||
PACKAGE_WRITE_DEPS = "coreutils-native sed-native binutils-cross-${TARGET_ARCH} gcc-cross-${TARGET_ARCH}"
|
@@ -1,30 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
[[ -d ${0%/*} ]] && cd ${0%/*}
|
||||
|
||||
RUN_ID="$1"
|
||||
TESTS=$2
|
||||
|
||||
./configure
|
||||
|
||||
NCPU=$(getconf _NPROCESSORS_ONLN)
|
||||
|
||||
if ! [[ $TESTS ]]; then
|
||||
make -j$NCPU all syncheck rpm logtee
|
||||
else
|
||||
[[ $TESTS == "99" ]] && make_docs=yes || make_docs=no
|
||||
make -j$NCPU enable_documentation=$make_docs all logtee
|
||||
|
||||
cd test
|
||||
|
||||
time sudo LOGTEE_TIMEOUT_MS=300000 make \
|
||||
enable_documentation=$make_docs \
|
||||
KVERSION=$(rpm -qa kernel --qf '%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort -rn | head -1) \
|
||||
DRACUT_NO_XATTR=1 \
|
||||
TEST_RUN_ID=$RUN_ID \
|
||||
${TESTS:+TESTS="$TESTS"} \
|
||||
-k V=2 \
|
||||
check
|
||||
fi
|
@@ -48,6 +48,7 @@ case "$COMMAND" in
|
||||
unset noimageifnotneeded
|
||||
|
||||
for ((i=0; i < "${#BOOT_OPTIONS[@]}"; i++)); do
|
||||
# shellcheck disable=SC1001
|
||||
if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then
|
||||
noimageifnotneeded="yes"
|
||||
break
|
@@ -14,8 +14,8 @@ dropindirs_sort()
|
||||
args=("$@")
|
||||
files=$(
|
||||
while (( $# > 0 )); do
|
||||
for i in ${1}/*${suffix}; do
|
||||
[[ -f $i ]] && echo ${i##*/}
|
||||
for i in "${1}"/*"${suffix}"; do
|
||||
[[ -f $i ]] && echo "${i##*/}"
|
||||
done
|
||||
shift
|
||||
done | sort -Vu
|
||||
@@ -36,7 +36,7 @@ dropindirs_sort()
|
||||
if [[ ${KERNEL_INSTALL_MACHINE_ID+x} ]]; then
|
||||
MACHINE_ID=$KERNEL_INSTALL_MACHINE_ID
|
||||
elif [[ -f /etc/machine-id ]] ; then
|
||||
read MACHINE_ID < /etc/machine-id
|
||||
read -r MACHINE_ID < /etc/machine-id
|
||||
fi
|
||||
|
||||
if ! [[ $MACHINE_ID ]]; then
|
||||
@@ -80,9 +80,13 @@ case "$COMMAND" in
|
||||
|
||||
# source our config dir
|
||||
for f in $(dropindirs_sort ".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d"); do
|
||||
[[ -e $f ]] && . "$f"
|
||||
if [[ -e $f ]]; then
|
||||
# shellcheck disable=SC1090
|
||||
. "$f"
|
||||
fi
|
||||
done
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
[[ $dracut_rescue_image != "yes" ]] && exit 0
|
||||
|
||||
[[ -d "$BOOT_DIR_ABS" ]] || mkdir -p "$BOOT_DIR_ABS"
|
||||
@@ -101,17 +105,17 @@ case "$COMMAND" in
|
||||
echo "title $PRETTY_NAME - Rescue Image"
|
||||
echo "version $KERNEL_VERSION"
|
||||
echo "machine-id $MACHINE_ID"
|
||||
echo "options ${BOOT_OPTIONS[@]} rd.auto=1"
|
||||
echo "options ${BOOT_OPTIONS[*]} rd.auto=1"
|
||||
echo "linux $BOOT_DIR/linux"
|
||||
echo "initrd $BOOT_DIR/initrd"
|
||||
} > $LOADER_ENTRY
|
||||
} > "$LOADER_ENTRY"
|
||||
else
|
||||
if [[ -e "${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" ]]; then
|
||||
cp -aT "${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" $LOADER_ENTRY
|
||||
cp -aT "${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" "$LOADER_ENTRY"
|
||||
else
|
||||
cp -aT "${KERNEL_IMAGE%/*}/bls.conf" $LOADER_ENTRY
|
||||
cp -aT "${KERNEL_IMAGE%/*}/bls.conf" "$LOADER_ENTRY"
|
||||
fi
|
||||
sed -i 's/'$KERNEL_VERSION'/0-rescue-'${MACHINE_ID}'/' $LOADER_ENTRY
|
||||
sed -i "s/${KERNEL_VERSION}/0-rescue-${MACHINE_ID}/" "$LOADER_ENTRY"
|
||||
fi
|
||||
|
||||
((ret+=$?))
|
73
logtee.c
73
logtee.c
@@ -1,73 +0,0 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
||||
#define BUFLEN 4096
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int fd;
|
||||
int len, slen;
|
||||
int ret;
|
||||
int timeout;
|
||||
char *timeout_env;
|
||||
struct pollfd fds[] = {{
|
||||
.fd = STDIN_FILENO,
|
||||
.events = POLLIN | POLLERR,
|
||||
}};
|
||||
|
||||
timeout_env = getenv("LOGTEE_TIMEOUT_MS");
|
||||
if (timeout_env)
|
||||
timeout = atoi(timeout_env);
|
||||
else
|
||||
timeout = -1;
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage: %s <file>\n", argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC | O_NONBLOCK, 0644);
|
||||
if (fd == -1) {
|
||||
perror("open");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
fprintf(stderr, "Logging to %s: ", argv[1]);
|
||||
|
||||
slen = 0;
|
||||
|
||||
do {
|
||||
ret = poll (fds, sizeof(fds) / sizeof(fds[0]), timeout);
|
||||
if (ret == 0) {
|
||||
fprintf (stderr, "Timed out after %d milliseconds of no output.\n", timeout);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
len = splice(STDIN_FILENO, NULL, fd, NULL,
|
||||
BUFLEN, SPLICE_F_MOVE | SPLICE_F_NONBLOCK);
|
||||
|
||||
if (len < 0) {
|
||||
if (errno == EAGAIN)
|
||||
continue;
|
||||
perror("tee");
|
||||
exit(EXIT_FAILURE);
|
||||
} else
|
||||
if (len == 0)
|
||||
break;
|
||||
slen += len;
|
||||
if ((slen/BUFLEN) > 0) {
|
||||
fprintf(stderr, ".");
|
||||
}
|
||||
slen = slen % BUFLEN;
|
||||
|
||||
} while (1);
|
||||
close(fd);
|
||||
fprintf(stderr, "\n");
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
@@ -1,60 +0,0 @@
|
||||
#
|
||||
# Copyright 2013 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/>.
|
||||
#
|
||||
|
||||
__contains_word () {
|
||||
local word=$1; shift
|
||||
for w in $*; do [[ $w = $word ]] && return 0; done
|
||||
return 1
|
||||
}
|
||||
|
||||
_lsinitrd() {
|
||||
local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
local -A OPTS=(
|
||||
[STANDALONE]='-s --size -h --help'
|
||||
|
||||
[ARG]='-f --file -k --kver'
|
||||
)
|
||||
|
||||
if __contains_word "$prev" ${OPTS[ARG]}; then
|
||||
case $prev in
|
||||
--file|-f)
|
||||
comps=$(compgen -f -- "$cur")
|
||||
compopt -o filenames
|
||||
;;
|
||||
--kver|-k)
|
||||
comps=$(cd /lib/modules; echo [0-9]*)
|
||||
;;
|
||||
*)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ $cur = -* ]]; then
|
||||
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
|
||||
comps=$(compgen -f -- "$cur")
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||
return 0
|
||||
}
|
||||
|
||||
complete -F _lsinitrd lsinitrd
|
170
lsinitrd.sh
170
lsinitrd.sh
@@ -17,8 +17,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
usage()
|
||||
{
|
||||
usage() {
|
||||
{
|
||||
echo "Usage: ${0##*/} [options] [<initramfs file> [<filename> [<filename> [...] ]]]"
|
||||
echo "Usage: ${0##*/} [options] -k <kernel version>"
|
||||
@@ -38,7 +37,6 @@ usage()
|
||||
} >&2
|
||||
}
|
||||
|
||||
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
|
||||
sorted=0
|
||||
@@ -59,7 +57,8 @@ TEMP=$(getopt \
|
||||
--long verbose \
|
||||
-- "$@")
|
||||
|
||||
if (( $? != 0 )); then
|
||||
# shellcheck disable=SC2181
|
||||
if (($? != 0)); then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
@@ -68,16 +67,31 @@ eval set -- "$TEMP"
|
||||
|
||||
while (($# > 0)); do
|
||||
case $1 in
|
||||
-k|--kver) KERNEL_VERSION="$2"; shift;;
|
||||
-f|--file) filenames[${2#/}]=1; shift;;
|
||||
-s|--size) sorted=1;;
|
||||
-h|--help) usage; exit 0;;
|
||||
-m|--mod) modules=1;;
|
||||
-v|--verbose) verbose="--verbose";;
|
||||
--unpack) unpack=1;;
|
||||
--unpackearly) unpackearly=1;;
|
||||
--) shift;break;;
|
||||
*) usage; exit 1;;
|
||||
-k | --kver)
|
||||
KERNEL_VERSION="$2"
|
||||
shift
|
||||
;;
|
||||
-f | --file)
|
||||
filenames[${2#/}]=1
|
||||
shift
|
||||
;;
|
||||
-s | --size) sorted=1 ;;
|
||||
-h | --help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
-m | --mod) modules=1 ;;
|
||||
-v | --verbose) verbose="--verbose" ;;
|
||||
--unpack) unpack=1 ;;
|
||||
--unpackearly) unpackearly=1 ;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
@@ -86,7 +100,7 @@ done
|
||||
|
||||
if [[ $1 ]]; then
|
||||
image="$1"
|
||||
if ! [[ -f "$image" ]]; then
|
||||
if ! [[ -f $image ]]; then
|
||||
{
|
||||
echo "$image does not exist"
|
||||
echo
|
||||
@@ -95,11 +109,15 @@ if [[ $1 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
[[ -f /etc/machine-id ]] && read -r MACHINE_ID < /etc/machine-id
|
||||
|
||||
if [[ -d /boot/loader/entries || -L /boot/loader/entries ]] \
|
||||
if [[ -d /efi/loader/entries || -L /efi/loader/entries ]] \
|
||||
&& [[ $MACHINE_ID ]] \
|
||||
&& [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
|
||||
&& [[ -d /efi/${MACHINE_ID} || -L /efi/${MACHINE_ID} ]]; then
|
||||
image="/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
|
||||
elif [[ -d /boot/loader/entries || -L /boot/loader/entries ]] \
|
||||
&& [[ $MACHINE_ID ]] \
|
||||
&& [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]]; then
|
||||
image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
|
||||
else
|
||||
image="/boot/initramfs-${KERNEL_VERSION}.img"
|
||||
@@ -108,11 +126,11 @@ fi
|
||||
|
||||
shift
|
||||
while (($# > 0)); do
|
||||
filenames[${1#/}]=1;
|
||||
filenames[${1#/}]=1
|
||||
shift
|
||||
done
|
||||
|
||||
if ! [[ -f "$image" ]]; then
|
||||
if ! [[ -f $image ]]; then
|
||||
{
|
||||
echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
|
||||
echo
|
||||
@@ -122,6 +140,7 @@ if ! [[ -f "$image" ]]; then
|
||||
fi
|
||||
|
||||
TMPDIR="$(mktemp -d -t lsinitrd.XXXXXX)"
|
||||
# shellcheck disable=SC2064
|
||||
trap "rm -rf '$TMPDIR'" EXIT
|
||||
|
||||
dracutlibdirs() {
|
||||
@@ -130,46 +149,43 @@ dracutlibdirs() {
|
||||
done
|
||||
}
|
||||
|
||||
extract_files()
|
||||
{
|
||||
(( ${#filenames[@]} == 1 )) && nofileinfo=1
|
||||
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
|
||||
((ret+=$?))
|
||||
$CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout "$f" 2> /dev/null
|
||||
((ret += $?))
|
||||
[[ $nofileinfo ]] || echo "========================================================================"
|
||||
[[ $nofileinfo ]] || echo
|
||||
done
|
||||
}
|
||||
|
||||
list_modules()
|
||||
{
|
||||
list_modules() {
|
||||
echo "dracut modules:"
|
||||
# shellcheck disable=SC2046
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
|
||||
$(dracutlibdirs modules.txt) 2>/dev/null
|
||||
((ret+=$?))
|
||||
$(dracutlibdirs modules.txt) 2> /dev/null
|
||||
((ret += $?))
|
||||
}
|
||||
|
||||
list_files()
|
||||
{
|
||||
list_files() {
|
||||
echo "========================================================================"
|
||||
if [ "$sorted" -eq 1 ]; then
|
||||
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
$CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
else
|
||||
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -k9
|
||||
$CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --list | sort -k9
|
||||
fi
|
||||
((ret+=$?))
|
||||
((ret += $?))
|
||||
echo "========================================================================"
|
||||
}
|
||||
|
||||
list_squash_content()
|
||||
{
|
||||
SQUASH_IMG="squash/root.img"
|
||||
list_squash_content() {
|
||||
SQUASH_IMG="squash-root.img"
|
||||
SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh"
|
||||
|
||||
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout -- \
|
||||
$SQUASH_IMG > "$SQUASH_TMPFILE" 2>/dev/null
|
||||
$CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout -- \
|
||||
$SQUASH_IMG > "$SQUASH_TMPFILE" 2> /dev/null
|
||||
if [[ -s $SQUASH_TMPFILE ]]; then
|
||||
echo "Squashed content ($SQUASH_IMG):"
|
||||
echo "========================================================================"
|
||||
@@ -178,22 +194,24 @@ list_squash_content()
|
||||
fi
|
||||
}
|
||||
|
||||
unpack_files()
|
||||
{
|
||||
if (( ${#filenames[@]} > 0 )); then
|
||||
unpack_files() {
|
||||
if ((${#filenames[@]} > 0)); then
|
||||
for f in "${!filenames[@]}"; do
|
||||
$CAT "$image" 2>/dev/null | cpio -id --quiet $verbose $f
|
||||
((ret+=$?))
|
||||
$CAT "$image" 2> /dev/null | cpio -id --quiet $verbose $f
|
||||
((ret += $?))
|
||||
done
|
||||
else
|
||||
$CAT "$image" 2>/dev/null | cpio -id --quiet $verbose
|
||||
((ret+=$?))
|
||||
$CAT "$image" 2> /dev/null | cpio -id --quiet $verbose
|
||||
((ret += $?))
|
||||
fi
|
||||
}
|
||||
|
||||
read -N 2 bin < "$image"
|
||||
read -r -N 2 bin < "$image"
|
||||
if [ "$bin" = "MZ" ]; then
|
||||
command -v objcopy > /dev/null || { echo "Need 'objcopy' to unpack an UEFI executable."; exit 1; }
|
||||
command -v objcopy > /dev/null || {
|
||||
echo "Need 'objcopy' to unpack an UEFI executable."
|
||||
exit 1
|
||||
}
|
||||
objcopy \
|
||||
--dump-section .linux="$TMPDIR/vmlinuz" \
|
||||
--dump-section .initrd="$TMPDIR/initrd.img" \
|
||||
@@ -205,10 +223,10 @@ if [ "$bin" = "MZ" ]; then
|
||||
[ -f "$image" ] || exit 1
|
||||
fi
|
||||
|
||||
if (( ${#filenames[@]} <= 0 )) && [[ -z "$unpack" ]] && [[ -z "$unpackearly" ]]; then
|
||||
if ((${#filenames[@]} <= 0)) && [[ -z $unpack ]] && [[ -z $unpackearly ]]; then
|
||||
if [ -n "$uefi" ]; then
|
||||
echo -n "initrd in UEFI: $uefi: "
|
||||
du -h $image | while read a b || [ -n "$a" ]; do echo $a;done
|
||||
du -h "$image" | while read -r a _ || [ -n "$a" ]; do echo "$a"; done
|
||||
if [ -f "$TMPDIR/osrel.txt" ]; then
|
||||
name=$(sed -En '/^PRETTY_NAME/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
|
||||
id=$(sed -En '/^ID/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
|
||||
@@ -225,26 +243,26 @@ if (( ${#filenames[@]} <= 0 )) && [[ -z "$unpack" ]] && [[ -z "$unpackearly" ]];
|
||||
fi
|
||||
else
|
||||
echo -n "Image: $image: "
|
||||
du -h $image | while read a b || [ -n "$a" ]; do echo $a;done
|
||||
du -h "$image" | while read -r a _ || [ -n "$a" ]; do echo "$a"; done
|
||||
fi
|
||||
|
||||
echo "========================================================================"
|
||||
fi
|
||||
|
||||
read -N 6 bin < "$image"
|
||||
read -r -N 6 bin < "$image"
|
||||
case $bin in
|
||||
$'\x71\xc7'*|070701)
|
||||
$'\x71\xc7'* | 070701)
|
||||
CAT="cat --"
|
||||
is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2>/dev/null)
|
||||
is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2> /dev/null)
|
||||
# Debian mkinitramfs does not create the file 'early_cpio', so let's check if firmware files exist
|
||||
[[ "$is_early" ]] || is_early=$(cpio --list --verbose --quiet --to-stdout -- 'kernel/*/microcode/*.bin' < "$image" 2>/dev/null)
|
||||
[[ "$is_early" ]] || is_early=$(cpio --list --verbose --quiet --to-stdout -- 'kernel/*/microcode/*.bin' < "$image" 2> /dev/null)
|
||||
if [[ "$is_early" ]]; then
|
||||
if [[ -n "$unpack" ]]; then
|
||||
if [[ -n $unpack ]]; then
|
||||
# should use --unpackearly for early CPIO
|
||||
:
|
||||
elif [[ -n "$unpackearly" ]]; then
|
||||
elif [[ -n $unpackearly ]]; then
|
||||
unpack_files
|
||||
elif (( ${#filenames[@]} > 0 )); then
|
||||
elif ((${#filenames[@]} > 0)); then
|
||||
extract_files
|
||||
else
|
||||
echo "Early CPIO image"
|
||||
@@ -265,10 +283,10 @@ case $bin in
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ $SKIP ]] ; then
|
||||
bin="$($SKIP "$image" | { read -N 6 bin && echo "$bin" ; })"
|
||||
if [[ $SKIP ]]; then
|
||||
bin="$($SKIP "$image" | { read -r -N 6 bin && echo "$bin"; })"
|
||||
else
|
||||
read -N 6 bin < "$image"
|
||||
read -r -N 6 bin < "$image"
|
||||
fi
|
||||
case $bin in
|
||||
$'\x1f\x8b'*)
|
||||
@@ -277,7 +295,7 @@ case $bin in
|
||||
BZh*)
|
||||
CAT="bzcat --"
|
||||
;;
|
||||
$'\x71\xc7'*|070701)
|
||||
$'\x71\xc7'* | 070701)
|
||||
CAT="cat --"
|
||||
;;
|
||||
$'\x02\x21'*)
|
||||
@@ -290,7 +308,7 @@ case $bin in
|
||||
CAT="zstd -d -c"
|
||||
;;
|
||||
*)
|
||||
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
|
||||
if echo "test" | xz | xzcat --single-stream > /dev/null 2>&1; then
|
||||
CAT="xzcat --single-stream --"
|
||||
else
|
||||
CAT="xzcat --"
|
||||
@@ -298,8 +316,7 @@ case $bin in
|
||||
;;
|
||||
esac
|
||||
|
||||
skipcpio()
|
||||
{
|
||||
skipcpio() {
|
||||
$SKIP "$@" | $ORIG_CAT
|
||||
}
|
||||
|
||||
@@ -308,26 +325,26 @@ if [[ $SKIP ]]; then
|
||||
CAT=skipcpio
|
||||
fi
|
||||
|
||||
if (( ${#filenames[@]} > 1 )); then
|
||||
if ((${#filenames[@]} > 1)); then
|
||||
TMPFILE="$TMPDIR/initrd.cpio"
|
||||
$CAT "$image" 2>/dev/null > $TMPFILE
|
||||
pre_decompress()
|
||||
{
|
||||
cat $TMPFILE
|
||||
$CAT "$image" 2> /dev/null > "$TMPFILE"
|
||||
pre_decompress() {
|
||||
cat "$TMPFILE"
|
||||
}
|
||||
CAT=pre_decompress
|
||||
fi
|
||||
|
||||
ret=0
|
||||
|
||||
if [[ -n "$unpack" ]]; then
|
||||
if [[ -n $unpack ]]; then
|
||||
unpack_files
|
||||
elif (( ${#filenames[@]} > 0 )); then
|
||||
elif ((${#filenames[@]} > 0)); then
|
||||
extract_files
|
||||
else
|
||||
# shellcheck disable=SC2046
|
||||
version=$($CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
|
||||
$(dracutlibdirs 'dracut-*') 2>/dev/null)
|
||||
((ret+=$?))
|
||||
$(dracutlibdirs 'dracut-*') 2> /dev/null)
|
||||
((ret += $?))
|
||||
echo "Version: $version"
|
||||
echo
|
||||
if [ "$modules" -eq 1 ]; then
|
||||
@@ -335,8 +352,9 @@ else
|
||||
echo "========================================================================"
|
||||
else
|
||||
echo -n "Arguments: "
|
||||
# shellcheck disable=SC2046
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
|
||||
$(dracutlibdirs build-parameter.txt) 2>/dev/null
|
||||
$(dracutlibdirs build-parameter.txt) 2> /dev/null
|
||||
echo
|
||||
list_modules
|
||||
list_files
|
||||
@@ -344,4 +362,4 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
exit $ret
|
||||
exit "$ret"
|
||||
|
@@ -510,6 +510,9 @@ will not be able to boot.
|
||||
The <BUILD_ID> is taken from BUILD_ID in _/usr/lib/os-release_ or if it exists
|
||||
_/etc/os-release_ and is left out, if BUILD_ID is non-existant or empty.
|
||||
|
||||
**--no-uefi**::
|
||||
Disables UEFI mode.
|
||||
|
||||
**--no-machineid**::
|
||||
affects the default output filename of **--uefi** and will discard the <MACHINE_ID>
|
||||
part.
|
||||
@@ -518,7 +521,6 @@ will not be able to boot.
|
||||
Specifies the UEFI stub loader, which will load the attached kernel, initramfs and
|
||||
kernel command line and boots the kernel. The default is
|
||||
_$prefix/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
|
||||
or _$prefix/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
|
||||
|
||||
**--uefi-splash-image _<FILE>_**::
|
||||
Specifies the UEFI stub loader's splash image. Requires bitmap (**.bmp**) image
|
||||
@@ -593,6 +595,12 @@ Default:
|
||||
_SYSTEMD_VERSION_::
|
||||
overrides systemd version. Used for **--sysroot**.
|
||||
|
||||
_SYSTEMCTL_::
|
||||
overrides the systemctl binary. Used for **--sysroot**.
|
||||
|
||||
_NM_VERSION_::
|
||||
overrides the NetworkManager version. Used for **--sysroot**.
|
||||
|
||||
_DRACUT_INSTALL_PATH_::
|
||||
overrides **PATH** environment for **dracut-install** to look for
|
||||
binaries relative to **--sysroot**. In a cross-compiled environment
|
@@ -162,9 +162,6 @@ include::dracut.cmdline.7.asc[]
|
||||
[[lsinitrd1]]
|
||||
include::lsinitrd.1.asc[]
|
||||
|
||||
[[mkinitrd8]]
|
||||
include::mkinitrd.8.asc[]
|
||||
|
||||
= Developer Manual
|
||||
|
||||
:leveloffset: 1
|
@@ -167,10 +167,16 @@ Misc
|
||||
specify the controlling terminal for the console.
|
||||
This is useful, if you have multiple "console=" arguments.
|
||||
|
||||
**rd.shutdown.timeout.umount=**__<seconds>__::
|
||||
specify how long dracut should wait for an individual umount to finish
|
||||
during shutdown. This avoids the system from blocking when unmounting a file
|
||||
system cannot complete and waits indefinitely. Value '0' means to wait
|
||||
'forever'. The default is 90 seconds.
|
||||
|
||||
[[dracutkerneldebug]]
|
||||
Debug
|
||||
~~~~~
|
||||
If you are dropped to an emergency shell, the file
|
||||
If you are dropped to an emergency shell, 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.
|
||||
@@ -569,23 +575,32 @@ USB Android phone::
|
||||
* enp0s29u1u2
|
||||
=====================
|
||||
|
||||
**ip=**__{dhcp|on|any|dhcp6|auto6|either6}__::
|
||||
dhcp|on|any::: get ip from dhcp server from all interfaces. If root=dhcp,
|
||||
**ip=**__{dhcp|on|any|dhcp6|auto6|either6|link6|single-dhcp}__::
|
||||
dhcp|on|any::: get ip from dhcp server from all interfaces. If netroot=dhcp,
|
||||
loop sequentially through all interfaces (eth0, eth1, ...) and use the first
|
||||
with a valid DHCP root-path.
|
||||
|
||||
single-dhcp::: Send DHCP on all available interfaces in parallel, as
|
||||
opposed to one after another. After the first DHCP response is received,
|
||||
stop DHCP on all other interfaces. This gives the fastest boot time by
|
||||
using the IP on interface for which DHCP succeeded first during early boot.
|
||||
Caveat: Does not apply to Network Manager and to SUSE using wicked.
|
||||
|
||||
auto6::: IPv6 autoconfiguration
|
||||
|
||||
dhcp6::: IPv6 DHCP
|
||||
|
||||
either6::: if auto6 fails, then dhcp6
|
||||
|
||||
**ip=**__<interface>__:__{dhcp|on|any|dhcp6|auto6}__[:[__<mtu>__][:__<macaddr>__]]::
|
||||
link6::: bring up interface for IPv6 link-local addressing
|
||||
|
||||
**ip=**__<interface>__:__{dhcp|on|any|dhcp6|auto6|link6}__[:[__<mtu>__][:__<macaddr>__]]::
|
||||
This parameter can be specified multiple times.
|
||||
+
|
||||
=====================
|
||||
dhcp|on|any|dhcp6::: get ip from dhcp server on a specific interface
|
||||
auto6::: do IPv6 autoconfiguration
|
||||
link6::: bring up interface for IPv6 link local address
|
||||
<macaddr>::: optionally **set** <macaddr> on the <interface>. This
|
||||
cannot be used in conjunction with the **ifname** argument for the
|
||||
same <interface>.
|
||||
@@ -692,7 +707,7 @@ NFS
|
||||
":" or "," and are separated by ",".
|
||||
|
||||
**root=**nfs:\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__], **root=**nfs4:\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__], **root=**__{dhcp|dhcp6}__::
|
||||
root=dhcp alone directs initrd to look at the DHCP root-path where NFS
|
||||
netroot=dhcp alone directs initrd to look at the DHCP root-path where NFS
|
||||
options can be specified.
|
||||
+
|
||||
[listing]
|
||||
@@ -856,7 +871,7 @@ iscsistart -b --param node.session.timeo.replacement_timeout=30
|
||||
|
||||
FCoE
|
||||
~~~~
|
||||
**rd.nofcoe=0**::
|
||||
**rd.fcoe=0**::
|
||||
disable FCoE and lldpad
|
||||
|
||||
**fcoe=**__<edd|interface|MAC>__:__{dcb|nodcb}__:__{fabric|vn2vn}__::
|
||||
@@ -894,8 +909,8 @@ NOTE:
|
||||
If "exportname" instead of "port" is given the standard port is used.
|
||||
Newer versions of nbd are only supported with "exportname".
|
||||
|
||||
**root=dhcp** with **dhcp** **root-path=**nbd:__<server>__:__<port/exportname>__[:__<fstype>__[:__<mountopts>__[:__<nbdopts>__]]]::
|
||||
root=dhcp alone directs initrd to look at the DHCP root-path where NBD
|
||||
**root=/dev/root netroot=dhcp** with **dhcp** **root-path=**nbd:__<server>__:__<port/exportname>__[:__<fstype>__[:__<mountopts>__[:__<nbdopts>__]]]::
|
||||
netroot=dhcp alone directs initrd to look at the DHCP root-path where NBD
|
||||
options can be specified. This syntax is only usable in cases where you are
|
||||
directly mounting the volume as the rootfs.
|
||||
+
|
||||
@@ -1097,7 +1112,7 @@ used to persist the changes made to the device specified by the
|
||||
**root=live:__<url>__** option.
|
||||
+
|
||||
The default _pathspec_, when _auto_ or no _:<pathspec>_ is given, is
|
||||
`/<+++<b>rd.live.dir</b>+++>/overlay-<label>-<uuid>`, where _<label>_ is the
|
||||
`/<rd.live.dir>/overlay-<label>-<uuid>`, where _<label>_ is the
|
||||
device LABEL, and _<uuid>_ is the device UUID.
|
||||
* _none_ (the word itself) specifies that no overlay will be used, such as when
|
||||
an uncompressed, writable live root filesystem is available.
|
@@ -204,7 +204,6 @@ provide a valid _/etc/fstab_.
|
||||
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_
|
||||
|
||||
*uefi_splash_image=*"_<FILE>_"::
|
||||
Specifies the UEFI stub loader's splash image. Requires bitmap (**.bmp**) image format.
|
@@ -62,7 +62,7 @@ _/etc/dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_. See *dracut.conf*(5).
|
||||
You can also add dracut modules on the command line
|
||||
by using the -a or --add option:
|
||||
----
|
||||
# dracut --add bootchart initramfs-bootchart.img
|
||||
# dracut --add module initramfs-module.img
|
||||
----
|
||||
|
||||
To see a list of available dracut modules, use the --list-modules option:
|
@@ -1,226 +0,0 @@
|
||||
#!/bin/bash --norc
|
||||
kver=$(uname -r)
|
||||
|
||||
boot_dir="/boot"
|
||||
quiet=0
|
||||
host_only=0
|
||||
force=0
|
||||
|
||||
error() { echo "$@" >&2; }
|
||||
|
||||
usage () {
|
||||
[[ $1 = '-n' ]] && cmd=echo || cmd=error
|
||||
|
||||
$cmd "usage: ${0##*/} [--version] [--help] [-v] [-f] [--preload <module>]"
|
||||
$cmd " [--image-version] [--with=<module>]"
|
||||
$cmd " [--nocompress]"
|
||||
$cmd " <initrd-image> <kernel-version>"
|
||||
$cmd ""
|
||||
$cmd " (ex: ${0##*/} /boot/initramfs-$kver.img $kver)"
|
||||
|
||||
[[ $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
|
||||
}
|
||||
|
||||
# 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 "${DRACUT_ARCH:-$(uname -m)}" in
|
||||
s390|s390x)
|
||||
regex='image'
|
||||
;;
|
||||
ppc*)
|
||||
regex='vmlinux'
|
||||
;;
|
||||
i?86|x86_64)
|
||||
regex='vmlinuz'
|
||||
;;
|
||||
arm*)
|
||||
regex='[uz]Image'
|
||||
;;
|
||||
aarch64|riscv64)
|
||||
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 $?
|
||||
basicmodules="$basicmodules ${usbmodule:-usb-storage}"
|
||||
unset usbmodule;;
|
||||
--with-avail) read_arg modname "$@" || shift $?
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--with) read_arg modname "$@" || shift $?
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--version)
|
||||
echo "mkinitrd: dracut compatibility wrapper"
|
||||
exit 0;;
|
||||
-v|--verbose) dracut_args="${dracut_args} -v";;
|
||||
-f|--force) force=1;;
|
||||
--preload) read_arg modname "$@" || shift $?
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--image-version) img_vers=yes;;
|
||||
--rootfs|-d) read_arg rootfs "$@" || shift $?
|
||||
dracut_args="${dracut_args} --filesystems $rootfs";;
|
||||
--nocompress) dracut_args="$dracut_args --no-compress";;
|
||||
--help) usage -n;;
|
||||
--builtin) ;;
|
||||
--without*) ;;
|
||||
--without-usb) ;;
|
||||
--fstab*) ;;
|
||||
--ifneeded) ;;
|
||||
--omit-scsi-modules) ;;
|
||||
--omit-ide-modules) ;;
|
||||
--omit-raid-modules) ;;
|
||||
--omit-lvm-modules) ;;
|
||||
--omit-dmraid) ;;
|
||||
--allow-missing) ;;
|
||||
--net-dev*) ;;
|
||||
--noresume) ;;
|
||||
--rootdev*) ;;
|
||||
--thawdev*) ;;
|
||||
--rootopts*) ;;
|
||||
--root*) ;;
|
||||
--loopdev*) ;;
|
||||
--loopfs*) ;;
|
||||
--loopopts*) ;;
|
||||
--looppath*) ;;
|
||||
--dsdt*) ;;
|
||||
--bootchart) ;;
|
||||
-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;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
[[ $targets && $kernels ]] || default_kernel_images
|
||||
[[ $targets && $kernels ]] || (error "No kernel found in $boot_dir" && usage)
|
||||
|
||||
# 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
|
@@ -1,106 +0,0 @@
|
||||
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 compatibility 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_), Image name should begin with the following string,
|
||||
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 environment 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)
|
379
mkinitrd-suse.sh
379
mkinitrd-suse.sh
@@ -1,379 +0,0 @@
|
||||
#!/bin/bash --norc
|
||||
#
|
||||
# mkinitrd compatibility 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 " environment 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=$(( 0xffffffff << (32 - $prefix) ))
|
||||
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
|
||||
}
|
||||
|
||||
kernel_version_from_image() {
|
||||
local dir="${1%/*}/"
|
||||
[[ "$dir" != "$1" ]] || dir=""
|
||||
local kernel_image="$1" kernel_image_gz="${dir}vmlinux-${1#*-}.gz"
|
||||
echo kernel_image_gz="'$kernel_image_gz'" >&2
|
||||
|
||||
if get_kernel_version "$kernel_image" 2>/dev/null; then
|
||||
return
|
||||
fi
|
||||
|
||||
# As a last resort, try vmlinux-$version.gz, which might be around
|
||||
get_kernel_version "$kernel_image_gz" 2>/dev/null
|
||||
}
|
||||
|
||||
# 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 "${DRACUT_ARCH:-$(uname -m)}" in
|
||||
s390|s390x)
|
||||
regex='image'
|
||||
;;
|
||||
ppc|ppc64)
|
||||
regex='vmlinux'
|
||||
;;
|
||||
i?86|x86_64)
|
||||
regex='vmlinuz'
|
||||
;;
|
||||
arm*)
|
||||
regex='[uz]Image'
|
||||
;;
|
||||
aarch64|riscv64)
|
||||
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=$(kernel_version_from_image \
|
||||
$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
|
||||
[ -L "/boot/$kernel_image" ] && kernel_image="$(readlink "/boot/$kernel_image")"
|
||||
kernels="$kernels ${kernel_image#*-}"
|
||||
done
|
||||
;;
|
||||
-i) read_arg initrd_images "$@" || shift $?
|
||||
for initrd_image in $initrd_images;do
|
||||
[ -L "/boot/$initrd_image" ] && initrd_image="$(readlink "/boot/$initrd_image")"
|
||||
# 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) dracut_args="${dracut_args} --no-host-only";;
|
||||
-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 or bad modules dir in /lib/modules"
|
||||
exit 1
|
||||
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
|
||||
|
||||
failed=""
|
||||
|
||||
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
|
||||
[ $? -ne 0 ] && failed="$failed $target"
|
||||
else
|
||||
$dracut_cmd $dracut_args "$target" "$kernel" &>/dev/null
|
||||
[ $? -ne 0 ] && failed="$failed $target"
|
||||
fi
|
||||
else
|
||||
if [ -n "${modules_all}" ];then
|
||||
$dracut_cmd $dracut_args --force-drivers "${modules_all}" "$target" "$kernel"
|
||||
[ $? -ne 0 ] && failed="$failed $target"
|
||||
else
|
||||
$dracut_cmd $dracut_args "$target" "$kernel"
|
||||
[ $? -ne 0 ] && failed="$failed $target"
|
||||
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
|
||||
[ $? -ne 0 ] && echo "Updating bootloader failed" && exit 1
|
||||
fi
|
||||
|
||||
if [ "$failed" != "" ]; then
|
||||
echo "Generating $failed targets failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
@@ -1,66 +0,0 @@
|
||||
MKINITRD(8)
|
||||
=========
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
:man version: {version}
|
||||
|
||||
NAME
|
||||
----
|
||||
mkinitrd - is a compat wrapper, which calls dracut to generate an initramfs
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
*mkinitrd* ['OPTION...'] [<initrd-image>] <kernel-version>
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
mkinitrd creates an initramfs image <initrd-image> for the kernel with
|
||||
version <kernel-version> by calling "dracut".
|
||||
|
||||
[IMPORTANT]
|
||||
If a more fine grained control over the resulting image is needed,
|
||||
"dracut" should be called directly.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
**--version**::
|
||||
print info about the version
|
||||
|
||||
**-v, --verbose**::
|
||||
increase verbosity level
|
||||
|
||||
**-f, --force**::
|
||||
overwrite existing initramfs file.
|
||||
|
||||
**--image-version*::
|
||||
append the kernel version to the target image
|
||||
<initrd-image>-<kernel-version>.
|
||||
|
||||
**--with=<module>**::
|
||||
add the kernel module <module> to the initramfs.
|
||||
|
||||
**--preload=<module>**::
|
||||
preload the kernel module <module> in the initramfs before any other kernel
|
||||
modules are loaded. This can be used to ensure a certain device naming,
|
||||
which should in theory be avoided and the use of symbolic links in /dev is
|
||||
encouraged.
|
||||
|
||||
**--nocompress**::
|
||||
do not compress the resulting image.
|
||||
|
||||
**--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
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
*dracut*(8)
|
@@ -18,4 +18,3 @@ install() {
|
||||
# Prefer bash as /bin/sh if it is available.
|
||||
inst /bin/bash && ln -sf bash "${initdir}/bin/sh"
|
||||
}
|
||||
|
||||
|
@@ -1,30 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 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
|
||||
|
||||
inst_multiple bootchartd bash \
|
||||
/lib/bootchart/bootchart-collector /etc/bootchartd.conf \
|
||||
accton \
|
||||
echo \
|
||||
grep \
|
||||
usleep
|
||||
|
||||
inst /usr/bin/pkill /bin/pkill
|
||||
inst /usr/bin/[ /bin/[
|
||||
}
|
||||
|
@@ -18,4 +18,3 @@ install() {
|
||||
# Prefer dash as /bin/sh if it is available.
|
||||
inst /bin/dash && ln -sf dash "${initdir}/bin/sh"
|
||||
}
|
||||
|
||||
|
@@ -18,4 +18,3 @@ install() {
|
||||
# Prefer mksh as /bin/sh if it is available.
|
||||
inst /bin/mksh && ln -sf mksh "${initdir}/bin/sh"
|
||||
}
|
||||
|
||||
|
21
modules.d/00systemd-network-management/module-setup.sh
Executable file
21
modules.d/00systemd-network-management/module-setup.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
# This file is part of dracut.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Prerequisite check(s) for module.
|
||||
check() {
|
||||
|
||||
# Return 255 to only include the module, if another module requires it.
|
||||
return 255
|
||||
|
||||
}
|
||||
|
||||
# Module dependency requirements.
|
||||
depends() {
|
||||
|
||||
# This module has external dependency on other module(s).
|
||||
echo systemd systemd-hostnamed systemd-networkd systemd-resolved systemd-timedated systemd-timesyncd
|
||||
# Return 0 to include the dependent module(s) in the initramfs.
|
||||
return 0
|
||||
|
||||
}
|
@@ -1,26 +1,14 @@
|
||||
#!/bin/bash
|
||||
# This file is part of dracut.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
getSystemdVersion() {
|
||||
[ -z "$SYSTEMD_VERSION" ] && SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
|
||||
# Check if the systemd version is a valid number
|
||||
if ! [[ $SYSTEMD_VERSION =~ ^[0-9]+$ ]]; then
|
||||
dfatal "systemd version is not a number ($SYSTEMD_VERSION)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $SYSTEMD_VERSION
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
# Prerequisite check(s) for module.
|
||||
check() {
|
||||
[[ $mount_needs ]] && return 1
|
||||
if require_binaries $systemdutildir/systemd; then
|
||||
SYSTEMD_VERSION=$(getSystemdVersion)
|
||||
(( $SYSTEMD_VERSION >= 198 )) && return 0
|
||||
return 255
|
||||
fi
|
||||
|
||||
return 1
|
||||
# If the binary(s) requirements are not fulfilled the module can't be installed
|
||||
require_binaries "$systemdutildir"/systemd || return 1
|
||||
# Return 255 to only include the module, if another module requires it.
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
@@ -37,118 +25,114 @@ installkernel() {
|
||||
install() {
|
||||
local _mods
|
||||
|
||||
if [[ "$prefix" == /run/* ]]; then
|
||||
dfatal "systemd does not work with a prefix, which contains \"/run\"!!"
|
||||
if [[ $prefix == /run/* ]]; then
|
||||
dfatal 'systemd does not work with a prefix, which contains "/run"!!'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $(getSystemdVersion) -ge 240 ]; then
|
||||
inst_multiple -o \
|
||||
$systemdutildir/system-generators/systemd-debug-generator \
|
||||
$systemdsystemunitdir/debug-shell.service
|
||||
fi
|
||||
|
||||
inst_multiple -o \
|
||||
$systemdutildir/systemd \
|
||||
$systemdutildir/systemd-coredump \
|
||||
$systemdutildir/systemd-cgroups-agent \
|
||||
$systemdutildir/systemd-shutdown \
|
||||
$systemdutildir/systemd-reply-password \
|
||||
$systemdutildir/systemd-fsck \
|
||||
$systemdutildir/systemd-udevd \
|
||||
$systemdutildir/systemd-journald \
|
||||
$systemdutildir/systemd-sysctl \
|
||||
$systemdutildir/systemd-modules-load \
|
||||
$systemdutildir/systemd-vconsole-setup \
|
||||
$systemdutildir/systemd-volatile-root \
|
||||
$systemdutildir/system-generators/systemd-fstab-generator \
|
||||
$systemdutildir/system-generators/systemd-gpt-auto-generator \
|
||||
"$systemdutildir"/systemd \
|
||||
"$systemdutildir"/systemd-coredump \
|
||||
"$systemdutildir"/systemd-cgroups-agent \
|
||||
"$systemdutildir"/systemd-shutdown \
|
||||
"$systemdutildir"/systemd-reply-password \
|
||||
"$systemdutildir"/systemd-fsck \
|
||||
"$systemdutildir"/systemd-udevd \
|
||||
"$systemdutildir"/systemd-journald \
|
||||
"$systemdutildir"/systemd-sysctl \
|
||||
"$systemdutildir"/systemd-modules-load \
|
||||
"$systemdutildir"/systemd-vconsole-setup \
|
||||
"$systemdutildir"/systemd-volatile-root \
|
||||
"$systemdutildir"/system-generators/systemd-debug-generator \
|
||||
"$systemdutildir"/system-generators/systemd-fstab-generator \
|
||||
"$systemdutildir"/system-generators/systemd-gpt-auto-generator \
|
||||
\
|
||||
$systemdsystemunitdir/cryptsetup.target \
|
||||
$systemdsystemunitdir/cryptsetup-pre.target \
|
||||
$systemdsystemunitdir/remote-cryptsetup.target \
|
||||
$systemdsystemunitdir/emergency.target \
|
||||
$systemdsystemunitdir/sysinit.target \
|
||||
$systemdsystemunitdir/basic.target \
|
||||
$systemdsystemunitdir/halt.target \
|
||||
$systemdsystemunitdir/kexec.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 \
|
||||
$systemdsystemunitdir/reboot.target \
|
||||
$systemdsystemunitdir/rescue.target \
|
||||
$systemdsystemunitdir/rpcbind.target \
|
||||
$systemdsystemunitdir/shutdown.target \
|
||||
$systemdsystemunitdir/final.target \
|
||||
$systemdsystemunitdir/sigpwr.target \
|
||||
$systemdsystemunitdir/sockets.target \
|
||||
$systemdsystemunitdir/swap.target \
|
||||
$systemdsystemunitdir/timers.target \
|
||||
$systemdsystemunitdir/paths.target \
|
||||
$systemdsystemunitdir/umount.target \
|
||||
"$systemdsystemunitdir"/debug-shell.service \
|
||||
"$systemdsystemunitdir"/cryptsetup.target \
|
||||
"$systemdsystemunitdir"/cryptsetup-pre.target \
|
||||
"$systemdsystemunitdir"/remote-cryptsetup.target \
|
||||
"$systemdsystemunitdir"/emergency.target \
|
||||
"$systemdsystemunitdir"/sysinit.target \
|
||||
"$systemdsystemunitdir"/basic.target \
|
||||
"$systemdsystemunitdir"/halt.target \
|
||||
"$systemdsystemunitdir"/kexec.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 \
|
||||
"$systemdsystemunitdir"/reboot.target \
|
||||
"$systemdsystemunitdir"/rescue.target \
|
||||
"$systemdsystemunitdir"/rpcbind.target \
|
||||
"$systemdsystemunitdir"/shutdown.target \
|
||||
"$systemdsystemunitdir"/final.target \
|
||||
"$systemdsystemunitdir"/sigpwr.target \
|
||||
"$systemdsystemunitdir"/sockets.target \
|
||||
"$systemdsystemunitdir"/swap.target \
|
||||
"$systemdsystemunitdir"/timers.target \
|
||||
"$systemdsystemunitdir"/paths.target \
|
||||
"$systemdsystemunitdir"/umount.target \
|
||||
\
|
||||
$systemdsystemunitdir/sys-kernel-config.mount \
|
||||
"$systemdsystemunitdir"/sys-kernel-config.mount \
|
||||
\
|
||||
$systemdsystemunitdir/kmod-static-nodes.service \
|
||||
$systemdsystemunitdir/systemd-tmpfiles-setup.service \
|
||||
$systemdsystemunitdir/systemd-tmpfiles-setup-dev.service \
|
||||
$systemdsystemunitdir/systemd-ask-password-console.path \
|
||||
$systemdsystemunitdir/systemd-udevd-control.socket \
|
||||
$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 \
|
||||
$systemdsystemunitdir/systemd-poweroff.service \
|
||||
$systemdsystemunitdir/systemd-reboot.service \
|
||||
$systemdsystemunitdir/systemd-kexec.service \
|
||||
$systemdsystemunitdir/systemd-fsck@.service \
|
||||
$systemdsystemunitdir/systemd-udevd.service \
|
||||
$systemdsystemunitdir/systemd-udev-trigger.service \
|
||||
$systemdsystemunitdir/systemd-udev-settle.service \
|
||||
$systemdsystemunitdir/systemd-ask-password-plymouth.service \
|
||||
$systemdsystemunitdir/systemd-journald.service \
|
||||
$systemdsystemunitdir/systemd-vconsole-setup.service \
|
||||
$systemdsystemunitdir/systemd-volatile-root.service \
|
||||
$systemdsystemunitdir/systemd-random-seed-load.service \
|
||||
$systemdsystemunitdir/systemd-random-seed.service \
|
||||
$systemdsystemunitdir/systemd-sysctl.service \
|
||||
"$systemdsystemunitdir"/kmod-static-nodes.service \
|
||||
"$systemdsystemunitdir"/systemd-tmpfiles-setup.service \
|
||||
"$systemdsystemunitdir"/systemd-tmpfiles-setup-dev.service \
|
||||
"$systemdsystemunitdir"/systemd-ask-password-console.path \
|
||||
"$systemdsystemunitdir"/systemd-udevd-control.socket \
|
||||
"$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 \
|
||||
"$systemdsystemunitdir"/systemd-poweroff.service \
|
||||
"$systemdsystemunitdir"/systemd-reboot.service \
|
||||
"$systemdsystemunitdir"/systemd-kexec.service \
|
||||
"$systemdsystemunitdir"/systemd-fsck@.service \
|
||||
"$systemdsystemunitdir"/systemd-udevd.service \
|
||||
"$systemdsystemunitdir"/systemd-udev-trigger.service \
|
||||
"$systemdsystemunitdir"/systemd-udev-settle.service \
|
||||
"$systemdsystemunitdir"/systemd-ask-password-plymouth.service \
|
||||
"$systemdsystemunitdir"/systemd-journald.service \
|
||||
"$systemdsystemunitdir"/systemd-vconsole-setup.service \
|
||||
"$systemdsystemunitdir"/systemd-volatile-root.service \
|
||||
"$systemdsystemunitdir"/systemd-random-seed-load.service \
|
||||
"$systemdsystemunitdir"/systemd-random-seed.service \
|
||||
"$systemdsystemunitdir"/systemd-sysctl.service \
|
||||
\
|
||||
$systemdsystemunitdir/sysinit.target.wants/systemd-modules-load.service \
|
||||
$systemdsystemunitdir/sysinit.target.wants/systemd-ask-password-console.path \
|
||||
$systemdsystemunitdir/sysinit.target.wants/systemd-journald.service \
|
||||
$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 \
|
||||
$systemdsystemunitdir/sysinit.target.wants/kmod-static-nodes.service \
|
||||
$systemdsystemunitdir/sysinit.target.wants/systemd-tmpfiles-setup.service \
|
||||
$systemdsystemunitdir/sysinit.target.wants/systemd-tmpfiles-setup-dev.service \
|
||||
$systemdsystemunitdir/sysinit.target.wants/systemd-sysctl.service \
|
||||
"$systemdsystemunitdir"/sysinit.target.wants/systemd-modules-load.service \
|
||||
"$systemdsystemunitdir"/sysinit.target.wants/systemd-ask-password-console.path \
|
||||
"$systemdsystemunitdir"/sysinit.target.wants/systemd-journald.service \
|
||||
"$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 \
|
||||
"$systemdsystemunitdir"/sysinit.target.wants/kmod-static-nodes.service \
|
||||
"$systemdsystemunitdir"/sysinit.target.wants/systemd-tmpfiles-setup.service \
|
||||
"$systemdsystemunitdir"/sysinit.target.wants/systemd-tmpfiles-setup-dev.service \
|
||||
"$systemdsystemunitdir"/sysinit.target.wants/systemd-sysctl.service \
|
||||
\
|
||||
$systemdsystemunitdir/ctrl-alt-del.target \
|
||||
$systemdsystemunitdir/reboot.target \
|
||||
$systemdsystemunitdir/systemd-reboot.service \
|
||||
$systemdsystemunitdir/syslog.socket \
|
||||
"$systemdsystemunitdir"/ctrl-alt-del.target \
|
||||
"$systemdsystemunitdir"/reboot.target \
|
||||
"$systemdsystemunitdir"/systemd-reboot.service \
|
||||
"$systemdsystemunitdir"/syslog.socket \
|
||||
\
|
||||
$systemdsystemunitdir/slices.target \
|
||||
$systemdsystemunitdir/system.slice \
|
||||
$systemdsystemunitdir/-.slice \
|
||||
"$systemdsystemunitdir"/slices.target \
|
||||
"$systemdsystemunitdir"/system.slice \
|
||||
"$systemdsystemunitdir"/-.slice \
|
||||
\
|
||||
$tmpfilesdir/systemd.conf \
|
||||
"$tmpfilesdir"/systemd.conf \
|
||||
\
|
||||
journalctl systemctl \
|
||||
echo swapoff \
|
||||
@@ -157,8 +141,7 @@ install() {
|
||||
systemd-run systemd-escape \
|
||||
systemd-cgls systemd-tmpfiles \
|
||||
systemd-ask-password systemd-tty-ask-password-agent \
|
||||
/etc/udev/udev.hwdb \
|
||||
${NULL}
|
||||
/etc/udev/udev.hwdb
|
||||
|
||||
inst_multiple -o \
|
||||
/usr/lib/modules-load.d/*.conf \
|
||||
@@ -168,21 +151,22 @@ install() {
|
||||
local _line i
|
||||
for i in "$dracutsysrootdir$1"/*.conf; do
|
||||
[[ -f $i ]] || continue
|
||||
while read _line || [ -n "$_line" ]; do
|
||||
while read -r _line || [ -n "$_line" ]; do
|
||||
case $_line in
|
||||
\#*)
|
||||
;;
|
||||
\;*)
|
||||
;;
|
||||
\#*) ;;
|
||||
|
||||
\;*) ;;
|
||||
|
||||
*)
|
||||
echo $_line
|
||||
echo "$_line"
|
||||
;;
|
||||
esac
|
||||
done < "$i"
|
||||
done
|
||||
}
|
||||
|
||||
_mods=$(modules_load_get /usr/lib/modules-load.d)
|
||||
[[ $_mods ]] && hostonly='' instmods $_mods
|
||||
mapfile -t _mods < <(modules_load_get /usr/lib/modules-load.d)
|
||||
[[ ${#_mods[@]} -gt 0 ]] && hostonly='' instmods "${_mods[@]}"
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
inst_multiple -H -o \
|
||||
@@ -190,7 +174,9 @@ install() {
|
||||
/etc/systemd/journald.conf.d/*.conf \
|
||||
/etc/systemd/system.conf \
|
||||
/etc/systemd/system.conf.d/*.conf \
|
||||
/etc/hosts \
|
||||
/etc/hostname \
|
||||
/etc/nsswitch.conf \
|
||||
/etc/machine-id \
|
||||
/etc/machine-info \
|
||||
/etc/vconsole.conf \
|
||||
@@ -198,53 +184,55 @@ install() {
|
||||
/etc/modules-load.d/*.conf \
|
||||
/etc/sysctl.d/*.conf \
|
||||
/etc/sysctl.conf \
|
||||
/etc/udev/udev.conf \
|
||||
${NULL}
|
||||
/etc/udev/udev.conf
|
||||
|
||||
_mods=$(modules_load_get /etc/modules-load.d)
|
||||
[[ $_mods ]] && hostonly='' instmods $_mods
|
||||
mapfile -t _mods < <(modules_load_get /etc/modules-load.d)
|
||||
[[ ${#_mods[@]} -gt 0 ]] && hostonly='' instmods "${_mods[@]}"
|
||||
fi
|
||||
|
||||
if ! [[ -e "$initdir/etc/machine-id" ]]; then
|
||||
> "$initdir/etc/machine-id"
|
||||
: > "$initdir/etc/machine-id"
|
||||
fi
|
||||
|
||||
# install adm user/group for journald
|
||||
inst_multiple nologin
|
||||
grep '^systemd-journal:' $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
grep '^adm:' $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
grep '^systemd-journal:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||
grep '^wheel:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||
grep '^adm:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||
grep '^utmp:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||
grep '^root:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||
{
|
||||
grep '^systemd-journal:' "$dracutsysrootdir"/etc/passwd 2> /dev/null
|
||||
grep '^adm:' "$dracutsysrootdir"/etc/passwd 2> /dev/null
|
||||
# we don't use systemd-networkd, but the user is in systemd.conf tmpfiles snippet
|
||||
grep '^systemd-network:' "$dracutsysrootdir"/etc/passwd 2> /dev/null
|
||||
} >> "$initdir/etc/passwd"
|
||||
|
||||
# we don't use systemd-networkd, but the user is in systemd.conf tmpfiles snippet
|
||||
grep '^systemd-network:' $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
grep '^systemd-network:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||
{
|
||||
grep '^systemd-journal:' "$dracutsysrootdir"/etc/group 2> /dev/null
|
||||
grep '^wheel:' "$dracutsysrootdir"/etc/group 2> /dev/null
|
||||
grep '^adm:' "$dracutsysrootdir"/etc/group 2> /dev/null
|
||||
grep '^utmp:' "$dracutsysrootdir"/etc/group 2> /dev/null
|
||||
grep '^root:' "$dracutsysrootdir"/etc/group 2> /dev/null
|
||||
# we don't use systemd-networkd, but the user is in systemd.conf tmpfiles snippet
|
||||
grep '^systemd-network:' "$dracutsysrootdir"/etc/group 2> /dev/null
|
||||
} >> "$initdir/etc/group"
|
||||
|
||||
ln_r $systemdutildir/systemd "/init"
|
||||
ln_r $systemdutildir/systemd "/sbin/init"
|
||||
ln_r "$systemdutildir"/systemd "/init"
|
||||
ln_r "$systemdutildir"/systemd "/sbin/init"
|
||||
|
||||
inst_binary true
|
||||
ln_r $(type -P true) "/usr/bin/loginctl"
|
||||
ln_r $(type -P true) "/bin/loginctl"
|
||||
ln_r "$(find_binary true)" "/usr/bin/loginctl"
|
||||
ln_r "$(find_binary true)" "/bin/loginctl"
|
||||
inst_rules \
|
||||
70-uaccess.rules \
|
||||
71-seat.rules \
|
||||
73-seat-late.rules \
|
||||
90-vconsole.rules \
|
||||
99-systemd.rules \
|
||||
${NULL}
|
||||
99-systemd.rules
|
||||
|
||||
for i in \
|
||||
emergency.target \
|
||||
rescue.target \
|
||||
systemd-ask-password-console.service \
|
||||
systemd-ask-password-plymouth.service \
|
||||
; do
|
||||
[[ -f $systemdsystemunitdir/$i ]] || continue
|
||||
systemctl -q --root "$initdir" add-wants "$i" systemd-vconsole-setup.service
|
||||
systemd-ask-password-plymouth.service; do
|
||||
[[ -f "$systemdsystemunitdir"/$i ]] || continue
|
||||
$SYSTEMCTL -q --root "$initdir" add-wants "$i" systemd-vconsole-setup.service
|
||||
done
|
||||
|
||||
mkdir -p "$initdir/etc/systemd"
|
||||
@@ -256,5 +244,11 @@ install() {
|
||||
echo "RateLimitBurst=0"
|
||||
} >> "$initdir/etc/systemd/journald.conf"
|
||||
|
||||
systemctl -q --root "$initdir" set-default multi-user.target
|
||||
$SYSTEMCTL -q --root "$initdir" set-default multi-user.target
|
||||
|
||||
# Install library file(s)
|
||||
_arch=${DRACUT_ARCH:-$(uname -m)}
|
||||
inst_libdir_file \
|
||||
{"tls/$_arch/",tls/,"$_arch/",}"libnss_*"
|
||||
|
||||
}
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
if test -e /etc/adjtime ; then
|
||||
while read line ; do
|
||||
if test "$line" = LOCAL ; then
|
||||
hwclock --systz
|
||||
fi
|
||||
if test -e /etc/adjtime; then
|
||||
while read -r line; do
|
||||
if test "$line" = LOCAL; then
|
||||
hwclock --systz
|
||||
fi
|
||||
done < /etc/adjtime
|
||||
fi
|
||||
|
@@ -1,10 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
|
||||
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1
|
||||
elif [ -z "$fipsmode" ]; then
|
||||
die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
|
||||
elif getarg boot= >/dev/null; then
|
||||
elif getarg boot= > /dev/null; then
|
||||
. /sbin/fips.sh
|
||||
if mount_boot; then
|
||||
do_fips || die "FIPS integrity test failed"
|
||||
|
@@ -1,7 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
|
||||
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
|
||||
rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1
|
||||
elif [ -z "$fipsmode" ]; then
|
||||
die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
|
||||
else
|
||||
. /sbin/fips.sh
|
||||
fips_load_crypto || die "FIPS integrity test failed"
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
|
||||
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1
|
||||
elif [ -z "$fipsmode" ]; then
|
||||
die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
|
||||
elif ! [ -f /tmp/fipsdone ]; then
|
||||
|
@@ -1,5 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
# systemd lets stdout go to journal only, but the system
|
||||
# has to halt when the integrity check fails to satisfy FIPS.
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
@@ -12,67 +14,53 @@ else
|
||||
}
|
||||
fi
|
||||
|
||||
mount_boot()
|
||||
{
|
||||
mount_boot() {
|
||||
boot=$(getarg boot=)
|
||||
|
||||
if [ -n "$boot" ]; then
|
||||
case "$boot" in
|
||||
LABEL=*)
|
||||
boot="$(echo $boot | sed 's,/,\\x2f,g')"
|
||||
boot="/dev/disk/by-label/${boot#LABEL=}"
|
||||
;;
|
||||
UUID=*)
|
||||
boot="/dev/disk/by-uuid/${boot#UUID=}"
|
||||
;;
|
||||
PARTUUID=*)
|
||||
boot="/dev/disk/by-partuuid/${boot#PARTUUID=}"
|
||||
;;
|
||||
PARTLABEL=*)
|
||||
boot="/dev/disk/by-partlabel/${boot#PARTLABEL=}"
|
||||
;;
|
||||
/dev/*)
|
||||
;;
|
||||
*)
|
||||
die "You have to specify boot=<boot device> as a boot option for fips=1" ;;
|
||||
LABEL=* | UUID=* | PARTUUID=* | PARTLABEL=*)
|
||||
boot="$(label_uuid_to_dev "$boot")"
|
||||
;;
|
||||
/dev/*) ;;
|
||||
|
||||
*)
|
||||
die "You have to specify boot=<boot device> as a boot option for fips=1"
|
||||
;;
|
||||
esac
|
||||
|
||||
if ! [ -e "$boot" ]; then
|
||||
udevadm trigger --action=add >/dev/null 2>&1
|
||||
[ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)
|
||||
udevadm trigger --action=add > /dev/null 2>&1
|
||||
|
||||
i=0
|
||||
while ! [ -e $boot ]; do
|
||||
if [ $UDEVVERSION -ge 143 ]; then
|
||||
udevadm settle --exit-if-exists=$boot
|
||||
else
|
||||
udevadm settle --timeout=30
|
||||
fi
|
||||
[ -e $boot ] && break
|
||||
while ! [ -e "$boot" ]; do
|
||||
udevadm settle --exit-if-exists="$boot"
|
||||
[ -e "$boot" ] && break
|
||||
sleep 0.5
|
||||
i=$(($i+1))
|
||||
i=$((i + 1))
|
||||
[ $i -gt 40 ] && break
|
||||
done
|
||||
fi
|
||||
|
||||
[ -e "$boot" ] || return 1
|
||||
|
||||
mkdir /boot
|
||||
mkdir -p /boot
|
||||
fips_info "Mounting $boot as /boot"
|
||||
mount -oro "$boot" /boot || return 1
|
||||
elif [ -d "$NEWROOT/boot" ]; then
|
||||
# shellcheck disable=SC2114
|
||||
rm -fr -- /boot
|
||||
ln -sf "$NEWROOT/boot" /boot
|
||||
fi
|
||||
}
|
||||
|
||||
do_rhevh_check()
|
||||
{
|
||||
do_rhevh_check() {
|
||||
KERNEL=$(uname -r)
|
||||
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 || [ -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)
|
||||
HMAC_SUM_ORIG=$(while read -r a _ || [ -n "$a" ]; do printf "%s\n" "$a"; done < "$NEWROOT/boot/.vmlinuz-${KERNEL}.hmac")
|
||||
HMAC_SUM_CALC=$(sha512hmac "$kpath" | while read -r a _ || [ -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
|
||||
@@ -81,31 +69,33 @@ do_rhevh_check()
|
||||
return 0
|
||||
}
|
||||
|
||||
nonfatal_modprobe()
|
||||
{
|
||||
modprobe $1 2>&1 > /dev/stdout |
|
||||
while read -r line || [ -n "$line" ]; do
|
||||
nonfatal_modprobe() {
|
||||
modprobe "$1" 2>&1 > /dev/stdout \
|
||||
| while read -r line || [ -n "$line" ]; do
|
||||
echo "${line#modprobe: FATAL: }" >&2
|
||||
done
|
||||
}
|
||||
|
||||
fips_load_crypto()
|
||||
{
|
||||
fips_load_crypto() {
|
||||
local _k
|
||||
local _v
|
||||
local _found
|
||||
|
||||
FIPSMODULES=$(cat /etc/fipsmodules)
|
||||
|
||||
fips_info "Loading and integrity checking all crypto modules"
|
||||
mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
|
||||
for _module in $FIPSMODULES; do
|
||||
if [ "$_module" != "tcrypt" ]; then
|
||||
if ! nonfatal_modprobe "${_module}" 2>/tmp/fips.modprobe_err; then
|
||||
if ! nonfatal_modprobe "${_module}" 2> /tmp/fips.modprobe_err; then
|
||||
# check if kernel provides generic algo
|
||||
_found=0
|
||||
while read _k _s _v || [ -n "$_k" ]; do
|
||||
while read -r _k _ _v || [ -n "$_k" ]; do
|
||||
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
|
||||
[ "$_v" != "$_module" ] && continue
|
||||
_found=1
|
||||
break
|
||||
done </proc/crypto
|
||||
done < /proc/crypto
|
||||
[ "$_found" = "0" ] && cat /tmp/fips.modprobe_err >&2 && return 1
|
||||
fi
|
||||
fi
|
||||
@@ -117,10 +107,7 @@ fips_load_crypto()
|
||||
rmmod tcrypt
|
||||
}
|
||||
|
||||
do_fips()
|
||||
{
|
||||
local _v
|
||||
local _s
|
||||
do_fips() {
|
||||
local _v
|
||||
local _module
|
||||
|
||||
@@ -167,9 +154,9 @@ do_fips()
|
||||
|
||||
fips_info "All initrd crypto checks done"
|
||||
|
||||
> /tmp/fipsdone
|
||||
: > /tmp/fipsdone
|
||||
|
||||
umount /boot >/dev/null 2>&1
|
||||
umount /boot > /dev/null 2>&1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@ installkernel() {
|
||||
_fipsmodules+="crc32c crct10dif ghash "
|
||||
|
||||
# Ciphers:
|
||||
_fipsmodules+="cipher_null des3_ede aes cfb "
|
||||
_fipsmodules+="cipher_null des3_ede aes cfb dh ecdh "
|
||||
|
||||
# Modes/templates:
|
||||
_fipsmodules+="ecb cbc ctr xts gcm ccm authenc hmac cmac ofb cts "
|
||||
@@ -39,20 +39,21 @@ installkernel() {
|
||||
_fipsmodules+="aead cryptomgr tcrypt crypto_user "
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2174
|
||||
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
|
||||
|
||||
for _mod in $_fipsmodules; do
|
||||
if hostonly='' instmods -c -s $_mod; then
|
||||
echo $_mod >> "${initdir}/etc/fipsmodules"
|
||||
if hostonly='' instmods -c -s "$_mod"; then
|
||||
echo "$_mod" >> "${initdir}/etc/fipsmodules"
|
||||
echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
|
||||
fi
|
||||
done
|
||||
|
||||
# with hostonly_default_device fs module for /boot is not installed by default
|
||||
if [[ $hostonly ]] && [[ "$hostonly_default_device" == "no" ]]; then
|
||||
if [[ $hostonly ]] && [[ $hostonly_default_device == "no" ]]; then
|
||||
_bootfstype=$(find_mp_fstype /boot)
|
||||
if [[ -n "$_bootfstype" ]]; then
|
||||
hostonly='' instmods $_bootfstype
|
||||
if [[ -n $_bootfstype ]]; then
|
||||
hostonly='' instmods "$_bootfstype"
|
||||
else
|
||||
dwarning "Can't determine fs type for /boot, FIPS check may fail."
|
||||
fi
|
||||
@@ -61,7 +62,6 @@ installkernel() {
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _dir
|
||||
inst_hook pre-mount 01 "$moddir/fips-boot.sh"
|
||||
inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
|
||||
inst_hook pre-udev 01 "$moddir/fips-load-crypto.sh"
|
||||
@@ -70,13 +70,13 @@ install() {
|
||||
inst_multiple sha512hmac rmmod insmod mount uname umount
|
||||
|
||||
inst_simple /etc/system-fips
|
||||
[ -c ${initdir}/dev/random ] || mknod ${initdir}/dev/random c 1 8 \
|
||||
[ -c "${initdir}"/dev/random ] || mknod "${initdir}"/dev/random c 1 8 \
|
||||
|| {
|
||||
dfatal "Cannot create /dev/random"
|
||||
dfatal "To create an initramfs with fips support, dracut has to run as root"
|
||||
return 1
|
||||
}
|
||||
[ -c ${initdir}/dev/urandom ] || mknod ${initdir}/dev/urandom c 1 9 \
|
||||
[ -c "${initdir}"/dev/urandom ] || mknod "${initdir}"/dev/urandom c 1 9 \
|
||||
|| {
|
||||
dfatal "Cannot create /dev/random"
|
||||
dfatal "To create an initramfs with fips support, dracut has to run as root"
|
||||
|
@@ -0,0 +1,3 @@
|
||||
# This file is part of dracut systemd ac power module
|
||||
SUBSYSTEM=="power_supply", KERNEL=="AC", ATTR{online}=="0", RUN+="/usr/sbin/systemctl start initrd-on-battery-power.target"
|
||||
SUBSYSTEM=="power_supply", KERNEL=="AC", ATTR{online}=="1", RUN+="/usr/sbin/systemctl start initrd-on-ac-power.target"
|
8
modules.d/01systemd-ac-power/initrd-on-ac-power.target
Normal file
8
modules.d/01systemd-ac-power/initrd-on-ac-power.target
Normal file
@@ -0,0 +1,8 @@
|
||||
# This file is part of dracut.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
[Unit]
|
||||
Description=Initial RAM Disk On AC Power
|
||||
ConditionPathExists=/usr/lib/initrd-release
|
||||
DefaultDependencies=no
|
||||
StopWhenUnneeded=yes
|
@@ -0,0 +1,8 @@
|
||||
# This file is part of dracut.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
[Unit]
|
||||
Description=Initial RAM Disk On Battery Power
|
||||
ConditionPathExists=/usr/lib/initrd-release
|
||||
DefaultDependencies=no
|
||||
StopWhenUnneeded=yes
|
29
modules.d/01systemd-ac-power/module-setup.sh
Executable file
29
modules.d/01systemd-ac-power/module-setup.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
# This file is part of dracut.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Prerequisite check(s) for module.
|
||||
check() {
|
||||
|
||||
# Return 255 to only include the module, if another module requires it.
|
||||
return 255
|
||||
|
||||
}
|
||||
|
||||
# Module dependency requirements.
|
||||
depends() {
|
||||
|
||||
# Return 0 to include the dependent module(s) in the initramfs.
|
||||
return 0
|
||||
|
||||
}
|
||||
|
||||
# Install the required file(s) and directories for the module in the initramfs.
|
||||
install() {
|
||||
|
||||
inst_rules "$moddir/99-initrd-power-targets.rules"
|
||||
inst_simple "$systemdutildir"/systemd-ac-power
|
||||
inst_simple "$moddir/initrd-on-ac-power.target" "$systemdsystemunitdir/initrd-on-ac-power.target"
|
||||
inst_simple "$moddir/initrd-on-battery-power.target" "$systemdsystemunitdir/initrd-on-battery-power.target"
|
||||
|
||||
}
|
60
modules.d/01systemd-ask-password/module-setup.sh
Executable file
60
modules.d/01systemd-ask-password/module-setup.sh
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
# This file is part of dracut.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Prerequisite check(s) for module.
|
||||
check() {
|
||||
|
||||
# If the binary(s) requirements are not fulfilled the module can't be installed
|
||||
require_binaries \
|
||||
systemd-ask-password \
|
||||
systemd-tty-ask-password-agent \
|
||||
|| return 1
|
||||
|
||||
# Return 255 to only include the module, if another module requires it.
|
||||
return 255
|
||||
|
||||
}
|
||||
|
||||
# Module dependency requirements.
|
||||
depends() {
|
||||
|
||||
# Return 0 to include the dependent module(s) in the initramfs.
|
||||
return 0
|
||||
|
||||
}
|
||||
|
||||
# Install the required file(s) for the module in the initramfs.
|
||||
install() {
|
||||
|
||||
inst_multiple -o \
|
||||
"$systemdsystemunitdir"/systemd-ask-password-console.path \
|
||||
"$systemdsystemunitdir"/systemd-ask-password-console.service \
|
||||
"$systemdsystemunitdir"/multi-user.target.wants/systemd-ask-password-wall.path \
|
||||
"$systemdsystemunitdir"/sysinit.target.wants/systemd-ask-password-console.path \
|
||||
systemd-ask-password \
|
||||
systemd-tty-ask-password-agent
|
||||
|
||||
# Enable the systemd type service unit for systemd-ask-password.
|
||||
$SYSTEMCTL -q --root "$initdir" enable systemd-ask-password-console.service
|
||||
|
||||
# Install systemd-ask-password plymouth units if plymouth is enabled.
|
||||
if dracut_module_included "plymouth"; then
|
||||
inst_multiple -o \
|
||||
"$systemdsystemunitdir"/systemd-ask-password-plymouth.path \
|
||||
"$systemdsystemunitdir"/systemd-ask-password-plymouth.service
|
||||
|
||||
$SYSTEMCTL -q --root "$initdir" enable systemd-ask-password-plymouth.service
|
||||
fi
|
||||
|
||||
# Uncomment this section if the usecase for wall module in the initramfs arises.
|
||||
# Install systemd-ask-password wall units if <wall module> is enabled.
|
||||
#if dracut_module_included "<wall module>"; then
|
||||
# inst_multiple -o \
|
||||
# $systemdsystemunitdir/systemd-ask-password-wall.path \
|
||||
# $systemdsystemunitdir/systemd-ask-password-wall.service \
|
||||
# $systemdsystemunitdir/multi-user.target.wants/systemd-ask-password-wall.path \
|
||||
#
|
||||
# $SYSTEMCTL -q --root "$initdir" enable systemd-ask-password-wall.service
|
||||
#fi
|
||||
}
|
53
modules.d/01systemd-coredump/module-setup.sh
Executable file
53
modules.d/01systemd-coredump/module-setup.sh
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
# This file is part of dracut.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Prerequisite check(s) for module.
|
||||
check() {
|
||||
|
||||
# If the binary(s) requirements are not fulfilled the module can't be installed
|
||||
require_binaries \
|
||||
coredumpctl \
|
||||
"$systemdutildir"/systemd-coredump \
|
||||
|| return 1
|
||||
|
||||
# Return 255 to only include the module, if another module requires it.
|
||||
return 255
|
||||
|
||||
}
|
||||
|
||||
# Module dependency requirements.
|
||||
depends() {
|
||||
|
||||
# This module has external dependency on the systemd module.
|
||||
echo systemd-journald systemd-sysctl
|
||||
# Return 0 to include the dependent module(s) in the initramfs.
|
||||
return 0
|
||||
|
||||
}
|
||||
|
||||
# Install the required file(s) and directories for the module in the initramfs.
|
||||
install() {
|
||||
|
||||
inst_dir /var/lib/systemd/coredump
|
||||
inst_multiple -o \
|
||||
"$sysctld"/50-coredump.conf \
|
||||
"$systemdutildir"/coredump.conf \
|
||||
"$systemdsystemunitdir"/systemd-coredump \
|
||||
"$systemdsystemunitdir"/systemd-coredump.socket \
|
||||
"$systemdsystemunitdir"/systemd-coredump@.service \
|
||||
"$systemdsystemunitdir"/sockets.target.wants/systemd-coredump.socket \
|
||||
coredumpctl
|
||||
|
||||
# Install the hosts local user configurations if enabled.
|
||||
if [[ $hostonly ]]; then
|
||||
inst_multiple -H -o \
|
||||
"$systemdutilconfdir"/coredump.conf \
|
||||
"$systemdsystemconfdir/coredump.conf.d/*.conf" \
|
||||
"$systemdsystemconfdir"/systemd-coredump.socket \
|
||||
"$systemdsystemconfdir/systemd-coredump.socket.d/*.conf" \
|
||||
"$systemdsystemconfdir"/systemd-coredump@.service \
|
||||
"$systemdsystemconfdir/systemd-coredump@.service.d/*.conf" \
|
||||
"$systemdsystemconfdir"/sockets.target.wants/systemd-coredump.socket
|
||||
fi
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
# This file is part of dracut systemd-hostnamed module.
|
||||
|
||||
[Service]
|
||||
User=systemd-network
|
||||
Group=systemd-hostname
|
||||
AmbientCapabilities=CAP_SYS_ADMIN
|
51
modules.d/01systemd-hostnamed/module-setup.sh
Executable file
51
modules.d/01systemd-hostnamed/module-setup.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
# This file is part of dracut.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Prerequisite check(s) for module.
|
||||
check() {
|
||||
|
||||
# If the binary(s) requirements are not fulfilled the module can't be installed.
|
||||
require_binaries \
|
||||
hostnamectl \
|
||||
"$systemdutildir"/systemd-hostnamed \
|
||||
|| return 1
|
||||
|
||||
# Return 255 to only include the module, if another module requires it.
|
||||
return 255
|
||||
|
||||
}
|
||||
|
||||
# Module dependency requirements.
|
||||
depends() {
|
||||
|
||||
# This module has external dependency on other module(s).
|
||||
echo dbus systemd-sysusers
|
||||
# Return 0 to include the dependent module(s) in the initramfs.
|
||||
return 0
|
||||
|
||||
}
|
||||
|
||||
# Install the required file(s) and directories for the module in the initramfs.
|
||||
install() {
|
||||
|
||||
inst_simple "$moddir/systemd-hostname-dracut.conf" "$sysusers/systemd-hostname-dracut.conf"
|
||||
inst_simple "$moddir/org.freedesktop.hostname1_dracut.conf" "$dbussystem/org.freedesktop.hostname1_dracut.conf"
|
||||
inst_simple "$moddir/99-systemd-networkd-dracut.conf" "$systemdsystemunitdir/systemd-hostnamed.service.d/99-systemd-networkd-dracut.conf"
|
||||
|
||||
inst_multiple -o \
|
||||
"$dbussystem"/org.freedesktop.hostname1.conf \
|
||||
"$dbussystemservices"/org.freedesktop.hostname1.service \
|
||||
"$systemdutildir"/systemd-hostnamed \
|
||||
"$systemdsystemunitdir"/systemd-hostnamed.service \
|
||||
"$systemdsystemunitdir/systemd-hostnamed.service.d/*.conf" \
|
||||
hostnamectl
|
||||
|
||||
# Install the hosts local user configurations if enabled.
|
||||
if [[ $hostonly ]]; then
|
||||
inst_multiple -H -o \
|
||||
/etc/hostname \
|
||||
"$systemdsystemconfdir"/systemd-hostnamed.service \
|
||||
"$systemdsystemconfdir/systemd-hostnamed.service.d/*.conf"
|
||||
fi
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0"?> <!--*-nxml-*-->
|
||||
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
|
||||
<!--
|
||||
|
||||
This file is part of dracut systemd-hostnamed module.
|
||||
|
||||
-->
|
||||
|
||||
<busconfig>
|
||||
|
||||
<policy group="systemd-hostname">
|
||||
<allow own="org.freedesktop.hostname1"/>
|
||||
<allow send_destination="org.freedesktop.hostname1"/>
|
||||
<allow receive_sender="org.freedesktop.hostname1"/>
|
||||
</policy>
|
||||
|
||||
</busconfig>
|
@@ -0,0 +1,2 @@
|
||||
# This file is part of dracut systemd-hostnamed module.
|
||||
g systemd-hostname - "systemd hostname"
|
@@ -4,11 +4,6 @@
|
||||
check() {
|
||||
[[ $mount_needs ]] && return 1
|
||||
|
||||
if ! dracut_module_included "systemd"; then
|
||||
derror "systemd-initrd needs systemd in the initramfs"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -23,18 +18,17 @@ installkernel() {
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _mods
|
||||
|
||||
inst_multiple -o \
|
||||
$systemdsystemunitdir/initrd.target \
|
||||
$systemdsystemunitdir/initrd-fs.target \
|
||||
$systemdsystemunitdir/initrd-root-device.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
|
||||
"$systemdsystemunitdir"/initrd.target \
|
||||
"$systemdsystemunitdir"/initrd-fs.target \
|
||||
"$systemdsystemunitdir"/initrd-root-device.target \
|
||||
"$systemdsystemunitdir"/initrd-root-fs.target \
|
||||
"$systemdsystemunitdir"/initrd-usr-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
|
||||
|
||||
systemctl -q --root "$initdir" set-default initrd.target
|
||||
$SYSTEMCTL -q --root "$initdir" set-default initrd.target
|
||||
}
|
||||
|
9
modules.d/01systemd-journald/initrd.conf
Normal file
9
modules.d/01systemd-journald/initrd.conf
Normal file
@@ -0,0 +1,9 @@
|
||||
# This file is part of dracut systemd-journal module.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#
|
||||
# Dracut requires volatile journal without rate-limiting
|
||||
|
||||
[Journal]
|
||||
Storage=volatile
|
||||
RateLimitInterval=0
|
||||
RateLimitBurst=0
|
72
modules.d/01systemd-journald/module-setup.sh
Executable file
72
modules.d/01systemd-journald/module-setup.sh
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
# This file is part of dracut.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Prerequisite check(s) for module.
|
||||
check() {
|
||||
|
||||
# If the binary(s) requirements are not fulfilled the module can't be installed.
|
||||
require_binaries \
|
||||
journalctl \
|
||||
"$systemdutildir"/systemd-journald \
|
||||
|| return 1
|
||||
|
||||
# Return 255 to only include the module, if another module requires it.
|
||||
return 255
|
||||
|
||||
}
|
||||
|
||||
# Module dependency requirements.
|
||||
depends() {
|
||||
|
||||
# Return 0 to include the dependent module(s) in the initramfs.
|
||||
return 0
|
||||
|
||||
}
|
||||
|
||||
# Install the required file(s) and directories for the module in the initramfs.
|
||||
install() {
|
||||
|
||||
inst_simple "$moddir/initrd.conf" "$systemdutildir/journald.conf.d/initrd.conf"
|
||||
|
||||
inst_multiple -o \
|
||||
"$systemdutildir"/journald.conf \
|
||||
"$systemdutildir/journald.conf.d/*.conf" \
|
||||
"$systemdutildir"/systemd-journald \
|
||||
"$systemdsystemunitdir"/systemd-journald.service \
|
||||
"$systemdsystemunitdir"/systemd-journald.socket \
|
||||
"$systemdsystemunitdir"/systemd-journald@.service \
|
||||
"$systemdsystemunitdir"/systemd-journald@.socket \
|
||||
"$systemdsystemunitdir"/systemd-journald-audit.socket \
|
||||
"$systemdsystemunitdir"/systemd-journald-dev-log.socket \
|
||||
"$systemdsystemunitdir"/systemd-journald-varlink@.socket \
|
||||
"$systemdsystemunitdir"/systemd-journal-flush.service \
|
||||
"$systemdsystemunitdir"/systemd-journal-catalog-update.service \
|
||||
"$systemdsystemunitdir"/sockets.target.wants/systemd-journald-audit.socket \
|
||||
"$systemdsystemunitdir"/sockets.target.wants/systemd-journald-dev-log.socket \
|
||||
"$systemdsystemunitdir"/sockets.target.wants/systemd-journald.socket \
|
||||
"$systemdsystemunitdir"/sockets.target.wants/systemd-journald-audit.socket \
|
||||
"$systemdsystemunitdir"/sysinit.target.wants/systemd-journald.service \
|
||||
journalctl
|
||||
|
||||
# Install library file(s)
|
||||
_arch=${DRACUT_ARCH:-$(uname -m)}
|
||||
inst_libdir_file \
|
||||
{"tls/$_arch/",tls/,"$_arch/",}"liblz4.so.*" \
|
||||
{"tls/$_arch/",tls/,"$_arch/",}"libzstd.so.*" \
|
||||
{"tls/$_arch/",tls/,"$_arch/",}"liblzma.so.*"
|
||||
|
||||
# Install the hosts local user configurations if enabled.
|
||||
if [[ $hostonly ]]; then
|
||||
inst_multiple -H -o \
|
||||
"$systemdutilconfdir"/journald.conf \
|
||||
"$systemdutilconfdir/journald.conf.d/*.conf" \
|
||||
"$systemdsystemconfdir"/systemd-journald.service \
|
||||
"$systemdsystemconfdir/systemd-journald.service.d/*.conf" \
|
||||
"$systemdsystemconfdir"/systemd-journal-flush.service \
|
||||
"$systemdsystemconfdir/systemd-journal-flush.service.d/*.conf" \
|
||||
"$systemdsystemconfdir"/systemd-journal-catalog-update.service \
|
||||
"$systemdsystemconfdir/systemd-journal-catalog-update.service.d/*.conf"
|
||||
fi
|
||||
|
||||
}
|
49
modules.d/01systemd-ldconfig/module-setup.sh
Executable file
49
modules.d/01systemd-ldconfig/module-setup.sh
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
# This file is part of dracut.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Prerequisite check(s) for module.
|
||||
check() {
|
||||
|
||||
# If the binary(s) requirements are not fulfilled the module can't be installed.
|
||||
require_binaries ldconfig || return 1
|
||||
|
||||
# Return 255 to only include the module, if another module requires it.
|
||||
return 255
|
||||
|
||||
}
|
||||
|
||||
# Module dependency requirements.
|
||||
depends() {
|
||||
|
||||
# This module has external dependency on other module(s).
|
||||
echo systemd
|
||||
# Return 0 to include the dependent module(s) in the initramfs.
|
||||
return 0
|
||||
|
||||
}
|
||||
|
||||
# Install the required file(s) and directories for the module in the initramfs.
|
||||
install() {
|
||||
|
||||
inst_multiple -o \
|
||||
/etc/ld.so.cache \
|
||||
/etc/ld.so.conf \
|
||||
"/etc/ld.so.conf.d/*.conf" \
|
||||
"$systemdsystemunitdir"/ldconfig.service \
|
||||
"$systemdsystemunitdir/ldconfig.service.d/*.conf" \
|
||||
"$systemdsystemunitdir"/sysinit.target.wants/ldconfig.service \
|
||||
ldconfig
|
||||
|
||||
# Install required libraries.
|
||||
_arch=${DRACUT_ARCH:-$(uname -m)}
|
||||
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"ld.so"
|
||||
|
||||
# Install the hosts local user configurations if enabled.
|
||||
if [[ $hostonly ]]; then
|
||||
inst_multiple -H -o \
|
||||
"$systemdsystemconfdir"/ldconfig.service \
|
||||
"$systemdsystemconfdir/ldconfig.service.d/*.conf"
|
||||
fi
|
||||
|
||||
}
|
44
modules.d/01systemd-modules-load/module-setup.sh
Normal file
44
modules.d/01systemd-modules-load/module-setup.sh
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
# This file is part of dracut.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Prerequisite check(s) for module.
|
||||
check() {
|
||||
|
||||
# If the binary(s) requirements are not fulfilled the module can't be installed
|
||||
require_binaries "$systemdutildir"/systemd-modules-load || return 1
|
||||
|
||||
# Return 255 to only include the module, if another module requires it.
|
||||
return 255
|
||||
|
||||
}
|
||||
|
||||
# Module dependency requirements.
|
||||
depends() {
|
||||
|
||||
# Return 0 to include the dependent module(s) in the initramfs.
|
||||
return 0
|
||||
|
||||
}
|
||||
|
||||
# Install the required file(s) and directories for the module in the initramfs.
|
||||
install() {
|
||||
|
||||
inst_multiple -o \
|
||||
"$modulesload/*.conf" \
|
||||
"$systemdutildir"/systemd-modules-load \
|
||||
"$systemdsystemunitdir"/systemd-modules-load.service \
|
||||
"$systemdsystemunitdir"/sysinit.target.wants/systemd-modules-load.service
|
||||
|
||||
# Enable systemd type unit(s)
|
||||
$SYSTEMCTL -q --root "$initdir" enable systemd-modules-load.service
|
||||
|
||||
# Install the hosts local user configurations if enabled.
|
||||
if [[ $hostonly ]]; then
|
||||
inst_multiple -H -o \
|
||||
"$modulesloadconfdir/*.conf" \
|
||||
"$systemdsystemconfdir"/systemd-modules-load.service \
|
||||
"$systemdsystemconfdir/systemd-modules-load.service.d/*.conf"
|
||||
fi
|
||||
|
||||
}
|
79
modules.d/01systemd-networkd/module-setup.sh
Executable file
79
modules.d/01systemd-networkd/module-setup.sh
Executable file
@@ -0,0 +1,79 @@
|
||||
#!/bin/bash
|
||||
# This file is part of dracut.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Prerequisite check(s) for module.
|
||||
check() {
|
||||
[[ $mount_needs ]] && return 1
|
||||
|
||||
# If the binary(s) requirements are not fulfilled the module can't be installed
|
||||
require_binaries ip networkctl \
|
||||
"$systemdutildir"/systemd-networkd \
|
||||
"$systemdutildir"/systemd-network-generator \
|
||||
"$systemdutildir"/systemd-networkd-wait-online \
|
||||
|| return 1
|
||||
|
||||
# Return 255 to only include the module, if another module requires it.
|
||||
return 255
|
||||
|
||||
}
|
||||
|
||||
# Module dependency requirements.
|
||||
depends() {
|
||||
|
||||
# This module has external dependency on other module(s).
|
||||
echo dbus kernel-network-modules systemd-sysusers
|
||||
# Return 0 to include the dependent module(s) in the initramfs.
|
||||
return 0
|
||||
|
||||
}
|
||||
|
||||
# Install the required file(s) and directories for the module in the initramfs.
|
||||
install() {
|
||||
|
||||
inst_multiple -o \
|
||||
"$dbussystem"/org.freedesktop.network1.conf \
|
||||
"$dbussystemservices"/org.freedesktop.network1.service \
|
||||
"$systemdutildir"/networkd.conf \
|
||||
"$systemdutildir/networkd.conf.d/*.conf" \
|
||||
"$systemdutildir"/systemd-networkd \
|
||||
"$systemdutildir"/systemd-network-generator \
|
||||
"$systemdutildir"/systemd-networkd-wait-online \
|
||||
"$systemdutildir"/network/80-container-host0.network \
|
||||
"$systemdutildir"/network/80-container-ve.network \
|
||||
"$systemdutildir"/network/80-container-vz.network \
|
||||
"$systemdutildir"/network/80-vm-vt.network \
|
||||
"$systemdutildir"/network/80-wifi-adhoc.network \
|
||||
"$systemdutildir"/network/99-default.link \
|
||||
"$systemdsystemunitdir"/systemd-networkd.service \
|
||||
"$systemdsystemunitdir"/systemd-networkd.socket \
|
||||
"$systemdsystemunitdir"/systemd-network-generator.service \
|
||||
"$systemdsystemunitdir"/systemd-networkd-wait-online.service \
|
||||
"$systemdsystemunitdir"/systemd-network-generator.service \
|
||||
networkctl ip
|
||||
|
||||
# Enable systemd type units
|
||||
for i in \
|
||||
systemd-networkd.service \
|
||||
systemd-networkd.socket \
|
||||
systemd-network-generator.service \
|
||||
systemd-networkd-wait-online.service; do
|
||||
$SYSTEMCTL -q --root "$initdir" enable "$i"
|
||||
done
|
||||
|
||||
# Install the hosts local user configurations if enabled.
|
||||
if [[ $hostonly ]]; then
|
||||
inst_multiple -H -o \
|
||||
"$systemdutilconfdir"/networkd.conf \
|
||||
"$systemdutilconfdir/networkd.conf.d/*.conf" \
|
||||
"$systemdutilconfdir/network/*" \
|
||||
"$systemdsystemconfdir"/systemd-networkd.service \
|
||||
"$systemdsystemconfdir/systemd-networkd.service/*.conf" \
|
||||
"$systemdsystemunitdir"/systemd-networkd.socket \
|
||||
"$systemdsystemunitdir/systemd-networkd.socket/*.conf" \
|
||||
"$systemdsystemconfdir"/systemd-network-generator.service \
|
||||
"$systemdsystemconfdir/systemd-network-generator.service/*.conf" \
|
||||
"$systemdsystemconfdir"/systemd-networkd-wait-online.service \
|
||||
"$systemdsystemconfdir/systemd-networkd-wait-online.service/*.conf"
|
||||
fi
|
||||
}
|
40
modules.d/01systemd-repart/module-setup.sh
Executable file
40
modules.d/01systemd-repart/module-setup.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
# This file is part of dracut.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Prerequisite check(s) for module.
|
||||
check() {
|
||||
|
||||
# If the binary(s) requirements are not fulfilled the module can't be installed.
|
||||
require_binaries systemd-repart || return 1
|
||||
|
||||
# Return 255 to only include the module, if another module requires it.
|
||||
return 255
|
||||
|
||||
}
|
||||
|
||||
# Module dependency requirements.
|
||||
depends() {
|
||||
|
||||
# Return 0 to include the dependent module(s) in the initramfs.
|
||||
return 0
|
||||
|
||||
}
|
||||
|
||||
# Install the required file(s) for the module in the initramfs.
|
||||
install() {
|
||||
|
||||
inst_multiple -o \
|
||||
"$libdir/repart.d/*.conf" \
|
||||
"$systemdsystemunitdir"/systemd-repart.service \
|
||||
"$systemdsystemunitdir"/initrd-root-fs.target.wants/systemd-repart.service \
|
||||
systemd-repart
|
||||
|
||||
# Install the hosts local user configurations if enabled.
|
||||
if [[ $hostonly ]]; then
|
||||
inst_multiple -H -o \
|
||||
"/etc/repart.d/*.conf" \
|
||||
"$systemdsystemconfdir"/systemd-repart.service \
|
||||
"$systemdsystemconfdir/systemd-repart.service.d/*.conf"
|
||||
fi
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user