mirror of
https://github.com/troglobit/finit.git
synced 2026-10-13 10:14:47 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
9d9b6b5201 | ||
|
|
c0b74c5e53 | ||
|
|
88a6864fd4 | ||
|
|
2b2c6aaf4e | ||
|
|
8ed37f5fa0 | ||
|
|
8fe4aad53e | ||
|
|
54e5fd2a78 | ||
|
|
1d6737eac1 | ||
|
|
fa0c2f7050 | ||
|
|
70c0a38307 | ||
|
|
217df432d6 | ||
|
|
cfa97253be | ||
|
|
6462bac249 | ||
|
|
b0a1d6bd61 | ||
|
|
ee4768ba53 | ||
|
|
c7c0c723d6 | ||
|
|
b7c1a2a198 | ||
|
|
af45166814 | ||
|
|
1a881389b2 | ||
|
|
6306c757a2 | ||
|
|
3865ce765e | ||
|
|
aa08221666 | ||
|
|
7c8b0df720 | ||
|
|
cb802cd54e |
@@ -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
|
||||||
@@ -76,4 +76,4 @@ Bill & Ted; [be excellent to each other][conduct].
|
|||||||
[github]: https://github.com/troglobit/finit/
|
[github]: https://github.com/troglobit/finit/
|
||||||
[KNF]: https://en.wikipedia.org/wiki/Kernel_Normal_Form
|
[KNF]: https://en.wikipedia.org/wiki/Kernel_Normal_Form
|
||||||
[gitbook]: https://git-scm.com/book/ch5-2.html
|
[gitbook]: https://git-scm.com/book/ch5-2.html
|
||||||
[conduct]: https://github.com/troglobit/finit/blob/master/CODE-OF-CONDUCT.md
|
[conduct]: CODE-OF-CONDUCT.md
|
||||||
@@ -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
|
||||||
|
|||||||
+13
-12
@@ -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,25 +27,25 @@ 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=/tmp --disable-doc --disable-contrib --enable-watchdog --enable-fallback-shell"
|
||||||
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=/tmp --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=/tmp --enable-x11-common-plugin --enable-fallback-shell --enable-watchdog
|
||||||
- cat config.log
|
- cat config.log
|
||||||
- make clean
|
- make clean
|
||||||
- make V=1 -j5
|
- make V=1 -j5
|
||||||
@@ -59,3 +56,7 @@ script:
|
|||||||
- size /tmp/sbin/initctl
|
- size /tmp/sbin/initctl
|
||||||
- size /tmp/sbin/reboot
|
- size /tmp/sbin/reboot
|
||||||
- LD_LIBRARY_PATH=/tmp/lib /tmp/sbin/initctl -h
|
- LD_LIBRARY_PATH=/tmp/lib /tmp/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>
|
||||||
|
|||||||
+51
-23
@@ -4,15 +4,35 @@ 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][UNRELEASED] - 2021-02-21
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
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 changelog 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 𝓜𝓸𝓭𝓮𝓻𝓷
|
||||||
|
* 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., you must give proper
|
||||||
|
path arguments to the script, no more guessing just GNU defaults.
|
||||||
|
There are examples in the documentation and the `contrib/` section
|
||||||
|
* Change service conditions from the non-obvious `<svc/path/to/foo>` to
|
||||||
|
`<pid/foo:id>`. This to hopefully make it clear that one service's
|
||||||
|
'pid:!foo' pidfile is another service's `<pid/foo>` condition
|
||||||
|
* Initial support for cgroups, every service now runs in its own cgroup
|
||||||
|
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
|
||||||
* 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.
|
||||||
@@ -20,7 +40,7 @@ Bug fix release, but also cgroups and a new progress!
|
|||||||
* 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-docs` 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
|
* Add support for `@console` also for external getty
|
||||||
* Add `-b`, batch mode, for non-interactive use to `initctl`
|
* Add `-b`, batch mode, for non-interactive use to `initctl`
|
||||||
@@ -58,19 +78,32 @@ Bug fix release, but also cgroups and a new progress!
|
|||||||
can be enabled with `./configure --enable-auto-reload`
|
can be enabled with `./configure --enable-auto-reload`
|
||||||
* Support for logging security related events, e.g., runlevel change,
|
* Support for logging security related events, e.g., runlevel change,
|
||||||
star/stop or failure to start services, by Jonas Holmberg, Westermo
|
star/stop or failure to start services, by Jonas Holmberg, Westermo
|
||||||
|
* Mount devtpts with recommended `ptxmode=0666`
|
||||||
|
* Mount /run tmpfs with nosuid,nodev,noexec for added security
|
||||||
|
* Support for `console` as alias for `@console` in tty stanzas
|
||||||
|
* Drop `--enable-rw-roots` configure option, use `rw` for your `/`
|
||||||
|
partition in `/etc/fstab` instead to trigger remount at boot
|
||||||
|
* Drop default tty speed (38400) and use 0 (kernel default) instead
|
||||||
|
* Make `:ID` optional, use NULL/zero internally this allows ...
|
||||||
|
* Handle use-cases where multiple services share the same PID filem
|
||||||
|
and thus the same condition path, e.g. different instances for
|
||||||
|
different runlevels. Allow custom condition path with `name:foo`
|
||||||
|
syntax, creates conditions w/o a path, and ...
|
||||||
|
* 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
|
||||||
|
* 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
|
||||||
@@ -78,23 +111,14 @@ Bug fix release, but also cgroups and a new progress!
|
|||||||
not yet exist (symlink to `/run`). Added compat layer for access
|
not yet exist (symlink to `/run`). Added compat layer for access
|
||||||
* 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
|
|
||||||
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
|
|
||||||
Petrus Hellgren, 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
|
||||||
@@ -109,6 +133,10 @@ Bug fix release, but also cgroups and a new progress!
|
|||||||
* Restore Ctrl-D and Ctrl-U support in built-in getty
|
* Restore Ctrl-D and Ctrl-U support in built-in getty
|
||||||
* Remove service condition when service is deleted
|
* Remove service condition when service is deleted
|
||||||
* Fix C++ compilation issues, by Robert Andersson, Atlas Copco
|
* Fix C++ compilation issues, by Robert Andersson, Atlas Copco
|
||||||
|
* Build fixes for uClibc
|
||||||
|
* 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
|
||||||
|
|
||||||
|
|
||||||
[3.1][] - 2018-01-23
|
[3.1][] - 2018-01-23
|
||||||
@@ -183,7 +211,7 @@ This version requires at least libuEv v2.1.0 and libite v2.0.1
|
|||||||
possibility of running a second stage mount command before files in
|
possibility of running a second stage mount command before files in
|
||||||
`/run` and similar are created
|
`/run` and similar are created
|
||||||
* Skip `gdbserver` when unleashing the grim reaper at shutdown
|
* Skip `gdbserver` when unleashing the grim reaper at shutdown
|
||||||
* Distribute and install `docs/` and `contrib/` directories
|
* Distribute and install `doc/` and `contrib/` directories
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
|
||||||
@@ -246,7 +274,7 @@ distributions.
|
|||||||
* Ensure plugins always have a default name, file name
|
* Ensure plugins always have a default name, file name
|
||||||
* Reorganization, move all source files to a `src/` sub-directory
|
* Reorganization, move all source files to a `src/` sub-directory
|
||||||
* Add support for `initctl <list|enable|disable> <SVC>`, much needed by
|
* Add support for `initctl <list|enable|disable> <SVC>`, much needed by
|
||||||
distributions. See [docs/distro.md](docs/distro.md) for details
|
distributions. See [doc/distro.md](doc/distro.md) for details
|
||||||
* Remove `UNUSED()` macro, mentioned here because it may have been used
|
* Remove `UNUSED()` macro, mentioned here because it may have been used
|
||||||
by external plugin developers. Set `-Wno-unused-parameter` instead
|
by external plugin developers. Set `-Wno-unused-parameter` instead
|
||||||
* New table headings in `initctl`, using `top` style inverted text
|
* New table headings in `initctl`, using `top` style inverted text
|
||||||
@@ -817,7 +845,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
|
||||||
|
|||||||
+8
-6
@@ -1,13 +1,13 @@
|
|||||||
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
|
||||||
|
|
||||||
if CONTRIB
|
if CONTRIB
|
||||||
SUBDIRS += contrib
|
SUBDIRS += contrib
|
||||||
endif
|
endif
|
||||||
if DOCS
|
if DOC
|
||||||
SUBDIRS += docs
|
SUBDIRS += doc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Compat hook
|
# Compat hook
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -3,19 +3,18 @@
|
|||||||
|
|
||||||
* [Introduction](#introduction)
|
* [Introduction](#introduction)
|
||||||
* [Features](#features)
|
* [Features](#features)
|
||||||
* [Bootstrap](docs/bootstrap.md#bootstrap)
|
* [Bootstrap](doc/bootstrap.md#bootstrap)
|
||||||
* [Runlevels](#runlevels)
|
* [Runlevels](#runlevels)
|
||||||
* [Syntax](docs/config.md#syntax)
|
* [Syntax](doc/config.md#syntax)
|
||||||
* [Inetd](docs/inetd.md#inetd)
|
|
||||||
* [Runparts & /etc/rc.local](#runparts--etcrclocal)
|
* [Runparts & /etc/rc.local](#runparts--etcrclocal)
|
||||||
* [Hooks, Callbacks & Plugins](docs/plugins.md#hooks-callbacks--plugins)
|
* [Hooks, Callbacks & Plugins](doc/plugins.md#hooks-callbacks--plugins)
|
||||||
* [Rebooting & Halting](#rebooting--halting)
|
* [Rebooting & Halting](#rebooting--halting)
|
||||||
* [Commands & Status](#commands--status)
|
* [Commands & Status](#commands--status)
|
||||||
* [Tips & Tricks with the kernel cmdline](docs/cmdline.md)
|
* [Tips & Tricks with the kernel cmdline](doc/cmdline.md)
|
||||||
* [Building](docs/build.md#building)
|
* [Building](doc/build.md#building)
|
||||||
* [Running](docs/build.md#running)
|
* [Running](doc/build.md#running)
|
||||||
* [Recovery](docs/build.md#recovery)
|
* [Recovery](doc/build.md#recovery)
|
||||||
* [Debugging](docs/build.md#debugging)
|
* [Debugging](doc/build.md#debugging)
|
||||||
* [Requirements](#requirements)
|
* [Requirements](#requirements)
|
||||||
* [Origin & References](#origin--references)
|
* [Origin & References](#origin--references)
|
||||||
|
|
||||||
@@ -27,6 +26,9 @@ 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/).*
|
||||||
|
|
||||||
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 +37,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 +58,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] watchdogd -L -f -- System watchdog daemon
|
||||||
service [S12345] /sbin/syslogd -n -b 3 -D -- System log daemon
|
service [S12345] syslogd -n -b 3 -D -- System log daemon
|
||||||
service [S12345] /sbin/klogd -n -- Kernel log daemon
|
service [S12345] <pid/syslogd> klogd -n -- Kernel log daemon
|
||||||
service [2345] /sbin/lldpd -d -c -M1 -H0 -i -- LLDP daemon (IEEE 802.1ab)
|
service [2345] lldpd -d -c -M1 -H0 -i -- 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
|
#task [S] /etc/init.d/keyboard-setup start -- Setting up preliminary keymap
|
||||||
#task [S] /etc/init.d/acpid start -- Starting ACPI Daemon
|
#task [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
|
||||||
|
|
||||||
# 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
|
# Virtual consoles run BusyBox getty, keep kernel default speed
|
||||||
tty [12345] /sbin/getty -L 115200 /dev/tty1 linux
|
tty [12345] /sbin/getty -L 0 /dev/tty1 linux
|
||||||
tty [12345] /sbin/getty -L 115200 /dev/tty2 linux
|
tty [12345] /sbin/getty -L 0 /dev/tty2 linux
|
||||||
tty [12345] /sbin/getty -L 115200 /dev/tty3 linux
|
tty [12345] /sbin/getty -L 0 /dev/tty3 linux
|
||||||
|
|
||||||
# Use built-in getty for serial port and USB serial
|
# Use built-in getty for serial port and USB serial
|
||||||
tty [12345] /dev/ttyAMA0 115200 noclear nowait
|
tty [12345] /dev/ttyAMA0 noclear nowait
|
||||||
tty [12345] /dev/ttyUSB0 115200 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 [docs/config.md](docs/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](docs/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 +139,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 +158,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](docs/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 [docs/inetd.md](docs/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
|
||||||
@@ -197,9 +166,9 @@ waits for user input before handing over to `/bin/login`, which is
|
|||||||
responsible for handling the actual authentication.
|
responsible for handling the actual authentication.
|
||||||
|
|
||||||
```conf
|
```conf
|
||||||
tty [12345] /dev/tty1 38400 nowait linux
|
tty [12345] /dev/tty1 nowait linux
|
||||||
tty [12345] /dev/ttyAMA0 115200 noclear vt100
|
tty [12345] /dev/ttyAMA0 noclear vt100
|
||||||
tty [12345] /sbin/getty -L 115200 /dev/ttyAMA0 vt100
|
tty [12345] /sbin/getty -L /dev/ttyAMA0 vt100
|
||||||
```
|
```
|
||||||
|
|
||||||
Users of embedded systems may want to enable automatic serial console
|
Users of embedded systems may want to enable automatic serial console
|
||||||
@@ -208,19 +177,19 @@ system uses `ttyS0`, `ttyAMA0`, `ttyMXC0`, or anything else. Finit
|
|||||||
figures it out by querying sysfs: `/sys/class/tty/console/active`.
|
figures it out by querying sysfs: `/sys/class/tty/console/active`.
|
||||||
|
|
||||||
```conf
|
```conf
|
||||||
tty [12345] @console 115200 linux noclear
|
tty [12345] @console linux noclear
|
||||||
```
|
```
|
||||||
|
|
||||||
Notice the optional `noclear`, `nowait`, and `nologin` flags. The
|
Notice the optional `noclear`, `nowait`, and `nologin` flags. The
|
||||||
latter is for skipping the login process entirely. For more information,
|
latter is for skipping the login process entirely. For more information,
|
||||||
see [docs/config.md](docs/config.md#syntax).
|
see [doc/config.md](doc/config.md#syntax).
|
||||||
|
|
||||||
|
|
||||||
**Runlevels**
|
**Runlevels**
|
||||||
|
|
||||||
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,34 +219,12 @@ 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
|
||||||
hook into the boot process or respond to various I/O.
|
hook into the boot process or respond to various I/O.
|
||||||
|
|
||||||
For more information, see [docs/plugins.md](docs/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 [docs/build.md](docs/build.md#recovery).
|
|
||||||
|
|
||||||
|
|
||||||
**Automatic Reload**
|
**Automatic Reload**
|
||||||
@@ -313,8 +260,8 @@ Right after the runlevel change when all services have started properly,
|
|||||||
No configuration stanza in `/etc/finit.conf` is required for `rc.local`.
|
No configuration stanza in `/etc/finit.conf` is required for `rc.local`.
|
||||||
If it exists and is an executable shell script Finit calls it at the very
|
If it exists and is an executable shell script Finit calls it at the very
|
||||||
end of the boot, before calling the `HOOK_SYSTEM_UP`. See more on hooks
|
end of the boot, before calling the `HOOK_SYSTEM_UP`. See more on hooks
|
||||||
in [docs/plugins.md](docs/plugins.md#hooks), and about the system bootstrap
|
in [doc/plugins.md](doc/plugins.md#hooks), and about the system bootstrap
|
||||||
in [docs/bootstrap.md](docs/bootstrap.md).
|
in [doc/bootstrap.md](doc/bootstrap.md).
|
||||||
|
|
||||||
|
|
||||||
Runlevels
|
Runlevels
|
||||||
@@ -335,10 +282,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 +332,31 @@ 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
|
||||||
[docs/signals.md](docs/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
|
||||||
|
-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,34 +364,39 @@ 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
|
||||||
|
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 show Show condition status
|
cond show Show condition status
|
||||||
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
|
restart <NAME>[:ID] Restart (stop/start) service by name
|
||||||
status <JOB|NAME>[:ID] Show service status, by job# or name
|
status <NAME>[:ID] Show service status, by name
|
||||||
status | show Show status of services, default command
|
status Show status of services, default command
|
||||||
|
|
||||||
|
ps List processes 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
|
|
||||||
```
|
```
|
||||||
|
|
||||||
For services *not* supporting `SIGHUP` the `<!>` notation in the .conf
|
For services *not* supporting `SIGHUP` the `<!>` notation in the .conf
|
||||||
file must be used to tell Finit to stop and start it on `reload` and
|
file must be used to tell Finit to stop and start it on `reload` and
|
||||||
`runlevel` changes. If `<>` holds more [conditions](docs/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
|
||||||
@@ -471,18 +404,31 @@ 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
|
|
||||||
~ $ initctl status -v
|
|
||||||
1 running 476 [S12345] /sbin/watchdog -T 16 -t 2 -F /dev/watchdog
|
|
||||||
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
|
|
||||||
4:2 inetd 0 [2345] internal time allow eth0:3737
|
|
||||||
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
|
|
||||||
6:1 inetd 0 [345] /sbin/dropbear allow eth0:222
|
|
||||||
6:2 inetd 0 [345] /sbin/dropbear allow *:22 deny eth0
|
|
||||||
```
|
```
|
||||||
|
alpine:~# initctl
|
||||||
|
PID IDENT STATUS RUNLEVELS DESCRIPTION
|
||||||
|
======================================================================
|
||||||
|
1506 acpid running [--2345----] ACPI daemon
|
||||||
|
1509 crond running [--2345----] Cron daemon
|
||||||
|
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 -v
|
||||||
|
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/`.
|
||||||
|
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
@@ -502,7 +448,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 +457,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 +465,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 +490,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
|
||||||
|
|||||||
+42
-89
@@ -1,5 +1,6 @@
|
|||||||
AC_INIT(Finit, 3.2-rc2, https://github.com/troglobit/finit/issues, finit, http://troglobit.com/finit.html)
|
AC_INIT(Finit, 4.0-rc2, 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])
|
||||||
@@ -9,18 +10,17 @@ AC_CONFIG_FILES([Makefile
|
|||||||
contrib/alpine/Makefile contrib/alpine/finit.d/Makefile contrib/alpine/finit.d/available/Makefile
|
contrib/alpine/Makefile contrib/alpine/finit.d/Makefile contrib/alpine/finit.d/available/Makefile
|
||||||
contrib/debian/Makefile contrib/debian/finit.d/Makefile contrib/debian/finit.d/available/Makefile contrib/debian/grub.d/Makefile
|
contrib/debian/Makefile contrib/debian/finit.d/Makefile contrib/debian/finit.d/available/Makefile contrib/debian/grub.d/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
|
||||||
docs/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,7 +45,7 @@ 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,
|
AC_ARG_ENABLE(emergency_shell,
|
||||||
@@ -61,18 +61,6 @@ 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(rw-rootfs,
|
|
||||||
AS_HELP_STRING([--enable-rw-rootfs], [Remount / R/W at boot, usually not for embedded]),,[
|
|
||||||
enable_rw_rootfs=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,
|
AC_ARG_ENABLE(watchdog,
|
||||||
AS_HELP_STRING([--enable-watchdog], [Enable built-in watchdog, uses /dev/watchdog]),,[
|
AS_HELP_STRING([--enable-watchdog], [Enable built-in watchdog, uses /dev/watchdog]),,[
|
||||||
enable_watchdog=no])
|
enable_watchdog=no])
|
||||||
@@ -81,10 +69,6 @@ AC_ARG_ENABLE(redirect,
|
|||||||
AS_HELP_STRING([--enable-redirect], [Redirect service output to /dev/null, default: no]),,[
|
AS_HELP_STRING([--enable-redirect], [Redirect service output to /dev/null, default: no]),,[
|
||||||
enable_redirect_output=no])
|
enable_redirect_output=no])
|
||||||
|
|
||||||
AC_ARG_ENABLE(inetd,
|
|
||||||
AS_HELP_STRING([--disable-inetd], [Disable built-in inetd super server, default enabled]),,[
|
|
||||||
enable_inetd=yes])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(logit,
|
AC_ARG_ENABLE(logit,
|
||||||
AS_HELP_STRING([--disable-logit], [Disable logit, used for log redirection, default: enable]),,[
|
AS_HELP_STRING([--disable-logit], [Disable logit, used for log redirection, default: enable]),,[
|
||||||
enable_logit=yes])
|
enable_logit=yes])
|
||||||
@@ -93,9 +77,9 @@ 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]),,[
|
||||||
enable_logrotate=yes])
|
enable_logrotate=yes])
|
||||||
|
|
||||||
AC_ARG_ENABLE(docs,
|
AC_ARG_ENABLE(doc,
|
||||||
AS_HELP_STRING([--disable-docs], [Disable build and install of docs section]),,[
|
AS_HELP_STRING([--disable-doc], [Disable build and install of doc/ section]),,[
|
||||||
enable_docs=yes])
|
enable_doc=yes])
|
||||||
|
|
||||||
AC_ARG_ENABLE(contrib,
|
AC_ARG_ENABLE(contrib,
|
||||||
AS_HELP_STRING([--disable-contrib], [Disable build and install of contrib section]),,[
|
AS_HELP_STRING([--disable-contrib], [Disable build and install of contrib section]),,[
|
||||||
@@ -105,52 +89,44 @@ 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])
|
||||||
|
|
||||||
### Enable features ###########################################################################
|
### Enable features ###########################################################################
|
||||||
|
|
||||||
@@ -164,22 +140,6 @@ AS_IF([test "x$enable_fallback_shell" = "xyes"], [
|
|||||||
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_rw_rootfs" = "xyes"], [
|
|
||||||
AC_DEFINE(REMOUNT_ROOTFS, 1, [Remount / as rw at boot])])
|
|
||||||
|
|
||||||
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"], [
|
AS_IF([test "x$enable_watchdog" = "xyes"], [
|
||||||
AC_DEFINE(BUILTIN_WATCHDOG, 1, [Enable built-in watchdog, kicks on /dev/watchdog])])
|
AC_DEFINE(BUILTIN_WATCHDOG, 1, [Enable built-in watchdog, kicks on /dev/watchdog])])
|
||||||
|
|
||||||
@@ -187,34 +147,28 @@ 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"], [
|
AS_IF([test "x$enable_logit" != "xno"], [
|
||||||
AC_DEFINE(LOGIT_ENABLED, 1, [Enable logit tool, used for log redirection by Finit])])
|
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"], [
|
||||||
@@ -222,16 +176,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])])
|
||||||
@@ -239,7 +194,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"], [
|
||||||
@@ -250,10 +206,9 @@ AS_IF([test "x$with_random_seed" != "xno"], [
|
|||||||
|
|
||||||
# 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$enable_watchdog" = "xyes"])
|
AM_CONDITIONAL(WATCHDOGD, [test "x$enable_watchdog" = "xyes"])
|
||||||
AM_CONDITIONAL(LOGIT, [test "x$enable_logit" = "xyes"])
|
AM_CONDITIONAL(LOGIT, [test "x$enable_logit" = "xyes"])
|
||||||
AM_CONDITIONAL(DOCS, [test "x$enable_docs" = "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"])
|
||||||
|
|
||||||
# Override default libdir, used for plugins and rescue.conf
|
# Override default libdir, used for plugins and rescue.conf
|
||||||
@@ -268,6 +223,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
|
||||||
@@ -277,13 +234,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
|
||||||
@@ -293,18 +251,13 @@ Behavior:
|
|||||||
Plugins...............: $plugins
|
Plugins...............: $plugins
|
||||||
|
|
||||||
Optional features:
|
Optional features:
|
||||||
Install docs/.........: $enable_docs
|
Install doc/..........: $enable_doc
|
||||||
Install contrib/......: $enable_contrib
|
Install contrib/......: $enable_contrib
|
||||||
Built-in inetd........: $enable_inetd
|
|
||||||
Built-in watchdogd....: $enable_watchdog
|
Built-in watchdogd....: $enable_watchdog
|
||||||
Built-in logrotate....: $enable_logrotate
|
Built-in logrotate....: $enable_logrotate
|
||||||
Scripting tool logit..: $enable_logit
|
Scripting tool logit..: $enable_logit
|
||||||
Emergency shell.......: $enable_emergency_shell
|
Emergency shell.......: $enable_emergency_shell
|
||||||
Fallback shell........: $enable_fallback_shell
|
Fallback shell........: $enable_fallback_shell
|
||||||
Remount / RW at boot..: $enable_rw_rootfs
|
|
||||||
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-rw-rootfs --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-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,5 @@
|
|||||||
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 klogd.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,4 @@
|
|||||||
# Consoles to start getty on when system is up
|
# Consoles to start getty on when system is up
|
||||||
tty /dev/tty1 noclear nowait
|
tty [12345] /dev/tty1 noclear nowait
|
||||||
tty /dev/tty2 noclear nowait
|
tty [2345] /dev/tty2 noclear nowait
|
||||||
tty /dev/tty3 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 +1,2 @@
|
|||||||
# Start klogd as soon as possible, should always run
|
# Start klogd as soon as possible, after syslogd, should always run
|
||||||
service [S12345] /sbin/klogd -n -- Kernel log daemon
|
service [S12345] <pid/syslogd> env:-/etc/conf.d/klogd klogd -n $KLOGD_OPTS -- Kernel log daemon
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
service [2345] /usr/sbin/lxdm -- Lightweight Login Manager
|
service [2345] lxdm -- Lightweight Login Manager
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
## 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
|
||||||
|
|||||||
@@ -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,2 @@
|
|||||||
|
# Start syslogd as soon as possible, should always run
|
||||||
|
service [S12345] env:-/etc/conf.d/syslog syslogd -n $SYSLOGD_OPTS -- Syslog 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
|
||||||
@@ -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-rw-rootfs --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
|
||||||
|
|||||||
@@ -5,23 +5,18 @@ d_LINKS = console-setup.conf getty.conf keyboard-setup.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 getty.conf keyboard-setup.conf \
|
||||||
keyboard-setup.conf lightdm.conf modules.conf \
|
lightdm.conf modules.conf rsyslogd.conf sntpd.conf \
|
||||||
ntpclient.conf rsyslogd.conf sshd.conf xdm.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
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Consoles to start getty on when system is up
|
# Consoles to start getty on when system is up
|
||||||
tty [12345] /dev/tty1 115200 vt100 noclear nowait
|
tty [12345] /dev/tty1 linux noclear nowait
|
||||||
tty [2345] /dev/tty2 38400 linux noclear nowait
|
tty [2345] /dev/tty2 linux noclear nowait
|
||||||
tty [2345] /dev/tty3 38400 linux noclear nowait
|
tty [2345] /dev/tty3 linux noclear nowait
|
||||||
|
|||||||
@@ -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 ..."
|
||||||
|
|||||||
+6
-16
@@ -2,9 +2,6 @@
|
|||||||
#
|
#
|
||||||
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
|
||||||
@@ -33,28 +30,21 @@ 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] <pid/syslogd> klogd -n -- Kernel logging server
|
||||||
service [2345] /sbin/syslogd -n -- Syslog server
|
service [2345] syslogd -n -- Syslog server
|
||||||
service [3] /usr/sbin/gdm -- GNOME Display Manager
|
service [3] gdm -- GNOME Display Manager
|
||||||
|
|
||||||
# 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-rw-rootfs --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-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,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,4 +1,4 @@
|
|||||||
# Consoles to start Finit built-in getty on when system is up
|
# Consoles to start Finit built-in getty on when system is up
|
||||||
tty /dev/tty1 noclear nowait
|
tty [12345] /dev/tty1 noclear nowait
|
||||||
tty /dev/tty2 noclear nowait
|
tty [2345] /dev/tty2 noclear nowait
|
||||||
tty /dev/tty3 noclear nowait
|
tty [2345] /dev/tty3 noclear nowait
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
# Start klogd as soon as possible, should always run
|
# Start klogd as soon as possible, should always run
|
||||||
service [S12345] /sbin/klogd -n -- Kernel log daemon
|
service [S12345] <pid/syslogd> klogd -n -- Kernel log daemon
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
service [2345] /usr/sbin/lxdm -- Lightweight Login Manager
|
service [2345] lxdm -- Lightweight Login Manager
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
## 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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
# Start syslogd as soon as possible, should always run
|
# Start syslogd as soon as possible, should always run
|
||||||
service [S12345] /sbin/syslogd -n -- Syslog daemon
|
service [S12345] 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
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
docsdir := @docdir@/doc
|
||||||
|
docs_DATA = config.md conditions.md distro.md plugins.md \
|
||||||
|
service.md signals.md svc-machine.png cmdline.md
|
||||||
|
EXTRA_DIST = $(docs_DATA)
|
||||||
+44
@@ -0,0 +1,44 @@
|
|||||||
|
Goals of Finit
|
||||||
|
==============
|
||||||
|
|
||||||
|
Initially Finit aimed to be more than a processes monitor, acting as a
|
||||||
|
replacement for cron/at and inetd as well. Over time, however, the true
|
||||||
|
value in the project turned out to be:
|
||||||
|
|
||||||
|
> A simple SysV init and systemd replacement, primarily for embedded
|
||||||
|
> systems, container, and dedicated server applications.
|
||||||
|
|
||||||
|
|
||||||
|
Misc TODOs
|
||||||
|
----------
|
||||||
|
|
||||||
|
Some of these are also registered in the issue tracker on GitHub.
|
||||||
|
|
||||||
|
* Refactor the .conf parser, parse user input in a separate process
|
||||||
|
* 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
|
||||||
|
* When a process dies, and Finit does not restart it, we should collect
|
||||||
|
a `siginfo_t` from the SIGCHLD signal and supply to the user in case
|
||||||
|
`initctl status <process>` is called to debug the issue.
|
||||||
|
* 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
|
||||||
|
* Add `finit.conf` support for ctrl-alt-delete (SIGINT) and kbrequest,
|
||||||
|
i.e. KeyboardSignal, (SIGWINCH) behavior. Using conditions to a task,
|
||||||
|
e.g, <sys/key/ctrlaltdel> and <sys/key/signal> like SIGPWR handling.
|
||||||
|
* Write man pages for finit and `finit.conf`, steal from the excellent
|
||||||
|
`pimd` man pages ...
|
||||||
|
* Add support for timed shutdown in Finit, including cancelled shutdown
|
||||||
|
* Add support for JSON output, or similar, from `initctl show`, e.g.
|
||||||
|
`initctl show --json`
|
||||||
|
|
||||||
|
|
||||||
|
Init
|
||||||
|
----
|
||||||
|
|
||||||
|
Finit in itself is not SysV Init compatible, it doesn't use `/etc/rc.d`
|
||||||
|
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
|
||||||
|
`/etc/inittab` to be able to start standard Linux systems.
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ Bootstrap
|
|||||||
9. Parse `/etc/finit.conf` and all `/etc/finit.d/*.conf` files
|
9. Parse `/etc/finit.conf` and all `/etc/finit.d/*.conf` files
|
||||||
10. Start built-in watchdog, if enabled
|
10. Start built-in watchdog, if enabled
|
||||||
11. Set hostname
|
11. Set hostname
|
||||||
12. Pivot root, or remount `/` read-write, depending on system type
|
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
|
||||||
15. Enable SysV init signals
|
15. Enable SysV init signals
|
||||||
@@ -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,12 +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`
|
||||||
|
|
||||||
* `--enable-rw-rootfs`: Most desktop and server systems boot with the
|
* `--exec-prefix=..`: This you want to set to the empty string, or `/`, to
|
||||||
root file stystem read-only. With this setting Finit will remount it
|
ensure the programs `finit` and `initctl` are installed to the proper
|
||||||
as read-write early at boot so the `bootmisc.so` plugin can run.
|
locations. Linux expects an "init" in `/sbin`, default: `--prefix`
|
||||||
Usually not needed on embedded systems.
|
|
||||||
|
* `--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
|
||||||
@@ -66,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-rw-rootfs --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
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
Tips & Tricks with the kernel cmdline
|
||||||
|
=====================================
|
||||||
|
|
||||||
|
This document summarizes the different boot parameters that can be
|
||||||
|
passed on the Linux kernel command line. Not limited to Finit.
|
||||||
|
|
||||||
|
The `bool` setting is one of `on, off, true false, 1, 0`.
|
||||||
|
|
||||||
|
|
||||||
|
* `debug`: Enable kernel debug. Debug messages are printed to the
|
||||||
|
console until Finit starts up.
|
||||||
|
|
||||||
|
* `finit.debug[=bool]`: Enable finit debug. This is operated
|
||||||
|
independently of the kernel debug setting. New as of Finit v4.
|
||||||
|
|
||||||
|
* `finit.show_status[=bool]`: Control finit boot progress, including
|
||||||
|
banner.
|
||||||
|
|
||||||
|
* `finit.status_style=<classic,modern>`: Set Finit boot progress style,
|
||||||
|
when enabled.
|
||||||
|
|
||||||
|
* `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`: 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 Finit rescue mode; no network, no `fsck` of file
|
||||||
|
systems in `/etc/fstab`, no `/etc/rc.local`, no `runparts`. The
|
||||||
|
configuration is read from `/lib/finit/rescue.conf`, and can be
|
||||||
|
modified by the operator.
|
||||||
|
|
||||||
|
* `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)][].
|
||||||
|
|
||||||
|
|
||||||
|
[bootparam(7)]: https://www.man7.org/linux/man-pages/man7/bootparam.7.html
|
||||||
@@ -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
|
||||||
@@ -56,32 +54,33 @@ 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`.
|
||||||
|
|
||||||
|
|
||||||
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 +94,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 +138,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 +154,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 +164,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
|
||||||
+510
@@ -0,0 +1,510 @@
|
|||||||
|
Configuration
|
||||||
|
=============
|
||||||
|
|
||||||
|
* [Introduction](#introduction)
|
||||||
|
* [Service Wrapper Scripts](#service-wrapper-scripts)
|
||||||
|
* [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)
|
||||||
|
* [Limitations](#limitations)
|
||||||
|
* [/etc/finit.conf](#etcfinitconf)
|
||||||
|
* [/etc/finit.d](#etcfinitd)
|
||||||
|
|
||||||
|
|
||||||
|
Introduction
|
||||||
|
------------
|
||||||
|
|
||||||
|
Finit can be configured using only the original `/etc/finit.conf` file
|
||||||
|
or in combination with `/etc/finit.d/*.conf`. Useful for package-based
|
||||||
|
Linux distributions -- each package can provide its own "script" file.
|
||||||
|
|
||||||
|
- `/etc/finit.conf`: main configuration file
|
||||||
|
- `/etc/finit.d/*.conf`: snippets, usually one service per file
|
||||||
|
|
||||||
|
Not all configuration directives are available in `/etc/finit.d/*.conf`
|
||||||
|
and some directives are only available at bootstrap, runlevel `S`, see
|
||||||
|
the section [Limitations](#limitations) below for details.
|
||||||
|
|
||||||
|
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
|
||||||
|
call `finit q`, but that has been deprecated with the `initctl` tool).
|
||||||
|
Finit monitors all known active `.conf` files, so if you want to force
|
||||||
|
a restart of any service you can simply touch its corresponding `.conf`
|
||||||
|
file in `/etc/finit.d` and call `initctl reload`. Finit handle any
|
||||||
|
and all conditions and dependencies between services automatically.
|
||||||
|
|
||||||
|
It is also possible to drop `.conf` files in `/etc/finit.d/available/`
|
||||||
|
and use `initctl enable` to enable a service `.conf` file. This may be
|
||||||
|
useful in particular to Linux distributions that may want to install all
|
||||||
|
files for a package and let the user decide when to enable a service.
|
||||||
|
|
||||||
|
On `initctl reload` the following is checked for all services:
|
||||||
|
|
||||||
|
- If a service's `.conf` file has been removed, or its conditions are no
|
||||||
|
longer satisifed, the service is stopped.
|
||||||
|
- If the file is modified, or a service it depends on has been reloaded,
|
||||||
|
the service is reloaded (stopped and started).
|
||||||
|
- If a new service is added it is automatically started — respecting
|
||||||
|
runlevels and return values from any callbacks.
|
||||||
|
|
||||||
|
For more info on the different states of a service, see the separate
|
||||||
|
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
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
If your service requires to run additional commands, executed before the
|
||||||
|
service is actually started, like the systemd `ExecStartPre`, you can
|
||||||
|
use a wrapper shell script to start your service.
|
||||||
|
|
||||||
|
The Finit service `.conf` file can be put into `/etc/finit.d/available`,
|
||||||
|
so you can control the service using `initctl`. Then use the path to
|
||||||
|
the wrapper script in the Finit `.conf` service stanza. The following
|
||||||
|
example employs a wrapper script in `/etc/start.d`.
|
||||||
|
|
||||||
|
**Example:**
|
||||||
|
|
||||||
|
* `/etc/finit.d/available/program.conf`:
|
||||||
|
|
||||||
|
service [235] <!> /etc/start.d/program -- Example Program
|
||||||
|
|
||||||
|
* `/etc/start.d/program:`
|
||||||
|
|
||||||
|
#!/bin/sh
|
||||||
|
# Prepare the command line options
|
||||||
|
OPTIONS="-u $(cat /etc/username)"
|
||||||
|
|
||||||
|
# Execute the program
|
||||||
|
exec /usr/bin/program $OPTIONS
|
||||||
|
|
||||||
|
> **Note:** the example sets `<!>` to denote that it doesn't support
|
||||||
|
> `SIGHUP`. That way Finit will stop/start the service
|
||||||
|
> instead of sending SIGHUP at restart/reload events.
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
the man page, or the kernel `/proc/PID/limits` file, for details.
|
||||||
|
Finit versions before v3.1 used `infinity` for `unlimited`, which is
|
||||||
|
still supported, albeit deprecated.
|
||||||
|
|
||||||
|
# No process is allowed more than 8MB of address space
|
||||||
|
rlimit hard as 8388608
|
||||||
|
|
||||||
|
# Core dumps may be arbitrarily large
|
||||||
|
rlimit soft core infinity
|
||||||
|
|
||||||
|
# CPU limit for all services, soft & hard = 10 sec
|
||||||
|
rlimit cpu 10
|
||||||
|
|
||||||
|
`rlimit` can be set globally, in `/etc/finit.conf`, or locally per
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
### Runlevels
|
||||||
|
|
||||||
|
**Syntax:** `runlevel <N>`
|
||||||
|
|
||||||
|
Defines 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
|
||||||
|
command. Highly useful if true serialization is needed.
|
||||||
|
|
||||||
|
> `<COND>` is described in the [Services](#services) section.
|
||||||
|
|
||||||
|
|
||||||
|
### 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
|
||||||
|
redirects can be freely used:
|
||||||
|
|
||||||
|
task [s] echo "foo" | cat >/tmp/bar
|
||||||
|
|
||||||
|
> `<COND>` is described in the [Services](#services) section.
|
||||||
|
|
||||||
|
|
||||||
|
### 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 a disallowed runlevel, Finit calls `init-script stop`, and if
|
||||||
|
the Finit .conf, where `sysv` stanza is declared, is modified, Finit
|
||||||
|
calls `init-script restart` on `initctl reload`. Similar to how
|
||||||
|
`service` stanzas work.
|
||||||
|
|
||||||
|
Forking services started with `sysv` scripts can be monitored by Finit
|
||||||
|
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.
|
||||||
|
|
||||||
|
For daemons that support it, we recommend appending `--foreground`,
|
||||||
|
`--no-background`, `-n`, `-F`, or similar command line 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 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.
|
||||||
|
|
||||||
|
**Example:**
|
||||||
|
|
||||||
|
In the case of `ospfd` (below), we omit the `-d` flag (daemonize) to
|
||||||
|
prevent it from forking to the background:
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
`<...>` is the condition for starting `ospfd`. In this example Finit
|
||||||
|
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.
|
||||||
|
|
||||||
|
Some services do not maintain a PID file and rather than patching each
|
||||||
|
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:
|
||||||
|
|
||||||
|
pid[:[/path/to/]filename[.pid]]
|
||||||
|
|
||||||
|
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`.
|
||||||
|
|
||||||
|
|
||||||
|
### 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).
|
||||||
|
|
||||||
|
### 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] <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:**
|
||||||
|
|
||||||
|
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:**
|
||||||
|
|
||||||
|
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:**
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
configure --enable-fallback-shell
|
||||||
|
|
||||||
|
One can also use the `service` stanza to start a stand-alone shell:
|
||||||
|
|
||||||
|
service [12345] /bin/sh -l
|
||||||
|
|
||||||
|
|
||||||
|
### Non-privileged Services
|
||||||
|
|
||||||
|
Every `run`, `task`, or `service` can also list the privileges the
|
||||||
|
`/path/to/cmd` should be executed with. Simply prefix the path with
|
||||||
|
`[@USR[:GRP]]` like this:
|
||||||
|
|
||||||
|
run [2345] @joe:users logger "Hello world"
|
||||||
|
|
||||||
|
For multiple instances of the same command, e.g. a DHCP client or
|
||||||
|
multiple web servers, add `:ID` somewhere between the `run`, `task`,
|
||||||
|
`service` keyword and the command, like this:
|
||||||
|
|
||||||
|
service :80 [2345] httpd -f -h /http -p 80 -- Web server
|
||||||
|
service :8080[2345] httpd -f -h /http -p 8080 -- Old web server
|
||||||
|
|
||||||
|
Without the `:ID` to the service the latter will overwrite the former
|
||||||
|
and only the old web server would be started and supervised.
|
||||||
|
|
||||||
|
|
||||||
|
### Redirecting Output
|
||||||
|
|
||||||
|
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:prio:facility.level,tag:ident
|
||||||
|
log:console
|
||||||
|
log:null
|
||||||
|
log
|
||||||
|
|
||||||
|
Default `prio` is `daemon.info` and default `tag` is the basename of the
|
||||||
|
service or run/task command.
|
||||||
|
|
||||||
|
Log rotation is controlled using the global `log` setting.
|
||||||
|
|
||||||
|
**Example:**
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
Limitations
|
||||||
|
-----------
|
||||||
|
|
||||||
|
As of Finit v4 there are no limitations to where `.conf` settings can be
|
||||||
|
placed. Except for the system/global `rlimit`, which can only be set
|
||||||
|
from `/etc/finit.conf`, since it is the first `.conf` file Finit reads.
|
||||||
|
|
||||||
|
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,
|
||||||
|
network bringup and system shutdown. These can now also be set in any
|
||||||
|
`.conf` file in `/etc/finit.d`.
|
||||||
|
|
||||||
|
There is, however, nothing preventing you from having all configuration
|
||||||
|
settings in `/etc/finit.conf`.
|
||||||
|
|
||||||
|
> **Note:** The `/etc/finit.d` directory was previously the default
|
||||||
|
> Finit `runparts` directory. Finit no longer has a default
|
||||||
|
> `runparts`, make sure to update your setup, or the finit
|
||||||
|
> configuration, accordingly.
|
||||||
|
|
||||||
|
[run-parts(8)]: http://manpages.debian.org/cgi-bin/man.cgi?query=run-parts
|
||||||
@@ -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
|
||||||
@@ -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.
|
||||||
@@ -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
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
Finit Signals
|
||||||
|
=============
|
||||||
|
|
||||||
|
Finit is often used on embedded and small Linux systems with BusyBox.
|
||||||
|
Though Finit comes with its own tools for (poweroff, halt, reboot), for
|
||||||
|
compatibility with the existing BusyBox toolset the following signals
|
||||||
|
have been adopted:
|
||||||
|
|
||||||
|
`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.
|
||||||
|
|
||||||
|
`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.
|
||||||
|
|
||||||
|
`SIGTERM`
|
||||||
|
---------
|
||||||
|
|
||||||
|
Like `SIGUSR1`, but tell kernel to reboot the system when done.
|
||||||
|
|
||||||
|
SysV init N/A, systemd rexecutes itself.
|
||||||
|
|
||||||
|
`SIGINT`
|
||||||
|
--------
|
||||||
|
|
||||||
|
Sent from kernel when the CTRL-ALT-DEL key combo is pressed. SysV init
|
||||||
|
and systemd default to reboot with `shutdown -r`.
|
||||||
|
|
||||||
|
Finit currently forwards this to `SIGTERM`.
|
||||||
|
|
||||||
|
`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`.
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@@ -1,4 +0,0 @@
|
|||||||
docsdir := @docdir@/docs
|
|
||||||
docs_DATA = config.md conditions.md distro.md inetd.md plugins.md \
|
|
||||||
service.md signals.md svc-machine.png cmdline.md
|
|
||||||
EXTRA_DIST = $(docs_DATA)
|
|
||||||
-119
@@ -1,119 +0,0 @@
|
|||||||
Goals of Finit
|
|
||||||
==============
|
|
||||||
|
|
||||||
The intent of finit is to monitor not just processes, but to supervise
|
|
||||||
an entire system and the behavior of certain processes that declare
|
|
||||||
themselves to be finit compliant. Similar to launchd, the goal of
|
|
||||||
finit is to be a replacement for:
|
|
||||||
|
|
||||||
* init
|
|
||||||
* inetd
|
|
||||||
* 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
|
|
||||||
-----------
|
|
||||||
|
|
||||||
* When a process dies, and Finit does not restart it, we should collect
|
|
||||||
a `siginfo_t` from the SIGCHLD signal and supply to the user in case
|
|
||||||
`initctl status <process>` is called to debug the issue.
|
|
||||||
* Merge UDP redirect service uredir as an UDP inetd variant
|
|
||||||
* 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
|
|
||||||
* Add `finit.conf` support for ctrl-alt-delete (SIGINT) and kbrequest,
|
|
||||||
i.e. KeyboardSignal, (SIGWINCH) behavior. Using conditions to a task,
|
|
||||||
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
|
|
||||||
`pimd` man pages ...
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
`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
|
|
||||||
----
|
|
||||||
|
|
||||||
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
|
|
||||||
to achieve compatibility would be to add a plugin to finit which reads
|
|
||||||
`/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`
|
|
||||||
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
Tips & Tricks with the kernel cmdline
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
This document summarizes the different boot parameters that can be
|
|
||||||
passed on the Linux kernel command line. Not just limited to Finit.
|
|
||||||
|
|
||||||
* `debug`, or `--debug`
|
|
||||||
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`
|
|
||||||
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 Finit rescue mode; no network, no `fsck` of file systems in
|
|
||||||
`/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`
|
|
||||||
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.
|
|
||||||
|
|
||||||
* `splash`
|
|
||||||
Display Finit splash screen with progress at bootstrap and shutdown.
|
|
||||||
|
|
||||||
For more on kernel boot paramaters, see the man page `bootparam(7)`.
|
|
||||||
-457
@@ -1,457 +0,0 @@
|
|||||||
Configuration
|
|
||||||
=============
|
|
||||||
|
|
||||||
* [Introduction](#introduction)
|
|
||||||
* [Service Wrapper Scripts](#service-wrapper-scripts)
|
|
||||||
* [Syntax](#syntax)
|
|
||||||
* [Limitations](#limitations)
|
|
||||||
* [/etc/finit.conf](#etcfinitconf)
|
|
||||||
* [/etc/finit.d](#etcfinitd)
|
|
||||||
|
|
||||||
|
|
||||||
Introduction
|
|
||||||
------------
|
|
||||||
|
|
||||||
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
|
|
||||||
system using only `/etc/finit.d/*.conf`, highly useful for package-based
|
|
||||||
Linux distributions -- each package can provide its own "script" file.
|
|
||||||
|
|
||||||
- `/etc/finit.conf`: main configuration file
|
|
||||||
- `/etc/finit.d/*.conf`: snippets, usually one service per file
|
|
||||||
|
|
||||||
Not all configuration directives are available in `/etc/finit.d/*.conf`
|
|
||||||
and some directives are only available at bootstrap, runlevel `S`, see
|
|
||||||
the section [Limitations](#limitations) below for details.
|
|
||||||
|
|
||||||
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
|
|
||||||
call `finit q`, but that has been deprecated with the `initctl` tool).
|
|
||||||
Finit monitors all known active `.conf` files, so if you want to force
|
|
||||||
a restart of any service you can simply touch its corresponding `.conf`
|
|
||||||
file in `/etc/finit.d` and call `initctl reload`. Finit handle any
|
|
||||||
and all conditions and dependencies between services automatically.
|
|
||||||
|
|
||||||
It is also possible to drop `.conf` files in `/etc/finit.d/available/`
|
|
||||||
and use `initctl enable` to enable a service `.conf` file. This may be
|
|
||||||
useful in particular to Linux distributions that may want to install all
|
|
||||||
files for a package and let the user decide when to enable a service.
|
|
||||||
|
|
||||||
On `initctl reload` the following is checked for all services:
|
|
||||||
|
|
||||||
- If a service's `.conf` file has been removed, or its conditions are no
|
|
||||||
longer satisifed, the service is stopped.
|
|
||||||
- If the file is modified, or a service it depends on has been reloaded,
|
|
||||||
the service is reloaded (stopped and started).
|
|
||||||
- If a new service is added it is automatically started — respecting
|
|
||||||
runlevels and return values from any callbacks.
|
|
||||||
|
|
||||||
For more info on the different states of a service, see the separate
|
|
||||||
document [Finit Services](service.md).
|
|
||||||
|
|
||||||
|
|
||||||
Service Wrapper Scripts
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
If your service requires to run additional commands, executed before the
|
|
||||||
service is actually started, like the systemd `ExecStartPre`, you can
|
|
||||||
use a wrapper shell script to start your service.
|
|
||||||
|
|
||||||
The Finit service `.conf` file can be put into `/etc/finit.d/available`,
|
|
||||||
so you can control the service using `initctl`. Then use the path to
|
|
||||||
the wrapper script in the Finit `.conf` service stanza. The following
|
|
||||||
example employs a wrapper script in `/etc/start.d`.
|
|
||||||
|
|
||||||
**Example:**
|
|
||||||
|
|
||||||
* `/etc/finit.d/available/program.conf`:
|
|
||||||
```conf
|
|
||||||
service [235] <!> /etc/start.d/program -- Example Program
|
|
||||||
```
|
|
||||||
|
|
||||||
* `/etc/start.d/program:`
|
|
||||||
```shell
|
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Prepare the command line options
|
|
||||||
OPTIONS="-u $(cat /etc/username)"
|
|
||||||
|
|
||||||
# Execute the program
|
|
||||||
exec /usr/bin/program $OPTIONS
|
|
||||||
```
|
|
||||||
|
|
||||||
**Note:**, that the example sets `<!>` to denote that it doesn't support
|
|
||||||
`SIGHUP`. That way Finit will stop/start such the service instead of
|
|
||||||
sending SIGHUP at restart/reload.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
* `module <MODULE> [ARGS]`
|
|
||||||
Load a kernel module, with optional arguments. Similar to `insmod`
|
|
||||||
command line tool.
|
|
||||||
|
|
||||||
Note, 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/`, 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"
|
|
||||||
|
|
||||||
* `network <PATH>`
|
|
||||||
Script or program to bring up networking, with optional arguments
|
|
||||||
|
|
||||||
* `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 the prefix. E.g. to set `RLIMIT_CPU`, use `cpu`.
|
|
||||||
|
|
||||||
LIMIT is an integer that depends on the resource being modified, see
|
|
||||||
the man page, or the kernel `/proc/PID/limits` file, for details.
|
|
||||||
Finit versions before v3.1 used `infinity` for `unlimited`, which is
|
|
||||||
still supported, albeit deprecated.
|
|
||||||
|
|
||||||
```shell
|
|
||||||
# No process is allowed more than 8MB of address space
|
|
||||||
rlimit hard as 8388608
|
|
||||||
|
|
||||||
# Core dumps may be arbitrarily large
|
|
||||||
rlimit soft core infinity
|
|
||||||
|
|
||||||
# CPU limit for all services, soft & hard = 10 sec
|
|
||||||
rlimit cpu 10
|
|
||||||
```
|
|
||||||
|
|
||||||
`rlimit` can be set globally, in `/etc/finit.conf`, or locally for
|
|
||||||
a set of task/run/services, in `/etc/finit.d/*.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`
|
|
||||||
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
|
|
||||||
command. Highly useful if true serialization is needed.
|
|
||||||
|
|
||||||
* `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
|
|
||||||
redirects can be freely used:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
task [s] echo "foo" | cat >/tmp/bar
|
|
||||||
```
|
|
||||||
|
|
||||||
* `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 a disallowed runlevel, Finit calls `init-script stop`,
|
|
||||||
and if the Finit .conf, where `sysv` stanza is declared, is modified,
|
|
||||||
Finit calls `init-script restart` on `initctl reload`. Similar to
|
|
||||||
how `service` stanzas work.
|
|
||||||
|
|
||||||
Forking services started with `sysv` scripts can be monitored by Finit
|
|
||||||
by declaring the PID file to look for: `pid:!/path/to/pidfile.pid`.
|
|
||||||
|
|
||||||
* `service [LVLS] <COND> /path/to/daemon ARGS -- Optional description`
|
|
||||||
Service, or daemon, to be monitored and automatically restarted if it
|
|
||||||
exits prematurely.
|
|
||||||
|
|
||||||
For daemons that support it, we recommend appending `--foreground`, or
|
|
||||||
`--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
|
|
||||||
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.
|
|
||||||
|
|
||||||
In the case of `ospfd` (below), we omit the `-d` flag to prevent it
|
|
||||||
from forking (daemonizing):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
service [2345] <svc/sbin/zebra> /sbin/ospfd -- OSPF daemon
|
|
||||||
```
|
|
||||||
|
|
||||||
The `[2345]` is the runlevels `ospfd` is allowed to run in, they are
|
|
||||||
optional and default to level 2-5 if left out.
|
|
||||||
|
|
||||||
The `<...>` is the condition for starting `ospfd`. In this example
|
|
||||||
Finit waits for another service, `/sbin/zebra`, to have created its
|
|
||||||
PID file in `/var/run/zebra.pid` before starting `ospfd`.
|
|
||||||
|
|
||||||
Some services do not maintain a PID file and rather than patching each
|
|
||||||
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 argument:
|
|
||||||
|
|
||||||
pid[:[/path/to/]filename[.pid]]
|
|
||||||
|
|
||||||
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 `<svc/sbin/foo>`, notice the composition of conditions.
|
|
||||||
|
|
||||||
However, if a service `bar` *does* create a PID file, using `foo.pid`,
|
|
||||||
we can inform Finit of this by prepending an `!`:
|
|
||||||
|
|
||||||
pid:!/run/foo.pid
|
|
||||||
|
|
||||||
Here Finit will *not* create/remove/touch the PID file, only use it
|
|
||||||
for the condition handling instead of the default PID file name.
|
|
||||||
|
|
||||||
> 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`.
|
|
||||||
|
|
||||||
* `inetd service/proto[@iflist] <wait|nowait> [LVLS] /path/to/daemon args`
|
|
||||||
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
|
|
||||||
inetd ftp/tcp nowait @root /usr/sbin/uftpd -i -f
|
|
||||||
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`, which is very useful on embedded systems. Default
|
|
||||||
baud rate is `38400`.
|
|
||||||
|
|
||||||
**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`.
|
|
||||||
|
|
||||||
**Example:**
|
|
||||||
```conf
|
|
||||||
tty [12345] @console 115200 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:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
run [2345] @joe:users /usr/bin/logger "Hello world"
|
|
||||||
```
|
|
||||||
|
|
||||||
For multiple instances of the same command, e.g. a DHCP client or
|
|
||||||
multiple web servers, add `:ID` somewhere between the `run`, `task`,
|
|
||||||
`service` keyword and the command, like this:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
service :1 [2345] /sbin/httpd -f -h /http -p 80 -- 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
|
|
||||||
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
|
|
||||||
syslog using the native `logit` tool. The full syntax is:
|
|
||||||
|
|
||||||
log:/path/to/file
|
|
||||||
log:prio:facility.level,tag:ident
|
|
||||||
log:console
|
|
||||||
log:null
|
|
||||||
log
|
|
||||||
|
|
||||||
Default `prio` is `daemon.info` and default `tag` is the basename of the
|
|
||||||
service or run/task command.
|
|
||||||
|
|
||||||
Log rotation is controlled using the global `log` setting.
|
|
||||||
|
|
||||||
**Example:**
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
|
|
||||||
Limitations
|
|
||||||
-----------
|
|
||||||
|
|
||||||
To understand the limitations of `finit.conf` vs `finit.d` it is useful
|
|
||||||
to picture the different phases of the system: bootstrap, runtime, and
|
|
||||||
shutdown.
|
|
||||||
|
|
||||||
### /etc/finit.conf
|
|
||||||
|
|
||||||
This file used to be the only way to set up and boot a Finit system.
|
|
||||||
Today it is mainly used for pre-runtime settings like system hostname,
|
|
||||||
network bringup and shutdown:
|
|
||||||
|
|
||||||
- `host`, only at bootstrap, (runlevel `S`)
|
|
||||||
- `mknod`, only at bootstrap
|
|
||||||
- `network`, only at bootstrap
|
|
||||||
- `runparts`, only at bootstrap
|
|
||||||
- `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
|
|
||||||
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
|
|
||||||
- `service`
|
|
||||||
- `task`
|
|
||||||
- `run`
|
|
||||||
- `inetd`
|
|
||||||
- `rlimit`
|
|
||||||
- `tty`
|
|
||||||
|
|
||||||
**NOTE:** The `/etc/finit.d` directory was previously the default Finit
|
|
||||||
`runparts` directory. Finit no longer has a default `runparts`, make
|
|
||||||
sure to update your setup, or the finit configuration, accordingly.
|
|
||||||
|
|
||||||
[run-parts(8)]: http://manpages.debian.org/cgi-bin/man.cgi?query=run-parts
|
|
||||||
-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
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
Finit Signals
|
|
||||||
=============
|
|
||||||
|
|
||||||
Finit is often used on embedded and small Linux systems with BusyBox.
|
|
||||||
Though Finit comes with its own tools for (poweroff, halt, reboot), for
|
|
||||||
compatibility with the existing BusyBox toolset the following signals
|
|
||||||
have been adopted:
|
|
||||||
|
|
||||||
* `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.
|
|
||||||
* `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.
|
|
||||||
* `SIGTERM`
|
|
||||||
Like `SIGUSR1`, but tell kernel to reboot the system when done.
|
|
||||||
|
|
||||||
SysV init N/A, systemd rexecutes itself.
|
|
||||||
* `SIGINT`
|
|
||||||
Sent from kernel when the CTRL-ALT-DEL key combo is pressed.
|
|
||||||
SysV init and systemd default to reboot with `shutdown -r`.
|
|
||||||
Finit currently forwards this to `SIGTERM`.
|
|
||||||
* `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.
|
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
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
+14
-6
@@ -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)
|
||||||
@@ -116,8 +117,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);
|
||||||
@@ -142,10 +145,12 @@ static void setup(void *arg)
|
|||||||
/*
|
/*
|
||||||
* 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 */
|
create("/var/run/utmp", 0644, 0, gid); /* Currently logged in */
|
||||||
create("/var/log/btmp", 0600, 0, gid); /* Failed logins */
|
create("/var/log/wtmp", 0644, 0, gid); /* Login history */
|
||||||
create("/var/log/lastlog", 0644, 0, gid);
|
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();
|
||||||
@@ -162,6 +167,8 @@ static void setup(void *arg)
|
|||||||
makedir("/var/run/pluto", 0755); /* Needed by Openswan */
|
makedir("/var/run/pluto", 0755); /* Needed by Openswan */
|
||||||
makedir("/var/run/quagga", 0755); /* Needed by Quagga */
|
makedir("/var/run/quagga", 0755); /* Needed by Quagga */
|
||||||
makedir("/var/log/quagga", 0755); /* Needed by Quagga */
|
makedir("/var/log/quagga", 0755); /* Needed by Quagga */
|
||||||
|
makedir("/var/run/frr", 0755); /* Needed by FRR */
|
||||||
|
makedir("/var/log/frr", 0755); /* Needed by FRR */
|
||||||
makedir("/var/run/sshd", 01755); /* OpenSSH */
|
makedir("/var/run/sshd", 01755); /* OpenSSH */
|
||||||
|
|
||||||
gid = getgroup("tty");
|
gid = getgroup("tty");
|
||||||
@@ -191,6 +198,7 @@ static plugin_t plugin = {
|
|||||||
.hook[HOOK_BASEFS_UP] = {
|
.hook[HOOK_BASEFS_UP] = {
|
||||||
.cb = setup
|
.cb = setup
|
||||||
},
|
},
|
||||||
|
.depends = { "pidfile" },
|
||||||
};
|
};
|
||||||
|
|
||||||
PLUGIN_INIT(plugin_init)
|
PLUGIN_INIT(plugin_init)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user