Compare commits
582 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
75369f8ba0 | ||
![]() |
8e2bcb4b42 | ||
![]() |
bfac40665b | ||
![]() |
6c6d805765 | ||
![]() |
44f870be42 | ||
![]() |
b37398dc1c | ||
![]() |
1b0a362d83 | ||
![]() |
bb425d20a1 | ||
![]() |
cbd69dc6ff | ||
![]() |
cb8def95c4 | ||
![]() |
78d1d4f86d | ||
![]() |
5bfa3b363a | ||
![]() |
1d4b337543 | ||
![]() |
8c67d395d4 | ||
![]() |
02566acdd7 | ||
![]() |
478aa7dac1 | ||
![]() |
967db70090 | ||
![]() |
619c1bb334 | ||
![]() |
57aa1e9140 | ||
![]() |
af2fcbafe8 | ||
![]() |
7b6bdc3f94 | ||
![]() |
db43f56d94 | ||
![]() |
a1ebd77179 | ||
![]() |
e26d76dca1 | ||
![]() |
d59732004d | ||
![]() |
a3a8f58d73 | ||
![]() |
c9e5b75308 | ||
![]() |
fd191a7b41 | ||
![]() |
e42c7a980c | ||
![]() |
85804a9197 | ||
![]() |
ee2321c91e | ||
![]() |
11fbde4454 | ||
![]() |
fb05f9876a | ||
![]() |
7e9bfdde14 | ||
![]() |
7e9fc37db8 | ||
![]() |
bb278147cf | ||
![]() |
81b676a675 | ||
![]() |
6b46e7baa0 | ||
![]() |
85c85f07e2 | ||
![]() |
c853dc72e9 | ||
![]() |
18d0c9b858 | ||
![]() |
0a5fd0dcec | ||
![]() |
e0e99c59a5 | ||
![]() |
d46394ad33 | ||
![]() |
87dc81a1f6 | ||
![]() |
ce92ca0527 | ||
![]() |
c390590fac | ||
![]() |
fd8e4aef90 | ||
![]() |
c5a742a3bf | ||
![]() |
fc4e10a859 | ||
![]() |
83bb0893ed | ||
![]() |
8fdcc1a9b1 | ||
![]() |
a23b368c92 | ||
![]() |
bbfff3e58b | ||
![]() |
9c322b2f3b | ||
![]() |
dff9a66c44 | ||
![]() |
449b0e0707 | ||
![]() |
4a5a9c6d89 | ||
![]() |
917f3e4d25 | ||
![]() |
7d848c55a6 | ||
![]() |
7d17d6c976 | ||
![]() |
b8060ef781 | ||
![]() |
727543c1e6 | ||
![]() |
c85cda9e2f | ||
![]() |
c0c6c74d99 | ||
![]() |
d26bd6ca55 | ||
![]() |
e22eb857be | ||
![]() |
2fa6fd3aaa | ||
![]() |
dd5875499e | ||
![]() |
d351541ee6 | ||
![]() |
d928724c3c | ||
![]() |
727e68d0b5 | ||
![]() |
8d28614e4f | ||
![]() |
fba5fbbdad | ||
![]() |
d008b6b89f | ||
![]() |
aede120c92 | ||
![]() |
cc2303001e | ||
![]() |
54e7d7c32d | ||
![]() |
bcd352dfa1 | ||
![]() |
d837ac3984 | ||
![]() |
900e15da34 | ||
![]() |
19d69051a3 | ||
![]() |
31737a05e1 | ||
![]() |
1161f03777 | ||
![]() |
cf24ac8c19 | ||
![]() |
af3ef92a6b | ||
![]() |
c46cda8260 | ||
![]() |
34bd2be23f | ||
![]() |
c3dd68fcf1 | ||
![]() |
3e35441f18 | ||
![]() |
dde2db3da9 | ||
![]() |
cbc21754e5 | ||
![]() |
eb2dc8c34b | ||
![]() |
c4e098a514 | ||
![]() |
72875215a3 | ||
![]() |
335bc217b3 | ||
![]() |
510aecdbd8 | ||
![]() |
9dd9d81fc6 | ||
![]() |
a5b48ce798 | ||
![]() |
59afbd8e73 | ||
![]() |
348baca3e4 | ||
![]() |
83691c413f | ||
![]() |
ca36b9b8f8 | ||
![]() |
a9c7dc74c4 | ||
![]() |
ce862de624 | ||
![]() |
500861cd05 | ||
![]() |
44d26d9209 | ||
![]() |
35270e34d0 | ||
![]() |
fe654ff0aa | ||
![]() |
5e1e1ec060 | ||
![]() |
2673ff1932 | ||
![]() |
e8f7ea6794 | ||
![]() |
3899211bfc | ||
![]() |
6e0c1c448d | ||
![]() |
6ae68b4674 | ||
![]() |
41eba87b32 | ||
![]() |
a1084c02fd | ||
![]() |
5ac8420abc | ||
![]() |
24d009507f | ||
![]() |
e9020221a7 | ||
![]() |
b59e9e5724 | ||
![]() |
b5859d6359 | ||
![]() |
dbfaae0e34 | ||
![]() |
8d85429a44 | ||
![]() |
3e4ab73cd4 | ||
![]() |
4e32b2e916 | ||
![]() |
356333b331 | ||
![]() |
f62f3a2191 | ||
![]() |
389333396a | ||
![]() |
cfb7410cd0 | ||
![]() |
f672b1c399 | ||
![]() |
f12f694355 | ||
![]() |
9a9c6e1256 | ||
![]() |
9c65c125a9 | ||
![]() |
7d4d3f8da6 | ||
![]() |
569ffe77bf | ||
![]() |
a42b2b8133 | ||
![]() |
31ba4de21d | ||
![]() |
a005c47763 | ||
![]() |
5db6ca5a4b | ||
![]() |
1a6fdf2417 | ||
![]() |
27a2c3a406 | ||
![]() |
b347edfa23 | ||
![]() |
3ed09d970e | ||
![]() |
a28e2aeefe | ||
![]() |
c6a71c7b8a | ||
![]() |
6ecb9a2d68 | ||
![]() |
918a6874df | ||
![]() |
2663232a01 | ||
![]() |
cebab07e68 | ||
![]() |
a04f3077cd | ||
![]() |
04b873598b | ||
![]() |
22137f9cac | ||
![]() |
54665349ec | ||
![]() |
f251a89772 | ||
![]() |
fbdfa57746 | ||
![]() |
6b095274fb | ||
![]() |
11174408e8 | ||
![]() |
c2117747fd | ||
![]() |
4f6e293308 | ||
![]() |
d9076cac19 | ||
![]() |
ff52ca1b57 | ||
![]() |
8a3c4957fc | ||
![]() |
3f54a83ca8 | ||
![]() |
7fa3b9e376 | ||
![]() |
39135af155 | ||
![]() |
02640e8e65 | ||
![]() |
579f385384 | ||
![]() |
56d60c4b2d | ||
![]() |
62fd2b3644 | ||
![]() |
cd9072d342 | ||
![]() |
19bab59c48 | ||
![]() |
d8b627b9dc | ||
![]() |
6320d072a1 | ||
![]() |
7abeb49878 | ||
![]() |
14fcfbec3e | ||
![]() |
fa9f15e3be | ||
![]() |
ae4758ce0d | ||
![]() |
66f01450a8 | ||
![]() |
e5786ed1b7 | ||
![]() |
b47517140b | ||
![]() |
3de6001e1e | ||
![]() |
c8d685c9d3 | ||
![]() |
d6d3173916 | ||
![]() |
8b6bf0ef57 | ||
![]() |
7bd8f23303 | ||
![]() |
a08ea34aba | ||
![]() |
6cb77ea91f | ||
![]() |
c586b033a7 | ||
![]() |
a9f634f815 | ||
![]() |
551c2dd71f | ||
![]() |
ffc4f173b6 | ||
![]() |
ebd1d65a1b | ||
![]() |
5b68300899 | ||
![]() |
2b6dd6a1fc | ||
![]() |
1d22c670b0 | ||
![]() |
0ae480dcbf | ||
![]() |
256cba18c3 | ||
![]() |
e6fcec9173 | ||
![]() |
1db3d2615d | ||
![]() |
5204d1d36d | ||
![]() |
3fa59d171d | ||
![]() |
d7264a3cc0 | ||
![]() |
9078167927 | ||
![]() |
3bd7fba7af | ||
![]() |
b455451f49 | ||
![]() |
efa5eb424d | ||
![]() |
3baa150bd4 | ||
![]() |
43cc4d84bc | ||
![]() |
6b84015e67 | ||
![]() |
60bbb8fcc9 | ||
![]() |
16c84f2873 | ||
![]() |
579238a3ac | ||
![]() |
2b5cd3dbf8 | ||
![]() |
3d8a164d0e | ||
![]() |
00ae54f00a | ||
![]() |
488d55c546 | ||
![]() |
9d6165f235 | ||
![]() |
2258f00e91 | ||
![]() |
2bac2d6d76 | ||
![]() |
b6b895bab5 | ||
![]() |
fdeae2a3ac | ||
![]() |
040f388331 | ||
![]() |
7990578443 | ||
![]() |
528ae4f46c | ||
![]() |
0fb7b847c5 | ||
![]() |
a67a6f957d | ||
![]() |
965edeb63b | ||
![]() |
329bbd797f | ||
![]() |
065fc56ab2 | ||
![]() |
64d144aece | ||
![]() |
2d9b156e9e | ||
![]() |
2b9be6f707 | ||
![]() |
b26897fb60 | ||
![]() |
8bf25df640 | ||
![]() |
e743cfdd4b | ||
![]() |
636e5cd2d5 | ||
![]() |
f046336c44 | ||
![]() |
665b7e58ba | ||
![]() |
1391a06d80 | ||
![]() |
404815eaf0 | ||
![]() |
6c128565b1 | ||
![]() |
e1cb85802b | ||
![]() |
cbd60fcaaf | ||
![]() |
28a88b6886 | ||
![]() |
7081e99735 | ||
![]() |
dc67eda6bf | ||
![]() |
b85f723535 | ||
![]() |
9ff9dde8d7 | ||
![]() |
8714280104 | ||
![]() |
6d70aa7836 | ||
![]() |
14986b9d58 | ||
![]() |
e5c9bc1198 | ||
![]() |
fc9bc6f8db | ||
![]() |
c62b94614d | ||
![]() |
833685ded5 | ||
![]() |
3cff5fb56f | ||
![]() |
3e6dad37c4 | ||
![]() |
600c876968 | ||
![]() |
cc68f78d92 | ||
![]() |
48ca487621 | ||
![]() |
13cb578a37 | ||
![]() |
df2afa9ff4 | ||
![]() |
76d5c79e9c | ||
![]() |
fdf2b152e5 | ||
![]() |
178c189b0b | ||
![]() |
14be3b16cd | ||
![]() |
2e111dd57a | ||
![]() |
06e9f8870a | ||
![]() |
7e0d508002 | ||
![]() |
585b3b37c0 | ||
![]() |
167a320e5f | ||
![]() |
2242cd92ee | ||
![]() |
d20fb951fa | ||
![]() |
e0a393361d | ||
![]() |
da9c518116 | ||
![]() |
4d51eff05f | ||
![]() |
a6c718ce8e | ||
![]() |
43a050e542 | ||
![]() |
25787f8071 | ||
![]() |
ecfa02bdc8 | ||
![]() |
080d1b718d | ||
![]() |
8ea8d6de80 | ||
![]() |
4dbc1d1bb3 | ||
![]() |
3b9669cff4 | ||
![]() |
a6332e6980 | ||
![]() |
9037b63eb2 | ||
![]() |
308015bc4d | ||
![]() |
2692a42231 | ||
![]() |
e064127729 | ||
![]() |
103281f3b6 | ||
![]() |
69ba546721 | ||
![]() |
d65638dacb | ||
![]() |
a0be1eddcf | ||
![]() |
e1b48995c2 | ||
![]() |
194e074764 | ||
![]() |
7f1d77d9fb | ||
![]() |
3722020071 | ||
![]() |
f7235c223d | ||
![]() |
868eba13f2 | ||
![]() |
2cae00be9e | ||
![]() |
69eba8c40a | ||
![]() |
17b01c5b13 | ||
![]() |
a0508937fc | ||
![]() |
bc07024624 | ||
![]() |
907f75447b | ||
![]() |
500d8e6002 | ||
![]() |
3d12d7a2cc | ||
![]() |
886b9afcc5 | ||
![]() |
f3f9777497 | ||
![]() |
5596b70bd0 | ||
![]() |
4211605000 | ||
![]() |
aa09b74a41 | ||
![]() |
d9a7ea5b43 | ||
![]() |
914f531f39 | ||
![]() |
0fc0dcff60 | ||
![]() |
0e32ce3219 | ||
![]() |
ff0636635a | ||
![]() |
ba111df2b9 | ||
![]() |
dff1671f8f | ||
![]() |
44f77ac1b0 | ||
![]() |
641a8558f4 | ||
![]() |
3bff70ef15 | ||
![]() |
d672bf167c | ||
![]() |
ea62729238 | ||
![]() |
32ec0a762d | ||
![]() |
ca121b1a5c | ||
![]() |
0db77f5a2b | ||
![]() |
cc4037d120 | ||
![]() |
a999414eaf | ||
![]() |
00083a0909 | ||
![]() |
8a7f561ee5 | ||
![]() |
32b2fb8a27 | ||
![]() |
104727ad6e | ||
![]() |
cce471c9ce | ||
![]() |
353e7a7ec3 | ||
![]() |
73088e46f7 | ||
![]() |
52f1b04183 | ||
![]() |
83e0dc7a3d | ||
![]() |
c4bb88715c | ||
![]() |
54c7ace145 | ||
![]() |
c1b8934faa | ||
![]() |
5746f04994 | ||
![]() |
f9452c94c0 | ||
![]() |
68c49db952 | ||
![]() |
f9c7788ba5 | ||
![]() |
68318328f1 | ||
![]() |
c9a9968dfc | ||
![]() |
48dba7f9ac | ||
![]() |
bdf1f472b4 | ||
![]() |
e4297a66b1 | ||
![]() |
ec6d8eab69 | ||
![]() |
dece5ee1f5 | ||
![]() |
a41dc8f969 | ||
![]() |
aa11b710ce | ||
![]() |
6af5a4accf | ||
![]() |
ec8974914f | ||
![]() |
b9775297cd | ||
![]() |
4a6b33f1ee | ||
![]() |
7dd7ff0f33 | ||
![]() |
126732bcc1 | ||
![]() |
23d6dcd125 | ||
![]() |
9fd9e96130 | ||
![]() |
f0a7fc5b43 | ||
![]() |
d82e0d7dd8 | ||
![]() |
5545fc3046 | ||
![]() |
a638056838 | ||
![]() |
1f524c4544 | ||
![]() |
47b8f66ced | ||
![]() |
52da8a514a | ||
![]() |
5cd7c104bd | ||
![]() |
173edca09e | ||
![]() |
506b219237 | ||
![]() |
6c83d7d5bf | ||
![]() |
a059f72b09 | ||
![]() |
afcebd136f | ||
![]() |
3d3c192621 | ||
![]() |
92b3ee855f | ||
![]() |
650ab3b077 | ||
![]() |
474cca1e9d | ||
![]() |
c0cae7f702 | ||
![]() |
3f7e5358e5 | ||
![]() |
3d352f5228 | ||
![]() |
540eca9d9d | ||
![]() |
19cd47fd26 | ||
![]() |
cf62cc435f | ||
![]() |
8b6bdafc39 | ||
![]() |
27790828d1 | ||
![]() |
d782ffb822 | ||
![]() |
5a84ac3fe3 | ||
![]() |
343b7d7488 | ||
![]() |
aefea76cf8 | ||
![]() |
4976edb1a6 | ||
![]() |
171ba532bc | ||
![]() |
bfd2e8c25f | ||
![]() |
b2d225a669 | ||
![]() |
a5f01bbfb5 | ||
![]() |
7e2285a48a | ||
![]() |
3e964eeb96 | ||
![]() |
aec9f902f0 | ||
![]() |
764eb40cc9 | ||
![]() |
95a5b23a38 | ||
![]() |
5d833a9f5b | ||
![]() |
3e51b2f6fc | ||
![]() |
852105dc44 | ||
![]() |
a7473ef379 | ||
![]() |
f7f3792390 | ||
![]() |
2d674a9336 | ||
![]() |
24a38bc1cb | ||
![]() |
82b1739dce | ||
![]() |
fc6b272f41 | ||
![]() |
c9baff669d | ||
![]() |
72ee74b9be | ||
![]() |
cc21808764 | ||
![]() |
78021eace1 | ||
![]() |
65d1a8a4ae | ||
![]() |
187a8e08d5 | ||
![]() |
c9a81c1f91 | ||
![]() |
d580636e97 | ||
![]() |
6ca264a151 | ||
![]() |
aa505d588f | ||
![]() |
96c6fa9202 | ||
![]() |
25706eafac | ||
![]() |
8aa9926839 | ||
![]() |
ff3953efe1 | ||
![]() |
ec5e5ae27a | ||
![]() |
3cc4c8ba9b | ||
![]() |
81672479af | ||
![]() |
6a5170a15f | ||
![]() |
1f4aaaeb5e | ||
![]() |
79148c2945 | ||
![]() |
5767201eaf | ||
![]() |
221c342d50 | ||
![]() |
b56e174322 | ||
![]() |
5afa957915 | ||
![]() |
af3b67b213 | ||
![]() |
93d7b823b4 | ||
![]() |
4a1255bc38 | ||
![]() |
15976a0670 | ||
![]() |
24ba78cb77 | ||
![]() |
15f0b1f624 | ||
![]() |
823311ea3b | ||
![]() |
f67a1f7f64 | ||
![]() |
e625eea4f9 | ||
![]() |
f6297ebe73 | ||
![]() |
372c9b9647 | ||
![]() |
63c65b984a | ||
![]() |
06c6ea654f | ||
![]() |
ab8bfca794 | ||
![]() |
386579a45a | ||
![]() |
f1040fc470 | ||
![]() |
585fd00624 | ||
![]() |
e045e1f386 | ||
![]() |
bf7883ebca | ||
![]() |
a844fb1552 | ||
![]() |
35022f987c | ||
![]() |
8a240aca9e | ||
![]() |
68e7661ca7 | ||
![]() |
e88e3b2797 | ||
![]() |
df68781fca | ||
![]() |
f855f9daaf | ||
![]() |
c5758f2090 | ||
![]() |
3e9b4330a9 | ||
![]() |
c072e13162 | ||
![]() |
f2271428d4 | ||
![]() |
cef379bb03 | ||
![]() |
3e624cd9dc | ||
![]() |
5297d4f5b2 | ||
![]() |
b7c8f59fef | ||
![]() |
13f77e9fd5 | ||
![]() |
472189da15 | ||
![]() |
e5ec81a354 | ||
![]() |
4c3be42cdf | ||
![]() |
24450a5ab7 | ||
![]() |
df7be11b38 | ||
![]() |
52f74c8010 | ||
![]() |
ddf818dad5 | ||
![]() |
e65caf3696 | ||
![]() |
a0af318a8d | ||
![]() |
c008b0ce10 | ||
![]() |
258de82819 | ||
![]() |
c243105e6b | ||
![]() |
3bb4700f98 | ||
![]() |
6bd4ca5644 | ||
![]() |
a01cf5d782 | ||
![]() |
7292a59593 | ||
![]() |
765d8408e9 | ||
![]() |
6da9cb4ba7 | ||
![]() |
3780d7e449 | ||
![]() |
a43f97c4e3 | ||
![]() |
4ee59ab3ed | ||
![]() |
0f283709c9 | ||
![]() |
7a1f355fb5 | ||
![]() |
030ade7590 | ||
![]() |
1ddc789f5a | ||
![]() |
3d115217e4 | ||
![]() |
f31049c17f | ||
![]() |
e6bec9b793 | ||
![]() |
982032fd26 | ||
![]() |
2499c305f9 | ||
![]() |
f6c2faebfa | ||
![]() |
98eb6d57df | ||
![]() |
f60cd2593f | ||
![]() |
2723ebba9a | ||
![]() |
badda27f61 | ||
![]() |
0d57270395 | ||
![]() |
3e1d48fd12 | ||
![]() |
83a420674b | ||
![]() |
9f5c98a76a | ||
![]() |
fc5b6b0328 | ||
![]() |
4dda0095a1 | ||
![]() |
bef2fd9722 | ||
![]() |
ad401d1eaf | ||
![]() |
a92311074b | ||
![]() |
9ede75b1ce | ||
![]() |
fe5f8d0074 | ||
![]() |
0028ffac74 | ||
![]() |
792b189317 | ||
![]() |
43bac63e33 | ||
![]() |
450b5f336d | ||
![]() |
4eafdbdbe8 | ||
![]() |
27fa604418 | ||
![]() |
3c1feedfd1 | ||
![]() |
2023d8eb5b | ||
![]() |
a17fc9902e | ||
![]() |
d6e8280cd8 | ||
![]() |
cbefa47006 | ||
![]() |
b4e20a898e | ||
![]() |
6795dcc4fc | ||
![]() |
fbf658fece | ||
![]() |
593b315c70 | ||
![]() |
56ed92922e | ||
![]() |
9954876417 | ||
![]() |
d96c3254e8 | ||
![]() |
e1619ee151 | ||
![]() |
e09048aaf5 | ||
![]() |
a421016671 | ||
![]() |
f1e7add2bf | ||
![]() |
528864e460 | ||
![]() |
1760dfc051 | ||
![]() |
5d0404e3b3 | ||
![]() |
18595cede8 | ||
![]() |
e5efb6a798 | ||
![]() |
f1e9f613d9 | ||
![]() |
e7dc1e42cd | ||
![]() |
d04f16f600 | ||
![]() |
338b43cd6a | ||
![]() |
394ffc1d97 | ||
![]() |
0251fcd400 | ||
![]() |
eaf4cb6bbb | ||
![]() |
a85ee030ab | ||
![]() |
d8caa679e0 | ||
![]() |
f7bccf3724 | ||
![]() |
38bbec3731 | ||
![]() |
a128f03b30 | ||
![]() |
f0e10d9351 | ||
![]() |
ffa71b4afa | ||
![]() |
9f355169f4 | ||
![]() |
0e14946a20 | ||
![]() |
c204501e3e | ||
![]() |
194b80f974 | ||
![]() |
ec61f0a3af | ||
![]() |
f225f180e3 | ||
![]() |
e74944eee5 | ||
![]() |
eaa924b69e | ||
![]() |
1d59e3e592 | ||
![]() |
5113a3efff | ||
![]() |
1594d0bf9c | ||
![]() |
47057875e7 | ||
![]() |
ef9b54cfe6 | ||
![]() |
04d18f5587 | ||
![]() |
73575f11a9 | ||
![]() |
998bf6e088 | ||
![]() |
34e43ceb0d | ||
![]() |
7209df9e91 | ||
![]() |
0e95d84892 | ||
![]() |
965c2d8760 | ||
![]() |
9fb01d49d6 | ||
![]() |
e42b6f9e15 | ||
![]() |
2ee48b4b4b | ||
![]() |
f4031e8a9a | ||
![]() |
85854b245e |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
/Makefile.inc
|
||||
/dracut.8
|
||||
/dracut-catimages.8
|
||||
/dracut.conf.5
|
||||
@@ -11,3 +12,4 @@ test*.img
|
||||
/.buildpath
|
||||
/.project
|
||||
/dracut-version.sh
|
||||
/install/dracut-install
|
||||
|
33
50-dracut.install
Executable file
33
50-dracut.install
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if [[ -f /etc/kernel/cmdline ]]; then
|
||||
readarray -t BOOT_OPTIONS < /etc/kernel/cmdline
|
||||
fi
|
||||
|
||||
if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
|
||||
readarray -t BOOT_OPTIONS < /proc/cmdline
|
||||
fi
|
||||
|
||||
unset noimageifnotneeded
|
||||
|
||||
for ((i=0; i < "${#BOOT_OPTIONS[@]}"; i++)); do
|
||||
if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then
|
||||
noimageifnotneeded="yes"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
ret=0
|
||||
case "$1" in
|
||||
add)
|
||||
dracut ${noimageifnotneeded+--noimageifnotneeded} "$3"/initrd "$2"
|
||||
ret=$?
|
||||
;;
|
||||
remove)
|
||||
rm -f "$3"/initrd
|
||||
ret=$?
|
||||
;;
|
||||
esac
|
||||
exit $ret
|
70
51-dracut-rescue-postinst.sh
Executable file
70
51-dracut-rescue-postinst.sh
Executable file
@@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
export LANG=C
|
||||
|
||||
KERNEL_VERSION="$1"
|
||||
KERNEL_IMAGE="$2"
|
||||
|
||||
[[ -f /etc/os-release ]] && . /etc/os-release
|
||||
|
||||
if [[ ! -f /etc/machine-id ]] || [[ ! -s /etc/machine-id ]]; then
|
||||
systemd-machine-id-setup
|
||||
fi
|
||||
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
[[ $MACHINE_ID ]] || exit 1
|
||||
[[ -f $KERNEL_IMAGE ]] || exit 1
|
||||
|
||||
INITRDFILE="/boot/initramfs-0-rescue-${MACHINE_ID}.img"
|
||||
NEW_KERNEL_IMAGE="${KERNEL_IMAGE%/*}/vmlinuz-0-rescue-${MACHINE_ID}"
|
||||
|
||||
[[ -f $INITRDFILE ]] && [[ -f $NEW_KERNEL_IMAGE ]] && exit 0
|
||||
|
||||
dropindirs_sort()
|
||||
{
|
||||
suffix=$1; shift
|
||||
args=("$@")
|
||||
files=$(
|
||||
while (( $# > 0 )); do
|
||||
for i in ${1}/*${suffix}; do
|
||||
[[ -f $i ]] && echo ${i##*/}
|
||||
done
|
||||
shift
|
||||
done | sort -Vu
|
||||
)
|
||||
|
||||
for f in $files; do
|
||||
for d in "${args[@]}"; do
|
||||
if [[ -f "$d/$f" ]]; then
|
||||
echo "$d/$f"
|
||||
continue 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
# source our config dir
|
||||
for f in $(dropindirs_sort ".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d"); do
|
||||
[[ -e $f ]] && . "$f"
|
||||
done
|
||||
|
||||
[[ $dracut_rescue_image != "yes" ]] && exit 0
|
||||
|
||||
if [[ ! -f $INITRDFILE ]]; then
|
||||
dracut --no-hostonly -a "rescue" "$INITRDFILE" "$KERNEL_VERSION"
|
||||
((ret+=$?))
|
||||
fi
|
||||
|
||||
if [[ ! -f $NEW_KERNEL_IMAGE ]]; then
|
||||
cp "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE"
|
||||
((ret+=$?))
|
||||
fi
|
||||
|
||||
new-kernel-pkg --install "$KERNEL_VERSION" --kernel-image "$NEW_KERNEL_IMAGE" --initrdfile "$INITRDFILE" --banner "$NAME $VERSION_ID Rescue $MACHINE_ID"
|
||||
|
||||
((ret+=$?))
|
||||
|
||||
exit $ret
|
101
51-dracut-rescue.install
Executable file
101
51-dracut-rescue.install
Executable file
@@ -0,0 +1,101 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
export LANG=C
|
||||
|
||||
COMMAND="$1"
|
||||
KERNEL_VERSION="$2"
|
||||
|
||||
dropindirs_sort()
|
||||
{
|
||||
suffix=$1; shift
|
||||
args=("$@")
|
||||
files=$(
|
||||
while (( $# > 0 )); do
|
||||
for i in ${1}/*${suffix}; do
|
||||
[[ -f $i ]] && echo ${i##*/}
|
||||
done
|
||||
shift
|
||||
done | sort -Vu
|
||||
)
|
||||
|
||||
for f in $files; do
|
||||
for d in "${args[@]}"; do
|
||||
if [[ -f "$d/$f" ]]; then
|
||||
echo "$d/$f"
|
||||
continue 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
[[ -f /etc/os-release ]] && . /etc/os-release
|
||||
|
||||
if [[ ! -f /etc/machine-id ]] || [[ ! -s /etc/machine-id ]]; then
|
||||
systemd-machine-id-setup
|
||||
fi
|
||||
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
if [[ -f /etc/kernel/cmdline ]]; then
|
||||
readarray -t BOOT_OPTIONS < /etc/kernel/cmdline
|
||||
fi
|
||||
if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
|
||||
readarray -t BOOT_OPTIONS < /proc/cmdline
|
||||
fi
|
||||
if ! [[ $BOOT_OPTIONS ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOADER_ENTRY="/boot/loader/entries/${MACHINE_ID}-0-rescue.conf"
|
||||
BOOT_DIR="/${MACHINE_ID}/0-rescue"
|
||||
BOOT_DIR_ABS="/boot${BOOT_DIR}"
|
||||
|
||||
ret=0
|
||||
|
||||
case "$COMMAND" in
|
||||
add)
|
||||
for i in "/boot/loader/entries/${MACHINE_ID}-0-rescue.conf"; do
|
||||
[[ -f $i ]] && exit 0
|
||||
done
|
||||
|
||||
# source our config dir
|
||||
for f in $(dropindirs_sort ".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d"); do
|
||||
[[ -e $f ]] && . "$f"
|
||||
done
|
||||
|
||||
[[ $dracut_rescue_image != "yes" ]] && exit 0
|
||||
|
||||
[[ -d "$BOOT_DIR_ABS" ]] || mkdir -p "$BOOT_DIR_ABS"
|
||||
|
||||
if ! cp "$KERNEL_IMAGE" "$BOOT_DIR_ABS"/linux; then
|
||||
echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/linux'!" >&2
|
||||
fi
|
||||
|
||||
dracut --no-hostonly -a "rescue" "$BOOT_DIR_ABS"/initrd "$2"
|
||||
((ret+=$?))
|
||||
|
||||
{
|
||||
echo "title $PRETTY_NAME - Rescue Image"
|
||||
echo "version $KERNEL_VERSION"
|
||||
echo "machine-id $MACHINE_ID"
|
||||
echo "options ${BOOT_OPTIONS[@]} rd.auto=1"
|
||||
echo "linux $BOOT_DIR/linux"
|
||||
echo "initrd $BOOT_DIR/initrd"
|
||||
} > $LOADER_ENTRY
|
||||
((ret+=$?))
|
||||
;;
|
||||
|
||||
remove)
|
||||
exit 0
|
||||
;;
|
||||
|
||||
*)
|
||||
usage
|
||||
ret=1;;
|
||||
esac
|
||||
|
||||
((ret+=$?))
|
||||
|
||||
exit $ret
|
38
AUTHORS
38
AUTHORS
@@ -1,67 +1,87 @@
|
||||
Harald Hoyer <harald@redhat.com>
|
||||
Victor Lowther <victor.lowther@gmail.com>
|
||||
Amadeusz Żołnowski <aidecoe@aidecoe.name>
|
||||
Philippe Seewer <philippe.seewer@bfh.ch>
|
||||
Warren Togami <wtogami@redhat.com>
|
||||
Amadeusz Żołnowski <aidecoe@aidecoe.name>
|
||||
Will Woods <wwoods@redhat.com>
|
||||
Jeremy Katz <katzj@redhat.com>
|
||||
David Dillow <dave@thedillows.org>
|
||||
Will Woods <wwoods@redhat.com>
|
||||
Michal Soltys <soltys@ziu.info>
|
||||
Dave Young <dyoung@redhat.com>
|
||||
Amerigo Wang <amwang@redhat.com>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Dave Young <dyoung@redhat.com>
|
||||
Colin Guthrie <colin@mageia.org>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Andreas Thienemann <andreas@bawue.net>
|
||||
Hans de Goede <hdegoede@redhat.com>
|
||||
Peter Jones <pjones@redhat.com>
|
||||
John Reiser <jreiser@bitwagon.com>
|
||||
Luca Berra <bluca@vodka.it>
|
||||
Daniel Drake <dsd@laptop.org>
|
||||
Leho Kraav <leho@kraav.com>
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
Marc Grimme <grimme@atix.de>
|
||||
Chao Wang <chaowang@redhat.com>
|
||||
Dan Horák <dhorak@redhat.com>
|
||||
Jesse Keating <jkeating@redhat.com>
|
||||
Milan Broz <mbroz@redhat.com>
|
||||
Roberto Sassu <roberto.sassu@polito.it>
|
||||
dyoung@redhat.com <dyoung@redhat.com>
|
||||
Anton Blanchard <anton@samba.org>
|
||||
Bill Nottingham <notting@redhat.com>
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
David Cantrell <dcantrell@redhat.com>
|
||||
Frederic Crozat <fcrozat@suse.com>
|
||||
Jon Ander Hernandez <jonan.h@gmail.com>
|
||||
Juan RP <xtraeme@gmail.com>
|
||||
Lance Albertson <lance@osuosl.org>
|
||||
Marian Ganisin <mganisin@redhat.com>
|
||||
Michael Ploujnikov <plouj@somanetworks.com>
|
||||
Peter Rajnoha <prajnoha@redhat.com>
|
||||
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
||||
Alan Pevec <apevec@redhat.com>
|
||||
Colin Walters <walters@verbum.org>
|
||||
Dennis Gilmore <dennis@ausil.us>
|
||||
Ian Dall <ian@beware.dropbear.id.au>
|
||||
James Buren <ryuo@frugalware.org>
|
||||
Joey Boggs <jboggs@redhat.com>
|
||||
Jon Ander Hernandez <jonan.h@gmail.com>
|
||||
Mike Snitzer <snitzer@redhat.com>
|
||||
Peter Rajnoha <prajnoha@redhat.com>
|
||||
Przemysław Rudy <prudy1@o2.pl>
|
||||
Thomas Lange <lange@informatik.uni-koeln.de>
|
||||
Vivek Goyal <vgoyal@redhat.com>
|
||||
Vladislav Bogdanov <bubble@hoster-ok.com>
|
||||
Wim Muskee <wimmuskee@gmail.com>
|
||||
Alexander Todorov <atodorov@redhat.com>
|
||||
Andy Lutomirski <luto@mit.edu>
|
||||
Anssi Hannula <anssi@mageia.org>
|
||||
Canek Peláez Valdés <caneko@gmail.com>
|
||||
Chris Leech <cleech@redhat.com>
|
||||
Christian Heinz <christian.ch.heinz@gmail.com>
|
||||
Dave Jones <davej@redhat.com>
|
||||
Duane Griffin <duaneg@dghda.com>
|
||||
Frederic Crozat <fcrozat@mandriva.com>
|
||||
Frederick Grose <fgrose@gmail.com>
|
||||
Glen Gray <slaine@slaine.org>
|
||||
Hermann Gausterer <git-dracut-2012@mrq1.org>
|
||||
James Laska <jlaska@redhat.com>
|
||||
Jan Stodola <jstodola@redhat.com>
|
||||
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Leho Kraav <leho@kraav.com>
|
||||
Lennert Buytenhek <buytenh@wantstofly.org>
|
||||
Lubomir Rintel <lkundrak@v3.sk>
|
||||
Matt <smoothsailing72@hotmail.com>
|
||||
Matt Smith <shadowfax@gmx.com>
|
||||
Michal Schmidt <mschmidt@redhat.com>
|
||||
Mike Gorse <mgorse@suse.com>
|
||||
Munehiro Matsuda <haro@kgt.co.jp>
|
||||
Nikoli <nikoli@lavabit.com>
|
||||
Olivier Blin <dev@blino.org>
|
||||
Paolo Bonzini <pbonzini@redhat.com>
|
||||
Peter Robinson <pbrobinson@fedoraproject.org>
|
||||
Pádraig Brady <P@draigBrady.com>
|
||||
Quentin Armitage <quentin@armitage.org.uk>
|
||||
Radek Vykydal <rvykydal@redhat.com>
|
||||
Sergey Fionov <fionov@gmail.com>
|
||||
Srinivasa T N <seenutn@linux.vnet.ibm.com>
|
||||
Stefan Reimer <it@startux.de>
|
||||
Thilo Bangert <thilo.bangert@gmx.net>
|
||||
Thomas Lange <lange@informatik.uni-koeln.de>
|
||||
Tomasz Torcz <tomek@pipebreaker.pl>
|
||||
Vadim Kuznetsov <vadimk@gentoo.org>
|
||||
Ville Skyttä <ville.skytta@iki.fi>
|
||||
|
42
COPYING
42
COPYING
@@ -1,12 +1,12 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
@@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
@@ -225,7 +225,7 @@ impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
@@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
@@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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
|
||||
@@ -303,16 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||
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, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
@@ -335,5 +335,5 @@ necessary. Here is a sample; alter the names:
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
|
128
Makefile
128
Makefile
@@ -1,6 +1,8 @@
|
||||
VERSION=020
|
||||
VERSION=027
|
||||
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
|
||||
|
||||
-include Makefile.inc
|
||||
|
||||
prefix ?= /usr
|
||||
libdir ?= ${prefix}/lib
|
||||
datadir ?= ${prefix}/share
|
||||
@@ -8,18 +10,63 @@ pkglibdir ?= ${libdir}/dracut
|
||||
sysconfdir ?= ${prefix}/etc
|
||||
bindir ?= ${prefix}/bin
|
||||
mandir ?= ${prefix}/share/man
|
||||
CFLAGS ?= -O2 -g -Wall
|
||||
CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64
|
||||
bashcompletiondir ?= ${datadir}/bash-completion/completions
|
||||
|
||||
man1pages = lsinitrd.1
|
||||
|
||||
man5pages = dracut.conf.5
|
||||
|
||||
man7pages = dracut.cmdline.7 \
|
||||
dracut.bootup.7
|
||||
|
||||
man8pages = dracut.8 \
|
||||
dracut-catimages.8 \
|
||||
mkinitrd.8 \
|
||||
modules.d/98systemd/dracut-cmdline.service.8 \
|
||||
modules.d/98systemd/dracut-initqueue.service.8 \
|
||||
modules.d/98systemd/dracut-mount.service.8 \
|
||||
modules.d/98systemd/dracut-pre-mount.service.8 \
|
||||
modules.d/98systemd/dracut-pre-pivot.service.8 \
|
||||
modules.d/98systemd/dracut-pre-trigger.service.8 \
|
||||
modules.d/98systemd/dracut-pre-udev.service.8
|
||||
|
||||
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
|
||||
|
||||
manpages = dracut.8 dracut.cmdline.7 dracut.conf.5 dracut-catimages.8
|
||||
|
||||
.PHONY: install clean archive rpm testimage test all check AUTHORS doc
|
||||
|
||||
all: syncheck dracut-version.sh install/dracut-install
|
||||
all: syncheck dracut-version.sh dracut-install
|
||||
|
||||
install/dracut-install:
|
||||
$(MAKE) -C install dracut-install
|
||||
DRACUT_INSTALL_OBJECTS = \
|
||||
install/dracut-install.o \
|
||||
install/hashmap.o\
|
||||
install/log.o \
|
||||
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/dracut-install: $(DRACUT_INSTALL_OBJECTS)
|
||||
|
||||
dracut-install: install/dracut-install
|
||||
ln -fs $< $@
|
||||
|
||||
indent:
|
||||
indent -i8 -nut -br -linux -l120 install/dracut-install.c
|
||||
|
||||
doc: $(manpages) dracut.html
|
||||
|
||||
ifneq ($(enable_documentation),no)
|
||||
all: doc
|
||||
endif
|
||||
|
||||
%: %.xml
|
||||
xsltproc -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
|
||||
|
||||
@@ -29,52 +76,66 @@ doc: $(manpages) dracut.html
|
||||
dracut.html: dracut.asc $(manpages)
|
||||
asciidoc -a numbered -d book -b docbook -o dracut.xml dracut.asc
|
||||
xsltproc -o dracut.html --xinclude -nonet \
|
||||
--stringparam draft.mode yes \
|
||||
--stringparam html.stylesheet \
|
||||
http://docs.redhat.com/docs/en-US/Common_Content/css/default.css \
|
||||
http://docs.fedoraproject.org/en-US/Common_Content/css/default.css \
|
||||
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
|
||||
rm dracut.xml
|
||||
|
||||
install: doc dracut-version.sh
|
||||
install: dracut-version.sh
|
||||
mkdir -p $(DESTDIR)$(pkglibdir)
|
||||
mkdir -p $(DESTDIR)$(bindir)
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)
|
||||
mkdir -p $(DESTDIR)$(pkglibdir)/modules.d
|
||||
mkdir -p $(DESTDIR)$(mandir)/man5 $(DESTDIR)$(mandir)/man7 $(DESTDIR)$(mandir)/man8
|
||||
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
|
||||
mkdir -p $(DESTDIR)$(pkglibdir)/dracut.conf.d
|
||||
install -m 0755 dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions.sh
|
||||
install -m 0755 dracut-version.sh $(DESTDIR)$(pkglibdir)/dracut-version.sh
|
||||
ln -s dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions
|
||||
ln -fs dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions
|
||||
install -m 0755 dracut-logger.sh $(DESTDIR)$(pkglibdir)/dracut-logger.sh
|
||||
install -m 0755 dracut-initramfs-restore.sh $(DESTDIR)$(pkglibdir)/dracut-initramfs-restore
|
||||
cp -arx modules.d $(DESTDIR)$(pkglibdir)
|
||||
install -m 0644 dracut.8 $(DESTDIR)$(mandir)/man8/dracut.8
|
||||
install -m 0644 dracut-catimages.8 $(DESTDIR)$(mandir)/man8/dracut-catimages.8
|
||||
install -m 0644 dracut.conf.5 $(DESTDIR)$(mandir)/man5/dracut.conf.5
|
||||
install -m 0644 dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.cmdline.7
|
||||
ln -s dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.kernel.7
|
||||
ifneq ($(enable_documentation),no)
|
||||
for i in $(man1pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man1/$${i##*/}; done
|
||||
for i in $(man5pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man5/$${i##*/}; done
|
||||
for i in $(man7pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man7/$${i##*/}; done
|
||||
for i in $(man8pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man8/$${i##*/}; done
|
||||
ln -fs dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.kernel.7
|
||||
endif
|
||||
if [ -n "$(systemdsystemunitdir)" ]; then \
|
||||
mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
|
||||
for i in \
|
||||
modules.d/98systemd/dracut-initqueue.service \
|
||||
modules.d/98systemd/dracut-pre-pivot.service \
|
||||
modules.d/98systemd/dracut-pre-trigger.service \
|
||||
modules.d/98systemd/dracut-pre-udev.service \
|
||||
modules.d/98systemd/initrd-switch-root.service \
|
||||
modules.d/98systemd/initrd-switch-root.target \
|
||||
dracut-shutdown.service; do \
|
||||
install -m 0644 $$i $(DESTDIR)$(systemdsystemunitdir); \
|
||||
done; \
|
||||
install -m 0644 dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir); \
|
||||
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants; \
|
||||
ln -s ../dracut-shutdown.service \
|
||||
$(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants/dracut-shutdown.service; \
|
||||
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants; \
|
||||
for i in \
|
||||
dracut-cmdline.service \
|
||||
dracut-initqueue.service \
|
||||
dracut-mount.service \
|
||||
dracut-pre-mount.service \
|
||||
dracut-pre-pivot.service \
|
||||
dracut-pre-trigger.service \
|
||||
dracut-pre-udev.service \
|
||||
; do \
|
||||
install -m 0644 modules.d/98systemd/$$i $(DESTDIR)$(systemdsystemunitdir); \
|
||||
ln -s ../$$i \
|
||||
$(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants/$i; \
|
||||
done \
|
||||
fi
|
||||
$(MAKE) -C install install
|
||||
if [ -f install/dracut-install ]; then \
|
||||
install -m 0755 install/dracut-install $(DESTDIR)$(pkglibdir)/dracut-install; \
|
||||
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
|
||||
mkdir -p $(DESTDIR)${bashcompletiondir}
|
||||
install -m 0644 dracut-bash-completion.sh $(DESTDIR)${bashcompletiondir}/dracut
|
||||
|
||||
dracut-version.sh:
|
||||
@echo "DRACUT_VERSION=$(VERSION)-$(GITVERSION)" > dracut-version.sh
|
||||
@@ -83,11 +144,12 @@ clean:
|
||||
$(RM) *~
|
||||
$(RM) */*~
|
||||
$(RM) */*/*~
|
||||
$(RM) $(manpages:%=%.xml) dracut.xml
|
||||
$(RM) test-*.img
|
||||
$(RM) dracut-*.rpm dracut-*.tar.bz2
|
||||
$(RM) dracut-install install/dracut-install $(DRACUT_INSTALL_OBJECTS)
|
||||
$(RM) $(manpages) dracut.html
|
||||
$(MAKE) -C test clean
|
||||
$(MAKE) -C install clean
|
||||
|
||||
archive: dracut-$(VERSION)-$(GITVERSION).tar.bz2
|
||||
|
||||
@@ -105,7 +167,7 @@ dracut-$(VERSION).tar.bz2: doc
|
||||
rpm: dracut-$(VERSION).tar.bz2
|
||||
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
|
||||
cp dracut-$(VERSION).tar.bz2 "$$rpmbuild"; \
|
||||
LANG=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
|
||||
LC_MESSAGES=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
|
||||
(cd "$$rpmbuild"; rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
|
||||
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
|
||||
--define "_rpmdir $$PWD" -ba dracut.spec; ) && \
|
||||
@@ -124,7 +186,8 @@ syncheck:
|
||||
done;exit $$ret
|
||||
|
||||
check: all syncheck
|
||||
$(MAKE) -C test check
|
||||
@[ "$$EUID" == "0" ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; }
|
||||
@$(MAKE) -C test check
|
||||
|
||||
testimage: all
|
||||
./dracut.sh -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
|
||||
@@ -142,3 +205,10 @@ hostimage: all
|
||||
|
||||
AUTHORS:
|
||||
git shortlog --numbered --summary -e |while read a rest; do echo $$rest;done > AUTHORS
|
||||
|
||||
dracut.html.sign: dracut-$(VERSION).tar.bz2
|
||||
gpg-sign-all dracut-$(VERSION).tar.bz2 dracut.html
|
||||
|
||||
upload: dracut.html.sign
|
||||
kup put dracut-$(VERSION).tar.bz2 dracut-$(VERSION).tar.sign /pub/linux/utils/boot/dracut/
|
||||
kup put dracut.html dracut.html.sign /pub/linux/utils/boot/dracut/
|
||||
|
128
NEWS
128
NEWS
@@ -1,3 +1,131 @@
|
||||
dracut-027
|
||||
==========
|
||||
- dracut now has bash-completion
|
||||
- require bash version 4
|
||||
- systemd module now requires systemd >= 199
|
||||
- dracut makes use of native systemd initrd units
|
||||
- added hooks for new-kernel-pkg and kernel-install
|
||||
- hostonly is now default for fedora
|
||||
- comply with the BootLoaderSpec paths
|
||||
http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec
|
||||
- added rescue module
|
||||
- host_fs_types is now a hashmap
|
||||
- new dracut argument "--regenerate-all"
|
||||
- new dracut argument "--noimageifnotneeded"
|
||||
- new man page dracut.bootup
|
||||
- install all host filesystem drivers
|
||||
- use -D_FILE_OFFSET_BITS=64 to build dracut-install
|
||||
|
||||
dracut-026
|
||||
==========
|
||||
- introduce /usr/lib/dracut/dracut.conf.d/ drop-in directory
|
||||
|
||||
/usr/lib/dracut/dracut.conf.d/*.conf can be overwritten by the same
|
||||
filenames in /etc/dracut.conf.d.
|
||||
|
||||
Packages should use /usr/lib/dracut/dracut.conf.d rather than
|
||||
/etc/dracut.conf.d for drop-in configuration files.
|
||||
|
||||
/etc/dracut.conf and /etc/dracut.conf.d belong to the system administrator.
|
||||
|
||||
- uses systemd-198 native initrd units
|
||||
- totally rely on the fstab-generator in systemd mode for block devices
|
||||
- dracut systemd now uses dracut.target rather than basic.target
|
||||
- dracut systemd services optimize themselves away
|
||||
- fixed hostonly parameter generation
|
||||
- turn off curl globbing (fixes IPv6)
|
||||
- modify the udev rules on install and not runtime time
|
||||
- enable initramfs building without kernel modules (fixed regression)
|
||||
- in the initqueue/timeout,
|
||||
reset the main loop counter, as we see new udev events or initqueue/work
|
||||
- fixed udev rule installation
|
||||
|
||||
dracut-025
|
||||
==========
|
||||
- do not strip signed kernel modules
|
||||
- add sosreport script and generate /run/initramfs/sosreport.txt
|
||||
- make short uuid specification for allow-discards work
|
||||
- turn off RateLimit for the systemd journal
|
||||
- fixed MAC address assignment
|
||||
- add systemd checkisomd5 service
|
||||
- splitout drm kernel modules from plymouth module
|
||||
- add 'swapoff' to initramfs to fix shutdown/reboot
|
||||
- add team device support
|
||||
- add pre-shutdown hook
|
||||
- kill all processes in shutdown and report remaining ones
|
||||
- "--device" changed to "--add-device" and "add_device=" added for conf files
|
||||
- add memory usage trace to different hook points
|
||||
- cope with optional field #7 in /proc/self/mountinfo
|
||||
- lots of small bugfixes
|
||||
|
||||
dracut-024
|
||||
==========
|
||||
- new dracut option "--device"
|
||||
- new dracut kernel command line options "rd.auto"
|
||||
- new dracut kernel command line options "rd.noverifyssl"
|
||||
- new dracut option "--kernel-cmdline" and "kernel_cmdline" option for default parameters
|
||||
- fixes for systemd and crypto
|
||||
- fix for kexec in shutdown, if not included in initramfs
|
||||
- create the initramfs non-world readable
|
||||
- prelink/preunlink in the initramfs
|
||||
- strip binaries in the initramfs by default now
|
||||
- various FIPS fixes
|
||||
- various dracut-install fixes
|
||||
|
||||
dracut-023
|
||||
==========
|
||||
- resume from hibernate fixes
|
||||
- -N option for --no-hostonly
|
||||
- support for systemd crypto handling
|
||||
- new dracut module "crypt-loop"
|
||||
- deprecate the old kernel command line options
|
||||
- more documentation
|
||||
- honor CFLAGS for dracut-install build
|
||||
- multipath fixes
|
||||
- / is mounted according to rootflags parameter but forced ro at first.
|
||||
Later it is remounted according to /etc/fstab + rootflags parameter
|
||||
and "ro"/"rw".
|
||||
- support for xfs / reiserfs separate journal device
|
||||
- new "ro_mnt" option to force ro mount of / and /usr
|
||||
- root on cifs support
|
||||
- dracut-install: fixed issue for /var/tmp containing a symlink
|
||||
- only lazy resolve with ldd, if the /var/tmp partition is not mounted with "noexec"
|
||||
- i18n: fixed inclusion of "include" keymaps
|
||||
|
||||
dracut-022
|
||||
==========
|
||||
- fixed host-only kernel module bug
|
||||
|
||||
dracut-021
|
||||
==========
|
||||
- fixed systemd in the initramfs (requires systemd >= 187)
|
||||
- dracut-install: massive speedup with /var on the same filesystem with COW copy
|
||||
- dracut-install: moved to /usr/lib/dracut until it becomes a general purpose tool
|
||||
- new options: "rd.usrmount.ro" and "rd.skipfsck"
|
||||
- less mount/umount
|
||||
- apply "ro" on the kernel command line also to /usr
|
||||
- mount according to fstab, if neither "ro" or "rw" is specified
|
||||
- skip fsck for xfs and btrfs. remount is enough
|
||||
- give emergency_shell if /usr mount failed
|
||||
- dracut now uses getopt:
|
||||
* options can be position independent now!!
|
||||
* we can now use --option=<arg>
|
||||
- added option "--kver=<kernel-version>", and the image location can be omitted
|
||||
# dracut --kver 3.5.0-0.rc7.git1.2.fc18.x86_64
|
||||
- dracut.sh: for --include copy also the symbolic links
|
||||
- man pages: lsinitrd and mkinitrd added
|
||||
- network: We do not support renaming in the kernel namespace anymore (as udev does
|
||||
that not anymore). So, if a user wants to use ifname, he has to rename
|
||||
to a custom namespace. "eth[0-9]+" is not allowed anymore. !!!!!
|
||||
- resume: moved the resume process to the initqueue.
|
||||
This should prevent accidently mounting the root file system.
|
||||
- testsuite: add support for: make V=1 TESTS="01 20 40" check
|
||||
$ sudo make V=1 clean check
|
||||
now runs the testsuite in verbose mode
|
||||
|
||||
$ sudo make TESTS="01 20 40" clean check
|
||||
now only runs the 01, 20 and 40 tests.
|
||||
|
||||
dracut-020
|
||||
==========
|
||||
- changed rd.dasd kernel parameter
|
||||
|
4
README
4
README
@@ -1,6 +1,6 @@
|
||||
Dracut
|
||||
dracut
|
||||
------
|
||||
Dracut is a new initramfs infrastructure.
|
||||
dracut is a new initramfs infrastructure.
|
||||
|
||||
Information about the initial goals and aims can be found at
|
||||
https://fedoraproject.org/wiki/Initrdrewrite
|
||||
|
@@ -1,5 +1,5 @@
|
||||
Most of the functionality that dracut implements are actually implemented
|
||||
by dracut modules. Dracut modules live in modules.d, and have the following
|
||||
by dracut modules. dracut modules live in modules.d, and have the following
|
||||
structure:
|
||||
|
||||
dracut_install_dir/modules.d/
|
||||
@@ -38,7 +38,7 @@ installkernel():
|
||||
|
||||
|
||||
check():
|
||||
Dracut calls this function to check and see if a module can be installed
|
||||
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
|
||||
|
@@ -7,5 +7,24 @@ cryptsetup
|
||||
nfs-utils
|
||||
netbsd-iscsi
|
||||
nbd
|
||||
dhcp
|
||||
dhcp (dhcp-server on openSUSE)
|
||||
iscsi-initiator-utils
|
||||
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
|
||||
|
16
TODO
16
TODO
@@ -6,22 +6,26 @@ Items are ordered in priority.
|
||||
|
||||
INITRAMFS TODO
|
||||
|
||||
- fix btrfs subvolume mounting for /usr (fsck)
|
||||
- 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
|
||||
- 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.
|
||||
- automatic kexec fallback
|
||||
- panic fallback
|
||||
- bridging/bonding without "netroot=" https://bugzilla.redhat.com/show_bug.cgi?id=822750
|
||||
- progress indication for fsck https://bugzilla.redhat.com/show_bug.cgi?id=827118
|
||||
- domain, searchdomain https://bugzilla.redhat.com/show_bug.cgi?id=840778
|
||||
- disable write-ifcfg https://bugzilla.redhat.com/show_bug.cgi?id=840784
|
||||
- check for /var to be mounted in convertfs https://bugzilla.redhat.com/show_bug.cgi?id=848172
|
||||
- probably fix "--include" https://bugzilla.redhat.com/show_bug.cgi?id=849338
|
||||
|
||||
GENERATOR TODO
|
||||
|
||||
- add presets (predefined set of modules)
|
||||
- add interpreter/plugin-scripts to be sourced at the beginning or end (can use dracut-functions)
|
||||
- provide "installkernel" and "new-kernel-pkg"
|
||||
- add mechanism for module specific command line options
|
||||
- pkg-config integration, to make it easy for other packages to use us.
|
||||
- add recovery image creator (mkrecovery)
|
||||
- default module specification could use some work
|
||||
- udev rule copying, as mentioned above, is a bit too hard-coded
|
||||
|
||||
@@ -33,5 +37,5 @@ CODE TODO
|
||||
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
|
||||
- https://bugzilla.redhat.com/show_bug.cgi?id=524727 - dracut + encrypted root + networking
|
||||
|
||||
|
78
configure
vendored
Executable file
78
configure
vendored
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# We don't support srcdir != builddir
|
||||
echo \#buildapi-variable-no-builddir >/dev/null
|
||||
|
||||
prefix=/usr
|
||||
|
||||
enable_documentation=yes
|
||||
|
||||
# Little helper function for reading args from the commandline.
|
||||
# it automatically handles -a b and -a=b variants, and returns 1 if
|
||||
# we need to shift $3.
|
||||
read_arg() {
|
||||
# $1 = arg name
|
||||
# $2 = arg value
|
||||
# $3 = arg parameter
|
||||
local rematch='^[^=]*=(.*)$'
|
||||
if [[ $2 =~ $rematch ]]; then
|
||||
read "$1" <<< "${BASH_REMATCH[1]}"
|
||||
else
|
||||
read "$1" <<< "$3"
|
||||
# There is no way to shift our callers args, so
|
||||
# return 1 to indicate they should do it instead.
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
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'";;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
cat > Makefile.inc.$$ <<EOF
|
||||
prefix ?= ${prefix}
|
||||
libdir ?= ${libdir:-${prefix}/lib}
|
||||
datadir ?= ${datadir:-${prefix}/share}
|
||||
sysconfdir ?= ${sysconfdir:-${prefix}/etc}
|
||||
sbindir ?= ${sbindir:-${prefix}/sbin}
|
||||
mandir ?= ${mandir:-${prefix}/share/man}
|
||||
enable_documentation ?= ${enable_documentation:-yes}
|
||||
bindir ?= ${bindir:-${prefix}/bin}
|
||||
EOF
|
||||
|
||||
{
|
||||
[[ $programprefix ]] && echo "programprefix ?= ${programprefix}"
|
||||
[[ $execprefix ]] && echo "execprefix ?= ${execprefix}"
|
||||
[[ $includedir ]] && echo "includedir ?= ${includedir}"
|
||||
[[ $libexecdir ]] && echo "libexecdir ?= ${libexecdir}"
|
||||
[[ $localstatedir ]] && echo "localstatedir ?= ${localstatedir}"
|
||||
[[ $sharedstatedir ]] && echo "sharedstatedir ?= ${sharedstatedir}"
|
||||
[[ $infodir ]] && echo "infodir ?= ${infodir}"
|
||||
[[ $systemdsystemunitdir ]] && echo "systemdsystemunitdir ?= ${systemdsystemunitdir}"
|
||||
[[ $bashcompletiondir ]] && echo "bashcompletiondir ?= ${bashcompletiondir}"
|
||||
} >> Makefile.inc.$$
|
||||
|
||||
mv Makefile.inc.$$ Makefile.inc
|
71
dracut-bash-completion.sh
Normal file
71
dracut-bash-completion.sh
Normal file
@@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Copyright 2013 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# 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 --no-compress --gzip --list-modules --show-modules --keep
|
||||
--printsize --regenerate-all --noimageifnotneeded'
|
||||
|
||||
[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'
|
||||
)
|
||||
|
||||
if __contains_word "$prev" ${OPTS[ARG]}; then
|
||||
case $prev in
|
||||
--kmoddir|-k|--fwdir|-c|--conf|--confdir|--tmpdir|--sshkey|--add-fstab|--add-device|-I|--install)
|
||||
comps=$(compgen -d -- "$cur")
|
||||
compopt -o filenames
|
||||
;;
|
||||
-a|-m|-o|--add|--modules|--omit)
|
||||
comps=$(dracut --list-modules 2>/dev/null)
|
||||
;;
|
||||
--kver)
|
||||
comps=$(cd /lib/modules; echo *)
|
||||
;;
|
||||
*)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ $cur = -* ]]; then
|
||||
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
complete -F _dracut dracut
|
@@ -19,12 +19,35 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
export LC_MESSAGES=C
|
||||
|
||||
[[ -d "$initdir/.kernelmodseen" ]] || mkdir -p "$initdir/.kernelmodseen"
|
||||
if [[ $DRACUT_KERNEL_LAZY ]] && ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then
|
||||
if ! [[ -d "$initdir/.kernelmodseen" ]]; then
|
||||
mkdir -p "$initdir/.kernelmodseen"
|
||||
fi
|
||||
DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen"
|
||||
fi
|
||||
|
||||
if [[ $initdir ]] && ! [[ -d $initdir ]]; then
|
||||
mkdir -p "$initdir"
|
||||
fi
|
||||
|
||||
# Generic substring function. If $2 is in $1, return 0.
|
||||
strstr() { [[ $1 = *$2* ]]; }
|
||||
|
||||
# find a binary. If we were not passed the full path directly,
|
||||
# search in the usual places to find the binary.
|
||||
find_binary() {
|
||||
if [[ -z ${1##/*} ]]; then
|
||||
if [[ -x $1 ]] || { strstr "$1" ".so" && ldd $1 &>/dev/null; }; then
|
||||
echo $1
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
type -P ${1##*/}
|
||||
}
|
||||
|
||||
if ! [[ $dracutbasedir ]]; then
|
||||
dracutbasedir=${BASH_SOURCE[0]%/*}
|
||||
[[ $dracutbasedir = "dracut-functions" ]] && dracutbasedir="."
|
||||
@@ -32,6 +55,14 @@ if ! [[ $dracutbasedir ]]; then
|
||||
dracutbasedir="$(readlink -f $dracutbasedir)"
|
||||
fi
|
||||
|
||||
if ! [[ $DRACUT_INSTALL ]]; then
|
||||
DRACUT_INSTALL=$(find_binary dracut-install)
|
||||
fi
|
||||
|
||||
if ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/dracut-install ]]; then
|
||||
DRACUT_INSTALL=$dracutbasedir/dracut-install
|
||||
fi
|
||||
|
||||
# Detect lib paths
|
||||
if ! [[ $libdirs ]] ; then
|
||||
if strstr "$(ldd /bin/sh)" "/lib64/" &>/dev/null \
|
||||
@@ -65,15 +96,28 @@ if ! type dinfo >/dev/null 2>&1; then
|
||||
dlog_init
|
||||
fi
|
||||
|
||||
if ! [[ $initdir ]]; then
|
||||
dfatal "initdir not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# export standard hookdirs
|
||||
[[ $hookdirs ]] || {
|
||||
hookdirs="cmdline pre-udev pre-trigger netroot "
|
||||
hookdirs+="initqueue initqueue/settled initqueue/online initqueue/finished initqueue/timeout "
|
||||
hookdirs+="pre-mount pre-pivot cleanup mount "
|
||||
hookdirs+="emergency shutdown-emergency shutdown "
|
||||
hookdirs+="emergency shutdown-emergency pre-shutdown shutdown "
|
||||
export hookdirs
|
||||
}
|
||||
|
||||
dracut_need_initqueue() {
|
||||
>"$initdir/lib/dracut/need-initqueue"
|
||||
}
|
||||
|
||||
dracut_module_included() {
|
||||
strstr "$mods_to_load $modules_loaded" "$@"
|
||||
}
|
||||
|
||||
# Create all subdirectories for given path without creating the last element.
|
||||
# $1 = path
|
||||
mksubdirs() { [[ -e ${1%/*} ]] || mkdir -m 0755 -p ${1%/*}; }
|
||||
@@ -203,6 +247,21 @@ else
|
||||
}
|
||||
fi
|
||||
|
||||
get_persistent_dev() {
|
||||
local i _tmp _dev
|
||||
|
||||
_dev=$(udevadm info --query=name --name="$1" 2>/dev/null)
|
||||
[ -z "$_dev" ] && return
|
||||
|
||||
for i in /dev/mapper/* /dev/disk/by-uuid/* /dev/disk/by-id/*; do
|
||||
_tmp=$(udevadm info --query=name --name="$i" 2>/dev/null)
|
||||
if [ "$_tmp" = "$_dev" ]; then
|
||||
echo $i
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# get_fs_env <device>
|
||||
# Get and set the ID_FS_TYPE and ID_FS_UUID variable from udev for a device.
|
||||
# Example:
|
||||
@@ -260,10 +319,17 @@ get_maj_min() {
|
||||
# $ find_block_device /usr
|
||||
# 8:4
|
||||
find_block_device() {
|
||||
local _x _mpt _majmin _dev _fs _maj _min
|
||||
local _x _mpt _majmin _dev _fs _maj _min _find_mpt
|
||||
_find_mpt="$1"
|
||||
if [[ $use_fstab != yes ]]; then
|
||||
while read _x _x _majmin _x _mpt _x _x _fs _dev _x; do
|
||||
[[ $_mpt = $1 ]] || continue
|
||||
while read _x; do
|
||||
set -- $_x
|
||||
_majmin="$3"
|
||||
_mpt="$5"
|
||||
[[ $8 = "-" ]] && shift
|
||||
_fs="$8"
|
||||
_dev="$9"
|
||||
[[ $_mpt = $_find_mpt ]] || continue
|
||||
[[ $_fs = nfs ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = nfs3 ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = nfs4 ]] && { echo $_dev; return 0;}
|
||||
@@ -281,7 +347,7 @@ find_block_device() {
|
||||
while read _dev _mpt _fs _x; do
|
||||
[ "${_dev%%#*}" != "$_dev" ] && continue
|
||||
|
||||
if [[ $_mpt = $1 ]]; then
|
||||
if [[ $_mpt = $_find_mpt ]]; then
|
||||
[[ $_fs = nfs ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = nfs3 ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = nfs4 ]] && { echo $_dev; return 0;}
|
||||
@@ -304,16 +370,75 @@ find_block_device() {
|
||||
# $ find_dev_fstype /dev/sda2;echo
|
||||
# ext4
|
||||
find_dev_fstype() {
|
||||
local _x _mpt _majmin _dev _fs _maj _min
|
||||
while read _x _x _majmin _x _mpt _x _x _fs _dev _x; do
|
||||
[[ $_dev = $1 ]] || continue
|
||||
local _x _mpt _majmin _dev _fs _maj _min _find_dev
|
||||
_find_dev="$1"
|
||||
strstr "$_find_dev" "/dev" || _find_dev="/dev/block/$_find_dev"
|
||||
while read _x; do
|
||||
set -- $_x
|
||||
_majmin="$3"
|
||||
_mpt="$5"
|
||||
[[ $8 = "-" ]] && shift
|
||||
_fs="$8"
|
||||
_dev="$9"
|
||||
strstr "$_dev" "/dev" || continue
|
||||
[[ $_dev -ef $_find_dev ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
echo -n $_fs;
|
||||
return 0;
|
||||
done < /proc/self/mountinfo
|
||||
|
||||
# fall back to /etc/fstab
|
||||
while read _dev _mpt _fs _x; do
|
||||
[[ $_dev = $1 ]] || continue
|
||||
[ "${_dev%%#*}" != "$_dev" ] && continue
|
||||
case "$_dev" in
|
||||
LABEL=*)
|
||||
_dev="$(echo $_dev | sed 's,/,\\x2f,g')"
|
||||
_dev="/dev/disk/by-label/${_dev#LABEL=}"
|
||||
;;
|
||||
UUID=*)
|
||||
_dev="/dev/disk/by-uuid/${_dev#UUID=}"
|
||||
;;
|
||||
PARTUUID=*)
|
||||
_dev="/dev/disk/by-partuuid/${_dev#PARTUUID=}"
|
||||
;;
|
||||
esac
|
||||
|
||||
[[ $_dev -ef $_find_dev ]] || continue
|
||||
echo -n $_fs;
|
||||
return 0;
|
||||
done < /etc/fstab
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
# find_mp_fstype <mountpoint>
|
||||
# Echo the filesystem type for a given mountpoint.
|
||||
# /proc/self/mountinfo is taken as the primary source of information
|
||||
# and /etc/fstab is used as a fallback.
|
||||
# No newline is appended!
|
||||
# Example:
|
||||
# $ find_mp_fstype /;echo
|
||||
# ext4
|
||||
find_mp_fstype() {
|
||||
local _x _mpt _majmin _dev _fs _maj _min _find_mpt
|
||||
_find_mpt="$1"
|
||||
while read _x; do
|
||||
set -- $_x
|
||||
_majmin="$3"
|
||||
_mpt="$5"
|
||||
[[ $8 = "-" ]] && shift
|
||||
_fs="$8"
|
||||
_dev="$9"
|
||||
[[ $_mpt = $_find_mpt ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
echo -n $_fs;
|
||||
return 0;
|
||||
done < /proc/self/mountinfo
|
||||
|
||||
# fall back to /etc/fstab
|
||||
while read _dev _mpt _fs _x; do
|
||||
[ "${_dev%%#*}" != "$_dev" ] && continue
|
||||
[[ $_mpt = $_find_mpt ]] || continue
|
||||
echo -n $_fs;
|
||||
return 0;
|
||||
done < /etc/fstab
|
||||
@@ -325,27 +450,27 @@ find_dev_fstype() {
|
||||
find_root_block_device() { find_block_device /; }
|
||||
|
||||
# for_each_host_dev_fs <func>
|
||||
# Execute "<func> <dev> <filesystem>" for every "<dev>|<fs>" pair found
|
||||
# Execute "<func> <dev> <filesystem>" for every "<dev> <fs>" pair found
|
||||
# in ${host_fs_types[@]}
|
||||
for_each_host_dev_fs()
|
||||
{
|
||||
local _func="$1"
|
||||
local _dev
|
||||
local _fs
|
||||
local _ret=1
|
||||
for f in ${host_fs_types[@]}; do
|
||||
OLDIFS="$IFS"
|
||||
IFS="|"
|
||||
set -- $f
|
||||
IFS="$OLDIFS"
|
||||
_dev="$1"
|
||||
[[ -b "$_dev" ]] || continue
|
||||
_fs="$2"
|
||||
$_func $_dev $_fs && _ret=0
|
||||
|
||||
[[ "${!host_fs_types[@]}" ]] || return 0
|
||||
|
||||
for _dev in "${!host_fs_types[@]}"; do
|
||||
$_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0
|
||||
done
|
||||
return $_ret
|
||||
}
|
||||
|
||||
host_fs_all()
|
||||
{
|
||||
echo "${host_fs_types[@]}"
|
||||
}
|
||||
|
||||
# Walk all the slave relationships for a given block device.
|
||||
# Stop when our helper function returns success
|
||||
# $1 = function to call on every found block device
|
||||
@@ -366,6 +491,57 @@ check_block_and_slaves() {
|
||||
return 1
|
||||
}
|
||||
|
||||
check_block_and_slaves_all() {
|
||||
local _x _ret=1
|
||||
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
|
||||
if "$1" $2; then
|
||||
_ret=0
|
||||
fi
|
||||
check_vol_slaves "$@" && return 0
|
||||
if [[ -f /sys/dev/block/$2/../dev ]]; then
|
||||
check_block_and_slaves_all $1 $(cat "/sys/dev/block/$2/../dev") && _ret=0
|
||||
fi
|
||||
[[ -d /sys/dev/block/$2/slaves ]] || return 1
|
||||
for _x in /sys/dev/block/$2/slaves/*/dev; do
|
||||
[[ -f $_x ]] || continue
|
||||
check_block_and_slaves_all $1 $(cat "$_x") && _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()
|
||||
{
|
||||
local _func="$1"
|
||||
local _dev
|
||||
local _ret=1
|
||||
|
||||
[[ "${host_devs[@]}" ]] || return 0
|
||||
|
||||
for _dev in ${host_devs[@]}; do
|
||||
[[ -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()
|
||||
{
|
||||
local _func="$1"
|
||||
local _dev
|
||||
|
||||
[[ "${host_devs[@]}" ]] || return 0
|
||||
|
||||
for _dev in ${host_devs[@]}; do
|
||||
[[ -b "$_dev" ]] || continue
|
||||
check_block_and_slaves $_func $(get_maj_min $_dev) && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# ugly workaround for the lvm design
|
||||
# There is no volume group device,
|
||||
# so, there are no slave devices for volume groups.
|
||||
@@ -391,56 +567,79 @@ check_vol_slaves() {
|
||||
return 1
|
||||
}
|
||||
|
||||
if [[ -x /usr/bin/dracut-install ]]; then
|
||||
# fs_get_option <filesystem options> <search for option>
|
||||
# search for a specific option in a bunch of filesystem options
|
||||
# and return the value
|
||||
fs_get_option() {
|
||||
local _fsopts=$1
|
||||
local _option=$2
|
||||
local OLDIFS="$IFS"
|
||||
IFS=,
|
||||
set -- $_fsopts
|
||||
IFS="$OLDIFS"
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
$_option=*)
|
||||
echo ${1#${_option}=}
|
||||
break
|
||||
esac
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
if [[ $DRACUT_INSTALL ]]; then
|
||||
[[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
|
||||
inst_dir() {
|
||||
[[ -e ${initdir}/"$1" ]] && return 0 # already there
|
||||
dracut-install ${initdir+-D "$initdir"} -d "$@"
|
||||
(($? != 0)) && derror dracut-install ${initdir+-D "$initdir"} -d "$@" || :
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} -d "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} -d "$@" || :
|
||||
}
|
||||
|
||||
inst() {
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
#dinfo "dracut-install -l $@"
|
||||
dracut-install ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror dracut-install ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
#dinfo "$DRACUT_INSTALL -l $@"
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_simple() {
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -e $1 ]] || return 1 # no source
|
||||
dracut-install ${initdir+-D "$initdir"} "$@"
|
||||
(($? != 0)) && derror dracut-install ${initdir+-D "$initdir"} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} "$@" || :
|
||||
}
|
||||
|
||||
inst_symlink() {
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -L $1 ]] || return 1
|
||||
dracut-install ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror dracut-install ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
}
|
||||
|
||||
dracut_install() {
|
||||
#dinfo "initdir=$initdir dracut-install -l $@"
|
||||
dracut-install ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror dracut-install ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
local ret
|
||||
#dinfo "initdir=$initdir $DRACUT_INSTALL -l $@"
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
ret=$?
|
||||
(($ret != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
return $ret
|
||||
}
|
||||
|
||||
inst_library() {
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -e $1 ]] || return 1 # no source
|
||||
dracut-install ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror dracut-install ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_binary() {
|
||||
dracut-install ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror dracut-install ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_script() {
|
||||
dracut-install ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror dracut-install ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
}
|
||||
|
||||
else
|
||||
@@ -493,6 +692,12 @@ else
|
||||
if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
|
||||
inst "${_src%/*}/.${_src##*/}.hmac" "${_target%/*}/.${_target##*/}.hmac"
|
||||
fi
|
||||
if [[ -e "/lib/fipscheck/${_src##*/}.hmac" ]]; then
|
||||
inst "/lib/fipscheck/${_src##*/}.hmac" "/lib/fipscheck/${_target##*/}.hmac"
|
||||
fi
|
||||
if [[ -e "/lib64/fipscheck/${_src##*/}.hmac" ]]; then
|
||||
inst "/lib64/fipscheck/${_src##*/}.hmac" "/lib64/fipscheck/${_target##*/}.hmac"
|
||||
fi
|
||||
fi
|
||||
ddebug "Installing $_src"
|
||||
cp --reflink=auto --sparse=auto -pfL "$_src" "${initdir}/$_target"
|
||||
@@ -530,6 +735,12 @@ else
|
||||
if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
|
||||
inst "${_src%/*}/.${_src##*/}.hmac" "${_dest%/*}/.${_dest##*/}.hmac"
|
||||
fi
|
||||
if [[ -e "/lib/fipscheck/${_src##*/}.hmac" ]]; then
|
||||
inst "/lib/fipscheck/${_src##*/}.hmac" "/lib/fipscheck/${_dest##*/}.hmac"
|
||||
fi
|
||||
if [[ -e "/lib64/fipscheck/${_src##*/}.hmac" ]]; then
|
||||
inst "/lib64/fipscheck/${_src##*/}.hmac" "/lib64/fipscheck/${_dest##*/}.hmac"
|
||||
fi
|
||||
fi
|
||||
_reallib=$(readlink -f "$_src")
|
||||
inst_simple "$_reallib" "$_reallib"
|
||||
@@ -664,70 +875,83 @@ rev_lib_symlinks() {
|
||||
echo "${links}"
|
||||
}
|
||||
|
||||
# find a binary. If we were not passed the full path directly,
|
||||
# search in the usual places to find the binary.
|
||||
find_binary() {
|
||||
if [[ -z ${1##/*} ]]; then
|
||||
if [[ -x $1 ]] || { strstr "$1" ".so" && ldd $1 &>/dev/null; }; then
|
||||
echo $1
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
type -P $1
|
||||
}
|
||||
|
||||
# attempt to install any programs specified in a udev rule
|
||||
inst_rule_programs() {
|
||||
local _prog _bin
|
||||
|
||||
if grep -qE 'PROGRAM==?"[^ "]+' "$1"; then
|
||||
for _prog in $(grep -E 'PROGRAM==?"[^ "]+' "$1" | sed -r 's/.*PROGRAM==?"([^ "]+).*/\1/'); do
|
||||
_bin=""
|
||||
if [ -x ${udevdir}/$_prog ]; then
|
||||
_bin=${udevdir}/$_prog
|
||||
else
|
||||
elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then
|
||||
_bin=$(find_binary "$_prog") || {
|
||||
dinfo "Skipping program $_prog using in udev rule $(basename $1) as it cannot be found"
|
||||
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
|
||||
continue;
|
||||
}
|
||||
fi
|
||||
|
||||
#dinfo "Installing $_bin due to it's use in the udev rule $(basename $1)"
|
||||
dracut_install "$_bin"
|
||||
[[ $_bin ]] && dracut_install "$_bin"
|
||||
done
|
||||
fi
|
||||
if grep -qE 'RUN==?"[^ "]+' "$1"; then
|
||||
for _prog in $(grep -E 'RUN==?"[^ "]+' "$1" | sed -r 's/.*RUN==?"([^ "]+).*/\1/'); do
|
||||
if grep -qE 'RUN[+=]=?"[^ "]+' "$1"; then
|
||||
for _prog in $(grep -E 'RUN[+=]=?"[^ "]+' "$1" | sed -r 's/.*RUN[+=]=?"([^ "]+).*/\1/'); do
|
||||
_bin=""
|
||||
if [ -x ${udevdir}/$_prog ]; then
|
||||
_bin=${udevdir}/$_prog
|
||||
else
|
||||
elif [[ "${_prog/\$env\{/}" == "$_prog" ]] && [[ "${_prog}" != "/sbin/initqueue" ]]; then
|
||||
_bin=$(find_binary "$_prog") || {
|
||||
dinfo "Skipping program $_prog using in udev rule $(basename $1) as it cannot be found"
|
||||
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
|
||||
continue;
|
||||
}
|
||||
fi
|
||||
|
||||
#dinfo "Installing $_bin due to it's use in the udev rule $(basename $1)"
|
||||
dracut_install "$_bin"
|
||||
[[ $_bin ]] && dracut_install "$_bin"
|
||||
done
|
||||
fi
|
||||
if grep -qE 'PROGRAM==?"[^ "]+' "$1"; then
|
||||
for _prog in $(grep -E 'IMPORT==?"[^ "]+' "$1" | sed -r 's/.*IMPORT==?"([^ "]+).*/\1/'); do
|
||||
if grep -qE 'IMPORT\{program\}==?"[^ "]+' "$1"; then
|
||||
for _prog in $(grep -E 'IMPORT\{program\}==?"[^ "]+' "$1" | sed -r 's/.*IMPORT\{program\}==?"([^ "]+).*/\1/'); do
|
||||
_bin=""
|
||||
if [ -x ${udevdir}/$_prog ]; then
|
||||
_bin=${udevdir}/$_prog
|
||||
else
|
||||
elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then
|
||||
_bin=$(find_binary "$_prog") || {
|
||||
dinfo "Skipping program $_prog using in udev rule $(basename $1) as it cannot be found"
|
||||
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
|
||||
continue;
|
||||
}
|
||||
fi
|
||||
|
||||
#dinfo "Installing $_bin due to it's use in the udev rule $(basename $1)"
|
||||
dracut_install "$_bin"
|
||||
[[ $_bin ]] && dracut_install "$_bin"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# attempt to install any programs specified in a udev rule
|
||||
inst_rule_group_owner() {
|
||||
local i
|
||||
|
||||
if grep -qE 'OWNER=?"[^ "]+' "$1"; then
|
||||
for i in $(grep -E 'OWNER=?"[^ "]+' "$1" | sed -r 's/.*OWNER=?"([^ "]+).*/\1/'); do
|
||||
if ! egrep -q "^$i:" "$initdir/etc/passwd" 2>/dev/null; then
|
||||
egrep "^$i:" /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if grep -qE 'GROUP=?"[^ "]+' "$1"; then
|
||||
for i in $(grep -E 'GROUP=?"[^ "]+' "$1" | sed -r 's/.*GROUP=?"([^ "]+).*/\1/'); do
|
||||
if ! egrep -q "^$i:" "$initdir/etc/group" 2>/dev/null; then
|
||||
egrep "^$i:" /etc/group 2>/dev/null >> "$initdir/etc/group"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
inst_rule_initqueue() {
|
||||
if grep -q -F initqueue "$1"; then
|
||||
dracut_need_initqueue
|
||||
fi
|
||||
}
|
||||
|
||||
# udev rules always get installed in the same place, so
|
||||
# create a function to install them to make life simpler.
|
||||
inst_rules() {
|
||||
@@ -736,11 +960,13 @@ inst_rules() {
|
||||
inst_dir "${udevdir}/rules.d"
|
||||
inst_dir "$_target"
|
||||
for _rule in "$@"; do
|
||||
if [ "${rule#/}" = "$rule" ]; then
|
||||
if [ "${_rule#/}" = "$_rule" ]; then
|
||||
for r in ${udevdir}/rules.d /etc/udev/rules.d; do
|
||||
if [[ -f $r/$_rule ]]; then
|
||||
_found="$r/$_rule"
|
||||
inst_rule_programs "$_found"
|
||||
inst_rule_group_owner "$_found"
|
||||
inst_rule_initqueue "$_found"
|
||||
inst_simple "$_found"
|
||||
fi
|
||||
done
|
||||
@@ -749,6 +975,8 @@ inst_rules() {
|
||||
if [[ -f ${r}$_rule ]]; then
|
||||
_found="${r}$_rule"
|
||||
inst_rule_programs "$_found"
|
||||
inst_rule_group_owner "$_found"
|
||||
inst_rule_initqueue "$_found"
|
||||
inst_simple "$_found" "$_target/${_found##*/}"
|
||||
fi
|
||||
done
|
||||
@@ -756,6 +984,33 @@ inst_rules() {
|
||||
done
|
||||
}
|
||||
|
||||
prepare_udev_rules() {
|
||||
[ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version)
|
||||
|
||||
for f in "$@"; do
|
||||
f="${initdir}/etc/udev/rules.d/$f"
|
||||
[ -e "$f" ] || continue
|
||||
while read line; do
|
||||
if [ "${line%%IMPORT PATH_ID}" != "$line" ]; then
|
||||
if [ $UDEVVERSION -ge 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
|
||||
printf '%sIMPORT{builtin}="blkid"\n' "${line%%IMPORT BLKID}"
|
||||
else
|
||||
printf '%sIMPORT{program}="/sbin/blkid -o udev -p $tempnode"\n' "${line%%IMPORT BLKID}"
|
||||
fi
|
||||
else
|
||||
echo "$line"
|
||||
fi
|
||||
done < "${f}" > "${f}.new"
|
||||
mv "${f}.new" "$f"
|
||||
done
|
||||
}
|
||||
|
||||
# install function specialized for hooks
|
||||
# $1 = type of hook, $2 = hook priority (lower runs first), $3 = hook
|
||||
# All hooks should be POSIX/SuS compliant, they will be sourced by init.
|
||||
@@ -768,7 +1023,7 @@ inst_hook() {
|
||||
dfatal "No such hook type $1. Aborting initrd creation."
|
||||
exit 1
|
||||
fi
|
||||
inst_simple "$3" "/lib/dracut/hooks/${1}/${2}${3##*/}"
|
||||
inst_simple "$3" "/lib/dracut/hooks/${1}/${2}-${3##*/}"
|
||||
}
|
||||
|
||||
# install any of listed files
|
||||
@@ -840,7 +1095,7 @@ inst_decompress() {
|
||||
for _src in $@
|
||||
do
|
||||
case ${_src} in
|
||||
*.gz) _cmd='gzip -d' ;;
|
||||
*.gz) _cmd='gzip -f -d' ;;
|
||||
*.bz2) _cmd='bzip2 -d' ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
@@ -992,6 +1247,9 @@ check_mount() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local _ret
|
||||
local _moddep
|
||||
|
||||
[ "${#host_fs_types[*]}" -le 0 ] && return 1
|
||||
|
||||
# If we are already scheduled to be loaded, no need to check again.
|
||||
strstr " $mods_to_load " " $_mod " && return 0
|
||||
strstr " $mods_checked_as_dep " " $_mod " && return 1
|
||||
@@ -1001,15 +1259,28 @@ check_mount() {
|
||||
|
||||
[[ $2 ]] || mods_checked_as_dep+=" $_mod "
|
||||
|
||||
strstr " $omit_dracutmodules " " $_mod " && return 1
|
||||
|
||||
if [ "${#host_fs_types[*]}" -gt 0 ]; then
|
||||
module_check_mount $_mod || return 1
|
||||
else
|
||||
# skip this module
|
||||
if strstr " $omit_dracutmodules " " $_mod "; then
|
||||
dinfo "dracut module '$_mod' will not be installed, because it's in the list to be omitted!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if strstr " $dracutmodules $add_dracutmodules $force_add_dracutmodules" " $_mod "; then
|
||||
module_check_mount $_mod; ret=$?
|
||||
|
||||
# explicit module, so also accept ret=255
|
||||
[[ $ret = 0 || $ret = 255 ]] || return 1
|
||||
else
|
||||
# module not in our list
|
||||
if [[ $dracutmodules = all ]]; then
|
||||
# check, if we can and should install this module
|
||||
module_check_mount $_mod || return 1
|
||||
else
|
||||
# skip this module
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
for _moddep in $(module_depends $_mod); do
|
||||
# handle deps as if they were manually added
|
||||
strstr " $add_dracutmodules " " $_moddep " || \
|
||||
@@ -1017,7 +1288,10 @@ check_mount() {
|
||||
strstr " $force_add_dracutmodules " " $_moddep " || \
|
||||
force_add_dracutmodules+=" $_moddep "
|
||||
# if a module we depend on fail, fail also
|
||||
check_module $_moddep || return 1
|
||||
if ! check_module $_moddep; then
|
||||
derror "dracut module '$_mod' depends on '$_moddep', which can't be installed"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
strstr " $mods_to_load " " $_mod " || \
|
||||
@@ -1044,7 +1318,10 @@ check_module() {
|
||||
|
||||
[[ $2 ]] || mods_checked_as_dep+=" $_mod "
|
||||
|
||||
strstr " $omit_dracutmodules " " $_mod " && return 1
|
||||
if strstr " $omit_dracutmodules " " $_mod "; then
|
||||
dinfo "dracut module '$_mod' will not be installed, because it's in the list to be omitted!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if strstr " $dracutmodules $add_dracutmodules $force_add_dracutmodules" " $_mod "; then
|
||||
if strstr " $force_add_dracutmodules" " $_mod"; then
|
||||
@@ -1072,7 +1349,10 @@ check_module() {
|
||||
strstr " $force_add_dracutmodules " " $_moddep " || \
|
||||
force_add_dracutmodules+=" $_moddep "
|
||||
# if a module we depend on fail, fail also
|
||||
check_module $_moddep || return 1
|
||||
if ! check_module $_moddep; then
|
||||
derror "dracut module '$_mod' depends on '$_moddep', which can't be installed"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
strstr " $mods_to_load " " $_mod " || \
|
||||
@@ -1100,7 +1380,7 @@ for_each_module_dir() {
|
||||
for _mod in $_modcheck; do
|
||||
strstr "$mods_to_load" "$_mod" && continue
|
||||
strstr "$omit_dracutmodules" "$_mod" && continue
|
||||
derror "Dracut module \"$_mod\" cannot be found or installed."
|
||||
derror "dracut module '$_mod' cannot be found or installed."
|
||||
done
|
||||
}
|
||||
|
||||
@@ -1112,8 +1392,8 @@ install_kmod_with_fw() {
|
||||
[[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] \
|
||||
&& return 0
|
||||
|
||||
if [[ -e "$initdir/.kernelmodseen/${1##*/}" ]]; then
|
||||
read ret < "$initdir/.kernelmodseen/${1##*/}"
|
||||
if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && [[ -e "$DRACUT_KERNEL_LAZY_HASHDIR/${1##*/}" ]]; then
|
||||
read ret < "$DRACUT_KERNEL_LAZY_HASHDIR/${1##*/}"
|
||||
return $ret
|
||||
fi
|
||||
|
||||
@@ -1133,8 +1413,9 @@ install_kmod_with_fw() {
|
||||
|
||||
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}"
|
||||
ret=$?
|
||||
[ -d "$initdir/.kernelmodseen" ] && \
|
||||
echo $ret > "$initdir/.kernelmodseen/${1##*/}"
|
||||
[[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \
|
||||
[[ -d "$DRACUT_KERNEL_LAZY_HASHDIR" ]] && \
|
||||
echo $ret > "$DRACUT_KERNEL_LAZY_HASHDIR/${1##*/}"
|
||||
(($ret != 0)) && return $ret
|
||||
|
||||
local _modname=${1##*/} _fwdir _found _fw
|
||||
@@ -1181,38 +1462,38 @@ for_each_kmod_dep() {
|
||||
dracut_kernel_post() {
|
||||
local _moddirname=${srcmods%%/lib/modules/*}
|
||||
|
||||
if [[ -f "$initdir/.kernelmodseen/lazylist" ]]; then
|
||||
xargs modprobe -a ${_moddirname+-d ${_moddirname}/} --ignore-install --show-depends \
|
||||
< "$initdir/.kernelmodseen/lazylist" 2>/dev/null \
|
||||
if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && [[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" ]]; then
|
||||
xargs -r modprobe -a ${_moddirname+-d ${_moddirname}/} \
|
||||
--ignore-install --show-depends --set-version $kernel \
|
||||
< "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" 2>/dev/null \
|
||||
| sort -u \
|
||||
| while read _cmd _modpath _options; do
|
||||
[[ $_cmd = insmod ]] || continue
|
||||
echo "$_modpath"
|
||||
done > "$initdir/.kernelmodseen/lazylist.dep"
|
||||
done > "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
|
||||
|
||||
(
|
||||
if [[ -x /usr/bin/dracut-install ]] && [[ -z $_moddirname ]]; then
|
||||
xargs dracut-install ${initdir+-D "$initdir"} -a < "$initdir/.kernelmodseen/lazylist.dep"
|
||||
if [[ $DRACUT_INSTALL ]] && [[ -z $_moddirname ]]; then
|
||||
xargs -r $DRACUT_INSTALL ${initdir+-D "$initdir"} -a < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
|
||||
else
|
||||
while read _modpath; do
|
||||
local _destpath=$_modpath
|
||||
[[ $_moddirname ]] && _destpath=${_destpath##$_moddirname/}
|
||||
_destpath=${_destpath##*/lib/modules/$kernel/}
|
||||
inst_simple "$_modpath" "/lib/modules/$kernel/${_destpath}" || exit $?
|
||||
done < "$initdir/.kernelmodseen/lazylist.dep"
|
||||
done < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
|
||||
fi
|
||||
) &
|
||||
|
||||
|
||||
if [[ -x /usr/bin/dracut-install ]]; then
|
||||
xargs modinfo -k $kernel -F firmware < "$initdir/.kernelmodseen/lazylist.dep" \
|
||||
if [[ $DRACUT_INSTALL ]]; then
|
||||
xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" \
|
||||
| while read line; do
|
||||
for _fwdir in $fw_dir; do
|
||||
echo $_fwdir/$line;
|
||||
done;
|
||||
done |xargs dracut-install ${initdir+-D "$initdir"} -a -o
|
||||
done | xargs -r $DRACUT_INSTALL ${initdir+-D "$initdir"} -a -o
|
||||
else
|
||||
for _fw in $(xargs modinfo -k $kernel -F firmware < "$initdir/.kernelmodseen/lazylist.dep"); do
|
||||
for _fw in $(xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"); do
|
||||
for _fwdir in $fw_dir; do
|
||||
if [[ -d $_fwdir && -f $_fwdir/$_fw ]]; then
|
||||
inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw"
|
||||
@@ -1243,23 +1524,40 @@ dracut_kernel_post() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -fr "$initdir/.kernelmodseen"
|
||||
[[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && rm -fr "$DRACUT_KERNEL_LAZY_HASHDIR"
|
||||
}
|
||||
|
||||
module_is_host_only() (
|
||||
local _mod=$1
|
||||
_mod=${_mod##*/}
|
||||
_mod=${_mod%.ko}
|
||||
|
||||
[[ "$add_drivers" =~ " ${_mod} " ]] && return 0
|
||||
|
||||
# check if module is loaded
|
||||
[[ -d $(echo /sys/module/${_mod//-/_}|{ read a b; echo $a; }) ]] && return 0
|
||||
|
||||
# check if module is loadable on the current kernel
|
||||
# this covers the case, where a new module is introduced
|
||||
# or a module was renamed
|
||||
# or a module changed from builtin to a module
|
||||
modinfo -F filename "$_mod" &>/dev/null || return 0
|
||||
|
||||
return 1
|
||||
)
|
||||
|
||||
find_kernel_modules_by_path () (
|
||||
local _OLDIFS
|
||||
if ! [[ $hostonly ]]; then
|
||||
_OLDIFS=$IFS
|
||||
IFS=:
|
||||
while read a rest; do
|
||||
[[ $a = kernel*/$1/* ]] || continue
|
||||
echo $srcmods/$a
|
||||
done < $srcmods/modules.dep
|
||||
IFS=$_OLDIFS
|
||||
else
|
||||
( cd /sys/module; echo *; ) \
|
||||
| xargs modinfo -F filename -k $kernel 2>/dev/null
|
||||
fi
|
||||
|
||||
[[ -f $srcmods/modules.dep ]] || return 0
|
||||
|
||||
_OLDIFS=$IFS
|
||||
IFS=:
|
||||
while read a rest; do
|
||||
[[ $a = */$1/* ]] || continue
|
||||
echo $srcmods/$a
|
||||
done < $srcmods/modules.dep
|
||||
IFS=$_OLDIFS
|
||||
return 0
|
||||
)
|
||||
|
||||
@@ -1267,8 +1565,8 @@ find_kernel_modules () {
|
||||
find_kernel_modules_by_path drivers
|
||||
}
|
||||
|
||||
# instmods [-c] <kernel module> [<kernel module> ... ]
|
||||
# instmods [-c] <kernel subsystem>
|
||||
# instmods [-c [-s]] <kernel module> [<kernel module> ... ]
|
||||
# instmods [-c [-s]] <kernel subsystem>
|
||||
# install kernel modules along with all their dependencies.
|
||||
# <kernel subsystem> can be e.g. "=block" or "=drivers/usb/storage"
|
||||
instmods() {
|
||||
@@ -1276,11 +1574,17 @@ instmods() {
|
||||
# called [sub]functions inherit _fderr
|
||||
local _fderr=9
|
||||
local _check=no
|
||||
local _silent=no
|
||||
if [[ $1 = '-c' ]]; then
|
||||
_check=yes
|
||||
shift
|
||||
fi
|
||||
|
||||
if [[ $1 = '-s' ]]; then
|
||||
_silent=yes
|
||||
shift
|
||||
fi
|
||||
|
||||
function inst1mod() {
|
||||
local _ret=0 _mod="$1"
|
||||
case $_mod in
|
||||
@@ -1291,13 +1595,13 @@ instmods() {
|
||||
((_ret+=$?))
|
||||
;;
|
||||
--*) _mpargs+=" $_mod" ;;
|
||||
i2o_scsi) return 0;; # Do not load this diagnostic-only module
|
||||
*)
|
||||
_mod=${_mod##*/}
|
||||
# if we are already installed, skip this module and go on
|
||||
# to the next one.
|
||||
if [[ -f "$initdir/.kernelmodseen/${_mod%.ko}.ko" ]]; then
|
||||
read _ret <"$initdir/.kernelmodseen/${_mod%.ko}.ko"
|
||||
if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \
|
||||
[[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko}.ko" ]]; then
|
||||
read _ret <"$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko}.ko"
|
||||
return $_ret
|
||||
fi
|
||||
|
||||
@@ -1305,16 +1609,16 @@ instmods() {
|
||||
dinfo "Omitting driver ${_mod##$srcmods}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# If we are building a host-specific initramfs and this
|
||||
# module is not already loaded, move on to the next one.
|
||||
[[ $hostonly ]] \
|
||||
&& ! [[ -d $(echo /sys/module/${_mod//-/_}|{ read a b; echo $a; }) ]] \
|
||||
&& ! [[ "$add_drivers" =~ " ${_mod} " ]] \
|
||||
&& ! module_is_host_only "$_mod" \
|
||||
&& return 0
|
||||
|
||||
if [[ "$_check" = "yes" ]] || ! [[ $DRACUT_KERNEL_LAZY ]]; then
|
||||
if [[ "$_check" = "yes" ]] || ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then
|
||||
# We use '-d' option in modprobe only if modules prefix path
|
||||
# differs from default '/'. This allows us to use Dracut with
|
||||
# differs from default '/'. This allows us to use dracut with
|
||||
# old version of modprobe which doesn't have '-d' option.
|
||||
local _moddirname=${srcmods%%/lib/modules/*}
|
||||
[[ -n ${_moddirname} ]] && _moddirname="-d ${_moddirname}/"
|
||||
@@ -1325,7 +1629,8 @@ instmods() {
|
||||
--set-version $kernel ${_moddirname} $_mpargs
|
||||
((_ret+=$?))
|
||||
else
|
||||
echo $_mod >> "$initdir/.kernelmodseen/lazylist"
|
||||
[[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \
|
||||
echo $_mod >> "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@@ -1337,8 +1642,8 @@ instmods() {
|
||||
if (($# == 0)); then # filenames from stdin
|
||||
while read _mod; do
|
||||
inst1mod "${_mod%.ko*}" || {
|
||||
if [ "$_check" = "yes" ]; then
|
||||
dfatal "Failed to install $_mod"
|
||||
if [[ "$_check" == "yes" ]]; then
|
||||
[[ "$_silent" == "no" ]] && dfatal "Failed to install $_mod"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@@ -1346,8 +1651,8 @@ instmods() {
|
||||
fi
|
||||
while (($# > 0)); do # filenames as arguments
|
||||
inst1mod ${1%.ko*} || {
|
||||
if [ "$_check" = "yes" ]; then
|
||||
dfatal "Failed to install $1"
|
||||
if [[ "$_check" == "yes" ]]; then
|
||||
[[ "$_silent" == "no" ]] && dfatal "Failed to install $1"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
@@ -1,17 +1,28 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
set -e
|
||||
|
||||
KERNEL_VERSION="$(uname -r)"
|
||||
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
|
||||
IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
|
||||
fi
|
||||
[[ -f $IMG ]] || IMG="/boot/initramfs-${KERNEL_VERSION}.img"
|
||||
|
||||
cd /run/initramfs
|
||||
IMG="/boot/initramfs-$(uname -r).img"
|
||||
|
||||
[ -f .need_shutdown -a -f "$IMG" ] || exit 1
|
||||
if zcat "$IMG" | cpio -id >/dev/null 2>&1; then
|
||||
if zcat "$IMG" | cpio -id --quiet >/dev/null; then
|
||||
rm .need_shutdown
|
||||
elif xzcat "$IMG" | cpio -id >/dev/null 2>&1; then
|
||||
elif xzcat "$IMG" | cpio -id --quiet >/dev/null; then
|
||||
rm .need_shutdown
|
||||
else
|
||||
# something failed, so we clean up
|
||||
echo "Unpacking of $IMG to /run/initramfs failed" >&2
|
||||
rm -f /run/initramfs/shutdown
|
||||
exit 1
|
||||
fi
|
||||
|
@@ -23,7 +23,7 @@
|
||||
__DRACUT_LOGGER__=1
|
||||
|
||||
|
||||
## @brief Logging facility module for Dracut both at build- and boot-time.
|
||||
## @brief Logging facility module for dracut both at build- and boot-time.
|
||||
#
|
||||
# @section intro Introduction
|
||||
#
|
||||
@@ -89,7 +89,7 @@ __DRACUT_LOGGER__=1
|
||||
# @see dlog_init()
|
||||
|
||||
|
||||
## @brief Initializes Dracut Logger.
|
||||
## @brief Initializes dracut Logger.
|
||||
#
|
||||
# @retval 1 if something has gone wrong
|
||||
# @retval 0 on success.
|
||||
@@ -116,7 +116,7 @@ dlog_init() {
|
||||
|
||||
if [ -z "$fileloglvl" ]; then
|
||||
[ -w "$logfile" ] && fileloglvl=4 || fileloglvl=0
|
||||
elif (( $fileloglvl >= 0 )); then
|
||||
elif (( $fileloglvl > 0 )); then
|
||||
__oldumask=$(umask)
|
||||
umask 0377
|
||||
! [ -e "$logfile" ] && >"$logfile"
|
||||
@@ -138,7 +138,7 @@ dlog_init() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( $sysloglvl >= 0 )); then
|
||||
if (( $sysloglvl > 0 )); then
|
||||
if ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null
|
||||
then
|
||||
# We cannot log to syslog, so turn this facility off.
|
||||
@@ -148,7 +148,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
|
||||
|
@@ -8,7 +8,7 @@
|
||||
[Unit]
|
||||
Description=Restore /run/initramfs
|
||||
After=getty@tty1.service prefdm.service
|
||||
Before=reboot.service shutdown.target
|
||||
Before=systemd-reboot.service shutdown.target
|
||||
DefaultDependencies=no
|
||||
ConditionPathExists=/run/initramfs/.need_shutdown
|
||||
ConditionPathExists=!/run/initramfs/bin/sh
|
||||
|
127
dracut.8.asc
127
dracut.8.asc
@@ -14,6 +14,12 @@ SYNOPSIS
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
Create an initramfs <image> for the kernel with the version <kernel version>.
|
||||
If <kernel version> is omitted, then the version of the actual running
|
||||
kernel is used. If <image> is omitted or empty, then the default location
|
||||
/boot/initramfs-<kernel version>.img is used.
|
||||
|
||||
dracut creates an initial image used by the kernel for preloading the block
|
||||
device modules (such as IDE, SCSI or RAID) which are needed to access the root
|
||||
filesystem, mounting the root filesystem and booting into the real system.
|
||||
@@ -22,10 +28,72 @@ At boot time, the kernel unpacks that archive into RAM disk, mounts and uses it
|
||||
as initial root file system. All finding of the root device happens in this
|
||||
early userspace.
|
||||
|
||||
For a complete list of kernel command line options see *dracut.cmdline*(7)
|
||||
For a complete list of kernel command line options see *dracut.cmdline*(7).
|
||||
|
||||
If you are dropped to an emergency shell, while booting your initramfs,
|
||||
the file _/run/initramfs/sosreport.txt_ is created, which can be safed to a
|
||||
(to be mounted by hand) partition (usually /boot) or a USB stick.
|
||||
Additional debugging info can be produced by adding **rd.debug** to the kernel command line.
|
||||
_/run/initramfs/sosreport.txt_ contains all logs and the output of some tools.
|
||||
It should be attached to any report about dracut problems.
|
||||
|
||||
EXAMPLE
|
||||
-------
|
||||
|
||||
To create a initramfs image, the most simple command is:
|
||||
----
|
||||
# dracut
|
||||
----
|
||||
|
||||
This will generate a general purpose initramfs image, with all possible
|
||||
functionality resulting of the combination of the installed dracut modules and
|
||||
system tools. The image is /boot/initramfs-_++<kernel version>++_.img and
|
||||
contains the kernel modules of the currently active kernel with version
|
||||
_++<kernel version>++_.
|
||||
|
||||
If the initramfs image already exists, dracut will display an error message, and
|
||||
to overwrite the existing image, you have to use the --force option.
|
||||
----
|
||||
# dracut --force
|
||||
----
|
||||
|
||||
If you want to specify another filename for the resulting image you would issue
|
||||
a command like:
|
||||
----
|
||||
# dracut foobar.img
|
||||
----
|
||||
|
||||
To generate an image for a specific kernel version, the command would be:
|
||||
----
|
||||
# dracut foobar.img 2.6.40-1.rc5.f20
|
||||
----
|
||||
|
||||
A shortcut to generate the image at the default location for a specific kernel
|
||||
version is:
|
||||
----
|
||||
# dracut --kver 2.6.40-1.rc5.f20
|
||||
----
|
||||
|
||||
If you want to create lighter, smaller initramfs images, you may want to specify
|
||||
the --host-only or -H option. Using this option, the resulting image will
|
||||
contain only those dracut modules, kernel modules and filesystems, which are
|
||||
needed to boot this specific machine. This has the drawback, that you can't put
|
||||
the disk on another controller or machine, and that you can't switch to another
|
||||
root filesystem, without recreating the initramfs image. The usage of the
|
||||
--host-only option is only for experts and you will have to keep the broken
|
||||
pieces. At least keep a copy of a general purpose image (and corresponding
|
||||
kernel) as a fallback to rescue your system.
|
||||
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
**--kver** _<kernel version>_::
|
||||
set the kernel version. This enables to specify the kernel version, without
|
||||
specifying the location of the initramfs image. For example:
|
||||
----
|
||||
# dracut --kver 3.5.0-0.rc7.git1.2.fc18.x86_64
|
||||
----
|
||||
|
||||
**-f, --force**::
|
||||
overwrite existing initramfs file.
|
||||
|
||||
@@ -46,7 +114,7 @@ example:
|
||||
**-o, --omit** _<list of dracut modules>_::
|
||||
omit a space-separated list of dracut modules. This parameter can be
|
||||
specified multiple times.
|
||||
|
||||
+
|
||||
[NOTE]
|
||||
===============================
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes. For
|
||||
@@ -130,7 +198,7 @@ example:
|
||||
specify a space-separated list of kernel filesystem modules to exclusively
|
||||
include in the generic initramfs. This parameter can be specified multiple
|
||||
times.
|
||||
|
||||
+
|
||||
[NOTE]
|
||||
===============================
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes. For
|
||||
@@ -147,6 +215,10 @@ example:
|
||||
specify additional directories, where to look for firmwares. This parameter
|
||||
can be specified multiple times.
|
||||
|
||||
**--kernel-cmdline <parameters>**::
|
||||
specify default kernel command line parameters
|
||||
|
||||
|
||||
**--kernel-only**::
|
||||
only install kernel drivers and firmware files
|
||||
|
||||
@@ -188,6 +260,12 @@ example:
|
||||
**--nostrip**::
|
||||
do not strip binaries in the initramfs
|
||||
|
||||
**--hardlink**::
|
||||
hardlink files in the initramfs (default)
|
||||
|
||||
**--nohardlink**::
|
||||
do not hardlink files in the initramfs
|
||||
|
||||
**--prefix** _<dir>_::
|
||||
prefix initramfs files with the specified directory
|
||||
|
||||
@@ -241,7 +319,7 @@ If chrooted to another root other than the real root device, use "--fstab" and
|
||||
provide a valid _/etc/fstab_.
|
||||
====
|
||||
|
||||
**--no-hostonly**::
|
||||
**-N, --no-hostonly**::
|
||||
Disable Host-Only mode
|
||||
|
||||
**--fstab**::
|
||||
@@ -254,6 +332,12 @@ provide a valid _/etc/fstab_.
|
||||
Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ and _<filesystem
|
||||
options>_ in the initramfs
|
||||
|
||||
**--add-device** _<device>_ ::
|
||||
Bring up _<device>_ in initramfs, _<device>_ should be the device name.
|
||||
This can be useful in hostonly mode for resume support when your swap is on
|
||||
LVM or an encrypted partition.
|
||||
[NB --device can be used for compatibility with earlier releases]
|
||||
|
||||
**-i, --include** _<SOURCE>_ _<TARGET>_::
|
||||
include the files in the SOURCE directory into the
|
||||
TARGET directory in the final initramfs. If SOURCE is a file, it will be
|
||||
@@ -267,7 +351,6 @@ provide a valid _/etc/fstab_.
|
||||
===============================
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes. For
|
||||
example:
|
||||
+
|
||||
----
|
||||
# dracut --install "/bin/foo /sbin/bar" ...
|
||||
----
|
||||
@@ -326,6 +409,10 @@ will not be able to boot. Equivalent to "--compress=xz --check=crc32
|
||||
**--keep**::
|
||||
Keep the initramfs temporary directory for debugging purposes.
|
||||
|
||||
**--regenerate-all**::
|
||||
Regenerate all initramfs images at the default location with the kernel versions found on the system.
|
||||
Additional parameters are passed through.
|
||||
|
||||
FILES
|
||||
-----
|
||||
_/var/log/dracut.log_::
|
||||
@@ -341,6 +428,9 @@ _/etc/dracut.conf_::
|
||||
_/etc/dracut.conf.d/*.conf_::
|
||||
see dracut.conf5
|
||||
|
||||
_/usr/lib/dracut/dracut.conf.d/*.conf_::
|
||||
see dracut.conf5
|
||||
|
||||
Configuration in the initramfs
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
_/etc/conf.d/_::
|
||||
@@ -349,6 +439,9 @@ _/etc/conf.d/_::
|
||||
set in the configuration files.
|
||||
|
||||
_/etc/cmdline_::
|
||||
Can contain additional command line options. Deprecated, better use /etc/cmdline.d/*.conf.
|
||||
|
||||
_/etc/cmdline.d/*.conf::
|
||||
Can contain additional command line options.
|
||||
|
||||
AVAILABILITY
|
||||
@@ -358,29 +451,21 @@ link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]
|
||||
|
||||
AUTHORS
|
||||
-------
|
||||
*Harald Hoyer*::
|
||||
Project Leader and Developer
|
||||
Harald Hoyer
|
||||
|
||||
*Victor Lowther*::
|
||||
Developer
|
||||
Victor Lowther
|
||||
|
||||
*Philippe Seewer*::
|
||||
Developer
|
||||
Philippe Seewer
|
||||
|
||||
*Warren Togami*::
|
||||
Developer
|
||||
Warren Togami
|
||||
|
||||
*Amadeusz Żołnowski*::
|
||||
Developer
|
||||
Amadeusz Żołnowski
|
||||
|
||||
*Jeremy Katz*::
|
||||
Developer
|
||||
Jeremy Katz
|
||||
|
||||
*David Dillow*::
|
||||
Developer
|
||||
David Dillow
|
||||
|
||||
*Will Woods*::
|
||||
Developer
|
||||
Will Woods
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
|
94
dracut.asc
94
dracut.asc
@@ -79,7 +79,7 @@ udev pulls in modules matching the computer's detected hardware.
|
||||
initialized and a user-space helper started to paint animations onto the display
|
||||
in lockstep with the boot process.
|
||||
|
||||
* If the root file system is on NFS, dracut does then:
|
||||
* If the root file system is on NFS, dracut does then:
|
||||
** Bring up the primary network interface.
|
||||
** Invoke a DHCP client, with which it can obtain a DHCP lease.
|
||||
** Extract the name of the NFS share and the address of the NFS server from the
|
||||
@@ -120,6 +120,29 @@ final cleanup tasks. On an initramfs, the initial root file system cannot be
|
||||
rotated away. Instead, it is simply emptied and the final root file system
|
||||
mounted over the top.
|
||||
|
||||
If the systemd module is used in the initramfs, the ordering of the services
|
||||
started looks like <<dracutbootup7>>.
|
||||
|
||||
== Dracut on shutdown
|
||||
|
||||
On a systemd driven system, the dracut initramfs is also used for the shutdown procedure.
|
||||
|
||||
The following steps are executed during a shutdown:
|
||||
|
||||
* systemd switches to the shutdown.target
|
||||
* systemd starts /lib/systemd/system/shutdown.target.wants/dracut-shutdown.service
|
||||
* dracut-shutdown.service executes /usr/lib/dracut/dracut-initramfs-restore
|
||||
which unpacks the initramfs to /run/initramfs
|
||||
* systemd finishes shutdown.target
|
||||
* systemd kills all processes
|
||||
* systemd tries to unmount everything and mounts the remaining read-only
|
||||
* systemd checks, if there is a /run/initramfs/shutdown executable
|
||||
* if yes, it does a pivot_root to /run/initramfs and executes ./shutdown.
|
||||
The old root is then mounted on /oldroot. /usr/lib/dracut/modules.d/99shutdown/shutdown.sh is the shutdown executable.
|
||||
* shutdown will try to umount every /oldroot mount and calls the various shutdown hooks from the dracut modules
|
||||
|
||||
This ensures, that all devices are disassembled and unmounted cleanly.
|
||||
|
||||
= User Manual
|
||||
|
||||
== Creating an initramfs Image
|
||||
@@ -154,7 +177,7 @@ To generate an image for a specific kernel version, the command would be:
|
||||
A shortcut to generate the image at the default location for a specific kernel
|
||||
version is:
|
||||
----
|
||||
# dracut '' 2.6.40-1.rc5.f20
|
||||
# dracut --kver 2.6.40-1.rc5.f20
|
||||
----
|
||||
|
||||
If you want to create lighter, smaller initramfs images, you may want to specify
|
||||
@@ -328,25 +351,28 @@ To add your own files to the initramfs image, you have several possibilities.
|
||||
|
||||
The --include option let you specify a source path and a target path. For example
|
||||
----
|
||||
# dracut --include cmdline-preset /etc/cmdline initramfs-cmdline-pre.img
|
||||
# dracut --include cmdline-preset /etc/cmdline.d/mycmdline.conf initramfs-cmdline-pre.img
|
||||
----
|
||||
will create an initramfs image, where the file cmdline-preset will be copied
|
||||
inside the initramfs to _/etc/cmdline_. --include can only be specified once.
|
||||
inside the initramfs to _/etc/cmdline.d/mycmdline.conf_. --include can only be specified once.
|
||||
|
||||
|
||||
----
|
||||
# mkdir rd.live.overlay
|
||||
# mkdir rd.live.overlay/etc
|
||||
# mkdir rd.live.overlay/etc/conf.d
|
||||
# echo "ip=auto" >> rd.live.overlay/etc/cmdline
|
||||
# echo export TESTVAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
|
||||
# echo export TESTVAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
|
||||
# mkdir rd.live.overlay/etc/cmdline.d
|
||||
# echo "ip=auto" >> rd.live.overlay/etc/cmdline.d/mycmdline.conf
|
||||
# echo export FOO=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
|
||||
# echo export BAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
|
||||
# tree rd.live.overlay/
|
||||
rd.live.overlay/
|
||||
└── etc
|
||||
├── cmdline
|
||||
└── conf.d
|
||||
└── testvar.conf
|
||||
├── cmdline.d
|
||||
│ └── mycmdline.conf
|
||||
└── conf.d
|
||||
└── testvar.conf
|
||||
|
||||
# dracut --include rd.live.overlay / initramfs-rd.live.overlay.img
|
||||
----
|
||||
|
||||
@@ -388,12 +414,12 @@ How to setup your PXE/TFTP server can be found in the
|
||||
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/[Red
|
||||
Hat Enterprise Linux Storage Administration Guide].
|
||||
|
||||
If you specify rd.ip=auto on the kernel command line, then dracut asks a dhcp
|
||||
If you specify ip=auto on the kernel command line, then dracut asks a dhcp
|
||||
server about the ip adress for the machine. The dhcp server can also serve an
|
||||
additional root-path, which will set the root device for dracut. With this
|
||||
mechanism, you have static configuration on your client machine and a
|
||||
centralized boot configuration on your TFTP/DHCP server. If you can't pass a
|
||||
kernel command line, then you can inject _/etc/cmdline_, with a method described
|
||||
kernel command line, then you can inject _/etc/cmdline.d/mycmdline.conf_, with a method described
|
||||
in <<Injecting>>.
|
||||
|
||||
|
||||
@@ -459,6 +485,14 @@ dracut shell commands are printed as they are executed
|
||||
# less /run/initramfs/init.log
|
||||
# dmesg | less
|
||||
----
|
||||
. With dracut >= 022 and systemd, you can inspect the rd.debug output with:
|
||||
----
|
||||
# journalctl -ab
|
||||
----
|
||||
. With dracut >= 025 the file /run/initramfs/sosreport.txt is generated, which contains all the logs and the output of all significant tools, which are mentioned later.
|
||||
|
||||
If you want to save that output, simply mount /boot by hand or insert an USB stick and mount that.
|
||||
Then you can store the output for later inspection.
|
||||
|
||||
[[information-to-include-in-your-report]]
|
||||
=== Information to include in your report
|
||||
@@ -472,7 +506,7 @@ configuration file (e.g. _/etc/grub.conf_) or from _/proc/cmdline_.
|
||||
* A copy of your disk partition information from _/etc/fstab_, which might be
|
||||
obtained booting an old working initramfs or a rescue medium.
|
||||
* A device listing from device-mapper. This can be obtained by running the
|
||||
command
|
||||
command
|
||||
+
|
||||
----
|
||||
# dmsetup ls --tree
|
||||
@@ -500,19 +534,19 @@ all files in _/etc/dracut.conf.d/*.conf_
|
||||
As well as the information from <<all-bug-reports>> include the following
|
||||
information:
|
||||
|
||||
* Include physical volume information by running the command:
|
||||
* Include physical volume information by running the command:
|
||||
+
|
||||
----
|
||||
# lvm pvdisplay
|
||||
----
|
||||
+
|
||||
* Include volume group information by running the command:
|
||||
* Include volume group information by running the command:
|
||||
+
|
||||
----
|
||||
# lvm vgdisplay
|
||||
----
|
||||
+
|
||||
* Include logical volume information by running the command:
|
||||
* Include logical volume information by running the command:
|
||||
+
|
||||
----
|
||||
# lvm lvdisplay
|
||||
@@ -523,7 +557,7 @@ information:
|
||||
As well as the information from <<all-bug-reports>>, include the following
|
||||
information:
|
||||
|
||||
* If using software RAID disk partitions, please include the output of
|
||||
* If using software RAID disk partitions, please include the output of
|
||||
+
|
||||
----
|
||||
# cat /proc/mdstat
|
||||
@@ -602,7 +636,7 @@ will put it out on the console when it reaches the kernel buffer by doing
|
||||
[[using-the-dracut-shell]]
|
||||
==== Using the dracut shell
|
||||
|
||||
Dracut offers a shell for interactive debugging in the event dracut fails to
|
||||
dracut offers a shell for interactive debugging in the event dracut fails to
|
||||
locate your root filesystem. To enable the shell:
|
||||
|
||||
. Add the boot parameter ''rd.shell'' to your bootloader configuration file
|
||||
@@ -628,7 +662,7 @@ title Fedora (2.6.29.5-191.fc11.x86_64)
|
||||
No root device found
|
||||
Dropping to debug shell.
|
||||
|
||||
#
|
||||
#
|
||||
----
|
||||
+
|
||||
. Use this shell prompt to gather the information requested above (see <<all-bug-reports>>).
|
||||
@@ -648,7 +682,7 @@ The exact method for locating and preparing will vary. However, to continue with
|
||||
a successful boot, the objective is to locate your root volume and create a
|
||||
symlink _/dev/root_ which points to the file system. For example, the following
|
||||
example demonstrates accessing and booting a root volume that is an encrypted
|
||||
LVM Logical volume.
|
||||
LVM Logical volume.
|
||||
|
||||
. Inspect your partitions using parted
|
||||
+
|
||||
@@ -664,7 +698,7 @@ Number Start End Size Type File system Flags
|
||||
----
|
||||
+
|
||||
. You recall that your root volume was a LVM logical volume. Scan and activate
|
||||
any logical volumes.
|
||||
any logical volumes.
|
||||
+
|
||||
----
|
||||
# lvm vgscan
|
||||
@@ -690,7 +724,7 @@ Installation Guide, you unlock your encrypted root volume.
|
||||
# UUID=$(cryptsetup luksUUID /dev/mapper/linux-root)
|
||||
# cryptsetup luksOpen /dev/mapper/linux-root luks-$UUID
|
||||
Enter passphrase for /dev/mapper/linux-root:
|
||||
Key slot 0 unlocked.
|
||||
Key slot 0 unlocked.
|
||||
----
|
||||
+
|
||||
. Next, make a symbolic link to the unlocked root volume
|
||||
@@ -749,7 +783,7 @@ processes, and switches to the real root device for further booting. dracut
|
||||
modules can insert custom script at various points, to control the boot process.
|
||||
These hooks are plain directories containing shell scripts ending with ".sh",
|
||||
which are sourced by init.
|
||||
Common used functions are in _dracut-lib.sh_, which can be sourced by any script.
|
||||
Common used functions are in _dracut-lib.sh_, which can be sourced by any script.
|
||||
|
||||
|
||||
|
||||
@@ -798,7 +832,7 @@ udevadm.
|
||||
=== Trigger Udev
|
||||
|
||||
udev is triggered by calling udevadm trigger, which sends add events for all
|
||||
devices and subsystems.
|
||||
devices and subsystems.
|
||||
|
||||
|
||||
|
||||
@@ -878,7 +912,6 @@ still running from the initramfs should not have any open file descriptors left.
|
||||
|
||||
== Network Infrastructure
|
||||
|
||||
|
||||
FIXME
|
||||
|
||||
|
||||
@@ -997,13 +1030,11 @@ instmods
|
||||
|
||||
=== Creation Functions
|
||||
|
||||
|
||||
FIXME
|
||||
|
||||
|
||||
=== Initramfs Functions
|
||||
|
||||
|
||||
FIXME
|
||||
|
||||
|
||||
@@ -1011,6 +1042,9 @@ FIXME
|
||||
|
||||
FIXME
|
||||
|
||||
:leveloffset: 1
|
||||
[[dracutbootup7]]
|
||||
include::dracut.bootup.7.asc[]
|
||||
|
||||
:leveloffset: 1
|
||||
[[dracut8]]
|
||||
@@ -1022,6 +1056,12 @@ include::dracut.conf.5.asc[]
|
||||
[[dracutcmdline7]]
|
||||
include::dracut.cmdline.7.asc[]
|
||||
|
||||
[[lsinitrd1]]
|
||||
include::lsinitrd.1.asc[]
|
||||
|
||||
[[mkinitrd8]]
|
||||
include::mkinitrd.8.asc[]
|
||||
|
||||
:leveloffset: 0
|
||||
[appendix]
|
||||
License
|
||||
|
122
dracut.bootup.7.asc
Normal file
122
dracut.bootup.7.asc
Normal file
@@ -0,0 +1,122 @@
|
||||
DRACUT.BOOTUP(7)
|
||||
================
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
|
||||
NAME
|
||||
----
|
||||
dracut.bootup - boot ordering in the initramfs
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
This flow chart illustrates the ordering of the services, if systemd is used in the dracut initramfs.
|
||||
----
|
||||
|
||||
systemd-journal.socket
|
||||
|
|
||||
v
|
||||
dracut-cmdline.service
|
||||
|
|
||||
v
|
||||
dracut-pre-udev.service
|
||||
|
|
||||
v
|
||||
systemd-udevd.service
|
||||
|
|
||||
v
|
||||
local-fs-pre.target dracut-pre-trigger.service
|
||||
| |
|
||||
v v
|
||||
(various mounts) (various swap systemd-udev-trigger.service
|
||||
| devices...) | (various low-level (various low-level
|
||||
| | | services: seed, API VFS mounts:
|
||||
v v v tmpfiles, random mqueue, configfs,
|
||||
local-fs.target swap.target dracut-initqueue.service sysctl, ...) debugfs, ...)
|
||||
| | | | |
|
||||
\_______________|____________________ | ___________________|____________________/
|
||||
\|/
|
||||
v
|
||||
sysinit.target
|
||||
|
|
||||
_________________/|\___________________
|
||||
/ | \
|
||||
| | |
|
||||
v | v
|
||||
(various | rescue.service
|
||||
sockets...) | |
|
||||
| | v
|
||||
v | rescue.target
|
||||
sockets.target |
|
||||
| |
|
||||
\_________________ | emergency.service
|
||||
\| |
|
||||
v v
|
||||
basic.target emergency.target
|
||||
|
|
||||
______________________/|
|
||||
/ |
|
||||
| v
|
||||
| dracut-pre-mount.service
|
||||
| |
|
||||
| v
|
||||
| sysroot.mount
|
||||
| |
|
||||
| v
|
||||
| initrd-root-fs.target
|
||||
(custom initrd services) |
|
||||
| v
|
||||
| dracut-mount.service
|
||||
| |
|
||||
| v
|
||||
| initrd-parse-etc.service
|
||||
| |
|
||||
| v
|
||||
| (sysroot-usr.mount and
|
||||
| various mounts marked
|
||||
| with fstab option
|
||||
| x-initrd.mount)
|
||||
| |
|
||||
| v
|
||||
| initrd-fs.target
|
||||
\______________________ |
|
||||
\|
|
||||
v
|
||||
initrd.target
|
||||
|
|
||||
v
|
||||
dracut-pre-pivot.service
|
||||
|
|
||||
v
|
||||
initrd-cleanup.service
|
||||
isolates to
|
||||
initrd-switch-root.target
|
||||
|
|
||||
v
|
||||
______________________/|
|
||||
/ |
|
||||
| initrd-udevadm-cleanup-db.service
|
||||
| |
|
||||
(custom initrd services) |
|
||||
| |
|
||||
\______________________ |
|
||||
\|
|
||||
v
|
||||
initrd-switch-root.target
|
||||
|
|
||||
v
|
||||
initrd-switch-root.service
|
||||
|
|
||||
v
|
||||
switch-root
|
||||
----
|
||||
|
||||
|
||||
AUTHOR
|
||||
------
|
||||
Harald Hoyer
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
*dracut*(8) *bootup*(7)
|
@@ -61,11 +61,24 @@ rootfstype=ext3
|
||||
_/etc/fstab_ of the real root will be parsed for special mount options and
|
||||
mounted accordingly.
|
||||
|
||||
**ro**::
|
||||
force mounting _/_ and _/usr_ (if it is a separate device) read-only. If
|
||||
none of ro and rw is present, both are mounted according to _/etc/fstab_.
|
||||
|
||||
**rw**::
|
||||
force mounting _/_ and _/usr_ (if it is a separate device) read-write.
|
||||
See also ro option.
|
||||
|
||||
**rd.auto** **rd.auto=1**::
|
||||
enable autoassembly of special devices like cryptoLUKS, dmraid, mdraid or lvm.
|
||||
Default is off as of dracut version >= 024.
|
||||
|
||||
**rd.fstab=0**::
|
||||
do not honor special mount options for the root filesystem found in
|
||||
_/etc/fstab_ of the real root.
|
||||
|
||||
**resume=**_<path to resume partition>_
|
||||
**resume=**_<path to resume partition>_::
|
||||
resume from a swap partition
|
||||
+
|
||||
E.g.:
|
||||
+
|
||||
@@ -75,6 +88,11 @@ resume=/dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
||||
resume=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
||||
----
|
||||
|
||||
**rd.skipfsck**::
|
||||
skip fsck for rootfs and _/usr_. If you're mounting _/usr_ read-only and
|
||||
the init system performs fsck before remount, you might want to use this
|
||||
option to avoid duplication.
|
||||
|
||||
|
||||
Misc
|
||||
~~~~
|
||||
@@ -90,9 +108,28 @@ Misc
|
||||
force loading kernel module <drivername> after all automatic loading modules
|
||||
have been loaded. This parameter can be specified multiple times.
|
||||
|
||||
**rd.retry=**_<seconds>_::
|
||||
specify how long dracut should wait for devices to appear.
|
||||
The default is 30 seconds. After 2/3 of the time, degraded raids are force
|
||||
started. If you have hardware, which takes a very long time to announce its
|
||||
drives, you might want to extend this value.
|
||||
|
||||
**rd.noverifyssl**::
|
||||
accept self-signed certificates for ssl downloads.
|
||||
|
||||
**rd.ctty=**_<terminal device>_**::
|
||||
specify the controlling terminal for the console.
|
||||
This is useful, if you have multiple "console=" arguments.
|
||||
|
||||
[[dracutkerneldebug]]
|
||||
Debug
|
||||
~~~~~
|
||||
If you are dropped to an emergency shell, the file _/run/initramfs/sosreport.txt_ is created,
|
||||
which can be safed to a (to be mounted by hand) partition (usually /boot) or a USB stick.
|
||||
Additional debugging info can be produced by adding **rd.debug** to the kernel command line.
|
||||
_/run/initramfs/sosreport.txt_ contains all logs and the output of some tools.
|
||||
It should be attached to any report about dracut problems.
|
||||
|
||||
**rd.info**::
|
||||
print informational output though "quiet" is set
|
||||
|
||||
@@ -100,8 +137,19 @@ Debug
|
||||
allow dropping to a shell, if root mounting fails
|
||||
|
||||
**rd.debug**::
|
||||
set -x for the dracut shell and logs to dmesg, console and
|
||||
_/run/initramfs/init.log_
|
||||
set -x for the dracut shell.
|
||||
If systemd is active in the initramfs, all output is logged to the systemd journal,
|
||||
which you can inspect with "journalctl -ab".
|
||||
If systemd is not active, the logs are written to dmesg and _/run/initramfs/init.log_.
|
||||
If "quiet" is set, it also logs to the console.
|
||||
|
||||
**rd.memdebug=[0-3]**::
|
||||
Print memory usage info at various points, set the verbose level from 0 to 3
|
||||
Higher level means more debugging output:
|
||||
0 - no output
|
||||
1 - partial /proc/meminfo
|
||||
2 - /proc/meminfo
|
||||
3 - /proc/meminfo + /proc/slabinfo
|
||||
|
||||
**rd.break**::
|
||||
drop to a shell at the end
|
||||
@@ -199,7 +247,7 @@ crypto LUKS
|
||||
LUKS UUID, so you don't have to specify the full UUID.
|
||||
This parameter can be specified multiple times.
|
||||
|
||||
**rd.luks.allow-discards::
|
||||
**rd.luks.allow-discards**::
|
||||
Allow using of discards (TRIM) requests on all LUKS partitions.
|
||||
|
||||
**rd.luks.crypttab=0**::
|
||||
@@ -219,6 +267,29 @@ rd.luks.key=/foo/bar.key
|
||||
----
|
||||
+
|
||||
As you see, you can skip colons in such a case.
|
||||
+
|
||||
[NOTE]
|
||||
===============================
|
||||
dracut pipes key to cryptsetup with _-d -_ argument, therefore you need to pipe
|
||||
to crypsetup luksFormat with _-d -_, too!
|
||||
|
||||
Here follows example for key encrypted with GPG:
|
||||
|
||||
----
|
||||
gpg --quiet --decrypt rootkey.gpg \
|
||||
| cryptsetup -d - -v \
|
||||
--cipher serpent-cbc-essiv:sha256 \
|
||||
--key-size 256 luksFormat /dev/sda3
|
||||
----
|
||||
|
||||
If you use plain keys, just add path to _-d_ option:
|
||||
|
||||
----
|
||||
cryptsetup -d rootkey.key -v \
|
||||
--cipher serpent-cbc-essiv:sha256 \
|
||||
--key-size 256 luksFormat /dev/sda3
|
||||
----
|
||||
===============================
|
||||
|
||||
MD RAID
|
||||
~~~~~~~
|
||||
@@ -285,24 +356,51 @@ Network
|
||||
**ip=**_<interface>_:_{dhcp|on|any|dhcp6|auto6}_[:[_<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
|
||||
<macaddr>::: optionally set <macaddr> on the <interface>
|
||||
<macaddr>::: optionally **set** <macaddr> on the <interface>. This
|
||||
cannot be used in conjunction with the **ifname** argument for the
|
||||
same <interface>.
|
||||
=====================
|
||||
|
||||
[IMPORTANT]
|
||||
=====================
|
||||
It is recommended to either bind <interface> to a MAC with the **ifname**
|
||||
argument. Or use biosdevname to name your interfaces, which will then have names according to their hardware location.
|
||||
|
||||
em<port>::: for embedded NICs
|
||||
p<slot>#<port>_<virtual instance>::: for cards in PCI slots
|
||||
=====================
|
||||
|
||||
**ip=**_<client-IP>_:_<server-IP>_:_<gateway-IP>_:_<netmask>_:_<client_hostname>_:_<interface>_:_{none|off|dhcp|on|any|dhcp6|auto6|ibft}_[:[_<mtu>_][:_<macaddr>_]]::
|
||||
explicit network configuration. If you want do define a IPv6 address, put it
|
||||
in brackets (e.g. [2001:DB8::1]). This parameter can be specified multiple
|
||||
times.
|
||||
+
|
||||
<macaddr>::: optionally set <macaddr> on the <interface>
|
||||
=====================
|
||||
<macaddr>::: optionally **set** <macaddr> on the <interface>. This
|
||||
cannot be used in conjunction with the **ifname** argument for the
|
||||
same <interface>.
|
||||
=====================
|
||||
|
||||
[IMPORTANT]
|
||||
=====================
|
||||
It is recommended to either bind <interface> to a MAC with the **ifname**
|
||||
argument. Or use biosdevname to name your interfaces, which will then have names according to their hardware location.
|
||||
|
||||
em<port>::: for embedded NICs
|
||||
p<slot>#<port>_<virtual instance>::: for cards in PCI slots
|
||||
=====================
|
||||
|
||||
**ifname=**_<interface>_:_<MAC>_::
|
||||
Assign network device name <interface> (ie eth0) to the NIC with MAC <MAC>.
|
||||
Note: If you use this option you _must_ specify an ifname= argument for all
|
||||
interfaces used in ip= or fcoe= arguments. However, if the interface in
|
||||
ip= or fcoe= is a bridge, bonding or vlan interface, you should specify
|
||||
an ifname= for _each_ of its underlying interfaces. This parameter can be
|
||||
specified multiple times.
|
||||
Assign network device name <interface> (ie "bootnet") to the NIC with MAC <MAC>.
|
||||
+
|
||||
[IMPORTANT]
|
||||
|
||||
Do **not** use the default kernel naming scheme for the interface name,
|
||||
as it can conflict with the kernel names. So, don't use "eth[0-9]+" for the
|
||||
interface name. Better name it "bootnet" or "bluesocket".
|
||||
|
||||
**bootdev=**_<interface>_::
|
||||
specify network interface to use routing and netroot information from.
|
||||
@@ -314,6 +412,9 @@ auto6::: do IPv6 autoconfiguration
|
||||
**biosdevname=0**::
|
||||
boolean, turn off biosdevname network interface renaming
|
||||
|
||||
**rd.neednet=1**::
|
||||
boolean, bring up network even without netroot set
|
||||
|
||||
**vlan=_<vlanname>_:_<phydevice>_**::
|
||||
Setup vlan device named <vlanname> on <phydeivce>.
|
||||
We support the four styles of vlan names: VLAN_PLUS_VID (vlan0005), VLAN_PLUS_VID_NO_PAD (vlan5),
|
||||
@@ -327,6 +428,10 @@ auto6::: do IPv6 autoconfiguration
|
||||
then its values should be separated by semicolon.
|
||||
Bond without parameters assumes bond=bond0:eth0,eth1:mode=balance-rr
|
||||
|
||||
**team =_<teammaster>_:_<teamslaves>_**::
|
||||
Setup team device <teammaster> on top of <teamslaves>.
|
||||
<teamslaves> is a comma-separated list of physical (ethernet) interfaces.
|
||||
|
||||
**bridge=_<bridgename>_:_<ethnames>_**::
|
||||
Setup bridge <bridgename> with <ethnames>. <ethnames> is a comma-separated
|
||||
list of physical (ethernet) interfaces. Bridge without parameters assumes bridge=br0:eth0
|
||||
@@ -357,6 +462,31 @@ NFS
|
||||
**rd.nfs.domain=**_<NFSv4 domain name>_::
|
||||
Set the NFSv4 domain name. Will overwrite the settings in _/etc/idmap.conf_.
|
||||
|
||||
CIFS
|
||||
~~~
|
||||
**root=**cifs://[_<username>_[:_<password>_]@]_<server-ip>_:_<root-dir>_::
|
||||
mount cifs share from <server-ip>:/<root-dir>, if no server-ip is given, use
|
||||
dhcp next_server. if server-ip is an IPv6 address it has to be put in
|
||||
brackets, e.g. [2001:DB8::1]. If a username or password are not specified
|
||||
as part of the root, then they must be passed on the command line through
|
||||
cifsuser/cifspass.
|
||||
+
|
||||
[WARNING]
|
||||
====
|
||||
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path.
|
||||
====
|
||||
|
||||
**cifsuser=_<username>_::
|
||||
Set the cifs username, if not specified as part of the root.
|
||||
|
||||
**cifspass=_<password>_::
|
||||
Set the cifs password, if not specified as part of the root.
|
||||
+
|
||||
[WARNING]
|
||||
====
|
||||
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path.
|
||||
====
|
||||
|
||||
iSCSI
|
||||
~~~~~
|
||||
**root=**iscsi:[_<username>_:_<password>_[:_<reverse>_:_<password>_]@][_<servername>_]:[_<protocol>_]:[_<port>_][:[_<iscsi_iface_name>_]:[_<netdev_name>_]]:[_<LUN>_]:_<targetname>_::
|
||||
@@ -378,6 +508,11 @@ If servername is an IPv6 address, it has to be put in brackets. e.g.:
|
||||
----
|
||||
root=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0
|
||||
----
|
||||
+
|
||||
[WARNING]
|
||||
====
|
||||
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path.
|
||||
====
|
||||
|
||||
**root=**_???_ **netroot=**iscsi:[_<username>_:_<password>_[:_<reverse>_:_<password>_]@][_<servername>_]:[_<protocol>_]:[_<port>_][:[_<iscsi_iface_name>_]:[_<netdev_name>_]]:[_<LUN>_]:_<targetname>_ ...::
|
||||
multiple netroot options allow setting up multiple iscsi disks. e.g.:
|
||||
@@ -393,9 +528,19 @@ If servername is an IPv6 address, it has to be put in brackets. e.g.:
|
||||
----
|
||||
netroot=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0
|
||||
----
|
||||
+
|
||||
[WARNING]
|
||||
====
|
||||
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path. You may want to use rd.iscsi.firmware.
|
||||
====
|
||||
|
||||
**root=**_???_ **rd.iscsi.initiator=**_<initiator>_ **rd.iscsi.target.name=**_<target name>_ **rd.iscsi.target.ip=**_<target ip>_ **rd.iscsi.target.port=**_<target port>_ **rd.iscsi.target.group=**_<target group>_ **rd.iscsi.username=**_<username>_ **rd.iscsi.password=**_<password>_ **rd.iscsi.in.username=**_<in username>_ **rd.iscsi.in.password=**_<in password>_::
|
||||
manually specify all iscsistart parameter (see **+iscsistart --help+**)
|
||||
+
|
||||
[WARNING]
|
||||
====
|
||||
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path. You may want to use rd.iscsi.firmware.
|
||||
====
|
||||
|
||||
**root=**_???_ **netroot=**iscsi **rd.iscsi.firmware=1**::
|
||||
will read the iscsi parameter from the BIOS firmware
|
||||
@@ -406,7 +551,7 @@ netroot=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0
|
||||
e.g.:
|
||||
+
|
||||
----
|
||||
"netroot=iscsi iscsi_firmware rd.iscsi.param=node.session.timeo.replacement_timeout=30"
|
||||
"netroot=iscsi rd.iscsi.firmware=1 rd.iscsi.param=node.session.timeo.replacement_timeout=30"
|
||||
----
|
||||
+
|
||||
will result in
|
||||
@@ -420,8 +565,10 @@ FCoE
|
||||
**fcoe=**_<edd|interface|MAC>_:_{dcb|nodcb}_::
|
||||
Try to connect to a FCoE SAN through the NIC specified by _<interface>_ or
|
||||
_<MAC>_ or EDD settings. For the second argument, currently only nodcb is
|
||||
supported. This parameter can be specified multiple times. Note: letters in
|
||||
the MAC-address must be lowercase!
|
||||
supported. This parameter can be specified multiple times.
|
||||
+
|
||||
[NOTE]
|
||||
letters in the MAC-address must be lowercase!
|
||||
|
||||
NBD
|
||||
~~~
|
||||
@@ -457,7 +604,7 @@ ZNET
|
||||
+
|
||||
----
|
||||
rd.znet=qeth,0.0.0600,0.0.0601,0.0.0602,layer2=1,portname=foo
|
||||
rd.znet=ctc,0.0.0600,0.0.0601,0.0.0602,protocol=bar
|
||||
rd.znet=ctc,0.0.0600,0.0.0601,protocol=bar
|
||||
----
|
||||
|
||||
Plymouth Boot Splash
|
||||
@@ -634,15 +781,14 @@ _/etc/conf.d/_::
|
||||
set in the configuration files.
|
||||
|
||||
_/etc/cmdline_::
|
||||
Can contain additional command line options.
|
||||
Can contain additional command line options. Deprecated, better use /etc/cmdline.d/*.conf.
|
||||
|
||||
_/etc/cmdline.d/*.conf_::
|
||||
Can contain additional command line options.
|
||||
|
||||
AUTHOR
|
||||
------
|
||||
*Harald Hoyer*::
|
||||
Project Leader and Developer
|
||||
Harald Hoyer
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
|
17
dracut.conf
17
dracut.conf
@@ -1,21 +1,21 @@
|
||||
# PUT YOUR CONFIG HERE OR IN separate files named *.conf
|
||||
# in /etc/dracut.conf.d
|
||||
# /etc/dracut.conf.d/*.conf will override the settings in here
|
||||
# SEE man dracut.conf(5)
|
||||
|
||||
# Sample dracut config file
|
||||
|
||||
logfile=/var/log/dracut.log
|
||||
fileloglvl=6
|
||||
#logfile=/var/log/dracut.log
|
||||
#fileloglvl=6
|
||||
|
||||
# Exact list of dracut modules to use. Modules not listed here are not going
|
||||
# to be included. If you only want to add some optional modules use
|
||||
# add_dracutmodules option instead.
|
||||
#dracutmodules+=""
|
||||
|
||||
# Dracut modules to omit
|
||||
# dracut modules to omit
|
||||
#omit_dracutmodules+=""
|
||||
|
||||
# Dracut modules to add to the default
|
||||
# dracut modules to add to the default
|
||||
#add_dracutmodules+=""
|
||||
|
||||
# additional kernel modules to the default
|
||||
@@ -29,10 +29,10 @@ fileloglvl=6
|
||||
#
|
||||
|
||||
# install local /etc/mdadm.conf
|
||||
mdadmconf="yes"
|
||||
#mdadmconf="no"
|
||||
|
||||
# install local /etc/lvm/lvm.conf
|
||||
lvmconf="yes"
|
||||
#lvmconf="no"
|
||||
|
||||
# A list of fsck tools to install. If it's not specified, module's hardcoded
|
||||
# default is used, currently: "umount mount /sbin/fsck* xfs_db xfs_check
|
||||
@@ -43,6 +43,9 @@ lvmconf="yes"
|
||||
# inhibit installation of any fsck tools
|
||||
#nofscks="yes"
|
||||
|
||||
# mount / and /usr read-only by default
|
||||
#ro_mnt="no"
|
||||
|
||||
# set the directory for temporary files
|
||||
# default: /var/tmp
|
||||
#tmpdir=/tmp
|
||||
|
@@ -10,17 +10,24 @@ dracut.conf - configuration file(s) for dracut
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
_/etc/dracut.conf_ _/etc/dracut.conf.d/*.conf_
|
||||
_/etc/dracut.conf_ _/etc/dracut.conf.d/*.conf_ _/usr/lib/dracut/dracut.conf.d/*.conf_
|
||||
|
||||
Description
|
||||
-----------
|
||||
_dracut.conf_ is loaded during the initialisation phase of dracut. Command line
|
||||
parameter will overwrite any values set here. _dracut.conf.d/*.conf_ files are
|
||||
read in alphanumerical order and will overwrite parameters set in
|
||||
parameter will overwrite any values set here.
|
||||
|
||||
_*.conf_ files are read from /usr/lib/dracut/dracut.conf.d and /etc/dracut.conf.d.
|
||||
Files with the same name in /etc/dracut.conf.d will replace files in /usr/lib/dracut/dracut.conf.d.
|
||||
The files are then read in alphanumerical order and will overwrite parameters set in
|
||||
_/etc/dracut.conf_. Each line specifies an attribute and a value. A '#'
|
||||
indicates the beginning of a comment; following characters, up to the end of the
|
||||
line are not interpreted.
|
||||
|
||||
dracut command line options will overwrite any values set here.
|
||||
|
||||
Configuration files must have the extension .conf; other extensions are ignored.
|
||||
|
||||
*dracutmodules+=*" __<dracut modules>__ "::
|
||||
Specify a space-separated list of dracut modules to call when building the
|
||||
initramfs. Modules are located in _/usr/lib/dracut/modules.d_.
|
||||
@@ -44,10 +51,6 @@ line are not interpreted.
|
||||
Specify a space-separated list of kernel modules not to add to the
|
||||
initramfs. The kernel modules have to be specified without the ".ko" suffix.
|
||||
|
||||
*install_items+=*" __<kernel modules>__ "::
|
||||
Specify a space-separated list of files, which are added to the initramfs
|
||||
image.
|
||||
|
||||
*filesystems+=*" __<filesystem names>__ "::
|
||||
Specify a space-separated list of kernel filesystem modules to exclusively
|
||||
include in the generic initramfs.
|
||||
@@ -82,6 +85,11 @@ If chrooted to another root other than the real root device, use --fstab and pro
|
||||
*add_fstab+=*" __<filename>__ "::
|
||||
Add entries of __<filename>__ to the initramfs /etc/fstab.
|
||||
|
||||
*add_device+=*" __<device>__ "::
|
||||
Bring up _<device>_ in initramfs, _<device>_ should be the device name.
|
||||
This can be useful in hostonly mode for resume support when your swap is on
|
||||
LVM an encrypted partition.
|
||||
|
||||
*mdadmconf=*"__{yes|no}__"::
|
||||
Include local _/etc/mdadm.conf_ (default=yes)
|
||||
|
||||
@@ -97,6 +105,12 @@ If chrooted to another root other than the real root device, use --fstab and pro
|
||||
*nofscks=*"__{yes|no}__"::
|
||||
If specified, inhibit installation of any fsck tools.
|
||||
|
||||
*ro_mnt*
|
||||
Mount _/_ and _/usr_ read-only by default.
|
||||
|
||||
*kernel_cmdline=*"__parameters__"::
|
||||
Specify default kernel command line parameters
|
||||
|
||||
*kernel_only=*"__{yes|no}__"::
|
||||
Only install kernel drivers and firmware files. (default=no)
|
||||
|
||||
@@ -116,16 +130,16 @@ If chrooted to another root other than the real root device, use --fstab and pro
|
||||
Path to log file.
|
||||
|
||||
*show_modules=*"__{yes|no}__"::
|
||||
Print included module's name to standard output during build.
|
||||
Print the name of the included modules to standard output during build.
|
||||
|
||||
Files
|
||||
-----
|
||||
_/etc/dracut.conf_::
|
||||
Old configuration file. You better use your own file in
|
||||
_/etc/dracut/conf.d/_.
|
||||
_/etc/dracut.conf.d/_.
|
||||
|
||||
_/etc/dracut/conf.d/_::
|
||||
Any _/etc/dracut/conf.d/*.conf_ file can overwrite the values in
|
||||
_/etc/dracut.conf.d/_::
|
||||
Any _/etc/dracut.conf.d/*.conf_ file can overwrite the values in
|
||||
_/etc/dracut.conf_. The configuration files are read in alphanumerical
|
||||
order.
|
||||
|
||||
|
@@ -1,14 +1,17 @@
|
||||
# Dracut config file customized for RedHat/Fedora.
|
||||
# dracut config file customized for RedHat/Fedora.
|
||||
|
||||
# i18n
|
||||
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
|
||||
omit_dracutmodules+=" dash "
|
||||
omit_drivers+=" .*/fs/ocfs/.* "
|
||||
add_dracutmodules+=" systemd "
|
||||
omit_drivers+=' .*/fs/ocfs/.* i2o_scsi'
|
||||
stdloglvl=3
|
||||
realinitpath="/usr/lib/systemd/systemd"
|
||||
logfile=/var/log/dracut.log
|
||||
fileloglvl=6
|
||||
install_items+=" vi /etc/virc ps grep cat rm "
|
||||
prefix="/"
|
||||
systemdutildir=/usr/lib/systemd
|
||||
systemdsystemunitdir=/usr/lib/systemd/system
|
||||
systemdsystemconfdir=/etc/systemd/system
|
||||
udevdir=/usr/lib/udev
|
||||
add_dracutmodules+=" systemd "
|
||||
hostonly="yes"
|
||||
dracut_rescue_image="yes"
|
||||
|
@@ -1,9 +0,0 @@
|
||||
# /etc/dracut.conf.d/gentoo-openrc.conf
|
||||
# Dracut config file customized for Gentoo Base System release 2
|
||||
|
||||
#
|
||||
# Modules
|
||||
#
|
||||
|
||||
# i18n
|
||||
i18n_vars="/etc/conf.d/keymaps:keymap-KEYMAP,extended_keymaps-EXT_KEYMAPS /etc/conf.d/consolefont:consolefont-FONT,consoletranslation-FONT_MAP /etc/rc.conf:unicode-UNICODE"
|
5
dracut.conf.d/gentoo-systemd.conf.example
Normal file
5
dracut.conf.d/gentoo-systemd.conf.example
Normal file
@@ -0,0 +1,5 @@
|
||||
# /etc/dracut.conf.d/gentoo-systemd.conf
|
||||
|
||||
# Paths of systemd dirs on Gentoo
|
||||
systemdutildir=/usr/lib/systemd
|
||||
systemdsystemunitdir=/usr/lib/systemd/system
|
@@ -1,9 +1,14 @@
|
||||
# /etc/dracut.conf.d/gentoo.conf
|
||||
# Dracut config file customized for Gentoo Base System release 1
|
||||
# dracut config file customized for Gentoo Base System release 2
|
||||
|
||||
udevdir=/lib/udev
|
||||
ro_mnt=yes
|
||||
|
||||
#
|
||||
# Modules
|
||||
#
|
||||
|
||||
# i18n
|
||||
i18n_vars="/etc/conf.d/keymaps:KEYMAP,EXTENDED_KEYMAPS-EXT_KEYMAPS /etc/conf.d/consolefont:CONSOLEFONT-FONT,CONSOLETRANSLATION-FONT_MAP /etc/rc.conf:UNICODE"
|
||||
i18n_vars="/etc/conf.d/keymaps:keymap-KEYMAP,extended_keymaps-EXT_KEYMAPS /etc/conf.d/consolefont:consolefont-FONT,consoletranslation-FONT_MAP /etc/rc.conf:unicode-UNICODE"
|
||||
|
||||
omit_drivers+=" i2o_scsi"
|
||||
|
@@ -1,2 +1,3 @@
|
||||
i18n_vars="/etc/sysconfig/language:RC_LANG-LANG,RC_LC_ALL-LC_ALL /etc/sysconfig/console:CONSOLE_UNICODEMAP-FONT_UNIMAP,CONSOLE_FONT-FONT,CONSOLE_SCREENMAP-FONT_MAP /etc/sysconfig/keyboard:KEYTABLE-KEYMAP"
|
||||
omit_drivers+=" i2o_scsi"
|
||||
|
||||
|
627
dracut.sh
627
dracut.sh
@@ -7,7 +7,7 @@
|
||||
# of the various mkinitrd implementations out there
|
||||
#
|
||||
|
||||
# Copyright 2005-2010 Red Hat, Inc. All rights reserved.
|
||||
# Copyright 2005-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
|
||||
@@ -24,7 +24,7 @@
|
||||
#
|
||||
|
||||
# store for logging
|
||||
dracut_args="$@"
|
||||
dracut_args=( "$@" )
|
||||
|
||||
set -o pipefail
|
||||
|
||||
@@ -36,18 +36,44 @@ usage() {
|
||||
|
||||
# 80x25 linebreak here ^
|
||||
cat << EOF
|
||||
Usage: $0 [OPTION]... <initramfs> <kernel-version>
|
||||
Usage: $0 [OPTION]... [<initramfs> [<kernel-version>]]
|
||||
|
||||
Version: $DRACUT_VERSION
|
||||
|
||||
Creates initial ramdisk images for preloading modules
|
||||
|
||||
-h, --help Display all options
|
||||
|
||||
If a [LIST] has multiple arguments, then you have to put these in quotes.
|
||||
|
||||
For example:
|
||||
|
||||
# dracut --add-drivers "module1 module2" ...
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
long_usage() {
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
if [[ -f $dracutbasedir/dracut-version.sh ]]; then
|
||||
. $dracutbasedir/dracut-version.sh
|
||||
fi
|
||||
|
||||
# 80x25 linebreak here ^
|
||||
cat << EOF
|
||||
Usage: $0 [OPTION]... [<initramfs> [<kernel-version>]]
|
||||
|
||||
Version: $DRACUT_VERSION
|
||||
|
||||
Creates initial ramdisk images for preloading modules
|
||||
|
||||
--kver [VERSION] Set kernel version to [VERSION].
|
||||
-f, --force Overwrite existing initramfs file.
|
||||
-a, --add [LIST] Add a space-separated list of dracut modules.
|
||||
-m, --modules [LIST] Specify a space-separated list of dracut modules to
|
||||
call when building the initramfs. Modules are located
|
||||
in /usr/lib/dracut/modules.d.
|
||||
-o, --omit [LIST] Omit a space-separated list of dracut modules.
|
||||
-a, --add [LIST] Add a space-separated list of dracut modules.
|
||||
-d, --drivers [LIST] Specify a space-separated list of kernel modules to
|
||||
exclusively include in the initramfs.
|
||||
--add-drivers [LIST] Specify a space-separated list of kernel
|
||||
@@ -63,16 +89,20 @@ Creates initial ramdisk images for preloading modules
|
||||
firmwares, separated by :
|
||||
--kernel-only Only install kernel drivers and firmware files
|
||||
--no-kernel Do not install kernel drivers and firmware files
|
||||
--kernel-cmdline [PARAMETERS] Specify default kernel command line parameters
|
||||
--strip Strip binaries in the initramfs
|
||||
--nostrip Do not strip binaries in the initramfs (default)
|
||||
--nostrip Do not strip binaries in the initramfs
|
||||
--hardlink Hardlink files in the initramfs
|
||||
--nohardlink Do not hardlink files in the initramfs
|
||||
--prefix [DIR] Prefix initramfs files with [DIR]
|
||||
--noprefix Do not prefix initramfs files (default)
|
||||
--noprefix Do not prefix initramfs files
|
||||
--mdadmconf Include local /etc/mdadm.conf
|
||||
--nomdadmconf Do not include local /etc/mdadm.conf
|
||||
--lvmconf Include local /etc/lvm/lvm.conf
|
||||
--nolvmconf Do not include local /etc/lvm/lvm.conf
|
||||
--fscks [LIST] Add a space-separated list of fsck helpers.
|
||||
--nofscks Inhibit installation of any fsck helpers.
|
||||
--ro-mnt Mount / and /usr read-only by default.
|
||||
-h, --help This message
|
||||
--debug Output debug information of the build process
|
||||
--profile Output profile information of the build process
|
||||
@@ -81,11 +111,11 @@ Creates initial ramdisk images for preloading modules
|
||||
1 - only fatal errors
|
||||
2 - all errors
|
||||
3 - warnings
|
||||
4 - info (default)
|
||||
4 - info
|
||||
5 - debug info (here starts lots of output)
|
||||
6 - trace info (and even more)
|
||||
-v, --verbose Increase verbosity level (default is info(4))
|
||||
-q, --quiet Decrease verbosity level (default is info(4))
|
||||
-v, --verbose Increase verbosity level
|
||||
-q, --quiet Decrease verbosity level
|
||||
-c, --conf [FILE] Specify configuration file to use.
|
||||
Default: /etc/dracut.conf
|
||||
--confdir [DIR] Specify configuration directory to use *.conf files
|
||||
@@ -98,12 +128,13 @@ Creates initial ramdisk images for preloading modules
|
||||
Useful when running dracut from a git checkout.
|
||||
-H, --hostonly Host-Only mode: Install only what is needed for
|
||||
booting the local host instead of a generic host.
|
||||
--no-hostonly Disables Host-Only mode
|
||||
-N, --no-hostonly Disables Host-Only mode
|
||||
--fstab Use /etc/fstab to determine the root device.
|
||||
--add-fstab [FILE] Add file to the initramfs fstab
|
||||
--mount "[DEV] [MP] [FSTYPE] [FSOPTS]"
|
||||
Mount device [DEV] on mountpoint [MP] with filesystem
|
||||
[FSTYPE] and options [FSOPTS] in the initramfs
|
||||
--add-device "[DEV]" Bring up [DEV] in initramfs
|
||||
-i, --include [SOURCE] [TARGET]
|
||||
Include the files in the SOURCE directory into the
|
||||
Target directory in the final initramfs.
|
||||
@@ -137,8 +168,11 @@ Creates initial ramdisk images for preloading modules
|
||||
--sshkey [SSHKEY] Add ssh key to initramfs (use with ssh-client module)
|
||||
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes.
|
||||
|
||||
For example:
|
||||
# dracut --add-drivers "module1 module2" ...
|
||||
|
||||
# dracut --add-drivers "module1 module2" ...
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -149,9 +183,10 @@ EOF
|
||||
# example:
|
||||
# push stack 1 2 "3 4"
|
||||
push() {
|
||||
local _i
|
||||
local __stack=$1; shift
|
||||
for i in "$@"; do
|
||||
eval ${__stack}'[${#'${__stack}'[@]}]="$i"'
|
||||
for _i in "$@"; do
|
||||
eval ${__stack}'[${#'${__stack}'[@]}]="$_i"'
|
||||
done
|
||||
}
|
||||
|
||||
@@ -167,16 +202,16 @@ push() {
|
||||
pop() {
|
||||
local __stack=$1; shift
|
||||
local __resultvar=$1
|
||||
local myresult;
|
||||
local _value;
|
||||
# check for empty stack
|
||||
eval '[[ ${#'${__stack}'[@]} -eq 0 ]] && return 1'
|
||||
|
||||
eval myresult='${'${__stack}'[${#'${__stack}'[@]}-1]}'
|
||||
eval _value='${'${__stack}'[${#'${__stack}'[@]}-1]}'
|
||||
|
||||
if [[ "$__resultvar" ]]; then
|
||||
eval $__resultvar="'$myresult'"
|
||||
eval $__resultvar="'$_value'"
|
||||
else
|
||||
echo "$myresult"
|
||||
echo "$_value"
|
||||
fi
|
||||
eval unset ${__stack}'[${#'${__stack}'[@]}-1]'
|
||||
return 0
|
||||
@@ -200,57 +235,147 @@ read_arg() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Little helper function for reading args from the commandline to a stack.
|
||||
# it automatically handles -a b and -a=b variants, and returns 1 if
|
||||
# we need to shift $3.
|
||||
push_arg() {
|
||||
# $1 = arg name
|
||||
# $2 = arg value
|
||||
# $3 = arg parameter
|
||||
local rematch='^[^=]*=(.*)$'
|
||||
if [[ $2 =~ $rematch ]]; then
|
||||
push "$1" "${BASH_REMATCH[1]}"
|
||||
else
|
||||
push "$1" "$3"
|
||||
# There is no way to shift our callers args, so
|
||||
# return 1 to indicate they should do it instead.
|
||||
return 1
|
||||
fi
|
||||
|
||||
dropindirs_sort()
|
||||
{
|
||||
suffix=$1; shift
|
||||
args=("$@")
|
||||
files=$(
|
||||
while (( $# > 0 )); do
|
||||
for i in ${1}/*${suffix}; do
|
||||
[[ -f $i ]] && echo ${i##*/}
|
||||
done
|
||||
shift
|
||||
done | sort -Vu
|
||||
)
|
||||
|
||||
for f in $files; do
|
||||
for d in "${args[@]}"; do
|
||||
if [[ -f "$d/$f" ]]; then
|
||||
echo "$d/$f"
|
||||
continue 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
verbosity_mod_l=0
|
||||
unset kernel
|
||||
unset outfile
|
||||
|
||||
while (($# > 0)); do
|
||||
case ${1%%=*} in
|
||||
-a|--add) push_arg add_dracutmodules_l "$@" || shift;;
|
||||
--force-add) push_arg force_add_dracutmodules_l "$@" || shift;;
|
||||
--add-drivers) push_arg add_drivers_l "$@" || shift;;
|
||||
--omit-drivers) push_arg omit_drivers_l "$@" || shift;;
|
||||
-m|--modules) push_arg dracutmodules_l "$@" || shift;;
|
||||
-o|--omit) push_arg omit_dracutmodules_l "$@" || shift;;
|
||||
-d|--drivers) push_arg drivers_l "$@" || shift;;
|
||||
--filesystems) push_arg filesystems_l "$@" || shift;;
|
||||
-I|--install) push_arg install_items_l "$@" || shift;;
|
||||
--fwdir) push_arg fw_dir_l "$@" || shift;;
|
||||
--libdirs) push_arg libdirs_l "$@" || shift;;
|
||||
--fscks) push_arg fscks_l "$@" || shift;;
|
||||
--add-fstab) push_arg add_fstab_l "$@" || shift;;
|
||||
--mount) push_arg fstab_lines "$@" || shift;;
|
||||
# Workaround -i, --include taking 2 arguments
|
||||
set -- "${@/--include/++include}"
|
||||
|
||||
# This prevents any long argument ending with "-i"
|
||||
# -i, like --opt-i but I think we can just prevent that
|
||||
set -- "${@/%-i/++include}"
|
||||
|
||||
TEMP=$(unset POSIXLY_CORRECT; getopt \
|
||||
-o "a:m:o:d:I:k:c:L:fvqlHhMN" \
|
||||
--long kver: \
|
||||
--long add: \
|
||||
--long force-add: \
|
||||
--long add-drivers: \
|
||||
--long omit-drivers: \
|
||||
--long modules: \
|
||||
--long omit: \
|
||||
--long drivers: \
|
||||
--long filesystems: \
|
||||
--long install: \
|
||||
--long fwdir: \
|
||||
--long libdirs: \
|
||||
--long fscks: \
|
||||
--long add-fstab: \
|
||||
--long mount: \
|
||||
--long device: \
|
||||
--long nofscks: \
|
||||
--long ro-mnt \
|
||||
--long kmoddir: \
|
||||
--long conf: \
|
||||
--long confdir: \
|
||||
--long tmpdir: \
|
||||
--long stdlog: \
|
||||
--long compress: \
|
||||
--long prefix: \
|
||||
--long force \
|
||||
--long kernel-only \
|
||||
--long no-kernel \
|
||||
--long kernel-cmdline: \
|
||||
--long strip \
|
||||
--long nostrip \
|
||||
--long hardlink \
|
||||
--long nohardlink \
|
||||
--long noprefix \
|
||||
--long mdadmconf \
|
||||
--long nomdadmconf \
|
||||
--long lvmconf \
|
||||
--long nolvmconf \
|
||||
--long debug \
|
||||
--long profile \
|
||||
--long sshkey: \
|
||||
--long verbose \
|
||||
--long quiet \
|
||||
--long local \
|
||||
--long hostonly \
|
||||
--long no-hostonly \
|
||||
--long fstab \
|
||||
--long help \
|
||||
--long bzip2 \
|
||||
--long lzma \
|
||||
--long xz \
|
||||
--long no-compress \
|
||||
--long gzip \
|
||||
--long list-modules \
|
||||
--long show-modules \
|
||||
--long keep \
|
||||
--long printsize \
|
||||
--long regenerate-all \
|
||||
--long noimageifnotneeded \
|
||||
-- "$@")
|
||||
|
||||
if (( $? != 0 )); then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval set -- "$TEMP"
|
||||
|
||||
while :; do
|
||||
case $1 in
|
||||
--kver) kernel="$2"; shift;;
|
||||
-a|--add) push add_dracutmodules_l "$2"; shift;;
|
||||
--force-add) push force_add_dracutmodules_l "$2"; shift;;
|
||||
--add-drivers) push add_drivers_l "$2"; shift;;
|
||||
--omit-drivers) push omit_drivers_l "$2"; shift;;
|
||||
-m|--modules) push dracutmodules_l "$2"; shift;;
|
||||
-o|--omit) push omit_dracutmodules_l "$2"; shift;;
|
||||
-d|--drivers) push drivers_l "$2"; shift;;
|
||||
--filesystems) push filesystems_l "$2"; shift;;
|
||||
-I|--install) push install_items_l "$2"; shift;;
|
||||
--fwdir) push fw_dir_l "$2"; shift;;
|
||||
--libdirs) push libdirs_l "$2"; shift;;
|
||||
--fscks) push fscks_l "$2"; shift;;
|
||||
--add-fstab) push add_fstab_l "$2"; shift;;
|
||||
--mount) push fstab_lines "$2"; shift;;
|
||||
--add-device|--device)
|
||||
push add_device_l "$2"; shift;;
|
||||
--kernel-cmdline) push kernel_cmdline_l "$2"; shift;;
|
||||
--nofscks) nofscks_l="yes";;
|
||||
-k|--kmoddir) read_arg drivers_dir_l "$@" || shift;;
|
||||
-c|--conf) read_arg conffile "$@" || shift;;
|
||||
--confdir) read_arg confdir "$@" || shift;;
|
||||
--tmpdir) read_arg tmpdir_l "$@" || shift;;
|
||||
-L|--stdlog) read_arg stdloglvl_l "$@" || shift;;
|
||||
--compress) read_arg compress_l "$@" || shift;;
|
||||
--prefix) read_arg prefix_l "$@" || shift;;
|
||||
--ro-mnt) ro_mnt_l="yes";;
|
||||
-k|--kmoddir) drivers_dir_l="$2"; shift;;
|
||||
-c|--conf) conffile="$2"; shift;;
|
||||
--confdir) confdir="$2"; shift;;
|
||||
--tmpdir) tmpdir_l="$2"; shift;;
|
||||
-L|--stdlog) stdloglvl_l="$2"; shift;;
|
||||
--compress) compress_l="$2"; shift;;
|
||||
--prefix) prefix_l="$2"; shift;;
|
||||
-f|--force) force=yes;;
|
||||
--kernel-only) kernel_only="yes"; no_kernel="no";;
|
||||
--no-kernel) kernel_only="no"; no_kernel="yes";;
|
||||
--strip) do_strip_l="yes";;
|
||||
--nostrip) do_strip_l="no";;
|
||||
--hardlink) do_hardlink_l="yes";;
|
||||
--nohardlink) do_hardlink_l="no";;
|
||||
--noprefix) prefix_l="/";;
|
||||
--mdadmconf) mdadmconf_l="yes";;
|
||||
--nomdadmconf) mdadmconf_l="no";;
|
||||
@@ -258,7 +383,7 @@ while (($# > 0)); do
|
||||
--nolvmconf) lvmconf_l="no";;
|
||||
--debug) debug="yes";;
|
||||
--profile) profile="yes";;
|
||||
--sshkey) read_arg sshkey "$@" || shift;;
|
||||
--sshkey) sshkey="$2"; shift;;
|
||||
-v|--verbose) ((verbosity_mod_l++));;
|
||||
-q|--quiet) ((verbosity_mod_l--));;
|
||||
-l|--local)
|
||||
@@ -267,50 +392,104 @@ while (($# > 0)); do
|
||||
&& dracutbasedir="$(readlink -f ${0%/*})"
|
||||
;;
|
||||
-H|--hostonly) hostonly_l="yes" ;;
|
||||
--no-hostonly) hostonly_l="no" ;;
|
||||
-N|--no-hostonly) hostonly_l="no" ;;
|
||||
--fstab) use_fstab_l="yes" ;;
|
||||
-h|--help) usage; exit 1 ;;
|
||||
-h|--help) long_usage; exit 1 ;;
|
||||
-i|--include) push include_src "$2"
|
||||
push include_target "$3"
|
||||
shift 2;;
|
||||
shift;;
|
||||
--bzip2) compress_l="bzip2";;
|
||||
--lzma) compress_l="lzma";;
|
||||
--xz) compress_l="xz";;
|
||||
--no-compress) _no_compress_l="cat";;
|
||||
--gzip) compress_l="gzip";;
|
||||
--list-modules)
|
||||
do_list="yes";
|
||||
;;
|
||||
--list-modules) do_list="yes";;
|
||||
-M|--show-modules)
|
||||
show_modules_l="yes"
|
||||
;;
|
||||
--keep) keep="yes";;
|
||||
--printsize) printsize="yes";;
|
||||
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
|
||||
--regenerate-all) regenerate_all="yes";;
|
||||
--noimageifnotneeded) noimageifnotneeded="yes";;
|
||||
|
||||
--) shift; break;;
|
||||
|
||||
*) # should not even reach this point
|
||||
printf "\n!Unknown option: '%s'\n\n" "$1" >&2; usage; exit 1;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# getopt cannot handle multiple arguments, so just handle "-I,--include"
|
||||
# the old fashioned way
|
||||
|
||||
while (($# > 0)); do
|
||||
case ${1%%=*} in
|
||||
++include) push include_src "$2"
|
||||
push include_target "$3"
|
||||
shift 2;;
|
||||
*)
|
||||
if ! [[ ${outfile+x} ]]; then
|
||||
outfile=$1
|
||||
elif ! [[ ${kernel+x} ]]; then
|
||||
kernel=$1
|
||||
else
|
||||
echo "Unknown argument: $1"
|
||||
printf "\nUnknown arguments: %s\n\n" "$*" >&2
|
||||
usage; exit 1;
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [[ $regenerate_all == "yes" ]]; then
|
||||
ret=0
|
||||
if [[ $kernel ]]; then
|
||||
echo "--regenerate-all cannot be called with a kernel version" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $outfile ]]; then
|
||||
echo "--regenerate-all cannot be called with a image file" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
((len=${#dracut_args[@]}))
|
||||
for ((i=0; i < len; i++)); do
|
||||
[[ ${dracut_args[$i]} == "--regenerate-all" ]] && \
|
||||
unset dracut_args[$i]
|
||||
done
|
||||
|
||||
cd /lib/modules
|
||||
for i in *; do
|
||||
[[ -f $i/modules.builtin ]] || continue
|
||||
dracut --kver=$i "${dracut_args[@]}"
|
||||
((ret+=$?))
|
||||
done
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
if ! [[ $kernel ]]; then
|
||||
kernel=$(uname -r)
|
||||
fi
|
||||
[[ $outfile ]] || outfile="/boot/initramfs-$kernel.img"
|
||||
|
||||
if ! [[ $outfile ]]; then
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
|
||||
outfile="/boot/${MACHINE_ID}/$kernel/initrd"
|
||||
else
|
||||
outfile="/boot/initramfs-$kernel.img"
|
||||
fi
|
||||
fi
|
||||
|
||||
for i in /usr/sbin /sbin /usr/bin /bin; do
|
||||
rl=$i
|
||||
if [ -L "$i" ]; then
|
||||
rl=$(readlink -f $i)
|
||||
fi
|
||||
NPATH+=":$rl"
|
||||
if [[ "$NPATH" != "*:$rl*" ]] ; then
|
||||
NPATH+=":$rl"
|
||||
fi
|
||||
done
|
||||
export PATH="${NPATH#:}"
|
||||
unset NPATH
|
||||
@@ -347,11 +526,9 @@ fi
|
||||
[[ -f $conffile ]] && . "$conffile"
|
||||
|
||||
# source our config dir
|
||||
if [[ $confdir && -d $confdir ]]; then
|
||||
for f in "$confdir"/*.conf; do
|
||||
[[ -e $f ]] && . "$f"
|
||||
done
|
||||
fi
|
||||
for f in $(dropindirs_sort ".conf" "$confdir" "$dracutbasedir/dracut.conf.d"); do
|
||||
[[ -e $f ]] && . "$f"
|
||||
done
|
||||
|
||||
# these optins add to the stuff in the config file
|
||||
if (( ${#add_dracutmodules_l[@]} )); then
|
||||
@@ -434,6 +611,9 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||
|
||||
[[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
|
||||
[[ $do_strip_l ]] && do_strip=$do_strip_l
|
||||
[[ $do_strip ]] || do_strip=yes
|
||||
[[ $do_hardlink_l ]] && do_hardlink=$do_hardlink_l
|
||||
[[ $do_hardlink ]] || do_hardlink=yes
|
||||
[[ $prefix_l ]] && prefix=$prefix_l
|
||||
[[ $prefix = "/" ]] && unset prefix
|
||||
[[ $hostonly_l ]] && hostonly=$hostonly_l
|
||||
@@ -444,10 +624,10 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||
[[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware"
|
||||
[[ $tmpdir_l ]] && tmpdir="$tmpdir_l"
|
||||
[[ $tmpdir ]] || tmpdir=/var/tmp
|
||||
[[ $do_strip ]] || do_strip=no
|
||||
[[ $compress_l ]] && compress=$compress_l
|
||||
[[ $show_modules_l ]] && show_modules=$show_modules_l
|
||||
[[ $nofscks_l ]] && nofscks="yes"
|
||||
[[ $ro_mnt_l ]] && ro_mnt="yes"
|
||||
# eliminate IFS hackery when messing with fw_dir
|
||||
fw_dir=${fw_dir//:/ }
|
||||
|
||||
@@ -470,10 +650,15 @@ fi
|
||||
readonly TMPDIR="$tmpdir"
|
||||
readonly initdir=$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)
|
||||
[ -d "$initdir" ] || {
|
||||
echo "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t initramfs.XXXXXXfailed." >&2
|
||||
echo "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t initramfs.XXXXXX failed." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap 'ret=$?;[[ $outfile ]] && [[ -f $outfile.$$ ]] && rm -f "$outfile.$$";[[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf "$initdir";exit $ret; };' EXIT
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap 'exit 1;' SIGINT
|
||||
|
||||
export DRACUT_KERNEL_LAZY="1"
|
||||
export DRACUT_RESOLVE_LAZY="1"
|
||||
|
||||
@@ -486,11 +671,18 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
inst /bin/sh
|
||||
if ! $DRACUT_INSTALL ${initdir+-D "$initdir"} -R "$initdir/bin/sh" &>/dev/null; then
|
||||
unset DRACUT_RESOLVE_LAZY
|
||||
export DRACUT_RESOLVE_DEPS=1
|
||||
fi
|
||||
rm -fr ${initdir}/*
|
||||
|
||||
if [[ -f $dracutbasedir/dracut-version.sh ]]; then
|
||||
. $dracutbasedir/dracut-version.sh
|
||||
fi
|
||||
|
||||
# Verify bash version, curret minimum is 3.1
|
||||
# Verify bash version, current minimum is 3.1
|
||||
if (( ${BASH_VERSINFO[0]} < 3 ||
|
||||
( ${BASH_VERSINFO[0]} == 3 && ${BASH_VERSINFO[1]} < 1 ) )); then
|
||||
dfatal 'You need at least Bash 3.1 to use dracut, sorry.'
|
||||
@@ -522,6 +714,12 @@ if (( ${#omit_drivers_l[@]} )); then
|
||||
fi
|
||||
omit_drivers=${omit_drivers/-/_}
|
||||
|
||||
if (( ${#kernel_cmdline_l[@]} )); then
|
||||
while pop kernel_cmdline_l val; do
|
||||
kernel_cmdline+=" $val "
|
||||
done
|
||||
fi
|
||||
|
||||
omit_drivers_corrected=""
|
||||
for d in $omit_drivers; do
|
||||
strstr " $drivers $add_drivers " " $d " && continue
|
||||
@@ -530,8 +728,13 @@ done
|
||||
omit_drivers="${omit_drivers_corrected%|}"
|
||||
unset omit_drivers_corrected
|
||||
|
||||
|
||||
ddebug "Executing $0 $dracut_args"
|
||||
# prepare args for logging
|
||||
for ((i=0; i < ${#dracut_args[@]}; i++)); do
|
||||
strstr "${dracut_args[$i]}" " " && \
|
||||
dracut_args[$i]="\"${dracut_args[$i]}\""
|
||||
#" keep vim happy
|
||||
done
|
||||
ddebug "Executing: $0 ${dracut_args[@]}"
|
||||
|
||||
[[ $do_list = yes ]] && {
|
||||
for mod in $dracutbasedir/modules.d/*; do
|
||||
@@ -550,10 +753,11 @@ esac
|
||||
|
||||
abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
|
||||
|
||||
[[ -f $srcmods/modules.dep ]] || {
|
||||
dfatal "$srcmods/modules.dep is missing. Did you run depmod?"
|
||||
exit 1
|
||||
}
|
||||
if [[ -d $srcmods ]]; then
|
||||
[[ -f $srcmods/modules.dep ]] || {
|
||||
dwarn "$srcmods/modules.dep is missing. Did you run depmod?"
|
||||
}
|
||||
fi
|
||||
|
||||
if [[ -f $outfile && ! $force ]]; then
|
||||
dfatal "Will not override existing initramfs ($outfile) without --force"
|
||||
@@ -564,29 +768,39 @@ outdir=${outfile%/*}
|
||||
[[ $outdir ]] || outdir="/"
|
||||
|
||||
if [[ ! -d "$outdir" ]]; then
|
||||
dfatal "Can't write $outfile: Directory $outdir does not exist."
|
||||
dfatal "Can't write to $outdir: Directory $outdir does not exist or is not accessible."
|
||||
exit 1
|
||||
elif [[ ! -w "$outdir" ]]; then
|
||||
dfatal "No permission to write $outdir."
|
||||
dfatal "No permission to write to $outdir."
|
||||
exit 1
|
||||
elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
|
||||
dfatal "No permission to write $outfile."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap 'ret=$?;[[ $keep ]] && echo "Not removing $initdir." >&2 || rm -rf "$initdir";exit $ret;' EXIT
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap 'exit 1;' SIGINT
|
||||
|
||||
# Need to be able to have non-root users read stuff (rpcbind etc)
|
||||
chmod 755 "$initdir"
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
for i in /sys /proc /run /dev; do
|
||||
if ! findmnt "$i" &>/dev/null; then
|
||||
dwarning "Turning off host-only mode: '$i' is not mounted!"
|
||||
unset hostonly
|
||||
fi
|
||||
done
|
||||
if ! [[ -d /run/udev/data ]]; then
|
||||
dwarning "Turning off host-only mode: udev database not found!"
|
||||
unset hostonly
|
||||
fi
|
||||
fi
|
||||
|
||||
declare -A host_fs_types
|
||||
|
||||
for line in "${fstab_lines[@]}"; do
|
||||
set -- $line
|
||||
#dev mp fs fsopts
|
||||
push host_devs "$1"
|
||||
push host_fs_types "$1|$3"
|
||||
host_fs_types["$1"]="$3"
|
||||
done
|
||||
|
||||
for f in $add_fstab; do
|
||||
@@ -596,6 +810,16 @@ for f in $add_fstab; do
|
||||
done < $f
|
||||
done
|
||||
|
||||
if (( ${#add_device_l[@]} )); then
|
||||
while pop add_device_l val; do
|
||||
add_device+=" $val "
|
||||
done
|
||||
fi
|
||||
|
||||
for dev in $add_device; do
|
||||
push host_devs $dev
|
||||
done
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
# in hostonly mode, determine all devices, which have to be accessed
|
||||
# and examine them for filesystem types
|
||||
@@ -614,33 +838,49 @@ if [[ $hostonly ]]; then
|
||||
mountpoint "$mp" >/dev/null 2>&1 || continue
|
||||
push host_devs $(readlink -f "/dev/block/$(find_block_device "$mp")")
|
||||
done
|
||||
|
||||
while read dev type rest; do
|
||||
[[ -b $dev ]] || continue
|
||||
[[ "$type" == "partition" ]] || continue
|
||||
while read _d _m _t _o _r; do
|
||||
[[ "$_d" == \#* ]] && continue
|
||||
[[ $_d ]] || continue
|
||||
[[ $_t != "swap" ]] || [[ $_m != "swap" ]] && continue
|
||||
[[ "$_o" == *noauto* ]] && continue
|
||||
[[ "$_d" == UUID\=* ]] && _d="/dev/disk/by-uuid/${_d#UUID=}"
|
||||
[[ "$_d" == LABEL\=* ]] && _d="/dev/disk/by-label/$_d#LABEL=}"
|
||||
[[ "$_d" -ef "$dev" ]] || continue
|
||||
push host_devs $(readlink -f $dev)
|
||||
break
|
||||
done < /etc/fstab
|
||||
done < /proc/swaps
|
||||
|
||||
fi
|
||||
|
||||
_get_fs_type() (
|
||||
[[ $1 ]] || return
|
||||
if [[ -b $1 ]] && get_fs_env $1; then
|
||||
echo "$(readlink -f $1)|$ID_FS_TYPE"
|
||||
echo "$(readlink -f $1) $ID_FS_TYPE"
|
||||
return 1
|
||||
fi
|
||||
if [[ -b /dev/block/$1 ]] && get_fs_env /dev/block/$1; then
|
||||
echo "$(readlink -f /dev/block/$1)|$ID_FS_TYPE"
|
||||
echo "$(readlink -f /dev/block/$1) $ID_FS_TYPE"
|
||||
return 1
|
||||
fi
|
||||
if fstype=$(find_dev_fstype $1); then
|
||||
echo "$1|$fstype"
|
||||
echo "$1 $fstype"
|
||||
return 1
|
||||
fi
|
||||
return 1
|
||||
)
|
||||
|
||||
for dev in "${host_devs[@]}"; do
|
||||
unset fs_type
|
||||
for fstype in $(_get_fs_type $dev) \
|
||||
$(check_block_and_slaves _get_fs_type $(get_maj_min $dev)); do
|
||||
if ! strstr " ${host_fs_types[*]} " " $fstype ";then
|
||||
push host_fs_types "$fstype"
|
||||
fi
|
||||
done
|
||||
while read key val; do
|
||||
host_fs_types["$key"]="$val"
|
||||
done < <(
|
||||
_get_fs_type $dev
|
||||
check_block_and_slaves_all _get_fs_type $(get_maj_min $dev)
|
||||
)
|
||||
done
|
||||
|
||||
[[ -d $udevdir ]] \
|
||||
@@ -652,22 +892,30 @@ fi
|
||||
|
||||
[[ -d $systemdutildir ]] \
|
||||
|| systemdutildir=$(pkg-config systemd --variable=systemdutildir 2>/dev/null)
|
||||
[[ -d $systemdsystemunitdir ]] \
|
||||
|| systemdsystemunitdir=$(pkg-config systemd --variable=systemdsystemunitdir 2>/dev/null)
|
||||
|
||||
if ! [[ -d "$systemdutildir" ]]; then
|
||||
[[ -d /lib/systemd ]] && systemdutildir=/lib/systemd
|
||||
[[ -d /usr/lib/systemd ]] && systemdutildir=/usr/lib/systemd
|
||||
fi
|
||||
|
||||
[[ -d $systemdsystemunitdir ]] \
|
||||
|| systemdsystemunitdir=$(pkg-config systemd --variable=systemdsystemunitdir 2>/dev/null)
|
||||
|
||||
[[ -d "$systemdsystemunitdir" ]] || systemdsystemunitdir=${systemdutildir}/system
|
||||
|
||||
export initdir dracutbasedir dracutmodules drivers \
|
||||
[[ -d $systemdsystemconfdir ]] \
|
||||
|| systemdsystemconfdir=$(pkg-config systemd --variable=systemdsystemconfdir 2>/dev/null)
|
||||
|
||||
[[ -d "$systemdsystemconfdir" ]] || systemdsystemconfdir=/etc/systemd/system
|
||||
|
||||
export initdir dracutbasedir dracutmodules \
|
||||
fw_dir drivers_dir debug no_kernel kernel_only \
|
||||
add_drivers omit_drivers mdadmconf lvmconf filesystems \
|
||||
use_fstab fstab_lines libdirs fscks nofscks \
|
||||
omit_drivers mdadmconf lvmconf \
|
||||
use_fstab fstab_lines libdirs fscks nofscks ro_mnt \
|
||||
stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
|
||||
debug host_fs_types host_devs sshkey add_fstab \
|
||||
DRACUT_VERSION udevdir systemdutildir systemdsystemunitdir
|
||||
DRACUT_VERSION udevdir prefix filesystems drivers \
|
||||
systemdutildir systemdsystemunitdir systemdsystemconfdir
|
||||
|
||||
# Create some directory structure first
|
||||
[[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"
|
||||
@@ -683,7 +931,7 @@ if [[ $prefix ]]; then
|
||||
fi
|
||||
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
for d in usr/bin usr/sbin bin etc lib sbin tmp usr var var/log var/run var/lock $libdirs; do
|
||||
for d in usr/bin usr/sbin bin etc lib sbin tmp usr var $libdirs; do
|
||||
[[ -e "${initdir}${prefix}/$d" ]] && continue
|
||||
if [ -L "/$d" ]; then
|
||||
inst_symlink "/$d" "${prefix}/$d"
|
||||
@@ -700,8 +948,9 @@ if [[ $kernel_only != yes ]]; then
|
||||
fi
|
||||
done
|
||||
|
||||
ln -sfn /run "$initdir/var/run"
|
||||
ln -sfn /run/lock "$initdir/var/lock"
|
||||
ln -sfn ../run "$initdir/var/run"
|
||||
ln -sfn ../run/lock "$initdir/var/lock"
|
||||
ln -sfn ../run/log "$initdir/var/log"
|
||||
else
|
||||
for d in lib "$libdir"; do
|
||||
[[ -e "${initdir}${prefix}/$d" ]] && continue
|
||||
@@ -778,9 +1027,63 @@ dinfo "*** Including modules done ***"
|
||||
|
||||
## final stuff that has to happen
|
||||
if [[ $no_kernel != yes ]]; then
|
||||
|
||||
if [[ $drivers ]]; then
|
||||
hostonly='' instmods $drivers
|
||||
fi
|
||||
|
||||
if [[ $add_drivers ]]; then
|
||||
hostonly='' instmods -c $add_drivers
|
||||
fi
|
||||
if [[ $filesystems ]]; then
|
||||
hostonly='' instmods -c $filesystems
|
||||
fi
|
||||
|
||||
dinfo "*** Installing kernel module dependencies and firmware ***"
|
||||
dracut_kernel_post
|
||||
dinfo "*** Installing kernel module dependencies and firmware done ***"
|
||||
|
||||
if [[ $noimageifnotneeded == yes ]] && [[ $hostonly ]]; then
|
||||
if [[ ! -f "$initdir/lib/dracut/need-initqueue" ]] && \
|
||||
[[ -f ${initdir}/lib/modules/$kernel/modules.dep && ! -s ${initdir}/lib/modules/$kernel/modules.dep ]]; then
|
||||
for i in ${initdir}/etc/cmdline.d/*.conf; do
|
||||
# We need no initramfs image and do not generate one.
|
||||
[[ $i == "${initdir}/etc/cmdline.d/*.conf" ]] && exit 0
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
(( ${#install_items[@]} > 0 )) && dracut_install ${install_items[@]}
|
||||
|
||||
[[ $kernel_cmdline ]] && echo "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
|
||||
|
||||
while pop fstab_lines line; do
|
||||
echo "$line 0 0" >> "${initdir}/etc/fstab"
|
||||
done
|
||||
|
||||
for f in $add_fstab; do
|
||||
cat $f >> "${initdir}/etc/fstab"
|
||||
done
|
||||
|
||||
if [ -d ${initdir}/$systemdutildir ]; then
|
||||
mkdir -p ${initdir}/etc/conf.d
|
||||
{
|
||||
echo "systemdutildir=\"$systemdutildir\""
|
||||
echo "systemdsystemunitdir=\"$systemdsystemunitdir\""
|
||||
echo "systemdsystemconfdir=\"$systemdsystemconfdir\""
|
||||
} > ${initdir}/etc/conf.d/systemd.conf
|
||||
fi
|
||||
|
||||
if [[ $DRACUT_RESOLVE_LAZY ]] && [[ $DRACUT_INSTALL ]]; then
|
||||
dinfo "*** Resolving executable dependencies ***"
|
||||
find "$initdir" -type f \
|
||||
'(' -perm -0100 -or -perm -0010 -or -perm -0001 ')' \
|
||||
-not -path '*.ko' -print0 \
|
||||
| xargs -r -0 $DRACUT_INSTALL ${initdir+-D "$initdir"} -R ${DRACUT_FIPS_MODE+-H}
|
||||
dinfo "*** Resolving executable dependencies done***"
|
||||
fi
|
||||
fi
|
||||
|
||||
while pop include_src src && pop include_target tgt; do
|
||||
@@ -800,9 +1103,9 @@ while pop include_src src && pop include_target tgt; do
|
||||
mkdir -m 0755 -p "$s"
|
||||
chmod --reference="$i" "$s"
|
||||
fi
|
||||
cp --reflink=auto --sparse=auto -pfLr -t "$s" "$i"/*
|
||||
cp --reflink=auto --sparse=auto -fa -t "$s" "$i"/*
|
||||
else
|
||||
cp --reflink=auto --sparse=auto -pfLr -t "$s" "$i"
|
||||
cp --reflink=auto --sparse=auto -fa -t "$s" "$i"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
@@ -810,25 +1113,6 @@ while pop include_src src && pop include_target tgt; do
|
||||
done
|
||||
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
(( ${#install_items[@]} > 0 )) && dracut_install ${install_items[@]}
|
||||
|
||||
while pop fstab_lines line; do
|
||||
echo "$line 0 0" >> "${initdir}/etc/fstab"
|
||||
done
|
||||
|
||||
for f in $add_fstab; do
|
||||
cat $f >> "${initdir}/etc/fstab"
|
||||
done
|
||||
|
||||
if [[ $DRACUT_RESOLVE_LAZY ]] && [[ -x /usr/bin/dracut-install ]]; then
|
||||
dinfo "*** Resolving executable dependencies ***"
|
||||
find "$initdir" -type f \
|
||||
'(' -perm -0100 -or -perm -0010 -or -perm -0001 ')' \
|
||||
-not -path '*.ko' -print0 \
|
||||
| xargs -0 dracut-install ${initdir+-D "$initdir"} -R ${DRACUT_FIPS_MODE+-H}
|
||||
dinfo "*** Resolving executable dependencies done***"
|
||||
fi
|
||||
|
||||
# make sure that library links are correct and up to date
|
||||
for f in /etc/ld.so.conf /etc/ld.so.conf.d/*; do
|
||||
[[ -f $f ]] && inst_simple "$f"
|
||||
@@ -847,52 +1131,77 @@ if (($maxloglvl >= 5)); then
|
||||
du -c "$initdir" | sort -n | ddebug
|
||||
fi
|
||||
|
||||
PRELINK_BIN=$(command -v prelink)
|
||||
if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then
|
||||
if [[ $DRACUT_FIPS_MODE ]]; then
|
||||
dinfo "*** Pre-unlinking files ***"
|
||||
dracut_install -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache
|
||||
chroot "$initdir" $PRELINK_BIN -u -a
|
||||
rm -f "$initdir"/$PRELINK_BIN
|
||||
rm -fr "$initdir"/etc/prelink.*
|
||||
dinfo "*** Pre-unlinking files done ***"
|
||||
else
|
||||
dinfo "*** Pre-linking files ***"
|
||||
dracut_install -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf
|
||||
chroot "$initdir" $PRELINK_BIN -a
|
||||
rm -f "$initdir"/$PRELINK_BIN
|
||||
rm -fr "$initdir"/etc/prelink.*
|
||||
dinfo "*** Pre-linking files done ***"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $do_hardlink = yes ]] && command -v hardlink >/dev/null; then
|
||||
dinfo "*** Hardlinking files ***"
|
||||
hardlink "$initdir" 2>&1
|
||||
dinfo "*** Hardlinking files done ***"
|
||||
fi
|
||||
|
||||
# strip binaries
|
||||
if [[ $do_strip = yes ]] ; then
|
||||
for p in strip xargs find; do
|
||||
if ! type -P $p >/dev/null; then
|
||||
derror "Could not find '$p'. You should run $0 with '--nostrip'."
|
||||
dwarn "Could not find '$p'. Not stripping the initramfs."
|
||||
do_strip=no
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if strstr "$modules_loaded" " fips " && command -v prelink >/dev/null; then
|
||||
dinfo "*** pre-unlinking files ***"
|
||||
for dir in "$initdir/bin" \
|
||||
"$initdir/sbin" \
|
||||
"$initdir/usr/bin" \
|
||||
"$initdir/usr/sbin"; do
|
||||
[[ -L "$dir" ]] && continue
|
||||
for i in "$dir"/*; do
|
||||
[[ -L $i ]] && continue
|
||||
[[ -x $i ]] && prelink -u $i &>/dev/null
|
||||
done
|
||||
done
|
||||
dinfo "*** pre-unlinking files done ***"
|
||||
fi
|
||||
|
||||
if [[ $do_strip = yes ]] ; then
|
||||
dinfo "*** Stripping files ***"
|
||||
find "$initdir" -type f \
|
||||
'(' -perm -0100 -or -perm -0010 -or -perm -0001 \
|
||||
-or -path '*/lib/modules/*.ko' ')' -print0 \
|
||||
| xargs -0 strip -g 2>/dev/null
|
||||
if [[ $DRACUT_FIPS_MODE ]]; then
|
||||
find "$initdir" -type f \
|
||||
-executable -not -path '*/lib/modules/*.ko' -print0 \
|
||||
| while read -r -d $'\0' f; do
|
||||
if ! [[ -e "${f%/*}/.${f##*/}.hmac" ]] \
|
||||
&& ! [[ -e "/lib/fipscheck/${f##*/}.hmac" ]] \
|
||||
&& ! [[ -e "/lib64/fipscheck/${f##*/}.hmac" ]]; then
|
||||
echo -n "$f"; echo -n -e "\000"
|
||||
fi
|
||||
done | xargs -r -0 strip -g 2>/dev/null
|
||||
else
|
||||
find "$initdir" -type f \
|
||||
-executable -not -path '*/lib/modules/*.ko' -print0 \
|
||||
| xargs -r -0 strip -g 2>/dev/null
|
||||
fi
|
||||
|
||||
# strip kernel modules, but do not touch signed modules
|
||||
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
|
||||
| while read -r -d $'\0' f; do
|
||||
SIG=$(tail -c 28 "$f")
|
||||
[[ $SIG == '~Module signature appended~' ]] || { echo -n "$f"; echo -n -e "\000"; }
|
||||
done | xargs -r -0 strip -g
|
||||
|
||||
dinfo "*** Stripping files done ***"
|
||||
fi
|
||||
|
||||
type hardlink &>/dev/null && {
|
||||
dinfo "*** hardlinking files ***"
|
||||
hardlink "$initdir" 2>&1
|
||||
dinfo "*** hardlinking files done ***"
|
||||
}
|
||||
|
||||
rm -f "$outfile"
|
||||
dinfo "*** Creating image file ***"
|
||||
if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet| \
|
||||
$compress > "$outfile"; ); then
|
||||
dfatal "dracut: creation of $outfile failed"
|
||||
if ! ( umask 077; cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet| \
|
||||
$compress > "$outfile.$$"; ); then
|
||||
dfatal "dracut: creation of $outfile.$$ failed"
|
||||
exit 1
|
||||
fi
|
||||
mv $outfile.$$ $outfile
|
||||
dinfo "*** Creating image file done ***"
|
||||
|
||||
dinfo "Wrote $outfile:"
|
||||
|
175
dracut.spec
175
dracut.spec
@@ -19,8 +19,13 @@ Group: System Environment/Base
|
||||
%if 0%{?suse_version}
|
||||
Group: System/Base
|
||||
%endif
|
||||
License: GPLv2+
|
||||
|
||||
# The entire source code is GPLv2+
|
||||
# except install/* which is LGPLv2.1+
|
||||
License: GPLv2+ and LGPLv2.1+
|
||||
|
||||
URL: https://dracut.wiki.kernel.org/
|
||||
|
||||
# Source can be generated by
|
||||
# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{version};sf=tgz
|
||||
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.bz2
|
||||
@@ -29,7 +34,13 @@ BuildRequires: dash bash git
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: pkgconfig
|
||||
%endif
|
||||
%if 0%{?fedora}
|
||||
BuildRequires: bash-completion
|
||||
BuildRequires: pkgconfig
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%endif
|
||||
@@ -65,7 +76,7 @@ Provides: mkinitrd = 2.6.1
|
||||
Obsoletes: dracut-kernel < 005
|
||||
Provides: dracut-kernel = %{version}-%{release}
|
||||
|
||||
Requires: bash
|
||||
Requires: bash >= 4
|
||||
Requires: coreutils
|
||||
Requires: cpio
|
||||
Requires: filesystem >= 2.1.0
|
||||
@@ -76,11 +87,15 @@ Requires: gzip xz
|
||||
Requires: module-init-tools >= 3.7-9
|
||||
Requires: sed
|
||||
Requires: file
|
||||
Requires: udev > 166
|
||||
Requires: kpartx
|
||||
Requires: kbd kbd-misc
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
Requires: util-linux >= 2.21
|
||||
Requires: systemd >= 44-15
|
||||
Requires: systemd >= 198-5
|
||||
Conflicts: grubby < 8.23
|
||||
%else
|
||||
Requires: udev > 166
|
||||
Requires: util-linux-ng >= 2.21
|
||||
%endif
|
||||
|
||||
@@ -89,16 +104,20 @@ Conflicts: initscripts < 8.63-1
|
||||
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
|
||||
%endif
|
||||
|
||||
Conflicts: mdadm < 3.2.6-14
|
||||
|
||||
%description
|
||||
Dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
|
||||
dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
|
||||
Unlike existing implementations, dracut does hard-code as little as possible
|
||||
into the initramfs. Dracut contains various modules which are driven by the
|
||||
into the initramfs. dracut contains various modules which are driven by the
|
||||
event-based udev. Having root on MD, DM, LVM2, LUKS is supported as well as
|
||||
NFS, iSCSI, NBD, FCoE with the dracut-network package.
|
||||
|
||||
%package network
|
||||
Summary: Dracut modules to build a dracut initramfs with network support
|
||||
Summary: dracut modules to build a dracut initramfs with network support
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: iputils
|
||||
Requires: iproute
|
||||
Obsoletes: dracut-generic < 008
|
||||
Provides: dracut-generic = %{version}-%{release}
|
||||
|
||||
@@ -106,9 +125,9 @@ Provides: dracut-generic = %{version}-%{release}
|
||||
This package requires everything which is needed to build a generic
|
||||
all purpose initramfs with network support with dracut.
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} >= 6
|
||||
%if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?suse_version}
|
||||
%package fips
|
||||
Summary: Dracut modules to build a dracut initramfs with an integrity check
|
||||
Summary: dracut modules to build a dracut initramfs with an integrity check
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: hmaccalc
|
||||
%if 0%{?rhel} > 5
|
||||
@@ -121,29 +140,44 @@ Requires: nss-softokn-freebl
|
||||
|
||||
%description fips
|
||||
This package requires everything which is needed to build an
|
||||
all purpose initramfs with dracut, which does an integrity check.
|
||||
initramfs with dracut, which does an integrity check.
|
||||
%endif
|
||||
|
||||
%package fips-aesni
|
||||
Summary: Dracut modules to build a dracut initramfs with an integrity check with aesni-intel
|
||||
Summary: dracut modules to build a dracut initramfs with an integrity check with aesni-intel
|
||||
Requires: %{name}-fips = %{version}-%{release}
|
||||
|
||||
%description fips-aesni
|
||||
This package requires everything which is needed to build an
|
||||
all purpose initramfs with dracut, which does an integrity check
|
||||
and adds the aesni-intel kernel module.
|
||||
initramfs with dracut, which does an integrity check and adds the aesni-intel kernel module.
|
||||
|
||||
%package caps
|
||||
Summary: Dracut modules to build a dracut initramfs which drops capabilities
|
||||
Summary: dracut modules to build a dracut initramfs which drops capabilities
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: libcap
|
||||
|
||||
%description caps
|
||||
This package requires everything which is needed to build an
|
||||
all purpose initramfs with dracut, which drops capabilities.
|
||||
initramfs with dracut, which drops capabilities.
|
||||
|
||||
%package nohostonly
|
||||
Summary: dracut configuration to turn off hostonly image generation
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description nohostonly
|
||||
This package provides the configuration to turn off the host specific initramfs
|
||||
generation with dracut.
|
||||
|
||||
%package norescue
|
||||
Summary: dracut configuration to turn off rescue image generation
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description norescue
|
||||
This package provides the configuration to turn off the rescue initramfs
|
||||
generation with dracut.
|
||||
|
||||
%package tools
|
||||
Summary: Dracut tools to build the local initramfs
|
||||
Summary: dracut tools to build the local initramfs
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description tools
|
||||
@@ -164,27 +198,33 @@ git am -p1 %{patches}
|
||||
%endif
|
||||
|
||||
%build
|
||||
make all
|
||||
%configure --systemdsystemunitdir=%{_unitdir} --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) --libdir=%{_prefix}/lib
|
||||
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
%endif
|
||||
make install DESTDIR=$RPM_BUILD_ROOT \
|
||||
libdir=%{_prefix}/lib \
|
||||
bindir=%{_bindir} \
|
||||
%if %{defined _unitdir}
|
||||
systemdsystemunitdir=%{_unitdir} \
|
||||
%endif
|
||||
sysconfdir=/etc mandir=%{_mandir}
|
||||
make %{?_smp_mflags} install \
|
||||
DESTDIR=$RPM_BUILD_ROOT \
|
||||
libdir=%{_prefix}/lib
|
||||
|
||||
echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dracut-version.sh
|
||||
|
||||
%if 0%{?fedora} == 0 && 0%{?rhel} == 0
|
||||
%if 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} == 0
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/02fips-aesni
|
||||
%endif
|
||||
|
||||
%if %{defined _unitdir}
|
||||
# for systemd, better use systemd-bootchart
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00bootchart
|
||||
%endif
|
||||
|
||||
# we do not support dash in the initramfs
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00dash
|
||||
|
||||
# remove gentoo specific modules
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/50gensplash
|
||||
|
||||
@@ -202,13 +242,13 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log
|
||||
touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/01-dist.conf
|
||||
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/40-fips.conf
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/40-fips.conf
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/01-dist.conf
|
||||
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999
|
||||
@@ -216,8 +256,17 @@ rm $RPM_BUILD_ROOT%{_bindir}/mkinitrd
|
||||
rm $RPM_BUILD_ROOT%{_bindir}/lsinitrd
|
||||
%endif
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
|
||||
install -m 0644 dracut.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/dracut_log
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
# FIXME: remove after F19
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d
|
||||
install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
|
||||
|
||||
echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-nohostonly.conf
|
||||
echo 'dracut_rescue_image="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-norescue.conf
|
||||
%endif
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
|
||||
install -m 0644 dracut.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/dracut_log
|
||||
|
||||
# create compat symlink
|
||||
mkdir -p $RPM_BUILD_ROOT/sbin
|
||||
@@ -232,10 +281,10 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_bindir}/dracut
|
||||
# compat symlink
|
||||
/sbin/dracut
|
||||
%{_datadir}/bash-completion/completions/dracut
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
|
||||
%{_bindir}/mkinitrd
|
||||
%{_bindir}/lsinitrd
|
||||
%{_bindir}/dracut-install
|
||||
%endif
|
||||
%dir %{dracutlibdir}
|
||||
%dir %{dracutlibdir}/modules.d
|
||||
@@ -244,22 +293,35 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/dracut-version.sh
|
||||
%{dracutlibdir}/dracut-logger.sh
|
||||
%{dracutlibdir}/dracut-initramfs-restore
|
||||
%config(noreplace) /etc/dracut.conf
|
||||
%{dracutlibdir}/dracut-install
|
||||
%config(noreplace) %{_sysconfdir}/dracut.conf
|
||||
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel}
|
||||
%config /etc/dracut.conf.d/01-dist.conf
|
||||
%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
%endif
|
||||
%dir /etc/dracut.conf.d
|
||||
%dir %{_sysconfdir}/dracut.conf.d
|
||||
%dir %{dracutlibdir}/dracut.conf.d
|
||||
%{_mandir}/man8/dracut.8*
|
||||
%{_mandir}/man8/*service.8*
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
|
||||
%{_mandir}/man8/mkinitrd.8*
|
||||
%{_mandir}/man1/lsinitrd.1*
|
||||
%endif
|
||||
%{_mandir}/man7/dracut.kernel.7*
|
||||
%{_mandir}/man7/dracut.cmdline.7*
|
||||
%{_mandir}/man7/dracut.bootup.7*
|
||||
%{_mandir}/man5/dracut.conf.5*
|
||||
%if %{defined _unitdir}
|
||||
%{dracutlibdir}/modules.d/00systemd-bootchart
|
||||
%else
|
||||
%{dracutlibdir}/modules.d/00bootchart
|
||||
%{dracutlibdir}/modules.d/00dash
|
||||
%endif
|
||||
%{dracutlibdir}/modules.d/03rescue
|
||||
%{dracutlibdir}/modules.d/04watchdog
|
||||
%{dracutlibdir}/modules.d/05busybox
|
||||
%{dracutlibdir}/modules.d/10i18n
|
||||
%{dracutlibdir}/modules.d/30convertfs
|
||||
%{dracutlibdir}/modules.d/45url-lib
|
||||
%{dracutlibdir}/modules.d/50drm
|
||||
%{dracutlibdir}/modules.d/50plymouth
|
||||
%{dracutlibdir}/modules.d/80cms
|
||||
%{dracutlibdir}/modules.d/90btrfs
|
||||
@@ -273,6 +335,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/modules.d/90multipath
|
||||
%{dracutlibdir}/modules.d/90qemu
|
||||
%{dracutlibdir}/modules.d/91crypt-gpg
|
||||
%{dracutlibdir}/modules.d/91crypt-loop
|
||||
%{dracutlibdir}/modules.d/95debug
|
||||
%{dracutlibdir}/modules.d/95resume
|
||||
%{dracutlibdir}/modules.d/95rootfs-block
|
||||
@@ -299,13 +362,32 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/modules.d/99fs-lib
|
||||
%{dracutlibdir}/modules.d/99img-lib
|
||||
%{dracutlibdir}/modules.d/99shutdown
|
||||
%config(noreplace) /etc/logrotate.d/dracut_log
|
||||
%config(noreplace) %{_sysconfdir}/logrotate.d/dracut_log
|
||||
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
|
||||
%dir %{_sharedstatedir}/initramfs
|
||||
%if %{defined _unitdir}
|
||||
%{_unitdir}/*.service
|
||||
%{_unitdir}/*.target
|
||||
%{_unitdir}/*/*.service
|
||||
%{_unitdir}/dracut-shutdown.service
|
||||
%{_unitdir}/shutdown.target.wants/dracut-shutdown.service
|
||||
%{_unitdir}/dracut-cmdline.service
|
||||
%{_unitdir}/dracut-initqueue.service
|
||||
%{_unitdir}/dracut-mount.service
|
||||
%{_unitdir}/dracut-pre-mount.service
|
||||
%{_unitdir}/dracut-pre-pivot.service
|
||||
%{_unitdir}/dracut-pre-trigger.service
|
||||
%{_unitdir}/dracut-pre-udev.service
|
||||
%{_unitdir}/initrd.target.wants/dracut-cmdline.service
|
||||
%{_unitdir}/initrd.target.wants/dracut-initqueue.service
|
||||
%{_unitdir}/initrd.target.wants/dracut-mount.service
|
||||
%{_unitdir}/initrd.target.wants/dracut-pre-mount.service
|
||||
%{_unitdir}/initrd.target.wants/dracut-pre-pivot.service
|
||||
%{_unitdir}/initrd.target.wants/dracut-pre-trigger.service
|
||||
%{_unitdir}/initrd.target.wants/dracut-pre-udev.service
|
||||
|
||||
%endif
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
%{_prefix}/lib/kernel/install.d/50-dracut.install
|
||||
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
|
||||
%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
|
||||
%endif
|
||||
|
||||
%files network
|
||||
@@ -315,17 +397,18 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/modules.d/95iscsi
|
||||
%{dracutlibdir}/modules.d/90livenet
|
||||
%{dracutlibdir}/modules.d/90qemu-net
|
||||
%{dracutlibdir}/modules.d/95cifs
|
||||
%{dracutlibdir}/modules.d/95nbd
|
||||
%{dracutlibdir}/modules.d/95nfs
|
||||
%{dracutlibdir}/modules.d/95ssh-client
|
||||
%{dracutlibdir}/modules.d/45ifcfg
|
||||
%{dracutlibdir}/modules.d/95znet
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
%files fips
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/modules.d/01fips
|
||||
%config(noreplace) /etc/dracut.conf.d/40-fips.conf
|
||||
%{dracutlibdir}/dracut.conf.d/40-fips.conf
|
||||
%endif
|
||||
|
||||
%files fips-aesni
|
||||
@@ -345,4 +428,12 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%dir /var/lib/dracut
|
||||
%dir /var/lib/dracut/overlay
|
||||
|
||||
%files nohostonly
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/dracut.conf.d/02-nohostonly.conf
|
||||
|
||||
%files norescue
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/dracut.conf.d/02-norescue.conf
|
||||
|
||||
%changelog
|
||||
|
@@ -1,17 +1,7 @@
|
||||
prefix ?= /usr
|
||||
bindir ?= ${prefix}/bin
|
||||
strip ?= -s
|
||||
|
||||
all: dracut-install
|
||||
|
||||
dracut-install: dracut-install.c hashmap.c log.c util.c
|
||||
gcc -std=gnu99 -O2 -g -Wall -o dracut-install dracut-install.c hashmap.c log.c util.c
|
||||
|
||||
install: dracut-install
|
||||
install $(strip) -m 0755 dracut-install $(DESTDIR)$(bindir)/dracut-install
|
||||
all:
|
||||
$(MAKE) -C ..
|
||||
|
||||
clean:
|
||||
rm -f dracut-install *~
|
||||
$(MAKE) -C .. clean
|
||||
|
||||
indent:
|
||||
indent -i8 -nut -br -linux -l120 dracut-install.c
|
||||
.PHONY: all clean
|
||||
|
@@ -39,6 +39,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "hashmap.h"
|
||||
@@ -56,14 +57,14 @@ static char *destrootdir = NULL;
|
||||
static Hashmap *items = NULL;
|
||||
static Hashmap *items_failed = NULL;
|
||||
|
||||
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps);
|
||||
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst);
|
||||
|
||||
static size_t dir_len(char const *file)
|
||||
{
|
||||
size_t length;
|
||||
/* Strip the basename and any redundant slashes before it. */
|
||||
for (length = strlen(file); 0 < length; length--)
|
||||
if (file[length] == '/')
|
||||
for (length = strlen(file)-1; 0 < length; length--)
|
||||
if (file[length] == '/' && file[length-1] != '/')
|
||||
break;
|
||||
return length;
|
||||
}
|
||||
@@ -90,7 +91,13 @@ static char *convert_abs_rel(const char *from, const char *target)
|
||||
return strdup(from);
|
||||
}
|
||||
|
||||
asprintf(&realtarget, "%s/%s", q, &p[dirlen + 1]);
|
||||
/* dir_len() skips double /'s e.g. //lib64, so we can't skip just one
|
||||
* character - need to skip all leading /'s */
|
||||
rl = strlen(target);
|
||||
for (i = dirlen+1; i < rl; ++i)
|
||||
if (p[i] != '/')
|
||||
break;
|
||||
asprintf(&realtarget, "%s/%s", q, &p[i]);
|
||||
free(p);
|
||||
free(q);
|
||||
|
||||
@@ -163,25 +170,78 @@ static int ln_r(const char *src, const char *dst)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Perform the O(1) btrfs clone operation, if possible.
|
||||
Upon success, return 0. Otherwise, return -1 and set errno. */
|
||||
static inline int clone_file(int dest_fd, int src_fd)
|
||||
{
|
||||
#undef BTRFS_IOCTL_MAGIC
|
||||
#define BTRFS_IOCTL_MAGIC 0x94
|
||||
#undef BTRFS_IOC_CLONE
|
||||
#define BTRFS_IOC_CLONE _IOW (BTRFS_IOCTL_MAGIC, 9, int)
|
||||
return ioctl(dest_fd, BTRFS_IOC_CLONE, src_fd);
|
||||
}
|
||||
|
||||
static bool use_clone = true;
|
||||
|
||||
static int cp(const char *src, const char *dst)
|
||||
{
|
||||
int pid;
|
||||
int status;
|
||||
int ret;
|
||||
|
||||
if (use_clone) {
|
||||
struct stat sb;
|
||||
int dest_desc, source_desc;
|
||||
|
||||
if (lstat(src, &sb) != 0)
|
||||
goto normal_copy;
|
||||
|
||||
if (S_ISLNK(sb.st_mode))
|
||||
goto normal_copy;
|
||||
|
||||
source_desc = open(src, O_RDONLY | O_CLOEXEC);
|
||||
if (source_desc < 0)
|
||||
goto normal_copy;
|
||||
|
||||
dest_desc =
|
||||
open(dst, O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC,
|
||||
(sb.st_mode) & (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO));
|
||||
|
||||
if (dest_desc < 0) {
|
||||
close(source_desc);
|
||||
goto normal_copy;
|
||||
}
|
||||
|
||||
ret = clone_file(dest_desc, source_desc);
|
||||
close(source_desc);
|
||||
if (ret == 0) {
|
||||
if (fchown(dest_desc, sb.st_uid, sb.st_gid) != 0)
|
||||
fchown(dest_desc, -1, sb.st_gid);
|
||||
close(dest_desc);
|
||||
return ret;
|
||||
}
|
||||
close(dest_desc);
|
||||
|
||||
/* clone did not work, remove the file */
|
||||
unlink(dst);
|
||||
/* do not try clone again */
|
||||
use_clone = false;
|
||||
}
|
||||
|
||||
normal_copy:
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode", "-fL", src, dst, NULL);
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
while (waitpid(pid, &status, 0) < 0) {
|
||||
while (waitpid(pid, &ret, 0) < 0) {
|
||||
if (errno != EINTR) {
|
||||
status = -1;
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int resolve_deps(const char *src)
|
||||
@@ -206,7 +266,7 @@ static int resolve_deps(const char *src)
|
||||
for (q = p; *q && (!isspace(*q)); q++) ;
|
||||
*q = '\0';
|
||||
log_debug("Script install: '%s'", p);
|
||||
ret = dracut_install(p, p, false, true);
|
||||
ret = dracut_install(p, p, false, true, false);
|
||||
if (ret != 0)
|
||||
log_error("ERROR: failed to install '%s'", p);
|
||||
return ret;
|
||||
@@ -214,7 +274,7 @@ static int resolve_deps(const char *src)
|
||||
}
|
||||
|
||||
/* run ldd */
|
||||
asprintf(&cmd, "ldd %s", src);
|
||||
asprintf(&cmd, "ldd %s 2>&1", src);
|
||||
fptr = popen(cmd, "r");
|
||||
|
||||
while (!feof(fptr)) {
|
||||
@@ -228,12 +288,24 @@ static int resolve_deps(const char *src)
|
||||
if (strstr(buf, "not a dynamic executable"))
|
||||
break;
|
||||
|
||||
if (strstr(buf, "loader cannot load itself"))
|
||||
break;
|
||||
|
||||
if (strstr(buf, "not regular file"))
|
||||
break;
|
||||
|
||||
if (strstr(buf, "cannot read header"))
|
||||
break;
|
||||
|
||||
if (strstr(buf, destrootdir))
|
||||
break;
|
||||
|
||||
p = strstr(buf, "/");
|
||||
if (p) {
|
||||
int r;
|
||||
for (q = p; *q && *q != ' ' && *q != '\n'; q++) ;
|
||||
*q = '\0';
|
||||
r = dracut_install(p, p, false, false);
|
||||
r = dracut_install(p, p, false, false, true);
|
||||
if (r != 0)
|
||||
log_error("ERROR: failed to install '%s' for '%s'", p, src);
|
||||
else
|
||||
@@ -247,7 +319,7 @@ static int resolve_deps(const char *src)
|
||||
*q = '\0';
|
||||
|
||||
/* ignore errors for base lib symlink */
|
||||
if (dracut_install(p, p, false, false) == 0)
|
||||
if (dracut_install(p, p, false, false, true) == 0)
|
||||
log_debug("Lib install: '%s'", p);
|
||||
}
|
||||
}
|
||||
@@ -258,7 +330,7 @@ static int resolve_deps(const char *src)
|
||||
}
|
||||
|
||||
/* Install ".<filename>.hmac" file for FIPS self-checks */
|
||||
static int hmac_install(const char *src, const char *dst)
|
||||
static int hmac_install(const char *src, const char *dst, const char *hmacpath)
|
||||
{
|
||||
char *srcpath = strdup(src);
|
||||
char *dstpath = strdup(dst);
|
||||
@@ -269,12 +341,22 @@ static int hmac_install(const char *src, const char *dst)
|
||||
if (endswith(src, ".hmac"))
|
||||
return 0;
|
||||
|
||||
if (!hmacpath) {
|
||||
hmac_install(src, dst, "/lib/fipscheck");
|
||||
hmac_install(src, dst, "/lib64/fipscheck");
|
||||
}
|
||||
|
||||
srcpath[dlen] = '\0';
|
||||
dstpath[dir_len(dst)] = '\0';
|
||||
asprintf(&srchmacname, "%s/.%s.hmac", srcpath, &src[dlen + 1]);
|
||||
asprintf(&dsthmacname, "%s/.%s.hmac", dstpath, &src[dlen + 1]);
|
||||
if (hmacpath) {
|
||||
asprintf(&srchmacname, "%s/%s.hmac", hmacpath, &src[dlen + 1]);
|
||||
asprintf(&dsthmacname, "%s/%s.hmac", hmacpath, &src[dlen + 1]);
|
||||
} else {
|
||||
asprintf(&srchmacname, "%s/.%s.hmac", srcpath, &src[dlen + 1]);
|
||||
asprintf(&dsthmacname, "%s/.%s.hmac", dstpath, &src[dlen + 1]);
|
||||
}
|
||||
log_debug("hmac cp '%s' '%s')", srchmacname, dsthmacname);
|
||||
dracut_install(srchmacname, dsthmacname, false, false);
|
||||
dracut_install(srchmacname, dsthmacname, false, false, true);
|
||||
free(dsthmacname);
|
||||
free(srchmacname);
|
||||
free(srcpath);
|
||||
@@ -282,7 +364,7 @@ static int hmac_install(const char *src, const char *dst)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps)
|
||||
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst)
|
||||
{
|
||||
struct stat sb, db;
|
||||
char *dname = NULL;
|
||||
@@ -302,11 +384,13 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
}
|
||||
}
|
||||
|
||||
existing = hashmap_get(items, dst);
|
||||
if (existing) {
|
||||
if (strcmp(existing, dst) == 0) {
|
||||
log_debug("hash hit items for '%s'", dst);
|
||||
return 0;
|
||||
if (hashdst) {
|
||||
existing = hashmap_get(items, dst);
|
||||
if (existing) {
|
||||
if (strcmp(existing, dst) == 0) {
|
||||
log_debug("hash hit items for '%s'", dst);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,10 +417,15 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
log_debug("'%s' already exists", fulldstpath);
|
||||
if (resolvedeps && S_ISREG(sb.st_mode) && (sb.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
|
||||
log_debug("'%s' already exists, but checking for any deps", fulldstpath);
|
||||
ret = resolve_deps(src);
|
||||
} else
|
||||
log_debug("'%s' already exists", fulldstpath);
|
||||
|
||||
free(fulldstpath);
|
||||
/* dst does already exist */
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* check destination directory */
|
||||
@@ -354,7 +443,7 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
log_debug("dest dir '%s' does not exist", fulldstdir);
|
||||
dname = strdup(dst);
|
||||
dname[dir_len(dname)] = '\0';
|
||||
ret = dracut_install(dname, dname, true, false);
|
||||
ret = dracut_install(dname, dname, true, false, true);
|
||||
|
||||
free(dname);
|
||||
|
||||
@@ -388,7 +477,7 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
if (abspath == NULL)
|
||||
return 1;
|
||||
|
||||
if (dracut_install(abspath, abspath, false, resolvedeps)) {
|
||||
if (dracut_install(abspath, abspath, false, resolvedeps, hashdst)) {
|
||||
log_debug("'%s' install error", abspath);
|
||||
return 1;
|
||||
}
|
||||
@@ -410,7 +499,7 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
free(abspath);
|
||||
if (arg_hmac) {
|
||||
/* copy .hmac files also */
|
||||
hmac_install(src, dst);
|
||||
hmac_install(src, dst, NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -421,7 +510,7 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
ret += resolve_deps(src);
|
||||
if (arg_hmac) {
|
||||
/* copy .hmac files also */
|
||||
hmac_install(src, dst);
|
||||
hmac_install(src, dst, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -451,13 +540,14 @@ Install SOURCE to DEST in DESTROOTDIR with all needed dependencies.\n\
|
||||
-d --dir SOURCE is a directory\n\
|
||||
-l --ldd Also install shebang executables and libraries\n\
|
||||
-R --resolvelazy Only install shebang executables and libraries for all SOURCE files\n\
|
||||
-f --fips Also install all '.SOURCE.hmac' files\n\
|
||||
-H --fips Also install all '.SOURCE.hmac' files\n\
|
||||
-v --verbose Show more output\n\
|
||||
--debug Show debug output\n\
|
||||
--version Show package version\n\
|
||||
-h --help Show this help\n\
|
||||
\n\
|
||||
Example:\n\
|
||||
# mkdir -p /var/tmp/test-root\n\
|
||||
# %s -D /var/tmp/test-root --ldd -a sh tr\n\
|
||||
# tree /var/tmp/test-root\n\
|
||||
/var/tmp/test-root\n\
|
||||
@@ -547,6 +637,7 @@ static int parse_argv(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (!optind || optind == argc) {
|
||||
log_error("No SOURCE argument given");
|
||||
usage(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -584,6 +675,81 @@ static int resolve_lazy(int argc, char **argv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *find_binary(const char *src)
|
||||
{
|
||||
char *path;
|
||||
char *p, *q;
|
||||
bool end = false;
|
||||
char *newsrc = NULL;
|
||||
path = getenv("PATH");
|
||||
|
||||
if (path == NULL) {
|
||||
log_error("PATH is not set");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
path = strdup(path);
|
||||
p = path;
|
||||
log_debug("PATH=%s", path);
|
||||
|
||||
do {
|
||||
struct stat sb;
|
||||
|
||||
for (q = p; *q && *q != ':'; q++) ;
|
||||
|
||||
if (*q == '\0')
|
||||
end = true;
|
||||
else
|
||||
*q = '\0';
|
||||
|
||||
asprintf(&newsrc, "%s/%s", p, src);
|
||||
p = q + 1;
|
||||
|
||||
if (stat(newsrc, &sb) != 0) {
|
||||
log_debug("stat(%s) != 0", newsrc);
|
||||
free(newsrc);
|
||||
newsrc = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
end = true;
|
||||
|
||||
} while (!end);
|
||||
|
||||
free(path);
|
||||
if (newsrc)
|
||||
log_debug("find_binary(%s) == %s", src, newsrc);
|
||||
return newsrc;
|
||||
}
|
||||
|
||||
static int install_one(const char *src, const char *dst)
|
||||
{
|
||||
int r = 0;
|
||||
int ret;
|
||||
|
||||
if (strchr(src, '/') == NULL) {
|
||||
char *newsrc = find_binary(src);
|
||||
if (newsrc) {
|
||||
log_debug("dracut_install '%s' '%s'", newsrc, dst);
|
||||
ret = dracut_install(newsrc, dst, arg_createdir, arg_resolvedeps, true);
|
||||
if (ret == 0) {
|
||||
log_debug("dracut_install '%s' '%s' OK", newsrc, dst);
|
||||
}
|
||||
free(newsrc);
|
||||
} else {
|
||||
ret = -1;
|
||||
}
|
||||
} else {
|
||||
ret = dracut_install(src, dst, arg_createdir, arg_resolvedeps, true);
|
||||
}
|
||||
|
||||
if ((ret != 0) && (!arg_optional)) {
|
||||
log_error("ERROR: installing '%s' to '%s'", src, dst);
|
||||
r = EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static int install_all(int argc, char **argv)
|
||||
{
|
||||
int r = 0;
|
||||
@@ -593,57 +759,25 @@ static int install_all(int argc, char **argv)
|
||||
log_debug("Handle '%s'", argv[i]);
|
||||
|
||||
if (strchr(argv[i], '/') == NULL) {
|
||||
char *path;
|
||||
char *p, *q;
|
||||
bool end = false;
|
||||
path = getenv("PATH");
|
||||
if (path == NULL) {
|
||||
log_error("PATH is not set");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
path = strdup(path);
|
||||
p = path;
|
||||
log_debug("PATH=%s", path);
|
||||
do {
|
||||
char *newsrc = NULL;
|
||||
char *dest;
|
||||
struct stat sb;
|
||||
|
||||
for (q = p; *q && *q != ':'; q++) ;
|
||||
|
||||
if (*q == '\0')
|
||||
end = true;
|
||||
else
|
||||
*q = '\0';
|
||||
|
||||
asprintf(&newsrc, "%s/%s", p, argv[i]);
|
||||
p = q + 1;
|
||||
|
||||
if (stat(newsrc, &sb) != 0) {
|
||||
free(newsrc);
|
||||
ret = -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
dest = strdup(newsrc);
|
||||
|
||||
char *newsrc = find_binary(argv[i]);
|
||||
if (newsrc) {
|
||||
log_debug("dracut_install '%s'", newsrc);
|
||||
ret = dracut_install(newsrc, dest, arg_createdir, arg_resolvedeps);
|
||||
ret = dracut_install(newsrc, newsrc, arg_createdir, arg_resolvedeps, true);
|
||||
if (ret == 0) {
|
||||
end = true;
|
||||
log_debug("dracut_install '%s' OK", newsrc);
|
||||
}
|
||||
free(newsrc);
|
||||
free(dest);
|
||||
} while (!end);
|
||||
free(path);
|
||||
} else {
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
} else {
|
||||
char *dest = strdup(argv[i]);
|
||||
ret = dracut_install(argv[i], dest, arg_createdir, arg_resolvedeps);
|
||||
ret = dracut_install(argv[i], dest, arg_createdir, arg_resolvedeps, true);
|
||||
free(dest);
|
||||
}
|
||||
|
||||
if ((ret != 0) && (!arg_optional)) {
|
||||
if ((ret != 0) && (!arg_optional)) {
|
||||
log_error("ERROR: installing '%s'", argv[i]);
|
||||
r = EXIT_FAILURE;
|
||||
}
|
||||
@@ -670,15 +804,29 @@ int main(int argc, char **argv)
|
||||
|
||||
umask(0022);
|
||||
|
||||
if (destrootdir == NULL) {
|
||||
if (destrootdir == NULL || strlen(destrootdir) == 0) {
|
||||
destrootdir = getenv("DESTROOTDIR");
|
||||
if (destrootdir == NULL) {
|
||||
if (destrootdir == NULL || strlen(destrootdir) == 0) {
|
||||
log_error("Environment DESTROOTDIR or argument -D is not set!");
|
||||
usage(EXIT_FAILURE);
|
||||
}
|
||||
destrootdir = strdup(destrootdir);
|
||||
}
|
||||
|
||||
if (strcmp(destrootdir, "/") == 0) {
|
||||
log_error("Environment DESTROOTDIR or argument -D is set to '/'!");
|
||||
usage(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
i = destrootdir;
|
||||
destrootdir = realpath(destrootdir, NULL);
|
||||
if (!destrootdir) {
|
||||
log_error("Environment DESTROOTDIR or argument -D is set to '%s': %m", i);
|
||||
r = EXIT_FAILURE;
|
||||
goto finish;
|
||||
}
|
||||
free(i);
|
||||
|
||||
items = hashmap_new(string_hash_func, string_compare_func);
|
||||
items_failed = hashmap_new(string_hash_func, string_compare_func);
|
||||
|
||||
@@ -709,11 +857,7 @@ int main(int argc, char **argv)
|
||||
r = install_all(argc - optind, &argv[optind]);
|
||||
} else {
|
||||
/* simple "inst src dst" */
|
||||
r = dracut_install(argv[optind], argv[optind + 1], arg_createdir, arg_resolvedeps);
|
||||
if ((r != 0) && (!arg_optional)) {
|
||||
log_error("ERROR: installing '%s' to '%s'", argv[optind], argv[optind + 1]);
|
||||
r = EXIT_FAILURE;
|
||||
}
|
||||
r = install_one(argv[optind], argv[optind + 1]);
|
||||
}
|
||||
|
||||
if (arg_optional)
|
||||
|
Binary file not shown.
44
lsinitrd.1.asc
Normal file
44
lsinitrd.1.asc
Normal file
@@ -0,0 +1,44 @@
|
||||
LSINITRD(1)
|
||||
=========
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
|
||||
NAME
|
||||
----
|
||||
lsinitrd - tool to show the contents of an initramfs image
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
*lsinitrd* ['OPTION...'] [<image>]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
lsinitrd shows the contents of an initramfs image. if <image> is omitted, then
|
||||
lsinitrd uses the default image _/boot/<machine-id>/<kernel-version>/initrd_ or
|
||||
_/boot/initramfs-<kernel-version>.img_.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
**-h, --help**::
|
||||
print a help message and exit.
|
||||
|
||||
**-s, --size**::
|
||||
sort the contents of the initramfs by size.
|
||||
|
||||
AVAILABILITY
|
||||
------------
|
||||
The lsinitrd 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
|
||||
|
||||
Amerigo Wang
|
||||
|
||||
Nikoli
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
*dracut*(8)
|
55
lsinitrd.sh
55
lsinitrd.sh
@@ -19,19 +19,60 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
[[ $# -le 2 ]] || { echo "Usage: $(basename $0) [-s] [<initramfs file> [<filename>]]" ; exit 1 ; }
|
||||
usage()
|
||||
{
|
||||
{
|
||||
echo "Usage: ${0##*/} [-s] [<initramfs file> [<filename>]]"
|
||||
echo
|
||||
echo "-h, --help print a help message and exit."
|
||||
echo "-s, --size sort the contents of the initramfs by size."
|
||||
echo
|
||||
} >&2
|
||||
}
|
||||
|
||||
[[ $# -le 2 ]] || { usage ; exit 1 ; }
|
||||
|
||||
sorted=0
|
||||
while getopts "s" opt; do
|
||||
case $opt in
|
||||
s) sorted=1;;
|
||||
\?) exit 1;;
|
||||
h) usage; exit 0;;
|
||||
\?) usage; exit 1;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
image="${1:-/boot/initramfs-$(uname -r).img}"
|
||||
[[ -f "$image" ]] || { echo "$image does not exist" ; exit 1 ; }
|
||||
KERNEL_VERSION="$(uname -r)"
|
||||
|
||||
if [[ "$1" ]]; then
|
||||
image="$1"
|
||||
if ! [[ -f "$image" ]]; then
|
||||
{
|
||||
echo "$image does not exist"
|
||||
echo
|
||||
} >&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
if [[ $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"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if ! [[ -f "$image" ]]; then
|
||||
{
|
||||
echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
|
||||
echo
|
||||
} >&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CAT=zcat
|
||||
FILE_T=$(file --dereference "$image")
|
||||
@@ -57,13 +98,13 @@ if [[ $# -eq 2 ]]; then
|
||||
exit $?
|
||||
fi
|
||||
|
||||
echo "$image: $(du -h $image | awk '{print $1}')"
|
||||
echo "$image: $(du -h $image | while read a b; do echo $a;done)"
|
||||
echo "========================================================================"
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout 'lib/dracut/dracut-*' 2>/dev/null
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout '*lib/dracut/dracut-*' 2>/dev/null
|
||||
echo "========================================================================"
|
||||
if [ "$sorted" -eq 1 ]; then
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
else
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -k9
|
||||
fi
|
||||
echo "========================================================================"
|
||||
|
65
mkinitrd.8.asc
Normal file
65
mkinitrd.8.asc
Normal file
@@ -0,0 +1,65 @@
|
||||
MKINITRD(8)
|
||||
=========
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
|
||||
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
modules.d/00systemd-bootchart/module-setup.sh
Executable file
18
modules.d/00systemd-bootchart/module-setup.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
[ -x $systemdutildir/systemd-bootchart ] || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_symlink /init /sbin/init
|
||||
dracut_install $systemdutildir/systemd-bootchart
|
||||
}
|
@@ -32,8 +32,6 @@ mount_boot()
|
||||
udevadm settle --timeout=30
|
||||
fi
|
||||
[ -e $boot ] && break
|
||||
modprobe scsi_wait_scan && rmmod scsi_wait_scan
|
||||
[ -e $boot ] && break
|
||||
sleep 0.5
|
||||
i=$(($i+1))
|
||||
[ $i -gt 40 ] && break
|
||||
@@ -45,23 +43,23 @@ mount_boot()
|
||||
mkdir /boot
|
||||
info "Mounting $boot as /boot"
|
||||
mount -oro "$boot" /boot || return 1
|
||||
elif [ -d "$NEWROOT/boot" ]; then
|
||||
rm -fr /boot
|
||||
ln -sf "$NEWROOT/boot" /boot
|
||||
fi
|
||||
}
|
||||
|
||||
do_fips()
|
||||
{
|
||||
info "Checking integrity of kernel"
|
||||
newroot=$NEWROOT
|
||||
KERNEL=$(uname -r)
|
||||
|
||||
[ -e "$newroot/boot/.vmlinuz-${KERNEL}.hmac" ] || unset newroot
|
||||
|
||||
if ! [ -e "$newroot/boot/.vmlinuz-${KERNEL}.hmac" ]; then
|
||||
warn "$newroot/boot/.vmlinuz-${KERNEL}.hmac does not exist"
|
||||
if ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
|
||||
warn "/boot/.vmlinuz-${KERNEL}.hmac does not exist"
|
||||
return 1
|
||||
fi
|
||||
|
||||
sha512hmac -c "$newroot/boot/.vmlinuz-${KERNEL}.hmac" || return 1
|
||||
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
|
||||
|
||||
FIPSMODULES=$(cat /etc/fipsmodules)
|
||||
|
||||
|
@@ -12,19 +12,18 @@ depends() {
|
||||
|
||||
installkernel() {
|
||||
local _fipsmodules _mod
|
||||
_fipsmodules="aead aes_generic xts aes-x86_64 ansi_cprng cbc ccm chainiv ctr"
|
||||
_fipsmodules+=" des deflate ecb eseqiv hmac seqiv sha256 sha512"
|
||||
_fipsmodules+=" cryptomgr crypto_null tcrypt dm-mod dm-crypt"
|
||||
_fipsmodules="aead aes_generic xts aes-x86_64 ansi_cprng cbc ccm chainiv ctr gcm ghash_generic"
|
||||
_fipsmodules+=" des deflate ecb eseqiv hmac seqiv sha256 sha256_generic sha512 sha512_generic"
|
||||
_fipsmodules+=" cryptomgr crypto_null tcrypt dm-mod dm-crypt lzo"
|
||||
|
||||
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
|
||||
|
||||
for _mod in $_fipsmodules; do
|
||||
if hostonly='' instmods $_mod; then
|
||||
if hostonly='' instmods -c -s $_mod; then
|
||||
echo $_mod >> "${initdir}/etc/fipsmodules"
|
||||
echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
|
||||
fi
|
||||
done
|
||||
hostonly='' instmods scsi_wait_scan
|
||||
}
|
||||
|
||||
install() {
|
||||
@@ -33,11 +32,11 @@ install() {
|
||||
inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
|
||||
inst_script "$moddir/fips.sh" /sbin/fips.sh
|
||||
|
||||
dracut_install sha512hmac rmmod insmod mount uname umount
|
||||
dracut_install sha512hmac rmmod insmod mount uname umount fipscheck
|
||||
|
||||
inst_libdir_file libsoftokn3.so libsoftokn3.so \
|
||||
libsoftokn3.chk libfreebl3.so libfreebl3.chk \
|
||||
'hmaccalc/sha512hmac.hmac'
|
||||
libssl.so 'hmaccalc/sha512hmac.hmac'
|
||||
|
||||
dracut_install -o prelink
|
||||
}
|
||||
|
@@ -14,6 +14,6 @@ install() {
|
||||
inst_hook pre-pivot 00 "$moddir/caps.sh"
|
||||
inst $(type -P capsh 2>/dev/null) /usr/sbin/capsh
|
||||
# capsh wants bash and we need bash also
|
||||
inst /bin/bash && ln -sf bash "${initdir}/bin/sh"
|
||||
inst /bin/bash
|
||||
}
|
||||
|
||||
|
@@ -12,7 +12,7 @@ depends() {
|
||||
|
||||
installkernel() {
|
||||
local _fipsmodules _mod
|
||||
_fipsmodules="aesni-intel"
|
||||
_fipsmodules="aesni-intel ghash_clmulni_intel"
|
||||
|
||||
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
|
||||
|
||||
|
19
modules.d/03rescue/module-setup.sh
Executable file
19
modules.d/03rescue/module-setup.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
# do not add this module by default
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install -o ps grep more cat rm strace free showmount \
|
||||
ping netstat rpcinfo vi scp ping6 ssh \
|
||||
fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.vfat e2fsck
|
||||
}
|
||||
|
@@ -23,5 +23,6 @@ install() {
|
||||
inst_hook cleanup 00 "$moddir/watchdog.sh"
|
||||
inst_hook cleanup 99 "$moddir/watchdog.sh"
|
||||
inst_hook emergency 02 "$moddir/watchdog-stop.sh"
|
||||
dracut_install -o wdctl
|
||||
}
|
||||
|
||||
|
2
modules.d/04watchdog/watchdog-stop.sh
Executable file
2
modules.d/04watchdog/watchdog-stop.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
[ -c /dev/watchdog ] && echo -n 'V' > /dev/watchdog
|
@@ -1,7 +1,12 @@
|
||||
#!/bin/sh
|
||||
if [ -e /dev/watchdog ]; then
|
||||
if [ ! -e /tmp/watchdog_timeout ]; then
|
||||
wdctl -s 60 /dev/watchdog >/dev/null 2>&1
|
||||
> /tmp/watchdog_timeout
|
||||
fi
|
||||
info "Triggering watchdog"
|
||||
>/dev/watchdog
|
||||
else
|
||||
modprobe ib700wdt
|
||||
modprobe i6300esb
|
||||
fi
|
||||
|
@@ -13,9 +13,10 @@ depends() {
|
||||
}
|
||||
|
||||
install() {
|
||||
local _i _progs _path
|
||||
inst busybox /usr/bin/busybox
|
||||
for _i in `/sbin/busybox | sed -ne '1,/Currently/!{s/,//g; s/busybox//g; p}'`
|
||||
local _i _progs _path _busybox
|
||||
_busybox=$(type -P busybox)
|
||||
inst $_busybox /usr/bin/busybox
|
||||
for _i in $($_busybox | sed -ne '1,/Currently/!{s/,//g; s/busybox//g; p}')
|
||||
do
|
||||
_progs="$_progs $_i"
|
||||
done
|
||||
@@ -26,11 +27,7 @@ install() {
|
||||
for _i in $_progs; do
|
||||
_path=$(find_binary "$_i")
|
||||
[ -z "$_path" ] && continue
|
||||
if [[ $_path != ${_path#/usr} ]]; then
|
||||
ln -sf ../../usr/bin/busybox "$initdir/$_path"
|
||||
else
|
||||
ln -sf ../usr/bin/busybox "$initdir/$_path"
|
||||
fi
|
||||
ln_r /usr/bin/busybox $_path
|
||||
done
|
||||
}
|
||||
|
||||
|
@@ -1,2 +1,2 @@
|
||||
# Console initialization - keyboard, font, etc.
|
||||
KERNEL=="tty0", RUN+="/lib/udev/console_init $root/$name"
|
||||
KERNEL=="tty0", RUN+="/sbin/initqueue --onetime --unique --name console_init_$name /lib/udev/console_init $root/$name"
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Dracut i18n module
|
||||
dracut i18n module
|
||||
------------------
|
||||
|
||||
INDEX
|
||||
@@ -21,7 +21,7 @@ is intended to be generic across different GNU/Linux distributions.
|
||||
i18n and keyboard settings are stored in different files among
|
||||
distributions. To deal with it avoiding hardcoding those differences in
|
||||
the installation script we handle it by mappings between variables used
|
||||
by Dracut and the ones in the system. Package maintainer is expected to
|
||||
by dracut and the ones in the system. Package maintainer is expected to
|
||||
create those for his/her distribution and it's appreciated to share it
|
||||
with us, so we can include it in source package.
|
||||
|
||||
|
@@ -2,7 +2,11 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
[ -x /lib/systemd/systemd-vconsole-setup ] && exit 0
|
||||
[ -n "$DRACUT_SYSTEMD" ] && exit 0
|
||||
|
||||
if [ -x $systemdutildir/systemd-vconsole-setup ]; then
|
||||
$systemdutildir/systemd-vconsole-setup "$@"
|
||||
fi
|
||||
|
||||
[ -e /etc/vconsole.conf ] && . /etc/vconsole.conf
|
||||
|
||||
|
@@ -12,7 +12,7 @@ depends() {
|
||||
}
|
||||
|
||||
install() {
|
||||
[ -x /lib/systemd/systemd-vconsole-setup ] && dracut_install /lib/systemd/systemd-vconsole-setup
|
||||
dracut_install -o $systemdutildir/systemd-vconsole-setup
|
||||
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
|
||||
DEFAULT_FONT=LatArCyrHeb-16
|
||||
I18N_CONF="/etc/locale.conf"
|
||||
@@ -31,7 +31,7 @@ install() {
|
||||
*) cmd=grep ;;
|
||||
esac
|
||||
|
||||
for INCL in $($cmd "^include " $MAP | while read a a b; do echo ${a/\"/}; done); do
|
||||
for INCL in $($cmd "^include " $MAP | while read a a b; do echo ${a//\"/}; done); do
|
||||
for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
|
||||
findkeymap $FN
|
||||
done
|
||||
@@ -74,9 +74,11 @@ install() {
|
||||
for map in ${item[1]//,/ }
|
||||
do
|
||||
map=(${map//-/ })
|
||||
value=$(grep "^${map[0]}=" "${item[0]}")
|
||||
value=${value#*=}
|
||||
echo "${map[1]:-${map[0]}}=${value}"
|
||||
if [[ -f "${item[0]}" ]]; then
|
||||
value=$(grep "^${map[0]}=" "${item[0]}")
|
||||
value=${value#*=}
|
||||
echo "${map[1]:-${map[0]}}=${value}"
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
@@ -84,9 +86,11 @@ install() {
|
||||
install_base() {
|
||||
dracut_install setfont loadkeys kbd_mode stty
|
||||
|
||||
inst ${moddir}/console_init.sh /lib/udev/console_init
|
||||
inst_rules ${moddir}/10-console.rules
|
||||
inst_hook cmdline 20 "${moddir}/parse-i18n.sh"
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst ${moddir}/console_init.sh /lib/udev/console_init
|
||||
inst_rules ${moddir}/10-console.rules
|
||||
inst_hook cmdline 20 "${moddir}/parse-i18n.sh"
|
||||
fi
|
||||
}
|
||||
|
||||
install_all_kbd() {
|
||||
@@ -94,7 +98,7 @@ install() {
|
||||
|
||||
for _src in $(eval echo ${kbddir}/{${KBDSUBDIRS}}); do
|
||||
inst_dir "$_src"
|
||||
cp --reflink=auto --sparse=auto -prfL -t "${initdir}/${_src%/*}" "$_src"
|
||||
cp --reflink=auto --sparse=auto -prfL -t "${initdir}/${_src}" "$_src"/*
|
||||
done
|
||||
|
||||
# remove unnecessary files
|
||||
@@ -155,9 +159,10 @@ install() {
|
||||
EXT_KEYMAPS+=\ ${UNIKEYMAP}\ ${GRP_TOGGLE}
|
||||
|
||||
[[ ${KEYMAP} ]] || {
|
||||
derror 'No KEYMAP.'
|
||||
dinfo 'No KEYMAP configured.'
|
||||
return 1
|
||||
}
|
||||
|
||||
findkeymap ${KEYMAP}
|
||||
|
||||
for map in ${EXT_KEYMAPS}
|
||||
@@ -170,7 +175,7 @@ install() {
|
||||
|
||||
inst_opt_decompress ${kbddir}/consolefonts/${DEFAULT_FONT}.*
|
||||
|
||||
if [[ ${FONT} ]]
|
||||
if [[ ${FONT} ]] && [[ ${FONT} != ${DEFAULT_FONT} ]]
|
||||
then
|
||||
FONT=${FONT%.psf*}
|
||||
inst_opt_decompress ${kbddir}/consolefonts/${FONT}.*
|
||||
|
@@ -13,21 +13,21 @@ inst_key_val() {
|
||||
_value=$(getarg $@)
|
||||
[ -z "${_value}" ] && _value=$_default
|
||||
if [ -n "${_value}" ]; then
|
||||
printf '%s="%s"\n' $1 ${_value} >> $_file
|
||||
printf '%s="%s"\n' $2 ${_value} >> $_file
|
||||
fi
|
||||
unset _file
|
||||
unset _value
|
||||
}
|
||||
|
||||
inst_key_val '' /etc/vconsole.conf KEYMAP vconsole.keymap KEYTABLE
|
||||
inst_key_val '' /etc/vconsole.conf FONT vconsole.font SYSFONT
|
||||
inst_key_val '' /etc/vconsole.conf FONT_MAP vconsole.font.map CONTRANS
|
||||
inst_key_val '' /etc/vconsole.conf FONT_UNIMAP vconsole.font.unimap UNIMAP
|
||||
inst_key_val 1 /etc/vconsole.conf UNICODE vconsole.unicode vconsole.font.unicode
|
||||
inst_key_val '' /etc/vconsole.conf EXT_KEYMAP vconsole.keymap.ext
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.keymap KEYMAP -d KEYTABLE
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.font FONT -d SYSFONT
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.font.map FONT_MAP -d CONTRANS
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.font.unimap FONT_UNIMAP -d UNIMAP
|
||||
inst_key_val 1 /etc/vconsole.conf vconsole.font.unicode UNICODE vconsole.unicode
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.keymap.ext EXT_KEYMAP
|
||||
|
||||
inst_key_val '' /etc/locale.conf LANG locale.LANG
|
||||
inst_key_val '' /etc/locale.conf LC_ALL locale.LC_ALL
|
||||
inst_key_val '' /etc/locale.conf locale.LANG LANG
|
||||
inst_key_val '' /etc/locale.conf locale.LC_ALL LC_ALL
|
||||
|
||||
if [ -f /etc/locale.conf ]; then
|
||||
. /etc/locale.conf
|
||||
@@ -35,10 +35,8 @@ if [ -f /etc/locale.conf ]; then
|
||||
export LC_ALL
|
||||
fi
|
||||
|
||||
# FIXME: fix systemd-vconsole-setup
|
||||
#if [ -x /lib/systemd/systemd-vconsole-setup ]; then
|
||||
# /lib/systemd/systemd-vconsole-setup
|
||||
# rm -f /{etc,lib}/udev/rules.d/10-console.rules
|
||||
# rm -f /lib/udev/console_init
|
||||
# ln -s /lib/systemd/systemd-vconsole-setup /lib/udev/console_init
|
||||
#fi
|
||||
if [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
rm -f /etc/udev/rules.d/10-console.rules
|
||||
rm -f /lib/udev/rules.d/10-console.rules
|
||||
rm -f /lib/udev/console_init
|
||||
fi
|
||||
|
@@ -73,13 +73,35 @@ if [[ ! -e "$testfile" ]]; then
|
||||
fi
|
||||
rm -f "$testfile"
|
||||
|
||||
ismounted() {
|
||||
while read a m a; do
|
||||
[[ "$m" = "$1" ]] && return 0
|
||||
find_mount() {
|
||||
local dev mnt etc wanted_dev
|
||||
wanted_dev="$(readlink -e -q $1)"
|
||||
while read dev mnt etc; do
|
||||
[ "$dev" = "$wanted_dev" ] && echo "$dev" && return 0
|
||||
done < /proc/mounts
|
||||
return 1
|
||||
}
|
||||
|
||||
# usage: ismounted <mountpoint>
|
||||
# usage: ismounted /dev/<device>
|
||||
if command -v findmnt >/dev/null; then
|
||||
ismounted() {
|
||||
findmnt "$1" > /dev/null 2>&1
|
||||
}
|
||||
else
|
||||
ismounted() {
|
||||
if [ -b "$1" ]; then
|
||||
find_mount "$1" > /dev/null && return 0
|
||||
return 1
|
||||
fi
|
||||
|
||||
while read a m a; do
|
||||
[ "$m" = "$1" ] && return 0
|
||||
done < /proc/mounts
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
|
||||
# clean up after ourselves no matter how we die.
|
||||
cleanup() {
|
||||
echo "Something failed. Move back to the original state"
|
||||
|
@@ -25,8 +25,7 @@ setup_interface() {
|
||||
if ! ip link set $netif mtu $mtu ; then
|
||||
ip link set $netif down
|
||||
ip link set $netif mtu $mtu
|
||||
ip link set $netif up
|
||||
wait_for_if_up $netif
|
||||
linkup $netif
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -51,6 +50,7 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
export PS4="dhclient.$interface.$$ + "
|
||||
exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
|
||||
# We already need a set netif here
|
||||
netif=$interface
|
||||
@@ -61,8 +61,7 @@ netif=$interface
|
||||
case $reason in
|
||||
PREINIT)
|
||||
echo "dhcp: PREINIT $netif up"
|
||||
ip link set $netif up
|
||||
wait_for_if_up $netif
|
||||
linkup $netif
|
||||
;;
|
||||
BOUND)
|
||||
echo "dhcp: BOND setting $netif"
|
||||
@@ -88,9 +87,12 @@ case $reason in
|
||||
echo "setup_net $netif"
|
||||
echo "source_hook initqueue/online $netif"
|
||||
[ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
|
||||
echo "> /tmp/setup_net_$netif.ok"
|
||||
echo "> /tmp/setup_net_\$(cat /sys/class/net/$netif/address).ok"
|
||||
echo "rm -f $hookdir/initqueue/setup_net_$netif.sh"
|
||||
} > $hookdir/initqueue/setup_net_$netif.sh
|
||||
|
||||
echo "[ -f /tmp/setup_net_$netif.ok ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
|
||||
>/tmp/net.$netif.up
|
||||
;;
|
||||
*) echo "dhcp: $reason";;
|
||||
|
@@ -7,15 +7,28 @@ if ! getarg ifname= >/dev/null ; then
|
||||
return
|
||||
fi
|
||||
|
||||
command -v parse_ifname_opts >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
{
|
||||
for p in $(getargs ifname=); do
|
||||
parse_ifname_opts $p
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="%s", ATTR{type}=="1", NAME="%s"\n' "$ifname_mac" "$ifname_if"
|
||||
done
|
||||
|
||||
# Rename non named interfaces out of the way for named ones.
|
||||
for p in $(getargs ifname=); do
|
||||
parse_ifname_opts $p
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="?*", ATTR{type}=="1", NAME!="?*", KERNEL=="%s", NAME="%%k-renamed"\n' "$ifname_if"
|
||||
if [ -f /tmp/ifname-$ifname_mac ]; then
|
||||
read oldif < /tmp/ifname-$ifname_mac
|
||||
fi
|
||||
if [ -f /tmp/ifname-$ifname_if ]; then
|
||||
read oldmac < /tmp/ifname-$ifname_if
|
||||
fi
|
||||
if [ -n "$oldif" -a -n "$oldmac" -a "$oldif" = "$ifname_if" -a "$oldmac" = "$ifname_mac" ]; then
|
||||
# skip same ifname= declaration
|
||||
continue
|
||||
fi
|
||||
|
||||
[ -n "$oldif" ] && warn "Multiple interface names specified for MAC $ifname_mac: $oldif"
|
||||
[ -n "$oldmac" ] && warn "Multiple MAC specified for $ifname_if: $oldmac"
|
||||
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="%s", ATTR{type}=="1", NAME="%s"\n' "$ifname_mac" "$ifname_if"
|
||||
echo $ifname_if > /tmp/ifname-$ifname_mac
|
||||
echo $ifname_mac > /tmp/ifname-$ifname_if
|
||||
done
|
||||
} > /etc/udev/rules.d/50-ifname.rules
|
||||
} >> /etc/udev/rules.d/80-ifname.rules
|
||||
|
@@ -17,6 +17,8 @@ type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
|
||||
# $netif reads easier than $1
|
||||
netif=$1
|
||||
use_bridge='false'
|
||||
use_vlan='false'
|
||||
|
||||
# enslave this interface to bond?
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
@@ -28,6 +30,15 @@ if [ -e /tmp/bond.info ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -e /tmp/team.info ]; then
|
||||
. /tmp/team.info
|
||||
for slave in $teamslaves ; do
|
||||
if [ "$netif" = "$slave" ] ; then
|
||||
netif=$teammaster
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# bridge this interface?
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
@@ -37,6 +48,7 @@ if [ -e /tmp/bridge.info ]; then
|
||||
: # We need to really setup bond (recursive call)
|
||||
else
|
||||
netif="$bridgename"
|
||||
use_bridge='true'
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@@ -49,6 +61,7 @@ if [ -e /tmp/vlan.info ]; then
|
||||
: # We need to really setup bond (recursive call)
|
||||
else
|
||||
netif="$vlanname"
|
||||
use_vlan='true'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -84,44 +97,33 @@ do_ipv6auto() {
|
||||
echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
|
||||
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
|
||||
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
|
||||
ip link set $netif up
|
||||
wait_for_if_up $netif
|
||||
linkup $netif
|
||||
|
||||
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
|
||||
namesrv=$(getargs nameserver)
|
||||
if [ -n "$namesrv" ] ; then
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
done
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
return 0
|
||||
}
|
||||
|
||||
# Handle static ip configuration
|
||||
do_static() {
|
||||
strstr $ip '*:*:*' && load_ipv6
|
||||
|
||||
ip link set $netif up
|
||||
wait_for_if_up $netif
|
||||
[ -n "$macaddr" ] && ip link set address $macaddr
|
||||
[ -n "$mtu" ] && ip link set mtu $mtu
|
||||
linkup $netif
|
||||
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
|
||||
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
|
||||
if strstr $ip '*:*:*'; then
|
||||
# note no ip addr flush for ipv6
|
||||
ip addr add $ip/$mask dev $netif
|
||||
ip addr add $ip/$mask ${srv+peer $srv} dev $netif
|
||||
else
|
||||
ip addr flush dev $netif
|
||||
ip addr add $ip/$mask brd + dev $netif
|
||||
ip addr add $ip/$mask ${srv+peer $srv} brd + dev $netif
|
||||
fi
|
||||
|
||||
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
|
||||
namesrv=$(getargs nameserver)
|
||||
if [ -n "$namesrv" ] ; then
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
done
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
> /tmp/setup_net_${netif}.ok
|
||||
return 0
|
||||
}
|
||||
|
||||
# loopback is always handled the same way
|
||||
@@ -157,13 +159,12 @@ if [ -e /tmp/bond.info ]; then
|
||||
fi
|
||||
done
|
||||
|
||||
ip link set $netif up
|
||||
linkup $netif
|
||||
|
||||
for slave in $bondslaves ; do
|
||||
ip link set $slave down
|
||||
echo "+$slave" > /sys/class/net/$bondname/bonding/slaves
|
||||
ip link set $slave up
|
||||
wait_for_if_up $slave
|
||||
linkup $slave
|
||||
done
|
||||
|
||||
# add the bits to setup the needed post enslavement parameters
|
||||
@@ -177,6 +178,28 @@ if [ -e /tmp/bond.info ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e /tmp/team.info ]; then
|
||||
. /tmp/team.info
|
||||
if [ "$netif" = "$teammaster" ] && [ ! -e /tmp/net.$teammaster.up ] ; then
|
||||
# We shall only bring up those _can_ come up
|
||||
# in case of some slave is gone in active-backup mode
|
||||
working_slaves=""
|
||||
for slave in $teamslaves ; do
|
||||
ip link set $slave up 2>/dev/null
|
||||
if wait_for_if_up $slave; then
|
||||
working_slaves+="$slave "
|
||||
fi
|
||||
done
|
||||
# Do not add slaves now
|
||||
teamd -d -U -n -t $teammaster -f /etc/teamd/$teammaster.conf
|
||||
for slave in $working_slaves; do
|
||||
# team requires the slaves to be down before joining team
|
||||
ip link set $slave down
|
||||
teamdctl $teammaster port add $slave
|
||||
done
|
||||
ip link set $teammaster up
|
||||
fi
|
||||
fi
|
||||
|
||||
# XXX need error handling like dhclient-script
|
||||
|
||||
@@ -190,9 +213,8 @@ if [ -e /tmp/bridge.info ]; then
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
DO_BOND_SETUP=yes ifup $bondname -m
|
||||
else
|
||||
ip link set $ethname up
|
||||
linkup $ethname
|
||||
fi
|
||||
wait_for_if_up $ethname
|
||||
brctl addif $bridgename $ethname
|
||||
done
|
||||
fi
|
||||
@@ -201,10 +223,10 @@ fi
|
||||
get_vid() {
|
||||
case "$1" in
|
||||
vlan*)
|
||||
return ${1#vlan}
|
||||
echo ${1#vlan}
|
||||
;;
|
||||
*.*)
|
||||
return ${1##*.}
|
||||
echo ${1##*.}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -214,12 +236,19 @@ if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
|
||||
if [ "$phydevice" = "$bondname" ] ; then
|
||||
DO_BOND_SETUP=yes ifup $phydevice -m
|
||||
else
|
||||
ip link set "$phydevice" up
|
||||
linkup "$phydevice"
|
||||
fi
|
||||
wait_for_if_up "$phydevice"
|
||||
ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname; echo $?)"
|
||||
ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname)"
|
||||
fi
|
||||
|
||||
# setup nameserver
|
||||
namesrv=$(getargs nameserver)
|
||||
if [ -n "$namesrv" ] ; then
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
done
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
|
||||
# No ip lines default to dhcp
|
||||
ip=$(getarg ip)
|
||||
|
||||
@@ -231,6 +260,7 @@ if [ -z "$ip" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Specific configuration, spin through the kernel command line
|
||||
# looking for ip= lines
|
||||
for p in $(getargs ip=); do
|
||||
@@ -239,7 +269,9 @@ for p in $(getargs ip=); do
|
||||
[ "$autoconf" = "ibft" ] && continue
|
||||
|
||||
# If this option isn't directed at our interface, skip it
|
||||
[ -n "$dev" ] && [ "$dev" != "$netif" ] && continue
|
||||
[ -n "$dev" ] && [ "$dev" != "$netif" ] && \
|
||||
[ "$use_bridge" != 'true' ] && \
|
||||
[ "$use_vlan" != 'true' ] && continue
|
||||
|
||||
# Store config for later use
|
||||
for i in ip srv gw mask hostname macaddr; do
|
||||
|
@@ -64,21 +64,17 @@ installkernel() {
|
||||
{ find_kernel_modules_by_path drivers/net; if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then find_kernel_modules_by_path drivers/s390/net; fi; } \
|
||||
| net_module_filter | instmods
|
||||
|
||||
instmods =drivers/net/phy
|
||||
instmods ecb arc4
|
||||
# bridge modules
|
||||
instmods bridge stp llc
|
||||
instmods ipv6
|
||||
# bonding
|
||||
instmods bonding
|
||||
# vlan
|
||||
instmods 8021q
|
||||
#instmods() will take care of hostonly
|
||||
instmods =drivers/net/phy ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net =drivers/net/team
|
||||
}
|
||||
|
||||
install() {
|
||||
local _arch _i _dir
|
||||
dracut_install ip arping dhclient sed
|
||||
dracut_install -o ping ping6
|
||||
dracut_install -o brctl
|
||||
dracut_install -o teamd teamdctl teamnl
|
||||
inst_simple /etc/libnl/classid
|
||||
inst_script "$moddir/ifup.sh" "/sbin/ifup"
|
||||
inst_script "$moddir/netroot.sh" "/sbin/netroot"
|
||||
inst_script "$moddir/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
@@ -89,6 +85,7 @@ install() {
|
||||
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
|
||||
inst_hook cmdline 95 "$moddir/parse-vlan.sh"
|
||||
inst_hook cmdline 96 "$moddir/parse-bond.sh"
|
||||
inst_hook cmdline 96 "$moddir/parse-team.sh"
|
||||
inst_hook cmdline 97 "$moddir/parse-bridge.sh"
|
||||
inst_hook cmdline 98 "$moddir/parse-ip-opts.sh"
|
||||
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
|
||||
@@ -98,5 +95,7 @@ install() {
|
||||
|
||||
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
|
||||
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"
|
||||
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
||||
|
@@ -15,26 +15,41 @@ fix_bootif() {
|
||||
}
|
||||
|
||||
# Don't continue if we don't need network
|
||||
[ -z "$netroot" ] && ! [ -e "/tmp/net.ifaces" ] && return;
|
||||
if [ -z "$netroot" ] && [ ! -e "/tmp/net.ifaces" ] && ! getargbool 0 rd.neednet >/dev/null; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Write udev rules
|
||||
{
|
||||
# bridge: attempt only the defined interface
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
IFACES+=" ${ethnames%% *}"
|
||||
IFACES="$IFACES ${ethnames%% *}"
|
||||
fi
|
||||
|
||||
# bond: attempt only the defined interface (override bridge defines)
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
# It is enough to fire up only one
|
||||
IFACES+=" ${bondslaves%% *}"
|
||||
IFACES="$IFACES ${bondslaves%% *}"
|
||||
fi
|
||||
|
||||
if [ -e /tmp/team.info ]; then
|
||||
. /tmp/team.info
|
||||
IFACES="$IFACES ${teamslaves}"
|
||||
fi
|
||||
|
||||
if [ -e /tmp/vlan.info ]; then
|
||||
. /tmp/vlan.info
|
||||
IFACES+=" $phydevice"
|
||||
IFACES="$IFACES $phydevice"
|
||||
fi
|
||||
|
||||
if [ -z "$IFACES" ]; then
|
||||
[ -e /tmp/net.ifaces ] && read IFACES < /tmp/net.ifaces
|
||||
fi
|
||||
|
||||
if [ -e /tmp/net.bootdev ]; then
|
||||
bootdev=$(cat /tmp/net.bootdev)
|
||||
fi
|
||||
|
||||
ifup='/sbin/ifup $env{INTERFACE}'
|
||||
@@ -45,16 +60,23 @@ fix_bootif() {
|
||||
if [ -n "$BOOTIF" ] ; then
|
||||
BOOTIF=$(fix_bootif "$BOOTIF")
|
||||
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="%s"\n' "$BOOTIF" "/sbin/initqueue --onetime $ifup"
|
||||
echo "[ -f /tmp/setup_net_${BOOTIF}.ok ]" >$hookdir/initqueue/finished/wait-${BOOTIF}.sh
|
||||
|
||||
# If we have to handle multiple interfaces, handle only them.
|
||||
elif [ -n "$IFACES" ] ; then
|
||||
for iface in $IFACES ; do
|
||||
printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="%s"\n' "$iface" "/sbin/initqueue --onetime $ifup"
|
||||
if [ "$bootdev" = "$iface" ]; then
|
||||
echo "[ -f /tmp/setup_net_${iface}.ok ]" >$hookdir/initqueue/finished/wait-$iface.sh
|
||||
fi
|
||||
done
|
||||
|
||||
# Default: We don't know the interface to use, handle all
|
||||
# Fixme: waiting for the interface as well.
|
||||
else
|
||||
printf 'SUBSYSTEM=="net", RUN+="%s"\n' "/sbin/initqueue --onetime $ifup" > /etc/udev/rules.d/61-default-net.rules
|
||||
# if you change the name of "91-default-net.rules", also change modules.d/80cms/cmssetup.sh
|
||||
printf 'SUBSYSTEM=="net", RUN+="%s"\n' "/sbin/initqueue --onetime $ifup" > /etc/udev/rules.d/91-default-net.rules
|
||||
fi
|
||||
|
||||
} > /etc/udev/rules.d/60-net.rules
|
||||
# if you change the name of "90-net.rules", also change modules.d/80cms/cmssetup.sh
|
||||
} > /etc/udev/rules.d/90-net.rules
|
||||
|
@@ -1,4 +1,6 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
get_ip() {
|
||||
local iface="$1" ip=""
|
||||
@@ -145,8 +147,8 @@ ibft_to_cmdline() {
|
||||
for iface in /sys/firmware/ibft/ethernet*; do
|
||||
[ -e ${iface}/mac ] || continue
|
||||
mac=$(read a < ${iface}/mac; echo $a)
|
||||
[ -z "$ifname_mac" ] && continue
|
||||
dev=$(set_ifname ibft $ifname_mac)
|
||||
[ -z "$mac" ] && continue
|
||||
dev=$(set_ifname ibft $mac)
|
||||
dhcp=$(read a < ${iface}/dhcp; echo $a)
|
||||
if [ -n "$dhcp" ]; then
|
||||
echo "ip=$dev:dhcp"
|
||||
@@ -157,6 +159,7 @@ ibft_to_cmdline() {
|
||||
hostname=$(read a < ${iface}/hostname; echo $a)
|
||||
echo "ip=$ip::$gw:$mask:$hostname:$dev:none"
|
||||
fi
|
||||
echo $mac > /tmp/net.${dev}.has_ibft_config
|
||||
done
|
||||
) >> /etc/cmdline.d/40-ibft.conf
|
||||
# reread cmdline
|
||||
@@ -269,10 +272,15 @@ ip_to_var() {
|
||||
case $# in
|
||||
0) autoconf="error" ;;
|
||||
1) autoconf=$1 ;;
|
||||
2) dev=$1; autoconf=$2 ;;
|
||||
3) dev=$1; autoconf=$2; mtu=$3 ;;
|
||||
4) dev=$1; autoconf=$2; mtu=$3; macaddr=$4 ;;
|
||||
*) ip=$1; srv=$2; gw=$3; mask=$4; hostname=$5; dev=$6; autoconf=$7; mtu=$8; macaddr=$9 ;;
|
||||
2) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2 ;;
|
||||
3) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2; [ -n "$3" ] && mtu=$3 ;;
|
||||
4) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2; [ -n "$3" ] && mtu=$3; [ -n "$4" ] && macaddr=$4 ;;
|
||||
*) [ -n "$1" ] && ip=$1; [ -n "$2" ] && srv=$2; [ -n "$3" ] && gw=$3; [ -n "$4" ] && mask=$4;
|
||||
[ -n "$5" ] && hostname=$5; [ -n "$6" ] && dev=$6; [ -n "$7" ] && autoconf=$7; [ -n "$8" ] && mtu=$8;
|
||||
if [ -n "${9}" -a -n "${10}" -a -n "${11}" -a -n "${12}" -a -n "${13}" -a -n "${14}" ]; then
|
||||
macaddr="${9}:${10}:${11}:${12}:${13}:${14}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
# anaconda-style argument cluster
|
||||
if strstr "$autoconf" "*.*.*.*"; then
|
||||
@@ -289,3 +297,72 @@ ip_to_var() {
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
parse_ifname_opts() {
|
||||
local IFS=:
|
||||
set $1
|
||||
|
||||
case $# in
|
||||
7)
|
||||
ifname_if=$1
|
||||
# udev requires MAC addresses to be lower case
|
||||
ifname_mac=$(echo $2:$3:$4:$5:$6:$7 | sed 'y/ABCDEF/abcdef/')
|
||||
;;
|
||||
*)
|
||||
die "Invalid arguments for ifname="
|
||||
;;
|
||||
esac
|
||||
|
||||
case $ifname_if in
|
||||
eth[0-9]|eth[0-9][0-9]|eth[0-9][0-9][0-9]|eth[0-9][0-9][0-9][0-9])
|
||||
warn "ifname=$ifname_if uses the kernel name space for interfaces"
|
||||
warn "This can fail for multiple network interfaces and is discouraged!"
|
||||
warn "Please use a custom name like \"netboot\" or \"bluesocket\""
|
||||
warn "or use biosdevname and no ifname= at all."
|
||||
;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
# some network driver need long time to initialize, wait before it's ready.
|
||||
wait_for_if_link() {
|
||||
local cnt=0
|
||||
local li
|
||||
while [ $cnt -lt 600 ]; do
|
||||
li=$(ip -o link show dev $1 2>/dev/null)
|
||||
[ -n "$li" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
wait_for_if_up() {
|
||||
local cnt=0
|
||||
local li
|
||||
while [ $cnt -lt 200 ]; do
|
||||
li=$(ip -o link show up dev $1)
|
||||
[ -n "$li" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
wait_for_route_ok() {
|
||||
local cnt=0
|
||||
while [ $cnt -lt 200 ]; do
|
||||
li=$(ip route show)
|
||||
[ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
linkup() {
|
||||
wait_for_if_link $1 2>/dev/null\
|
||||
&& ip link set $1 up 2>/dev/null\
|
||||
&& wait_for_if_up $1 2>/dev/null
|
||||
}
|
||||
|
||||
|
@@ -24,9 +24,6 @@ netif=$1
|
||||
# handlers when this is not called from manually network bringing up.
|
||||
if [ -z "$2" ]; then
|
||||
if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then
|
||||
# Unset root so we can check later
|
||||
unset root
|
||||
|
||||
# Load dhcp options
|
||||
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
|
||||
|
||||
@@ -67,6 +64,7 @@ source_hook netroot $netif
|
||||
# Run the handler; don't store the root, it may change from device to device
|
||||
# XXX other variables to export?
|
||||
if $handler $netif $netroot $NEWROOT; then
|
||||
rm -f $hookdir/initqueue/finished/dhcp.sh
|
||||
# Network rootfs mount successful - save interface info for ifcfg etc.
|
||||
save_netinfo $netif
|
||||
fi
|
||||
|
@@ -18,21 +18,7 @@ if ! getarg ifname= >/dev/null ; then
|
||||
return
|
||||
fi
|
||||
|
||||
parse_ifname_opts() {
|
||||
local IFS=:
|
||||
set $1
|
||||
|
||||
case $# in
|
||||
7)
|
||||
ifname_if=$1
|
||||
# udev requires MAC addresses to be lower case
|
||||
ifname_mac=$(echo $2:$3:$4:$5:$6:$7 | sed 'y/ABCDEF/abcdef/')
|
||||
;;
|
||||
*)
|
||||
die "Invalid arguments for ifname="
|
||||
;;
|
||||
esac
|
||||
}
|
||||
command -v parse_ifname_opts >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
# Check ifname= lines
|
||||
for p in $(getargs ifname=); do
|
||||
|
@@ -40,9 +40,10 @@ fi
|
||||
unset count
|
||||
|
||||
# If needed, check if bootdev= contains anything usable
|
||||
BOOTDEV=$(getarg bootdev=)
|
||||
|
||||
if [ -n "$NEEDBOOTDEV" ] ; then
|
||||
BOOTDEV=$(getarg bootdev=) || die "Please supply bootdev argument for multiple ip= lines"
|
||||
[ -z "$BOOTDEV" ] && die "Bootdev argument is empty"
|
||||
[ -z "$BOOTDEV" ] && warn "Please supply bootdev argument for multiple ip= lines"
|
||||
fi
|
||||
|
||||
# If ibft is requested, read ibft vals and write ip=XXX cmdline args
|
||||
@@ -96,9 +97,6 @@ for p in $(getargs ip=); do
|
||||
IFACES="$IFACES $dev"
|
||||
fi
|
||||
|
||||
# Small optimization for udev rules
|
||||
[ -z "$NEEDBOOTDEV" ] && [ -n "$dev" ] && BOOTDEV=$dev
|
||||
|
||||
# Do we need to check for specific options?
|
||||
if [ -n "$NEEDDHCP" ] || [ -n "$DHCPORSERVER" ] ; then
|
||||
# Correct device? (Empty is ok as well)
|
||||
|
44
modules.d/40network/parse-team.sh
Executable file
44
modules.d/40network/parse-team.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Format:
|
||||
# team=<teammaster>:<teamslaves>
|
||||
#
|
||||
# teamslaves is a comma-separated list of physical (ethernet) interfaces
|
||||
#
|
||||
|
||||
# return if team already parsed
|
||||
[ -n "$teammaster" ] && return
|
||||
|
||||
# Check if team parameter is valid
|
||||
if getarg team= >/dev/null ; then
|
||||
:
|
||||
fi
|
||||
|
||||
parseteam() {
|
||||
local v=${1}:
|
||||
set --
|
||||
while [ -n "$v" ]; do
|
||||
set -- "$@" "${v%%:*}"
|
||||
v=${v#*:}
|
||||
done
|
||||
|
||||
unset teammaster teamslaves
|
||||
case $# in
|
||||
2) teammaster=$1; teamslaves=$(str_replace "$2" "," " ") ;;
|
||||
*) die "team= requires two parameters" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
unset teammaster teamslaves
|
||||
|
||||
if getarg team>/dev/null; then
|
||||
# Read team= parameters if they exist
|
||||
team="$(getarg team=)"
|
||||
if [ ! "$team" = "team" ]; then
|
||||
parseteam "$(getarg team=)"
|
||||
fi
|
||||
|
||||
echo "teammaster=$teammaster" > /tmp/team.info
|
||||
echo "teamslaves=\"$teamslaves\"" >> /tmp/team.info
|
||||
return
|
||||
fi
|
@@ -85,6 +85,7 @@ print_s390() {
|
||||
|
||||
|
||||
for netif in $IFACES ; do
|
||||
[ -e /tmp/ifcfg/ifcfg-$netif ] && continue
|
||||
# bridge?
|
||||
unset bridge
|
||||
unset bond
|
||||
@@ -104,23 +105,31 @@ for netif in $IFACES ; do
|
||||
echo "UUID=$uuid"
|
||||
[ -n "$mtu" ] && echo "MTU=$mtu"
|
||||
if [ -f /tmp/net.$netif.lease ]; then
|
||||
strstr "$ip" '*:*:*' &&
|
||||
echo "DHCPV6C=yes"
|
||||
echo "BOOTPROTO=dhcp"
|
||||
strstr "$ip" '*:*:*' && echo "IPV6INIT=yes"
|
||||
if [ -f /tmp/net.$netif.has_ibft_config ]; then
|
||||
echo "BOOTPROTO=ibft"
|
||||
else
|
||||
echo "BOOTPROTO=dhcp"
|
||||
fi
|
||||
cp /tmp/net.$netif.lease /tmp/ifcfg-leases/dhclient-$uuid-$netif.lease
|
||||
else
|
||||
# If we've booted with static ip= lines, the override file is there
|
||||
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
|
||||
if strstr "$ip" '*:*:*'; then
|
||||
echo "IPV6INIT=yes"
|
||||
echo "IPV6_AUTOCONF=no"
|
||||
echo "IPV6ADDR=$ip/$mask"
|
||||
else
|
||||
echo "BOOTPROTO=none"
|
||||
echo "IPADDR=$ip"
|
||||
if strstr "$mask" "."; then
|
||||
echo "NETMASK=$mask"
|
||||
if [ -f /tmp/net.$netif.has_ibft_config ]; then
|
||||
echo "BOOTPROTO=ibft"
|
||||
else
|
||||
echo "PREFIX=$mask"
|
||||
echo "BOOTPROTO=none"
|
||||
echo "IPADDR=$ip"
|
||||
if strstr "$mask" "."; then
|
||||
echo "NETMASK=$mask"
|
||||
else
|
||||
echo "PREFIX=$mask"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if strstr "$gw" '*:*:*'; then
|
||||
|
@@ -14,6 +14,12 @@ depends() {
|
||||
install() {
|
||||
inst_simple "$moddir/url-lib.sh" "/lib/url-lib.sh"
|
||||
dracut_install curl
|
||||
# also install libs for curl https
|
||||
inst_libdir_file "libnsspem.so*"
|
||||
inst_libdir_file "libnsssysinit.so*"
|
||||
inst_libdir_file "libsoftokn3.so*"
|
||||
inst_libdir_file "libsqlite3.so*"
|
||||
|
||||
mkdir -m 0755 -p "$initdir/etc/ssl/certs"
|
||||
if ! inst_any -t /etc/ssl/certs/ca-bundle.crt \
|
||||
/etc/ssl/certs/ca-bundle.crt \
|
||||
|
@@ -55,18 +55,25 @@ add_url_handler() {
|
||||
export CURL_HOME="/run/initramfs/url-lib"
|
||||
mkdir -p $CURL_HOME
|
||||
curl_args="--location --retry 3 --fail --show-error"
|
||||
getargbool 0 rd.noverifyssl && curl_args="$curl_args --insecure"
|
||||
|
||||
proxy=$(getarg proxy=)
|
||||
[ -n "$proxy" ] && curl_args="$curl_args --proxy $proxy"
|
||||
|
||||
curl_fetch_url() {
|
||||
local url="$1" outloc="$2"
|
||||
echo "$url" > /proc/self/fd/0
|
||||
if [ -n "$outloc" ]; then
|
||||
curl $curl_args --output "$outloc" "$url" || return $?
|
||||
curl --globoff $curl_args --output "$outloc" "$url" || return $?
|
||||
else
|
||||
local outdir="$(mkuniqdir /tmp curl_fetch_url)"
|
||||
( cd "$outdir"; curl $curl_args --remote-name "$url" || return $? )
|
||||
outloc="$outdir/$(ls -A $outdir)"
|
||||
fi
|
||||
[ -f "$outloc" ] || return 253
|
||||
if ! [ -f "$outloc" ]; then
|
||||
warn "Downloading '$url' failed!"
|
||||
return 253
|
||||
fi
|
||||
if [ -z "$2" ]; then echo "$outloc" ; fi
|
||||
}
|
||||
add_url_handler curl_fetch_url http https ftp
|
||||
|
63
modules.d/50drm/module-setup.sh
Normal file
63
modules.d/50drm/module-setup.sh
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
local _modname
|
||||
# Include KMS capable drm drivers
|
||||
|
||||
drm_module_filter() {
|
||||
local _drm_drivers='drm_crtc_init'
|
||||
local _ret
|
||||
# subfunctions inherit following FDs
|
||||
local _merge=8 _side2=9
|
||||
function nmf1() {
|
||||
local _fname _fcont
|
||||
while read _fname; do
|
||||
case "$_fname" in
|
||||
*.ko) _fcont="$(< $_fname)" ;;
|
||||
*.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
|
||||
*.ko.xz) _fcont="$(xz -dc $_fname)" ;;
|
||||
esac
|
||||
[[ $_fcont =~ $_drm_drivers
|
||||
&& ! $_fcont =~ iw_handler_get_spy ]] \
|
||||
&& echo "$_fname"
|
||||
done
|
||||
}
|
||||
function rotor() {
|
||||
local _f1 _f2
|
||||
while read _f1; do
|
||||
echo "$_f1"
|
||||
if read _f2; then
|
||||
echo "$_f2" 1>&${_side2}
|
||||
fi
|
||||
done | nmf1 1>&${_merge}
|
||||
}
|
||||
# Use two parallel streams to filter alternating modules.
|
||||
set +x
|
||||
eval "( ( rotor ) ${_side2}>&1 | nmf1 ) ${_merge}>&1"
|
||||
[[ $debug ]] && set -x
|
||||
return 0
|
||||
}
|
||||
|
||||
for _modname in $(find_kernel_modules_by_path drivers/gpu/drm \
|
||||
| drm_module_filter) ; do
|
||||
# if the hardware is present, include module even if it is not currently loaded,
|
||||
# as we could e.g. be in the installer; nokmsboot boot parameter will disable
|
||||
# loading of the driver if needed
|
||||
if [[ $hostonly ]] && modinfo -F alias $_modname | sed -e 's,\?,\.,g' -e 's,\*,\.\*,g' \
|
||||
| grep -qxf - /sys/bus/pci/devices/*/modalias 2>/dev/null; then
|
||||
hostonly='' instmods $_modname
|
||||
continue
|
||||
fi
|
||||
instmods $_modname
|
||||
done
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
Dracut gensplash module
|
||||
dracut gensplash module
|
||||
-----------------------
|
||||
|
||||
INDEX
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if getargbool 1 rd.splash -n rd_NO_SPLASH; then
|
||||
if getargbool 1 rd.splash -d -n rd_NO_SPLASH; then
|
||||
info "Starting Gentoo Splash"
|
||||
|
||||
[ -x /lib/udev/console_init ] && /lib/udev/console_init /dev/tty0
|
||||
|
@@ -8,74 +8,25 @@ check() {
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
local _modname
|
||||
# Include KMS capable drm drivers
|
||||
|
||||
drm_module_filter() {
|
||||
local _drm_drivers='drm_crtc_init'
|
||||
local _ret
|
||||
# subfunctions inherit following FDs
|
||||
local _merge=8 _side2=9
|
||||
function nmf1() {
|
||||
local _fname _fcont
|
||||
while read _fname; do
|
||||
case "$_fname" in
|
||||
*.ko) _fcont="$(< $_fname)" ;;
|
||||
*.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
|
||||
*.ko.xz) _fcont="$(xz -dc $_fname)" ;;
|
||||
esac
|
||||
[[ $_fcont =~ $_drm_drivers
|
||||
&& ! $_fcont =~ iw_handler_get_spy ]] \
|
||||
&& echo "$_fname"
|
||||
done
|
||||
}
|
||||
function rotor() {
|
||||
local _f1 _f2
|
||||
while read _f1; do
|
||||
echo "$_f1"
|
||||
if read _f2; then
|
||||
echo "$_f2" 1>&${_side2}
|
||||
fi
|
||||
done | nmf1 1>&${_merge}
|
||||
}
|
||||
# Use two parallel streams to filter alternating modules.
|
||||
set +x
|
||||
eval "( ( rotor ) ${_side2}>&1 | nmf1 ) ${_merge}>&1"
|
||||
[[ $debug ]] && set -x
|
||||
return 0
|
||||
}
|
||||
|
||||
for _modname in $(find_kernel_modules_by_path drivers/gpu/drm \
|
||||
| drm_module_filter) ; do
|
||||
# if the hardware is present, include module even if it is not currently loaded,
|
||||
# as we could e.g. be in the installer; nokmsboot boot parameter will disable
|
||||
# loading of the driver if needed
|
||||
if [[ $hostonly ]] && modinfo -F alias $_modname | sed -e 's,\?,\.,g' -e 's,\*,\.\*,g' \
|
||||
| grep -qxf - /sys/bus/pci/devices/*/modalias; then
|
||||
hostonly='' instmods $_modname
|
||||
continue
|
||||
fi
|
||||
instmods $_modname
|
||||
done
|
||||
echo drm
|
||||
}
|
||||
|
||||
install() {
|
||||
if grep -q nash /usr/libexec/plymouth/plymouth-populate-initrd \
|
||||
|| ! grep -q PLYMOUTH_POPULATE_SOURCE_FUNCTIONS /usr/libexec/plymouth/plymouth-populate-initrd \
|
||||
|| [ ! -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
|
||||
. "$moddir"/plymouth-populate-initrd.sh
|
||||
else
|
||||
PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \
|
||||
/usr/libexec/plymouth/plymouth-populate-initrd -t $initdir
|
||||
/usr/libexec/plymouth/plymouth-populate-initrd -t "$initdir"
|
||||
fi
|
||||
|
||||
inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
|
||||
inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh
|
||||
inst_hook emergency 50 "$moddir"/plymouth-emergency.sh
|
||||
|
||||
dracut_install readlink
|
||||
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh
|
||||
inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
|
||||
fi
|
||||
}
|
||||
|
||||
|
@@ -2,6 +2,6 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if [ -x /bin/plymouth ]; then
|
||||
if [ -x /bin/plymouth -a -z "$DRACUT_SYSTEMD" ]; then
|
||||
/bin/plymouth --newroot=$NEWROOT
|
||||
fi
|
||||
|
@@ -2,8 +2,8 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if [ -x /bin/plymouthd ]; then
|
||||
if getargbool 1 plymouth.enable && getargbool 1 rd.plymouth -n rd_NO_PLYMOUTH; then
|
||||
if [ -x /bin/plymouthd -a -z "$DRACUT_SYSTEMD" ]; then
|
||||
if getargbool 1 plymouth.enable && getargbool 1 rd.plymouth -d -n rd_NO_PLYMOUTH; then
|
||||
# first trigger graphics subsystem
|
||||
udevadm trigger --action=add --attr-match=class=0x030000 >/dev/null 2>&1
|
||||
# first trigger graphics and tty subsystem
|
||||
|
@@ -32,6 +32,7 @@ function cms_write_config()
|
||||
cat > /etc/sysconfig/network << EOF
|
||||
HOSTNAME=$HOSTNAME
|
||||
EOF
|
||||
echo "$HOSTNAME" > /etc/hostname
|
||||
if [ "$ipv6" ]; then
|
||||
echo "NETWORKING_IPV6=yes" >> /etc/sysconfig/network
|
||||
else
|
||||
|
@@ -167,8 +167,8 @@ processcmsfile()
|
||||
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$env{INTERFACE} /sbin/cmsifup $env{INTERFACE}"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
|
||||
# remove the default net rules
|
||||
rm -f /etc/udev/rules.d/61-default-net.rules
|
||||
[[ -f /etc/udev/rules.d/60-net.rules ]] \
|
||||
rm -f /etc/udev/rules.d/91-default-net.rules
|
||||
[[ -f /etc/udev/rules.d/90-net.rules ]] \
|
||||
|| printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
|
||||
|
||||
znet_cio_free
|
||||
|
@@ -29,4 +29,5 @@ install() {
|
||||
|
||||
inst_libdir_file "gconv/*"
|
||||
#inst /usr/lib/locale/locale-archive
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
@@ -1,11 +1,8 @@
|
||||
SUBSYSTEM!="block", GOTO="btrfs_end"
|
||||
ACTION!="add|change", GOTO="btrfs_end"
|
||||
ENV{ID_FS_TYPE}!="btrfs", GOTO="btrfs_end"
|
||||
RUN+="/sbin/modprobe btrfs"
|
||||
RUN+="/sbin/btrfs device scan $env{DEVNAME}"
|
||||
|
||||
RUN+="/sbin/initqueue --finished --unique --name btrfs_finished /sbin/btrfs_finished"
|
||||
RUN+="/sbin/initqueue --timeout --onetime --unique --name btrfs_timeout /sbin/btrfs_timeout"
|
||||
|
||||
LABEL="btrfs_end"
|
||||
|
||||
|
21
modules.d/90btrfs/btrfs_device_ready.sh
Executable file
21
modules.d/90btrfs/btrfs_device_ready.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
btrfs_check_complete() {
|
||||
local _rootinfo _dev
|
||||
_dev="${1:-/dev/root}"
|
||||
[ -e "$_dev" ] || return 0
|
||||
_rootinfo=$(udevadm info --query=env "--name=$_dev" 2>/dev/null)
|
||||
if strstr "$_rootinfo" "ID_FS_TYPE=btrfs"; then
|
||||
info "Checking, if btrfs device complete"
|
||||
btrfs device ready "$_dev" >/dev/null 2>&1
|
||||
return $?
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
btrfs_check_complete $1
|
||||
exit $?
|
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
info "Scanning for all btrfs devices"
|
||||
/sbin/btrfs device scan 2>&1 | vinfo
|
||||
exit 0
|
||||
/sbin/btrfs device scan >/dev/null 2>&1
|
||||
|
@@ -9,12 +9,10 @@ check() {
|
||||
type -P btrfs >/dev/null || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
local _found
|
||||
for fs in ${host_fs_types[@]}; do
|
||||
strstr "$fs" "\|btrfs" && _found="1"
|
||||
[[ "$fs" == "btrfs" ]] && return 0
|
||||
done
|
||||
[[ $_found ]] || return 1
|
||||
unset _found
|
||||
return 255
|
||||
}
|
||||
|
||||
return 0
|
||||
@@ -26,13 +24,26 @@ depends() {
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods btrfs crc32c
|
||||
instmods btrfs
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_rules "$moddir/80-btrfs.rules"
|
||||
inst_script "$moddir/btrfs_finished.sh" /sbin/btrfs_finished
|
||||
inst_script "$moddir/btrfs_timeout.sh" /sbin/btrfs_timeout
|
||||
dracut_install btrfs btrfsck
|
||||
if ! inst_rules 64-btrfs.rules; then
|
||||
inst_rules "$moddir/80-btrfs.rules"
|
||||
case "$(btrfs --help)" in
|
||||
*device\ ready*)
|
||||
inst_script "$moddir/btrfs_device_ready.sh" /sbin/btrfs_finished ;;
|
||||
*)
|
||||
inst_script "$moddir/btrfs_finished.sh" /sbin/btrfs_finished ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_script "$moddir/btrfs_timeout.sh" \
|
||||
/usr/lib/dracut/hooks/initqueue/timeout/btrfs_timeout.sh
|
||||
fi
|
||||
|
||||
dracut_install btrfsck
|
||||
inst $(command -v btrfs) /sbin/btrfs
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# close everything which is not busy
|
||||
rm -f /etc/udev/rules.d/70-luks.rules >/dev/null 2>&1
|
||||
|
||||
if ! getarg rd.luks.uuid rd_LUKS_UUID >/dev/null 2>&1 && getargbool 1 rd.luks -n rd_NO_LUKS >/dev/null 2>&1; then
|
||||
if ! getarg rd.luks.uuid -d rd_LUKS_UUID >/dev/null 2>&1 && getargbool 1 rd.luks -d -n rd_NO_LUKS >/dev/null 2>&1; then
|
||||
while true; do
|
||||
local do_break="y"
|
||||
for i in /dev/mapper/luks-*; do
|
||||
|
@@ -165,8 +165,15 @@ readkey() {
|
||||
local keydev="$2"
|
||||
local device="$3"
|
||||
|
||||
local mntp=$(mkuniqdir /mnt keydev)
|
||||
mount -r "$keydev" "$mntp" || die 'Mounting rem. dev. failed!'
|
||||
# This creates a unique single mountpoint for *, or several for explicitly
|
||||
# given LUKS devices. It accomplishes unlocking multiple LUKS devices with
|
||||
# a single password entry.
|
||||
local mntp="/mnt/$(str_replace "keydev-$keydev-$keypath" '/' '-')"
|
||||
|
||||
if [ ! -d "$mntp" ]; then
|
||||
mkdir "$mntp"
|
||||
mount -r "$keydev" "$mntp" || die 'Mounting rem. dev. failed!'
|
||||
fi
|
||||
|
||||
case "${keypath##*.}" in
|
||||
gpg)
|
||||
@@ -177,9 +184,22 @@ readkey() {
|
||||
die "No GPG support to decrypt '$keypath' on '$keydev'."
|
||||
fi
|
||||
;;
|
||||
img)
|
||||
if [ -f /lib/dracut-crypt-loop-lib.sh ]; then
|
||||
. /lib/dracut-crypt-loop-lib.sh
|
||||
loop_decrypt "$mntp" "$keypath" "$keydev" "$device"
|
||||
initqueue --onetime --finished --unique --name "crypt-loop-cleanup-99-${mntp##*/}" \
|
||||
$(command -v umount) "$mntp; " $(command -v rmdir) "$mntp"
|
||||
return 0
|
||||
else
|
||||
die "No loop file support to decrypt '$keypath' on '$keydev'."
|
||||
fi
|
||||
;;
|
||||
*) cat "$mntp/$keypath" ;;
|
||||
esac
|
||||
|
||||
# General unmounting mechanism, modules doing custom cleanup should return earlier
|
||||
# and install a pre-pivot cleanup hook
|
||||
umount "$mntp"
|
||||
rmdir "$mntp"
|
||||
}
|
||||
|
36
modules.d/90crypt/crypt-run-generator.sh
Executable file
36
modules.d/90crypt/crypt-run-generator.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
dev=$1
|
||||
luks=$2
|
||||
|
||||
if [ -f /etc/crypttab ]; then
|
||||
while read l rest; do
|
||||
strstr "${l##luks-}" "${luks##luks-}" && exit 0
|
||||
done < /etc/crypttab
|
||||
fi
|
||||
|
||||
allowdiscards="-"
|
||||
|
||||
# parse for allow-discards
|
||||
if strstr "$(cryptsetup --help)" "allow-discards"; then
|
||||
if discarduuids=$(getargs "rd.luks.allow-discards"); then
|
||||
discarduuids=$(str_replace "$discarduuids" 'luks-' '')
|
||||
if strstr " $discarduuids " " ${luks##luks-}"; then
|
||||
allowdiscards="allow-discards"
|
||||
fi
|
||||
elif getargbool 0 rd.luks.allow-discards; then
|
||||
allowdiscards="allow-discards"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$luks $dev - timeout=0,$allowdiscards" >> /etc/crypttab
|
||||
|
||||
if command -v systemctl >/dev/null; then
|
||||
systemctl daemon-reload
|
||||
systemctl start cryptsetup.target
|
||||
fi
|
||||
exit 0
|
@@ -36,7 +36,7 @@ fi
|
||||
numtries=${3:-10}
|
||||
|
||||
# TODO: improve to support what cmdline does
|
||||
if [ -f /etc/crypttab ] && getargbool 1 rd.luks.crypttab -n rd_NO_CRYPTTAB; then
|
||||
if [ -f /etc/crypttab ] && getargbool 1 rd.luks.crypttab -d -n rd_NO_CRYPTTAB; then
|
||||
while read name dev luksfile luksoptions; do
|
||||
# ignore blank lines and comments
|
||||
if [ -z "$name" -o "${name#\#}" != "$name" ]; then
|
||||
@@ -97,10 +97,11 @@ done
|
||||
# parse for allow-discards
|
||||
if strstr "$(cryptsetup --help)" "allow-discards"; then
|
||||
if discarduuids=$(getargs "rd.luks.allow-discards"); then
|
||||
discarduuids=$(str_replace "$discarduuids" 'luks-' '')
|
||||
if strstr " $discarduuids " " ${luksdev##luks-}"; then
|
||||
allowdiscards="--allow-discards"
|
||||
fi
|
||||
elif getargbool rd.luks.allow-discards; then
|
||||
elif getargbool 0 rd.luks.allow-discards; then
|
||||
allowdiscards="--allow-discards"
|
||||
fi
|
||||
fi
|
||||
|
@@ -7,25 +7,11 @@ check() {
|
||||
# if cryptsetup is not installed, then we cannot support encrypted devices.
|
||||
type -P cryptsetup >/dev/null || return 1
|
||||
|
||||
check_crypt() {
|
||||
local dev=$1 fs=$2
|
||||
[[ $fs = "crypto_LUKS" ]] || return 1
|
||||
ID_FS_UUID=$(udevadm info --query=property --name=$dev \
|
||||
| while read line; do
|
||||
[[ ${line#ID_FS_UUID} = $line ]] && continue
|
||||
eval "$line"
|
||||
echo $ID_FS_UUID
|
||||
break
|
||||
done)
|
||||
[[ ${ID_FS_UUID} ]] || return 1
|
||||
if ! [[ $kernel_only ]]; then
|
||||
echo " rd.luks.uuid=luks-${ID_FS_UUID} " >> "${initdir}/etc/cmdline.d/90crypt.conf"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_fs check_crypt || return 1
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ $fs = "crypto_LUKS" ]] && return 0
|
||||
done
|
||||
return 255
|
||||
}
|
||||
|
||||
return 0
|
||||
@@ -41,13 +27,47 @@ installkernel() {
|
||||
}
|
||||
|
||||
install() {
|
||||
|
||||
check_crypt() {
|
||||
local dev=$1 fs=$2
|
||||
|
||||
[[ $fs = "crypto_LUKS" ]] || return 1
|
||||
ID_FS_UUID=$(udevadm info --query=property --name=$dev \
|
||||
| while read line; do
|
||||
[[ ${line#ID_FS_UUID} = $line ]] && continue
|
||||
eval "$line"
|
||||
echo $ID_FS_UUID
|
||||
break
|
||||
done)
|
||||
[[ ${ID_FS_UUID} ]] || return 1
|
||||
if ! [[ $kernel_only ]]; then
|
||||
echo " rd.luks.uuid=luks-${ID_FS_UUID} " >> "${initdir}/etc/cmdline.d/90crypt.conf"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
for_each_host_dev_fs check_crypt
|
||||
|
||||
dracut_install cryptsetup rmdir readlink umount
|
||||
inst_script "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
|
||||
inst_script "$moddir"/probe-keydev.sh /sbin/probe-keydev
|
||||
inst_hook cmdline 10 "$moddir/parse-keydev.sh"
|
||||
inst_hook cmdline 30 "$moddir/parse-crypt.sh"
|
||||
inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
|
||||
inst_simple /etc/crypttab
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
|
||||
fi
|
||||
[[ $hostonly ]] && inst_simple /etc/crypttab
|
||||
inst_simple "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
|
||||
}
|
||||
|
||||
dracut_install -o \
|
||||
$systemdutildir/system-generators/systemd-cryptsetup-generator \
|
||||
$systemdutildir/system-generators/systemd-cryptsetup-generator \
|
||||
$systemdutildir/systemd-cryptsetup \
|
||||
$systemdsystemunitdir/systemd-ask-password-console.path \
|
||||
$systemdsystemunitdir/systemd-ask-password-console.service \
|
||||
$systemdsystemunitdir/cryptsetup.target \
|
||||
$systemdsystemunitdir/sysinit.target.wants/cryptsetup.target \
|
||||
systemd-ask-password systemd-tty-ask-password-agent
|
||||
inst_script "$moddir"/crypt-run-generator.sh /sbin/crypt-run-generator
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
@@ -1,7 +1,8 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
if ! getargbool 1 rd.luks -n rd_NO_LUKS; then
|
||||
|
||||
if ! getargbool 1 rd.luks -d -n rd_NO_LUKS; then
|
||||
info "rd.luks=0: removing cryptoluks activation"
|
||||
rm -f /etc/udev/rules.d/70-luks.rules
|
||||
else
|
||||
@@ -10,19 +11,23 @@ else
|
||||
echo 'ACTION!="add|change", GOTO="luks_end"'
|
||||
} > /etc/udev/rules.d/70-luks.rules.new
|
||||
|
||||
LUKS=$(getargs rd.luks.uuid rd_LUKS_UUID)
|
||||
LUKS=$(getargs rd.luks.uuid -d rd_LUKS_UUID)
|
||||
tout=$(getarg rd.luks.key.tout)
|
||||
|
||||
if [ -n "$LUKS" ]; then
|
||||
for luksid in $LUKS; do
|
||||
|
||||
luksid=${luksid##luks-}
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
|
||||
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
|
||||
printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
|
||||
printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask)
|
||||
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
|
||||
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
|
||||
printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
|
||||
printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask)
|
||||
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
fi
|
||||
|
||||
uuid=$luksid
|
||||
while [ "$uuid" != "${uuid#*-}" ]; do uuid=${uuid%%-*}${uuid#*-}; done
|
||||
@@ -34,12 +39,20 @@ else
|
||||
printf -- 'warn "crypto LUKS UUID "%s" not found"\n' $luksid
|
||||
} >> $hookdir/emergency/90-crypt.sh
|
||||
done
|
||||
else
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
|
||||
printf -- '--unique --onetime --name cryptroot-ask-%%k '
|
||||
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $(command -v cryptroot-ask) $tout
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
elif getargbool 0 rd.auto; then
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
|
||||
printf -- '--unique --onetime --name cryptroot-ask-%%k '
|
||||
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $(command -v cryptroot-ask) $tout
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
else
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
|
||||
printf -- '--unique --onetime --name crypt-run-generator-%%k '
|
||||
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID}"\n' $(command -v crypt-run-generator)
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
fi
|
||||
fi
|
||||
|
||||
echo 'LABEL="luks_end"' >> /etc/udev/rules.d/70-luks.rules.new
|
||||
|
15
modules.d/90dm/59-persistent-storage-dm.rules
Normal file
15
modules.d/90dm/59-persistent-storage-dm.rules
Normal file
@@ -0,0 +1,15 @@
|
||||
SUBSYSTEM!="block", GOTO="dm_end"
|
||||
ACTION!="add|change", GOTO="dm_end"
|
||||
# Also don't process disks that are slated to be a multipath device
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="dm_end"
|
||||
|
||||
KERNEL!="dm-[0-9]*", GOTO="dm_end"
|
||||
ACTION=="add", GOTO="dm_end"
|
||||
IMPORT{program}="/sbin/dmsetup info -c --nameprefixes --unquoted --rows --noheadings -o name,uuid,suspended,readonly,major,minor,open,tables_loaded,names_using_dev -j%M -m%m"
|
||||
ENV{DM_NAME}!="?*", GOTO="dm_end"
|
||||
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="dm_end"
|
||||
ENV{DM_UUID}=="CRYPT-TEMP-?*", GOTO="dm_end"
|
||||
ENV{DM_UUID}!="?*", ENV{DM_NAME}=="temporary-cryptsetup-?*", GOTO="dm_end"
|
||||
IMPORT BLKID
|
||||
|
||||
LABEL="dm_end"
|
@@ -13,6 +13,7 @@ depends() {
|
||||
|
||||
installkernel() {
|
||||
instmods =drivers/md
|
||||
instmods dm_mod
|
||||
}
|
||||
|
||||
install() {
|
||||
@@ -31,6 +32,9 @@ install() {
|
||||
|
||||
inst_rules "$moddir/11-dm.rules"
|
||||
|
||||
inst_rules "$moddir/59-persistent-storage-dm.rules"
|
||||
prepare_udev_rules 59-persistent-storage-dm.rules
|
||||
|
||||
inst_hook shutdown 30 "$moddir/dm-shutdown.sh"
|
||||
}
|
||||
|
||||
|
@@ -4,6 +4,8 @@
|
||||
|
||||
SUBSYSTEM!="block", GOTO="dm_end"
|
||||
ACTION!="add|change", GOTO="dm_end"
|
||||
# Also don't process disks that are slated to be a multipath device
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="dm_end"
|
||||
|
||||
ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="dm_end"
|
||||
|
||||
|
@@ -4,40 +4,44 @@
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
DM_RAIDS=$(getargs rd.dm.uuid rd_DM_UUID=)
|
||||
DM_RAIDS=$(getargs rd.dm.uuid -d rd_DM_UUID=)
|
||||
|
||||
DM_CLEANUP="no"
|
||||
if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then
|
||||
|
||||
# run dmraid if udev has settled
|
||||
info "Scanning for dmraid devices $DM_RAIDS"
|
||||
SETS=$(dmraid -c -s)
|
||||
DM_CLEANUP="no"
|
||||
|
||||
if [ "$SETS" = "no raid disks" -o "$SETS" = "no raid sets" ]; then
|
||||
return
|
||||
fi
|
||||
# run dmraid if udev has settled
|
||||
info "Scanning for dmraid devices $DM_RAIDS"
|
||||
SETS=$(dmraid -c -s)
|
||||
|
||||
info "Found dmraid sets:"
|
||||
echo $SETS|vinfo
|
||||
if [ "$SETS" = "no raid disks" -o "$SETS" = "no raid sets" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -n "$DM_RAIDS" ]; then
|
||||
info "Found dmraid sets:"
|
||||
echo $SETS|vinfo
|
||||
|
||||
if [ -n "$DM_RAIDS" ]; then
|
||||
# only activate specified DM RAIDS
|
||||
for r in $DM_RAIDS; do
|
||||
for s in $SETS; do
|
||||
if [ "${s##$r}" != "$s" ]; then
|
||||
info "Activating $s"
|
||||
dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
|
||||
[ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s" 2>&1 | vinfo
|
||||
udevsettle
|
||||
fi
|
||||
for r in $DM_RAIDS; do
|
||||
for s in $SETS; do
|
||||
if [ "${s##$r}" != "$s" ]; then
|
||||
info "Activating $s"
|
||||
dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
|
||||
[ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s" 2>&1 | vinfo
|
||||
udevsettle
|
||||
fi
|
||||
done
|
||||
done
|
||||
done
|
||||
else
|
||||
else
|
||||
# scan and activate all DM RAIDS
|
||||
for s in $SETS; do
|
||||
info "Activating $s"
|
||||
dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
|
||||
[ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s" 2>&1 | vinfo
|
||||
done
|
||||
fi
|
||||
for s in $SETS; do
|
||||
info "Activating $s"
|
||||
dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
|
||||
[ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s" 2>&1 | vinfo
|
||||
done
|
||||
fi
|
||||
|
||||
need_shutdown
|
||||
need_shutdown
|
||||
|
||||
fi
|
||||
|
@@ -8,9 +8,27 @@ check() {
|
||||
# in trying to support it in the initramfs.
|
||||
type -P dmraid >/dev/null || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ $fs = *_raid_member ]] && return 0
|
||||
done
|
||||
return 255
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
depends() {
|
||||
echo dm rootfs-block
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
local _i
|
||||
|
||||
check_dmraid() {
|
||||
local dev=$1 fs=$2 holder DEVPATH DM_NAME
|
||||
[[ "$fs" = "${fs%%_raid_member}" ]] && return 1
|
||||
[[ "$fs" != *_raid_member ]] && return 1
|
||||
|
||||
DEVPATH=$(udevadm info --query=property --name=$dev \
|
||||
| while read line; do
|
||||
@@ -37,21 +55,11 @@ check() {
|
||||
return 0
|
||||
}
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_fs check_dmraid || return 1
|
||||
}
|
||||
for_each_host_dev_fs check_dmraid
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
depends() {
|
||||
echo dm rootfs-block
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
local _i
|
||||
dracut_install dmraid partx kpartx
|
||||
dracut_install dmraid
|
||||
dracut_install -o kpartx
|
||||
inst $(command -v partx) /sbin/partx
|
||||
|
||||
inst "$moddir/dmraid.sh" /sbin/dmraid_scan
|
||||
|
||||
|
@@ -2,17 +2,23 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
# nodmraid for anaconda / rc.sysinit compatibility
|
||||
if ! getargbool 1 rd.dm -n rd_NO_DM || getarg nodmraid; then
|
||||
if ! getargbool 1 rd.dm -d -n rd_NO_DM || getarg "rd.dm=0" -d nodmraid; then
|
||||
info "rd.dm=0: removing DM RAID activation"
|
||||
udevproperty rd_NO_DM=1
|
||||
fi
|
||||
|
||||
if ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.imsm -n rd_NO_MDIMSM || getarg noiswmd; then
|
||||
if ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.imsm -d -n rd_NO_MDIMSM -n noiswmd; then
|
||||
info "rd.md.imsm=0: no MD RAID for imsm/isw raids"
|
||||
udevproperty rd_NO_MDIMSM=1
|
||||
fi
|
||||
|
||||
if ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF || getarg noddfmd; then
|
||||
if ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF -n noddfmd; then
|
||||
info "rd.md.ddf=0: no MD RAID for SNIA ddf raids"
|
||||
udevproperty rd_NO_MDDDF=1
|
||||
fi
|
||||
|
||||
DM_RAIDS=$(getargs rd.dm.uuid -d rd_DM_UUID=)
|
||||
|
||||
if [ -z "$DM_RAIDS" ] && ! getargbool 0 rd.auto; then
|
||||
udevproperty rd_NO_DM=1
|
||||
fi
|
||||
|
@@ -2,14 +2,16 @@
|
||||
|
||||
if [ -b /dev/mapper/live-rw ] && [ -d /updates ]; then
|
||||
info "Applying updates to live image..."
|
||||
mount -o bind /run $NEWROOT/run
|
||||
# avoid overwriting symlinks (e.g. /lib -> /usr/lib) with directories
|
||||
(
|
||||
cd /updates
|
||||
find . -depth -type d | while read dir; do
|
||||
[ -d "$NEWROOT/$dir" ] || mkdir -p "$NEWROOT/$dir"
|
||||
mkdir -p "$NEWROOT/$dir"
|
||||
done
|
||||
find . -depth \! -type d | while read file; do
|
||||
cp -a "$file" "$NEWROOT/$file"
|
||||
done
|
||||
)
|
||||
umount $NEWROOT/run
|
||||
fi
|
||||
|
13
modules.d/90dmsquash-live/checkisomd5@.service
Normal file
13
modules.d/90dmsquash-live/checkisomd5@.service
Normal file
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Media check on %f
|
||||
DefaultDependencies=no
|
||||
Before=shutdown.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=no
|
||||
ExecStart=/bin/checkisomd5 --verbose %f
|
||||
StandardInput=tty-force
|
||||
StandardOutput=inherit
|
||||
StandardError=inherit
|
||||
TimeoutSec=0
|
@@ -6,7 +6,7 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
if getargbool 0 rd.live.debug -y rdlivedebug; then
|
||||
if getargbool 0 rd.live.debug -n -y rdlivedebug; then
|
||||
exec > /tmp/liveroot.$$.out
|
||||
exec 2>> /tmp/liveroot.$$.out
|
||||
set -x
|
||||
@@ -17,22 +17,27 @@ livedev="$1"
|
||||
|
||||
# parse various live image specific options that make sense to be
|
||||
# specified as their own things
|
||||
live_dir=$(getarg rd.live.dir live_dir)
|
||||
live_dir=$(getarg rd.live.dir -d live_dir)
|
||||
[ -z "$live_dir" ] && live_dir="LiveOS"
|
||||
getargbool 0 rd.live.ram -y live_ram && live_ram="yes"
|
||||
getargbool 0 rd.live.overlay.reset -y reset_overlay && reset_overlay="yes"
|
||||
getargbool 0 rd.live.overlay.readonly -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
|
||||
overlay=$(getarg rd.live.overlay overlay)
|
||||
getargbool 0 rd.live.ram -d -y live_ram && live_ram="yes"
|
||||
getargbool 0 rd.live.overlay.reset -d -y reset_overlay && reset_overlay="yes"
|
||||
getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
|
||||
overlay=$(getarg rd.live.overlay -d overlay)
|
||||
|
||||
# CD/DVD media check
|
||||
[ -b $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
|
||||
if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
|
||||
check="yes"
|
||||
fi
|
||||
getarg rd.live.check check || check=""
|
||||
getarg rd.live.check -d check || check=""
|
||||
if [ -n "$check" ]; then
|
||||
[ -x /bin/plymouth ] && /bin/plymouth --hide-splash
|
||||
checkisomd5 --verbose $livedev
|
||||
if [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
p=$(str_replace "$livedev" "-" '\x2d')
|
||||
systemctl start checkisomd5@${p}.service
|
||||
else
|
||||
checkisomd5 --verbose $livedev
|
||||
fi
|
||||
if [ $? -ne 0 ]; then
|
||||
die "CD check failed!"
|
||||
exit 1
|
||||
@@ -44,9 +49,12 @@ ln -s $livedev /run/initramfs/livedev
|
||||
|
||||
# determine filesystem type for a filesystem image
|
||||
det_img_fs() {
|
||||
udevadm settle
|
||||
blkid -s TYPE -u noraid -o value "$1"
|
||||
}
|
||||
|
||||
modprobe squashfs
|
||||
|
||||
for arg in $CMDLINE; do case $arg in ro|rw) liverw=$arg ;; esac; done
|
||||
# mount the backing of the live image first
|
||||
mkdir -m 0755 -p /run/initramfs/live
|
||||
@@ -98,25 +106,41 @@ do_live_overlay() {
|
||||
if [ -f /run/initramfs/overlayfs$pathspec -a -w /run/initramfs/overlayfs$pathspec ]; then
|
||||
losetup $OVERLAY_LOOPDEV /run/initramfs/overlayfs$pathspec
|
||||
if [ -n "$reset_overlay" ]; then
|
||||
dd if=/dev/zero of=$OVERLAY_LOOPDEV bs=64k count=1 2>/dev/null
|
||||
dd if=/dev/zero of=$OVERLAY_LOOPDEV bs=64k count=1 conv=fsync 2>/dev/null
|
||||
fi
|
||||
setup="yes"
|
||||
fi
|
||||
umount -l /run/initramfs/overlayfs || :
|
||||
fi
|
||||
|
||||
if [ -z "$setup" ]; then
|
||||
if [ -n "$devspec" -a -n "$pathspec" ]; then
|
||||
if [ -z "$setup" -o -n "$readonly_overlay" ]; then
|
||||
if [ -n "$setup" ]; then
|
||||
warn "Using temporary overlay."
|
||||
elif [ -n "$devspec" -a -n "$pathspec" ]; then
|
||||
warn "Unable to find persistent overlay; using temporary"
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((512*1024)) 2> /dev/null
|
||||
losetup $OVERLAY_LOOPDEV /overlay
|
||||
if [ -n "$setup" -a -n "$readonly_overlay" ]; then
|
||||
RO_OVERLAY_LOOPDEV=$( losetup -f )
|
||||
losetup $RO_OVERLAY_LOOPDEV /overlay
|
||||
else
|
||||
losetup $OVERLAY_LOOPDEV /overlay
|
||||
fi
|
||||
fi
|
||||
|
||||
# set up the snapshot
|
||||
echo 0 `blockdev --getsz $BASE_LOOPDEV` snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV p 8 | dmsetup create $readonly_overlay live-rw
|
||||
sz=$(blockdev --getsz $BASE_LOOPDEV)
|
||||
if [ -n "$readonly_overlay" ]; then
|
||||
echo 0 $sz snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV p 8 | dmsetup create $readonly_overlay live-ro
|
||||
base="/dev/mapper/live-ro"
|
||||
over=$RO_OVERLAY_LOOPDEV
|
||||
else
|
||||
base=$BASE_LOOPDEV
|
||||
over=$OVERLAY_LOOPDEV
|
||||
fi
|
||||
echo 0 $sz snapshot $base $over p 8 | dmsetup create live-rw
|
||||
}
|
||||
|
||||
# live cd helper function
|
||||
@@ -167,7 +191,6 @@ if [ -e "$SQUASHED" ] ; then
|
||||
dd if=$SQUASHED of=/squashed.img bs=512 2> /dev/null
|
||||
umount -n /run/initramfs/live
|
||||
echo "Done copying live image to RAM."
|
||||
eject -p $livedev || :
|
||||
SQUASHED="/squashed.img"
|
||||
fi
|
||||
|
||||
|
@@ -16,12 +16,12 @@ depends() {
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods squashfs loop
|
||||
instmods squashfs loop iso9660
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install umount dmsetup blkid dd losetup grep blockdev
|
||||
dracut_install -o eject checkisomd5
|
||||
dracut_install -o checkisomd5
|
||||
inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh"
|
||||
inst_hook pre-udev 30 "$moddir/dmsquash-live-genrules.sh"
|
||||
inst_hook pre-udev 30 "$moddir/dmsquash-liveiso-genrules.sh"
|
||||
@@ -29,5 +29,6 @@ install() {
|
||||
inst_script "$moddir/dmsquash-live-root.sh" "/sbin/dmsquash-live-root"
|
||||
# should probably just be generally included
|
||||
inst_rules 60-cdrom_id.rules
|
||||
inst_simple "$moddir/checkisomd5@.service" "/etc/systemd/system/checkisomd5@.service"
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
|
||||
# support legacy syntax of passing liveimg and then just the base root
|
||||
if getargbool 0 rd.live.image -y liveimg; then
|
||||
if getargbool 0 rd.live.image -d -y liveimg; then
|
||||
liveroot="live:$root"
|
||||
fi
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
for modlist in $(getargs rd.driver.post rdinsmodpost=); do
|
||||
for modlist in $(getargs rd.driver.post -d rdinsmodpost=); do
|
||||
(
|
||||
IFS=,
|
||||
for m in $modlist; do
|
||||
|
@@ -35,49 +35,49 @@ installkernel() {
|
||||
return 0
|
||||
}
|
||||
|
||||
hostonly='' instmods sr_mod sd_mod scsi_dh scsi_dh_rdac scsi_dh_emc ata_piix
|
||||
hostonly='' instmods pcmcia firewire-ohci
|
||||
hostonly='' instmods usb_storage sdhci sdhci-pci
|
||||
hostonly='' instmods sr_mod sd_mod scsi_dh ata_piix \
|
||||
ehci-hcd ehci-pci ehci-platform ohci-hcd uhci-hcd xhci-hcd hid_generic \
|
||||
unix
|
||||
|
||||
# arm specific modules
|
||||
hostonly='' instmods sdhci_esdhc_imx mmci sdhci_tegra mvsdio omap omapdrm sdhci_dove ahci_platform pata_imx sata_mv
|
||||
instmods yenta_socket scsi_dh_rdac scsi_dh_emc \
|
||||
atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech \
|
||||
hid-logitech-dj hid-microsoft firewire-ohci \
|
||||
pcmcia usb_storage
|
||||
|
||||
if [[ "$(uname -p)" == arm* ]]; then
|
||||
# arm specific modules
|
||||
hostonly='' instmods sdhci_esdhc_imx mmci sdhci_tegra mvsdio omap omapdrm \
|
||||
omap_hsmmc sdhci_dove ahci_platform pata_imx sata_mv
|
||||
fi
|
||||
|
||||
# install virtual machine support
|
||||
instmods virtio virtio_blk virtio_ring virtio_pci virtio_scsi \
|
||||
"=drivers/pcmcia" =ide "=drivers/usb/storage"
|
||||
|
||||
# install keyboard support
|
||||
hostonly='' instmods atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech hid-logitech-dj hid-microsoft ehci-hcd ohci-hcd uhci-hcd xhci-hcd
|
||||
# install unix socket support
|
||||
hostonly='' instmods unix
|
||||
instmods "=drivers/pcmcia" =ide "=drivers/usb/storage"
|
||||
find_kernel_modules | block_module_filter | instmods
|
||||
|
||||
# if not on hostonly mode, install all known filesystems,
|
||||
# if the required list is not set via the filesystems variable
|
||||
if ! [[ $hostonly ]]; then
|
||||
if [[ -z $filesystems ]]; then
|
||||
omit_drivers="$omit_drivers|kernel/fs/nfs|kernel/fs/nfsd|kernel/fs/lockd" omit_drivers="${omit_drivers##|}" instmods '=fs'
|
||||
omit_drivers="${omit_drivers}|kernel/fs/nfs|kernel/fs/nfsd|kernel/fs/lockd" \
|
||||
omit_drivers="${omit_drivers##|}" \
|
||||
instmods '=fs'
|
||||
fi
|
||||
else
|
||||
inst_fs() {
|
||||
[[ $2 ]] || return 1
|
||||
hostonly='' instmods $2
|
||||
}
|
||||
for_each_host_dev_fs inst_fs
|
||||
for i in $(host_fs_all); do
|
||||
hostonly='' instmods $i
|
||||
done
|
||||
fi
|
||||
else
|
||||
hostonly='' instmods $drivers
|
||||
fi
|
||||
|
||||
if [[ $add_drivers ]]; then
|
||||
hostonly='' instmods -c $add_drivers || return 1
|
||||
fi
|
||||
if [[ $filesystems ]]; then
|
||||
hostonly='' instmods -c $filesystems || return 1
|
||||
fi
|
||||
|
||||
:
|
||||
}
|
||||
|
||||
install() {
|
||||
local _f i
|
||||
[ -f /etc/modprobe.conf ] && dracut_install /etc/modprobe.conf
|
||||
dracut_install $(find -L /etc/modprobe.d/ -maxdepth 1 -type f -name '*.conf')
|
||||
inst_hook cmdline 01 "$moddir/parse-kernel.sh"
|
||||
dracut_install -o /lib/modprobe.d/*.conf
|
||||
[[ $hostonly ]] && dracut_install -o /etc/modprobe.d/*.conf /etc/modprobe.conf
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook cmdline 01 "$moddir/parse-kernel.sh"
|
||||
fi
|
||||
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
|
||||
}
|
||||
|
@@ -2,7 +2,16 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
for i in $(getargs rd.driver.pre rdloaddriver=); do
|
||||
_modprobe_d=/etc/modprobe.d
|
||||
if [ -d /usr/lib/modprobe.d ] ; then
|
||||
_modprobe_d=/usr/lib/modprobe.d
|
||||
elif [ -d /lib/modprobe.d ] ; then
|
||||
_modprobe_d=/lib/modprobe.d
|
||||
elif [ ! -d $_modprobe_d ] ; then
|
||||
mkdir -p $_modprobe_d
|
||||
fi
|
||||
|
||||
for i in $(getargs rd.driver.pre -d rdloaddriver=); do
|
||||
(
|
||||
IFS=,
|
||||
for p in $i; do
|
||||
@@ -11,19 +20,22 @@ for i in $(getargs rd.driver.pre rdloaddriver=); do
|
||||
)
|
||||
done
|
||||
|
||||
for i in $(getargs rd.driver.blacklist rdblacklist=); do
|
||||
|
||||
[ -d /etc/modprobe.d ] || mkdir -p /etc/modprobe.d
|
||||
|
||||
for i in $(getargs rd.driver.blacklist -d rdblacklist=); do
|
||||
(
|
||||
IFS=,
|
||||
for p in $i; do
|
||||
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
|
||||
echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
|
||||
done
|
||||
)
|
||||
done
|
||||
|
||||
for p in $(getargs rd.driver.post rdinsmodpost=); do
|
||||
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
|
||||
for p in $(getargs rd.driver.post -d rdinsmodpost=); do
|
||||
echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
|
||||
_do_insmodpost=1
|
||||
done
|
||||
|
||||
[ -n "$_do_insmodpost" ] && initqueue --settled --unique --onetime insmodpost.sh
|
||||
unset _do_insmodpost
|
||||
unset _do_insmodpost _modprobe_d
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user