mirror of
https://github.com/troglobit/finit.git
synced 2026-10-12 10:12:32 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e85c4f3d1 | ||
|
|
2531102623 | ||
|
|
33deada6f0 | ||
|
|
9d1506bb7e | ||
|
|
c3f115c9ec | ||
|
|
430d402b14 | ||
|
|
e011dac98b | ||
|
|
42b84d1ccb | ||
|
|
288105eac7 | ||
|
|
842b522e68 | ||
|
|
e6f36974c8 | ||
|
|
679b4df881 | ||
|
|
666cae6f49 | ||
|
|
be2ac1d1b1 | ||
|
|
266e5b30eb | ||
|
|
4e5d06b580 | ||
|
|
fe334135ce | ||
|
|
aef10fb5e7 | ||
|
|
86707c1f0b | ||
|
|
a28d5b3c09 | ||
|
|
550ae9c784 | ||
|
|
cd5b91680a | ||
|
|
221ab20898 | ||
|
|
96534789db | ||
|
|
26128dd788 | ||
|
|
799e992542 | ||
|
|
fa524eec60 | ||
|
|
6dced29b49 | ||
|
|
2ea613a42b | ||
|
|
985df20519 | ||
|
|
f6161b9be9 | ||
|
|
25c5014d3c | ||
|
|
b8b7b53d96 | ||
|
|
7707c4b8e6 | ||
|
|
437f95f00f | ||
|
|
099672fabb | ||
|
|
860515a716 | ||
|
|
c85551a42e | ||
|
|
79dc6e7472 | ||
|
|
06e456384c | ||
|
|
38f7d24a80 | ||
|
|
145c78ef3e | ||
|
|
dd437bf0a5 | ||
|
|
d82d119729 | ||
|
|
7f76202865 | ||
|
|
aee92751ac | ||
|
|
2ea7236d45 | ||
|
|
cedc04e1e3 | ||
|
|
edc6eb1747 | ||
|
|
be5ec94fdf | ||
|
|
23a13fe1b6 | ||
|
|
0168b765c1 | ||
|
|
01358a5a45 | ||
|
|
106516d12d | ||
|
|
ba858743e5 | ||
|
|
9fd860ef3c | ||
|
|
46ccdc3820 | ||
|
|
242fe54afd | ||
|
|
df5d296cd9 | ||
|
|
dc4630f214 | ||
|
|
ac07d3bac7 | ||
|
|
f641eef8f7 | ||
|
|
f17b5b3cd3 | ||
|
|
d945f4960b | ||
|
|
6a5a6ac62f | ||
|
|
a9ba4300ec | ||
|
|
7bb649f11a | ||
|
|
85ada0ac99 | ||
|
|
be343a3b34 | ||
|
|
0ac0e5c7d3 | ||
|
|
7f272768e4 | ||
|
|
7b74c9900f | ||
|
|
36f1a39b31 | ||
|
|
6d380082eb | ||
|
|
8d3917e9fa | ||
|
|
c3cd1a5bfa | ||
|
|
eaeddc36c2 | ||
|
|
4f40b65f0c | ||
|
|
f958aa504e | ||
|
|
3d1b95aa7a | ||
|
|
4bb67bc06f | ||
|
|
0929c93caf | ||
|
|
c0368d2b16 | ||
|
|
85a212ef93 | ||
|
|
12c3cb3dc0 | ||
|
|
16710e7ab5 | ||
|
|
b652aaf0cb | ||
|
|
30020263ba | ||
|
|
3cf5d36972 | ||
|
|
c9ae96bcf7 | ||
|
|
5955110e67 | ||
|
|
4191e15c77 | ||
|
|
d60baa2b80 | ||
|
|
a50bc331db | ||
|
|
eff4453de9 | ||
|
|
4cfc8fec0e | ||
|
|
c9e1c2f80f | ||
|
|
93039e40cc | ||
|
|
015a52a20d | ||
|
|
d53cc8bfe7 | ||
|
|
3c4eca60b7 | ||
|
|
c85e28b971 | ||
|
|
d373068619 | ||
|
|
997f3d7862 | ||
|
|
f12f53692e | ||
|
|
b921b8cf0f | ||
|
|
61781c72fe | ||
|
|
3b5cfc5ecf | ||
|
|
a42a789d29 | ||
|
|
d77c014723 | ||
|
|
23fca9c067 | ||
|
|
37eb1901f9 | ||
|
|
98c4e7764f | ||
|
|
d3e4463612 | ||
|
|
b812045d82 | ||
|
|
b1bcdc88e0 | ||
|
|
62c5a9d06d | ||
|
|
dcdc842336 | ||
|
|
12eaa3073a | ||
|
|
34875f57a5 | ||
|
|
f0bf1343b0 | ||
|
|
4e6b9514d5 | ||
|
|
3b495d7518 | ||
|
|
badf8701bf | ||
|
|
85fa0d4926 | ||
|
|
3de9643893 | ||
|
|
73629944c0 | ||
|
|
c97c83bfb6 | ||
|
|
19b18afac9 | ||
|
|
e3c424e129 | ||
|
|
c0716d7f63 | ||
|
|
d43af8c9c1 | ||
|
|
2825100f77 | ||
|
|
b1bee31d61 | ||
|
|
522276b80d | ||
|
|
7bc1470a1e | ||
|
|
ca32cb0dfc | ||
|
|
d59f55b90c | ||
|
|
02936de993 | ||
|
|
8ed223343d | ||
|
|
90f7ff1c23 | ||
|
|
a56220f158 | ||
|
|
d40b426c1b | ||
|
|
5342881bf4 | ||
|
|
c84c17ea8c | ||
|
|
f976b8261f | ||
|
|
10f4c7fa18 | ||
|
|
665d212bd6 | ||
|
|
9e6e653c57 | ||
|
|
bda4da71a6 | ||
|
|
a24fc941a6 | ||
|
|
f307ad060b | ||
|
|
1845b7be54 | ||
|
|
a260e157eb | ||
|
|
0641b1a73e | ||
|
|
9ba57f0c9d | ||
|
|
9c2f0b2dc8 | ||
|
|
d4bbebeb93 | ||
|
|
1a22b4f0aa | ||
|
|
9c4d5341ae | ||
|
|
b9d498e01c | ||
|
|
a1e38a3e40 | ||
|
|
c0ae7763a6 | ||
|
|
9f98b1d3d1 | ||
|
|
a7e2224f05 | ||
|
|
3bb1e41394 | ||
|
|
e437379939 | ||
|
|
3ad4f6ef4b | ||
|
|
4170a61d0b | ||
|
|
b3c5ab41e7 | ||
|
|
b3fad1077e | ||
|
|
522e1f57d7 | ||
|
|
d00a53dfbf | ||
|
|
ff86f29f41 | ||
|
|
3107027132 | ||
|
|
728db73b09 | ||
|
|
fcb8ec9967 | ||
|
|
5b8fe12502 | ||
|
|
6e24f2ff13 | ||
|
|
74d715243c | ||
|
|
d9993860cb | ||
|
|
6a6f3a8291 | ||
|
|
99a8cf3eb7 | ||
|
|
da95c7d80e | ||
|
|
a9f7f692a9 | ||
|
|
ce55f88a00 | ||
|
|
74a26f559d | ||
|
|
08144df5ea | ||
|
|
230c64927b | ||
|
|
d1e56f300d | ||
|
|
9842786453 | ||
|
|
6d0c679e05 | ||
|
|
5428dea5bf | ||
|
|
4e84ecae89 | ||
|
|
959c9fe5aa | ||
|
|
03d8ef9c8f | ||
|
|
084b4ce8d3 | ||
|
|
31cae6a56d | ||
|
|
1fd45c6f2e | ||
|
|
46995fe446 | ||
|
|
600b2874e6 | ||
|
|
b080b970b7 | ||
|
|
6106574e13 | ||
|
|
2385a1209b | ||
|
|
e8b942cf95 | ||
|
|
ac17d7f5a7 | ||
|
|
1edc4356a6 | ||
|
|
9f06a2db99 | ||
|
|
cfb3a9f2b9 | ||
|
|
8aba63a9e3 | ||
|
|
3d98ad293b | ||
|
|
156e86f395 | ||
|
|
d859ecd21d | ||
|
|
cbec78dbbc | ||
|
|
572291a1d9 | ||
|
|
280608f30e | ||
|
|
5c4146cfe4 | ||
|
|
30e3f5a33c | ||
|
|
2c12379a30 | ||
|
|
5f026c8149 | ||
|
|
90005235e8 | ||
|
|
6b688c4211 | ||
|
|
bdf5f8fc90 | ||
|
|
79f7a8ccfb | ||
|
|
3b19db04e3 | ||
|
|
93402b81d7 | ||
|
|
6dec4c9ca0 | ||
|
|
548acf27cf | ||
|
|
cd0bc57ca8 | ||
|
|
11a3318c02 | ||
|
|
2711b27971 | ||
|
|
05ac9c18c9 | ||
|
|
1a7092f545 | ||
|
|
8000d361b3 | ||
|
|
e3c8febe3b | ||
|
|
32ca117949 | ||
|
|
b966d031c8 | ||
|
|
905c2678a3 | ||
|
|
7d429bdbb1 | ||
|
|
ccfea59cb3 | ||
|
|
7b315364ca | ||
|
|
e9e28ece1c | ||
|
|
c1f9b4e1f6 | ||
|
|
6ebb23e0f0 | ||
|
|
026c229005 | ||
|
|
4d05bf9359 | ||
|
|
289247dab9 | ||
|
|
e44dfde54e | ||
|
|
35b200d3a9 | ||
|
|
5badf4d376 | ||
|
|
24f274c126 | ||
|
|
1abd43384b | ||
|
|
70a1acc210 | ||
|
|
6af0446490 | ||
|
|
ecaf111a4b | ||
|
|
32ec25b070 | ||
|
|
305ad302f2 | ||
|
|
d6390244ad | ||
|
|
790a316607 | ||
|
|
77aa941e84 | ||
|
|
e0a65f67c9 | ||
|
|
3ed291789c | ||
|
|
774a24cdd8 | ||
|
|
6011f91f22 | ||
|
|
07a364e570 | ||
|
|
5b9d99011b | ||
|
|
f4f773b4c7 | ||
|
|
9d949c4186 | ||
|
|
1434561a46 | ||
|
|
cf3d3f6f8e | ||
|
|
621da582c2 | ||
|
|
9167d9255d | ||
|
|
c71bafd495 | ||
|
|
b3b7a33252 | ||
|
|
d1efc60c84 | ||
|
|
9a24dfd98d | ||
|
|
0e3fe5e3bf | ||
|
|
224f42c344 | ||
|
|
e60eb94810 | ||
|
|
464bc831a5 | ||
|
|
e84911fe52 | ||
|
|
4bcfd606b4 | ||
|
|
fe27ed17eb | ||
|
|
b3ea23ed26 | ||
|
|
439699ef52 | ||
|
|
f20936dae0 | ||
|
|
d5bea7eeeb | ||
|
|
5da0a460fe | ||
|
|
63033d7dcf | ||
|
|
2857dafaf4 | ||
|
|
8355c37285 | ||
|
|
dc49b523d1 | ||
|
|
bf863673c8 | ||
|
|
ecc8b2dcf9 | ||
|
|
3b64b155d4 | ||
|
|
1b05220376 | ||
|
|
7f6ccfabb2 | ||
|
|
c5083c4bbc | ||
|
|
1020695ebd | ||
|
|
3d50a28fe3 | ||
|
|
460add3cae | ||
|
|
5dcf7be3c9 | ||
|
|
89be90cade | ||
|
|
93f9856da8 | ||
|
|
e2f6ac0ece | ||
|
|
84be93e013 | ||
|
|
c5db989bed | ||
|
|
928110b19e | ||
|
|
c204724353 | ||
|
|
2ac39e1917 | ||
|
|
49582c70c5 | ||
|
|
4c2bbf7d93 | ||
|
|
2bfede2cfe | ||
|
|
544180aa0b | ||
|
|
6862d7cd5f | ||
|
|
7e3b18a38d | ||
|
|
70c884816e | ||
|
|
f8c07e81ff | ||
|
|
270512bc97 | ||
|
|
c001349dd3 | ||
|
|
8a063e665d | ||
|
|
9b3aca9846 | ||
|
|
e06e4175d3 | ||
|
|
510bd1ac0b | ||
|
|
0d52583624 | ||
|
|
aa998583a7 | ||
|
|
f9532d11ba | ||
|
|
c7d189f199 | ||
|
|
83cdb884d9 | ||
|
|
e9ed90cb34 | ||
|
|
689e6cd52a | ||
|
|
0cb99d5c00 | ||
|
|
aa096cde19 | ||
|
|
7c45fd451e | ||
|
|
acf886f483 | ||
|
|
2fd4418371 | ||
|
|
7fe1189f7b | ||
|
|
4aa17a84ab | ||
|
|
255d90cee9 | ||
|
|
8b680b1b14 | ||
|
|
01cd9ec358 | ||
|
|
f291c7ac9e | ||
|
|
061de4ddf3 | ||
|
|
6d4bc670e6 | ||
|
|
d258dcecd2 | ||
|
|
2e0c658160 | ||
|
|
2f439194e5 | ||
|
|
5e37f94775 | ||
|
|
41319a8cf8 | ||
|
|
001e859a97 | ||
|
|
6cf8c7ade4 | ||
|
|
6b7ae50fbb | ||
|
|
7439fa0c2a | ||
|
|
6b1ba37438 | ||
|
|
a579e0e8ae | ||
|
|
8077169ea9 | ||
|
|
bf2272c6b3 | ||
|
|
4e035f77f6 | ||
|
|
9df5e7664d | ||
|
|
41092095f5 | ||
|
|
a758d3dddc | ||
|
|
e228174eb5 | ||
|
|
a1f79e263a | ||
|
|
6f06c432ec | ||
|
|
3ae609c341 | ||
|
|
60d0ca1075 | ||
|
|
435211765c | ||
|
|
92c6de2c09 | ||
|
|
e3b27d47bc | ||
|
|
6b7255fdeb | ||
|
|
80e4f025d3 | ||
|
|
45a374b50a | ||
|
|
ea9f88b9fb | ||
|
|
da2dde879e | ||
|
|
064d124e19 | ||
|
|
0e0b2773eb | ||
|
|
ea4fe2045d | ||
|
|
48b732e53d | ||
|
|
f8a989439b | ||
|
|
dfd41a1b37 | ||
|
|
74d3194775 | ||
|
|
7ef25abecf | ||
|
|
ea278a6370 | ||
|
|
8790fcabf3 | ||
|
|
3d9ee49759 | ||
|
|
cde580ffce | ||
|
|
3c32cbfd9e | ||
|
|
691bc58f0e | ||
|
|
cafbb18626 | ||
|
|
939c6f2f67 | ||
|
|
477b50b7a6 | ||
|
|
6cdcacf20b | ||
|
|
d37c20f467 | ||
|
|
70964ccb35 | ||
|
|
3ebac3dece | ||
|
|
14f0443bd7 | ||
|
|
81d8f3cccc | ||
|
|
d27b3948af | ||
|
|
f906bb357a | ||
|
|
e0d3aa8e06 | ||
|
|
91ffda154d | ||
|
|
84248e1c56 | ||
|
|
51fe974ee5 | ||
|
|
1efdbeda16 | ||
|
|
827f826201 | ||
|
|
a5ef5f3104 | ||
|
|
76b2a846a2 | ||
|
|
e77f3f4d74 | ||
|
|
2c055cb954 | ||
|
|
f214098560 | ||
|
|
6027e94c65 | ||
|
|
bc4d4b7f35 | ||
|
|
e067f23ef2 | ||
|
|
05901a90aa | ||
|
|
dd6ebc3b65 | ||
|
|
8dc1ad00d5 | ||
|
|
f72e0a646e | ||
|
|
47dcd1cb8a | ||
|
|
25ffc3192f | ||
|
|
51fe6a15e9 | ||
|
|
8381976f05 | ||
|
|
6bcb9e9030 | ||
|
|
b364fd7d6a | ||
|
|
27ad3b5a7f | ||
|
|
eda9ae4c3e | ||
|
|
bb095bfd5d | ||
|
|
8a2cc2aeb8 | ||
|
|
6d9374590f | ||
|
|
3ec788a6cf | ||
|
|
5e20abef8d | ||
|
|
3d01728d2e | ||
|
|
c0bbb0fc51 | ||
|
|
4480010d4a | ||
|
|
70773105ac | ||
|
|
17d0835d63 | ||
|
|
cda90fe5ee | ||
|
|
07521e043a | ||
|
|
2c56e20941 | ||
|
|
11841ceb5d | ||
|
|
e44d348f09 | ||
|
|
ee31c8551f | ||
|
|
c2bb46f18c | ||
|
|
df66d1efd8 | ||
|
|
6f8c24a8d3 | ||
|
|
cd2fcac4cf | ||
|
|
adc9c40fe1 | ||
|
|
914955341d | ||
|
|
0ef17f55ff | ||
|
|
f4a0b99df8 | ||
|
|
644273fc5c | ||
|
|
a28bb6f951 | ||
|
|
9d3d211b6b | ||
|
|
8f55bf140e | ||
|
|
b73998d7c6 | ||
|
|
407c524088 | ||
|
|
fc82f0242c | ||
|
|
8c7a3bc476 | ||
|
|
765e1eb640 | ||
|
|
a8f562a7f5 | ||
|
|
7e42203627 | ||
|
|
649a269526 | ||
|
|
e80edbb401 | ||
|
|
1cb37a3ee7 | ||
|
|
27a4c8cd9a | ||
|
|
97a0baaf93 | ||
|
|
7b561044a9 | ||
|
|
346320f669 | ||
|
|
e941a510c1 | ||
|
|
835f6a45d3 | ||
|
|
ee71378dfd | ||
|
|
0161958603 | ||
|
|
dd6af87d6e | ||
|
|
7965dbd13f | ||
|
|
99ad26236e | ||
|
|
ba621502ae | ||
|
|
061702b6e4 | ||
|
|
e72fd5a271 | ||
|
|
c80a755dc6 | ||
|
|
5a4cb74493 | ||
|
|
5775a20eff | ||
|
|
cdd504622d | ||
|
|
39edf52792 | ||
|
|
4224c2e8fe | ||
|
|
4f82cb8261 | ||
|
|
aa9a5fbb99 | ||
|
|
dda59503ac | ||
|
|
549aeda1fd | ||
|
|
5903ebeb62 | ||
|
|
4d4fd40286 | ||
|
|
27aa7ad1e1 | ||
|
|
72a892ef55 | ||
|
|
4ff6f6a1f1 | ||
|
|
07da8aecac | ||
|
|
352ffb1582 | ||
|
|
ad08f30b31 | ||
|
|
13893b9f32 | ||
|
|
e5a53c175a | ||
|
|
224fbedbf4 | ||
|
|
97196d6520 | ||
|
|
06aea7d3f3 | ||
|
|
703ae0caf3 | ||
|
|
20c5788430 | ||
|
|
d449329d3d | ||
|
|
65f25756bf | ||
|
|
272db0d41d | ||
|
|
47d89ba2f6 | ||
|
|
6dd65d33ca | ||
|
|
70ca64a392 | ||
|
|
35e4e0d073 | ||
|
|
13a33d345b | ||
|
|
e30e6ad6c9 | ||
|
|
e9a89248ec | ||
|
|
46bb09c331 | ||
|
|
89a57054f5 | ||
|
|
c1e4c24136 | ||
|
|
d9b705ab98 | ||
|
|
87f6769c51 | ||
|
|
8a71f2d323 | ||
|
|
5fbcf6814c | ||
|
|
b175b4a2ae | ||
|
|
3aeb150eef | ||
|
|
260288a184 | ||
|
|
fec8530486 | ||
|
|
0557c83d40 | ||
|
|
fe969b64a0 | ||
|
|
27bd9423bc | ||
|
|
72a0ba6a55 | ||
|
|
56eb2c6b21 | ||
|
|
02d7c6747b | ||
|
|
cac321c16e | ||
|
|
10d4964106 | ||
|
|
e843be4540 | ||
|
|
782da9d091 | ||
|
|
a45e2c6831 | ||
|
|
111f5b163a | ||
|
|
ed0e65e5bb | ||
|
|
a43f54f960 | ||
|
|
cb64c068e3 | ||
|
|
eb6ac5ee22 | ||
|
|
e8561b7f90 | ||
|
|
815454c065 | ||
|
|
d1afc705ab | ||
|
|
ab8e813c7a | ||
|
|
99d22a7c21 | ||
|
|
a226c93539 | ||
|
|
e88a9b14ff | ||
|
|
673a9a55a2 | ||
|
|
d1fac6f5b3 | ||
|
|
3e9c170e6b | ||
|
|
59d5601f8f | ||
|
|
46c028f58c | ||
|
|
5105ff91d9 | ||
|
|
91750fd1da | ||
|
|
4ca5204acb | ||
|
|
43d73e3c01 | ||
|
|
f6b6ed211c | ||
|
|
1fb78742c7 | ||
|
|
c93e9a30cd | ||
|
|
4b54ae46ea | ||
|
|
e147cf7a8c | ||
|
|
36de18ec55 | ||
|
|
a5714a058c | ||
|
|
a8b113185d | ||
|
|
ff41868b59 | ||
|
|
d068684154 | ||
|
|
4a83c95d2b | ||
|
|
5d7ce3a92b | ||
|
|
82664396d6 | ||
|
|
3fb700c17d | ||
|
|
1a5aabc034 | ||
|
|
aa4addfa86 | ||
|
|
06fdcf51b9 | ||
|
|
7d6eb2b59b | ||
|
|
5c2ba8ef3a | ||
|
|
fccba7cd4c | ||
|
|
3e8d63c29c | ||
|
|
18359ef448 | ||
|
|
0c85f8adfe | ||
|
|
84c6ab737e | ||
|
|
9e73fda2ac | ||
|
|
254d7e0238 | ||
|
|
022f140b3a | ||
|
|
378456b6bd | ||
|
|
adcc78039e | ||
|
|
bdceeb83d5 | ||
|
|
100cea5d9f | ||
|
|
cc655609e2 | ||
|
|
18ab7d3183 | ||
|
|
4febd288ef | ||
|
|
b280c8a16a | ||
|
|
9c8df123e8 | ||
|
|
e558d5871b | ||
|
|
2ce1a003d5 | ||
|
|
8a8a51e23c | ||
|
|
c3e0a205f9 | ||
|
|
24a78d3246 | ||
|
|
31f6362e2e | ||
|
|
946ca09c54 | ||
|
|
552f52e061 | ||
|
|
57ab42bb7f | ||
|
|
b7e4310542 | ||
|
|
15ee8f172b | ||
|
|
9e778aa7e8 | ||
|
|
16e401f253 | ||
|
|
fdead062cd | ||
|
|
df54f5a59c | ||
|
|
2dd5d40833 | ||
|
|
0d41ff77be | ||
|
|
76c2054fa6 | ||
|
|
1fa6a98e79 | ||
|
|
a7adff4c4b | ||
|
|
af6f71abe4 | ||
|
|
9eb8e8dd99 | ||
|
|
23461f1ef5 | ||
|
|
3b63946973 | ||
|
|
1eca65fcda | ||
|
|
b364492a8c | ||
|
|
484aa0ba97 | ||
|
|
83078d1947 | ||
|
|
e02f8cf353 | ||
|
|
317fe7aceb | ||
|
|
54fd38adcc | ||
|
|
5fd5e722a8 | ||
|
|
e16a6ad4f0 | ||
|
|
2f87c10cf1 | ||
|
|
389328c99f | ||
|
|
e3884597a5 | ||
|
|
dc99d8637b | ||
|
|
2a4052bd8d | ||
|
|
3f5ff0d339 | ||
|
|
37d92e87bc |
@@ -1,4 +1,5 @@
|
|||||||
# Contributor Code of Conduct
|
Contributor Code of Conduct
|
||||||
|
===========================
|
||||||
|
|
||||||
As contributors and maintainers of this project, and in the interest of
|
As contributors and maintainers of this project, and in the interest of
|
||||||
fostering an open and welcoming community, we pledge to respect all
|
fostering an open and welcoming community, we pledge to respect all
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
## Supported Versions
|
||||||
|
|
||||||
|
finit is a small project, as such we have no possibility to support older versions.
|
||||||
|
The only supported version is the latest released on GitHub:
|
||||||
|
|
||||||
|
<https://github.com/troglobit/finit/releases>
|
||||||
|
|
||||||
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
Contact the project's main author and owner to report and discuss vulnerabilities.
|
||||||
@@ -9,11 +9,13 @@ GSYMS
|
|||||||
GTAGS
|
GTAGS
|
||||||
|
|
||||||
# GNU configure and build system
|
# GNU configure and build system
|
||||||
|
/aux
|
||||||
/.deps
|
/.deps
|
||||||
/autom4te.cache
|
/autom4te.cache
|
||||||
/aclocal.m4
|
/aclocal.m4
|
||||||
/ar-lib
|
/ar-lib
|
||||||
/compile
|
/compile
|
||||||
|
/config.cache
|
||||||
/config.h
|
/config.h
|
||||||
/config.mk
|
/config.mk
|
||||||
/config.guess
|
/config.guess
|
||||||
@@ -31,6 +33,9 @@ GTAGS
|
|||||||
/Makefile.in
|
/Makefile.in
|
||||||
/stamp-h1
|
/stamp-h1
|
||||||
|
|
||||||
|
/test-driver
|
||||||
|
/test-suite.log
|
||||||
|
|
||||||
# TroglOS build system
|
# TroglOS build system
|
||||||
/.config
|
/.config
|
||||||
/.stamp
|
/.stamp
|
||||||
|
|||||||
+20
-19
@@ -5,9 +5,6 @@ language: c
|
|||||||
# Use docker for quicker builds, it now allows https://docs.travis-ci.com/user/apt/
|
# Use docker for quicker builds, it now allows https://docs.travis-ci.com/user/apt/
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|
||||||
# Use non-docker builds atm. to install libuEv and libite from source
|
|
||||||
#sudo: true
|
|
||||||
|
|
||||||
# Test build with both GCC and Clang (LLVM)
|
# Test build with both GCC and Clang (LLVM)
|
||||||
compiler:
|
compiler:
|
||||||
- gcc
|
- gcc
|
||||||
@@ -30,32 +27,36 @@ addons:
|
|||||||
name: "troglobit/finit"
|
name: "troglobit/finit"
|
||||||
description: "finit | Fast & Extensible init for Linux"
|
description: "finit | Fast & Extensible init for Linux"
|
||||||
notification_email: troglobit@gmail.com
|
notification_email: troglobit@gmail.com
|
||||||
build_command_prepend: "./autogen.sh && ./configure --prefix=/tmp"
|
build_command_prepend: "./autogen.sh && ./configure --prefix= --disable-doc --disable-contrib --with-watchdog"
|
||||||
build_command: "make"
|
build_command: "make"
|
||||||
branch_pattern: dev
|
branch_pattern: dev
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- wget https://github.com/troglobit/libuev/releases/download/v2.2.0/libuev-2.2.0.tar.xz
|
- wget https://github.com/troglobit/libuev/releases/download/v2.3.2/libuev-2.3.2.tar.xz
|
||||||
- wget https://github.com/troglobit/libite/releases/download/v2.0.1/libite-2.0.1.tar.xz
|
- wget https://github.com/troglobit/libite/releases/download/v2.3.1/libite-2.3.1.tar.gz
|
||||||
- tar xf libuev-2.2.0.tar.xz
|
- tar xf libuev-2.3.2.tar.xz
|
||||||
- tar xf libite-2.0.1.tar.xz
|
- tar xf libite-2.3.1.tar.gz
|
||||||
- (cd libuev-2.2.0 && ./configure --prefix=/tmp && make && make install-strip)
|
- (cd libuev-2.3.2 && ./configure --prefix=/tmp && make && make install-strip)
|
||||||
- (cd libite-2.0.1 && ./configure --prefix=/tmp && make && make install-strip)
|
- (cd libite-2.3.1 && ./configure --prefix=/tmp && make && make install-strip)
|
||||||
|
|
||||||
# Custom build script for the time being, no "make test" yet
|
# Custom build script for the time being, no "make test" yet
|
||||||
script:
|
script:
|
||||||
- ./autogen.sh
|
- ./autogen.sh
|
||||||
- ./configure --prefix=/tmp --disable-inetd --enable-static
|
- ./configure --prefix= --enable-static
|
||||||
- make clean
|
- make clean
|
||||||
- make V=1 -j5
|
- make V=1 -j5
|
||||||
- ./configure --prefix=/tmp --enable-inetd-echo-plugin --enable-inetd-time-plugin --enable-x11-common-plugin --enable-inetd-chargen-plugin --enable-fallback-shell --enable-watchdog --enable-logit
|
- ./configure --prefix= --enable-x11-common-plugin --with-watchdog
|
||||||
- cat config.log
|
- cat config.log
|
||||||
- make clean
|
- make clean
|
||||||
- make V=1 -j5
|
- make V=1 -j5
|
||||||
- make install-strip
|
- make install-strip DESTDIR=/tmp/finit
|
||||||
- tree /tmp
|
- tree /tmp/finit
|
||||||
- ldd /tmp/sbin/finit
|
- ldd /tmp/finit/sbin/finit
|
||||||
- size /tmp/sbin/finit
|
- size /tmp/finit/sbin/finit
|
||||||
- size /tmp/sbin/initctl
|
- size /tmp/finit/sbin/initctl
|
||||||
- size /tmp/sbin/reboot
|
- size /tmp/finit/sbin/reboot
|
||||||
- LD_LIBRARY_PATH=/tmp/lib /tmp/sbin/initctl -h
|
- LD_LIBRARY_PATH=/tmp/lib /tmp/finit/sbin/initctl -h
|
||||||
|
- unshare -V
|
||||||
|
- nsenter -V
|
||||||
|
- chroot --version
|
||||||
|
- 'LD_LIBRARY_PATH=/tmp/lib make distcheck || (cat finit-4.0-beta1/_build/sub/test/test-suite.log; exit 1)'
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
Current Maintainer(s):
|
Current Maintainer(s):
|
||||||
* Joachim Nilsson <troglobit@gmail.com>
|
* Joachim Wiberg <troglobit@gmail.com>
|
||||||
|
|
||||||
Major Contributors:
|
Major Contributors:
|
||||||
* Tobias Waldekranz <tobias@waldekranz.com>
|
* Tobias Waldekranz <tobias@waldekranz.com>
|
||||||
* Mattias Walström <mattias.walstrom@westermo.se>
|
* Mattias Walström <mattias.walstrom@westermo.se>
|
||||||
* Jonas Johansson <jonas.johansson@westermo.se>
|
* Jonas Johansson <jonas.johansson@westermo.se>
|
||||||
|
* Jacques de Laval <jacques@de-laval.se>
|
||||||
|
* Magnus Malm <magnusmalm@gmail.com>
|
||||||
|
|
||||||
Original Author(s):
|
Original Author(s):
|
||||||
* Claudio Matsuoka <cmatsuoka@gmail.com>
|
* Claudio Matsuoka <cmatsuoka@gmail.com>
|
||||||
|
|||||||
+70
-26
@@ -4,25 +4,67 @@ Change Log
|
|||||||
All relevant changes are documented in this file.
|
All relevant changes are documented in this file.
|
||||||
|
|
||||||
|
|
||||||
[3.2][UNRELEASED] - 2020-04-xx
|
[4.0][] - 2021-04-26
|
||||||
------------------------------
|
--------------------
|
||||||
|
|
||||||
Bug fix release, but also cgroups and a new progress!
|
This release became v4.0, and not v3.2, because of incompatible changes
|
||||||
|
to service conditions. There are other significant changes as well, so
|
||||||
https://twitter.com/b0rk/status/1214341831049252870?s=20
|
make sure to read the whole change log when upgrading.
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
|
* The stand-alone `reboot` tool has been replaced with a symlink to
|
||||||
|
`initctl`, like its siblings: halt, shutdown, poweroff, and suspend.
|
||||||
|
Calling `reboot` & C:o now defaults to the corresponding `initctl cmd`
|
||||||
|
with a fallback to sending signals as per traditional SysV init. The
|
||||||
|
`-f` (force) flag remains, where `reboot(2)` is called directly
|
||||||
* Introducing Finit progress 𝓜𝓸𝓭𝓮𝓻𝓷
|
* Introducing Finit progress 𝓜𝓸𝓭𝓮𝓻𝓷
|
||||||
|
* The `inictl cond set|clear COND` have changed completely. Constrained
|
||||||
|
to a flat `<usr/...>` namespace and automatically activated by a new
|
||||||
|
`usr.so` plugin that checks services for usr condition changes
|
||||||
|
* Removed built-in inetd super server. If you need this functionality,
|
||||||
|
use an external inetd, like xinetd, instead. A pull request for a
|
||||||
|
stand-alone inetd, like watchdogd and getty, is most welcome!
|
||||||
|
* Incompatible `configure` script changes, i.e., no guessing `--prefix`
|
||||||
|
and other paths. Also, many options have been changed, renamed, or
|
||||||
|
flipped defaults, or even dropped altogether. There are examples in
|
||||||
|
the documentation and the `contrib/` section
|
||||||
|
* Service conditions change from the non-obvious `<svc/path/to/foo>` to
|
||||||
|
`<pid/foo:id>`. Not only does this give simpler internal semantics,
|
||||||
|
it hopefully also makes it clear that one service's `pid:!foo` pidfile
|
||||||
|
is another service's `<pid/foo>` condition, issue #143
|
||||||
|
* Initial support for cgroups v2:
|
||||||
|
- services runs in a cgroup named after their respective *.conf file
|
||||||
|
- top-level groups are; init, user, and system
|
||||||
|
- all top-level groups can be configured from finit *.conf files
|
||||||
|
- each service can tweak the cgroup settings
|
||||||
|
- Use `initctl [top|ps|cgroup]` commands to inspect runtime state
|
||||||
|
- https://twitter.com/b0rk/status/1214341831049252870?s=20
|
||||||
|
* Major refactor of Finit's `main()` function to be able to start the
|
||||||
|
event loop earlier. This also facilitated factoring out functionality
|
||||||
|
previously hard-coded in Finit, e.g., starting the bundled watchdogd,
|
||||||
|
various distro packed udevd and other hotplugging tools
|
||||||
|
* A proper rescue mode has been added. It is started extremely early
|
||||||
|
and is protected with a bundled `suslogin`. Exiting rescue mode now
|
||||||
|
brings up the system as a normal boot, as one expects
|
||||||
* Support for `sysv` start/stop scripts as well as monitoring forking
|
* Support for `sysv` start/stop scripts as well as monitoring forking
|
||||||
services, stared using `sysv` or `service` stanza
|
services, stared using `sysv` or `service` stanza
|
||||||
* Support for custom `kill:DELAY`, default 3 sec.
|
* Support for custom `kill:DELAY`, default 3 sec.
|
||||||
* Support for custom `halt:SIGNAL`, default SIGTERM
|
* Support for custom `halt:SIGNAL`, default SIGTERM
|
||||||
|
* Support for `pre:script` and `post:script`, allows for setup and
|
||||||
|
teardown/cleanup before and after a service runs, issue #129
|
||||||
|
* Support for `env:file` in `/etc/default/foo` or `/etc/conf.d/foo`, see
|
||||||
|
the contrib section for examples that utilize this feature. Variables
|
||||||
|
expanded from env files, and the env files themselves, are tracked for
|
||||||
|
changes to see if a service .conf file is "dirty" and needs restart on
|
||||||
|
`initctl reload`
|
||||||
* Support for tracking custom PID files, using `pid:!/path/to/foo.pid`,
|
* Support for tracking custom PID files, using `pid:!/path/to/foo.pid`,
|
||||||
useful with new `sysv` or `service` which fork to background
|
useful with new `sysv` or `service` which fork to background
|
||||||
* Support starting run/task/services without absolute path, trust `$PATH`
|
* Support starting run/task/services without absolute path, trust `$PATH`
|
||||||
* Add support for `--disable-doc` and `--disable-contrib` to speed up
|
* Add support for `--disable-doc` and `--disable-contrib` to speed up
|
||||||
builds and work around issue with massively parallel builds
|
builds and work around issue with massively parallel builds
|
||||||
* Add support for `@console` also for external getty
|
* Support for `@console` also for external getty
|
||||||
|
* Support for `notty` option to built-in getty, for board bring-up
|
||||||
|
* Support for `rescue` option to built-in getty, for rescue shells
|
||||||
* Add `-b`, batch mode, for non-interactive use to `initctl`
|
* Add `-b`, batch mode, for non-interactive use to `initctl`
|
||||||
* Prefer udev to handle `/dev/` if mdev is also available
|
* Prefer udev to handle `/dev/` if mdev is also available
|
||||||
* Redirect dbus daemon output to syslog
|
* Redirect dbus daemon output to syslog
|
||||||
@@ -64,50 +106,48 @@ Bug fix release, but also cgroups and a new progress!
|
|||||||
* Drop `--enable-rw-roots` configure option, use `rw` for your `/`
|
* Drop `--enable-rw-roots` configure option, use `rw` for your `/`
|
||||||
partition in `/etc/fstab` instead to trigger remount at boot
|
partition in `/etc/fstab` instead to trigger remount at boot
|
||||||
* Drop default tty speed (38400) and use 0 (kernel default) instead
|
* Drop default tty speed (38400) and use 0 (kernel default) instead
|
||||||
* Make `:ID` optional for real, use NULL/zero internally and only
|
* Make `:ID` optional, use NULL/zero internally this allows ...
|
||||||
force :ID (numbered) for inetd services, this allows ...
|
|
||||||
* Handle use-cases where multiple services share the same PID filem
|
* Handle use-cases where multiple services share the same PID filem
|
||||||
and thus the same condition path, e.g. different instances for
|
and thus the same condition path, e.g. different instances for
|
||||||
different runlevels. Allow custom condition path with `name:foo`
|
different runlevels. Allow custom condition path with `name:foo`
|
||||||
syntax, creates conditions w/o a path, and ...
|
syntax, creates conditions w/o a path, and ...
|
||||||
* Always append `:ID` qualifier to conditions if set for a service
|
* Always append `:ID` qualifier to conditions if set for a service
|
||||||
|
* The IPC socket has moved from `/run/finit.sock` to `/run/finit/socket`
|
||||||
|
officially only supported for use by the `initctl` tool
|
||||||
|
* The IPC socket now uses `SOCK_SEQPACKET` instead of `SOCK_STREAM`.
|
||||||
|
Recommend using watchdogd v3.4, or later, which support this
|
||||||
|
* Improved support for modern `/etc/network/interfaces`, which has
|
||||||
|
include statements. No more native `ifup` of individual interfaces,
|
||||||
|
Finit now calls `ifup -a`, or `ifdown -a`, delegating all details to
|
||||||
|
the operating system. Also, this is now done in the background, by
|
||||||
|
popular request
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
|
||||||
* Fix #96: Start udevd as a proper service
|
* Fix #96: Start udevd as a proper service
|
||||||
* Ensure we track run commands as well as task/service, once per runlevel
|
* Ensure we track run commands as well as task/service, once per runlevel
|
||||||
* Fix #98: FTBFS with `--disable-inetd`
|
|
||||||
* Make sure to unblock UDP inetd services when connection terminates.
|
|
||||||
Regression introduced in v3.1
|
|
||||||
* Ensure run/tasks also go to stopping state on exit, like services,
|
* Ensure run/tasks also go to stopping state on exit, like services,
|
||||||
otherwise it is unnecessarily hard to restart them
|
otherwise it is unnecessarily hard to restart them
|
||||||
* Fix #99: Do not try to `SIGKILL` inetd services, they are not backed
|
|
||||||
by a PID. This caused a use after free issue crashing finit. Found
|
|
||||||
and fixed by Tobias Waldekranz, Westermo
|
|
||||||
* Fix missing OS/Finit title bug, adds leading newline before banner
|
* Fix missing OS/Finit title bug, adds leading newline before banner
|
||||||
* Remove "Failed connecting to watchdog ..." error message on systems
|
* Remove "Failed connecting to watchdog ..." error message on systems
|
||||||
that do not have a watchdog
|
that do not have a watchdog
|
||||||
* Fix #100: Early condition handling may not work if `/var/run` does
|
* Fix #100: Early condition handling may not work if `/var/run` does
|
||||||
not yet exist (symlink to `/run`). Added compat layer for access
|
not yet exist (symlink to `/run`). Added compat layer for access
|
||||||
|
* Fix #101: Built-in inetd removed
|
||||||
|
* Fix #102: Start built-in watchdogd as a regular service
|
||||||
* Fix #103: Register multiple getty if `@console` resolves to >1 TTY,
|
* Fix #103: Register multiple getty if `@console` resolves to >1 TTY,
|
||||||
* Fix #105: Only remove /etc/nologin when moving from runlevel 0, 1, 6
|
* Fix #105: Only remove /etc/nologin when moving from runlevel 0, 1, 6
|
||||||
* Fix #106: Don't mark inetd connections for deletion at .conf reload.
|
|
||||||
Fixed by Jonas Johansson, Westermo
|
|
||||||
* Fix #107: Stop spawned inetd conncections when stopping inetd service.
|
|
||||||
Fixed by Jonas Johansson, Westermo
|
Fixed by Jonas Johansson, Westermo
|
||||||
* Fix #109: Support for PID files in sub-directories to `/var/run`
|
* Fix #109: Support for PID files in sub-directories to `/var/run`
|
||||||
* Handle rename of PID files, by Robert Andersson, Atlas Copco
|
* Handle rename of PID files, by Robert Andersson, Atlas Copco
|
||||||
* Fix #111: Only restart inetd services when necessary. E.g., if the
|
* Fix #110: automatic modprobe of RTC devices, built-in hwclock
|
||||||
listening interface is changed. Only stop established connections
|
|
||||||
which are no longer allowed, i.e. do not touch already allowed
|
|
||||||
established connections. Fixed by Jonas Johansson, Westermo
|
|
||||||
* Fix #120: Redirect `stdin` to `/dev/null` for services by default
|
* Fix #120: Redirect `stdin` to `/dev/null` for services by default
|
||||||
* Fix #122: Switch to `nanosleep()` to achieve "signal safe" sleep,
|
* Fix #122: Switch to `nanosleep()` to achieve "signal safe" sleep,
|
||||||
fixed by Jacques de Laval, Westermo
|
fixed by Jacques de Laval, Westermo
|
||||||
* Fix #124: Lingering processes in process group when session leader
|
* Fix #124: Lingering processes in process group when session leader
|
||||||
exits. E.g., lingering `logit` processes when parent dies
|
exits. E.g., lingering `logit` processes when parent dies
|
||||||
* Fix: update inetd service args on config change. Found and fixed by
|
* Fix #127: Show all runparts scripts as they start, like rc.local, fixed
|
||||||
Petrus Hellgren, Westermo
|
by Jacques de Laval, Westermo
|
||||||
* Fix service name matching, e.g. for condition handling, may match with
|
* Fix service name matching, e.g. for condition handling, may match with
|
||||||
wrong service, by Jonas Holmberg, Westermo
|
wrong service, by Jonas Holmberg, Westermo
|
||||||
* Run all run-parts scripts using `/bin/sh -c foo` just like the standard
|
* Run all run-parts scripts using `/bin/sh -c foo` just like the standard
|
||||||
@@ -124,6 +164,10 @@ Bug fix release, but also cgroups and a new progress!
|
|||||||
* Fix C++ compilation issues, by Robert Andersson, Atlas Copco
|
* Fix C++ compilation issues, by Robert Andersson, Atlas Copco
|
||||||
* Build fixes for uClibc
|
* Build fixes for uClibc
|
||||||
* Provide service description for built-in watchdog daemon
|
* Provide service description for built-in watchdog daemon
|
||||||
|
* Fix #138: Handle `SIGPWR` like `SIGSUR2`, i.e., power off the system
|
||||||
|
* Drop the '%m' GNUism, for compat with older musl libc
|
||||||
|
* Fix #139: call `tzset()` on `initctl reload` to activate system
|
||||||
|
timezone changes (for logging)
|
||||||
|
|
||||||
|
|
||||||
[3.1][] - 2018-01-23
|
[3.1][] - 2018-01-23
|
||||||
@@ -732,14 +776,14 @@ Major bug fix release.
|
|||||||
* Makefile fixes for installation, paths encoded wrong
|
* Makefile fixes for installation, paths encoded wrong
|
||||||
* Strip binaries + .so files, support for `$(CROSS)` toolchain strip
|
* Strip binaries + .so files, support for `$(CROSS)` toolchain strip
|
||||||
* Default install is now to `/sbin/finit` and `/usr/`
|
* Default install is now to `/sbin/finit` and `/usr/`
|
||||||
* Note change in `$PLUGIN_DIR` environemnt variable to `$plugindir`
|
* Note change in `$PLUGIN_DIR` environment variable to `$plugindir`
|
||||||
|
|
||||||
|
|
||||||
[1.2][] - 2012-09-27
|
[1.2][] - 2012-09-27
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
* Update README with section on building and enviroment variables
|
* Update README with section on building and environment variables
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
* Fix installation paths encoded in finit binary
|
* Fix installation paths encoded in finit binary
|
||||||
@@ -832,7 +876,7 @@ Major bug fix release.
|
|||||||
* Initial release
|
* Initial release
|
||||||
|
|
||||||
[UNRELEASED]: https://github.com/troglobit/finit/compare/3.1...HEAD
|
[UNRELEASED]: https://github.com/troglobit/finit/compare/3.1...HEAD
|
||||||
[3.2]: https://github.com/troglobit/finit/compare/3.1...3.2
|
[4.0]: https://github.com/troglobit/finit/compare/3.1...4.0
|
||||||
[3.1]: https://github.com/troglobit/finit/compare/3.0...3.1
|
[3.1]: https://github.com/troglobit/finit/compare/3.0...3.1
|
||||||
[3.0]: https://github.com/troglobit/finit/compare/2.4...3.0
|
[3.0]: https://github.com/troglobit/finit/compare/2.4...3.0
|
||||||
[2.4]: https://github.com/troglobit/finit/compare/2.3...2.4
|
[2.4]: https://github.com/troglobit/finit/compare/2.3...2.4
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
||||||
Copyright (c) 2008-2014 Joachim Nilsson <troglobit@gmail.com>
|
Copyright (c) 2008-2021 Joachim Wiberg <troglobit@gmail.com>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+6
-4
@@ -1,5 +1,5 @@
|
|||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
SUBDIRS = plugins src
|
SUBDIRS = plugins src test
|
||||||
doc_DATA = README.md LICENSE contrib/finit.conf
|
doc_DATA = README.md LICENSE contrib/finit.conf
|
||||||
EXTRA_DIST = README.md LICENSE ChangeLog.md contrib/finit.conf
|
EXTRA_DIST = README.md LICENSE ChangeLog.md contrib/finit.conf
|
||||||
|
|
||||||
@@ -16,8 +16,9 @@ install-dev:
|
|||||||
|
|
||||||
# Target to run when building a release
|
# Target to run when building a release
|
||||||
release: distcheck
|
release: distcheck
|
||||||
@for file in $(DIST_ARCHIVES); do \
|
@for file in $(DIST_ARCHIVES); do \
|
||||||
md5sum $$file > ../$$file.md5; \
|
md5sum $$file > ../$$file.md5; \
|
||||||
|
sha256sum $$file > ../$$file.sha256; \
|
||||||
done
|
done
|
||||||
@mv $(DIST_ARCHIVES) ../
|
@mv $(DIST_ARCHIVES) ../
|
||||||
@echo
|
@echo
|
||||||
@@ -25,5 +26,6 @@ release: distcheck
|
|||||||
@echo "================================================================="
|
@echo "================================================================="
|
||||||
@for file in $(DIST_ARCHIVES); do \
|
@for file in $(DIST_ARCHIVES); do \
|
||||||
printf "$$file \tDistribution tarball\n"; \
|
printf "$$file \tDistribution tarball\n"; \
|
||||||
printf "$$file.md5\t"; cat ../$$file.md5 | cut -f1 -d' '; \
|
printf "$$file.md5\t"; cat ../$$file.md5 | cut -f1 -d' '; \
|
||||||
|
printf "$$file.sha256\t"; cat ../$$file.sha256 | cut -f1 -d' '; \
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
* [Bootstrap](doc/bootstrap.md#bootstrap)
|
* [Bootstrap](doc/bootstrap.md#bootstrap)
|
||||||
* [Runlevels](#runlevels)
|
* [Runlevels](#runlevels)
|
||||||
* [Syntax](doc/config.md#syntax)
|
* [Syntax](doc/config.md#syntax)
|
||||||
* [Inetd](doc/inetd.md#inetd)
|
|
||||||
* [Runparts & /etc/rc.local](#runparts--etcrclocal)
|
* [Runparts & /etc/rc.local](#runparts--etcrclocal)
|
||||||
* [Hooks, Callbacks & Plugins](doc/plugins.md#hooks-callbacks--plugins)
|
* [Hooks, Callbacks & Plugins](doc/plugins.md#hooks-callbacks--plugins)
|
||||||
* [Rebooting & Halting](#rebooting--halting)
|
* [Rebooting & Halting](#rebooting--halting)
|
||||||
@@ -27,6 +26,26 @@ Finit is a simple alternative to [SysV init][4] and [systemd][6]. It
|
|||||||
was reverse engineered from the [EeePC fastinit][] over ten years ago
|
was reverse engineered from the [EeePC fastinit][] over ten years ago
|
||||||
by [Claudio Matsuoka][] — "gaps filled with frog DNA …"
|
by [Claudio Matsuoka][] — "gaps filled with frog DNA …"
|
||||||
|
|
||||||
|

|
||||||
|
*Figure 1: Screenshot showing Finit booting [Alpine Linux](https://www.alpinelinux.org/).*
|
||||||
|
|
||||||
|
Features include:
|
||||||
|
|
||||||
|
* Runlevels
|
||||||
|
* One-shot tasks, daemons, or SysV init scripts
|
||||||
|
* Runparts and rc.local
|
||||||
|
* Process supervision
|
||||||
|
* Sourcing environment files
|
||||||
|
* Conditions for network/process/custom dependencies
|
||||||
|
* Pre/Post script actions
|
||||||
|
* Tooling to enable/disable services
|
||||||
|
* Built-in getty
|
||||||
|
* Built-in watchdog, with support for hand-over to [watchdogd](https://troglobit.com/watchdogd.html)
|
||||||
|
* Built-in support for Debian/BusyBox `/etc/network/interfaces`
|
||||||
|
* Cgroups v2, both configuration and monitoring in `initctl top`
|
||||||
|
* Plugin support for customization
|
||||||
|
* Proper rescue mode with bundled `sulogin` for protected maintenance shell
|
||||||
|
|
||||||
Focus is on small and embedded systems, although Finit is fully usable
|
Focus is on small and embedded systems, although Finit is fully usable
|
||||||
on server and desktop systems as well. For working examples, see the
|
on server and desktop systems as well. For working examples, see the
|
||||||
[contrib/](contrib/) section with tutorials for:
|
[contrib/](contrib/) section with tutorials for:
|
||||||
@@ -35,9 +54,6 @@ on server and desktop systems as well. For working examples, see the
|
|||||||
* [Alpine Linux](contrib/alpine/), and
|
* [Alpine Linux](contrib/alpine/), and
|
||||||
* [Debian GNU/Linux](contrib/debian/)
|
* [Debian GNU/Linux](contrib/debian/)
|
||||||
|
|
||||||

|
|
||||||
The screenshot shows [Alpine Linux](https://www.alpinelinux.org/).
|
|
||||||
|
|
||||||
|
|
||||||
Example
|
Example
|
||||||
-------
|
-------
|
||||||
@@ -59,89 +75,79 @@ runlevel 2
|
|||||||
log size=100k count=4
|
log size=100k count=4
|
||||||
|
|
||||||
# Services to be monitored and respawned as needed
|
# Services to be monitored and respawned as needed
|
||||||
service [S12345] /sbin/watchdogd -L -f -- System watchdog daemon
|
service [S12345] env:-/etc/conf.d/watchdog watchdog $WATCHDOG_OPTS $WATCHDOG_DEV -- System watchdog daemon
|
||||||
service [S12345] /sbin/syslogd -n -b 3 -D -- System log daemon
|
service [S12345] env:-/etc/conf.d/syslog syslogd -n $SYSLOGD_OPTS -- System log daemon
|
||||||
service [S12345] /sbin/klogd -n -- Kernel log daemon
|
service [S12345] <pid/syslogd> env:-/etc/conf.d/klogd klogd -n $KLOGD_OPTS -- Kernel log daemon
|
||||||
service [2345] /sbin/lldpd -d -c -M1 -H0 -i -- LLDP daemon (IEEE 802.1ab)
|
service [2345] env:-/etc/conf.d/lldpd lldpd -d $LLDPD_OPTS -- LLDP daemon (IEEE 802.1ab)
|
||||||
|
|
||||||
# The BusyBox ntpd does not use syslog when running in the foreground
|
# The BusyBox ntpd does not use syslog when running in the foreground
|
||||||
# So we use this trick to redirect stdout/stderr to a log file. The
|
# So we use this trick to redirect stdout/stderr to a log file. The
|
||||||
# log file is rotated with the above settings. The condition declares
|
# log file is rotated with the above settings. The condition declares
|
||||||
# a dependency on a system default route (gateway) to be set. A single
|
# a dependency on a system default route (gateway) to be set. A single
|
||||||
# <!> at the beginning means ntpd does not respect SIGHUP for restart.
|
# <!> at the beginning means ntpd does not respect SIGHUP for restart.
|
||||||
service [2345] log:/var/log/ntpd.log <!net/route/default> /sbin/ntpd -n -l -I eth0 -- NTP daemon
|
service [2345] log:/var/log/ntpd.log <!net/route/default> ntpd -n -l -I eth0 -- NTP daemon
|
||||||
|
|
||||||
# For multiple instances of the same service, add :ID somewhere between
|
# For multiple instances of the same service, add :ID somewhere between
|
||||||
# the service/run/task keyword and the command.
|
# the service/run/task keyword and the command.
|
||||||
service :1 [2345] /sbin/merecat -n -p 80 /var/www -- Web server
|
service :80 [2345] merecat -n -p 80 /var/www -- Web server
|
||||||
service :2 [2345] /sbin/merecat -n -p 8080 /var/www -- Old web server
|
service :8080 [2345] merecat -n -p 8080 /var/www -- Old web server
|
||||||
|
|
||||||
# Alternative method instead of below runparts, can also use /etc/rc.local
|
# Alternative method instead of below runparts, can also use /etc/rc.local
|
||||||
#task [S] /etc/init.d/keyboard-setup start -- Setting up preliminary keymap
|
#sysv [S] /etc/init.d/keyboard-setup -- Setting up preliminary keymap
|
||||||
#task [S] /etc/init.d/acpid start -- Starting ACPI Daemon
|
#sysv [S] /etc/init.d/acpid -- Starting ACPI Daemon
|
||||||
#task [S] /etc/init.d/kbd start -- Preparing console
|
#task [S] /etc/init.d/kbd -- Preparing console
|
||||||
|
|
||||||
# Inetd services to start on demand, with alternate ports and filtering
|
|
||||||
inetd ftp/tcp nowait [2345] /sbin/in.ftpd -- FTP daemon
|
|
||||||
inetd tftp/udp wait [2345] /sbin/in.tftpd -- TFTP daemon
|
|
||||||
inetd time/udp wait [2345] internal -- UNIX rdate service
|
|
||||||
inetd time/tcp nowait [2345] internal -- UNIX rdate service
|
|
||||||
inetd 3737/tcp nowait [2345] internal.time -- UNIX rdate service
|
|
||||||
inetd telnet/tcp nowait [2345] /sbin/telnetd -i -F -- Telnet daemon
|
|
||||||
inetd 2323/tcp nowait [2345] /sbin/telnetd -i -F -- Telnet daemon
|
|
||||||
inetd 222/tcp@eth0 nowait [2345] /sbin/dropbear -i -R -F -- SSH service
|
|
||||||
inetd ssh/tcp@*,!eth0 nowait [2345] /sbin/dropbear -i -R -F -- SSH service
|
|
||||||
|
|
||||||
# Run start scripts from this directory
|
# Run start scripts from this directory
|
||||||
# runparts /etc/start.d
|
# runparts /etc/start.d
|
||||||
|
|
||||||
# Virtual consoles run BusyBox getty, keep kernel default speed
|
# Virtual consoles run BusyBox getty, keep kernel default speed
|
||||||
tty [12345] /sbin/getty -L 0 /dev/tty1 linux
|
tty [12345] /sbin/getty -L 0 /dev/tty1 linux nowait noclear
|
||||||
tty [12345] /sbin/getty -L 0 /dev/tty2 linux
|
tty [2345] /sbin/getty -L 0 /dev/tty2 linux nowait noclear
|
||||||
tty [12345] /sbin/getty -L 0 /dev/tty3 linux
|
tty [2345] /sbin/getty -L 0 /dev/tty3 linux nowait noclear
|
||||||
|
|
||||||
# Use built-in getty for serial port and USB serial
|
# Use built-in getty for serial port and USB serial
|
||||||
tty [12345] /dev/ttyAMA0 noclear nowait
|
#tty [12345] /dev/ttyAMA0 noclear nowait
|
||||||
tty [12345] /dev/ttyUSB0 noclear
|
#tty [12345] /dev/ttyUSB0 noclear
|
||||||
|
|
||||||
# Just give me a shell, I need to debug this embedded system!
|
# Just give me a shell, I need to debug this embedded system!
|
||||||
tty [12345] @console noclear nologin
|
#tty [12345] console noclear nologin
|
||||||
```
|
```
|
||||||
|
|
||||||
The `service` stanza, as well as `task`, `run`, `inetd` and others are
|
The `service` stanza, as well as `task`, `run` and others are described
|
||||||
described in full in [doc/config.md](doc/config.md). Here's a quick
|
in full in [doc/config.md](doc/config.md). Here's a quick overview of
|
||||||
overview of some of the most common components needed to start a UNIX
|
some of the most common components needed to start a UNIX daemon:
|
||||||
daemon:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
service [LVLS] <COND> /path/to/daemon ARGS -- Some text
|
service [LVLS] <COND> log env:[-]/etc/default/daemon daemon ARGS -- Daemon daemon
|
||||||
^ ^ ^ ^ ^ ^
|
^ ^ ^ ^ ^ ^ ^ ^
|
||||||
| | | | | `-- Optional description
|
| | | | | | | `-- Optional description
|
||||||
| | | | `---------- Daemon arguments
|
| | | | | | `----------- Daemon arguments
|
||||||
| | | `-------------------------- Path to daemon
|
| | | | | `-------------------------- Path to daemon
|
||||||
| | `--------------------------------- Optional conditions
|
| | | | `---------------------------------------------------- Optional env. file
|
||||||
| `---------------------------------------- Optional Runlevels
|
| | | `-------------------------------------------------------- Redirect output to log
|
||||||
`------------------------------------------------ Monitored application
|
| | `--------------------------------------------------------------- Optional conditions
|
||||||
|
| `---------------------------------------------------------------------- Optional Runlevels
|
||||||
|
`------------------------------------------------------------------------------ Monitored application
|
||||||
```
|
```
|
||||||
|
|
||||||
Some components are optional: runlevel(s), condition(s) and description,
|
Some components are optional: runlevel(s), condition(s) and description,
|
||||||
making it easy to create simple start scripts and still possible for more
|
making it easy to create simple start scripts and still possible for more
|
||||||
advanced uses as well:
|
advanced uses as well:
|
||||||
|
|
||||||
service /usr/sbin/sshd -D
|
service sshd -D
|
||||||
|
|
||||||
Dependencies are handled using [conditions](doc/conditions.md). One of
|
Dependencies are handled using [conditions](doc/conditions.md). One of
|
||||||
the most common conditions is to wait for basic networking to become
|
the most common conditions is to wait for basic networking to become
|
||||||
available:
|
available:
|
||||||
|
|
||||||
service <net/route/default> /usr/sbin/nginx -- High performace HTTP server
|
service <net/route/default> nginx -- High performace HTTP server
|
||||||
|
|
||||||
Here is another example where we instruct Finit to not start BusyBox
|
Here is another example where we instruct Finit to not start BusyBox
|
||||||
`ntpd` until `syslogd` has started properly. Finit waits for `syslogd`
|
`ntpd` until `syslogd` has started properly. Finit waits for `syslogd`
|
||||||
to create its PID file, by default `/var/run/syslogd.pid`.
|
to create its PID file, by default `/var/run/syslogd.pid`.
|
||||||
|
|
||||||
service [2345] log <svc/sbin/syslogd> /usr/sbin/ntpd -n -N -p pool.ntp.org
|
service [2345] log <!pid/syslogd> ntpd -n -N -p pool.ntp.org
|
||||||
service [S12345] /sbin/syslogd -n -- Syslog daemon
|
service [S12345] syslogd -n -- Syslog daemon
|
||||||
|
|
||||||
Notice the `log` keyword, BusyBox `ntpd` uses `stderr` for logging when
|
Notice the `log` keyword, BusyBox `ntpd` uses `stderr` for logging when
|
||||||
run in the foreground. With `log` Finit redirects `stdout` + `stderr`
|
run in the foreground. With `log` Finit redirects `stdout` + `stderr`
|
||||||
@@ -150,7 +156,7 @@ to the system log daemon using the command line `logger(1)` tool.
|
|||||||
A service, or task, can have multiple dependencies listed. Here we wait
|
A service, or task, can have multiple dependencies listed. Here we wait
|
||||||
for *both* `syslogd` to have started and basic networking to be up:
|
for *both* `syslogd` to have started and basic networking to be up:
|
||||||
|
|
||||||
service [2345] log <svc/sbin/syslogd,net/route/default> /usr/sbin/ntpd -n -N -p pool.ntp.org
|
service [2345] log <pid/syslogd,net/route/default> ntpd -n -N -p pool.ntp.org
|
||||||
|
|
||||||
If either condition fails, e.g. loss of networking, `ntpd` is stopped
|
If either condition fails, e.g. loss of networking, `ntpd` is stopped
|
||||||
and as soon as it comes back up again `ntpd` is restarted automatically.
|
and as soon as it comes back up again `ntpd` is restarted automatically.
|
||||||
@@ -169,26 +175,6 @@ Features
|
|||||||
Start, monitor and restart services should they fail.
|
Start, monitor and restart services should they fail.
|
||||||
|
|
||||||
|
|
||||||
**Inetd**
|
|
||||||
|
|
||||||
Finit comes with a built-in [inetd server](doc/inetd.md). No need to
|
|
||||||
maintain a separate config file for services that you want to start on
|
|
||||||
demand.
|
|
||||||
|
|
||||||
All inetd services started can be filtered per port and inbound
|
|
||||||
interface, reducing the need for a full blown firewall.
|
|
||||||
|
|
||||||
Built-in optional inetd services:
|
|
||||||
|
|
||||||
- echo [RFC862][]
|
|
||||||
- chargen [RFC864][]
|
|
||||||
- daytime [RFC867][]
|
|
||||||
- discard [RFC863][]
|
|
||||||
- time (rdate) [RFC868][]
|
|
||||||
|
|
||||||
For more information, see [doc/inetd.md](doc/inetd.md).
|
|
||||||
|
|
||||||
|
|
||||||
**Getty**
|
**Getty**
|
||||||
|
|
||||||
Finit supports external getty but also comes with a limited built-in
|
Finit supports external getty but also comes with a limited built-in
|
||||||
@@ -220,7 +206,7 @@ see [doc/config.md](doc/config.md#syntax).
|
|||||||
|
|
||||||
Support for SysV init-style [runlevels][5] is available, in the same
|
Support for SysV init-style [runlevels][5] is available, in the same
|
||||||
minimal style as everything else in Finit. The `[2345]` syntax can be
|
minimal style as everything else in Finit. The `[2345]` syntax can be
|
||||||
applied to service, task, run, inetd, and TTY stanzas.
|
applied to service, task, run, and TTY stanzas.
|
||||||
|
|
||||||
Reserved runlevels are 0 and 6, halt and reboot, respectively just like
|
Reserved runlevels are 0 and 6, halt and reboot, respectively just like
|
||||||
SysV init. Runlevel 1 can be configured freely, but is recommended to
|
SysV init. Runlevel 1 can be configured freely, but is recommended to
|
||||||
@@ -250,9 +236,6 @@ Capabilities:
|
|||||||
Hook into the boot at predefined points to extend Finit
|
Hook into the boot at predefined points to extend Finit
|
||||||
- **I/O**
|
- **I/O**
|
||||||
Listen to external events and control Finit behavior/services
|
Listen to external events and control Finit behavior/services
|
||||||
- **Inetd**
|
|
||||||
Extend Finit with internal inetd services, for an example, see
|
|
||||||
`plugins/time.c`
|
|
||||||
|
|
||||||
Extensions and functionality not purely related to what an `/sbin/init`
|
Extensions and functionality not purely related to what an `/sbin/init`
|
||||||
needs to start a system are available as a set of plugins that either
|
needs to start a system are available as a set of plugins that either
|
||||||
@@ -261,32 +244,16 @@ hook into the boot process or respond to various I/O.
|
|||||||
For more information, see [doc/plugins.md](doc/plugins.md).
|
For more information, see [doc/plugins.md](doc/plugins.md).
|
||||||
|
|
||||||
|
|
||||||
**Progress**
|
|
||||||
|
|
||||||
Finit prior to v3.0 showed the progress at boot: plugins and modules
|
|
||||||
being loaded, run/tasks/services being started, etc. By default Finit
|
|
||||||
is now silent, but progress can still be enabled at build-time using:
|
|
||||||
|
|
||||||
configure --enable-progress
|
|
||||||
|
|
||||||
or at boot from the kernel cmdline using the boot parameter `splash`:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
append="init=/sbin/finit splash"
|
|
||||||
```
|
|
||||||
|
|
||||||
For a really nice boot, add `quiet` as well. This silences the output
|
|
||||||
from the kernel, leaving only warnings and errors. For other kernel
|
|
||||||
command line parameters, see [doc/build.md](doc/build.md#recovery).
|
|
||||||
|
|
||||||
|
|
||||||
**Automatic Reload**
|
**Automatic Reload**
|
||||||
|
|
||||||
By default, Finit monitors `/etc/finit.d/` and `/etc/finit.d/enabled/`
|
By default, Finit monitors `/etc/finit.d/` and `/etc/finit.d/enabled/`
|
||||||
registering any changes to `.conf` files. To activate a change the user
|
registering any changes to `.conf` files. To activate a change the user
|
||||||
must call `initctl reload`, which reloads all modified files, stops any
|
must call `initctl reload`, which reloads all modified files, stops any
|
||||||
removed services, starts new ones, and restarts any modified ones, with
|
removed services, starts new ones, and restarts any modified ones. If the
|
||||||
SIGHUP if the process supports it.
|
command line arguments of a service have changed, the process will be
|
||||||
|
terminated and then started again with the updated arguments. If the arguments
|
||||||
|
have not been modified and the process supports SIGHUP, the process will
|
||||||
|
receive a SIGHUP rather than being terminated and started.
|
||||||
|
|
||||||
For some use-cases the extra step of calling `initctl reload` creates an
|
For some use-cases the extra step of calling `initctl reload` creates an
|
||||||
unnecessary overhead, which can be removed at build-time using:
|
unnecessary overhead, which can be removed at build-time using:
|
||||||
@@ -294,6 +261,46 @@ unnecessary overhead, which can be removed at build-time using:
|
|||||||
configure --enable-auto-reload
|
configure --enable-auto-reload
|
||||||
|
|
||||||
|
|
||||||
|
**Cgroups**
|
||||||
|
|
||||||
|
Finit supports cgroups v2 and comes with the following default groups
|
||||||
|
in which services and user sessions are placed in:
|
||||||
|
|
||||||
|
/sys/fs/cgroup
|
||||||
|
|-- init/ # cpu.weight:100
|
||||||
|
|-- system/ # cpu.weight:9800
|
||||||
|
`-- user/ # cpu.weight:100
|
||||||
|
|
||||||
|
Finit itself and its helper scripts and services are placed in the
|
||||||
|
top-level leaf-node group `init/`, which also is _reserved_.
|
||||||
|
|
||||||
|
All run/task/service/sysv processes are placed in their own sub-group
|
||||||
|
in `system/`. The name of each sub-group is taken from the respective
|
||||||
|
`.conf` file from `/etc/finit.d`.
|
||||||
|
|
||||||
|
All getty/tty processes are placed in their own sub-group in `user/`.
|
||||||
|
The name of each sub-group is taken from the username.
|
||||||
|
|
||||||
|
A fourth group also exists, the `root` group. It is also _reserved_ and
|
||||||
|
primarily intended for RT tasks. If you have RT tasks they need to be
|
||||||
|
declared as such in their service stanza like this:
|
||||||
|
|
||||||
|
service [...] <...> cgroup.root /path/to/foo args -- description
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
cgroup.root
|
||||||
|
service [...] <...> /path/to/foo args -- description
|
||||||
|
service [...] <...> /path/to/bar args -- description
|
||||||
|
|
||||||
|
See [doc/config.md](doc/config.md#cgroups) for more information, e.g.,
|
||||||
|
how to configure per-group limits.
|
||||||
|
|
||||||
|
The `initctl` tool has three commands to help debug and optimize the
|
||||||
|
setup and monitoring of cgroups. See the `ps`, `top`, and `cgroup`
|
||||||
|
commands for details.
|
||||||
|
|
||||||
|
|
||||||
Runparts & /etc/rc.local
|
Runparts & /etc/rc.local
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
@@ -335,10 +342,10 @@ To specify an allowed set of runlevels for a `service`, `run` command,
|
|||||||
`task`, or `tty`, add `[NNN]` to your `/etc/finit.conf`, like this:
|
`task`, or `tty`, add `[NNN]` to your `/etc/finit.conf`, like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
service [S12345] /sbin/syslogd -n -x -- System log daemon
|
service [S12345] syslogd -n -x -- System log daemon
|
||||||
run [S] /etc/init.d/acpid start -- Starting ACPI Daemon
|
run [S] /etc/init.d/acpid start -- Starting ACPI Daemon
|
||||||
task [S] /etc/init.d/kbd start -- Preparing console
|
task [S] /etc/init.d/kbd start -- Preparing console
|
||||||
service [S12345] /sbin/klogd -n -x -- Kernel log daemon
|
service [S12345] <pid/syslogd> klogd -n -x -- Kernel log daemon
|
||||||
|
|
||||||
tty [12345] /dev/tty1
|
tty [12345] /dev/tty1
|
||||||
tty [2] /dev/tty2
|
tty [2] /dev/tty2
|
||||||
@@ -385,50 +392,34 @@ Rebooting & Halting
|
|||||||
|
|
||||||
Traditionally, rebooting and halting a UNIX system is done by changing
|
Traditionally, rebooting and halting a UNIX system is done by changing
|
||||||
its runlevel. Finit comes with its own tooling providing: `shutdown`,
|
its runlevel. Finit comes with its own tooling providing: `shutdown`,
|
||||||
`reboot`, `poweroff`, and `suspend`, but also the traditional `init` and
|
`reboot`, `poweroff`, and `suspend`, but also the `initctl` tool,
|
||||||
`telinit`, as well as a more modern `initctl` tool, detailed in the next
|
detailed in the next section.
|
||||||
section.
|
|
||||||
|
|
||||||
For compatibility reasons Finit listens to the same set of signals as
|
For compatibility reasons Finit listens to the same set of signals as
|
||||||
BusyBox init. This is not 100% compatible with SysV init, but clearly
|
BusyBox init. This is not 100% compatible with SysV init, but clearly
|
||||||
the more common combination for Finit. For more details, see
|
the more common combination for Finit. For more details, see
|
||||||
[doc/signals.md](doc/signals.md).
|
[doc/signals.md](doc/signals.md).
|
||||||
|
|
||||||
Finit also listens to the classic SysV init FIFO, used by `telinit`.
|
|
||||||
Support for this is implemented by the `initctl.so` plugin. Hence,
|
|
||||||
`telinit q` will work as the UNIX beards intended.
|
|
||||||
|
|
||||||
```shell
|
|
||||||
~ # telinit -h
|
|
||||||
Usage: telinit [OPTIONS] [q | Q | 0-9]
|
|
||||||
|
|
||||||
Options:
|
|
||||||
-h, --help This help text
|
|
||||||
-V, --version Show Finit version
|
|
||||||
|
|
||||||
Commands:
|
|
||||||
0 Power-off the system, same as initctl poweroff
|
|
||||||
6 Reboot the system, same as initctl reboot
|
|
||||||
2, 3, 4, 5 Change runlevel. Starts services in new runlevel, stops any
|
|
||||||
services in prev. runlevel that are not allowed in new.
|
|
||||||
q, Q Reload *.conf in /etc/finit.d/, same as initctl reload or
|
|
||||||
sending SIGHUP to PID 1
|
|
||||||
1, s, S Enter system rescue mode, runlevel 1
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Commands & Status
|
Commands & Status
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
Finit also implements a more modern API to query status, and start/stop
|
Finit also implements a modern API to query status, and start/stop
|
||||||
services, called `initctl`. Unlike `telinit` the `initctl` tool does
|
services, called `initctl`. Unlike `telinit` the `initctl` tool does
|
||||||
not return until the given command has fully completed.
|
not return until the given command has fully completed.
|
||||||
|
|
||||||
```shell
|
```
|
||||||
~ $ initctl -h
|
alpine:~# initctl help
|
||||||
Usage: initctl [OPTIONS] [COMMAND]
|
Usage: initctl [OPTIONS] [COMMAND]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
-b, --batch Batch mode, no screen size probing
|
||||||
|
-c, --create Create missing paths (and files) as needed
|
||||||
|
-f, --force Ignore missing files and arguments, never prompt
|
||||||
|
-1, --once Only one lap in commands like 'top'
|
||||||
|
-p, --plain Use plain table headings, no ctrl chars
|
||||||
|
-q, --quiet Silent, only return status of command
|
||||||
|
-t, --no-heading Skip table headings
|
||||||
-v, --verbose Verbose output
|
-v, --verbose Verbose output
|
||||||
-h, --help This help text
|
-h, --help This help text
|
||||||
|
|
||||||
@@ -436,29 +427,42 @@ Commands:
|
|||||||
debug Toggle Finit (daemon) debug
|
debug Toggle Finit (daemon) debug
|
||||||
help This help text
|
help This help text
|
||||||
version Show Finit version
|
version Show Finit version
|
||||||
|
|
||||||
list List all .conf in /etc/finit.d/
|
ls | list List all .conf in /etc/finit.d
|
||||||
enable <CONF> Enable .conf in /etc/finit.d/available/
|
create <CONF> Create .conf in /etc/finit.d/available
|
||||||
disable <CONF> Disable .conf in /etc/finit.d/[enabled/]
|
delete <CONF> Delete .conf in /etc/finit.d/available
|
||||||
touch <CONF> Mark .conf in /etc/finit.d/ for reload
|
show <CONF> Show .conf in /etc/finit.d/available
|
||||||
reload Reload *.conf in /etc/finit.d/ (activates changes)
|
edit <CONF> Edit .conf in /etc/finit.d/available
|
||||||
|
touch <CONF> Change .conf in /etc/finit.d/available
|
||||||
cond show Show condition status
|
enable <CONF> Enable .conf in /etc/finit.d/available
|
||||||
|
disable <CONF> Disable .conf in /etc/finit.d/enabled
|
||||||
|
reload Reload *.conf in /etc/finit.d (activate changes)
|
||||||
|
|
||||||
|
cond set <COND> Set (assert) user-defined condition +usr/COND
|
||||||
|
cond clear <COND> Clear (deassert) user-defined condition -usr/COND
|
||||||
|
cond status Show condition status, default cond command
|
||||||
cond dump Dump all conditions and their status
|
cond dump Dump all conditions and their status
|
||||||
|
|
||||||
log [NAME] Show ten last Finit, or NAME, messages from syslog
|
log [NAME] Show ten last Finit, or NAME, messages from syslog
|
||||||
start <JOB|NAME>[:ID] Start service by job# or name, with optional ID
|
start <NAME>[:ID] Start service by name, with optional ID
|
||||||
stop <JOB|NAME>[:ID] Stop/Pause a running service by job# or name
|
stop <NAME>[:ID] Stop/Pause a running service by name
|
||||||
restart <JOB|NAME>[:ID] Restart (stop/start) service by job# or name
|
reload <NAME>[:ID] Reload service by name (SIGHUP or restart)
|
||||||
status <JOB|NAME>[:ID] Show service status, by job# or name
|
restart <NAME>[:ID] Restart (stop/start) service by name
|
||||||
status | show Show status of services, default command
|
status <NAME>[:ID] Show service status, by name
|
||||||
|
status Show status of services, default command
|
||||||
|
|
||||||
|
cgroup List cgroup config overview
|
||||||
|
ps List processes based on cgroups
|
||||||
|
top Show top-like listing based on cgroups
|
||||||
|
|
||||||
runlevel [0-9] Show or set runlevel: 0 halt, 6 reboot
|
runlevel [0-9] Show or set runlevel: 0 halt, 6 reboot
|
||||||
reboot Reboot system
|
reboot Reboot system
|
||||||
halt Halt system
|
halt Halt system
|
||||||
poweroff Halt and power off system
|
poweroff Halt and power off system
|
||||||
|
suspend Suspend system
|
||||||
utmp show Raw dump of UTMP/WTMP db
|
|
||||||
|
Bug report address: https://github.com/troglobit/finit/issues
|
||||||
|
Project homepage: https://troglobit.com/finit.html
|
||||||
```
|
```
|
||||||
|
|
||||||
For services *not* supporting `SIGHUP` the `<!>` notation in the .conf
|
For services *not* supporting `SIGHUP` the `<!>` notation in the .conf
|
||||||
@@ -466,22 +470,73 @@ file must be used to tell Finit to stop and start it on `reload` and
|
|||||||
`runlevel` changes. If `<>` holds more [conditions](doc/conditions.md),
|
`runlevel` changes. If `<>` holds more [conditions](doc/conditions.md),
|
||||||
these will also affect how a service is maintained.
|
these will also affect how a service is maintained.
|
||||||
|
|
||||||
**Note:** even though it is possible to start services not belonging in
|
> **Note:** even though it is possible to start services not belonging in
|
||||||
the current runlevel these services will not be respawned automatically
|
> the current runlevel these services will not be respawned automatically
|
||||||
by Finit if they exit (crash). Hence, if the runlevel is 2, the below
|
> by Finit if they exit (crash). Hence, if the runlevel is 2, the below
|
||||||
Dropbear SSH service will not be restarted if it is killed or exits.
|
> Dropbear SSH service will not be restarted if it is killed or exits.
|
||||||
|
|
||||||
```shell
|
The `status` command is the default, it displays a quick overview of all
|
||||||
~ $ initctl status -v
|
monitored run/task/services. Here we call `initctl -p`, suitable for
|
||||||
1 running 476 [S12345] /sbin/watchdog -T 16 -t 2 -F /dev/watchdog
|
scripting and documentation:
|
||||||
2 running 477 [S12345] /sbin/syslogd -n -b 3 -D
|
|
||||||
3 running 478 [S12345] /sbin/klogd -n
|
```
|
||||||
4:1 inetd 0 [2345] internal time allow *:37,!eth0
|
alpine:~# initctl -p
|
||||||
4:2 inetd 0 [2345] internal time allow eth0:3737
|
PID IDENT STATUS RUNLEVELS DESCRIPTION
|
||||||
5:1 inetd 0 [2345] /sbin/telnetd allow *:23 deny eth0,eth1
|
======================================================================
|
||||||
5:2 inetd 0 [2345] /sbin/telnetd allow eth0:2323,eth2:2323,eth1:2323
|
1506 acpid running [--2345----] ACPI daemon
|
||||||
6:1 inetd 0 [345] /sbin/dropbear allow eth0:222
|
1509 crond running [--2345----] Cron daemon
|
||||||
6:2 inetd 0 [345] /sbin/dropbear allow *:22 deny eth0
|
1489 dropbear running [--2345----] Dropbear SSH daemon
|
||||||
|
1511 klogd running [S12345----] Kernel log daemon
|
||||||
|
1512 ntpd running [--2345----] NTP daemon
|
||||||
|
1473 syslogd running [S12345----] Syslog daemon
|
||||||
|
|
||||||
|
alpine:~# initctl -pv
|
||||||
|
PID IDENT STATUS RUNLEVELS COMMAND
|
||||||
|
======================================================================
|
||||||
|
1506 acpid running [--2345----] acpid -f
|
||||||
|
1509 crond running [--2345----] crond -f -S $CRON_OPTS
|
||||||
|
1489 dropbear running [--2345----] dropbear -R -F $DROPBEAR_OPTS
|
||||||
|
1511 klogd running [S12345----] klogd -n $KLOGD_OPTS
|
||||||
|
1512 ntpd running [--2345----] ntpd -n $NTPD_OPTS
|
||||||
|
1473 syslogd running [S12345----] syslogd -n
|
||||||
|
```
|
||||||
|
|
||||||
|
The environment variables to each of the services above are read from,
|
||||||
|
in the case of Alpine Linux, `/etc/conf.d/`. Other distributions may
|
||||||
|
have other directories, e.g., Debian use `/etc/default/`.
|
||||||
|
|
||||||
|
The `status` command takes an optional `NAME:ID` argument. Here we
|
||||||
|
check the status of `dropbear`, which only has one instance in this
|
||||||
|
system:
|
||||||
|
|
||||||
|
```
|
||||||
|
alpine:~# initctl -p status dropbear
|
||||||
|
Status : running
|
||||||
|
Identity : dropbear
|
||||||
|
Description : Dropbear SSH daemon
|
||||||
|
Origin : /etc/finit.d/enabled/dropbear.conf
|
||||||
|
Environment : -/etc/conf.d/dropbear
|
||||||
|
Condition(s):
|
||||||
|
Command : dropbear -R -F $DROPBEAR_OPTS
|
||||||
|
PID file : !/run/dropbear.pid
|
||||||
|
PID : 1485
|
||||||
|
User : root
|
||||||
|
Group : root
|
||||||
|
Uptime : 2 hour 46 min 56 sec
|
||||||
|
Runlevels : [--2345----]
|
||||||
|
Memory : 1.2M
|
||||||
|
CGroup : /system/dropbear cpu 0 [100, max] mem [--.--, max]
|
||||||
|
|- 1485 dropbear -R -F
|
||||||
|
|- 2634 dropbear -R -F
|
||||||
|
|- 2635 ash
|
||||||
|
`- 2652 initctl -p status dropbear
|
||||||
|
|
||||||
|
Apr 8 12:19:49 alpine authpriv.info dropbear[1485]: Not backgrounding
|
||||||
|
Apr 8 12:37:45 alpine authpriv.info dropbear[2300]: Child connection from 192.168.121.1:47834
|
||||||
|
Apr 8 12:37:46 alpine authpriv.notice dropbear[2300]: Password auth succeeded for 'root' from 192.168.121.1:47834
|
||||||
|
Apr 8 12:37:46 alpine authpriv.info dropbear[2300]: Exit (root) from <192.168.121.1:47834>: Disconnect received
|
||||||
|
Apr 8 15:02:11 alpine authpriv.info dropbear[2634]: Child connection from 192.168.121.1:48576
|
||||||
|
Apr 8 15:02:12 alpine authpriv.notice dropbear[2634]: Password auth succeeded for 'root' from 192.168.121.1:48576
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -502,7 +557,7 @@ done slightly differently and on systems with udev you might want to add
|
|||||||
the following one-shot task early in your `/etc/finit.conf`:
|
the following one-shot task early in your `/etc/finit.conf`:
|
||||||
|
|
||||||
```conf
|
```conf
|
||||||
run [S] /sbin/udevadm settle --timeout=120 -- Waiting for udev
|
run [S] udevadm settle --timeout=120 -- Waiting for udev
|
||||||
```
|
```
|
||||||
|
|
||||||
Finit has a built-in Getty for TTYs, but requires a working `/bin/login`
|
Finit has a built-in Getty for TTYs, but requires a working `/bin/login`
|
||||||
@@ -511,9 +566,6 @@ or `/bin/sh`, if no TTYs are configured in `/etc/finit.conf`.
|
|||||||
For a fully operational system `/var`, `/run` and `/tmp` must be set up
|
For a fully operational system `/var`, `/run` and `/tmp` must be set up
|
||||||
properly in `/etc/fstab` -- which is iterated over at boot.
|
properly in `/etc/fstab` -- which is iterated over at boot.
|
||||||
|
|
||||||
The built-in Inetd requires `/etc/services` and `/etc/protocols` to work
|
|
||||||
with port names rather than numbers.
|
|
||||||
|
|
||||||
|
|
||||||
Origin & References
|
Origin & References
|
||||||
-------------------
|
-------------------
|
||||||
@@ -522,7 +574,7 @@ This project is based on the [original finit][] by [Claudio Matsuoka][]
|
|||||||
which was reverse engineered from syscalls of the [EeePC fastinit][] —
|
which was reverse engineered from syscalls of the [EeePC fastinit][] —
|
||||||
"gaps filled with frog DNA …"
|
"gaps filled with frog DNA …"
|
||||||
|
|
||||||
Finit is developed and maintained by [Joachim Nilsson][] at [GitHub][].
|
Finit is developed and maintained by [Joachim Wiberg][] at [GitHub][].
|
||||||
Please file bug reports, clone it, or send pull requests for bug fixes
|
Please file bug reports, clone it, or send pull requests for bug fixes
|
||||||
and proposed extensions.
|
and proposed extensions.
|
||||||
|
|
||||||
@@ -547,11 +599,11 @@ and proposed extensions.
|
|||||||
[original finit]: http://helllabs.org/finit/
|
[original finit]: http://helllabs.org/finit/
|
||||||
[EeePC fastinit]: https://web.archive.org/web/20071208212450/http://wiki.eeeuser.com/boot_process:the_boot_process
|
[EeePC fastinit]: https://web.archive.org/web/20071208212450/http://wiki.eeeuser.com/boot_process:the_boot_process
|
||||||
[Claudio Matsuoka]: https://github.com/cmatsuoka
|
[Claudio Matsuoka]: https://github.com/cmatsuoka
|
||||||
[Joachim Nilsson]: http://troglobit.com
|
[Joachim Wiberg]: http://troglobit.com
|
||||||
[GitHub]: https://github.com/troglobit/finit
|
[GitHub]: https://github.com/troglobit/finit
|
||||||
[License]: https://en.wikipedia.org/wiki/MIT_License
|
[License]: https://en.wikipedia.org/wiki/MIT_License
|
||||||
[License Badge]: https://img.shields.io/badge/License-MIT-teal.svg
|
[License Badge]: https://img.shields.io/badge/License-MIT-teal.svg
|
||||||
[Travis]: https://travis-ci.org/troglobit/finit
|
[Travis]: https://travis-ci.org/troglobit/finit
|
||||||
[Travis Status]: https://travis-ci.org/troglobit/finit.png?branch=master
|
[Travis Status]: https://travis-ci.org/troglobit/finit.svg?branch=master
|
||||||
[Coverity Scan]: https://scan.coverity.com/projects/3545
|
[Coverity Scan]: https://scan.coverity.com/projects/3545
|
||||||
[Coverity Status]: https://scan.coverity.com/projects/3545/badge.svg
|
[Coverity Status]: https://scan.coverity.com/projects/3545/badge.svg
|
||||||
|
|||||||
+53
-113
@@ -1,5 +1,6 @@
|
|||||||
AC_INIT(Finit, 3.2-rc3, https://github.com/troglobit/finit/issues, finit, https://troglobit.com/finit.html)
|
AC_INIT(Finit, 4.0, https://github.com/troglobit/finit/issues, finit, https://troglobit.com/finit.html)
|
||||||
AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz subdir-objects])
|
AC_CONFIG_AUX_DIR(aux)
|
||||||
|
AM_INIT_AUTOMAKE([1.11 foreign dist-xz subdir-objects])
|
||||||
AM_SILENT_RULES([yes])
|
AM_SILENT_RULES([yes])
|
||||||
|
|
||||||
AC_CONFIG_SRCDIR([src/finit.c])
|
AC_CONFIG_SRCDIR([src/finit.c])
|
||||||
@@ -11,16 +12,15 @@ AC_CONFIG_FILES([Makefile
|
|||||||
contrib/void/Makefile contrib/void/finit.d/Makefile contrib/void/finit.d/available/Makefile
|
contrib/void/Makefile contrib/void/finit.d/Makefile contrib/void/finit.d/available/Makefile
|
||||||
doc/Makefile
|
doc/Makefile
|
||||||
plugins/Makefile
|
plugins/Makefile
|
||||||
src/Makefile])
|
src/Makefile
|
||||||
|
test/test.env
|
||||||
|
test/Makefile])
|
||||||
|
|
||||||
# Older versions of autoconf (<2.58) do not have AC_CONFIG_MACRO_DIR()
|
# Older versions of autoconf (<2.58) do not have AC_CONFIG_MACRO_DIR()
|
||||||
#m4_include([m4/plugin.m4])
|
#m4_include([m4/plugin.m4])
|
||||||
#m4_include([m4/expand.m4])
|
#m4_include([m4/expand.m4])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
|
||||||
# Change default prefix, we're PID 1 after all ...
|
|
||||||
AC_PREFIX_DEFAULT([])
|
|
||||||
|
|
||||||
# Handle building plugins either as dynamically loadable, or built-in
|
# Handle building plugins either as dynamically loadable, or built-in
|
||||||
LT_INIT([shared disable-static dlopen aix-soname=both disable-fast-install])
|
LT_INIT([shared disable-static dlopen aix-soname=both disable-fast-install])
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ AC_PROG_MKDIR_P
|
|||||||
|
|
||||||
# Configuration.
|
# Configuration.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_CHECK_HEADERS([fstaby.h termios.h])
|
AC_CHECK_HEADERS([fstaby.h termios.h sys/ioctl.h])
|
||||||
AC_CHECK_FUNCS([strstr getopt getfsenty])
|
AC_CHECK_FUNCS([strstr getopt getfsenty])
|
||||||
|
|
||||||
# Check for uint[8,16,32]_t
|
# Check for uint[8,16,32]_t
|
||||||
@@ -45,45 +45,16 @@ PKG_PROG_PKG_CONFIG
|
|||||||
|
|
||||||
# Check for required libraries
|
# Check for required libraries
|
||||||
PKG_CHECK_MODULES([uev], [libuev >= 2.2.0])
|
PKG_CHECK_MODULES([uev], [libuev >= 2.2.0])
|
||||||
PKG_CHECK_MODULES([lite], [libite >= 2.0.1])
|
PKG_CHECK_MODULES([lite], [libite >= 2.2.0])
|
||||||
|
|
||||||
# Check for configured Finit features
|
# Check for configured Finit features
|
||||||
AC_ARG_ENABLE(emergency_shell,
|
|
||||||
AS_HELP_STRING([--enable-emergency-shell], [Experimental emergency fallback at boot.
|
|
||||||
Use only for debugging very early boot problems with Finit]),,[
|
|
||||||
enable_emergency_shell=no])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(fallback_shell,
|
|
||||||
AS_HELP_STRING([--enable-fallback-shell], [Start a shell if no TTYs can start]),,[
|
|
||||||
enable_fallback_shell=no])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(auto_reload,
|
AC_ARG_ENABLE(auto_reload,
|
||||||
AS_HELP_STRING([--enable-auto-reload], [Automatic reload on any .conf change]),,[
|
AS_HELP_STRING([--enable-auto-reload], [Automatic reload on any .conf change]),,[
|
||||||
enable_auto_reload=no])
|
enable_auto_reload=no])
|
||||||
|
|
||||||
AC_ARG_ENABLE(progress,
|
|
||||||
AS_HELP_STRING([--enable-progress], [Modern progress display at bootup]),,[
|
|
||||||
enable_progress=no])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(progress-classic,
|
|
||||||
AS_HELP_STRING([--enable-progress-classic], [Pre Finit v3 bootup progress and heading]),,[
|
|
||||||
enable_progress_classic=no])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(watchdog,
|
|
||||||
AS_HELP_STRING([--enable-watchdog], [Enable built-in watchdog, uses /dev/watchdog]),,[
|
|
||||||
enable_watchdog=no])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(redirect,
|
AC_ARG_ENABLE(redirect,
|
||||||
AS_HELP_STRING([--enable-redirect], [Redirect service output to /dev/null, default: no]),,[
|
AS_HELP_STRING([--disable-redirect], [Disable redirection of service output to /dev/null]),,[
|
||||||
enable_redirect_output=no])
|
enable_redirect=yes])
|
||||||
|
|
||||||
AC_ARG_ENABLE(inetd,
|
|
||||||
AS_HELP_STRING([--disable-inetd], [Disable built-in inetd super server, default enabled]),,[
|
|
||||||
enable_inetd=yes])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(logit,
|
|
||||||
AS_HELP_STRING([--disable-logit], [Disable logit, used for log redirection, default: enable]),,[
|
|
||||||
enable_logit=yes])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(logrotate,
|
AC_ARG_ENABLE(logrotate,
|
||||||
AS_HELP_STRING([--disable-logrotate], [Disable built-in rotation of /var/log/wtmp, default enabled]),,[
|
AS_HELP_STRING([--disable-logrotate], [Disable built-in rotation of /var/log/wtmp, default enabled]),,[
|
||||||
@@ -101,113 +72,78 @@ AC_ARG_ENABLE(contrib,
|
|||||||
enable_all_plugins=auto
|
enable_all_plugins=auto
|
||||||
AC_PLUGIN([alsa-utils], [no], [Save and restore ALSA sound settings using alsactl])
|
AC_PLUGIN([alsa-utils], [no], [Save and restore ALSA sound settings using alsactl])
|
||||||
AC_PLUGIN([dbus], [no], [Setup and start system message bus, D-Bus])
|
AC_PLUGIN([dbus], [no], [Setup and start system message bus, D-Bus])
|
||||||
AC_PLUGIN([inetd-echo], [no], [Inetd plugin: echo server, RFC862])
|
|
||||||
AC_PLUGIN([inetd-chargen], [no], [Inetd plugin: character generator, RFC864])
|
|
||||||
AC_PLUGIN([inetd-daytime], [no], [Inetd plugin: daytime server, RFC867])
|
|
||||||
AC_PLUGIN([inetd-discard], [no], [Inetd plugin: discard server, RFC863])
|
|
||||||
AC_PLUGIN([inetd-time], [no], [Inetd plugin: time (rdate) server, RFC868])
|
|
||||||
AC_PLUGIN([modules-load], [no], [Scans /etc/modules-load.d for modules to load])
|
AC_PLUGIN([modules-load], [no], [Scans /etc/modules-load.d for modules to load])
|
||||||
AC_PLUGIN([resolvconf], [no], [Setup necessary files for resolvconf])
|
AC_PLUGIN([resolvconf], [no], [Setup necessary files for resolvconf])
|
||||||
AC_PLUGIN([x11-common], [no], [Console setup (for X)])
|
AC_PLUGIN([x11-common], [no], [Console setup (for X)])
|
||||||
AC_PLUGIN([netlink], [yes], [Basic netlink plugin for IFUP/IFDN and GW events. Can be replaced with externally built plugin that links with libnl or similar.])
|
AC_PLUGIN([netlink], [yes], [Basic netlink plugin for IFUP/IFDN and GW events. Can be replaced with externally built plugin that links with libnl or similar.])
|
||||||
|
AC_PLUGIN([hotplug], [yes], [Setup and start udev or mdev hotplug daemon])
|
||||||
|
|
||||||
# Check for extra arguments or packages
|
# Check for extra arguments or packages
|
||||||
AC_ARG_WITH(heading,
|
AC_ARG_WITH(heading,
|
||||||
AS_HELP_STRING([--with-heading=GREET], [Display GREET instead of Finit version at boot]),
|
AS_HELP_STRING([--with-heading=GREET], [Display GREET instead of Finit version at boot]),
|
||||||
[heading=$withval], [heading="$PACKAGE_NAME v$PACKAGE_VERSION"])
|
[heading=$withval], [heading=yes])
|
||||||
|
|
||||||
AC_ARG_WITH(fifo,
|
|
||||||
AS_HELP_STRING([--with-fifo=FIFO], [FIFO for init/telinit clients, default /var/run/initctl]),
|
|
||||||
[fifo=$withval], [fifo=$localstatedir/run/initctl])
|
|
||||||
|
|
||||||
AC_ARG_WITH(config,
|
AC_ARG_WITH(config,
|
||||||
AS_HELP_STRING([--with-config=CONFIG], [Finit bootstrap config file, default /etc/finit.conf]),
|
AS_HELP_STRING([--with-config=CONFIG], [Finit bootstrap config file, default /etc/finit.conf]),
|
||||||
[conf=$withval], [conf=$sysconfdir/finit.conf])
|
[conf=$withval], [conf=yes])
|
||||||
|
|
||||||
AC_ARG_WITH(rcsd,
|
AC_ARG_WITH(rcsd,
|
||||||
AS_HELP_STRING([--with-rcsd=DIR], [Finit rcS.d/ directory, default /etc/finit.d]),
|
AS_HELP_STRING([--with-rcsd=DIR], [Finit rcS.d/ directory, default /etc/finit.d]),
|
||||||
[rcsd=$withval], [rcsd=$sysconfdir/finit.d])
|
[rcsd=$withval], [rcsd=yes])
|
||||||
|
|
||||||
AC_ARG_WITH(rc-local,
|
AC_ARG_WITH(rc-local,
|
||||||
AS_HELP_STRING([--with-rc-local=FILE], [SysV init /etc/rc.local file, default /etc/rc.local]),
|
AS_HELP_STRING([--with-rc-local=FILE], [SysV init /etc/rc.local file, default /etc/rc.local]),
|
||||||
[rclocal=$withval], [rclocal=$sysconfdir/rc.local])
|
[rclocal=$withval], [rclocal=yes])
|
||||||
|
|
||||||
AC_ARG_WITH(console,
|
AC_ARG_WITH(sysconfig,
|
||||||
AS_HELP_STRING([--with-console=DEV], [Console to use, default: /dev/console]),
|
AS_HELP_STRING([--with-sysconfig=DIR], [System environment directory, sourced by .conf files, default /etc/default & /etc/conf.d]),
|
||||||
[console=$withval], [console=/dev/console])
|
[sysconfig=$withval], [sysconfig=default])
|
||||||
|
|
||||||
AC_ARG_WITH(hostname,
|
AC_ARG_WITH(hostname,
|
||||||
AS_HELP_STRING([--with-hostname=NAME], [If /etc/hostname is missing, default: noname]),
|
AS_HELP_STRING([--with-hostname=NAME], [If /etc/hostname is missing, default: noname]),
|
||||||
[hostname=$withval], [hostname=noname])
|
[hostname=$withval], [hostname=yes])
|
||||||
|
|
||||||
AC_ARG_WITH(runlevel,
|
AC_ARG_WITH(runlevel,
|
||||||
AS_HELP_STRING([--with-runlevel=N], [Runlevel to switch to after bootstrap, default: 2]),
|
AS_HELP_STRING([--with-runlevel=N], [Runlevel to switch to after bootstrap, default: 2]),
|
||||||
[runlevel=$withval], [runlevel=2])
|
[runlevel=$withval], [runlevel=yes])
|
||||||
|
|
||||||
AC_ARG_WITH(random-seed,
|
AC_ARG_WITH(random-seed,
|
||||||
AS_HELP_STRING([--with-random-seed=FILE], [Save a random seed for /dev/urandom across reboots, default /var/lib/misc/random-seed]),
|
AS_HELP_STRING([--with-random-seed=FILE], [Save a random seed for /dev/urandom across reboots, default /var/lib/misc/random-seed]),
|
||||||
[random_seed=$withval], [random_seed=/var/lib/misc/random-seed])
|
[random_seed=$withval], [random_seed=yes])
|
||||||
|
|
||||||
|
AC_ARG_WITH(watchdog,
|
||||||
|
AS_HELP_STRING([--with-watchdog=[DEV]], [Enable built-in watchdog, default: /dev/watchdog]),
|
||||||
|
[watchdog=$withval], [with_watchdog=no watchdog=])
|
||||||
|
|
||||||
### Enable features ###########################################################################
|
### Enable features ###########################################################################
|
||||||
|
|
||||||
# Create config.h from selected features and fallback defautls
|
# Create config.h from selected features and fallback defaults
|
||||||
AS_IF([test "x$enable_emergency_shell" = "xyes"], [
|
|
||||||
AC_DEFINE(EMERGENCY_SHELL, 1, [Fork off init and let PID 1 wait and start /bin/sh if init crashes.])])
|
|
||||||
|
|
||||||
AS_IF([test "x$enable_fallback_shell" = "xyes"], [
|
|
||||||
AC_DEFINE(FALLBACK_SHELL, 1, [Start /bin/sh on console if no TTYs.])])
|
|
||||||
|
|
||||||
AS_IF([test "x$enable_auto_reload" = "xyes"], [
|
AS_IF([test "x$enable_auto_reload" = "xyes"], [
|
||||||
AC_DEFINE(AUTO_RELOAD, 1, [Finit automatically does `initctl reload` on any .conf change])])
|
AC_DEFINE(AUTO_RELOAD, 1, [Finit automatically does `initctl reload` on any .conf change])])
|
||||||
|
|
||||||
AS_IF([test "x$enable_progress" = "xyes"], [
|
|
||||||
AC_DEFINE(PROGRESS_STYLE, 2, [Modern bootup messages, systemd inspired])])
|
|
||||||
|
|
||||||
AS_IF([test "x$enable_progress_classic" = "xyes"], [
|
|
||||||
enable_progress=no
|
|
||||||
AC_DEFINE(PROGRESS_STYLE, 1, [Pre Finit v3 bootup messages and heading])])
|
|
||||||
|
|
||||||
AS_IF([test "x$enable_progress_classic" = "xyes" -o "x$enable_progress" = "xyes"], [
|
|
||||||
AC_DEFINE(SILENT_MODE, 0, [Display bootup progress, see above for style])
|
|
||||||
], [
|
|
||||||
AC_DEFINE(PROGRESS_STYLE, 0, [Default progress style])
|
|
||||||
AC_DEFINE(SILENT_MODE, 1, [Completely silent until login prompt (default)])])
|
|
||||||
|
|
||||||
AS_IF([test "x$enable_watchdog" = "xyes"], [
|
|
||||||
AC_DEFINE(BUILTIN_WATCHDOG, 1, [Enable built-in watchdog, kicks on /dev/watchdog])])
|
|
||||||
|
|
||||||
AS_IF([test "x$enable_redirect" = "xyes"], [
|
AS_IF([test "x$enable_redirect" = "xyes"], [
|
||||||
AC_DEFINE(REDIRECT_OUTPUT, 1, [Enable redirection of service output to /dev/null])])
|
AC_DEFINE(REDIRECT_OUTPUT, 1, [Enable redirection of service output to /dev/null])])
|
||||||
|
|
||||||
### Disable features ###########################################################################
|
### Disable features ###########################################################################
|
||||||
AS_IF([test "x$enable_inetd" != "xno"], [
|
|
||||||
enable_inetd="yes"
|
|
||||||
AC_DEFINE(INETD_ENABLED, 1, [Enable built-in inetd])])
|
|
||||||
|
|
||||||
AS_IF([test "x$enable_logit" != "xno"], [
|
|
||||||
AC_DEFINE(LOGIT_ENABLED, 1, [Enable logit tool, used for log redirection by Finit])])
|
|
||||||
|
|
||||||
AS_IF([test "x$enable_logrotate" != "xno"], [
|
AS_IF([test "x$enable_logrotate" != "xno"], [
|
||||||
AC_DEFINE(LOGROTATE_ENABLED, 1, [Enable built-in rotation of /var/log/wtmp et al.])])
|
AC_DEFINE(LOGROTATE_ENABLED, 1, [Enable built-in rotation of /var/log/wtmp et al.])])
|
||||||
|
|
||||||
### With features ##############################################################################
|
AM_CONDITIONAL(LOGROTATE, [test "x$enable_logrotate" = "xyes"])
|
||||||
AS_IF([test "x$with_fifo" != "xno"], [
|
|
||||||
AS_IF([test "x$fifo" = "xyes"], [
|
|
||||||
fifo='$localstatedir/run/initctl'])])
|
|
||||||
AC_EXPAND_DIR(fifo_path, "$fifo")
|
|
||||||
AC_DEFINE_UNQUOTED(FINIT_FIFO, "$fifo_path", [FIFO for old style init/telinit client programs])
|
|
||||||
|
|
||||||
|
### With features ##############################################################################
|
||||||
AS_IF([test "x$with_config" != "xno"], [
|
AS_IF([test "x$with_config" != "xno"], [
|
||||||
AS_IF([test "x$config" = "xyes"], [
|
AS_IF([test "x$conf" = "xyes"], [
|
||||||
conf=$sysconfdir/finit.conf])])
|
conf=$sysconfdir/finit.conf])])
|
||||||
AC_EXPAND_DIR(conf_path, "$conf")
|
AC_EXPAND_DIR(conf_path, "$conf")
|
||||||
AC_DEFINE_UNQUOTED(FINIT_CONF, "$conf_path", [Main Finit configuration file, default /etc/finit.conf])
|
AC_DEFINE_UNQUOTED(FINIT_CONF, "$conf_path", [Main Finit configuration file, default /etc/finit.conf])
|
||||||
|
AC_SUBST(FINIT_CONF, "$conf_path")
|
||||||
|
|
||||||
AS_IF([test "x$with_rcsd" != "xno"], [
|
AS_IF([test "x$with_rcsd" != "xno"], [
|
||||||
AS_IF([test "x$rcsd" = "xyes"], [
|
AS_IF([test "x$rcsd" = "xyes"], [
|
||||||
rcsd=$sysconfdir/finit.d])])
|
rcsd=$sysconfdir/finit.d])])
|
||||||
AC_EXPAND_DIR(rcsd_path, "$rcsd")
|
AC_EXPAND_DIR(rcsd_path, "$rcsd")
|
||||||
AC_DEFINE_UNQUOTED(FINIT_RCSD, "$rcsd_path", [Finit rcS.d/, default /etc/finit.d])
|
AC_DEFINE_UNQUOTED(FINIT_RCSD, "$rcsd_path", [Finit rcS.d/, default /etc/finit.d])
|
||||||
|
AC_SUBST(FINIT_RCSD, "$rcsd_path")
|
||||||
|
|
||||||
AS_IF([test "x$with_rc_local" != "xno"], [
|
AS_IF([test "x$with_rc_local" != "xno"], [
|
||||||
AS_IF([test "x$rclocal" = "xyes"], [
|
AS_IF([test "x$rclocal" = "xyes"], [
|
||||||
@@ -215,16 +151,17 @@ AS_IF([test "x$with_rc_local" != "xno"], [
|
|||||||
AC_EXPAND_DIR(rclocal_path, "$rclocal")
|
AC_EXPAND_DIR(rclocal_path, "$rclocal")
|
||||||
AC_DEFINE_UNQUOTED(FINIT_RC_LOCAL, "$rclocal_path", [Compat SysV /etc/rc.local file to run last at boot.])
|
AC_DEFINE_UNQUOTED(FINIT_RC_LOCAL, "$rclocal_path", [Compat SysV /etc/rc.local file to run last at boot.])
|
||||||
|
|
||||||
|
AS_IF([test "x$with_sysconfig" != "xno"], [
|
||||||
|
AS_IF([test "x$sysconfig" != "xdefault"], [
|
||||||
|
AC_EXPAND_DIR(sysconfig_path, "$sysconfig")
|
||||||
|
AC_DEFINE_UNQUOTED(FINIT_SYSCONFIG, "$sysconfig_path",
|
||||||
|
[System environment, default /etc/default & /etc/conf.d])])])
|
||||||
|
|
||||||
AS_IF([test "x$with_heading" != "xno"], [
|
AS_IF([test "x$with_heading" != "xno"], [
|
||||||
AS_IF([test "x$heading" = "xyes"], [
|
AS_IF([test "x$heading" = "xyes"], [
|
||||||
heading="$PACKAGE_NAME v$PACKAGE_VERSION"])])
|
heading="$PACKAGE_NAME v$PACKAGE_VERSION"])])
|
||||||
AC_DEFINE_UNQUOTED(INIT_HEADING, "$heading", [Displayed by Finit at boot])
|
AC_DEFINE_UNQUOTED(INIT_HEADING, "$heading", [Displayed by Finit at boot])
|
||||||
|
|
||||||
AS_IF([test "x$with_console" != "xno"], [
|
|
||||||
AS_IF([test "x$console" = "xyes"], [
|
|
||||||
console=/dev/console])])
|
|
||||||
AC_DEFINE_UNQUOTED(CONSOLE, "$console", [Default console to use])
|
|
||||||
|
|
||||||
AS_IF([test "x$with_hostname" != "xno"], [
|
AS_IF([test "x$with_hostname" != "xno"], [
|
||||||
AS_IF([test "x$hostname" = "xyes"], [
|
AS_IF([test "x$hostname" = "xyes"], [
|
||||||
hostname=noname])])
|
hostname=noname])])
|
||||||
@@ -232,7 +169,8 @@ AC_DEFINE_UNQUOTED(DEFHOST, "$hostname", [For /etc/hostname])
|
|||||||
|
|
||||||
AS_IF([test "x$with_runlevel" != "xno"], [
|
AS_IF([test "x$with_runlevel" != "xno"], [
|
||||||
AS_IF([test "x$runlevel" = "xyes"], [
|
AS_IF([test "x$runlevel" = "xyes"], [
|
||||||
AC_DEFINE_UNQUOTED(RUNLEVEL, 2, [Default runlevel to start after S])])
|
runlevel=2
|
||||||
|
AC_DEFINE_UNQUOTED(RUNLEVEL, $runlevel, [Default runlevel to start after S])])
|
||||||
AC_DEFINE_UNQUOTED(RUNLEVEL, $runlevel, [Runlevel to start after S])])
|
AC_DEFINE_UNQUOTED(RUNLEVEL, $runlevel, [Runlevel to start after S])])
|
||||||
|
|
||||||
AS_IF([test "x$with_random_seed" != "xno"], [
|
AS_IF([test "x$with_random_seed" != "xno"], [
|
||||||
@@ -241,11 +179,16 @@ AS_IF([test "x$with_random_seed" != "xno"], [
|
|||||||
AC_EXPAND_DIR(random_path, "$random_seed")
|
AC_EXPAND_DIR(random_path, "$random_seed")
|
||||||
AC_DEFINE_UNQUOTED(RANDOMSEED, "$random_path", [Improve random at boot by seeding it with sth from before.])])
|
AC_DEFINE_UNQUOTED(RANDOMSEED, "$random_path", [Improve random at boot by seeding it with sth from before.])])
|
||||||
|
|
||||||
|
AS_IF([test "x$with_watchdog" != "xno"], [
|
||||||
|
AS_IF([test "x$watchdog" = "xyes"], [
|
||||||
|
watchdog=/dev/watchdog])
|
||||||
|
with_watchdog=yes
|
||||||
|
AC_DEFINE_UNQUOTED(WDT_DEVNODE, "$watchdog", [Built-in watchdog device node])], [
|
||||||
|
watchdog=])
|
||||||
|
|
||||||
# Control build with automake flags
|
# Control build with automake flags
|
||||||
AM_CONDITIONAL(STATIC, [test "x$enable_static" = "xyes"])
|
AM_CONDITIONAL(STATIC, [test "x$enable_static" = "xyes"])
|
||||||
AM_CONDITIONAL(INETD, [test "x$enable_inetd" = "xyes"])
|
AM_CONDITIONAL(WATCHDOGD, [test "x$with_watchdog" != "xno"])
|
||||||
AM_CONDITIONAL(WATCHDOGD, [test "x$enable_watchdog" = "xyes"])
|
|
||||||
AM_CONDITIONAL(LOGIT, [test "x$enable_logit" = "xyes"])
|
|
||||||
AM_CONDITIONAL(DOC, [test "x$enable_doc" = "xyes"])
|
AM_CONDITIONAL(DOC, [test "x$enable_doc" = "xyes"])
|
||||||
AM_CONDITIONAL(CONTRIB, [test "x$enable_contrib" = "xyes"])
|
AM_CONDITIONAL(CONTRIB, [test "x$enable_contrib" = "xyes"])
|
||||||
|
|
||||||
@@ -261,6 +204,8 @@ AC_DEFINE_UNQUOTED(PLUGIN_PATH, "$plugin_path", [Finit plugin path])
|
|||||||
|
|
||||||
AC_EXPAND_DIR(rescue_conf, "$libdir/finit/rescue.conf")
|
AC_EXPAND_DIR(rescue_conf, "$libdir/finit/rescue.conf")
|
||||||
AC_DEFINE_UNQUOTED(RESCUE_CONF, "$rescue_conf", [Finit rescue mode .conf])
|
AC_DEFINE_UNQUOTED(RESCUE_CONF, "$rescue_conf", [Finit rescue mode .conf])
|
||||||
|
AC_EXPAND_DIR(sample_conf, "$libdir/finit/sample.conf")
|
||||||
|
AC_DEFINE_UNQUOTED(SAMPLE_CONF, "$sample_conf", [Finit sameple.conf for initctl create])
|
||||||
|
|
||||||
# Generate all files
|
# Generate all files
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
@@ -270,13 +215,14 @@ cat <<EOF
|
|||||||
------------------ Summary ------------------
|
------------------ Summary ------------------
|
||||||
$PACKAGE_NAME version $PACKAGE_VERSION
|
$PACKAGE_NAME version $PACKAGE_VERSION
|
||||||
Prefix................: $prefix
|
Prefix................: $prefix
|
||||||
|
Exec prefix...........: $eprefix
|
||||||
Sysconfdir............: `eval echo $sysconfdir`
|
Sysconfdir............: `eval echo $sysconfdir`
|
||||||
Localstatedir.........: `eval echo $localstatedir`
|
Localstatedir.........: `eval echo $localstatedir`
|
||||||
FIFO path.............: $fifo_path
|
|
||||||
Finit config file.....: $conf_path
|
Finit config file.....: $conf_path
|
||||||
Finit config.d path...: $rcsd_path
|
Finit config.d path...: $rcsd_path
|
||||||
Finit plugin path.....: $plugin_path
|
Finit plugin path.....: $plugin_path
|
||||||
Compat rc.local path..: $rclocal_path
|
Compat rc.local path..: $rclocal_path
|
||||||
|
System environment....: ${sysconfig_path:-${sysconfig}}
|
||||||
Random seed path......: $random_path
|
Random seed path......: $random_path
|
||||||
C Compiler............: $CC $CFLAGS $CPPFLAGS $LDFLAGS $LIBS
|
C Compiler............: $CC $CFLAGS $CPPFLAGS $LDFLAGS $LIBS
|
||||||
Linker................: $LD $LLDP_LDFLAGS $LLDP_BIN_LDFLAGS $LDFLAGS $LIBS
|
Linker................: $LD $LLDP_LDFLAGS $LLDP_BIN_LDFLAGS $LDFLAGS $LIBS
|
||||||
@@ -288,15 +234,9 @@ Behavior:
|
|||||||
Optional features:
|
Optional features:
|
||||||
Install doc/..........: $enable_doc
|
Install doc/..........: $enable_doc
|
||||||
Install contrib/......: $enable_contrib
|
Install contrib/......: $enable_contrib
|
||||||
Built-in inetd........: $enable_inetd
|
Built-in watchdogd....: $with_watchdog $watchdog
|
||||||
Built-in watchdogd....: $enable_watchdog
|
|
||||||
Built-in logrotate....: $enable_logrotate
|
Built-in logrotate....: $enable_logrotate
|
||||||
Scripting tool logit..: $enable_logit
|
Redirect output.......: $enable_redirect
|
||||||
Emergency shell.......: $enable_emergency_shell
|
|
||||||
Fallback shell........: $enable_fallback_shell
|
|
||||||
Modern progress.......: $enable_progress
|
|
||||||
Classic progress......: $enable_progress_classic
|
|
||||||
Default console dev...: $console
|
|
||||||
Default hostname......: $hostname
|
Default hostname......: $hostname
|
||||||
Default runlevel......: $runlevel
|
Default runlevel......: $runlevel
|
||||||
|
|
||||||
|
|||||||
@@ -14,12 +14,11 @@ fi
|
|||||||
# The plugins are optional, but you may need D-Bus and X11 if you want
|
# The plugins are optional, but you may need D-Bus and X11 if you want
|
||||||
# to run X-Window, the other configure flags are however required.
|
# to run X-Window, the other configure flags are however required.
|
||||||
PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig ./configure \
|
PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig ./configure \
|
||||||
--enable-progress \
|
--prefix=/usr --exec-prefix= \
|
||||||
--enable-dbus-plugin --enable-x11-common-plugin \
|
--sysconfdir=/etc --localstatedir=/var \
|
||||||
--enable-alsa-utils-plugin --enable-inetd-echo-plugin \
|
--enable-dbus-plugin --enable-x11-common-plugin \
|
||||||
--enable-inetd-chargen-plugin --enable-inetd-daytime-plugin \
|
--enable-alsa-utils-plugin --with-watchdog \
|
||||||
--enable-inetd-discard-plugin --enable-inetd-time-plugin \
|
--with-heading="Alpine Linux 3.13"
|
||||||
--with-heading="Alpine Linux 3.6" --with-hostname=alpine
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "*** Building ..."
|
echo "*** Building ..."
|
||||||
|
|||||||
@@ -1,27 +1,23 @@
|
|||||||
SUBDIRS = available
|
SUBDIRS = available
|
||||||
docsdir := @docdir@/contrib/alpine/finit.d
|
docsdir := @docdir@/contrib/alpine/finit.d
|
||||||
d_LINKS = dropbear.conf getty.conf keymap.conf modules.conf klogd.conf \
|
d_LINKS = acpid.conf crond.conf dropbear.conf getty.conf \
|
||||||
syslogd.conf
|
keymap.conf modules.conf ntpd.conf \
|
||||||
|
klogd.conf syslogd.conf
|
||||||
|
|
||||||
install-exec-hook:
|
install-exec-hook:
|
||||||
@$(MKDIR_P) $(DESTDIR)$(docsdir)/available
|
@$(MKDIR_P) $(DESTDIR)$(docsdir)/available
|
||||||
|
@$(MKDIR_P) $(DESTDIR)$(docsdir)/enabled
|
||||||
@for file in $(d_LINKS); do \
|
@for file in $(d_LINKS); do \
|
||||||
lnk=$(DESTDIR)$(docsdir)/$$file; \
|
lnk=$(DESTDIR)$(docsdir)/enabled/$$file; \
|
||||||
src=available/$$file; \
|
src=available/$$file; \
|
||||||
if [ -L $$lnk ]; then \
|
rm -f $$lnk; \
|
||||||
echo "Skipping $$lnk exists."; \
|
$(LN_S) ../$$src $$lnk; \
|
||||||
else \
|
|
||||||
$(LN_S) $$src $$lnk; \
|
|
||||||
fi; \
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
uninstall-hook:
|
uninstall-hook:
|
||||||
@for file in $(d_LINKS); do \
|
@for file in $(d_LINKS); do \
|
||||||
lnk=$(DESTDIR)$(docsdir)/$$file; \
|
lnk=$(DESTDIR)$(docsdir)/enabled/$$file; \
|
||||||
src=available/$$file; \
|
src=available/$$file; \
|
||||||
if [ "`readlink $$lnk`" != "$$src" ]; then \
|
$(RM) -f $$lnk; \
|
||||||
continue; \
|
|
||||||
fi; \
|
|
||||||
$(RM) $$lnk; \
|
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
docsdir := @docdir@/contrib/alpine/finit.d/available
|
docsdir := @docdir@/contrib/alpine/finit.d/available
|
||||||
docs_DATA = acpid.conf crond.conf dropbear.conf getty.conf keymap.conf \
|
docs_DATA = acpid.conf crond.conf dropbear.conf getty.conf keymap.conf \
|
||||||
lxdm.conf modules.conf ntpd.conf klogd.conf syslogd.conf
|
lxdm.conf modules.conf ntpd.conf syslog.conf watchdog.conf
|
||||||
EXTRA_DIST = $(docs_DATA)
|
EXTRA_DIST = $(docs_DATA)
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
# Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager)
|
# Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager)
|
||||||
# Depends on syslogd having started. Redirect any output to log.
|
# Depends on syslogd having started. Redirect any output to log.
|
||||||
service [2345] log <svc/sbin/syslogd> /sbin/acpid -f -- ACPI daemon
|
service [2345] <pid/syslogd> log acpid -f -- ACPI daemon
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
service [2345] <svc/sbin/syslogd> /usr/sbin/crond -f -S -c /etc/crontabs -- Cron daemon
|
service [2345] <pid/syslogd> env:-/etc/conf.d/crond crond -f -S $CRON_OPTS -- Cron daemon
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
# Start SSH daemon as soon as basic networking comes up
|
# Start SSH daemon as soon as basic networking comes up
|
||||||
service [2345] <net/lo/up> /usr/sbin/dropbear -R -F -p 22 -- Dropbear SSH daemon
|
service [2345] env:-/etc/conf.d/dropbear dropbear -R -F $DROPBEAR_OPTS -- Dropbear SSH daemon
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# Consoles to start getty on when system is up
|
# Consoles to start getty on when system is up
|
||||||
tty [12345] /dev/tty1 noclear nowait
|
tty [12345] /dev/ttyS0 noclear
|
||||||
tty [2345] /dev/tty2 noclear nowait
|
tty [12345] /dev/tty1 noclear nowait
|
||||||
tty [2345] /dev/tty3 noclear nowait
|
tty [2345] /dev/tty2 noclear nowait
|
||||||
|
tty [2345] /dev/tty3 noclear nowait
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
# Oneshot task to run once at bootstrap
|
# Oneshot task to run once at bootstrap
|
||||||
task [S] zcat /etc/keymap/se.bmap.gz | loadkmap -- Loading keymap
|
task [S] env:/etc/conf.d/loadkmap zcat $KEYMAP | loadkmap -- Loading keymap
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
# Start klogd as soon as possible, should always run
|
|
||||||
service [S12345] /sbin/klogd -n -- Kernel log daemon
|
|
||||||
@@ -1 +1 @@
|
|||||||
service [2345] /usr/sbin/lxdm -- Lightweight Login Manager
|
service [2345] lxdm -- Lightweight Login Manager
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
## Linux kernel modules to load
|
## Linux kernel modules to load
|
||||||
#module fbcon
|
#module fbcon
|
||||||
module button
|
#module button
|
||||||
module evdev
|
#module evdev
|
||||||
module mousedev
|
#module mousedev
|
||||||
module 8139cp
|
#module 8139cp
|
||||||
|
module softdog
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
# Silly Busybox ntpd has no option to use syslog when running in foreground
|
# Busybox ntpd has no option to use syslog when running in foreground
|
||||||
service [2345] log <svc/sbin/syslogd> /usr/sbin/ntpd -n -N -p pool.ntp.org -- NTP daemon
|
service [2345] <pid/syslogd> env:-/etc/conf.d/ntpd log ntpd -n $NTPD_OPTS -- NTP daemon
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# Start syslogd as soon as possible, should always run
|
||||||
|
# Start klogd as soon as possible, but after syslogd
|
||||||
|
service [S12345] env:-/etc/conf.d/syslog syslogd -n $SYSLOGD_OPTS -- Syslog daemon
|
||||||
|
service [S12345] <pid/syslogd> env:-/etc/conf.d/klogd klogd -n $KLOGD_OPTS -- Kernel log daemon
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
# Start syslogd as soon as possible, should always run
|
|
||||||
service [S12345] /sbin/syslogd -n -- Syslog daemon
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
service [S123456789] env:-/etc/conf.d/watchdog watchdog $WATCHDOG_OPTS $WATCHDOG_DEV -- System watchdog
|
||||||
@@ -1 +0,0 @@
|
|||||||
available/dropbear.conf
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
available/getty.conf
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
available/keymap.conf
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
available/klogd.conf
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
available/modules.conf
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
available/syslogd.conf
|
|
||||||
@@ -29,7 +29,7 @@ if [ "x$yorn" = "xy" -o "x$yorn" = "xY" ]; then
|
|||||||
echo
|
echo
|
||||||
echo "*** Installing Finit files ..."
|
echo "*** Installing Finit files ..."
|
||||||
make install
|
make install
|
||||||
cd `dirname $0`
|
cd /usr/share/doc/finit/contrib/alpine
|
||||||
for file in finit.conf rc.local; do
|
for file in finit.conf rc.local; do
|
||||||
install -vbD $file /etc/$file
|
install -vbD $file /etc/$file
|
||||||
done
|
done
|
||||||
@@ -41,6 +41,11 @@ if [ "x$yorn" = "xy" -o "x$yorn" = "xY" ]; then
|
|||||||
cd /sbin
|
cd /sbin
|
||||||
rm init
|
rm init
|
||||||
ln -s finit init
|
ln -s finit init
|
||||||
|
|
||||||
|
rm halt shutdown suspend
|
||||||
|
ln -s reboot halt
|
||||||
|
ln -s reboot shutdown
|
||||||
|
ln -s reboot suspend
|
||||||
fi
|
fi
|
||||||
echo "*** Done"
|
echo "*** Done"
|
||||||
echo
|
echo
|
||||||
|
|||||||
Executable
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ "x`id -u`" != "x0" ]; then
|
||||||
|
echo
|
||||||
|
echo "*** This script must run as root"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
read -p "Do you really want to uninstall Finit (y/N)? " yorn
|
||||||
|
|
||||||
|
if [ "x$yorn" = "xy" -o "x$yorn" = "xY" ]; then
|
||||||
|
echo
|
||||||
|
echo "*** Removing all Finit files ..."
|
||||||
|
rm -rf /usr/share/doc/finit
|
||||||
|
rm -rf /etc/finit.conf
|
||||||
|
rm -rf /etc/finit.d
|
||||||
|
rm -rf /lib/finit
|
||||||
|
if [ -e /etc/rc.local ]; then
|
||||||
|
echo "*** Skipping /etc/rc.local, not sure if we installed it ..."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "*** Restoring BusyBox as /sbin/init ..."
|
||||||
|
cd /sbin
|
||||||
|
rm init
|
||||||
|
ln -s /bin/busybox init
|
||||||
|
|
||||||
|
rm halt shutdown reboot suspend
|
||||||
|
ln -s /bin/busybox halt
|
||||||
|
ln -s /bin/busybox shutdown
|
||||||
|
ln -s /bin/busybox reboot
|
||||||
|
ln -s /bin/busybox suspend
|
||||||
|
echo "*** Done"
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "*** Aborting uninstall."
|
||||||
|
echo
|
||||||
|
fi
|
||||||
@@ -20,6 +20,9 @@ tools pre-systemd work as intended.
|
|||||||
|
|
||||||
root@debian:~# apt install initscripts console-setup
|
root@debian:~# apt install initscripts console-setup
|
||||||
|
|
||||||
|
> **Note:** as of Debian 11 (Bullseye), libuev and libite are part of
|
||||||
|
> the main section of Debian. So just install the -dev packages :)
|
||||||
|
|
||||||
The following script can then be used to configure, build, install and
|
The following script can then be used to configure, build, install and
|
||||||
set up your system to run Finit:
|
set up your system to run Finit:
|
||||||
|
|
||||||
@@ -32,17 +35,25 @@ also possible to change the default init to Finit, if you do you can
|
|||||||
remove the custom Grub entry:
|
remove the custom Grub entry:
|
||||||
|
|
||||||
user@debian:~/finit# cd /sbin
|
user@debian:~/finit# cd /sbin
|
||||||
user@debian:/sbin# sudo rm init
|
user@debian:/sbin# sudo mv init oldinit
|
||||||
user@debian:/sbin# sudo ln -s finit init
|
user@debian:/sbin# sudo ln -s finit init
|
||||||
|
|
||||||
Before rebooting, check the default [/etc/finit.conf](finit.conf) and
|
Before rebooting, check the default [/etc/finit.conf](finit.conf) and
|
||||||
`/etc/finit.d/*.conf` files. The build + install script above provides
|
`/etc/finit.d/*.conf` files. The build + install script above provides
|
||||||
a few sample `.conf` files. See `initctl list` after boot for a list of
|
a few sample `.conf` files. See `initctl ls` after boot for a list of
|
||||||
enabled and available services.
|
enabled and available services, you can then use `enable` and `disable`
|
||||||
|
comands to `initctl`, followed by `reload` to activate your changes.
|
||||||
|
|
||||||
You can also use a standard [/etc/rc.local](rc.local) for one-shot tasks
|
You can also use a standard [/etc/rc.local](rc.local) for one-shot tasks
|
||||||
and initialization like keyboard language etc.
|
and initialization like keyboard language etc.
|
||||||
|
|
||||||
|
If you want to use the X Window system, `sudo apt install elogind`
|
||||||
|
(Bullseye and later). Followed by `initctl reload` (enabled by default)
|
||||||
|
and logout/login again. The elogind daemon ensures a regular non-root
|
||||||
|
user can start and interact with an X session, otherwise keyboard and
|
||||||
|
mouse won't work.
|
||||||
|
|
||||||
|
|
||||||
Have fun!
|
Have fun!
|
||||||
/Joachim ツ
|
/Joachim ツ
|
||||||
|
|
||||||
|
|||||||
@@ -21,14 +21,13 @@ echo
|
|||||||
|
|
||||||
# The plugins are optional, but you may need D-Bus and X11 if you want
|
# The plugins are optional, but you may need D-Bus and X11 if you want
|
||||||
# to run X-Window, the other configure flags are however required.
|
# to run X-Window, the other configure flags are however required.
|
||||||
./configure \
|
./configure \
|
||||||
--enable-progress \
|
--prefix=/usr --exec-prefix= \
|
||||||
--enable-dbus-plugin --enable-x11-common-plugin \
|
--sysconfdir=/etc --localstatedir=/var \
|
||||||
--enable-alsa-utils-plugin --enable-inetd-echo-plugin \
|
--enable-dbus-plugin --enable-x11-common-plugin \
|
||||||
--enable-inetd-chargen-plugin --enable-inetd-daytime-plugin \
|
--enable-alsa-utils-plugin \
|
||||||
--enable-inetd-discard-plugin --enable-inetd-time-plugin \
|
--with-random-seed=/var/lib/urandom/random-seed \
|
||||||
--with-random-seed=/var/lib/urandom/random-seed \
|
--with-heading="Debian GNU/Linux"
|
||||||
--with-heading="Debian GNU/Linux" --with-hostname="stretch"
|
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo
|
echo
|
||||||
|
|||||||
@@ -1,27 +1,23 @@
|
|||||||
SUBDIRS = available
|
SUBDIRS = available
|
||||||
docsdir := @docdir@/contrib/debian/finit.d
|
docsdir := @docdir@/contrib/debian/finit.d
|
||||||
d_LINKS = console-setup.conf getty.conf keyboard-setup.conf \
|
d_LINKS = console-setup.conf elogind.conf getty.conf \
|
||||||
modules.conf rsyslogd.conf sshd.conf
|
keyboard-setup.conf modules.conf rsyslogd.conf \
|
||||||
|
sshd.conf
|
||||||
|
|
||||||
install-exec-hook:
|
install-exec-hook:
|
||||||
@$(MKDIR_P) $(DESTDIR)$(docsdir)/available
|
@$(MKDIR_P) $(DESTDIR)$(docsdir)/available
|
||||||
|
@$(MKDIR_P) $(DESTDIR)$(docsdir)/enabled
|
||||||
@for file in $(d_LINKS); do \
|
@for file in $(d_LINKS); do \
|
||||||
lnk=$(DESTDIR)$(docsdir)/$$file; \
|
lnk=$(DESTDIR)$(docsdir)/enabled/$$file; \
|
||||||
src=available/$$file; \
|
src=available/$$file; \
|
||||||
if [ -L $$lnk ]; then \
|
rm -f $$lnk; \
|
||||||
echo "Skipping $$lnk exists."; \
|
$(LN_S) ../$$src $$lnk; \
|
||||||
else \
|
|
||||||
$(LN_S) $$src $$lnk; \
|
|
||||||
fi; \
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
uninstall-hook:
|
uninstall-hook:
|
||||||
@for file in $(d_LINKS); do \
|
@for file in $(d_LINKS); do \
|
||||||
lnk=$(DESTDIR)$(docsdir)/$$file; \
|
lnk=$(DESTDIR)$(docsdir)/enabled/$$file; \
|
||||||
src=available/$$file; \
|
src=available/$$file; \
|
||||||
if [ "`readlink $$lnk`" != "$$src" ]; then \
|
$(RM) -f $$lnk; \
|
||||||
continue; \
|
|
||||||
fi; \
|
|
||||||
$(RM) $$lnk; \
|
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
docsdir := @docdir@/contrib/debian/finit.d/available
|
docsdir := @docdir@/contrib/debian/finit.d/available
|
||||||
docs_DATA = acpid.conf console-setup.conf getty.conf \
|
docs_DATA = acpid.conf console-setup.conf elogind.conf getty.conf \
|
||||||
keyboard-setup.conf lightdm.conf modules.conf \
|
keyboard-setup.conf lightdm.conf modules.conf sntpd.conf \
|
||||||
ntpclient.conf rsyslogd.conf sshd.conf xdm.conf
|
rsyslogd.conf sshd.conf syslogd.conf xdm.conf
|
||||||
EXTRA_DIST = $(docs_DATA)
|
EXTRA_DIST = $(docs_DATA)
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
# Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager)
|
# Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager)
|
||||||
# Depends on rsyslogd having started. Redirect any output to log.
|
# Depends on a syslog daemon having started. Redirect any output to log.
|
||||||
service [2345] <svc/usr/sbin/rsyslogd> log /usr/sbin/acpid -f -- ACPI daemon
|
service [2345] <pid/syslogd> env:-/etc/default/acpid log acpid -f $OPTIONS -- ACPI daemon
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# On some systems, bootstrap can be really quick and cause elogind
|
||||||
|
# to not start before a user has managed to log in. To prevent
|
||||||
|
# this, add <pid/elogind> as condition to your TTYs in getty.conf
|
||||||
|
service [2345] <pid/syslogd> /lib/elogind/elogind -- Login manager
|
||||||
@@ -1 +1 @@
|
|||||||
service [3] /usr/sbin/lightdm -- Light Display Manager
|
service [3] lightdm -- Light Display Manager
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
## Linux kernel modules to load
|
## Linux kernel modules to load
|
||||||
#module fbcon
|
#module fbcon
|
||||||
module button
|
#module button
|
||||||
module evdev
|
#module evdev
|
||||||
module loop
|
#module loop
|
||||||
module psmouse
|
#module psmouse
|
||||||
module mousedev
|
#module mousedev
|
||||||
module 8139cp
|
#module 8139cp
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
# Simple NTP client (SNTP)
|
|
||||||
service [2345] <net/route/default> /usr/sbin/ntpclient -n -L pool.ntp.org -- SNTP client
|
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
# Start rsyslogd as soon as possible, should always run
|
# Start rsyslogd as soon as possible, should always run
|
||||||
service [S12345] /usr/sbin/rsyslogd -n -- Reliable and extended syslog daemon
|
# Provides pid/syslogd condition
|
||||||
|
service [S12345] name:syslogd env:-/etc/default/rsyslog rsyslogd -n $RSYSLOGD_OPTIONS -- Reliable syslog daemon
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# Simple NTP client (SNTP)
|
||||||
|
service [2345] <net/route/default> env:-/etc/default/sntpd sntpd -n $SNTPD_OPTIONS -- SNTP client
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
# Start SSH daemon as soon as basic networking comes up
|
# Start SSH daemon as soon as basic networking comes up
|
||||||
service [2345] <net/lo/up> /usr/sbin/sshd -D -- OpenSSH daemon
|
service [2345] <net/lo/up> env:-/etc/default/ssh /usr/sbin/sshd -D $SSHD_OPTS -- OpenSSH daemon
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# Start sysklogd as soon as possible, should always run if enabled
|
||||||
|
service [S123456789] env:-/etc/default/syslogd syslogd -F $SYSLOGD_OPTIONS -- System logging daemon
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# Here we use XDM since it has few dependencies (relatively speaking).
|
# Here we use XDM since it has few dependencies (relatively speaking).
|
||||||
# It is also an example of a service without a -- description.
|
# It is also an example of a service without a -- description.
|
||||||
# service [3] /usr/sbin/lxdm -- Lightweight Login Manager
|
# service [3] lxdm -- Lightweight Login Manager
|
||||||
service [3] /usr/bin/xdm -nodaemon
|
service [3] xdm -nodaemon -- X Display Manager
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
available/console-setup.conf
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
available/getty.conf
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
available/keyboard-setup.conf
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
available/modules.conf
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
available/rsyslogd.conf
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
available/sshd.conf
|
|
||||||
@@ -31,8 +31,10 @@ echo
|
|||||||
if [ "x$yorn" = "xy" -o "x$yorn" = "xY" ]; then
|
if [ "x$yorn" = "xy" -o "x$yorn" = "xY" ]; then
|
||||||
echo "Installing Finit files ..."
|
echo "Installing Finit files ..."
|
||||||
make install
|
make install
|
||||||
cd `dirname $0`
|
cd /usr/share/doc/finit/contrib/debian
|
||||||
install -vbD finit.conf /etc/finit.conf
|
for file in finit.conf; do
|
||||||
|
install -vbD $file /etc/$file
|
||||||
|
done
|
||||||
cp -va finit.d /etc/
|
cp -va finit.d /etc/
|
||||||
|
|
||||||
echo "*** Setting up a GRUB boot entry ..."
|
echo "*** Setting up a GRUB boot entry ..."
|
||||||
|
|||||||
+34
-17
@@ -2,15 +2,24 @@
|
|||||||
#
|
#
|
||||||
host testbed
|
host testbed
|
||||||
|
|
||||||
# Devices to fsck at boot
|
|
||||||
check /dev/vda1
|
|
||||||
|
|
||||||
# Linux kernel modules to load
|
# Linux kernel modules to load
|
||||||
module button
|
module button
|
||||||
module evdev
|
module evdev
|
||||||
module loop
|
module loop
|
||||||
module psmouse
|
module psmouse
|
||||||
|
|
||||||
|
# Top-level cgroups and their default settings. All groups mandatory
|
||||||
|
# but more can be added, max 8 groups in total currently. The cgroup
|
||||||
|
# 'root' is also available, reserved for RT processes. Settings are
|
||||||
|
# as-is, only one shorthand 'mem.' exists, other than that it's the
|
||||||
|
# cgroup v2 controller default names.
|
||||||
|
cgroup init cpu.weight:100
|
||||||
|
cgroup user cpu.weight:100
|
||||||
|
cgroup system cpu.weight:9700 cpu.max:50000
|
||||||
|
|
||||||
|
# Example extra cgroup
|
||||||
|
cgroup maint cpu.weight:100
|
||||||
|
|
||||||
# Runlevel to start after bootstrap, runlevel 'S'
|
# Runlevel to start after bootstrap, runlevel 'S'
|
||||||
runlevel 2
|
runlevel 2
|
||||||
|
|
||||||
@@ -19,7 +28,7 @@ network service networking start
|
|||||||
|
|
||||||
# Max file size for each log file: 100 kiB, rotate max 4 copies:
|
# Max file size for each log file: 100 kiB, rotate max 4 copies:
|
||||||
# log => log.1 => log.2.gz => log.3.gz => log.4.gz
|
# log => log.1 => log.2.gz => log.3.gz => log.4.gz
|
||||||
log size=100k count=4
|
log size:100k count:4
|
||||||
|
|
||||||
# Virtual consoles to start getty on
|
# Virtual consoles to start getty on
|
||||||
tty /dev/tty1
|
tty /dev/tty1
|
||||||
@@ -33,28 +42,36 @@ tty /dev/tty3
|
|||||||
#run [2] /etc/init.d/networking start -- Start networking
|
#run [2] /etc/init.d/networking start -- Start networking
|
||||||
|
|
||||||
# Services to be monitored and respawned as needed
|
# Services to be monitored and respawned as needed
|
||||||
service [2345] /sbin/klogd -n -- Kernel logging server
|
|
||||||
service [2345] /sbin/syslogd -n -- Syslog server
|
# klgod and syslogd are placed in the maint cgroup
|
||||||
service [3] /usr/sbin/gdm -- GNOME Display Manager
|
cgroup.maint
|
||||||
|
service [2345] <pid/syslogd> klogd -n -- Kernel logging server
|
||||||
|
service [2345] syslogd -n -- Syslog server
|
||||||
|
|
||||||
|
# gdm in the system cgroup (default when read from it's own .conf file)
|
||||||
|
cgroup.system
|
||||||
|
service [3] cgroup:cpu.weight:250,mem.max:10M gdm -- GNOME Display Manager
|
||||||
|
|
||||||
|
# Start SSH daemon with opts from /etc/default/ssh (if available), move
|
||||||
|
# to user cgroup with cpu.weight:250. Default for services is system
|
||||||
|
# group. Default weight in user group is 100 (above). Max length of
|
||||||
|
# cgroup argument is (currently) 63 chars.
|
||||||
|
#
|
||||||
|
# Notice alternative syntax where current cgroup is only set for this
|
||||||
|
# particular service.
|
||||||
|
service [2345] cgroup.user:cpu.weight:250,mem.max:10M env:-/etc/default/ssh /usr/sbin/sshd -D $SSHD_OPTS -- OpenSSH daemon
|
||||||
|
|
||||||
# The BusyBox ntpd does not use syslog when running in the foreground
|
# The BusyBox ntpd does not use syslog when running in the foreground
|
||||||
# So we use this trick to redirect stdout/stderr to a log file. The
|
# So we use this trick to redirect stdout/stderr to a log file. The
|
||||||
# log file is rotated with the above settings. The condition declares
|
# log file is rotated with the above settings. The condition declares
|
||||||
# a dependency on a system default route (gateway) to be set. A single
|
# a dependency on a system default route (gateway) to be set. A single
|
||||||
# <!> at the beginning means ntpd does not respect SIGHUP for restart.
|
# <!> at the beginning means ntpd does not respect SIGHUP for restart.
|
||||||
service [2345] log:/var/log/ntpd.log <!net/route/default> /sbin/ntpd -n -l -I eth0 -- NTP daemon
|
service [2345] <!net/route/default> log:/var/log/ntpd.log ntpd -n -l -I eth0 -- NTP daemon
|
||||||
|
|
||||||
# Run start scripts from this directory
|
# Run start scripts from this directory
|
||||||
# runparts /etc/start.d
|
# runparts /etc/start.d
|
||||||
|
|
||||||
# Inetd services
|
|
||||||
inetd time/udp wait [2345] internal -- UNIX rdate service
|
|
||||||
inetd time/tcp nowait [2345] internal -- UNIX rdate service
|
|
||||||
inetd ssh@eth0:222/tcp nowait [2345] /usr/sbin/sshd -i -- SSH service
|
|
||||||
inetd ssh/tcp nowait [2345] /usr/sbin/sshd -i -- SSH service
|
|
||||||
|
|
||||||
# For multiple instances of the same service, add :ID somewhere between
|
# For multiple instances of the same service, add :ID somewhere between
|
||||||
# the service/run/task keyword and the command.
|
# the service/run/task keyword and the command.
|
||||||
service :1 [2345] /sbin/httpd -f -h /http -p 80 -- Web server
|
service :80 [2345] /sbin/httpd -f -h /http -p 80 -- Web server
|
||||||
service :2 [2345] /sbin/httpd -f -h /http -p 8080 -- Old web server
|
service :8080 [2345] /sbin/httpd -f -h /http -p 8080 -- Old web server
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# This is a basic /etc/fstab that mounts up all of the virtual filesystems
|
||||||
|
# that older versions of Finit used to mount internally. It can serve as a
|
||||||
|
# starting point for systems running Busybox's mount implementation. Make
|
||||||
|
# sure that CONFIG_FEATURE_MOUNT_HELPERS enabled; as this is required
|
||||||
|
# create the /dev/{pts,shm} directories.
|
||||||
|
|
||||||
|
devtmpfs /dev devtmpfs defaults 0 0
|
||||||
|
mkdir#-p /dev/pts helper none 0 0
|
||||||
|
devpts /dev/pts devpts mode=620,ptmxmode=0666 0 0
|
||||||
|
mkdir#-p /dev/shm helper none 0 0
|
||||||
|
tmpfs /dev/shm tmpfs mode=0777 0 0
|
||||||
|
proc /proc proc defaults 0 0
|
||||||
|
tmpfs /tmp tmpfs mode=1777,nosuid,nodev 0 0
|
||||||
|
tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0
|
||||||
|
sysfs /sys sysfs defaults 0 0
|
||||||
@@ -14,12 +14,11 @@ fi
|
|||||||
# The plugins are optional, but you may need D-Bus and X11 if you want
|
# The plugins are optional, but you may need D-Bus and X11 if you want
|
||||||
# to run X-Window, the other configure flags are however required.
|
# to run X-Window, the other configure flags are however required.
|
||||||
PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig ./configure \
|
PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig ./configure \
|
||||||
--enable-progress \
|
--prefix=/usr --exec-prefix= \
|
||||||
--enable-dbus-plugin --enable-x11-common-plugin \
|
--sysconfdir=/etc --localstatedir=/var \
|
||||||
--enable-alsa-utils-plugin --enable-inetd-echo-plugin \
|
--enable-dbus-plugin --enable-x11-common-plugin \
|
||||||
--enable-inetd-chargen-plugin --enable-inetd-daytime-plugin \
|
--enable-alsa-utils-plugin --with-watchdog \
|
||||||
--enable-inetd-discard-plugin --enable-inetd-time-plugin \
|
--with-heading="Void Linux"
|
||||||
--with-heading="Void Linux" --with-hostname=void
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "*** Building ..."
|
echo "*** Building ..."
|
||||||
|
|||||||
@@ -4,23 +4,18 @@ d_LINKS = acpid.conf dhcpcd.conf getty.conf sshd.conf uuidd.conf
|
|||||||
|
|
||||||
install-exec-hook:
|
install-exec-hook:
|
||||||
@$(MKDIR_P) $(DESTDIR)$(docsdir)/available
|
@$(MKDIR_P) $(DESTDIR)$(docsdir)/available
|
||||||
|
@$(MKDIR_P) $(DESTDIR)$(docsdir)/enabled
|
||||||
@for file in $(d_LINKS); do \
|
@for file in $(d_LINKS); do \
|
||||||
lnk=$(DESTDIR)$(docsdir)/$$file; \
|
lnk=$(DESTDIR)$(docsdir)/enabled/$$file; \
|
||||||
src=available/$$file; \
|
src=available/$$file; \
|
||||||
if [ -L $$lnk ]; then \
|
rm -f $$lnk; \
|
||||||
echo "Skipping $$lnk exists."; \
|
$(LN_S) ../$$src $$lnk; \
|
||||||
else \
|
|
||||||
$(LN_S) $$src $$lnk; \
|
|
||||||
fi; \
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
uninstall-hook:
|
uninstall-hook:
|
||||||
@for file in $(d_LINKS); do \
|
@for file in $(d_LINKS); do \
|
||||||
lnk=$(DESTDIR)$(docsdir)/$$file; \
|
lnk=$(DESTDIR)$(docsdir)/enabled/$$file; \
|
||||||
src=available/$$file; \
|
src=available/$$file; \
|
||||||
if [ "`readlink $$lnk`" != "$$src" ]; then \
|
$(RM) -f $$lnk; \
|
||||||
continue; \
|
|
||||||
fi; \
|
|
||||||
$(RM) $$lnk; \
|
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
available/acpid.conf
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
docsdir := @docdir@/contrib/void/finit.d/available
|
docsdir := @docdir@/contrib/void/finit.d/available
|
||||||
docs_DATA = acpid.conf crond.conf dhcpcd.conf dmeventd.conf getty.conf \
|
docs_DATA = acpid.conf crond.conf dhcpcd.conf dmeventd.conf getty.conf \
|
||||||
keymap.conf klogd.conf lxdm.conf modules.conf ntpd.conf \
|
keymap.conf lxdm.conf modules.conf ntpd.conf \
|
||||||
sshd.conf syslogd.conf uuidd.conf
|
sshd.conf syslog.conf uuidd.conf
|
||||||
EXTRA_DIST = $(docs_DATA)
|
EXTRA_DIST = $(docs_DATA)
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
# Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager)
|
# Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager)
|
||||||
# Depends on syslogd having started. Redirect any output to log.
|
# Depends on syslogd having started. Redirect any output to log.
|
||||||
service [2345] /sbin/acpid -f -- ACPI daemon
|
service [2345] acpid -f -- ACPI daemon
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
service [2345] <svc/sbin/syslogd> /usr/sbin/crond -f -S -c /etc/crontabs -- Cron daemon
|
service [2345] <pid/syslogd> crond -f -S -c /etc/crontabs -- Cron daemon
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
service [2345] /usr/sbin/dhcpcd -B -M -- DHCP client
|
service [2345] dhcpcd -B -M -- DHCP client
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
service [S12345] /sbin/dmeventd -f -- Device mapper event daemon
|
service [S12345] dmeventd -f -- Device mapper event daemon
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
# Start klogd as soon as possible, should always run
|
|
||||||
service [S12345] /sbin/klogd -n -- Kernel log daemon
|
|
||||||
@@ -1 +1 @@
|
|||||||
service [2345] /usr/sbin/lxdm -- Lightweight Login Manager
|
service [2345] lxdm -- Lightweight Login Manager
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
## Linux kernel modules to load
|
## Linux kernel modules to load
|
||||||
#module fbcon
|
#module fbcon
|
||||||
module button
|
#module button
|
||||||
module evdev
|
#module evdev
|
||||||
module mousedev
|
#module mousedev
|
||||||
module 8139cp
|
#module 8139cp
|
||||||
|
module softdog
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
# Silly Busybox ntpd has no option to use syslog when running in foreground
|
# Silly Busybox ntpd has no option to use syslog when running in foreground
|
||||||
service [2345] log <svc/sbin/syslogd> /usr/sbin/ntpd -n -N -p pool.ntp.org -- NTP daemon
|
service [2345] <pid/syslogd> log ntpd -n -N -p pool.ntp.org -- NTP daemon
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
# Start SSH daemon as soon as basic networking comes up
|
# Start SSH daemon as soon as basic networking comes up
|
||||||
service [2345] <net/lo/up> /usr/sbin/sshd -D -- OpenSSH daemon
|
service [2345] /usr/sbin/sshd -D -- OpenSSH daemon
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# Start syslogd as soon as possible, should always run
|
||||||
|
# Start klogd as soon as possible, but after syslogd
|
||||||
|
service [S12345] syslogd -n -- Syslog daemon
|
||||||
|
service [S12345] <pid/syslogd> klogd -n -- Kernel log daemon
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
# Start syslogd as soon as possible, should always run
|
|
||||||
service [S12345] /sbin/syslogd -n -- Syslog daemon
|
|
||||||
@@ -1 +1 @@
|
|||||||
service @uuidd:uuidd [2345] /sbin/uuidd -F -- UUID generation daemon
|
service @uuidd:uuidd [2345] uuidd -F -- UUID generation daemon
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
available/dhcpcd.conf
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
available/getty.conf
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
available/sshd.conf
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
available/uuidd.conf
|
|
||||||
@@ -30,7 +30,7 @@ if [ "x$yorn" = "xy" -o "x$yorn" = "xY" ]; then
|
|||||||
echo
|
echo
|
||||||
echo "*** Installing Finit files ..."
|
echo "*** Installing Finit files ..."
|
||||||
make install
|
make install
|
||||||
cd `dirname $0`
|
cd /usr/share/doc/finit/contrib/void
|
||||||
for file in finit.conf rc.local; do
|
for file in finit.conf rc.local; do
|
||||||
install -vbD $file /etc/$file
|
install -vbD $file /etc/$file
|
||||||
done
|
done
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
docsdir := @docdir@/doc
|
docsdir := @docdir@/doc
|
||||||
docs_DATA = config.md conditions.md distro.md inetd.md plugins.md \
|
docs_DATA = config.md conditions.md distro.md plugins.md \
|
||||||
service.md signals.md svc-machine.png cmdline.md
|
service.md signals.md svc-machine.png cmdline.md
|
||||||
EXTRA_DIST = $(docs_DATA)
|
EXTRA_DIST = $(docs_DATA)
|
||||||
|
|||||||
+17
-92
@@ -1,119 +1,44 @@
|
|||||||
Goals of Finit
|
Goals of Finit
|
||||||
==============
|
==============
|
||||||
|
|
||||||
The intent of finit is to monitor not just processes, but to supervise
|
Initially Finit aimed to be more than a processes monitor, acting as a
|
||||||
an entire system and the behavior of certain processes that declare
|
replacement for cron/at and inetd as well. Over time, however, the true
|
||||||
themselves to be finit compliant. Similar to launchd, the goal of
|
value in the project turned out to be:
|
||||||
finit is to be a replacement for:
|
|
||||||
|
|
||||||
* init
|
> A simple SysV init and systemd replacement, primarily for embedded
|
||||||
* inetd
|
> systems, container, and dedicated server applications.
|
||||||
* crond
|
|
||||||
* watchdogd
|
|
||||||
|
|
||||||
A small and simple replacement, primarily for embedded systems, with a
|
|
||||||
low dependency on external packages. A compliant software is one that
|
|
||||||
can run as a damon in the foreground. If it can also touch its PID file
|
|
||||||
after a reconfiguration (`initctl reload`), the Finit dependency system
|
|
||||||
can also be used.
|
|
||||||
|
|
||||||
|
|
||||||
Near Future
|
Misc TODOs
|
||||||
-----------
|
----------
|
||||||
|
|
||||||
* When a process dies, and Finit does not restart it, we should collect
|
Some of these are also registered in the issue tracker on GitHub.
|
||||||
a `siginfo_t` from the SIGCHLD signal and supply to the user in case
|
|
||||||
`initctl status <process>` is called to debug the issue.
|
* Refactor the .conf parser, parse user input in a separate process
|
||||||
* Merge UDP redirect service uredir as an UDP inetd variant
|
* Move process monitor to separate process (same as parser?)
|
||||||
|
* Add new (complimentary) .svc file format to slowly migrate away
|
||||||
|
from the very terse one-liner format currently used
|
||||||
|
* Allow running as non-pid1 => read .conf and RCSD form cmdline
|
||||||
* Add `finit.conf` support for UPS notification (SIGPWR) to start a task
|
* Add `finit.conf` support for UPS notification (SIGPWR) to start a task
|
||||||
using, e.g. <sys/power/{ok,fail,low}> conditions. More info in sig.c
|
using, e.g. <sys/power/{ok,fail,low}> conditions. More info in sig.c
|
||||||
* Add `finit.conf` support for ctrl-alt-delete (SIGINT) and kbrequest,
|
* Add `finit.conf` support for ctrl-alt-delete (SIGINT) and kbrequest,
|
||||||
i.e. KeyboardSignal, (SIGWINCH) behavior. Using conditions to a task,
|
i.e. KeyboardSignal, (SIGWINCH) behavior. Using conditions to a task,
|
||||||
e.g, <sys/key/ctrlaltdel> and <sys/key/signal> like SIGPWR handling.
|
e.g, <sys/key/ctrlaltdel> and <sys/key/signal> like SIGPWR handling.
|
||||||
* Cron/At support, see below
|
|
||||||
* Write man pages for finit and `finit.conf`, steal from the excellent
|
* Write man pages for finit and `finit.conf`, steal from the excellent
|
||||||
`pimd` man pages ...
|
`pimd` man pages ...
|
||||||
|
* Add support for timed shutdown in Finit, including cancelled shutdown:
|
||||||
|
|
||||||
|
shutdown -h 03:35 "foobar was here"
|
||||||
|
|
||||||
General
|
|
||||||
-------
|
|
||||||
|
|
||||||
* Add support for timed shutdown in Finit, including cancelled shutdown,
|
|
||||||
possibly using an at-job, see [crond section](#Crond) below
|
|
||||||
* Add support for JSON output, or similar, from `initctl show`, e.g.
|
* Add support for JSON output, or similar, from `initctl show`, e.g.
|
||||||
`initctl show --json`
|
`initctl show --json`
|
||||||
* [Solaris SMF][] (Service Management Facility) has some interesting
|
|
||||||
features that may be well worth looking into adopting:
|
|
||||||
|
|
||||||
svcs enable -rt svc:/network/ssh:default
|
|
||||||
|
|
||||||
That is: (r)esolve dependencies and only enable ssh (t)emporary
|
|
||||||
in the default runlevel when networking is available.
|
|
||||||
* `initctl add /sbin/service -n -- Service description`, for details
|
|
||||||
see above [Solaris SMF][] featuer, issue #55 and issue #69,
|
|
||||||
https://github.com/troglobit/finit/issues/69#issuecomment-287907610
|
|
||||||
* Changing the name of a pidfile, `pid:[/path/]file.pid`, after a
|
|
||||||
service has been started is not supported atm. The previous name will
|
|
||||||
not be (never) removed and the new name will not be created until the
|
|
||||||
process has been stopped and started again.
|
|
||||||
* PID files created in subdirectories to `/run` is not supported right
|
|
||||||
now inotify listeners should be automatically created (and removed)
|
|
||||||
when a subdirectory is added (or removed).
|
|
||||||
|
|
||||||
[Solaris SMF]: http://www.oracle.com/technetwork/articles/servers-storage-admin/intro-smf-basics-s11-1729181.html
|
|
||||||
|
|
||||||
|
|
||||||
Init
|
Init
|
||||||
----
|
----
|
||||||
|
|
||||||
Finit in itself is not SysV Init compatible, it doesn't use `/etc/rc.d`
|
Finit in itself is not SysV Init compatible, it doesn't use `/etc/rc.d`
|
||||||
and `/etc/inet.d` scripts to boot the system. However, a plausible way
|
and `/etc/init.d` scripts to boot the system. However, a plausible way
|
||||||
to achieve compatibility would be to add a plugin to finit which reads
|
to achieve compatibility would be to add a plugin to finit which reads
|
||||||
`/etc/inittab` to be able to start standard Linux systems.
|
`/etc/inittab` to be able to start standard Linux systems.
|
||||||
|
|
||||||
|
|
||||||
Inetd
|
|
||||||
-----
|
|
||||||
|
|
||||||
* Add support for throttling connections.
|
|
||||||
* Optimize interface filtering by using socket filter. The functions
|
|
||||||
`inet_*_peek()` and `inetd_is_allowed()` used for interace filtering
|
|
||||||
should be possible to rewrite as socket filters.
|
|
||||||
* Optimize HTTP/HTTPS inetd connections by adding basic support for the
|
|
||||||
`inetd` variant `redir http/tcp@eth0 nowait [2345] 127.0.0.1:8080`,
|
|
||||||
which would reduce the overhead of spawn the web server on each HTTP
|
|
||||||
connection, yet still provide a means of filtering access per iface.
|
|
||||||
|
|
||||||
|
|
||||||
Crond
|
|
||||||
-----
|
|
||||||
|
|
||||||
Requirements are quite rudimentary, basic cron functionality, mainly
|
|
||||||
system-level timed periodic tasks:
|
|
||||||
|
|
||||||
* Periodically run a task, in a matching runlevel
|
|
||||||
* Optionally run as non-root (`crontab -e` as operator)
|
|
||||||
|
|
||||||
Proposed syntax:
|
|
||||||
|
|
||||||
# Crontab
|
|
||||||
cron @SPEC [LVLS] /path/to/cmd [ARGS] -- Optional descr
|
|
||||||
|
|
||||||
# One-shot 'at' command
|
|
||||||
at @YY-mm-ddTHH:MM [LVLS] /path/to/cmd [ARGS] -- Optional descr
|
|
||||||
|
|
||||||
Notice the ISO date in the `at` notation. The `cron @SPEC` could use
|
|
||||||
are mo loose notation, e.g. `@hourly`, `@midnight`, `@daily`, `@weekly`,
|
|
||||||
`@reboot`, etc. The runlevels is extra filtering sugar. E.g., if cron
|
|
||||||
service is only allowed in runlevels two or three it will not start if
|
|
||||||
system currently is in runlevel four.
|
|
||||||
|
|
||||||
To run a command as another user the `.conf` file must have a that
|
|
||||||
owner. E.g., `/etc/finit.d/extra.conf` may be owned by operator and
|
|
||||||
only hold `cron ...` lines.
|
|
||||||
|
|
||||||
What would be extremely useful is if `initctl`, or a homegrown `at`,
|
|
||||||
could support the basic functionality of the `at` command directly from
|
|
||||||
the shell -- that way setting up one-time jobs would not entail
|
|
||||||
re-reading `/etc/finit.conf`
|
|
||||||
|
|
||||||
|
|||||||
+6
-4
@@ -9,9 +9,11 @@ Bootstrap
|
|||||||
6. Load all `.so` plugins
|
6. Load all `.so` plugins
|
||||||
7. Call `fsck` on file systems listed in `/etc/fstab`
|
7. Call `fsck` on file systems listed in `/etc/fstab`
|
||||||
8. Populate `/dev` using either udev or mdev, depending on system type
|
8. Populate `/dev` using either udev or mdev, depending on system type
|
||||||
9. Parse `/etc/finit.conf` and all `/etc/finit.d/*.conf` files
|
9. Parse `/etc/finit.conf`
|
||||||
10. Start built-in watchdog, if enabled
|
10. Start built-in watchdog, if enabled and `WDT_DEVNODE` exists. This
|
||||||
11. Set hostname
|
means any WDT that requires a kernel module need to be either
|
||||||
|
compiled into the kernel, or insmod'ed in `/etc/finit.conf`
|
||||||
|
11. Load all `/etc/finit.d/*.conf` files and set hostname
|
||||||
12. Remount `/` read-write if `/` is listed in `/etc/fstab` without `ro`
|
12. Remount `/` read-write if `/` is listed in `/etc/fstab` without `ro`
|
||||||
13. Call 1st level hooks, `HOOK_ROOTFS_UP`
|
13. Call 1st level hooks, `HOOK_ROOTFS_UP`
|
||||||
14. Mount all file systems listed in `/etc/fstab` and swap, if available
|
14. Mount all file systems listed in `/etc/fstab` and swap, if available
|
||||||
@@ -34,7 +36,7 @@ Bootstrap
|
|||||||
24. Call 4th level hooks, `HOOK_SVC_UP`
|
24. Call 4th level hooks, `HOOK_SVC_UP`
|
||||||
25. Call `/etc/rc.local`, if it exists and is an executable shell script
|
25. Call `/etc/rc.local`, if it exists and is an executable shell script
|
||||||
26. Call 5th level (last) hooks, `HOOK_SYSTEM_UP`
|
26. Call 5th level (last) hooks, `HOOK_SYSTEM_UP`
|
||||||
27. Start all configured TTYs, or a fallback shell on `/dev/console`
|
27. Start all configured TTYs
|
||||||
|
|
||||||
In (19) and (22) tasks and services defined in `/etc/finit.conf` and
|
In (19) and (22) tasks and services defined in `/etc/finit.conf` and
|
||||||
`/etc/sysctl.d/*.conf` are started. Remember, all `service` and `task`
|
`/etc/sysctl.d/*.conf` are started. Remember, all `service` and `task`
|
||||||
|
|||||||
+32
-21
@@ -29,8 +29,8 @@ optional plugins to enable. It depends on two external libraries:
|
|||||||
The configure script checks for all dependencies, including the correct
|
The configure script checks for all dependencies, including the correct
|
||||||
version of the above mentioned libraries. Currently requried versions:
|
version of the above mentioned libraries. Currently requried versions:
|
||||||
|
|
||||||
- libite v2.0.1
|
- libite v2.2.0
|
||||||
- libuEv v2.1.0
|
- libuEv v2.2.0
|
||||||
|
|
||||||
|
|
||||||
Configure
|
Configure
|
||||||
@@ -38,7 +38,16 @@ Configure
|
|||||||
|
|
||||||
Below are a few of the main switches to configure:
|
Below are a few of the main switches to configure:
|
||||||
|
|
||||||
* `--disable-inetd`: Disable the built-in inetd server.
|
* `--prefix=..`: Usually you want to set this to `/usr`, default is the GNU
|
||||||
|
default: `/usr/local`
|
||||||
|
|
||||||
|
* `--exec-prefix=..`: This you want to set to the empty string, or `/`, to
|
||||||
|
ensure the programs `finit` and `initctl` are installed to the proper
|
||||||
|
locations. Linux expects an "init" in `/sbin`, default: `--prefix`
|
||||||
|
|
||||||
|
* `--sysconfdir=..`: follows `--prefix`, you likely want it to be `/etc`
|
||||||
|
|
||||||
|
* `--localstatedir=..`: follows `--prefix`, you likely want `/var`
|
||||||
|
|
||||||
* `--enable-static`: Build Finit statically. The plugins will be
|
* `--enable-static`: Build Finit statically. The plugins will be
|
||||||
built-ins (.o files) and all external libraries, except the C library
|
built-ins (.o files) and all external libraries, except the C library
|
||||||
@@ -61,22 +70,21 @@ Example
|
|||||||
First, unpack the archive:
|
First, unpack the archive:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ tar xf finit-3.0.tar.xz
|
$ tar xf finit-3.0.tar.xz
|
||||||
$ cd finit-3.0/
|
$ cd finit-3.0/
|
||||||
```
|
```
|
||||||
|
|
||||||
Then configure, build and install:
|
Then configure, build and install:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ ./configure --enable-inetd-echo-plugin \
|
$ ./configure --prefix=/usr --exec-prefix= \
|
||||||
--enable-inetd-chargen-plugin --enable-inetd-daytime-plugin \
|
--sysconfdir=/etc --localstatedir=/var \
|
||||||
--enable-inetd-discard-plugin --enable-inetd-time-plugin \
|
--with-heading="Alpine Linux 3.13" --with-hostname=alpine
|
||||||
--with-heading="Alpine Linux 3.4" --with-hostname=alpine
|
$ make
|
||||||
$ make
|
.
|
||||||
.
|
.
|
||||||
.
|
.
|
||||||
.
|
$ DESTDIR=/tmp/finit make install
|
||||||
$ DESTDIR=/tmp/finit make install
|
|
||||||
```
|
```
|
||||||
|
|
||||||
In this example the [finit-3.0.tar.xz][1] archive is unpacked to the
|
In this example the [finit-3.0.tar.xz][1] archive is unpacked to the
|
||||||
@@ -145,19 +153,22 @@ kernel messages and add `debug` to enable Finit debug messages.
|
|||||||
append="init=/sbin/finit debug"
|
append="init=/sbin/finit debug"
|
||||||
```
|
```
|
||||||
|
|
||||||
To debug startup issues, in particular issues with getty/login, try
|
To debug startup issues, in particular issues with getty/login, add
|
||||||
`configure --enable-fallback-shell`. When no TTYs are detected, and
|
the following to your Finit .conf file:
|
||||||
Finit is configured with this option, Finit will try to start a bare
|
|
||||||
`/bin/sh` on the boot console. Remember, this is only for debugging
|
tty [12345789] notty noclear
|
||||||
and would leave your production system potentially wide open.
|
|
||||||
|
The `notty` option ensures reusing the stdin/stdout set up by the
|
||||||
|
kernel. Remember, this is only for debugging and would leave your
|
||||||
|
production system potentially wide open.
|
||||||
|
|
||||||
There is also a rescue shell available, in case Finit crashes and the
|
There is also a rescue shell available, in case Finit crashes and the
|
||||||
kernel usually reboots: `configure --enable-emergency-shell`. However,
|
kernel usually reboots: `configure --enable-emergency-shell`. However,
|
||||||
the behavior of Finit is severely limited when this is enabled, so use
|
the behavior of Finit is severely limited when this is enabled, so use
|
||||||
it only for debugging start up issues when Finit crashes.
|
it only for debugging start up issues when Finit crashes.
|
||||||
|
|
||||||
**NOTE:** Neither of these two configure options should be enabled on
|
**NOTE:** Neither of these options should be enabled on production
|
||||||
production systems since they can potentially give a user root access.
|
systems since they can potentially give a user root access.
|
||||||
|
|
||||||
|
|
||||||
[1]: ftp://troglobit.com/finit/finit-3.0.tar.xz
|
[1]: ftp://troglobit.com/finit/finit-3.0.tar.xz
|
||||||
|
|||||||
+36
-26
@@ -2,37 +2,47 @@ Tips & Tricks with the kernel cmdline
|
|||||||
=====================================
|
=====================================
|
||||||
|
|
||||||
This document summarizes the different boot parameters that can be
|
This document summarizes the different boot parameters that can be
|
||||||
passed on the Linux kernel command line. Not just limited to Finit.
|
passed on the Linux kernel command line. Not limited to Finit.
|
||||||
|
|
||||||
* `debug`, or `--debug`
|
The `bool` setting is one of `on, off, true false, 1, 0`.
|
||||||
Enable debug mode. The former syntax also enable kernel debug, and
|
|
||||||
the latter only in Finit. Debug messages are printed to the console
|
|
||||||
until a syslog daemon has been started.
|
|
||||||
|
|
||||||
* `init=/bin/sh`
|
|
||||||
Bypass system default init and tell kernel to start a shell. Note,
|
|
||||||
this shell is very limited and does not support signals and has no
|
|
||||||
job control. Recommend using, and modifying, `rescue` mode instead.
|
|
||||||
|
|
||||||
* `panic=SEC`
|
* `debug`: Enable kernel debug. Debug messages are printed to the
|
||||||
By default the kernel does not reboot after a kernel panic. This
|
console until Finit starts up.
|
||||||
setting will cause a kernel reboot after SEC seconds.
|
|
||||||
|
|
||||||
* `quiet`
|
* `finit.debug[=bool]`: Enable finit debug. This is operated
|
||||||
Suppress kernel logging to console, except for warnings and errors.
|
independently of the kernel debug setting. New as of Finit v4.
|
||||||
|
|
||||||
* `rescue`
|
* `finit.show_status[=bool]`: Control finit boot progress, including
|
||||||
Start Finit rescue mode; no network, no `fsck` of file systems in
|
banner.
|
||||||
`/etc/fstab`, no `/etc/rc.local`, no `runparts`. The configuration
|
|
||||||
is read from `/etc/rescue.conf`, can be modified by the operator.
|
|
||||||
|
|
||||||
* `single`, or `S`
|
* `finit.status_style=<classic,modern>`: Set Finit boot progress style,
|
||||||
Single user mode, runlevel 1, in Finit. Useful to debug problems with
|
when enabled.
|
||||||
the regular runlevel. All services and TTYs in `[1]` will be started,
|
|
||||||
so a `tty [1] @console nologin` configuration presents you with a
|
|
||||||
root console without login.
|
|
||||||
|
|
||||||
* `splash`
|
* `init=/bin/sh`: Bypass system default init and tell kernel to start a
|
||||||
Display Finit splash screen with progress at bootstrap and shutdown.
|
shell. Note, this shell is very limited and does not support
|
||||||
|
signals and has no job control. Recommend using, and modifying,
|
||||||
|
`rescue` mode instead.
|
||||||
|
|
||||||
For more on kernel boot paramaters, see the man page `bootparam(7)`.
|
* `panic=SEC`: By default the kernel does not reboot after a kernel
|
||||||
|
panic. This setting will cause a kernel reboot after SEC seconds.
|
||||||
|
|
||||||
|
* `quiet`: Suppress kernel logging to console, except for warnings and
|
||||||
|
errors.
|
||||||
|
|
||||||
|
* `rescue`: Start rescue/maintenance mode. If your system comes with
|
||||||
|
the bundled `sulogin` program (Finit, or from util-linux/Busybox),
|
||||||
|
you will be given a root login to a maintenance shell. However, if
|
||||||
|
`sulogin` is missing, the file `/lib/finit/rescue.conf` is read and
|
||||||
|
the system booted in a limited fallback mode. See [config.md][]
|
||||||
|
for more information.
|
||||||
|
|
||||||
|
* `single`, or `S`: Single user mode, runlevel 1, in Finit. Useful to
|
||||||
|
debug problems with the regular runlevel. All services and TTYs in
|
||||||
|
`[1]` will be started, so a `tty [1] @console nologin` configuration
|
||||||
|
presents you with a root console without login.
|
||||||
|
|
||||||
|
For more on kernel boot paramaters, see the man page [bootparam(7)][].
|
||||||
|
|
||||||
|
[config.md][]: config.md#rescue-mode
|
||||||
|
[bootparam(7)]: https://www.man7.org/linux/man-pages/man7/bootparam.7.html
|
||||||
|
|||||||
+82
-43
@@ -17,8 +17,8 @@ Conditions are a new addition to Finit, introduced in v3, with the
|
|||||||
intention of providing a mechanism for common synchronization problems.
|
intention of providing a mechanism for common synchronization problems.
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
- *"do not start this service until another process has started"*, or
|
- *"wait for service A to start before starting service B"*, or
|
||||||
- *"do not starty until basic network access is available"*
|
- *"wait for basic network access to be available"*
|
||||||
|
|
||||||
Conditions are similar in syntax to declaring runlevels per service.
|
Conditions are similar in syntax to declaring runlevels per service.
|
||||||
They are specified within angle brackets `<>` and can be applied to any
|
They are specified within angle brackets `<>` and can be applied to any
|
||||||
@@ -30,14 +30,12 @@ service to run.
|
|||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
```shell
|
service [2345] <pid/setupd,pid/zebra> /sbin/netd -- Network monitor
|
||||||
service [2345] <svc/sbin/setupd,svc/sbin/zebra> /sbin/netd -- Network monitor
|
|
||||||
```
|
|
||||||
|
|
||||||
In this example the Network monitor daemon `netd` is not started until
|
In this example the Network monitor daemon `netd` is not started until
|
||||||
both the `svc/sbin/setupd` *and* `svc/sbin/zebra` conditions are
|
both the `pid/setupd` *and* `pid/zebra` conditions are satisfied. A
|
||||||
satisfied. An `svc` condition is satisfied by the corresponding
|
`pid/` condition is satisfied by the corresponding service's PID file
|
||||||
service's PID file being created.
|
being created.
|
||||||
|
|
||||||
**NOTE:** Conditions also stop services when a condition is no longer
|
**NOTE:** Conditions also stop services when a condition is no longer
|
||||||
asserted. I.e., if the Zebra process above stops or restarts, netd
|
asserted. I.e., if the Zebra process above stops or restarts, netd
|
||||||
@@ -47,7 +45,31 @@ service's PID file being created.
|
|||||||
Triggering
|
Triggering
|
||||||
----------
|
----------
|
||||||
|
|
||||||
Conditions can only be triggered by built-in plugins.
|
Conditions are mainly triggered (asserted) by built-in plugins, e.g.,
|
||||||
|
`netlink.so` and `pidfile.so`, see below for built-in conditions. Finit
|
||||||
|
also supports user-defined conditions, sometimes referred to as static
|
||||||
|
or one-shot conditions. They live in the `<usr/...` namespace and are
|
||||||
|
constrained to a flat hierarchy without any sub-directories, unlike the
|
||||||
|
pidfile plugin, for instance.
|
||||||
|
|
||||||
|
User-defined conditions are controlled using the `initctl cond set` and
|
||||||
|
`initctl cond clear` commands:
|
||||||
|
|
||||||
|
initctl cond set foo
|
||||||
|
initctl cond clear foo
|
||||||
|
|
||||||
|
The purpose of user-defined conditions is to be able to start or stop
|
||||||
|
services, or run/task jobs, on external site-dependent stimuli.
|
||||||
|
Example:
|
||||||
|
|
||||||
|
service [2345] <usr/foo> alarm --arg foo -- Foo alarm
|
||||||
|
|
||||||
|
For convenience, prefixing with `usr/` is allowed, but any other slashes
|
||||||
|
or period characters are disallowed. E.g., to trigger the `Foo alarm`,
|
||||||
|
the same as above, can also be achieved like this:
|
||||||
|
|
||||||
|
initctl cond set usr/foo
|
||||||
|
initctl cond clear usr/foo
|
||||||
|
|
||||||
Conditions retain their current state until the next reconfiguration or
|
Conditions retain their current state until the next reconfiguration or
|
||||||
runlevel change. At that point all set conditions transition into the
|
runlevel change. At that point all set conditions transition into the
|
||||||
@@ -56,32 +78,35 @@ on this, see [Internals](#internals).) Thus, after a reconfiguration it
|
|||||||
is up to the "owner" of the condition to convey the new (or possibly
|
is up to the "owner" of the condition to convey the new (or possibly
|
||||||
unchanged) state of it.
|
unchanged) state of it.
|
||||||
|
|
||||||
|
> **Note:** For `pid/` conditions it is expected that services "touch"
|
||||||
|
> or recreate their PID file on `SIGHUP`.
|
||||||
|
|
||||||
|
Static (one-shot) conditions, like `usr/`, never enter the `flux` state.
|
||||||
|
|
||||||
|
|
||||||
Built-in Conditions
|
Built-in Conditions
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
Finit is distributed with a `pidfile` and `netlink` plugin. If enabled,
|
Finit comes with a `pidfile` and `netlink` plugin. When enabled, the
|
||||||
the `pidfile` plugin watches `/var/run/` for PID files created by the
|
`pidfile` plugin watches `/var/run/` (recursively) for PID files created
|
||||||
monitored services, and sets a corresponding condition in the `svc/`
|
by the monitored services, and sets a corresponding condition in the
|
||||||
namespace. Similarily, the `netlink` plugin provides basic conditions
|
`pid/` namespace. Similarily, the `netlink` plugin provides basic
|
||||||
for when an interface is brought up/down and when a default route
|
conditions for when an interface is brought up/down and when a default
|
||||||
(gateway) is set, in the `net/` namespace.
|
route (gateway) is set, in the `net/` namespace.
|
||||||
|
|
||||||
With the example listed above, finit does not start the `/sbin/netd`
|
With the example listed above, finit does not start the `/sbin/netd`
|
||||||
daemon until `setupd` and `zebra` has started *and* created their PID
|
daemon until `setupd` and `zebra` has started *and* created their PID
|
||||||
files. Which they do when they have completed their initial set up and
|
files. Which they do when they have completed their initial set up and
|
||||||
are ready to receive signals.
|
are ready to receive signals.
|
||||||
|
|
||||||
The full path to the dependency is needed by finit to match the PID file
|
Finit expects monitored services to touch their PID files, i.e. update
|
||||||
to a monitored process. Finit expects monitored services to touch their
|
the mtime, when they reload their configuration files after a `SIGHUP`.
|
||||||
PID files, i.e. update the mtime, when they reload their configuration
|
Some services do not support `SIGHUP` and are instead restarted, which
|
||||||
files after a `SIGHUP`. Some services do not support `SIGHUP` and are
|
is a crude but effective way to have the PID file touched (re-created).
|
||||||
instead restarted, which is a crude but effective way to have the PID
|
|
||||||
file touched (re-created).
|
|
||||||
|
|
||||||
Built-in conditions:
|
Built-in conditions:
|
||||||
|
|
||||||
- `svc/<PATH>`
|
- `pid/<SERVICE>`
|
||||||
- `net/route/default`
|
- `net/route/default`
|
||||||
- `net/<IFNAME>/exist`
|
- `net/<IFNAME>/exist`
|
||||||
- `net/<IFNAME>/up`
|
- `net/<IFNAME>/up`
|
||||||
@@ -95,20 +120,34 @@ Built-in conditions:
|
|||||||
Composition
|
Composition
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
The `svc/` conditions can be quite tricky to understand. They are
|
The `pid/` conditions are generated by the Finit `pidfile.so` plugin and
|
||||||
generated by the Finit `pidfile.so` plugin and are composed from the
|
composed from a service's `name:` and `:id`. By default the basename of
|
||||||
daemon's path and the pidfile name (and path).
|
the daemon and the empty string.
|
||||||
|
|
||||||
| **service** | **pid:** | **pidfile path** | **svc condition** |
|
| **service** | **condition** |
|
||||||
|--------------------------------------|-----------------|------------------|-------------------|
|
|----------------------------------------------------|------------------|
|
||||||
| /sbin/foo | | /run/foo.pid | svc/sbin/foo |
|
| /sbin/foo | pid/foo |
|
||||||
| /sbin/bar -p /run/baz.pid | pid:baz | /run/bas.pid | svc/sbin/baz |
|
| /sbin/bar -p /run/baz.pid | pid/bar |
|
||||||
| lxc-start -n foo -p /run/lxc/foo.pid | pid:lxc/foo.pid | /run/lxc/foo.pid | svc/lxc/foo |
|
| name:lxc :foo lxc-start -n foo -p /run/lxc/foo.pid | pid/lxc:foo |
|
||||||
| /usr/bin/dbus-daemon | pid:dbus/pid | /run/dbus/pid | svc/usr/bin/dbus |
|
| /usr/bin/dbus-daemon | pid/dbus-daemon |
|
||||||
|
| :222 dropbear -p 222 | pid/dropbear:222 |
|
||||||
|
|
||||||
Omitting the `pid:` to run/task/service/sysv stanza means Finit will
|
The condition is asserted when `pidfile.so` receives an inotify event
|
||||||
guess the pidfile path based on `/run/` and the basename(1) of the
|
for a file matching `/run/*.pid`, `/run/**/*.pid`, or `/run/**/pid`,
|
||||||
program.
|
which contains the PID of the service Finit has started.
|
||||||
|
|
||||||
|
When Finit configuration files are changed and the `initctl reload`
|
||||||
|
command is called, it is expected of services to touch their PID files
|
||||||
|
for Finit to reassert their conditions.
|
||||||
|
|
||||||
|
Daemons that don't create PID files, or fail to touch them on reload,
|
||||||
|
can be worked around by using the `pid:/path/to/file.pid` syntax in
|
||||||
|
the service stanza for the daemon. It is far from optimal since any
|
||||||
|
synchronization of depending services may fail due to the daemon not
|
||||||
|
having reinitialized/created their IPC sockets, or similar.
|
||||||
|
|
||||||
|
> **Note:** in versions of Finit prior to v4, the PID conditions were
|
||||||
|
> called 'svc' conditions, and they were far more complex.
|
||||||
|
|
||||||
|
|
||||||
Debugging
|
Debugging
|
||||||
@@ -125,11 +164,11 @@ conditions that are not satisfied. Listed as `off` below.
|
|||||||
**Example:**
|
**Example:**
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
~ # initctl cond show
|
~ # initctl cond show
|
||||||
PID Service Status Condition (+ on, ~ flux, - off)
|
PID IDENT STATUS CONDITION (+ ON, ~ FLUX, - OFF)
|
||||||
===============================================================================
|
=======================================================================
|
||||||
1419 /sbin/netd on <+svc/sbin/setupd,+svc/sbin/zebra>
|
1419 /sbin/netd on <+pid/setupd,+pid/zebra>
|
||||||
0 /sbin/udhcpc off <-net/vlan1/exist>
|
0 /sbin/udhcpc off <-net/vlan1/exist>
|
||||||
```
|
```
|
||||||
|
|
||||||
Here we can see that `netd` is allowed to run since both its conditions
|
Here we can see that `netd` is allowed to run since both its conditions
|
||||||
@@ -141,9 +180,9 @@ To fake interface `vlan1` suddenly appearing, and test what happens to
|
|||||||
`udhcpc` we can enable debug mode and assert the condition, like this:
|
`udhcpc` we can enable debug mode and assert the condition, like this:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
~ # initctl debug
|
~ # initctl debug
|
||||||
~ # mkdir -p /var/run/finit/cond/net/vlan1
|
~ # mkdir -p /var/run/finit/cond/net/vlan1
|
||||||
~ # cp /var/run/finit/cond /var/run/finit/cond/net/vlan1/exist
|
~ # cp /var/run/finit/cond /var/run/finit/cond/net/vlan1/exist
|
||||||
```
|
```
|
||||||
|
|
||||||
Then watch the console for the debug messages and then check the output
|
Then watch the console for the debug messages and then check the output
|
||||||
@@ -151,7 +190,7 @@ from `initctl cond show` again. The client will likely have failed to
|
|||||||
start, but at least the condition is now satisfied.
|
start, but at least the condition is now satisfied.
|
||||||
|
|
||||||
There is also the `initctl cond dump` command, which dumps all known
|
There is also the `initctl cond dump` command, which dumps all known
|
||||||
conditions and their current status.
|
conditions, their current status, and their origin.
|
||||||
|
|
||||||
|
|
||||||
Internals
|
Internals
|
||||||
|
|||||||
+556
-309
@@ -2,27 +2,45 @@ Configuration
|
|||||||
=============
|
=============
|
||||||
|
|
||||||
* [Introduction](#introduction)
|
* [Introduction](#introduction)
|
||||||
|
* [Service Environment](#service-environment)
|
||||||
* [Service Wrapper Scripts](#service-wrapper-scripts)
|
* [Service Wrapper Scripts](#service-wrapper-scripts)
|
||||||
* [Syntax](#syntax)
|
* [Cgroups](#cgroups)
|
||||||
|
* [Configuration File Syntax](#configuration-file-syntax)
|
||||||
|
* [Hostname](#hostname)
|
||||||
|
* [Kernel Modules](#kernel-modules)
|
||||||
|
* [Networking](#networking)
|
||||||
|
* [Resource Limits](#resource-limits)
|
||||||
|
* [Runlevels](#runlevels)
|
||||||
|
* [One-shot Commands (sequence)](#one-shot-commands--sequence-)
|
||||||
|
* [One-shot Commands (parallel)](#one-shot-commands--parallel-)
|
||||||
|
* [SysV Init Scripts](#sysv-init-scripts)
|
||||||
|
* [Services](#services)
|
||||||
|
* [Run-parts Scripts](#run-parts-scripts)
|
||||||
|
* [Including Finit Configs](#including-finit-configs)
|
||||||
|
* [General Logging](#general-logging)
|
||||||
|
* [TTYs and Consoles](#ttys-and-consoles)
|
||||||
|
* [Non-privileged Services](#non-privileged-services)
|
||||||
|
* [Redirecting Output](#redirecting-output)
|
||||||
|
* [Rescue Mode](#rescue-mode)
|
||||||
* [Limitations](#limitations)
|
* [Limitations](#limitations)
|
||||||
* [/etc/finit.conf](#etcfinitconf)
|
* [/etc/finit.conf](#etcfinitconf)
|
||||||
* [/etc/finit.d](#etcfinitd)
|
* [/etc/finit.d](#etcfinitd)
|
||||||
|
* [Watchdog](#watchdog)
|
||||||
|
|
||||||
|
|
||||||
Introduction
|
Introduction
|
||||||
------------
|
------------
|
||||||
|
|
||||||
Finit can be configured using only the original `/etc/finit.conf` file
|
Finit can be configured using only the original `/etc/finit.conf` file
|
||||||
or in combination with `/etc/finit.d/*.conf`. Finit 3 can even start a
|
or in combination with `/etc/finit.d/*.conf`. Useful for package-based
|
||||||
system using only `/etc/finit.d/*.conf`, highly useful for package-based
|
|
||||||
Linux distributions -- each package can provide its own "script" file.
|
Linux distributions -- each package can provide its own "script" file.
|
||||||
|
|
||||||
- `/etc/finit.conf`: main configuration file
|
- `/etc/finit.conf`: main configuration file
|
||||||
- `/etc/finit.d/*.conf`: snippets, usually one service per file
|
- `/etc/finit.d/*.conf`: snippets, usually one service per file
|
||||||
|
|
||||||
Not all configuration directives are available in `/etc/finit.d/*.conf`
|
Not all configuration directives are available in `/etc/finit.d/*.conf`
|
||||||
and some directives are only available at bootstrap, runlevel `S`, see
|
and some directives are only available at [bootstrap][], runlevel `S`,
|
||||||
the section [Limitations](#limitations) below for details.
|
see the section [Limitations](#limitations) below for details.
|
||||||
|
|
||||||
To add a new service, simply drop a `.conf` file in `/etc/finit.d` and
|
To add a new service, simply drop a `.conf` file in `/etc/finit.d` and
|
||||||
run `initctl reload`. (It is also possible to `SIGHUP` to PID 1, or
|
run `initctl reload`. (It is also possible to `SIGHUP` to PID 1, or
|
||||||
@@ -49,6 +67,38 @@ On `initctl reload` the following is checked for all services:
|
|||||||
For more info on the different states of a service, see the separate
|
For more info on the different states of a service, see the separate
|
||||||
document [Finit Services](service.md).
|
document [Finit Services](service.md).
|
||||||
|
|
||||||
|
> When running <kbd>make install</kbd> no default `/etc/finit.conf` is
|
||||||
|
> installed since system requirements differ too much. There are some
|
||||||
|
> examples in the `contrib/` directory, which can be used as a base.
|
||||||
|
|
||||||
|
|
||||||
|
Service Environment
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
Finit supports sourcing environment variables from `/etc/default/*`, or
|
||||||
|
similar `--with-sysconfig=DIR`. This is a common pattern from SysV init
|
||||||
|
scripts, where the start-stop script is a generic script for the given
|
||||||
|
service, `foo`, and the options for the service are sourced from the
|
||||||
|
file `/etc/default/foo`. Like this:
|
||||||
|
|
||||||
|
* `/etc/default/foo`:
|
||||||
|
|
||||||
|
FOO_OPTIONS=--extra-arg="bar" -s -x
|
||||||
|
|
||||||
|
* `/etc/finit.conf`:
|
||||||
|
|
||||||
|
service [2345] env:-/etc/default/foo foo -n $FOO_OPTIONS -- Example foo daemon
|
||||||
|
|
||||||
|
Here the service `foo` is started with `-n`, to make sure it runs in the
|
||||||
|
foreground, and the with the options found in the environment file. With
|
||||||
|
the `ps` command we can see that the process is started with:
|
||||||
|
|
||||||
|
foo -n --extra-arg=bar -s -x
|
||||||
|
|
||||||
|
> **Note:** the leading `-` determines if Finit should treat a missing
|
||||||
|
> environment file as blocking the start of the service or not. When
|
||||||
|
> `-` is used, a missing environment file does *not* block the start.
|
||||||
|
|
||||||
|
|
||||||
Service Wrapper Scripts
|
Service Wrapper Scripts
|
||||||
-----------------------
|
-----------------------
|
||||||
@@ -65,333 +115,470 @@ example employs a wrapper script in `/etc/start.d`.
|
|||||||
**Example:**
|
**Example:**
|
||||||
|
|
||||||
* `/etc/finit.d/available/program.conf`:
|
* `/etc/finit.d/available/program.conf`:
|
||||||
```conf
|
|
||||||
service [235] <!> /etc/start.d/program -- Example Program
|
service [235] <!> /etc/start.d/program -- Example Program
|
||||||
```
|
|
||||||
|
|
||||||
* `/etc/start.d/program:`
|
* `/etc/start.d/program:`
|
||||||
```shell
|
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Prepare the command line options
|
#!/bin/sh
|
||||||
OPTIONS="-u $(cat /etc/username)"
|
# Prepare the command line options
|
||||||
|
OPTIONS="-u $(cat /etc/username)"
|
||||||
|
|
||||||
# Execute the program
|
# Execute the program
|
||||||
exec /usr/bin/program $OPTIONS
|
exec /usr/bin/program $OPTIONS
|
||||||
```
|
|
||||||
|
|
||||||
**Note:**, that the example sets `<!>` to denote that it doesn't support
|
> **Note:** the example sets `<!>` to denote that it doesn't support
|
||||||
`SIGHUP`. That way Finit will stop/start such the service instead of
|
> `SIGHUP`. That way Finit will stop/start the service
|
||||||
sending SIGHUP at restart/reload.
|
> instead of sending SIGHUP at restart/reload events.
|
||||||
|
|
||||||
|
|
||||||
Syntax
|
Cgroups
|
||||||
------
|
-------
|
||||||
|
|
||||||
* `host <NAME>`, or `hostname <NAME>`
|
There are three major cgroup configuration directives:
|
||||||
Set system hostname to NAME, unless `/etc/hostname` exists in which
|
|
||||||
case the contents of that file is used.
|
|
||||||
|
|
||||||
* `module <MODULE> [ARGS]`
|
1. Global top-level group: init, system, user, or a custom group
|
||||||
Load a kernel module, with optional arguments. Similar to `insmod`
|
2. Selecting a top-level group for a set of run/task/services
|
||||||
command line tool.
|
3. Per run/task/service limits
|
||||||
|
|
||||||
Note, there is both a `modules-load.so` and a `modprobe.so` plugin
|
Top-level group configuration.
|
||||||
that can handle module loading better. The former supports loading
|
|
||||||
from `/etc/modules-load.d/`, and the latter uses kernel modinfo to
|
|
||||||
automatically load (or coldplug) every required module. For hotplug
|
|
||||||
we recommend the BusyBox mdev tool, add to `/etc/mdev.conf`:
|
|
||||||
|
|
||||||
$MODALIAS=.* root:root 0660 @modprobe -b "$MODALIAS"
|
# Top-level cgroups and their default settings. All groups mandatory
|
||||||
|
# but more can be added, max 8 groups in total currently. The cgroup
|
||||||
|
# 'root' is also available, reserved for RT processes. Settings are
|
||||||
|
# as-is, only one shorthand 'mem.' exists, other than that it's the
|
||||||
|
# cgroup v2 controller default names.
|
||||||
|
cgroup init cpu.weight:100
|
||||||
|
cgroup user cpu.weight:100
|
||||||
|
cgroup system cpu.weight:9800
|
||||||
|
|
||||||
* `network <PATH>`
|
Adding an extra cgroup `maint/` will require you to adjust the weight of
|
||||||
Script or program to bring up networking, with optional arguments
|
the above three. We leave `init/` and `user /` as-is reducing weight of
|
||||||
|
`system/` to 9700.
|
||||||
|
|
||||||
* `rlimit [hard|soft] RESOURCE <LIMIT|unlimited>` Set the hard or soft
|
cgroup system cpu.weight:9700
|
||||||
limit for a resource, or both if that argument is omitted. `RESOURCE`
|
|
||||||
is the lower-case `RLIMIT_` string constants from `setrlimit(2)`,
|
# Example extra cgroup 'maint'
|
||||||
without the prefix. E.g. to set `RLIMIT_CPU`, use `cpu`.
|
cgroup maint cpu.weight:100
|
||||||
|
|
||||||
|
By default, the `system/` cgroup is selected for almost everything. The
|
||||||
|
`init/` cgroup is reserved for PID 1 itself and its closest relatives.
|
||||||
|
The `user/` cgroup is for local TTY logins spawned by getty.
|
||||||
|
|
||||||
|
To select a different top-level cgroup, e.g. `maint/`, one can either
|
||||||
|
define it for a group of run/task/service directives in a `.conf` or per
|
||||||
|
each stanza:
|
||||||
|
|
||||||
|
cgroup.maint
|
||||||
|
service [...] <...> /path/to/foo args -- description
|
||||||
|
service [...] <...> /path/to/bar args -- description
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
service [...] <...> cgroup.maint /path/to/foo args -- description
|
||||||
|
|
||||||
|
The latter form also allows per-stanza limits on the form:
|
||||||
|
|
||||||
|
service [...] <...> cgroup.maint:cpu.max:10000,mem.max:655360 /path/to/foo args -- description
|
||||||
|
|
||||||
|
Notice the comma separation and the `mem.` exception to the rule: every
|
||||||
|
cgroup setting maps directly to cgroup v2 syntax. I.e., `cpu.max` maps
|
||||||
|
to the file `/sys/fs/cgroup/maint/foo/cpu.max`. There is not filtering,
|
||||||
|
except for expanding the shorthand `mem.` to `memory.`, if the file is
|
||||||
|
not available, either the cgroup controller is not available in your
|
||||||
|
Linux kernel, or the name is misspelled.
|
||||||
|
|
||||||
|
> Linux cgroups and details surrounding values are not explained in the
|
||||||
|
> Finit documentation. The Linux admin-guide cover this well:
|
||||||
|
> <https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html>
|
||||||
|
|
||||||
|
|
||||||
|
Configuration File Syntax
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
### Hostname
|
||||||
|
|
||||||
|
**Syntax:** `host <NAME>`, or `hostname <NAME>`
|
||||||
|
|
||||||
|
Set system hostname to NAME, unless `/etc/hostname` exists in which case
|
||||||
|
the contents of that file is used.
|
||||||
|
|
||||||
|
Deprecated. We recommend using `/etc/hostname` instead.
|
||||||
|
|
||||||
|
> **Note:** only read and executed in runlevel S ([bootstrap][]).
|
||||||
|
|
||||||
|
|
||||||
|
### Kernel Modules
|
||||||
|
|
||||||
|
**Syntax:** `module <MODULE> [ARGS]`
|
||||||
|
|
||||||
|
Load a kernel module, with optional arguments. Similar to `insmod`
|
||||||
|
command line tool.
|
||||||
|
|
||||||
|
Deprecated, there is both a `modules-load.so` and a `modprobe.so` plugin
|
||||||
|
that can handle module loading better. The former supports loading from
|
||||||
|
`/etc/modules-load.d/`, the latter uses kernel modinfo to automatically
|
||||||
|
load (or coldplug) every required module. For hotplug we recommend the
|
||||||
|
BusyBox mdev tool, add to `/etc/mdev.conf`:
|
||||||
|
|
||||||
|
$MODALIAS=.* root:root 0660 @modprobe -b "$MODALIAS"
|
||||||
|
|
||||||
|
> **Note:** only read and executed in runlevel S ([bootstrap][]).
|
||||||
|
|
||||||
|
|
||||||
|
### Networking
|
||||||
|
|
||||||
|
**Syntax:** `network <PATH>`
|
||||||
|
|
||||||
|
Script or program to bring up networking, with optional arguments.
|
||||||
|
|
||||||
|
Deprecated. We recommend using dedicated task/run stanzas per runlevel,
|
||||||
|
or `/etc/network/interfaces` if you have a system with `ifupdown`, like
|
||||||
|
Debian, Ubuntu, Linux Mint, or an embedded BusyBox system.
|
||||||
|
|
||||||
|
> **Note:** only read and executed in runlevel S ([bootstrap][]).
|
||||||
|
|
||||||
|
|
||||||
|
### Resource Limits
|
||||||
|
|
||||||
|
**Syntax:** `rlimit [hard|soft] RESOURCE <LIMIT|unlimited>`
|
||||||
|
|
||||||
|
Set the hard or soft limit for a resource, or both if that argument is
|
||||||
|
omitted. `RESOURCE` is the lower-case `RLIMIT_` string constants from
|
||||||
|
`setrlimit(2)`, without prefix. E.g. to set `RLIMIT_CPU`, use `cpu`.
|
||||||
|
|
||||||
LIMIT is an integer that depends on the resource being modified, see
|
LIMIT is an integer that depends on the resource being modified, see
|
||||||
the man page, or the kernel `/proc/PID/limits` file, for details.
|
the man page, or the kernel `/proc/PID/limits` file, for details.
|
||||||
Finit versions before v3.1 used `infinity` for `unlimited`, which is
|
Finit versions before v3.1 used `infinity` for `unlimited`, which is
|
||||||
still supported, albeit deprecated.
|
still supported, albeit deprecated.
|
||||||
|
|
||||||
```shell
|
# No process is allowed more than 8MB of address space
|
||||||
# No process is allowed more than 8MB of address space
|
rlimit hard as 8388608
|
||||||
rlimit hard as 8388608
|
|
||||||
|
|
||||||
# Core dumps may be arbitrarily large
|
# Core dumps may be arbitrarily large
|
||||||
rlimit soft core infinity
|
rlimit soft core infinity
|
||||||
|
|
||||||
# CPU limit for all services, soft & hard = 10 sec
|
# CPU limit for all services, soft & hard = 10 sec
|
||||||
rlimit cpu 10
|
rlimit cpu 10
|
||||||
```
|
|
||||||
|
|
||||||
`rlimit` can be set globally, in `/etc/finit.conf`, or locally for
|
`rlimit` can be set globally, in `/etc/finit.conf`, or locally per
|
||||||
a set of task/run/services, in `/etc/finit.d/*.conf`.
|
each `/etc/finit.d/*.conf` read. I.e., a set of task/run/service
|
||||||
|
stanzas can share the same rlimits if they are in the same .conf.
|
||||||
|
|
||||||
* `runlevel <N>`
|
|
||||||
N is the runlevel number 1-9, where 6 is reserved for reboot.
|
|
||||||
Default is 2.
|
|
||||||
|
|
||||||
* `run [LVLS] <COND> /path/to/cmd ARGS -- Optional description`
|
### Runlevels
|
||||||
One-shot command to run in sequence when entering a runlevel, with
|
|
||||||
optional arguments and description.
|
**Syntax:** `runlevel <N>`
|
||||||
|
|
||||||
|
The system runlevel to go to after [bootstrap][] (S) has completed. `N`
|
||||||
|
is the runlevel number 0-9, where 6 is reserved for reboot and 0 for
|
||||||
|
halt.
|
||||||
|
|
||||||
|
Default: 2
|
||||||
|
|
||||||
|
> **Note:** only read and executed in runlevel S ([bootstrap][]).
|
||||||
|
|
||||||
|
|
||||||
|
### One-shot Commands (sequence)
|
||||||
|
|
||||||
|
**Syntax:** `run [LVLS] <COND> /path/to/cmd ARGS -- Optional description`
|
||||||
|
|
||||||
|
One-shot command to run in sequence when entering a runlevel, with
|
||||||
|
optional arguments and description.
|
||||||
|
|
||||||
`run` commands are guaranteed to be completed before running the next
|
`run` commands are guaranteed to be completed before running the next
|
||||||
command. Highly useful if true serialization is needed.
|
command. Highly useful if true serialization is needed.
|
||||||
|
|
||||||
* `task [LVLS] <COND> /path/to/cmd ARGS -- Optional description`
|
> `<COND>` is described in the [Services](#services) section.
|
||||||
One-shot like 'run', but starts in parallel with the next command.
|
|
||||||
|
|
||||||
|
### One-shot Commands (parallel)
|
||||||
|
|
||||||
|
**Syntax:** `task [LVLS] <COND> /path/to/cmd ARGS -- Optional description`
|
||||||
|
|
||||||
|
One-shot like 'run', but starts in parallel with the next command.
|
||||||
|
|
||||||
Both `run` and `task` commands are run in a shell, so pipes and
|
Both `run` and `task` commands are run in a shell, so pipes and
|
||||||
redirects can be freely used:
|
redirects can be freely used:
|
||||||
|
|
||||||
```shell
|
task [s] echo "foo" | cat >/tmp/bar
|
||||||
task [s] echo "foo" | cat >/tmp/bar
|
|
||||||
```
|
|
||||||
|
|
||||||
* `sysv [LVLS] <COND> /path/to/init-script -- Optional description`__
|
> `<COND>` is described in the [Services](#services) section.
|
||||||
Similar to `task` is the `sysv` stanza, which can be used to call SysV
|
|
||||||
style scripts. The primary intention for this command is to be able to
|
|
||||||
re-use much of existing setup and init scripts in Linux distributions.
|
### SysV Init Scripts
|
||||||
|
|
||||||
|
**Syntax:** `sysv [LVLS] <COND> /path/to/init-script -- Optional description`
|
||||||
|
|
||||||
|
Similar to `task` is the `sysv` stanza, which can be used to call SysV
|
||||||
|
style scripts. The primary intention for this command is to be able to
|
||||||
|
re-use much of existing setup and init scripts in Linux distributions.
|
||||||
|
|
||||||
When entering an allowed runlevel, Finit calls `init-script start`,
|
When entering an allowed runlevel, Finit calls `init-script start`, when
|
||||||
when entering a disallowed runlevel, Finit calls `init-script stop`,
|
entering a disallowed runlevel, Finit calls `init-script stop`, and if
|
||||||
and if the Finit .conf, where `sysv` stanza is declared, is modified,
|
the Finit .conf, where `sysv` stanza is declared, is modified, Finit
|
||||||
Finit calls `init-script restart` on `initctl reload`. Similar to
|
calls `init-script restart` on `initctl reload`. Similar to how
|
||||||
how `service` stanzas work.
|
`service` stanzas work.
|
||||||
|
|
||||||
Forking services started with `sysv` scripts can be monitored by Finit
|
Forking services started with `sysv` scripts can be monitored by Finit
|
||||||
by declaring the PID file to look for: `pid:!/path/to/pidfile.pid`.
|
by declaring the PID file to look for: `pid:!/path/to/pidfile.pid`.
|
||||||
|
|
||||||
|
> `<COND>` is described in the [Services](#services) section.
|
||||||
|
|
||||||
|
|
||||||
|
### Services
|
||||||
|
|
||||||
|
**Syntax:** `service [LVLS] <COND> /path/to/daemon ARGS -- Optional description`
|
||||||
|
|
||||||
|
Service, or daemon, to be monitored and automatically restarted if it
|
||||||
|
exits prematurely. Finit tries to restart services that die 10 times
|
||||||
|
before giving up, then you have to `initctl restart NAME` it manually.
|
||||||
|
|
||||||
* `service [LVLS] <COND> /path/to/daemon ARGS -- Optional description`
|
For daemons that support it, we recommend appending `--foreground`,
|
||||||
Service, or daemon, to be monitored and automatically restarted if it
|
`--no-background`, `-n`, `-F`, or similar command line argument to
|
||||||
exits prematurely.
|
prevent them from forking off a sub-process in the background. This is
|
||||||
|
the most reliable way to monitor a service.
|
||||||
|
|
||||||
|
However, not all daemons support running in the foreground, or they may
|
||||||
|
start logging to the foreground as well, these are called forking
|
||||||
|
services and are supported using the same syntax as forking `sysv`
|
||||||
|
services, using the `pid:!/path/to/pidfile.pid` syntax.
|
||||||
|
|
||||||
For daemons that support it, we recommend appending `--foreground`, or
|
**Example:**
|
||||||
`--no-background`, argument to prevent them from forking off a
|
|
||||||
sub-process in the background. This is the most reliable way to
|
|
||||||
monitor a service.
|
|
||||||
|
|
||||||
However, not all daemons support running in the foreground, or they
|
In the case of `ospfd` (below), we omit the `-d` flag (daemonize) to
|
||||||
may start logging to the foreground as well, these are called forking
|
prevent it from forking to the background:
|
||||||
services and are supported using the same syntax as forking `sysv`
|
|
||||||
services, using the `pid:!/path/to/pidfile.pid` syntax.
|
service [2345] <pid/zebra> /sbin/ospfd -- OSPF daemon
|
||||||
|
|
||||||
|
`[2345]` denote the runlevels `ospfd` is allowed to run in, they are
|
||||||
|
optional and default to level 2-5 if omitted.
|
||||||
|
|
||||||
In the case of `ospfd` (below), we omit the `-d` flag to prevent it
|
`<...>` is the condition for starting `ospfd`. In this example Finit
|
||||||
from forking (daemonizing):
|
waits for another service, `zebra`, to have created its PID file in
|
||||||
|
`/var/run/quagga/zebra.pid` before starting `ospfd`. Finit watches
|
||||||
|
*all* files in `/var/run`, for each file named `*.pid`, or `*/pid`,
|
||||||
|
Finit opens it and find the matching `NAME:ID` using the PID.
|
||||||
|
|
||||||
```shell
|
Some services do not maintain a PID file and rather than patching each
|
||||||
service [2345] <svc/sbin/zebra> /sbin/ospfd -- OSPF daemon
|
application Finit provides a workaround. A `pid` keyword can be set
|
||||||
```
|
to have Finit automatically create (when starting) and later remove
|
||||||
|
(when stopping) the PID file. The file is created in the `/var/run`
|
||||||
|
directory using the `basename(1)` of the service. The default can be
|
||||||
|
modified with an optional `pid:`-argument:
|
||||||
|
|
||||||
The `[2345]` is the runlevels `ospfd` is allowed to run in, they are
|
pid[:[/path/to/]filename[.pid]]
|
||||||
optional and default to level 2-5 if left out.
|
|
||||||
|
For example, by adding `pid:/run/foo.pid` to the service `/sbin/bar`,
|
||||||
|
that PID file will, not only be created and removed automatically, but
|
||||||
|
also be used by the Finit condition subsystem. So a service/run/task
|
||||||
|
can depend on `<pid/bar>`.
|
||||||
|
|
||||||
|
> For a detailed description of conditions, and how to debug them,
|
||||||
|
> see the [Finit Conditions](conditions.md) document.
|
||||||
|
|
||||||
|
If a service should not be automatically started, it can be configured
|
||||||
|
as manual with the optional `manual` argument. The service can then be
|
||||||
|
started at any time by running `initctl start <service>`.
|
||||||
|
|
||||||
|
manual:yes
|
||||||
|
|
||||||
|
The name of a service, shown by the `initctl` tool, defaults to the
|
||||||
|
basename of the service executable. It can be changed with the
|
||||||
|
optional `name` argument:
|
||||||
|
|
||||||
|
name:<service-name>
|
||||||
|
|
||||||
|
When stopping a service (run/task/sysv/service), either manually or
|
||||||
|
when moving to another runlevel, Finit starts by sending `SIGTERM`, to
|
||||||
|
allow the process to shut down gracefully. If the process has not
|
||||||
|
been collected within 3 seconds, Finit sends `SIGKILL`. To halt the
|
||||||
|
process using a different signal, use the option `halt:SIGNAL`, e.g.,
|
||||||
|
`halt:SIGPWR`. To change the delay between your halt signal and KILL,
|
||||||
|
use the option `kill:SEC`, e.g., `kill:10` to wait 10 seconds before
|
||||||
|
sending `SIGKILL`.
|
||||||
|
|
||||||
|
Services support `pre:script` and `post:script` actions as well. These
|
||||||
|
run as the same `@USER:GROUP` as the service itself, with any `env:file`
|
||||||
|
sourced. The scripts must use an absolute path, but are executed from
|
||||||
|
the `$HOME` of the given user. The scripts are not called with any
|
||||||
|
argument (currently), but both get the `SERVICE_IDENT=foo` environment
|
||||||
|
variable set. Here `foo` denotes the identity of the service, which if
|
||||||
|
there are multiple services named `foo`, may be `foo:1`, or any unique
|
||||||
|
identifier specified in the .conf file. The `post:script` is called
|
||||||
|
with an additional set of environment variables:
|
||||||
|
|
||||||
|
- `EXIT_CODE=[exited,signal]`: set to one of `exited` or `signal`
|
||||||
|
- `EXIT_STATUS=[num,SIGNAME]`: set to one of exit status code from
|
||||||
|
the program, if it exited normally, or the signal name (`HUP`,
|
||||||
|
`TERM`, etc.) if it exited due to signal
|
||||||
|
|
||||||
|
The scripts have a default execution time of 3 seconds before they are
|
||||||
|
SIGKILLed, this can be adjusted using the above `kill:SEC` syntax.
|
||||||
|
|
||||||
|
> **Note:** the `pre:script` _must_ be idempotent, because a service
|
||||||
|
> can transition between READY and HALTED states any number
|
||||||
|
> of times before going to RUNNING.
|
||||||
|
|
||||||
|
|
||||||
|
### Run-parts Scripts
|
||||||
|
|
||||||
|
**Syntax:** `runparts <DIR>`
|
||||||
|
|
||||||
|
Call [run-parts(8)][] on `DIR` to run start scripts. All executable
|
||||||
|
files, or scripts, in the directory are called, in alphabetic order.
|
||||||
|
The scripts in this directory are executed at the very end of runlevel
|
||||||
|
`S`, [bootstrap][].
|
||||||
|
|
||||||
|
It can be beneficial to use `S01name`, `S02othername`, etc. if there
|
||||||
|
is a dependency order between the scripts. Symlinks to existing
|
||||||
|
daemons can talso be used, but make sure they daemonize by default.
|
||||||
|
|
||||||
|
Similar to the `/etc/rc.local` shell script, make sure that all your
|
||||||
|
services and programs either terminate or start in the background or
|
||||||
|
you will block Finit.
|
||||||
|
|
||||||
|
> **Note:** only read and executed in runlevel S ([bootstrap][]).
|
||||||
|
|
||||||
|
[run-parts(8)]: http://manpages.debian.org/cgi-bin/man.cgi?query=run-parts
|
||||||
|
|
||||||
|
|
||||||
|
### Including Finit Configs
|
||||||
|
|
||||||
|
**Syntax:** `include <CONF>`
|
||||||
|
|
||||||
|
Include another configuration file. Absolute path required.
|
||||||
|
|
||||||
|
|
||||||
|
### General Logging
|
||||||
|
|
||||||
|
**Syntax:** `log size:200k count:5`
|
||||||
|
|
||||||
|
Log rotation for run/task/services using the `log` sub-option with
|
||||||
|
redirection to a log file. Global setting, applies to all services.
|
||||||
|
|
||||||
|
The size can be given as bytes, without a specifier, or in `k`, `M`,
|
||||||
|
or `G`, e.g. `size:10M`, or `size:3G`. A value of `size:0` disables
|
||||||
|
log rotation. The default is `200k`.
|
||||||
|
|
||||||
|
The count value is recommended to be between 1-5, with a default 5.
|
||||||
|
Setting count to 0 means the logfile will be truncated when the MAX
|
||||||
|
size limit is reached.
|
||||||
|
|
||||||
|
### TTYs and Consoles
|
||||||
|
|
||||||
|
**Syntax:** `tty [LVLS] <COND> DEV [BAUD] [noclear] [nowait] [nologin] [TERM]`
|
||||||
|
`tty [LVLS] <COND> CMD <ARGS> [noclear] [nowait]`
|
||||||
|
`tty [LVLS] <COND> [notty] [rescue]`
|
||||||
|
|
||||||
|
The first variant of this option uses the built-in getty on the given
|
||||||
|
TTY device DEV, in the given runlevels. The DEV may be the special
|
||||||
|
keyword `@console`, or `console`, useful on embedded systems.
|
||||||
|
|
||||||
|
The default baud rate is 0, i.e., keep kernel default.
|
||||||
|
|
||||||
|
> The `tty` stanza inherits runlevel, condition (and other feature)
|
||||||
|
> parsing from the `service` stanza. So TTYs can run in one or many
|
||||||
|
> runlevels and depend on any condition supported by Finit. This is
|
||||||
|
> useful e.g. to depend on `<pid/elogind>` before starting a TTY.
|
||||||
|
|
||||||
|
**Example:**
|
||||||
|
|
||||||
|
tty [12345] /dev/ttyAMA0 115200 noclear vt220
|
||||||
|
|
||||||
|
The second `tty` syntax variant is for using an external getty, like
|
||||||
|
agetty or the BusyBox getty.
|
||||||
|
|
||||||
|
The third variant is for board bringup and the `rescue` boot mode. No
|
||||||
|
device node is required in this variant, the same output that the kernel
|
||||||
|
uses is reused for stdio. If the `rescue` option is omitted, a shell is
|
||||||
|
started (`nologin`, `noclear`, and `nowait` are implied), if the rescue
|
||||||
|
option is set the bundled `/libexec/finit/sulogin` is started to present
|
||||||
|
a bare-bones root login prompt. If the root (uid:0, gid:0) user does
|
||||||
|
not have a password set, no rescue is possible. For more information,
|
||||||
|
see the [Rescue Mode](#rescue-mode) section.
|
||||||
|
|
||||||
|
By default, the first two syntax variants *clear* the TTY and *wait* for
|
||||||
|
the user to press enter before starting getty.
|
||||||
|
|
||||||
|
**Example:**
|
||||||
|
|
||||||
|
tty [12345] /sbin/getty -L 115200 /dev/ttyAMA0 vt100
|
||||||
|
tty [12345] /sbin/agetty -L ttyAMA0 115200 vt100 nowait
|
||||||
|
|
||||||
|
The `noclear` option disables clearing the TTY after each session.
|
||||||
|
Clearing the TTY when a user logs out is usually preferable.
|
||||||
|
|
||||||
The `<...>` is the condition for starting `ospfd`. In this example
|
The `nowait` option disables the `press Enter to activate console`
|
||||||
Finit waits for another service, `/sbin/zebra`, to have created its
|
message before actually starting the getty program. On small and
|
||||||
PID file in `/var/run/zebra.pid` before starting `ospfd`.
|
embedded systems running multiple unused getty wastes both memory
|
||||||
|
and CPU cycles, so `wait` is the preferred default.
|
||||||
|
|
||||||
Some services do not maintain a PID file and rather than patching each
|
The `nologin` option disables getty and `/bin/login`, and gives the
|
||||||
application Finit provides a workaround. A `pid` keyword can be set
|
user a root (login) shell on the given TTY `<DEV>` immediately.
|
||||||
to have Finit automatically create (when starting) and later remove
|
Needless to say, this is a rather insecure option, but can be very
|
||||||
(when stopping) the PID file. The file is created in the `/var/run`
|
useful for developer builds, during board bringup, or similar.
|
||||||
directory using the `basename(1)` of the service. The default can be
|
|
||||||
modified with an optional argument:
|
|
||||||
|
|
||||||
pid[:[/path/to/]filename[.pid]]
|
Notice the ordering, the `TERM` option to the built-in getty must be
|
||||||
|
the last argument.
|
||||||
|
|
||||||
For example, by adding `pid:/run/foo.pid` to the service `/sbin/bar`
|
Embedded systems may want to enable automatic `DEV` by supplying the
|
||||||
that PID file will, not only be created and removed automatically, but
|
special `@console` device. This works regardless weather the system
|
||||||
also be used by the Finit condition subsystem. So a service/run/task
|
uses `ttyS0`, `ttyAMA0`, `ttyMXC0`, or anything else. Finit figures
|
||||||
can depend on `<svc/sbin/foo>`, notice the composition of conditions.
|
it out by querying sysfs: `/sys/class/tty/console/active`. The speed
|
||||||
|
can be omitted to keep the kernel default.
|
||||||
|
|
||||||
However, if a service `bar` *does* create a PID file, using `foo.pid`,
|
> Most systems get by fine by just using `console`, which will evaluate
|
||||||
we can inform Finit of this by prepending an `!`:
|
> to `/dev/console`. If you have to use `@console` to get any output,
|
||||||
|
> you may have some issue with your kernel config.
|
||||||
|
|
||||||
pid:!/run/foo.pid
|
**Example:**
|
||||||
|
|
||||||
Here Finit will *not* create/remove/touch the PID file, only use it
|
tty [12345] @console noclear vt220
|
||||||
for the condition handling instead of the default PID file name.
|
|
||||||
|
|
||||||
> For a detailed description of conditions, and how to debug them, see
|
On really bare bones systems, or for board bringup, Finit can give you a
|
||||||
> the [Finit Conditions](conditions.md) document.
|
shell prompt as soon as [bootstrap][] is done, without opening any
|
||||||
|
device node:
|
||||||
|
|
||||||
If a service should not be automatically started, it can be configured
|
tty [12345789] notty
|
||||||
as manual with the optional `manual` argument. The service can then be
|
|
||||||
started at any time by running `initctl start <service>`.
|
|
||||||
|
|
||||||
manual:yes
|
This should of course not be enabled on production systems. Because it
|
||||||
|
may give a user root access without having to log in. However, for
|
||||||
|
board bringup and system debugging it can come in handy.
|
||||||
|
|
||||||
The name of a service, shown by the `initctl` tool, defaults to the
|
One can also use the `service` stanza to start a stand-alone shell:
|
||||||
basename of the service executable. It can be changed with the
|
|
||||||
optional `name` argument:
|
|
||||||
|
|
||||||
name:<service-name>
|
service [12345] /bin/sh -l
|
||||||
|
|
||||||
When stopping a service (run/task/sysv/service), either manually or
|
|
||||||
when moving to another runlevel, Finit starts by sending `SIGTERM`, to
|
|
||||||
allow the process to shut down gracefully. If the process has not
|
|
||||||
been collected within 3 seconds, Finit sends `SIGKILL`. To halt the
|
|
||||||
process using a different signal, use the option `halt:SIGNAL`, e.g.,
|
|
||||||
`halt:SIGPWR`. To change the delay between your halt signal and KILL,
|
|
||||||
use the option `kill:SEC`, e.g., `kill:10` to wait 10 seconds before
|
|
||||||
sending `SIGKILL`.
|
|
||||||
|
|
||||||
* `inetd service/proto[@iflist] <wait|nowait> [LVLS] /path/to/daemon args`
|
### Non-privileged Services
|
||||||
Launch a daemon when a client initiates a connection on an Internet
|
|
||||||
port. Available services are listed in the UNIX `/etc/services` file.
|
|
||||||
Finit can filter access to from a list of interfaces, `@iflist`, per
|
|
||||||
inetd service as well as listen to custom ports.
|
|
||||||
|
|
||||||
```shell
|
Every `run`, `task`, or `service` can also list the privileges the
|
||||||
inetd ftp/tcp nowait @root /usr/sbin/uftpd -i -f
|
`/path/to/cmd` should be executed with. Simply prefix the path with
|
||||||
inetd tftp/udp wait @root /usr/sbin/uftpd -i -t
|
|
||||||
```
|
|
||||||
|
|
||||||
The following example listens to port 2323 for telnet connections and
|
|
||||||
only allows clients connecting from `eth0`:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
inetd 2323/tcp@eth0 nowait [2345] /sbin/telnetd -i -F
|
|
||||||
```
|
|
||||||
|
|
||||||
The interface list, `@iflist`, is of the format `@iface,!iface,iface`,
|
|
||||||
where a single `!` means to deny access. Notice how interfaces are
|
|
||||||
comma separated with no spaces.
|
|
||||||
|
|
||||||
The `inetd` directive can also have ` -- Optional Description`, only
|
|
||||||
Finit does not output this text on the console when launching inetd
|
|
||||||
services. Instead this text is sent to syslog and also shown by the
|
|
||||||
`initctl` tool. More on inetd below.
|
|
||||||
|
|
||||||
* `runparts <DIR>`
|
|
||||||
Call [run-parts(8)][] on `DIR` to run start scripts. All executable
|
|
||||||
files, or scripts, in the directory are called, in alphabetic order.
|
|
||||||
The scripts in this directory are executed at the very end of runlevel
|
|
||||||
`S`, bootstrap.
|
|
||||||
|
|
||||||
It can be beneficial to use `S01name`, `S02othername`, etc. if there
|
|
||||||
is a dependency order between the scripts. Symlinks to existing
|
|
||||||
daemons can talso be used, but make sure they daemonize by default.
|
|
||||||
|
|
||||||
Similar to the `/etc/rc.local` shell script, make sure that all your
|
|
||||||
services and programs either terminate or start in the background or
|
|
||||||
you will block Finit.
|
|
||||||
|
|
||||||
* `include <CONF>`
|
|
||||||
Include another configuration file. Absolute path required.
|
|
||||||
|
|
||||||
* `log size:200k count:5`
|
|
||||||
|
|
||||||
Log rotation for run/task/services using the `log` sub-option with
|
|
||||||
redirection to a log file. Global setting, applies to all services.
|
|
||||||
|
|
||||||
The size can be given as bytes, without a specifier, or in `k`, `M`,
|
|
||||||
or `G`, e.g. `size:10M`, or `size:3G`. A value of `size:0` disables
|
|
||||||
log rotation. The default is `200k`.
|
|
||||||
|
|
||||||
The count value is recommended to be between 1-5, with a default 5.
|
|
||||||
Setting count to 0 means the logfile will be truncated when the MAX
|
|
||||||
size limit is reached.
|
|
||||||
|
|
||||||
* `tty [LVLS] <DEV> [BAUD] [noclear] [nowait] [nologin] [TERM]`
|
|
||||||
`tty [LVLS] <CMD> <ARGS> [noclear] [nowait]`
|
|
||||||
The first variant of this option uses the built-in getty on the given
|
|
||||||
TTY device DEV, in the given runlevels. The DEV may be the special
|
|
||||||
keyword `@console`, or `console`, useful on embedded systems.
|
|
||||||
|
|
||||||
The default baud rate is 0, i.e., keep kernel default.
|
|
||||||
|
|
||||||
**Example:**
|
|
||||||
```conf
|
|
||||||
tty [12345] /dev/ttyAMA0 115200 noclear vt220
|
|
||||||
```
|
|
||||||
|
|
||||||
The second `tty` syntax variant is for using an external getty, like
|
|
||||||
agetty or the BusyBox getty.
|
|
||||||
|
|
||||||
By default both variants *clear* the TTY and *wait* for the user to
|
|
||||||
press enter before starting getty.
|
|
||||||
|
|
||||||
**Example:**
|
|
||||||
```conf
|
|
||||||
tty [12345] /sbin/getty -L 115200 /dev/ttyAMA0 vt100
|
|
||||||
tty [12345] /sbin/agetty -L ttyAMA0 115200 vt100 nowait
|
|
||||||
```
|
|
||||||
|
|
||||||
The `noclear` option disables clearing the TTY after each session.
|
|
||||||
Clearing the TTY when a user logs out is usually preferable.
|
|
||||||
|
|
||||||
The `nowait` option disables the `press Enter to activate console`
|
|
||||||
message before actually starting the getty program. On small and
|
|
||||||
embedded systems running multiple unused getty wastes both memory
|
|
||||||
and CPU cycles, so `wait` is the preferred default.
|
|
||||||
|
|
||||||
The `nologin` option disables getty and `/bin/login`, and gives the
|
|
||||||
user a root (login) shell on the given TTY `<DEV>` immediately.
|
|
||||||
Needless to say, this is a rather insecure option, but can be very
|
|
||||||
useful for developer builds, during board bringup, or similar.
|
|
||||||
|
|
||||||
Notice the ordering, the `TERM` option to the built-in getty must be
|
|
||||||
the last argument.
|
|
||||||
|
|
||||||
Embedded systems may want to enable automatic `DEV` by supplying the
|
|
||||||
special `@console` device. This works regardless weather the system
|
|
||||||
uses `ttyS0`, `ttyAMA0`, `ttyMXC0`, or anything else. Finit figures
|
|
||||||
it out by querying sysfs: `/sys/class/tty/console/active`. The speed
|
|
||||||
can be omitted to keep the kernel default.
|
|
||||||
|
|
||||||
**Example:**
|
|
||||||
```conf
|
|
||||||
tty [12345] @console noclear vt220
|
|
||||||
```
|
|
||||||
|
|
||||||
On really bare bones systems Finit offers a fallback shell, which
|
|
||||||
should not be enabled on production systems since. This because it
|
|
||||||
may give a user root access without having to log in. However, for
|
|
||||||
bringup and system debugging it can come in handy:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
configure --enable-fallback-shell
|
|
||||||
```
|
|
||||||
|
|
||||||
One can also use the `service` stanza to start a stand-alone shell:
|
|
||||||
|
|
||||||
```conf
|
|
||||||
service [12345] /bin/sh -l
|
|
||||||
```
|
|
||||||
|
|
||||||
When running <kbd>make install</kbd> no default `/etc/finit.conf` will
|
|
||||||
be installed since system requirements differ too much. Try out the
|
|
||||||
Debian 6.0 example `/usr/share/doc/finit/finit.conf` configuration that
|
|
||||||
is capable of service monitoring SSH, sysklogd, gdm and getty!
|
|
||||||
|
|
||||||
Every `run`, `task`, `service`, or `inetd` can also list the privileges
|
|
||||||
the `/path/to/cmd` should be executed with. Simply prefix the path with
|
|
||||||
`[@USR[:GRP]]` like this:
|
`[@USR[:GRP]]` like this:
|
||||||
|
|
||||||
```shell
|
run [2345] @joe:users logger "Hello world"
|
||||||
run [2345] @joe:users /usr/bin/logger "Hello world"
|
|
||||||
```
|
|
||||||
|
|
||||||
For multiple instances of the same command, e.g. a DHCP client or
|
For multiple instances of the same command, e.g. a DHCP client or
|
||||||
multiple web servers, add `:ID` somewhere between the `run`, `task`,
|
multiple web servers, add `:ID` somewhere between the `run`, `task`,
|
||||||
`service` keyword and the command, like this:
|
`service` keyword and the command, like this:
|
||||||
|
|
||||||
```shell
|
service :80 [2345] httpd -f -h /http -p 80 -- Web server
|
||||||
service :1 [2345] /sbin/httpd -f -h /http -p 80 -- Web server
|
service :8080[2345] httpd -f -h /http -p 8080 -- Old web server
|
||||||
service :2 [2345] /sbin/httpd -f -h /http -p 8080 -- Old web server
|
|
||||||
```
|
|
||||||
|
|
||||||
Without the `:ID` to the service the latter will overwrite the former
|
Without the `:ID` to the service the latter will overwrite the former
|
||||||
and only the old web server would be started and supervised.
|
and only the old web server would be started and supervised.
|
||||||
|
|
||||||
The `run`, `task`, `service`, or `inetd` stanzas also allow the keyword
|
|
||||||
`log` to redirect `stderr` and `stdout` of the application to a file or
|
### Redirecting Output
|
||||||
syslog using the native `logit` tool. The full syntax is:
|
|
||||||
|
The `run`, `task`, and `service` stanzas also allow the keyword `log` to
|
||||||
|
redirect `stderr` and `stdout` of the application to a file or syslog
|
||||||
|
using the native `logit` tool. This is useful for programs that do not
|
||||||
|
support syslog on their own, which is sometimes the case when running
|
||||||
|
in the foreground.
|
||||||
|
|
||||||
|
The full syntax is:
|
||||||
|
|
||||||
log:/path/to/file
|
log:/path/to/file
|
||||||
log:prio:facility.level,tag:ident
|
log:prio:facility.level,tag:ident
|
||||||
@@ -408,52 +595,112 @@ Log rotation is controlled using the global `log` setting.
|
|||||||
|
|
||||||
service log:prio:user.warn,tag:ntpd /sbin/ntpd pool.ntp.org -- NTP daemon
|
service log:prio:user.warn,tag:ntpd /sbin/ntpd pool.ntp.org -- NTP daemon
|
||||||
|
|
||||||
Worth noting is that conditions is allowed for all these stanzas. For a
|
|
||||||
detailed description, see the [Conditions](conditions.md) document.
|
Rescue Mode
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Finit supports a rescue mode which is activated by the `rescue` option
|
||||||
|
on the kernel command line. See [cmdline docs](cmdline.md) for how to
|
||||||
|
activate it.
|
||||||
|
|
||||||
|
The rescue mode comes in two flavors; *traditional* and *fallback*.
|
||||||
|
|
||||||
|
|
||||||
|
### Traditional
|
||||||
|
|
||||||
|
This is what most users expect. A very early maintenance login prompt,
|
||||||
|
served by the bundled `/libexec/finit/sulogin` program, or the standard
|
||||||
|
`sulogin` from util-linux or BusyBox is searched for in the UNIX default
|
||||||
|
`$PATH`. If a successful login is made, or the user exits (Ctrl-D), the
|
||||||
|
rescue mode is ended and the system boots up normally.
|
||||||
|
|
||||||
|
> **Note:** if the user (UID 0 and GID 0) does not have a password, or
|
||||||
|
> __the account is locked__, the user is presented with a password-less
|
||||||
|
> `"Press enter to enter maintenance mode."`, prompt which opens up a
|
||||||
|
> root shell.
|
||||||
|
|
||||||
|
|
||||||
|
### Fallback
|
||||||
|
|
||||||
|
If no `sulogin` program is found, Finit tries to bring up as much of its
|
||||||
|
own functionality as possible, yet limiting many aspects, meaning; no
|
||||||
|
network, no `fsck` of file systems in `/etc/fstab`, no `/etc/rc.local`,
|
||||||
|
no `runparts`, and most plugins are skipped (except those that provide
|
||||||
|
functionality for the condition subsystem).
|
||||||
|
|
||||||
|
Instead of reading `/etc/finit.conf` et al, system configuration is read
|
||||||
|
from `/lib/finit/rescue.conf`, which can be freely modified by the
|
||||||
|
system administrator.
|
||||||
|
|
||||||
|
The bundled default `rescue.conf` contains nothing more than:
|
||||||
|
|
||||||
|
runlevel 1
|
||||||
|
tty [12345] rescue
|
||||||
|
|
||||||
|
The `tty` has the `rescue` option set, which works similar to the board
|
||||||
|
bring-up tty option `notty`. The major difference being that `sulogin`
|
||||||
|
is started to query for root/admin password. If `sulogin` is not found,
|
||||||
|
`rescue` behaves like `notty` and gives a plain root shell prompt.
|
||||||
|
|
||||||
|
If Finit cannot find `/lib/finit/rescue.conf` it defaults to:
|
||||||
|
|
||||||
|
tty [12345] rescue
|
||||||
|
|
||||||
|
There is no way to exit the *fallback* rescue mode.
|
||||||
|
|
||||||
|
|
||||||
Limitations
|
Limitations
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
To understand the limitations of `finit.conf` vs `finit.d` it is useful
|
As of Finit v4 there are no limitations to where `.conf` settings can be
|
||||||
to picture the different phases of the system: bootstrap, runtime, and
|
placed. Except for the system/global `rlimit`, which can only be set
|
||||||
shutdown.
|
from `/etc/finit.conf`, since it is the first `.conf` file Finit reads.
|
||||||
|
|
||||||
### /etc/finit.conf
|
Originally, `/etc/finit.conf` was the only way to set up a Finit system.
|
||||||
|
Today it is mainly used for bootstrap settings like system hostname,
|
||||||
|
early module loading for watchdogd, network bringup and system shutdown.
|
||||||
|
These can now also be set in any `.conf` file in `/etc/finit.d`.
|
||||||
|
|
||||||
This file used to be the only way to set up and boot a Finit system.
|
There is, however, nothing preventing you from having all configuration
|
||||||
Today it is mainly used for pre-runtime settings like system hostname,
|
settings in `/etc/finit.conf`.
|
||||||
network bringup and shutdown:
|
|
||||||
|
|
||||||
- `host`, only at bootstrap, (runlevel `S`)
|
> **Note:** The `/etc/finit.d` directory was previously the default
|
||||||
- `mknod`, only at bootstrap
|
> Finit [runparts](#run-parts-scripts) directory. Finit no
|
||||||
- `network`, only at bootstrap
|
> longer has a default `runparts`, make sure to update your
|
||||||
- `runparts`, only at bootstrap
|
> setup, or the finit configuration, accordingly.
|
||||||
- `include`
|
|
||||||
- `log`, global setting
|
|
||||||
- `shutdown`
|
|
||||||
- `runlevel`, only at bootstrap
|
|
||||||
- ... and all configuration stanzas from `/etc/finit.d` below
|
|
||||||
|
|
||||||
### /etc/finit.d
|
|
||||||
|
|
||||||
Support for per-service `.conf` files in `/etc/finit.d` was added in
|
Watchdog
|
||||||
v3.0 to handle changes of the system configuration at runtime. As of
|
--------
|
||||||
v3.1 `finit.conf` is also handled at runtime, except of course for any
|
|
||||||
stanza that only runs at bootstrap. However, a `/etc/finit.d/*.conf`
|
|
||||||
does *not support* the above `finit.conf` settings described above, only
|
|
||||||
the following:
|
|
||||||
|
|
||||||
- `module`, but only at bootstrap
|
When built `--with-watchdog` a separate service is built and installed
|
||||||
- `service`
|
in `/libexec/finit/watchdogd`. If this exists at runtime, and the WDT
|
||||||
- `task`
|
device node exists, Finit will start it and treat it as the elected
|
||||||
- `run`
|
watchdog service to delegate its reboot to. See [bootstrap][] for
|
||||||
- `inetd`
|
details. This delegation is to ensure that the system is rebooted by a
|
||||||
- `rlimit`
|
hardware watchdog timer -- on many embedded systems this is crucial to
|
||||||
- `tty`
|
ensure all circuits on the board are properly reset for the next boot,
|
||||||
|
in effect ensuring the system works the same after both a power-on and
|
||||||
|
reboot event.
|
||||||
|
|
||||||
**NOTE:** The `/etc/finit.d` directory was previously the default Finit
|
The delegation is performed at the very last steps of system shutdown,
|
||||||
`runparts` directory. Finit no longer has a default `runparts`, make
|
if reboot has been selected and an elected watchdog is known, first a
|
||||||
sure to update your setup, or the finit configuration, accordingly.
|
`SIGPWR` is sent to advise watchdogd of the pending reboot. Then, when
|
||||||
|
the necessary steps of preparing the system for shutdown (umount etc.)
|
||||||
|
are completed, Finit sends `SIGTERM` to watchdogd and puts itself in a
|
||||||
|
10 sec timeout loop waiting for the WDT to reset the board. If a reset
|
||||||
|
is not done before the timeout, Finit falls back to`reboot(RB_AUTOBOOT)`
|
||||||
|
which tells the kernel to do the reboot.
|
||||||
|
|
||||||
[run-parts(8)]: http://manpages.debian.org/cgi-bin/man.cgi?query=run-parts
|
An external watchdog service can also be used. The more advanced cousin
|
||||||
|
[watchdogd](https://github.com/troglobit/watchdogd/) is the recommended
|
||||||
|
option here. It can register itself with Finit using the same IPC as
|
||||||
|
`initctl`. If the bundled watchdogd is running a hand-over takes place,
|
||||||
|
so it's safe to have both services installed on a system. For the
|
||||||
|
hand-over to work it requires that the WDT driver supports the safe exit
|
||||||
|
functionality where `"V"` is written to the device before closing the
|
||||||
|
device descriptor. If the kernel driver has been built without this,
|
||||||
|
the only option is to remove `/libexec/finit/watchdogd` or build without
|
||||||
|
it at configure time.
|
||||||
|
|
||||||
|
[bootstrap]: bootstrap.md
|
||||||
|
|||||||
+11
-7
@@ -13,13 +13,13 @@ By default Finit uses the following directories for configuration files:
|
|||||||
```
|
```
|
||||||
|
|
||||||
To enable a service one simply drops a small configuration file in the
|
To enable a service one simply drops a small configuration file in the
|
||||||
`/etc/finit.d/` directory. This practice works will with systems that
|
`/etc/finit.d/` directory. This practice works with systems that
|
||||||
keep disabled services elsewhere, or generates them as needed from some
|
keep disabled services elsewhere, or generates them as needed from some
|
||||||
other tool.
|
other tool.
|
||||||
|
|
||||||
Disitributions, however, may want a clearer separation of enabled and
|
Distributions, however, may want a clearer separation of enabled and
|
||||||
available (installed but not enabled) services. They may even want to
|
available (installed but not enabled) services. They may even want to
|
||||||
customize the directories used, for brand labling or uniformity.
|
customize the directories used, for brand labeling or uniformity.
|
||||||
|
|
||||||
To that end Finit allows for a sub-directory `/etc/finit.d/available/`
|
To that end Finit allows for a sub-directory `/etc/finit.d/available/`
|
||||||
where installed but disabled services can reside. Adding a symlink to a
|
where installed but disabled services can reside. Adding a symlink to a
|
||||||
@@ -34,6 +34,9 @@ build time:
|
|||||||
./configure --with-rcsd=/etc/init.d --with-config=/etc/init.d/init.conf
|
./configure --with-rcsd=/etc/init.d --with-config=/etc/init.d/init.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> **Note:** remember `--prefix` et al as well, the default is likely
|
||||||
|
> *not* what you want. See the [build docs][1] for details.
|
||||||
|
|
||||||
The resulting directory structure is depicted below. Please notice how
|
The resulting directory structure is depicted below. Please notice how
|
||||||
`/etc/finit.conf` now resides in the same sub-directory as a non-symlink
|
`/etc/finit.conf` now resides in the same sub-directory as a non-symlink
|
||||||
`/etc/init.d/init.conf`:
|
`/etc/init.d/init.conf`:
|
||||||
@@ -42,10 +45,10 @@ The resulting directory structure is depicted below. Please notice how
|
|||||||
/etc/
|
/etc/
|
||||||
|-- init.d/
|
|-- init.d/
|
||||||
| |-- available/ -- Regular (disabled) services
|
| |-- available/ -- Regular (disabled) services
|
||||||
| | |-- httpd.conf
|
| | |-- httpd.conf
|
||||||
| | |-- ntpd.conf
|
| | |-- ntpd.conf
|
||||||
| | `-- sshd.conf
|
| | `-- sshd.conf
|
||||||
| |-- sshd.conf -- Symlink to available/sshd.conf
|
| |-- sshd.conf -- Symlink to available/sshd.conf
|
||||||
| `- init.conf -- Bootstrap tasks and services
|
| `- init.conf -- Bootstrap tasks and services
|
||||||
:
|
:
|
||||||
```
|
```
|
||||||
@@ -73,3 +76,4 @@ requires the `available/` sub-directory. Any non-symlink in the parent
|
|||||||
directory, here `/etc/init.d/`, will be considered a system override by
|
directory, here `/etc/init.d/`, will be considered a system override by
|
||||||
`initctl`.
|
`initctl`.
|
||||||
|
|
||||||
|
[1]: build.md#configure
|
||||||
|
|||||||
-125
@@ -1,125 +0,0 @@
|
|||||||
Internet Super Server
|
|
||||||
=====================
|
|
||||||
|
|
||||||
Inetd
|
|
||||||
-----
|
|
||||||
|
|
||||||
A built-in *Internet Super Server* support was added in Finit v1.12 and
|
|
||||||
v1.13, along with an internal `time` inetd service, RFC 868 (rdate).
|
|
||||||
The latter is supplied as a plugin to illustrate how simple it is to
|
|
||||||
extend finit with more internal inetd services. Today more built-in
|
|
||||||
services are available.
|
|
||||||
|
|
||||||
> Please note, not all UNIX daemons are prepared to run as inetd services.
|
|
||||||
> In the example below `sshd` also need the command line argument `-i`.
|
|
||||||
|
|
||||||
The inetd support in finit is quite advanced. Not only does it launch
|
|
||||||
services on demand, it can do so on custom ports and also filter inbound
|
|
||||||
traffic using a poor man's [TCP wrappers][]. The syntax is very similar
|
|
||||||
to the traditional `/etc/inetd.conf`, yet keeping with the style of
|
|
||||||
Finit:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
# Launch SSH on demand, in runlevels 2-5 as root
|
|
||||||
inetd ssh/tcp nowait [2345] @root:root /usr/sbin/sshd -i
|
|
||||||
```
|
|
||||||
|
|
||||||
A more advanced example is listed below, please note the *incompatible
|
|
||||||
syntax change* that was made between Finit v1.12 and v1.13 to support
|
|
||||||
deny filters:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
# Start sshd if inbound connection on eth0, port 222, or
|
|
||||||
# inbound on eth1, port 22. Ignore on other interfaces.
|
|
||||||
inetd 222/tcp@eth0 nowait [2345] /usr/sbin/sshd -i
|
|
||||||
inetd ssh/tcp@eth1,eth1 nowait [2345] /usr/sbin/sshd -i
|
|
||||||
```
|
|
||||||
|
|
||||||
If `eth0` is your Internet interface you may want to avoid using the
|
|
||||||
default port. To run ssh on port 222, and all others on port 22:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
inetd 222/tcp@eth0 nowait [2345] /usr/sbin/sshd -i
|
|
||||||
inetd ssh/tcp@*,!eth0 nowait [2345] /usr/sbin/sshd -i
|
|
||||||
```
|
|
||||||
|
|
||||||
Compared to Finit v1.12 you must *explicitly deny* access from `eth0`!
|
|
||||||
|
|
||||||
To protect against looping attacks, the inetd server will refuse UDP
|
|
||||||
service if the reply port corresponds to any internal service. Similar
|
|
||||||
to how the FreeBSD inetd operates.
|
|
||||||
|
|
||||||
|
|
||||||
**Internal Services**
|
|
||||||
|
|
||||||
Like the original `inetd`, Finit has a few standard services built-in.
|
|
||||||
They are realized as plugins to provide a simple means of testing the
|
|
||||||
inetd functionality stand-alone. But this also provides both a useful
|
|
||||||
network testing/availability, as well as a rudimentary time server for
|
|
||||||
`rdate` clients.
|
|
||||||
|
|
||||||
- echo
|
|
||||||
- chargen
|
|
||||||
- daytime
|
|
||||||
- discard
|
|
||||||
- time
|
|
||||||
|
|
||||||
For security reasons they are all disabled by default and have to be
|
|
||||||
enabled with both the `configure` script and a special `inetd` stanza in
|
|
||||||
the `finit.conf` or `finit.d/*.conf` like this:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
inetd echo/udp wait [2345] internal
|
|
||||||
inetd echo/tcp nowait [2345] internal
|
|
||||||
inetd chargen/udp wait [2345] internal
|
|
||||||
inetd chargen/tcp nowait [2345] internal
|
|
||||||
inetd daytime/udp wait [2345] internal
|
|
||||||
inetd daytime/tcp nowait [2345] internal
|
|
||||||
inetd discard/udp wait [2345] internal
|
|
||||||
inetd discard/tcp nowait [2345] internal
|
|
||||||
inetd time/udp wait [2345] internal
|
|
||||||
inetd time/tcp nowait [2345] internal
|
|
||||||
```
|
|
||||||
|
|
||||||
Then call `rdate` from a remote machine (or use localhost):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
rdate -p <IP>
|
|
||||||
rdate -up <IP>
|
|
||||||
```
|
|
||||||
|
|
||||||
Or `echoping` to reach the echo service:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
echoping -v <IP>
|
|
||||||
echoping -uv <IP>
|
|
||||||
```
|
|
||||||
|
|
||||||
Or `echoping -d` to reach the discard service:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
echoping -dv <IP>
|
|
||||||
echoping -duv <IP>
|
|
||||||
```
|
|
||||||
|
|
||||||
Or `echoping -c` to reach the chargen service:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
echoping -cv <IP>
|
|
||||||
echoping -cuv <IP>
|
|
||||||
```
|
|
||||||
|
|
||||||
If you use `time/udp` you must use the standard rdate implementation and
|
|
||||||
then call it with `rdate -up` to connect using UDP. Without the `-p`
|
|
||||||
argument rdate will try to set the system clock. Please note that rdate
|
|
||||||
has been deprecated by the NTP protocol and this plugin should only be
|
|
||||||
used for testing or environments where NTP for some reason is blocked.
|
|
||||||
Also, remember the UNIX year 2038 bug, or in the case of RFC 868 (and
|
|
||||||
some NTP implementations), year 2036!
|
|
||||||
|
|
||||||
**Note:** There is currently no verification that the same port is used
|
|
||||||
more than once. So a standard `inetd http/tcp` service will clash
|
|
||||||
with an ssh entry for the same port `inetd 80/tcp` …
|
|
||||||
|
|
||||||
|
|
||||||
[TCP Wrappers]: https://en.wikipedia.org/wiki/TCP_Wrapper
|
|
||||||
+7
-17
@@ -8,7 +8,7 @@ Hooks & Plugins
|
|||||||
* [Shutdown Hooks](#shutdown-hooks)
|
* [Shutdown Hooks](#shutdown-hooks)
|
||||||
|
|
||||||
Finit can be extended to add general functionality in the form of I/O
|
Finit can be extended to add general functionality in the form of I/O
|
||||||
monitors, built-in inetd services, or hook plugins.
|
monitors, or hook plugins.
|
||||||
|
|
||||||
The following sections detail existing plugins and hook points. For
|
The following sections detail existing plugins and hook points. For
|
||||||
more information, see the plugins listed below.
|
more information, see the plugins listed below.
|
||||||
@@ -34,18 +34,11 @@ For your convenience a set of *optional* plugins are available:
|
|||||||
* *dbus.so*: Setup and start system message bus, D-Bus, at boot.
|
* *dbus.so*: Setup and start system message bus, D-Bus, at boot.
|
||||||
_Optional plugin._
|
_Optional plugin._
|
||||||
|
|
||||||
* *echo.so*: RFC 862 plugin. Start as inetd service, like time below.
|
* *hotplug.so*: Setup and start either udev or mdev hotplug daemon, if
|
||||||
|
available.
|
||||||
* *chargen.so*: RFC 864 plugin. Start as inetd service, like time below.
|
|
||||||
|
|
||||||
* *daytime.so*: RFC 867 plugin. Start as inetd service, like time below.
|
|
||||||
|
|
||||||
* *discard.so*: RFC 863 plugin. Start as inetd service, like time below.
|
|
||||||
|
|
||||||
* *rtc.so*: Restore and save system clock from/to RTC on boot/halt.
|
* *rtc.so*: Restore and save system clock from/to RTC on boot/halt.
|
||||||
|
|
||||||
* *initctl.so*: Extends finit with a traditional `initctl` functionality.
|
|
||||||
|
|
||||||
* *modules-load.so*: Scans /etc/modules-load.d for modules to modprobe.
|
* *modules-load.so*: Scans /etc/modules-load.d for modules to modprobe.
|
||||||
|
|
||||||
* *netlink.so*: Listens to Linux kernel Netlink events for gateway and
|
* *netlink.so*: Listens to Linux kernel Netlink events for gateway and
|
||||||
@@ -56,9 +49,6 @@ For your convenience a set of *optional* plugins are available:
|
|||||||
* *resolvconf.so*: Setup necessary files for `resolvconf` at startup.
|
* *resolvconf.so*: Setup necessary files for `resolvconf` at startup.
|
||||||
_Optional plugin._
|
_Optional plugin._
|
||||||
|
|
||||||
* *time.so*: RFC 868 (rdate) plugin. Start as inetd service. Useful
|
|
||||||
for testing inetd filtering — BusyBox has an rdate (TCP) client.
|
|
||||||
|
|
||||||
* *tty.so*: Watches `/dev`, using inotify, for new device nodes (TTY's)
|
* *tty.so*: Watches `/dev`, using inotify, for new device nodes (TTY's)
|
||||||
to start/stop getty consoles on them on demand. Useful when plugging
|
to start/stop getty consoles on them on demand. Useful when plugging
|
||||||
in a usb2serial converter to login to your embedded device.
|
in a usb2serial converter to login to your embedded device.
|
||||||
@@ -110,7 +100,7 @@ Hooks
|
|||||||
* `HOOK_SHUTDOWN`: Called at shutdown/reboot, right before all
|
* `HOOK_SHUTDOWN`: Called at shutdown/reboot, right before all
|
||||||
services are sent `SIGTERM`
|
services are sent `SIGTERM`
|
||||||
|
|
||||||
Plugins like `initctl.so` and `tty.so` extend finit by acting on events,
|
Plugins like `tty.so` extend finit by acting on events, they are called
|
||||||
they are called I/O plugins and are called from the finit main loop when
|
I/O plugins and are called from the finit main loop when `poll()`
|
||||||
`poll()` detects an event. See the source code for `plugins/*.c` for
|
detects an event. See the source code for `plugins/*.c` for more help
|
||||||
more help and ideas.
|
and ideas.
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ The current state depends on the two following conditions:
|
|||||||
|
|
||||||
A service may be stopped, or blocked, for several reasons:
|
A service may be stopped, or blocked, for several reasons:
|
||||||
|
|
||||||
- The user has manually stopped the service using `initctl stop JOB`
|
- The user has manually stopped the service using `initctl stop NAME`
|
||||||
- The program exits immediately. I.e. keeps crashing (make sure to use
|
- The program exits immediately. I.e. keeps crashing (make sure to use
|
||||||
the 'run this service in the foreground' command line option)
|
the 'run this service in the foreground' command line option)
|
||||||
- The binary is missing in the filesystem
|
- The binary is missing in the filesystem
|
||||||
|
|||||||
+44
-25
@@ -6,31 +6,50 @@ Though Finit comes with its own tools for (poweroff, halt, reboot), for
|
|||||||
compatibility with the existing BusyBox toolset the following signals
|
compatibility with the existing BusyBox toolset the following signals
|
||||||
have been adopted:
|
have been adopted:
|
||||||
|
|
||||||
* `SIGHUP`
|
`SIGHUP`
|
||||||
Same effect as `finit q`, `init q`, or `initctl reload`, reloads all
|
--------
|
||||||
*.conf files in `/etc/finit.d/`
|
|
||||||
* `SIGUSR1`
|
|
||||||
Calls shutdown hooks, including `HOOK_SHUTDOWN`, stopping all running
|
|
||||||
processes, and unmounts all file systems. Then tells kernel to halt.
|
|
||||||
Most people these days want `SIGUSR2` though.
|
|
||||||
|
|
||||||
SysV init and systemd use this to re-open their FIFO/D-Bus.
|
Same effect as `finit q`, `init q`, or `initctl reload`, reloads all
|
||||||
* `SIGUSR2`
|
*.conf files in `/etc/finit.d/`
|
||||||
Like SIGUSR1, but tell kernel to power-off the system, if ACPI
|
|
||||||
or similar exists to actually do this. If the kernel fails
|
`SIGUSR1`
|
||||||
power-off, Finit falls back to halt.
|
---------
|
||||||
|
|
||||||
|
Calls shutdown hooks, including `HOOK_SHUTDOWN`, stopping all running
|
||||||
|
processes, and unmounts all file systems. Then tells kernel to halt.
|
||||||
|
Most people these days want `SIGUSR2` though.
|
||||||
|
|
||||||
|
SysV init and systemd use this to re-open their FIFO/D-Bus.
|
||||||
|
|
||||||
|
`SIGUSR2`
|
||||||
|
---------
|
||||||
|
|
||||||
|
Like SIGUSR1, but tell kernel to power-off the system, if ACPI or
|
||||||
|
similar exists to actually do this. If the kernel fails power-off,
|
||||||
|
Finit falls back to halt.
|
||||||
|
|
||||||
SysV init N/A, systemd dumps its internal state to log.
|
SysV init N/A, systemd dumps its internal state to log.
|
||||||
* `SIGTERM`
|
|
||||||
Like `SIGUSR1`, but tell kernel to reboot the system when done.
|
`SIGTERM`
|
||||||
|
---------
|
||||||
|
|
||||||
|
Like `SIGUSR1`, but tell kernel to reboot the system when done.
|
||||||
|
|
||||||
SysV init N/A, systemd rexecutes itself.
|
SysV init N/A, systemd rexecutes itself.
|
||||||
* `SIGINT`
|
|
||||||
Sent from kernel when the CTRL-ALT-DEL key combo is pressed.
|
`SIGINT`
|
||||||
SysV init and systemd default to reboot with `shutdown -r`.
|
--------
|
||||||
Finit currently forwards this to `SIGTERM`.
|
|
||||||
* `SIGPWR`
|
Sent from kernel when the CTRL-ALT-DEL key combo is pressed. SysV init
|
||||||
Sent from a power daemon, like `powstatd(8)`, on changes to the
|
and systemd default to reboot with `shutdown -r`.
|
||||||
UPS status. Traditionally SysV init read /etc/powerstatus and
|
|
||||||
acted on "OK", "FAIL", or "LOW" and then removed the file.
|
Finit currently forwards this to `SIGTERM`.
|
||||||
Finit currently forwards this to `SIGUSR2`.
|
|
||||||
|
`SIGPWR`
|
||||||
|
--------
|
||||||
|
|
||||||
|
Sent from a power daemon, like `powstatd(8)`, on changes to the
|
||||||
|
UPS status. Traditionally SysV init read /etc/powerstatus and
|
||||||
|
acted on "OK", "FAIL", or "LOW" and then removed the file.
|
||||||
|
Finit currently forwards this to `SIGUSR2`.
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 138 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.6 KiB |
+6
-42
@@ -7,7 +7,7 @@ AM_CPPFLAGS += $(lite_CFLAGS)
|
|||||||
|
|
||||||
if STATIC
|
if STATIC
|
||||||
noinst_LTLIBRARIES = libplug.la
|
noinst_LTLIBRARIES = libplug.la
|
||||||
libplug_la_SOURCES = bootmisc.c modprobe.c rtc.c initctl.c pidfile.c procps.c tty.c urandom.c
|
libplug_la_SOURCES = bootmisc.c modprobe.c rtc.c pidfile.c procps.c tty.c urandom.c usr.c
|
||||||
|
|
||||||
if BUILD_ALSA_UTILS_PLUGIN
|
if BUILD_ALSA_UTILS_PLUGIN
|
||||||
libplug_la_SOURCES += alsa-utils.c
|
libplug_la_SOURCES += alsa-utils.c
|
||||||
@@ -17,26 +17,8 @@ if BUILD_DBUS_PLUGIN
|
|||||||
libplug_la_SOURCES += dbus.c
|
libplug_la_SOURCES += dbus.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if INETD
|
if BUILD_HOTPLUG_PLUGIN
|
||||||
if BUILD_INETD_ECHO_PLUGIN
|
libplug_la_SOURCES += hotplug.c
|
||||||
libplug_la_SOURCES += echo.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
if BUILD_INETD_CHARGEN_PLUGIN
|
|
||||||
libplug_la_SOURCES += chargen.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
if BUILD_INETD_DAYTIME_PLUGIN
|
|
||||||
libplug_la_SOURCES += daytime.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
if BUILD_INETD_DISCARD_PLUGIN
|
|
||||||
libplug_la_SOURCES += discard.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
if BUILD_INETD_TIME_PLUGIN
|
|
||||||
libplug_la_SOURCES += time.c
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if BUILD_MODULES_LOAD_PLUGIN
|
if BUILD_MODULES_LOAD_PLUGIN
|
||||||
@@ -52,7 +34,7 @@ libplug_la_SOURCES += resolvconf.c
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
else
|
else
|
||||||
pkglib_LTLIBRARIES = bootmisc.la modprobe.la rtc.la initctl.la pidfile.la procps.la tty.la urandom.la
|
pkglib_LTLIBRARIES = bootmisc.la modprobe.la rtc.la pidfile.la procps.la tty.la urandom.la usr.la
|
||||||
|
|
||||||
if BUILD_ALSA_UTILS_PLUGIN
|
if BUILD_ALSA_UTILS_PLUGIN
|
||||||
pkglib_LTLIBRARIES += alsa-utils.la
|
pkglib_LTLIBRARIES += alsa-utils.la
|
||||||
@@ -62,26 +44,8 @@ if BUILD_DBUS_PLUGIN
|
|||||||
pkglib_LTLIBRARIES += dbus.la
|
pkglib_LTLIBRARIES += dbus.la
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if INETD
|
if BUILD_HOTPLUG_PLUGIN
|
||||||
if BUILD_INETD_ECHO_PLUGIN
|
pkglib_LTLIBRARIES += hotplug.la
|
||||||
pkglib_LTLIBRARIES += echo.la
|
|
||||||
endif
|
|
||||||
|
|
||||||
if BUILD_INETD_CHARGEN_PLUGIN
|
|
||||||
pkglib_LTLIBRARIES += chargen.la
|
|
||||||
endif
|
|
||||||
|
|
||||||
if BUILD_INETD_DAYTIME_PLUGIN
|
|
||||||
pkglib_LTLIBRARIES += daytime.la
|
|
||||||
endif
|
|
||||||
|
|
||||||
if BUILD_INETD_DISCARD_PLUGIN
|
|
||||||
pkglib_LTLIBRARIES += discard.la
|
|
||||||
endif
|
|
||||||
|
|
||||||
if BUILD_INETD_TIME_PLUGIN
|
|
||||||
pkglib_LTLIBRARIES += time.la
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if BUILD_MODULES_LOAD_PLUGIN
|
if BUILD_MODULES_LOAD_PLUGIN
|
||||||
|
|||||||
+11
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Save and restore ALSA sound settings using alsactl
|
/* Save and restore ALSA sound settings using alsactl
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2016 Joachim Nilsson <troglobit@gmail.com>
|
* Copyright (c) 2012-2021 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -30,6 +30,11 @@
|
|||||||
|
|
||||||
static void save(void *arg)
|
static void save(void *arg)
|
||||||
{
|
{
|
||||||
|
if (rescue) {
|
||||||
|
_d("Skipping %s plugin in rescue mode.", __FILE__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (whichp(ALSACTL)) {
|
if (whichp(ALSACTL)) {
|
||||||
_d("Saving sound settings ...");
|
_d("Saving sound settings ...");
|
||||||
run_interactive(ALSACTL " -g store", "Saving sound settings");
|
run_interactive(ALSACTL " -g store", "Saving sound settings");
|
||||||
@@ -38,6 +43,11 @@ static void save(void *arg)
|
|||||||
|
|
||||||
static void restore(void *arg)
|
static void restore(void *arg)
|
||||||
{
|
{
|
||||||
|
if (rescue) {
|
||||||
|
_d("Skipping %s plugin in rescue mode.", __FILE__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (whichp(ALSACTL)) {
|
if (whichp(ALSACTL)) {
|
||||||
_d("Restoring sound settings ...");
|
_d("Restoring sound settings ...");
|
||||||
run_interactive(ALSACTL " -g restore", "Restoring sound settings");
|
run_interactive(ALSACTL " -g restore", "Restoring sound settings");
|
||||||
|
|||||||
+43
-43
@@ -1,6 +1,6 @@
|
|||||||
/* Setup necessary system files for, e.g. UTMP (tracking logins)
|
/* Setup necessary system files for, e.g. UTMP (tracking logins)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2016 Joachim Nilsson <troglobit@gmail.com>
|
* Copyright (c) 2012-2021 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -30,6 +30,7 @@
|
|||||||
#include "finit.h"
|
#include "finit.h"
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
|
#include "util.h"
|
||||||
#include "utmp-api.h"
|
#include "utmp-api.h"
|
||||||
|
|
||||||
static int is_tmpfs(char *path)
|
static int is_tmpfs(char *path)
|
||||||
@@ -64,7 +65,7 @@ static int is_tmpfs(char *path)
|
|||||||
return tmpfs;
|
return tmpfs;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int do_clean(const char *fpath, const struct stat *sb, int tflag, struct FTW *ftw)
|
static int bootclean(const char *fpath, const struct stat *sb, int tflag, struct FTW *ftw)
|
||||||
{
|
{
|
||||||
if (ftw->level == 0)
|
if (ftw->level == 0)
|
||||||
return 1;
|
return 1;
|
||||||
@@ -75,8 +76,14 @@ static int do_clean(const char *fpath, const struct stat *sb, int tflag, struct
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We can safely skip tmpfs, nothing to clean from previous boot there */
|
/*
|
||||||
static void bootclean(void)
|
* Cleanup stale files from previous boot, if any still linger on.
|
||||||
|
* Some systems, e.g. Alpine Linux, still have a persistent /run and
|
||||||
|
* /tmp, i.e. not tmpfs.
|
||||||
|
*
|
||||||
|
* We can safely skip tmpfs, nothing to clean there.
|
||||||
|
*/
|
||||||
|
static void clean(void *arg)
|
||||||
{
|
{
|
||||||
char *dir[] = {
|
char *dir[] = {
|
||||||
"/tmp/",
|
"/tmp/",
|
||||||
@@ -89,7 +96,7 @@ static void bootclean(void)
|
|||||||
if (is_tmpfs(dir[i]))
|
if (is_tmpfs(dir[i]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
nftw(dir[i], do_clean, 20, FTW_DEPTH);
|
nftw(dir[i], bootclean, 20, FTW_DEPTH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,13 +105,11 @@ static void bootclean(void)
|
|||||||
*/
|
*/
|
||||||
static void setup(void *arg)
|
static void setup(void *arg)
|
||||||
{
|
{
|
||||||
int uid, gid;
|
mode_t prev;
|
||||||
|
|
||||||
/* Cleanup stale files, if any still linger on. */
|
prev = umask(0);
|
||||||
bootclean();
|
|
||||||
|
|
||||||
_d("Setting up FHS structure in /var ...");
|
_d("Setting up FHS structure in /var ...");
|
||||||
umask(0);
|
|
||||||
makedir("/var/cache", 0755);
|
makedir("/var/cache", 0755);
|
||||||
makedir("/var/db", 0755); /* _PATH_VARDB on some systems */
|
makedir("/var/db", 0755); /* _PATH_VARDB on some systems */
|
||||||
makedir("/var/games", 0755);
|
makedir("/var/games", 0755);
|
||||||
@@ -116,8 +121,10 @@ static void setup(void *arg)
|
|||||||
_d("System with new /run tmpfs ...");
|
_d("System with new /run tmpfs ...");
|
||||||
makedir("/run/lock", 1777);
|
makedir("/run/lock", 1777);
|
||||||
symlink("/run/lock", "/var/lock");
|
symlink("/run/lock", "/var/lock");
|
||||||
symlink("/run", "/var/run");
|
|
||||||
symlink("/dev/shm", "/run/shm");
|
symlink("/dev/shm", "/run/shm");
|
||||||
|
|
||||||
|
/* compat only, should really be set up by OS/dist */
|
||||||
|
symlink("/run", "/var/run");
|
||||||
} else {
|
} else {
|
||||||
makedir("/var/lock", 1777);
|
makedir("/var/lock", 1777);
|
||||||
makedir("/var/run", 0755);
|
makedir("/var/run", 0755);
|
||||||
@@ -130,22 +137,26 @@ static void setup(void *arg)
|
|||||||
makedir("/var/tmp", 0755);
|
makedir("/var/tmp", 0755);
|
||||||
makedir("/var/empty", 0755);
|
makedir("/var/empty", 0755);
|
||||||
|
|
||||||
/*
|
|
||||||
* If /etc/group or "utmp" group is missing,
|
|
||||||
* default to "root"/"wheel" group
|
|
||||||
*/
|
|
||||||
_d("Setting up necessary UTMP files ...");
|
|
||||||
gid = getgroup("utmp");
|
|
||||||
if (gid < 0)
|
|
||||||
gid = 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* UTMP actually needs multiple db files
|
* UTMP actually needs multiple db files
|
||||||
*/
|
*/
|
||||||
create("/var/run/utmp", 0644, 0, gid); /* Currently logged in */
|
if (has_utmp()) {
|
||||||
create("/var/log/wtmp", 0644, 0, gid); /* Login history */
|
int gid;
|
||||||
create("/var/log/btmp", 0600, 0, gid); /* Failed logins */
|
|
||||||
create("/var/log/lastlog", 0644, 0, gid);
|
/*
|
||||||
|
* If /etc/group or "utmp" group is missing, default to
|
||||||
|
* "root", or "wheel", group.
|
||||||
|
*/
|
||||||
|
_d("Setting up necessary UTMP files ...");
|
||||||
|
gid = getgroup("utmp");
|
||||||
|
if (gid < 0)
|
||||||
|
gid = 0;
|
||||||
|
|
||||||
|
create("/var/run/utmp", 0644, 0, gid); /* Currently logged in */
|
||||||
|
create("/var/log/wtmp", 0644, 0, gid); /* Login history */
|
||||||
|
create("/var/log/btmp", 0600, 0, gid); /* Failed logins */
|
||||||
|
create("/var/log/lastlog", 0644, 0, gid);
|
||||||
|
}
|
||||||
|
|
||||||
/* Set BOOT_TIME UTMP entry */
|
/* Set BOOT_TIME UTMP entry */
|
||||||
utmp_set_boot();
|
utmp_set_boot();
|
||||||
@@ -160,37 +171,26 @@ static void setup(void *arg)
|
|||||||
makedir("/var/run/network",0755); /* Needed by Debian/Ubuntu ifupdown */
|
makedir("/var/run/network",0755); /* Needed by Debian/Ubuntu ifupdown */
|
||||||
makedir("/var/run/lldpd", 0755); /* Needed by lldpd */
|
makedir("/var/run/lldpd", 0755); /* Needed by lldpd */
|
||||||
makedir("/var/run/pluto", 0755); /* Needed by Openswan */
|
makedir("/var/run/pluto", 0755); /* Needed by Openswan */
|
||||||
makedir("/var/run/quagga", 0755); /* Needed by Quagga */
|
mksubsys("/var/run/quagga", 0755, "quagga", "quagga");
|
||||||
makedir("/var/log/quagga", 0755); /* Needed by Quagga */
|
mksubsys("/var/log/quagga", 0755, "quagga", "quagga");
|
||||||
|
mksubsys("/var/run/frr", 0755, "frr", "frr");
|
||||||
|
mksubsys("/var/log/frr", 0755, "frr", "frr");
|
||||||
makedir("/var/run/sshd", 01755); /* OpenSSH */
|
makedir("/var/run/sshd", 01755); /* OpenSSH */
|
||||||
|
|
||||||
gid = getgroup("tty");
|
|
||||||
if (gid < 0)
|
|
||||||
gid = 0;
|
|
||||||
makefifo("/dev/xconsole", 0640); /* sysklogd */
|
|
||||||
chown("/dev/xconsole", 0, gid);
|
|
||||||
|
|
||||||
if (!fexist("/etc/mtab"))
|
if (!fexist("/etc/mtab"))
|
||||||
symlink("../proc/self/mounts", "/etc/mtab");
|
symlink("../proc/self/mounts", "/etc/mtab");
|
||||||
|
|
||||||
/* Void Linux has a uuidd that runs as uuid:uuid and needs /run/uuid */
|
/* Void Linux has a uuidd that runs as uuid:uuid and needs /run/uuid */
|
||||||
uid = getuser("uuidd", NULL);
|
mksubsys("/var/run/uuidd", 0755, "uuidd", "uuidd");
|
||||||
if (uid >= 0) {
|
|
||||||
gid = getgroup("uuidd");
|
|
||||||
if (gid < 0)
|
|
||||||
gid = 0;
|
|
||||||
makedir("/var/run/uuidd", 0755);
|
|
||||||
chown("/var/run/uuidd", uid, gid);
|
|
||||||
}
|
|
||||||
|
|
||||||
umask(022);
|
umask(prev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = __FILE__,
|
||||||
.hook[HOOK_BASEFS_UP] = {
|
.hook[HOOK_MOUNT_POST] = { .cb = clean },
|
||||||
.cb = setup
|
.hook[HOOK_BASEFS_UP] = { .cb = setup },
|
||||||
},
|
.depends = { "pidfile" },
|
||||||
};
|
};
|
||||||
|
|
||||||
PLUGIN_INIT(plugin_init)
|
PLUGIN_INIT(plugin_init)
|
||||||
|
|||||||
@@ -1,120 +0,0 @@
|
|||||||
/* Optional inetd plugin for the Character Generator Protocol, RFC 864
|
|
||||||
*
|
|
||||||
* Copyright (c) 2016 Joachim Nilsson <troglobit@gmail.com>
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <unistd.h> /* STDIN_FILENO */
|
|
||||||
#include <sys/socket.h>
|
|
||||||
|
|
||||||
#include "plugin.h"
|
|
||||||
|
|
||||||
#define NAME "chargen"
|
|
||||||
#define PATTERN "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ "
|
|
||||||
|
|
||||||
static char *generator(char *buf, size_t buflen)
|
|
||||||
{
|
|
||||||
size_t num, len, width = 72;
|
|
||||||
static size_t pos = 0;
|
|
||||||
const char pattern[] = PATTERN;
|
|
||||||
|
|
||||||
if (buflen < width)
|
|
||||||
width = buflen;
|
|
||||||
|
|
||||||
len = width;
|
|
||||||
if (len + 3 > buflen)
|
|
||||||
len = buflen - 3;
|
|
||||||
if (pos + len > sizeof(pattern)) {
|
|
||||||
num = sizeof(pattern) - pos;
|
|
||||||
len -= num;
|
|
||||||
} else {
|
|
||||||
num = width;
|
|
||||||
if (num + 3 > buflen)
|
|
||||||
num = buflen - 3;
|
|
||||||
len = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
strncpy(buf, &pattern[pos], num--);
|
|
||||||
if (len++)
|
|
||||||
strncpy(&buf[num], pattern, len);
|
|
||||||
strlcat(buf, "\r\n", width);
|
|
||||||
|
|
||||||
if (++pos >= sizeof(pattern) - 1)
|
|
||||||
pos = 0;
|
|
||||||
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int recv_peer(int sd, char *buf, ssize_t len, struct sockaddr *sa, socklen_t *sa_len)
|
|
||||||
{
|
|
||||||
len = recvfrom(sd, buf, len, MSG_DONTWAIT, sa, sa_len);
|
|
||||||
if (-1 == len)
|
|
||||||
return -1; /* On error, close connection. */
|
|
||||||
|
|
||||||
if (inetd_check_loop(sa, *sa_len, NAME))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int send_peer(int sd, char *buf, ssize_t len, struct sockaddr *sa, socklen_t sa_len)
|
|
||||||
{
|
|
||||||
char *pattern = generator(buf, len);
|
|
||||||
|
|
||||||
return sendto(sd, pattern, strlen(pattern), MSG_DONTWAIT, sa, sa_len);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int cb(int type)
|
|
||||||
{
|
|
||||||
int sd = STDIN_FILENO;
|
|
||||||
char buf[BUFSIZ];
|
|
||||||
struct sockaddr_storage sa;
|
|
||||||
socklen_t sa_len = sizeof(sa);
|
|
||||||
|
|
||||||
if (recv_peer(sd, buf, sizeof(buf), (struct sockaddr *)&sa, &sa_len))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return send_peer(sd, buf, sizeof(buf), (struct sockaddr *)&sa, sa_len);
|
|
||||||
}
|
|
||||||
|
|
||||||
static plugin_t plugin = {
|
|
||||||
.name = NAME, /* Must match the inetd /etc/services entry */
|
|
||||||
.inetd = {
|
|
||||||
.cmd = cb
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
PLUGIN_INIT(plugin_init)
|
|
||||||
{
|
|
||||||
plugin_register(&plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
PLUGIN_EXIT(plugin_exit)
|
|
||||||
{
|
|
||||||
plugin_unregister(&plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Local Variables:
|
|
||||||
* indent-tabs-mode: t
|
|
||||||
* c-file-style: "linux"
|
|
||||||
* End:
|
|
||||||
*/
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
/* Optional inetd plugin for Daytime Protocol, RFC 867
|
|
||||||
*
|
|
||||||
* Copyright (c) 2016 Joachim Nilsson <troglobit@gmail.com>
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <unistd.h> /* STDIN_FILENO */
|
|
||||||
#include <sys/socket.h>
|
|
||||||
|
|
||||||
#include "plugin.h"
|
|
||||||
|
|
||||||
#define NAME "daytime"
|
|
||||||
|
|
||||||
|
|
||||||
static char *daytime(char *buf, size_t len)
|
|
||||||
{
|
|
||||||
time_t t;
|
|
||||||
struct tm *tmp;
|
|
||||||
|
|
||||||
t = time(NULL);
|
|
||||||
tmp = localtime(&t);
|
|
||||||
|
|
||||||
memset(buf, 0, len);
|
|
||||||
strftime(buf, len, "%a, %B %d, %Y %T-%Z", tmp);
|
|
||||||
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int recv_peer(int sd, char *buf, ssize_t len, struct sockaddr *sa, socklen_t *sa_len)
|
|
||||||
{
|
|
||||||
len = recvfrom(sd, buf, sizeof(buf), MSG_DONTWAIT, sa, sa_len);
|
|
||||||
if (-1 == len)
|
|
||||||
return -1; /* On error, close connection. */
|
|
||||||
|
|
||||||
if (inetd_check_loop(sa, *sa_len, NAME))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int send_peer(int sd, char *buf, ssize_t len, struct sockaddr *sa, socklen_t sa_len)
|
|
||||||
{
|
|
||||||
char *now = daytime(buf, len);
|
|
||||||
|
|
||||||
return sendto(sd, now, strlen(now), MSG_DONTWAIT, sa, sa_len);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int cb(int type)
|
|
||||||
{
|
|
||||||
int sd = STDIN_FILENO;
|
|
||||||
char buf[BUFSIZ];
|
|
||||||
struct sockaddr_storage sa;
|
|
||||||
socklen_t sa_len = sizeof(sa);
|
|
||||||
|
|
||||||
if (recv_peer(sd, buf, sizeof(buf), (struct sockaddr *)&sa, &sa_len))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return send_peer(sd, buf, sizeof(buf), (struct sockaddr *)&sa, sa_len);
|
|
||||||
}
|
|
||||||
|
|
||||||
static plugin_t plugin = {
|
|
||||||
.name = NAME, /* Must match the inetd /etc/services entry */
|
|
||||||
.inetd = {
|
|
||||||
.cmd = cb
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
PLUGIN_INIT(plugin_init)
|
|
||||||
{
|
|
||||||
plugin_register(&plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
PLUGIN_EXIT(plugin_exit)
|
|
||||||
{
|
|
||||||
plugin_unregister(&plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Local Variables:
|
|
||||||
* indent-tabs-mode: t
|
|
||||||
* c-file-style: "linux"
|
|
||||||
* End:
|
|
||||||
*/
|
|
||||||
+19
-12
@@ -1,6 +1,6 @@
|
|||||||
/* Setup and start system message bus, D-Bus
|
/* Setup and start system message bus, D-Bus
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2017 Joachim Nilsson <troglobit@gmail.com>
|
* Copyright (c) 2012-2021 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -32,13 +32,21 @@
|
|||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
#define DAEMON "dbus-daemon"
|
#define DAEMON "dbus-daemon"
|
||||||
#define ARGS "--nofork --system"
|
#define ARGS "--nofork --system --syslog-only"
|
||||||
#define DESC "D-Bus message bus daemon"
|
#define DESC "D-Bus message bus daemon"
|
||||||
|
|
||||||
|
#define DAEMONUSER "messagebus"
|
||||||
|
|
||||||
static void setup(void *arg)
|
static void setup(void *arg)
|
||||||
{
|
{
|
||||||
char *cmd;
|
|
||||||
char line[256];
|
char line[256];
|
||||||
|
mode_t prev;
|
||||||
|
char *cmd;
|
||||||
|
|
||||||
|
if (rescue) {
|
||||||
|
_d("Skipping %s plugin in rescue mode.", __FILE__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
cmd = which(DAEMON);
|
cmd = which(DAEMON);
|
||||||
if (!cmd) {
|
if (!cmd) {
|
||||||
@@ -46,29 +54,28 @@ static void setup(void *arg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
umask(0);
|
prev =umask(0);
|
||||||
|
|
||||||
makedir("/var/run/dbus", 0755);
|
mksubsys("/var/run/dbus", 0755, DAEMONUSER, DAEMONUSER);
|
||||||
makedir("/var/lock/subsys", 0755);
|
|
||||||
makedir("/var/lock/subsys/messagebus", 0755);
|
|
||||||
if (whichp("dbus-uuidgen"))
|
if (whichp("dbus-uuidgen"))
|
||||||
run("dbus-uuidgen --ensure");
|
run_interactive("dbus-uuidgen --ensure", "Creating machine UUID for D-Bus");
|
||||||
|
|
||||||
/* Clean up from any previous pre-bootstrap run */
|
/* Clean up from any previous pre-bootstrap run */
|
||||||
erase("/var/run/dbus/pid");
|
remove("/var/run/dbus/pid");
|
||||||
|
|
||||||
/* Register service with Finit */
|
/* Register service with Finit */
|
||||||
snprintf(line, sizeof(line), "[S12345] pid:!/run/dbus/pid log:prio:daemon.info,tag:dbus %s %s -- %s", cmd, ARGS, DESC);
|
snprintf(line, sizeof(line), "[S12345789] @%s:%s %s %s -- %s",
|
||||||
|
DAEMONUSER, DAEMONUSER, cmd, ARGS, DESC);
|
||||||
if (service_register(SVC_TYPE_SERVICE, line, global_rlimit, NULL))
|
if (service_register(SVC_TYPE_SERVICE, line, global_rlimit, NULL))
|
||||||
_pe("Failed registering %s", DAEMON);
|
_pe("Failed registering %s", DAEMON);
|
||||||
free(cmd);
|
free(cmd);
|
||||||
|
|
||||||
umask(022);
|
umask(prev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = __FILE__,
|
||||||
.hook[HOOK_NETWORK_UP] = {
|
.hook[HOOK_BASEFS_UP] = {
|
||||||
.cb = setup
|
.cb = setup
|
||||||
},
|
},
|
||||||
.depends = { "bootmisc", },
|
.depends = { "bootmisc", },
|
||||||
|
|||||||
@@ -0,0 +1,116 @@
|
|||||||
|
/* Heuristically find and initialize a suitable hotplug daemon
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2021 Joachim Wiberg <troglobit@gmail.com>
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "conf.h"
|
||||||
|
#include "finit.h"
|
||||||
|
#include "helpers.h"
|
||||||
|
#include "plugin.h"
|
||||||
|
#include "service.h"
|
||||||
|
|
||||||
|
static void setup(void *arg)
|
||||||
|
{
|
||||||
|
char cmd[256];
|
||||||
|
char *path;
|
||||||
|
|
||||||
|
if (rescue) {
|
||||||
|
_d("Skipping %s plugin in rescue mode.", __FILE__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Populate /dev and prepare for runtime events from kernel.
|
||||||
|
* Prefer udev if mdev is also available on the system.
|
||||||
|
*/
|
||||||
|
path = which("udevd");
|
||||||
|
if (!path)
|
||||||
|
path = which("/lib/systemd/systemd-udevd");
|
||||||
|
if (path) {
|
||||||
|
/* Register udevd as a monitored service */
|
||||||
|
snprintf(cmd, sizeof(cmd), "[S12345789] pid:udevd name:udevd log %s "
|
||||||
|
"-- Device event managing daemon", path);
|
||||||
|
if (service_register(SVC_TYPE_SERVICE, cmd, global_rlimit, NULL)) {
|
||||||
|
_pe("Failed registering %s", path);
|
||||||
|
} else {
|
||||||
|
snprintf(cmd, sizeof(cmd), ":1 [S] <pid/udevd> log "
|
||||||
|
"udevadm trigger -c add -t devices "
|
||||||
|
"-- Requesting device events");
|
||||||
|
service_register(SVC_TYPE_RUN, cmd, global_rlimit, NULL);
|
||||||
|
|
||||||
|
snprintf(cmd, sizeof(cmd), ":2 [S] <pid/udevd> log "
|
||||||
|
"udevadm trigger -c add -t subsystems "
|
||||||
|
"-- Requesting subsystem events");
|
||||||
|
service_register(SVC_TYPE_RUN, cmd, global_rlimit, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(path);
|
||||||
|
|
||||||
|
/* Debian has this little script to copy generated
|
||||||
|
* rules while the system was read-only. TODO: When
|
||||||
|
* this functionality was hardcoded in finit.c, this
|
||||||
|
* call was made in crank_worker(). Now that
|
||||||
|
* filesystems are mounted earlier we should be able
|
||||||
|
* to make this call directly after the triggers have
|
||||||
|
* run, but this has not been tested AT ALL. */
|
||||||
|
if (fexist("/lib/udev/udev-finish"))
|
||||||
|
run_interactive("/lib/udev/udev-finish", "Finalizing udev");
|
||||||
|
} else {
|
||||||
|
path = which("mdev");
|
||||||
|
if (path) {
|
||||||
|
/* Embedded Linux systems usually have BusyBox mdev */
|
||||||
|
if (debug)
|
||||||
|
touch("/dev/mdev.log");
|
||||||
|
|
||||||
|
snprintf(cmd, sizeof(cmd), "%s -s", path);
|
||||||
|
free(path);
|
||||||
|
|
||||||
|
run_interactive(cmd, "Populating device tree");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static plugin_t plugin = {
|
||||||
|
.name = __FILE__,
|
||||||
|
.hook[HOOK_BASEFS_UP] = {
|
||||||
|
.cb = setup
|
||||||
|
},
|
||||||
|
.depends = { "bootmisc" },
|
||||||
|
};
|
||||||
|
|
||||||
|
PLUGIN_INIT(plugin_init)
|
||||||
|
{
|
||||||
|
plugin_register(&plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
PLUGIN_EXIT(plugin_exit)
|
||||||
|
{
|
||||||
|
plugin_unregister(&plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local Variables:
|
||||||
|
* indent-tabs-mode: t
|
||||||
|
* c-file-style: "linux"
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
@@ -1,194 +0,0 @@
|
|||||||
/* Optional /dev/initctl FIFO monitor, for receiving commands from telinit
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
|
||||||
* Copyright (c) 2008-2015 Joachim Nilsson <troglobit@gmail.com>
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h" /* Generated by configure script */
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h> /* O_RDONLY et al */
|
|
||||||
#include <signal.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h> /* read() */
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <lite/lite.h>
|
|
||||||
|
|
||||||
#include "finit.h"
|
|
||||||
#include "conf.h"
|
|
||||||
#include "helpers.h"
|
|
||||||
#include "plugin.h"
|
|
||||||
#include "sig.h"
|
|
||||||
#include "service.h"
|
|
||||||
|
|
||||||
static void parse(void *arg, int fd, int events);
|
|
||||||
static void setup(void *arg);
|
|
||||||
|
|
||||||
static plugin_t plugin = {
|
|
||||||
.name = __FILE__,
|
|
||||||
.io = {
|
|
||||||
.cb = parse,
|
|
||||||
.flags = PLUGIN_IO_READ,
|
|
||||||
},
|
|
||||||
.hook[HOOK_BASEFS_UP] = {
|
|
||||||
.cb = setup
|
|
||||||
},
|
|
||||||
.depends = { "bootmisc", },
|
|
||||||
};
|
|
||||||
|
|
||||||
static void fifo_open(void)
|
|
||||||
{
|
|
||||||
plugin.io.fd = open(FINIT_FIFO, O_RDWR | O_NONBLOCK | O_CLOEXEC);
|
|
||||||
if (-1 == plugin.io.fd) {
|
|
||||||
_e("Failed opening %s FIFO, error %d: %s", FINIT_FIFO, errno, strerror(errno));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We only handle INIT_HALT for differentiating between halt/poweroff
|
|
||||||
*/
|
|
||||||
static void set_env(char *data)
|
|
||||||
{
|
|
||||||
const char *var = "INIT_HALT";
|
|
||||||
|
|
||||||
if (strncmp(data, var, strlen(var)))
|
|
||||||
return;
|
|
||||||
data += strlen(var);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* No value means unset env, in this case cancel shutdown.
|
|
||||||
*/
|
|
||||||
if (data[0] == 0) {
|
|
||||||
halt = SHUT_DEFAULT;
|
|
||||||
/* XXX: Cancel timer here, when we get support for timed shutdown */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string_match(data, "=POWERDOWN"))
|
|
||||||
halt = SHUT_OFF;
|
|
||||||
if (string_match(data, "=HALT"))
|
|
||||||
halt = SHUT_HALT;
|
|
||||||
|
|
||||||
/* Now we wait for runlevel change, or cancelled shutdown */
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Standard reboot/shutdown utilities talk to init using /run/initctl.
|
|
||||||
* We should check if the fifo was recreated and reopen it.
|
|
||||||
*
|
|
||||||
* For SysV compatibility the default is to halt the system when issuing
|
|
||||||
* `init 0`, unless INIT_HALT=POWERDOWN, as performed by the SysV utils.
|
|
||||||
*/
|
|
||||||
static void parse(void *arg, int fd, int events)
|
|
||||||
{
|
|
||||||
int lvl;
|
|
||||||
struct init_request rq;
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
ssize_t len = read(fd, &rq, sizeof(rq));
|
|
||||||
|
|
||||||
if (len <= 0) {
|
|
||||||
if (-1 == len) {
|
|
||||||
if (EINTR == errno)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (EAGAIN == errno)
|
|
||||||
break;
|
|
||||||
|
|
||||||
_e("Failed reading initctl request, error %d: %s", errno, strerror(errno));
|
|
||||||
}
|
|
||||||
|
|
||||||
_d("Nothing to do, bailing out.");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rq.magic != INIT_MAGIC || len != sizeof(rq)) {
|
|
||||||
_e("Invalid initctl request.");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (rq.cmd) {
|
|
||||||
case INIT_CMD_RUNLVL:
|
|
||||||
switch (rq.runlevel) {
|
|
||||||
case 's':
|
|
||||||
case 'S':
|
|
||||||
rq.runlevel = '1'; /* Single user mode */
|
|
||||||
/* fallthrough */
|
|
||||||
|
|
||||||
case '0'...'9':
|
|
||||||
_d("Setting new runlevel %c", rq.runlevel);
|
|
||||||
lvl = rq.runlevel - '0';
|
|
||||||
if (lvl == 6)
|
|
||||||
halt = SHUT_REBOOT;
|
|
||||||
service_runlevel(lvl);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
_d("Unsupported runlevel: %d", rq.runlevel);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case INIT_CMD_RELOAD:
|
|
||||||
service_reload_dynamic();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case INIT_CMD_SETENV:
|
|
||||||
set_env(rq.data);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
_d("Unsupported cmd: %d", rq.cmd);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
close(fd);
|
|
||||||
fifo_open();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Must run after the base FS is up, needs /run, or /var/run */
|
|
||||||
static void setup(void *arg)
|
|
||||||
{
|
|
||||||
_d("Setting up %s", FINIT_FIFO);
|
|
||||||
makefifo(FINIT_FIFO, 0600);
|
|
||||||
|
|
||||||
fifo_open();
|
|
||||||
plugin_io_init(&plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
PLUGIN_INIT(plugin_init)
|
|
||||||
{
|
|
||||||
plugin_register(&plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
PLUGIN_EXIT(plugin_exit)
|
|
||||||
{
|
|
||||||
plugin_unregister(&plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Local Variables:
|
|
||||||
* indent-tabs-mode: t
|
|
||||||
* c-file-style: "linux"
|
|
||||||
* End:
|
|
||||||
*/
|
|
||||||
+16
-5
@@ -1,6 +1,6 @@
|
|||||||
/* Coldplug modules using modalias magic
|
/* Coldplug modules using modalias magic
|
||||||
*
|
*
|
||||||
* Copyright (c) 2020 Joachim Nilsson <troglobit@gmail.com>
|
* Copyright (c) 2021 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -142,11 +142,22 @@ static void coldplug(void *arg)
|
|||||||
struct module *m, *tmp;
|
struct module *m, *tmp;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
|
/* Skip for systems without modules, e.g. small embedded or containers */
|
||||||
|
if (!fisdir("/lib/modules"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!fismnt("/sys")) {
|
||||||
|
print(1, "Cannot modprobe system, /sys is not mounted");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
print_desc("Cold plugging system", NULL);
|
print_desc("Cold plugging system", NULL);
|
||||||
nftw("/sys/devices", scan_alias, 200, FTW_DEPTH);
|
rc = nftw("/sys/devices", scan_alias, 200, FTW_DEPTH | FTW_PHYS);
|
||||||
TAILQ_FOREACH_SAFE(m, &modules, link, tmp) {
|
if (!rc) {
|
||||||
rc += modprobe(m->alias);
|
TAILQ_FOREACH_SAFE(m, &modules, link, tmp) {
|
||||||
alias_remove(m);
|
rc += modprobe(m->alias);
|
||||||
|
alias_remove(m);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print_result(rc);
|
print_result(rc);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user