mirror of
https://github.com/troglobit/finit.git
synced 2026-10-12 10:12:32 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4401f92ad | ||
|
|
0197a9427c | ||
|
|
49481053a4 | ||
|
|
13887f323a | ||
|
|
faca84a590 | ||
|
|
920df09cd5 | ||
|
|
3e71d43bff | ||
|
|
5c3a07e8e6 | ||
|
|
11dd877484 | ||
|
|
921fd1e363 | ||
|
|
f949017596 | ||
|
|
03a33fc0ee | ||
|
|
22192acce4 | ||
|
|
500d301700 | ||
|
|
e8f26709e2 | ||
|
|
91b3e5eeb4 | ||
|
|
71026adf03 | ||
|
|
978beb8e7e | ||
|
|
3ef75ac176 | ||
|
|
83b613581a | ||
|
|
d4c28f87d1 | ||
|
|
5b53f001a2 | ||
|
|
f1c9581da9 | ||
|
|
5301bcb4f1 | ||
|
|
c2bf7d3a50 | ||
|
|
685771aef2 | ||
|
|
3ebb697910 | ||
|
|
bacaea0e02 | ||
|
|
07d6e69c30 | ||
|
|
d2053bd07d | ||
|
|
1e8a45cbe2 | ||
|
|
f4662d8c06 | ||
|
|
38ba9930d0 | ||
|
|
00fe37174d | ||
|
|
33916a2097 | ||
|
|
dd8dd67106 | ||
|
|
eb870efaff | ||
|
|
84369ab8b5 | ||
|
|
7ef3959a45 | ||
|
|
858f793ad2 | ||
|
|
8749459206 | ||
|
|
1c9f2e9b55 | ||
|
|
9b8e7a0793 | ||
|
|
3f150901fe | ||
|
|
fd090a6785 | ||
|
|
83445f1ebe | ||
|
|
e88241316b | ||
|
|
f91205cbad | ||
|
|
94aec26e8c | ||
|
|
11026d9da3 | ||
|
|
a6a3299f08 | ||
|
|
34a15241ca | ||
|
|
7a2667d34c | ||
|
|
f39cd50762 | ||
|
|
ddeed15191 | ||
|
|
2b173e831f | ||
|
|
b02f241e5e | ||
|
|
1a45045a0f | ||
|
|
e131b20a6c | ||
|
|
888ce56f3e | ||
|
|
7d9f873b7c | ||
|
|
cf60cdd9c9 | ||
|
|
bb27dde3ca | ||
|
|
6d02c6a71c | ||
|
|
f0c5c2d7f2 | ||
|
|
29357acf18 | ||
|
|
a32d3b0c87 | ||
|
|
510b53e62d | ||
|
|
23481b197b | ||
|
|
4782b1dc54 | ||
|
|
1ee1b9cec4 | ||
|
|
cef2ef82b6 | ||
|
|
cafa759edb | ||
|
|
cf0554405b | ||
|
|
f6071d6701 | ||
|
|
7104296396 | ||
|
|
38a274114d | ||
|
|
97eca563b6 | ||
|
|
0174347039 | ||
|
|
02cc426f05 | ||
|
|
06d9d95723 | ||
|
|
b8a7f3e0cc | ||
|
|
7db0e265ad | ||
|
|
6818813ff8 | ||
|
|
5b8f7ce2a3 | ||
|
|
1f9a6a42c1 | ||
|
|
1c2d987bea | ||
|
|
906827cc88 | ||
|
|
b2d98dc010 | ||
|
|
d027b4ff9c | ||
|
|
843621aded | ||
|
|
da5ac16670 | ||
|
|
2c68183045 | ||
|
|
c40cd06d60 | ||
|
|
c901b65581 | ||
|
|
27abcb5682 | ||
|
|
b7617248ce | ||
|
|
c400d35f83 | ||
|
|
d236709457 | ||
|
|
07790f4044 | ||
|
|
3d5128be77 | ||
|
|
b37ea48e5d | ||
|
|
92616d2ac0 | ||
|
|
46bc75e7f3 | ||
|
|
5f81404162 | ||
|
|
6ba7cfc851 | ||
|
|
09d2243eba | ||
|
|
e97c5e5860 | ||
|
|
660a09c7c1 | ||
|
|
41c003b221 | ||
|
|
12d8ac2399 | ||
|
|
8dc263d508 | ||
|
|
afb3fada50 | ||
|
|
227dda34f7 | ||
|
|
06479aa5f1 | ||
|
|
75d29de3cc | ||
|
|
40fc95047d | ||
|
|
5551324291 | ||
|
|
46cef811d6 | ||
|
|
52ccd6d662 | ||
|
|
70afaa16f5 | ||
|
|
8a1015cf3e | ||
|
|
586f0a7799 | ||
|
|
474bd2f361 | ||
|
|
0caa8330b7 | ||
|
|
c8d8c817e7 | ||
|
|
0d9542c222 | ||
|
|
b6be354508 | ||
|
|
448c6749d6 | ||
|
|
0f09c1b0dc | ||
|
|
7db6611593 | ||
|
|
c9b13759a2 | ||
|
|
449c712329 | ||
|
|
e27283c5e6 | ||
|
|
f337efcc35 | ||
|
|
3c7eaff7b3 | ||
|
|
d4d42a7a75 | ||
|
|
3c1c5621a5 | ||
|
|
2d9c147e0e | ||
|
|
53de1c8575 | ||
|
|
3d4e3c99ed | ||
|
|
c1b6c7e840 | ||
|
|
f17515d791 | ||
|
|
48262e4250 | ||
|
|
9d9dc74768 | ||
|
|
e1d1d1c795 | ||
|
|
fcfef0af47 | ||
|
|
c44c217c4a | ||
|
|
d60fc1ce62 | ||
|
|
0a12997d32 | ||
|
|
dce8031c83 | ||
|
|
bd9d9c8303 | ||
|
|
956acc4b93 | ||
|
|
5ed54d79fc | ||
|
|
acc77c27c3 | ||
|
|
bcb9fe039a | ||
|
|
55f44386d1 | ||
|
|
37983e69c4 | ||
|
|
a45a872c28 | ||
|
|
152b2be8ea | ||
|
|
1677436137 | ||
|
|
c69ca6847a | ||
|
|
f8147214f1 | ||
|
|
56eec5164d | ||
|
|
e58f84f3fb | ||
|
|
d22ffa05bd | ||
|
|
2e66db3fea | ||
|
|
376811c1a7 | ||
|
|
9b5f2388c1 | ||
|
|
686193b701 | ||
|
|
b43bca529c | ||
|
|
545171a8b2 | ||
|
|
d54d5b7f20 | ||
|
|
e52d952ca5 | ||
|
|
633a56054b | ||
|
|
3eeb966f15 | ||
|
|
d09253bdbd | ||
|
|
0052793a46 | ||
|
|
333871caf2 | ||
|
|
ef9d0c479e | ||
|
|
d5cce03a76 | ||
|
|
744903d455 | ||
|
|
cc00be48b5 | ||
|
|
b45a37ca47 | ||
|
|
f1f9ee712a | ||
|
|
7c4a9ad5af | ||
|
|
f3a000560f | ||
|
|
fdd13c1ae1 | ||
|
|
0585767258 | ||
|
|
9e7e92b4b7 | ||
|
|
29822ef0f7 | ||
|
|
718e82bc10 | ||
|
|
684314db0f | ||
|
|
442598282f | ||
|
|
3e2b78305d | ||
|
|
8eea64cebf | ||
|
|
b8a7cb6b93 | ||
|
|
529b39ebba | ||
|
|
f029ba2111 | ||
|
|
277c3dbb14 | ||
|
|
f273ecc135 | ||
|
|
2fe257b7af | ||
|
|
907595d9ed | ||
|
|
55c12aa6f6 | ||
|
|
04891d3e5b | ||
|
|
9973cd22a5 | ||
|
|
a2f4b35e4e | ||
|
|
1de540dd67 | ||
|
|
dec21e758a | ||
|
|
513f03b897 | ||
|
|
371fb3d0d0 | ||
|
|
f9f1846c8b | ||
|
|
f7b9b7be96 | ||
|
|
74affb32d3 | ||
|
|
675f82a6b9 | ||
|
|
19fcfcfef4 | ||
|
|
7c50d86a55 | ||
|
|
b629348973 | ||
|
|
7c185b4575 | ||
|
|
fefa6a93ca | ||
|
|
299962118a | ||
|
|
054baed134 | ||
|
|
b20fafd9fa | ||
|
|
62081d9525 | ||
|
|
100b4c70e4 | ||
|
|
5631849ced | ||
|
|
14ee218443 | ||
|
|
52fe525442 | ||
|
|
fec00377e5 | ||
|
|
c9ab70e30f | ||
|
|
8aef1e76c3 | ||
|
|
44f69bd575 | ||
|
|
963b736d8b | ||
|
|
4cc3aed139 | ||
|
|
e791e3dbe9 | ||
|
|
d34ee62f77 | ||
|
|
e48901b90f | ||
|
|
60f73dc952 | ||
|
|
eec32e299b | ||
|
|
fe362341dc | ||
|
|
8505db24b7 | ||
|
|
560adb2065 | ||
|
|
6676d4b50c | ||
|
|
c1bd3961cf | ||
|
|
4fa47eaf71 | ||
|
|
e5f47024af | ||
|
|
115b5f1ca7 | ||
|
|
878885e2b2 | ||
|
|
709e4230c8 | ||
|
|
46c5e41b68 | ||
|
|
0b43d0dc70 | ||
|
|
99f3f0291a | ||
|
|
6d3d190134 | ||
|
|
769659767c | ||
|
|
99818f9ce0 | ||
|
|
be6f0de0df | ||
|
|
405cf4d997 | ||
|
|
91480a0f02 | ||
|
|
90793c71a2 | ||
|
|
9bcb3e5778 | ||
|
|
c97e23bd58 | ||
|
|
73f1b986dd | ||
|
|
b06502b0cb | ||
|
|
c4b6fab3f3 | ||
|
|
109b5bb9df | ||
|
|
6f61e8e915 | ||
|
|
9c6e046d93 | ||
|
|
30822f0d68 | ||
|
|
e46e3cdcb6 | ||
|
|
260335a19f | ||
|
|
516dbcc512 | ||
|
|
7a48240856 | ||
|
|
cda5938215 | ||
|
|
cd947a69a8 | ||
|
|
60df2f2ea9 | ||
|
|
51e1a907e6 | ||
|
|
e9d5512e1a | ||
|
|
bd54cf6dee | ||
|
|
1036c365b8 | ||
|
|
8ce330bcdb | ||
|
|
8161e8d153 | ||
|
|
ec52a6a240 | ||
|
|
9a4f46dba4 | ||
|
|
5e8cb63f9a | ||
|
|
d1df837d04 | ||
|
|
670f08ce51 | ||
|
|
82661346b7 | ||
|
|
b2ac81540f | ||
|
|
fd861e1691 | ||
|
|
76b5bdc2c4 | ||
|
|
0ec5ad6961 | ||
|
|
1c2dcd9acc | ||
|
|
018a87286c | ||
|
|
d0a3b4b019 | ||
|
|
3428cd48b7 | ||
|
|
023a881fb9 | ||
|
|
36f38d5a13 | ||
|
|
d4001064a0 | ||
|
|
fffdad7645 | ||
|
|
32612929d9 | ||
|
|
d49683cfb6 | ||
|
|
9ca5ec16af | ||
|
|
7041813966 | ||
|
|
a31ecb32e1 | ||
|
|
b1ea279940 | ||
|
|
82172e65fa | ||
|
|
dfedb231dc | ||
|
|
5f5be8d74e | ||
|
|
fafeaf661a | ||
|
|
06d3161ffe | ||
|
|
885056a6c9 | ||
|
|
a44daf20cb | ||
|
|
67435d2034 | ||
|
|
cd5348dffd | ||
|
|
6e4b698fac | ||
|
|
c135a83cb3 | ||
|
|
37d391d53a | ||
|
|
d335c9833c | ||
|
|
ab7df43ccb | ||
|
|
ead92b3a27 | ||
|
|
647a79ffbd | ||
|
|
47793dcdf2 | ||
|
|
9df0454b64 | ||
|
|
5ea1ac7582 | ||
|
|
9f7604848c | ||
|
|
bbbaba7b47 | ||
|
|
d56031db7d | ||
|
|
0f64e18f27 | ||
|
|
958cab8cc7 | ||
|
|
9974d65756 | ||
|
|
a0e17c8f47 | ||
|
|
f76268dec9 | ||
|
|
8d74a12628 | ||
|
|
33ae64495a | ||
|
|
750712d28d | ||
|
|
de4bf53536 | ||
|
|
205db919f5 | ||
|
|
9b5d12bf22 | ||
|
|
3b53dfcaed | ||
|
|
1d39decaf1 | ||
|
|
8129ea32aa | ||
|
|
2bf024d3c3 | ||
|
|
19d89d627b | ||
|
|
fff68b7b06 | ||
|
|
044ded3045 | ||
|
|
0cccc629bf | ||
|
|
57181264e9 | ||
|
|
0b5888ed22 | ||
|
|
4321038518 | ||
|
|
b84e32a6fe | ||
|
|
21a293beae | ||
|
|
47b4850aa8 | ||
|
|
1999956d91 | ||
|
|
698f736b65 | ||
|
|
618744cc52 | ||
|
|
67125fedab | ||
|
|
f7cd46abc9 | ||
|
|
9f62153966 | ||
|
|
978771a3fb | ||
|
|
adc340e4c3 | ||
|
|
50668161ad | ||
|
|
6507136bdd | ||
|
|
5cdbd57875 | ||
|
|
1550c34d65 | ||
|
|
ec6e3bc9e7 | ||
|
|
d5942f3267 | ||
|
|
e272710e36 | ||
|
|
a95df9d64b | ||
|
|
816aa9a17c | ||
|
|
f95cd38ddb | ||
|
|
d9de2717a2 | ||
|
|
11d5019103 | ||
|
|
0946dbb287 | ||
|
|
cfcdedd508 | ||
|
|
3fac6ed6af | ||
|
|
ef7497094c | ||
|
|
de05070ccc | ||
|
|
f68daf1b14 | ||
|
|
88039f3d65 | ||
|
|
2c0421f2e6 | ||
|
|
a672988e35 | ||
|
|
74f3a3f5c8 | ||
|
|
f335e74cb8 | ||
|
|
83915b42f3 | ||
|
|
babcd117b1 | ||
|
|
892ac2edb2 | ||
|
|
5b12d17b56 | ||
|
|
1b6930126e | ||
|
|
8def97a465 | ||
|
|
7bbc0847b1 | ||
|
|
88dc3f0061 | ||
|
|
02e69932ae | ||
|
|
662dfbe777 | ||
|
|
c249cbdbe1 | ||
|
|
a47171891f | ||
|
|
1dc67acd40 | ||
|
|
146685c2c2 | ||
|
|
3cc2df20f9 | ||
|
|
4f3d246100 | ||
|
|
11bfec1a23 | ||
|
|
f24a03a32c | ||
|
|
829ff0b9f7 | ||
|
|
b9ae4d04ef | ||
|
|
47060c9738 | ||
|
|
846692ca03 | ||
|
|
985d53bec4 | ||
|
|
8548e67dcd | ||
|
|
1c60e949e7 | ||
|
|
86f02e8553 | ||
|
|
2c7332583c | ||
|
|
a96b74ea5e | ||
|
|
5a1b13ff41 | ||
|
|
4a71f19c40 | ||
|
|
5c672885f1 | ||
|
|
e38eb7cbd5 | ||
|
|
ba9ae0337d | ||
|
|
b674aad802 | ||
|
|
88f9458c6e | ||
|
|
6cb3d86cd1 | ||
|
|
5cde809909 | ||
|
|
1b6931eaea | ||
|
|
c3b7530b98 | ||
|
|
0f61b0792b | ||
|
|
bab13c9cef | ||
|
|
9c9fe51eee | ||
|
|
4f8211f6a1 | ||
|
|
5fc3a0a3b9 | ||
|
|
67c55145b9 | ||
|
|
fc2489d9e1 | ||
|
|
a384a95529 | ||
|
|
a013e48ab5 | ||
|
|
24a0ddfc59 | ||
|
|
3da4c2abe9 | ||
|
|
2950820d34 | ||
|
|
75b1ac8199 | ||
|
|
8f05b36551 | ||
|
|
0f840e6576 | ||
|
|
451f63ebe0 | ||
|
|
2dc9daf118 | ||
|
|
3c67a10347 | ||
|
|
6885a9f868 | ||
|
|
38142baa93 | ||
|
|
34bdbdb3b1 | ||
|
|
83af7e8e9d | ||
|
|
4eb5f8a0dc | ||
|
|
e03b358ff0 | ||
|
|
d2846b805a | ||
|
|
07d767e1af | ||
|
|
d423e6b774 | ||
|
|
bb89bdd8a9 | ||
|
|
5cc98f6e53 | ||
|
|
a6300f6ac6 | ||
|
|
aeabb4d2ea | ||
|
|
dcbb429863 | ||
|
|
077d52d209 | ||
|
|
44f5de188d | ||
|
|
191e5440b2 | ||
|
|
a2b0d00058 | ||
|
|
e8fa827026 | ||
|
|
89105090ed | ||
|
|
6ce218612b | ||
|
|
dd87c81adc | ||
|
|
37f3478873 | ||
|
|
a64259362e | ||
|
|
3554138118 | ||
|
|
f7d6d269c7 | ||
|
|
2c1e9877f9 | ||
|
|
a94c97221e | ||
|
|
f9732a6fb9 | ||
|
|
581fc956be | ||
|
|
ee901b018c | ||
|
|
d373ebfdd7 | ||
|
|
698b87dd35 |
+16
-16
@@ -2,34 +2,34 @@
|
||||
*.o
|
||||
*.so
|
||||
*.gz
|
||||
*.map
|
||||
configure
|
||||
Makefile
|
||||
Makefile.in
|
||||
/.deps/*
|
||||
/.libs/*
|
||||
/finit
|
||||
/initctl
|
||||
/reboot
|
||||
/config.h
|
||||
/config.mk
|
||||
/GPATH
|
||||
/GRTAGS
|
||||
/GSYMS
|
||||
/GTAGS
|
||||
GPATH
|
||||
GRTAGS
|
||||
GSYMS
|
||||
GTAGS
|
||||
|
||||
# GNU configure and build system
|
||||
/autom4te.cache/*
|
||||
/aclocal.m4
|
||||
/ar-lib
|
||||
/compile
|
||||
/config.h
|
||||
/config.mk
|
||||
/config.guess
|
||||
/config.h.in
|
||||
/config.log
|
||||
/config.status
|
||||
/config.sub
|
||||
/configure
|
||||
/depcomp
|
||||
/install-sh
|
||||
/libtool
|
||||
/ltmain.sh
|
||||
|
||||
/missing
|
||||
/Makefile
|
||||
/Makefile.in
|
||||
/stamp-h1
|
||||
|
||||
# TroglOS build system
|
||||
/.config
|
||||
/.stamp
|
||||
/.unpacked
|
||||
|
||||
+6
-6
@@ -33,12 +33,12 @@ addons:
|
||||
branch_pattern: dev
|
||||
|
||||
install:
|
||||
- wget https://github.com/troglobit/libuev/releases/download/v1.4.2/libuev-1.4.2.tar.xz
|
||||
- wget https://github.com/troglobit/libite/releases/download/v1.8.2/libite-1.8.2.tar.xz
|
||||
- tar xf libuev-1.4.2.tar.xz
|
||||
- tar xf libite-1.8.2.tar.xz
|
||||
- (cd libuev-1.4.2 && ./configure --prefix=/tmp && make && make install-strip)
|
||||
- (cd libite-1.8.2 && ./configure --prefix=/tmp && make && make install-strip)
|
||||
- wget https://github.com/troglobit/libuev/releases/download/v1.5.2/libuev-1.5.2.tar.xz
|
||||
- wget https://github.com/troglobit/libite/releases/download/v1.9.2/libite-1.9.2.tar.xz
|
||||
- tar xf libuev-1.5.2.tar.xz
|
||||
- tar xf libite-1.9.2.tar.xz
|
||||
- (cd libuev-1.5.2 && ./configure --prefix=/tmp && make && make install-strip)
|
||||
- (cd libite-1.9.2 && ./configure --prefix=/tmp && make && make install-strip)
|
||||
|
||||
# Custom build script for the time being, no "make test" yet
|
||||
script:
|
||||
|
||||
+92
-7
@@ -3,14 +3,67 @@ Change Log
|
||||
|
||||
All relevant changes are documented in this file.
|
||||
|
||||
[3.0][UNRELEASED] - 2016-XX-YY
|
||||
------------------------------
|
||||
[3.0][] - 2017-10-19
|
||||
--------------------
|
||||
|
||||
Major release, support for conditions/dependencies between services,
|
||||
optional built-in watchdog daemon, optional built-in getty, optional
|
||||
built-in standard inetd services like echo server, rdate, etc.
|
||||
|
||||
Also, native support for Debian/BusyBox `/etc/network/interfaces`,
|
||||
overhauled new configure based build system, logging to `/dev/kmsg`
|
||||
before syslogd has started, massively improved support for Linux
|
||||
distributions.
|
||||
|
||||
### Changes
|
||||
|
||||
* Added basic code of conduct covenant to project
|
||||
* Added contribution guidelines document
|
||||
* Removed `finit.conf` option `check DEV`, replaced entirely by automated
|
||||
call to `fsck` for each device listed in `/etc/fstab`
|
||||
* Removed deprecated and confusing `startx` and `user` settings. It is
|
||||
strongly recommended to instead use xdm/gdb/lightdm etc.
|
||||
* Add support for `initctl log <SVC>`, shows last 10 lines from syslog
|
||||
* Add `initctl cond dump` for debugging conditions
|
||||
* Ensure plugins always have a default name, file name
|
||||
* Reorganization, move all source files to a `src/` sub-directory
|
||||
* Add support for `initctl <list|enable|disable> <SVC>`, much needed by
|
||||
distributions. See [doc/distro.md](doc/distro.md) for details
|
||||
* Remove `UNUSED()` macro, mentioned here because it may have been used
|
||||
by external plugin developers. Set `-Wno-unused-parameter` instead
|
||||
* New table headings in `initctl`, using `top` style inverted text
|
||||
* Allow `initctl show` to use full screen width for service descriptions
|
||||
* New `HOOK_BANNER` for plugins to override the default `banner()`
|
||||
* Allow loading TTYs from `/etc/finit.d`
|
||||
* Improvements to built-in getty, ignore signals like `SIGINT`,
|
||||
`SIGHUP`, support Ctrl-U to erase to beginning of line
|
||||
* Add TTY `nowait` and `noclear` options
|
||||
* Allow using both built-in getty and external getty:
|
||||
|
||||
tty [12345] /dev/ttyAMA0 115200 noclear vt220
|
||||
tty [12345] /sbin/getty -L 115200 /dev/ttyAMA0 vt100
|
||||
tty [12345] /sbin/agetty -L ttyAMA0 115200 vt100 nowait
|
||||
|
||||
* Silent boot is now the default, use `--enable-progress` to get the old
|
||||
Finit style process progress. I.e., `--enable-silent` is no more
|
||||
* Support for `configure --enable-emergency-shell`, debug-only mode
|
||||
* Support for a fallback shell on console if none of the configured TTYs
|
||||
can be started, `configure --enable-fallback-shell`
|
||||
* All debug messages to console when Finit `--debug` is enabled
|
||||
* Prevent login, by touching `/etc/nologin`, during runlevel changes
|
||||
* A more orderly shutdown. On reboot/halt/poweroff Finit now properly
|
||||
goes to runlevel 0/6 to first stop all processes.
|
||||
* Perform sync before remounting as read-only, at shutdown
|
||||
* Clean up `/tmp`, `/var/run`, and `/var/lock` at boot on systems which
|
||||
have these directories on persistent storage
|
||||
* Call udev triggers at boot, on systems with udev
|
||||
* Add missing `/var/lock/subsys` directory for dbus
|
||||
* Add support for `poweroff`
|
||||
* Add support for a built-in miniature watchdog daemon
|
||||
* Remove GLIBC:isms like `__progname`
|
||||
* Manage service states based on user defined conditions
|
||||
* Manage dependencies between services, w/ conditions (pidfile plugin)
|
||||
* Manage service dependenceis on network events (netlink plugin)
|
||||
* Manage service dependencies on network events (netlink plugin)
|
||||
* Support for dynamically reloading Finit configuration at runtime
|
||||
* Refactor to use GNU configure and build system
|
||||
* New hooks for for detecting lost and started services (lost plugin)
|
||||
@@ -22,8 +75,7 @@ All relevant changes are documented in this file.
|
||||
* Add simple built-in getty
|
||||
* Greatly improved accounting support, both UTMP and WTMP fixes+features
|
||||
* Improved udev support, on non-embedded systems
|
||||
* Improvide shutdown and file-system unmount support (Debian)
|
||||
* Added `--enable-emergency-shell` (configure) fallback debug mode
|
||||
* Improved shutdown and file-system unmount support (Debian)
|
||||
* Support SysV init `/etc/rc.local`
|
||||
* Inetd protection against UDP looping attacks
|
||||
* Support systems with `/run` instead of `/var/run` (bootmisc plugin)
|
||||
@@ -33,7 +85,39 @@ All relevant changes are documented in this file.
|
||||
* Add OpenRC-like support for sysctl.d/*.conf
|
||||
* Add support for Debian/BusyBox `/etc/network/interfaces`
|
||||
* Add support for running fsck on file systems in `/etc/fstab`
|
||||
* Added example configs + HowTos for Debian (Jessie) and Alpine Linux
|
||||
* Added example configs + HowTos for Debian and Alpine Linux
|
||||
to support latest releases of both distributions
|
||||
* Lots of documentation updates
|
||||
|
||||
### Fixes
|
||||
|
||||
* Fix race-condition at configuration reload due to too low resolution.
|
||||
Thanks to Mattias Walström, Westermo
|
||||
* Fix to handle long process (PID) dependency chains, re-run reconf
|
||||
callback until no more applications are in flux.
|
||||
Thanks to Mattias Walström, Westermo
|
||||
* Clear `reconf` condition when `initctl reload` has finished
|
||||
* Skip automatic reload of `/etc/finit.d/*.conf` files when changing
|
||||
runlevel to halt or reboot
|
||||
* Fix issue #54: Allow halt and poweroff commands even if watchdog is enabled
|
||||
* Fix issue #56: Check existence of device before trying to start getty
|
||||
* Fix issue #60: `initctl` should display error and return error code
|
||||
for non-existing services should the operator try to start/stop them.
|
||||
* Fix issue #61: Reassert `net/*` conditions after `initctl reload`
|
||||
* Fix issue #64: Skip `fsck` on already mounted devices
|
||||
* Fix issue #66: Log rotate and gzip `/var/log/wtmp`, created by Finit
|
||||
* Fix issue #72: Check `ifup` exists before trying to bring up networking,
|
||||
also set `$PATH` earlier to simplify `run()` et al -- no longer any need
|
||||
to use absolute paths for system tools called from Finit. Thanks to crazy
|
||||
* Fix issue #73: Remove double `ntohl()` in inetd handling, prevents matches.
|
||||
Thanks to Petrus Hellgren, Westermo
|
||||
* Fix issue #76: Reap zombie processes in emergency shell mode
|
||||
* Fix issue #80: FTBFS on Arch Linux, missing `stdarg.h` in `helpers.h`,
|
||||
thanks to Jörg Krause
|
||||
* Fix issue #81: Workaround for systems w/o SYSV shm IPC support in kernel
|
||||
* Always collect bootstrap-only tasks when done, we will never re-run them.
|
||||
Also, make sure to never reload bootstrap-only tasks at runtime
|
||||
* Remove two second block (!) of Finit when stopping TTYs
|
||||
|
||||
|
||||
[2.4][] - 2015-12-04
|
||||
@@ -514,7 +598,8 @@ Major bug fix release.
|
||||
|
||||
* Initial release
|
||||
|
||||
[UNRELEASED]: https://github.com/troglobit/finit/compare/2.4...HEAD
|
||||
[UNRELEASED]: https://github.com/troglobit/finit/compare/3.0...HEAD
|
||||
[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.3]: https://github.com/troglobit/finit/compare/2.2...2.3
|
||||
[2.2]: https://github.com/troglobit/finit/compare/2.1...2.2
|
||||
|
||||
+5
-95
@@ -1,101 +1,11 @@
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
sbin_PROGRAMS = finit initctl reboot
|
||||
finit_SOURCES = api.c \
|
||||
cond.c cond-w.c cond.h \
|
||||
client.c \
|
||||
conf.c conf.h \
|
||||
exec.c finit.c finit.h \
|
||||
getty.c \
|
||||
helpers.c helpers.h \
|
||||
mdadm.c mount.c pid.c \
|
||||
plugin.c plugin.h private.h \
|
||||
service.c service.h \
|
||||
sig.c sig.h \
|
||||
sm.c sm.h \
|
||||
svc.c svc.h \
|
||||
tty.c tty.h \
|
||||
utmp-api.c utmp-api.h
|
||||
pkginclude_HEADERS = cond.h finit.h helpers.h inetd.h plugin.h svc.h
|
||||
if INETD
|
||||
finit_SOURCES += inetd.c inetd.h
|
||||
endif
|
||||
|
||||
finit_CFLAGS = -W -Wall -Wextra -std=gnu99 $(lite_CFLAGS) $(uev_CFLAGS)
|
||||
finit_LDADD = $(lite_LIBS) $(uev_LIBS)
|
||||
if STATIC
|
||||
finit_LDADD += plugins/libplug.la
|
||||
else
|
||||
finit_LDADD += -ldl
|
||||
endif
|
||||
|
||||
initctl_SOURCES = initctl.c svc.c svc.h helpers.c helpers.h cond.c cond.h \
|
||||
utmp-api.c utmp-api.h
|
||||
initctl_CFLAGS = $(lite_CFLAGS)
|
||||
initctl_LDADD = $(lite_LIBS)
|
||||
|
||||
reboot_SOURCES = reboot.c
|
||||
|
||||
INIT_LNKS = telinit init
|
||||
REBOOT_LNKS = shutdown halt suspend
|
||||
SUBDIRS = plugins
|
||||
doc_DATA = README.md LICENSE finit.conf
|
||||
EXTRA_DIST = README.md LICENSE ChangeLog.md finit.conf
|
||||
AM_CPPFLAGS = -U_FORTIFY_SOURCE
|
||||
AM_CPPFLAGS += -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_GNU_SOURCE -D_DEFAULT_SOURCE
|
||||
|
||||
if STATIC
|
||||
AM_CPPFLAGS += -DENABLE_STATIC
|
||||
AM_LDFLAGS = -static-libtool-libs
|
||||
else
|
||||
AM_CPPFLAGS += -DPLUGIN_PATH=\"$(pkglibdir)\"
|
||||
AM_LDFLAGS = -export-dynamic
|
||||
endif
|
||||
SUBDIRS = plugins src
|
||||
doc_DATA = README.md LICENSE contrib/finit.conf
|
||||
EXTRA_DIST = README.md LICENSE ChangeLog.md contrib/finit.conf
|
||||
|
||||
# Compat hook
|
||||
install-dev: install-pkgincludeHEADERS
|
||||
|
||||
# Hook in install to add finit and reboot symlink(s)
|
||||
install-exec-hook:
|
||||
@for file in $(INIT_LNKS); do \
|
||||
lnk=$(DESTDIR)$(sbindir)/$$file; \
|
||||
if [ -e $$lnk ]; then \
|
||||
echo "Skipping $$lnk exists already."; \
|
||||
else \
|
||||
$(LN_S) finit $$lnk; \
|
||||
fi; \
|
||||
done
|
||||
@if [ -L $(DESTDIR)$(sbindir)/reboot ]; then \
|
||||
echo "Non-finit reboot, skipping."; \
|
||||
else \
|
||||
for file in $(REBOOT_LNKS); do \
|
||||
link=$(DESTDIR)$(sbindir)/$$file; \
|
||||
if [ -e $$link ]; then \
|
||||
echo "$$link exists, skipping.";\
|
||||
else \
|
||||
$(LN_S) reboot $$link; \
|
||||
fi; \
|
||||
done; \
|
||||
fi
|
||||
|
||||
uninstall-hook:
|
||||
@for file in $(INIT_LNKS); do \
|
||||
lnk=`readlink $(DESTDIR)$(sbindir)/$$file`; \
|
||||
if [ "$$lnk" != "finit" ]; then \
|
||||
echo "Skipping non-finit $$file."; \
|
||||
continue; \
|
||||
fi; \
|
||||
$(RM) $(DESTDIR)$(sbindir)/$$file; \
|
||||
done
|
||||
@if [ -L $(DESTDIR)$(sbindir)/reboot ]; then \
|
||||
echo "Non-finit reboot, skipping uninstall."; \
|
||||
else \
|
||||
for file in $(REBOOT_LNKS); do \
|
||||
if [ "`readlink $$file`" != "reboot" ]; \
|
||||
then continue; \
|
||||
fi; \
|
||||
$(RM) $(DESTDIR)$(sbindir)/$$file; \
|
||||
done; \
|
||||
fi
|
||||
install-dev:
|
||||
@make -C src install-pkgincludeHEADERS
|
||||
|
||||
# Target to run when building a release
|
||||
release: dist
|
||||
|
||||
@@ -1,105 +1,141 @@
|
||||
```
|
||||
_______ __ _____ ___ __ ___________ _______
|
||||
/" "||" \ (\" \|" \ |" \(" _ ")/" __ )
|
||||
(: ______)|| | |.\\ \ | || |)__/ \\__/(__/ _) ./
|
||||
\/ | |: | |: \. \\ | |: | \\_ / / //
|
||||
// ___) |. | |. \ \. | |. | |. | __ \_ \\
|
||||
(: ( /\ |\| \ \ | /\ |\ \: | (: \__) :\
|
||||
\__/ (__\_|_)\___|\____\)(__\_|_) \__| \_______) ... Yes, we need a new logo!
|
||||
```
|
||||
|
||||
Fast init for Linux
|
||||
===================
|
||||
[![Travis Status]][Travis] [![Coverity Status]][Coverity Scan]
|
||||
|
||||
Table of Contents
|
||||
-----------------
|
||||
<img align="right" src="images/finit3.png" alt="Finit: Fast Init">
|
||||
|
||||
* [Introduction](#introduction)
|
||||
* [Features](#features)
|
||||
* [/etc/finit.conf](doc/config.md#etcfinitconf)
|
||||
* [/etc/finit.d](doc/config.md#etcfinitd)
|
||||
* [Runparts & /etc/rc.local](#runparts--etcrclocal)
|
||||
* [Bootstrap](doc/bootstrap.md#bootstrap)
|
||||
* [Runlevels](#runlevels)
|
||||
* [Inetd](doc/inetd.md#inetd)
|
||||
* [Hooks, Callbacks & Plugins](doc/plugins.md#hooks-callbacks--plugins)
|
||||
* [Syntax](doc/config.md#syntax)
|
||||
* [Inetd](doc/inetd.md#inetd)
|
||||
* [Runparts & /etc/rc.local](#runparts--etcrclocal)
|
||||
* [Hooks, Callbacks & Plugins](doc/plugins.md#hooks-callbacks--plugins)
|
||||
* [Rebooting & Halting](#rebooting--halting)
|
||||
* [Commands & Status](#commands--status)
|
||||
* [Building](doc/build.md#building)
|
||||
* [Running](#running)
|
||||
* [Debugging](#debugging)
|
||||
* [Running](doc/build.md#running)
|
||||
* [Debugging](doc/build.md#debugging)
|
||||
* [Requirements](#requirements)
|
||||
* [Origin & References](#origin--references)
|
||||
|
||||
|
||||
Introduction
|
||||
------------
|
||||
[![License Badge][]][License] [![Travis Status]][Travis] [![Coverity Status]][Coverity Scan]
|
||||
|
||||
Finit is an EeePC inspired Fastinit clone with [process supervision][1]
|
||||
similar to that of D.J. Bernstein's [daemontools][2] and Gerrit Pape's
|
||||
[runit][3]. The focus of Finit is on small and embedded Linux systems,
|
||||
although it is fully usable on server and desktop installations as well.
|
||||
See the [contrib section](contrib/) for Debian and Alpine examples.
|
||||
Finit is a simple alternative to [SysV init][4] and [systemd][6]. It
|
||||
was reverse engineered from the [EeePC fastinit][] ten years ago by
|
||||
[Claudio Matsuoka][] — "gaps filled with frog DNA …"
|
||||
|
||||
Traditional [SysV init][4] style systems are scripted. For low-resource
|
||||
embedded systems this is quite resource intensive and often leads to
|
||||
long boot times. Finit reduces context switches and forking of shell
|
||||
scripts to provide a swift [system bootstrap](doc/bootstrap.md) written
|
||||
entirely in C.
|
||||
Focus is on small and embedded systems, although Finit is fully usable
|
||||
on server and desktop systems as well. For working examples, see the
|
||||
[contrib/](contrib/) section where both [Debian](contrib/debian/) and
|
||||
up to date [Alpine Linux](contrib/alpine/) tutorials can be found.
|
||||
|
||||
Configuration is read from [/etc/finit.conf](doc/config.md#etcfinitconf)
|
||||
which details kernel modules to load, services and TTYs to start. When
|
||||
initial [bootstrap](doc/bootstrap.md) is done, including setting up
|
||||
networking, [/etc/finit.d/](doc/config.md#etcfinitd) and the familiar
|
||||
[/etc/rc.local](#runparts--etcrclocal) are run.
|
||||

|
||||
The screenshot shows [Alpine Linux](https://www.alpinelinux.org/).
|
||||
|
||||
**Example /etc/finit.conf:**
|
||||
|
||||
```
|
||||
# Fallback if /etc/hostname is missing
|
||||
host wopr
|
||||
|
||||
# Runlevel to start after bootstrap, runlevel 'S'
|
||||
runlevel 2
|
||||
|
||||
# Services to be monitored and respawned as needed
|
||||
service [S12345] /sbin/watchdogd -L -f -- System watchdog daemon
|
||||
service [S12345] /sbin/syslogd -n -b 3 -D -- System log daemon
|
||||
service [S12345] /sbin/klogd -n -- Kernel log daemon
|
||||
service [2345] /sbin/lldpd -d -c -M1 -H0 -i -- LLDP daemon (IEEE 802.1ab)
|
||||
|
||||
# For multiple instances of the same service, add :ID somewhere between
|
||||
# the service/run/task keyword and the command.
|
||||
service :1 [2345] /sbin/merecat -n -p 80 /var/www -- Web server
|
||||
service :2 [2345] /sbin/merecat -n -p 8080 /var/www -- Old web server
|
||||
Example
|
||||
-------
|
||||
|
||||
# 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/acpid start -- Starting ACPI Daemon
|
||||
#task [S] /etc/init.d/kbd start -- Preparing console
|
||||
This example `/etc/finit.conf` can also be split up in multiple `.conf`
|
||||
files in `/etc/finit.d`. Available, but not yet enabled, services can
|
||||
be placed in `/etc/finit.d/available` and enabled by an operator using
|
||||
the [initctl](#commands--status) tool.
|
||||
|
||||
# Inetd services to start on demand, with alternate ports and filtering
|
||||
inetd ftp/tcp nowait [2345] /sbin/uftpd -i -f -- FTP daemon
|
||||
inetd tftp/udp wait [2345] /sbin/uftpd -i -y -- 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
|
||||
# runparts /etc/start.d
|
||||
|
||||
# Virtual consoles to start built-in getty on
|
||||
tty [12345] /dev/tty1 115200 linux
|
||||
tty [12345] /dev/ttyAMA0 115200 vt100
|
||||
```ApacheConf
|
||||
# Fallback if /etc/hostname is missing
|
||||
host default
|
||||
|
||||
# Runlevel to start after bootstrap, 'S', default: 2
|
||||
runlevel 2
|
||||
|
||||
# Services to be monitored and respawned as needed
|
||||
service [S12345] /sbin/watchdogd -L -f -- System watchdog daemon
|
||||
service [S12345] /sbin/syslogd -n -b 3 -D -- System log daemon
|
||||
service [S12345] /sbin/klogd -n -- Kernel log daemon
|
||||
service [2345] /sbin/lldpd -d -c -M1 -H0 -i -- LLDP daemon (IEEE 802.1ab)
|
||||
|
||||
# For multiple instances of the same service, add :ID somewhere between
|
||||
# the service/run/task keyword and the command.
|
||||
service :1 [2345] /sbin/merecat -n -p 80 /var/www -- Web server
|
||||
service :2 [2345] /sbin/merecat -n -p 8080 /var/www -- Old web server
|
||||
|
||||
# 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/acpid start -- Starting ACPI Daemon
|
||||
#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
|
||||
# runparts /etc/start.d
|
||||
|
||||
# Virtual consoles run BusyBox getty
|
||||
tty [12345] /sbin/getty -L 115200 /dev/tty1 linux
|
||||
tty [12345] /sbin/getty -L 115200 /dev/tty2 linux
|
||||
tty [12345] /sbin/getty -L 115200 /dev/tty3 linux
|
||||
|
||||
# Use built-in getty for serial port and USB serial
|
||||
tty [12345] /dev/ttyAMA0 115200 noclear nowait
|
||||
tty [12345] /dev/ttyUSB0 115200 noclear
|
||||
```
|
||||
|
||||
For an example of a full blown embedded Linux, see [TroglOS][9], or take
|
||||
a look at the `contrib/` section with [Alpine Linux](contrib/alpine/),
|
||||
[Debian](contrib/debian/), support and more.
|
||||
The `service` stanza, as well as `task`, `run`, `inetd` and others are
|
||||
described in full in [doc/config.md](doc/config.md). Here's a quick
|
||||
overview of some of the most common components needed to start a UNIX
|
||||
daemon:
|
||||
|
||||
```
|
||||
service [LVLS] <COND> /path/to/daemon ARGS -- Some text
|
||||
^ ^ ^ ^ ^ ^
|
||||
| | | | | `-- Optional description
|
||||
| | | | `---------- Daemon arguments
|
||||
| | | `-------------------------- Path to daemon
|
||||
| | `--------------------------------- Optional conditions
|
||||
| `---------------------------------------- Optional Runlevels
|
||||
`------------------------------------------------ Monitored application
|
||||
```
|
||||
|
||||
Some components are optional: runlevel(s), condition(s) and description,
|
||||
making it easy to create simple start scripts and still possible for more
|
||||
advanced uses as well:
|
||||
|
||||
service /usr/sbin/sshd -D
|
||||
|
||||
Dependencies are handled using [conditions](doc/conditions.md). On of
|
||||
the most common conditions is to wait for basic networking to become
|
||||
available:
|
||||
|
||||
service <net/route/default> /usr/sbin/nginx -- High performace HTTP server
|
||||
|
||||
Here is another example where we instruct Finit to not start BusyBox
|
||||
`ntpd` until `syslogd` has started properly. Finit waits for `syslogd`
|
||||
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 [S12345] /sbin/syslogd -n -- Syslog daemon
|
||||
|
||||
A service, or task, can have multiple dependencies listed. Here we wait
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
**Note:** Make sure daemons *do not* fork and detach themselves from the
|
||||
controlling TTY, usually an `-n` or `-f` flag, or `-D` as in the case
|
||||
of OpenSSH above. If it detaches itself, Finit cannot monitor it and
|
||||
will instead try to restart it.
|
||||
|
||||
|
||||
Features
|
||||
@@ -109,6 +145,7 @@ Features
|
||||
|
||||
Start, monitor and restart services should they fail.
|
||||
|
||||
|
||||
**Inetd**
|
||||
|
||||
Finit comes with a built-in [inetd server](doc/inetd.md). No need to
|
||||
@@ -120,46 +157,53 @@ 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
|
||||
- echo [RFC862][]
|
||||
- chargen [RFC864][]
|
||||
- daytime [RFC867][]
|
||||
- discard [RFC863][]
|
||||
- time (rdate) [RFC868][]
|
||||
|
||||
For more information, see [doc/inetd.md](doc/inetd.md).
|
||||
|
||||
|
||||
**Getty**
|
||||
|
||||
Finit also comes with a built-in Getty for Linux console TTYs. It can
|
||||
parse `/etc/inittab` and set the speed. Then `/bin/login` handles all
|
||||
nasty bits with PAM etc.
|
||||
Finit supports external getty but also comes with a limited built-in
|
||||
Getty, useful for really small systems. A getty sets up the TTY and
|
||||
waits for user input before handing over to `/bin/login`, which is
|
||||
responsible for handling the actual authentication.
|
||||
|
||||
```conf
|
||||
tty [12345] /dev/tty1 38400 nowait linux
|
||||
tty [12345] /dev/ttyAMA0 115200 noclear vt100
|
||||
tty [12345] /sbin/getty -L 115200 /dev/ttyAMA0 vt100
|
||||
```
|
||||
|
||||
For more information, see [doc/config.md](doc/config.md#syntax).
|
||||
|
||||
# /etc/finit.conf
|
||||
tty [12345] /dev/tty1 38400 linux
|
||||
tty [12345] /dev/ttyAMA0 115200 vt100
|
||||
|
||||
**Runlevels**
|
||||
|
||||
Runlevels are optional in Finit, but support for [SysV runlevels][5] is
|
||||
available if needed. All services in runlevel S(1) are started first,
|
||||
followed by the desired run-time runlevel. Runlevel S can be started in
|
||||
sequence by using `run [S] cmd`. Changing runlevels at runtime is done
|
||||
like any other init, e.g. <kbd>init 4</kbd>
|
||||
Support for SysV init-style [runlevels][5] is available, in the same
|
||||
minimal style as everything else in Finit. The `[2345]` syntax can be
|
||||
applied to service, task, run, inetd, and TTY stanzas.
|
||||
|
||||
All services in runlevel S(1) are started first, followed by the desired
|
||||
run-time runlevel. Runlevel S can be started in sequence by using `run
|
||||
[S] cmd`. Changing runlevels at runtime is done like any other init,
|
||||
e.g. <kbd>init 4</kbd>, but also using the more advanced `intictl` tool.
|
||||
|
||||
|
||||
**Plugins**
|
||||
|
||||
Finit plugins can be *callbacks*, *boot hooks* into different stages of
|
||||
the boot process, or *pure extensions*. Plugins are written in C and
|
||||
compiled into a dynamic library that is loaded automatically by finit at
|
||||
boot. A basic set of plugins that extend and modify the basic behavior
|
||||
are bundled in the `plugins/` directory.
|
||||
Plugins can *extend* the functionality of Finit and *hook into* the
|
||||
different stages of the boot process and at runtime. Plugins are
|
||||
written in C and compiled into a dynamic library loaded automatically by
|
||||
finit at boot. A basic set of plugins are bundled in the `plugins/`
|
||||
directory.
|
||||
|
||||
Capabilities:
|
||||
|
||||
- **Task/Run/Service callbacks**
|
||||
Modify service arguments, override service monitor's decisions to
|
||||
start/stop/reload a service.
|
||||
- **Hooks**
|
||||
Hook into the boot at predefined points to extend Finit
|
||||
- **I/O**
|
||||
@@ -178,12 +222,12 @@ For more information, see [doc/plugins.md](doc/plugins.md).
|
||||
Runparts & /etc/rc.local
|
||||
------------------------
|
||||
|
||||
At the end of the boot, when networking and all services are up, finit
|
||||
At the end of the boot, when networking and all services are up, Finit
|
||||
calls its built-in [run-parts(8)][] on the `runparts <DIR>` directory,
|
||||
and `/etc/rc.local`, in that order if they exist.
|
||||
|
||||
```shell
|
||||
runparts /etc/rc.d/
|
||||
runparts /etc/rc.d/
|
||||
```
|
||||
|
||||
No configuration stanza in `/etc/finit.conf` is required for `rc.local`.
|
||||
@@ -210,17 +254,18 @@ are used, and even more commonly, only the default runlevel is used.
|
||||
To specify an allowed set of runlevels for a `service`, `run` command,
|
||||
`task`, or `tty`, add `[NNN]` to your `/etc/finit.conf`, like this:
|
||||
|
||||
```shell
|
||||
service [S12345] /sbin/syslogd -n -x -- System log daemon
|
||||
run [S] /etc/init.d/acpid start -- Starting ACPI Daemon
|
||||
task [S] /etc/init.d/kbd start -- Preparing console
|
||||
service [S12345] /sbin/klogd -n -x -- Kernel log daemon
|
||||
tty [12345] /dev/tty1
|
||||
tty [2] /dev/tty2
|
||||
tty [2] /dev/tty3
|
||||
tty [2] /dev/tty4
|
||||
tty [2] /dev/tty5
|
||||
tty [2] /dev/tty6
|
||||
```
|
||||
service [S12345] /sbin/syslogd -n -x -- System log daemon
|
||||
run [S] /etc/init.d/acpid start -- Starting ACPI Daemon
|
||||
task [S] /etc/init.d/kbd start -- Preparing console
|
||||
service [S12345] /sbin/klogd -n -x -- Kernel log daemon
|
||||
|
||||
tty [12345] /dev/tty1
|
||||
tty [2] /dev/tty2
|
||||
tty [2] /dev/tty3
|
||||
tty [2] /dev/tty4
|
||||
tty [2] /dev/tty5
|
||||
tty [2] /dev/tty6
|
||||
```
|
||||
|
||||
In this example syslogd is first started, in parallel, and then acpid is
|
||||
@@ -232,72 +277,63 @@ service.
|
||||
|
||||
Again, tasks and services are started in parallel, while run commands
|
||||
are called in the order listed and subsequent commands are not started
|
||||
until a run command has completed.
|
||||
until a run command has completed. Also, task and run commands are run
|
||||
in a shell, so pipes and redirects can be used.
|
||||
|
||||
The following examples illustrate this. Bootstrap task and run commands
|
||||
are also removed when they have completed, `initctl show` will not list
|
||||
them.
|
||||
|
||||
```
|
||||
task [S] echo "foo" | cat >/tmp/bar
|
||||
run [S] echo "$HOME" >/tmp/secret
|
||||
```
|
||||
|
||||
Switching between runlevels can be done by calling init with a single
|
||||
argument, e.g. <kbd>init 5</kbd> switches to runlevel 5. When changing
|
||||
runlevels Finit also automatically reloads all `.conf` files in the
|
||||
`/etc/finit.d/` directory. So if you want to set a new system config,
|
||||
switch to runlevel 1, change all config files in the system, and touch
|
||||
all `.conf` files in `/etc/finit.d` before switching back to the
|
||||
previous runlevel again — that way Finit can both stop old services and
|
||||
start any new ones for you, without rebooting the system.
|
||||
argument, e.g. <kbd>init 5</kbd>, or using `initctl runlevel 5`, both
|
||||
switch to runlevel 5. When changing runlevels Finit also automatically
|
||||
reloads all `.conf` files in the `/etc/finit.d/` directory. So if you
|
||||
want to set a new system config, switch to runlevel 1, change all config
|
||||
files in the system, and touch all `.conf` files in `/etc/finit.d`
|
||||
before switching back to the previous runlevel again — that way Finit
|
||||
can both stop old services and start any new ones for you, without
|
||||
rebooting the system.
|
||||
|
||||
|
||||
Rebooting & Halting
|
||||
-------------------
|
||||
|
||||
Finit is often used on embedded and small Linux systems with BusyBox.
|
||||
For compatibility with its existing toolset (halt, poweroff, reboot),
|
||||
the following signals have been adopted:
|
||||
Traditionally, rebooting and halting a UNIX system is done by changing
|
||||
its runlevel. Finit comes with its own tooling providing: `shutdown`,
|
||||
`reboot`, `poweroff`, and `suspend`, but also the traditional `init` and
|
||||
`telinit`, as well as a more modern `initctl` tool, detailed in the next
|
||||
section.
|
||||
|
||||
* `SIGUSR1`
|
||||
Same effect as `finit q`, reloads all *.conf files in `/etc/finit.d/`
|
||||
* `SIGUSR1`
|
||||
Calls shutdown hooks, including HOOK_SHUTDOWN, stops all running
|
||||
processes, and unmounts all file systems. Then tells kernel to
|
||||
halt. Most people these days want SIGUSR2 though.
|
||||
For compatibility reasons Finit listens to the same set of signals as
|
||||
BusyBox init. This is not 100% compatible with SysV init, but clearly
|
||||
the more common combination for Finit. For more details, see
|
||||
[doc/signals.md](doc/signals.md).
|
||||
|
||||
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`.
|
||||
|
||||
Finit also listens to the classic SysV init FIFO, which used to be
|
||||
located in `/dev` but these days default to `/run/initctl`. So existing
|
||||
tools like, `poweroff`, `halt`, `reboot`, and `shutdown` work as
|
||||
expected. Support for this old-style handling is implemented in the
|
||||
optional `initctl.so` plugin and can be accessed with the traditional
|
||||
`telinit` command line tool, symlinked to `finit`. Hence, if finit is
|
||||
your system init, then `init q` will work as the UNIX beards intended.
|
||||
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
|
||||
Usage: telinit [OPTIONS] [q | Q | 0-9]
|
||||
|
||||
Options:
|
||||
-h, --help This help text
|
||||
-v, --version Show Finit version
|
||||
|
||||
Commands:
|
||||
q | Q Reload *.conf in /etc/finit.d/, like SIGHUP
|
||||
0 - 9 Change runlevel: 0 halt, 6 reboot
|
||||
~ # 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
|
||||
```
|
||||
|
||||
|
||||
@@ -309,88 +345,81 @@ services, called `initctl`. Unlike `telinit` the `initctl` tool does
|
||||
not return until the given command has fully completed.
|
||||
|
||||
```shell
|
||||
~ $ initctl -h
|
||||
Usage: initctl [OPTIONS] <COMMAND>
|
||||
|
||||
Options:
|
||||
-d, --debug Debug initctl (client)
|
||||
-v, --verbose Verbose output
|
||||
-h, --help This help text
|
||||
|
||||
Commands:
|
||||
debug Toggle Finit (daemon) debug
|
||||
help This help text
|
||||
reload Reload *.conf in /etc/finit.d/ and activate changes
|
||||
runlevel [0-9] Show or set runlevel: 0 halt, 6 reboot
|
||||
status | show Show status of services
|
||||
cond set <COND> Set (assert) condition => +COND
|
||||
cond clear <COND> Clear (deassert) condition => -COND
|
||||
cond flux <COND> Emulate flux condition => ~COND
|
||||
cond show Show condition status
|
||||
start <JOB|NAME>[:ID] Start service by job# or name, with optional ID
|
||||
stop <JOB|NAME>[:ID] Stop/Pause a running service by job# or name
|
||||
restart <JOB|NAME>[:ID] Restart (stop/start) service by job# or name
|
||||
reload <JOB|NAME>[:ID] Reload (SIGHUP) service by job# or name
|
||||
version Show Finit version
|
||||
~ $ initctl -h
|
||||
Usage: initctl [OPTIONS] <COMMAND>
|
||||
|
||||
Options:
|
||||
-d, --debug Debug initctl (client)
|
||||
-v, --verbose Verbose output
|
||||
-h, --help This help text
|
||||
|
||||
Commands:
|
||||
debug Toggle Finit (daemon) debug
|
||||
help This help text
|
||||
reload Reload *.conf in /etc/finit.d/ and activate changes
|
||||
runlevel [0-9] Show or set runlevel: 0 halt, 6 reboot
|
||||
status | show Show status of services
|
||||
cond set <COND> Set (assert) condition => +COND
|
||||
cond clear <COND> Clear (deassert) condition => -COND
|
||||
cond show Show condition status
|
||||
cond dump Dump all conditions and their status
|
||||
start <JOB|NAME>[:ID] Start service by job# or name, with optional ID
|
||||
stop <JOB|NAME>[:ID] Stop/Pause a running service by job# or name
|
||||
restart <JOB|NAME>[:ID] Restart (stop/start) service by job# or name
|
||||
reload <JOB|NAME>[:ID] Reload (SIGHUP) service by job# or name
|
||||
version Show Finit version
|
||||
```
|
||||
|
||||
The `<!>` notation to a service stanza can be used empty, then it will
|
||||
apply to `reload` and `runlevel` commands. I.e., when a service's
|
||||
`.conf` file has been changed Finit will stop and start it instead. If
|
||||
a service does *not* have `<!>` declared, the service will be reloaded
|
||||
(`SIGHUP`:ed) in the `START` phase instead. The latter is the preferred
|
||||
behaviour, but not all daemons support this, unfortunately.
|
||||
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
|
||||
`runlevel` changes. If `<>` holds more [conditions](doc/conditions.md),
|
||||
these will also affect how a service is maintained.
|
||||
|
||||
**Note:** even though it is possible to start services not belonging to
|
||||
**Note:** even though it is possible to start services not belonging in
|
||||
the current runlevel these services will not be respawned automatically
|
||||
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.
|
||||
|
||||
```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
|
||||
4:2 inetd 0 [2345] internal time allow *:37
|
||||
4:3 inetd 0 [2345] internal 3737 allow *: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
|
||||
~ $ 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
|
||||
```
|
||||
|
||||
Running
|
||||
-------
|
||||
|
||||
Having successfully [built Finit](doc/build.md) it may now be time to
|
||||
take it for a test drive. The `make install` attempts to set up finit
|
||||
as the system system init, `/sbin/init`, but this is usually a symlink
|
||||
pointing to the current init.
|
||||
Requirements
|
||||
------------
|
||||
|
||||
So either change the symlink, or change your boot loader (GRUB, LOADLIN,
|
||||
LILO, U-Boot/Barebox or RedBoot) configuration to append the following
|
||||
to the kernel command line:
|
||||
Finit is capable of running on both desktop/server systems with udev and
|
||||
embedded systems that usually come with BusyBox mdev. Finit probes for
|
||||
them at runtime and expects `/dev/` to be writable, usually `devtmpfs`.
|
||||
It is also possible to run on a statically set up `/dev` if needed. It
|
||||
is however not a good idea to have both udev and mdev installed at the
|
||||
same time, this will lead to unpredictable results.
|
||||
|
||||
```shell
|
||||
init=/sbin/finit
|
||||
At boot Finit calls either `mdev` or `udevd` to populate `/dev`, this is
|
||||
done slightly differently and on systems with udev you might want to add
|
||||
the following one-shot task early in your `/etc/finit.conf`:
|
||||
|
||||
```conf
|
||||
run [S] /sbin/udevadm settle --timeout=120 -- Waiting for udev
|
||||
```
|
||||
|
||||
Remember to also set up an initial `/etc/finit.conf` before rebooting!
|
||||
Finit has a built-in Getty for TTYs, but requires a working `/bin/login`
|
||||
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
|
||||
properly in `/etc/fstab` -- which is iterated over at boot.
|
||||
|
||||
|
||||
Debugging
|
||||
---------
|
||||
|
||||
Add `finit_debug`, or `--debug`, to the kernel command line to enable
|
||||
debug messages. See the output from `configure --help` for more on
|
||||
how to assist debugging.
|
||||
|
||||
```shell
|
||||
init=/sbin/finit --debug
|
||||
```
|
||||
The built-in Inetd requires `/etc/services` and `/etc/protocols` to work
|
||||
with port names rather than numbers.
|
||||
|
||||
|
||||
Origin & References
|
||||
@@ -410,20 +439,26 @@ and proposed extensions.
|
||||
[3]: http://smarden.org/runit/
|
||||
[4]: http://en.wikipedia.org/wiki/Init
|
||||
[5]: http://en.wikipedia.org/wiki/Runlevel
|
||||
[6]: https://www.freedesktop.org/wiki/Software/systemd/
|
||||
[9]: https://github.com/troglobit/troglos
|
||||
[RFC862]: https://tools.ietf.org/html/rfc862
|
||||
[RFC863]: https://tools.ietf.org/html/rfc863
|
||||
[RFC864]: https://tools.ietf.org/html/rfc864
|
||||
[RFC867]: https://tools.ietf.org/html/rfc867
|
||||
[RFC868]: https://tools.ietf.org/html/rfc868
|
||||
[init]: http://en.wikipedia.org/wiki/Init
|
||||
[upstart]: http://upstart.ubuntu.com/
|
||||
[systemd]: http://www.freedesktop.org/wiki/Software/systemd/
|
||||
[openrc]: http://www.gentoo.org/proj/en/base/openrc/
|
||||
[run-parts(8)]: http://manpages.debian.org/cgi-bin/man.cgi?query=run-parts
|
||||
[original finit]: http://helllabs.org/finit/
|
||||
[EeePC fastinit]: http://wiki.eeeuser.com/boot_process:the_boot_process
|
||||
[Claudio Matsuoka]: https://github.com/cmatsuoka
|
||||
[Joachim Nilsson]: http://troglobit.com
|
||||
[GitHub]: https://github.com/troglobit/finit
|
||||
[License]: https://en.wikipedia.org/wiki/MIT_License
|
||||
[License Badge]: https://img.shields.io/badge/License-MIT-yellow.svg
|
||||
[Travis]: https://travis-ci.org/troglobit/finit
|
||||
[Travis Status]: https://travis-ci.org/troglobit/finit.png?branch=master
|
||||
[Coverity Scan]: https://scan.coverity.com/projects/3545
|
||||
[Coverity Status]: https://scan.coverity.com/projects/3545/badge.svg
|
||||
|
||||
<!--
|
||||
-- Local Variables:
|
||||
-- mode: markdown
|
||||
-- End:
|
||||
-->
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
# Top directory for building complete system, fall back to this directory
|
||||
ROOTDIR ?= $(TOPDIR)
|
||||
|
||||
# Strip binaries unless user explicitly disables it
|
||||
STRIPARGS ?= -s --strip-program=$(CROSS)strip -m 0755
|
||||
|
||||
# Some junk files we always want to be removed when doing a make clean.
|
||||
JUNK = *~ *.bak *.map .*.d *.d DEADJOE semantic.cache *.gdb *.elf core core.*
|
||||
MAKE := @$(MAKE)
|
||||
MAKEFLAGS = --no-print-directory --silent
|
||||
CHECK := cppcheck $(CPPFLAGS) --quiet --enable=all
|
||||
INSTALL := install --backup=off
|
||||
STRIPINST := $(INSTALL) $(STRIPARGS)
|
||||
ARFLAGS := crus
|
||||
|
||||
export libdir plugindir incdir ROOTDIR CPPFLAGS LDFLAGS LDLIBS STATIC
|
||||
|
||||
|
||||
# Override default implicit rules
|
||||
%.o: %.c
|
||||
@printf " CC $(subst $(ROOTDIR)/,,$(shell pwd)/$@)\n"
|
||||
@$(CC) $(CFLAGS) $(CPPFLAGS) -c -MMD -MP -o $@ $<
|
||||
|
||||
%: %.o
|
||||
@printf " LINK $(subst $(ROOTDIR)/,,$(shell pwd)/$@)\n"
|
||||
@$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-Map,$@.map -o $@ $^ $(LDLIBS$(LDLIBS-$(@)))
|
||||
|
||||
%.so: %.o
|
||||
@printf " PLUGIN $(subst $(ROOTDIR)/,,$(shell pwd)/$@)\n"
|
||||
@$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
|
||||
+98
-55
@@ -1,10 +1,10 @@
|
||||
AC_INIT(Finit, 3.0-rc1, https://github.com/troglobit/finit/issues, finit, http://troglobit.com/finit.html)
|
||||
AC_INIT(Finit, 3.0, https://github.com/troglobit/finit/issues, finit, http://troglobit.com/finit.html)
|
||||
AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz subdir-objects])
|
||||
AM_SILENT_RULES([yes])
|
||||
|
||||
AC_CONFIG_SRCDIR([finit.c])
|
||||
AC_CONFIG_SRCDIR([src/finit.c])
|
||||
AC_CONFIG_HEADER([config.h])
|
||||
AC_CONFIG_FILES([Makefile plugins/Makefile])
|
||||
AC_CONFIG_FILES([Makefile plugins/Makefile src/Makefile])
|
||||
|
||||
# Older versions of autoconf (<2.58) do not have AC_CONFIG_MACRO_DIR()
|
||||
#m4_include([m4/plugin.m4])
|
||||
@@ -24,8 +24,8 @@ AC_PROG_INSTALL
|
||||
|
||||
# Configuration.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(fstaby.h)
|
||||
AC_CHECK_FUNCS(strstr getopt getfsenty)
|
||||
AC_CHECK_HEADERS([fstaby.h termios.h])
|
||||
AC_CHECK_FUNCS([strstr getopt getfsenty])
|
||||
|
||||
# Check for uint[8,16,32]_t
|
||||
AC_TYPE_UINT8_T
|
||||
@@ -33,25 +33,38 @@ AC_TYPE_UINT16_T
|
||||
AC_TYPE_UINT32_T
|
||||
|
||||
# Check for required libraries
|
||||
PKG_CHECK_MODULES([uev], [libuev >= 1.4.2])
|
||||
PKG_CHECK_MODULES([lite], [libite >= 1.8.2])
|
||||
PKG_CHECK_MODULES([uev], [libuev >= 1.5.2])
|
||||
PKG_CHECK_MODULES([lite], [libite >= 1.9.2])
|
||||
|
||||
# Check for configured Finit features
|
||||
AC_ARG_ENABLE(emergency_shell,
|
||||
AS_HELP_STRING([--enable-emergency-shell], [Experimental emergency fallback at boot.
|
||||
Only use this for debugging very early boot problems with Finit.]))
|
||||
Use only for debugging very early boot problems with Finit]),,[
|
||||
enable_emergency_shell=no])
|
||||
|
||||
AC_ARG_ENABLE(fallback_shell,
|
||||
AS_HELP_STRING([--enable-fallback-shell], [Start a shell if no TTYs can start]),,[
|
||||
enable_fallback_shell=no])
|
||||
|
||||
AC_ARG_ENABLE(rw-rootfs,
|
||||
AS_HELP_STRING([--enable-rw-rootfs], [Remount / R/W at boot, usually not for embedded]))
|
||||
AS_HELP_STRING([--enable-rw-rootfs], [Remount / R/W at boot, usually not for embedded]),,[
|
||||
enable_rw_rootfs=no])
|
||||
|
||||
AC_ARG_ENABLE(silent,
|
||||
AS_HELP_STRING([--enable-silent], [Completely silent operation, not even boot messages]))
|
||||
AC_ARG_ENABLE(progress,
|
||||
AS_HELP_STRING([--enable-progress], [Pre Finit v3 bootup progress and heading]),,[
|
||||
enable_progress=no])
|
||||
|
||||
AC_ARG_ENABLE(watchdog,
|
||||
AS_HELP_STRING([--enable-watchdog], [Enable built-in watchdog, uses /dev/watchdog]),,[
|
||||
enable_watchdog=no])
|
||||
|
||||
AC_ARG_ENABLE(inetd,
|
||||
AS_HELP_STRING([--disable-inetd], [Disable built-in inetd super server, default enabled]))
|
||||
AS_HELP_STRING([--disable-inetd], [Disable built-in inetd super server, default enabled]),,[
|
||||
enable_inetd=yes])
|
||||
|
||||
AC_ARG_ENABLE(quiet,
|
||||
AS_HELP_STRING([--disable-quiet], [Default Finit obeys the kernel quiet option]))
|
||||
AC_ARG_ENABLE(logrotate,
|
||||
AS_HELP_STRING([--disable-logrotate], [Disable built-in rotation of /var/log/wtmp, default enabled]),,[
|
||||
enable_logrotate=yes])
|
||||
|
||||
# Check for extra plugins to enable
|
||||
enable_all_plugins=auto
|
||||
@@ -74,7 +87,7 @@ AC_ARG_WITH(heading,
|
||||
|
||||
AC_ARG_WITH(fifo,
|
||||
AS_HELP_STRING([--with-fifo=FIFO], [FIFO for init/telinit clients, default /var/run/initctl]),
|
||||
[fifo=$withval], [fifo=/var/run/initctl])
|
||||
[fifo=$withval], [fifo=$localstatedir/run/initctl])
|
||||
|
||||
AC_ARG_WITH(plugindir,
|
||||
AS_HELP_STRING([--with-plugindir=DIR], [Finit plugin directory, default /lib/finit/plugins]),
|
||||
@@ -97,14 +110,6 @@ AC_ARG_WITH(console,
|
||||
AS_HELP_STRING([--with-console=DEV], [Console to use, default: /dev/console]),
|
||||
[console=$withval], [console=/dev/console])
|
||||
|
||||
AC_ARG_WITH(shell,
|
||||
AS_HELP_STRING([--with-shell=PATH], [Fallback shell to use, default: /bin/sh]),
|
||||
[shell=$withval], [shell=/bin/sh])
|
||||
|
||||
AC_ARG_WITH(username,
|
||||
AS_HELP_STRING([--with-username=USER], [User for 'startx' .conf option, default: root]),
|
||||
[username=$withval], [username=root])
|
||||
|
||||
AC_ARG_WITH(hostname,
|
||||
AS_HELP_STRING([--with-hostname=NAME], [If /etc/hostname is missing, default: noname]),
|
||||
[hostname=$withval], [hostname=noname])
|
||||
@@ -124,47 +129,52 @@ AC_ARG_WITH(random-seed,
|
||||
AS_IF([test "x$enable_emergency_shell" = "xyes"], [
|
||||
AC_DEFINE(EMERGENCY_SHELL, 1, [Fork off init and let PID 1 wait and start /bin/sh if init crashes.])])
|
||||
|
||||
AS_IF([test "x$enable_fallback_shell" = "xyes"], [
|
||||
AC_DEFINE(FALLBACK_SHELL, 1, [Start /bin/sh on console if no TTYs.])])
|
||||
|
||||
AS_IF([test "x$enable_rw_rootfs" = "xyes"], [
|
||||
AC_DEFINE(REMOUNT_ROOTFS, 1, [Remount / as rw at boot])])
|
||||
|
||||
AS_IF([test "x$enable_silent" = "xyes"], [
|
||||
AC_DEFINE(SILENT_MODE, 1, [Completely silent operation, not even boot messages])
|
||||
AS_IF([test "x$enable_progress" = "xyes"], [
|
||||
AC_DEFINE(SILENT_MODE, 0, [Pre Finit v3 bootup messages and heading])
|
||||
], [
|
||||
AC_DEFINE(SILENT_MODE, 0, [Normal output, default])])
|
||||
AC_DEFINE(SILENT_MODE, 1, [Completely silent until login prompt])])
|
||||
|
||||
AS_IF([test "x$enable_watchdog" = "xyes"], [
|
||||
AC_DEFINE(BUILTIN_WATCHDOG, 1, [Enable built-in watchdog, kicks on /dev/watchdog])])
|
||||
|
||||
### Disable features ###########################################################################
|
||||
AS_IF([test "x$enable_inetd" != "xno"], enable_inetd="yes", [
|
||||
AC_DEFINE(INETD_DISABLED, 1, [Disable built-in inetd])])
|
||||
AS_IF([test "x$enable_inetd" != "xno"], [
|
||||
enable_inetd="yes"
|
||||
AC_DEFINE(INETD_ENABLED, 1, [Enable built-in inetd])])
|
||||
|
||||
AS_IF([test "x$enable_quiet" != "xno"], [
|
||||
AC_DEFINE(QUIET_MODE, 0, [Will print stopping/starting/etc messages at runtime])
|
||||
], [
|
||||
AC_DEFINE(QUIET_MODE, 1, [Silent at runtime, after initial boot, default])])
|
||||
AS_IF([test "x$enable_logrotate" != "xno"], [
|
||||
AC_DEFINE(LOGROTATE_ENABLED, 1, [Enable built-in rotation of /var/log/wtmp et al.])])
|
||||
|
||||
### With features ##############################################################################
|
||||
AS_IF([test "x$with_fifo" != "xno"], [
|
||||
AS_IF([test "x$fifo" = "xyes"], [
|
||||
fifo='/var/run/initctl'])])
|
||||
AC_EXPAND_DIR(lurvig, "$fifo")
|
||||
AC_DEFINE_UNQUOTED(FINIT_FIFO, "$lurvig", [FIFO for old style init/telinit client programs])
|
||||
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])
|
||||
|
||||
AS_IF([test "x$with_config" != "xno"], [
|
||||
AS_IF([test "x$config" = "xyes"], [
|
||||
conf=$sysconfdir/finit.conf])])
|
||||
AC_EXPAND_DIR(lurvig, "$conf")
|
||||
AC_DEFINE_UNQUOTED(FINIT_CONF, "$lurvig", [Main Finit configuration file, default /etc/finit.conf])
|
||||
AC_EXPAND_DIR(conf_path, "$conf")
|
||||
AC_DEFINE_UNQUOTED(FINIT_CONF, "$conf_path", [Main Finit configuration file, default /etc/finit.conf])
|
||||
|
||||
AS_IF([test "x$with_rcsd" != "xno"], [
|
||||
AS_IF([test "x$rcsd" = "xyes"], [
|
||||
rcsd=$sysconfdir/finit.d])])
|
||||
AC_EXPAND_DIR(lurvig, "$rcsd")
|
||||
AC_DEFINE_UNQUOTED(FINIT_RCSD, "$lurvig", [Finit rcS.d/, default /etc/finit.d])
|
||||
AC_EXPAND_DIR(rcsd_path, "$rcsd")
|
||||
AC_DEFINE_UNQUOTED(FINIT_RCSD, "$rcsd_path", [Finit rcS.d/, default /etc/finit.d])
|
||||
|
||||
AS_IF([test "x$with_rc_local" != "xno"], [
|
||||
AS_IF([test "x$rclocal" = "xyes"], [
|
||||
rclocal=$sysconfdir/rc.local])])
|
||||
AC_EXPAND_DIR(lurvig, "$rclocal")
|
||||
AC_DEFINE_UNQUOTED(FINIT_RC_LOCAL, "$lurvig", [Compat SysV /etc/rc.local file to run last at boot.])
|
||||
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.])
|
||||
|
||||
AS_IF([test "x$with_heading" != "xno"], [
|
||||
AS_IF([test "x$heading" = "xyes"], [
|
||||
@@ -176,16 +186,6 @@ AS_IF([test "x$with_console" != "xno"], [
|
||||
console=/dev/console])])
|
||||
AC_DEFINE_UNQUOTED(CONSOLE, "$console", [Default console to use])
|
||||
|
||||
AS_IF([test "x$with_shell" != "xno"], [
|
||||
AS_IF([test "x$shell" = "xyes"], [
|
||||
shell=/bin/sh])])
|
||||
AC_DEFINE_UNQUOTED(FALLBACK_SHELL, "$shell", [Used if no login getty])
|
||||
|
||||
AS_IF([test "x$with_username" != "xno"], [
|
||||
AS_IF([test "x$username" = "xyes"], [
|
||||
username=root])])
|
||||
AC_DEFINE_UNQUOTED(DEFUSER, "$username", [Used for startx .conf option])
|
||||
|
||||
AS_IF([test "x$with_hostname" != "xno"], [
|
||||
AS_IF([test "x$hostname" = "xyes"], [
|
||||
hostname=noname])])
|
||||
@@ -199,12 +199,55 @@ AS_IF([test "x$with_runlevel" != "xno"], [
|
||||
AS_IF([test "x$with_random_seed" != "xno"], [
|
||||
AS_IF([test "x$random_seed" = "xyes"], [
|
||||
random_seed=/var/lib/misc/random-seed])
|
||||
AC_EXPAND_DIR(lurvig, "$random_seed")
|
||||
AC_DEFINE_UNQUOTED(RANDOMSEED, "$lurvig", [Improve random at boot by seeding it with sth from before.])])
|
||||
AC_EXPAND_DIR(random_path, "$random_seed")
|
||||
AC_DEFINE_UNQUOTED(RANDOMSEED, "$random_path", [Improve random at boot by seeding it with sth from before.])])
|
||||
|
||||
# Control build with automake flags
|
||||
AM_CONDITIONAL(STATIC, [test "x$enable_static" = "xyes"])
|
||||
AM_CONDITIONAL(INETD, [test "x$enable_inetd" = "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"])
|
||||
|
||||
# Generate all files
|
||||
AC_OUTPUT
|
||||
|
||||
cat <<EOF
|
||||
|
||||
------------------ Summary ------------------
|
||||
$PACKAGE_NAME version $PACKAGE_VERSION
|
||||
Prefix................: $prefix
|
||||
Sysconfdir............: `eval echo $sysconfdir`
|
||||
Localstatedir.........: `eval echo $localstatedir`
|
||||
FIFO path.............: $fifo_path
|
||||
Finit config file.....: $conf_path
|
||||
Finit config.d path...: $rcsd_path
|
||||
Compat rc.local path..: $rclocal_path
|
||||
Random seed path......: $random_path
|
||||
C Compiler............: $CC $CFLAGS $CPPFLAGS $LDFLAGS $LIBS
|
||||
Linker................: $LD $LLDP_LDFLAGS $LLDP_BIN_LDFLAGS $LDFLAGS $LIBS
|
||||
|
||||
Behavior:
|
||||
Boot heading..........: $heading
|
||||
Plugins...............: $plugins
|
||||
|
||||
Optional features:
|
||||
Built-in inetd........: $enable_inetd
|
||||
Built-in watchdogd....: $enable_watchdog
|
||||
Built-in logrotate....: $enable_logrotate
|
||||
Emergency shell.......: $enable_emergency_shell
|
||||
Fallback shell........: $enable_fallback_shell
|
||||
Remount / RW at boot..: $enable_rw_rootfs
|
||||
Traditional progress..: $enable_progress
|
||||
Default console dev...: $console
|
||||
Default hostname......: $hostname
|
||||
Default runlevel......: $runlevel
|
||||
|
||||
------------- Compiler version --------------
|
||||
$($CC --version || true)
|
||||
-------------- Linker version ---------------
|
||||
$($LD --version || true)
|
||||
---------------------------------------------
|
||||
|
||||
Check the above options and compile with:
|
||||
${MAKE-make}
|
||||
|
||||
EOF
|
||||
|
||||
+32
-30
@@ -1,46 +1,48 @@
|
||||
HowTo: Finit on Alpine Linux 3.4
|
||||
================================
|
||||
HowTo: Finit on Alpine Linux 3.4-3.6
|
||||
====================================
|
||||
|
||||
Mini HowTo using Finit to boot an Alpine Linux system. It is assumed
|
||||
that the user has already installed a compiler, C library header files,
|
||||
HowTo use Finit to boot an [Alpine Linux][] system. It is assumed that
|
||||
the user has already installed make, a compiler, C library header files,
|
||||
and other tools needed to build a GNU configure based project.
|
||||
|
||||
To start with you need to first install [libuEv][] and [libite][], by
|
||||
default they install to `/usr/local` and Alpine's `pkg-config` does not
|
||||
look for libraries and header files there. So the `PKG_CONFIG_LIBDIR`
|
||||
environment variable has to be used:
|
||||
To start with you need to first install [libuEv][] and [libite][]. They
|
||||
default to install to `/usr/local`, but unlike Debian and Ubuntu based
|
||||
distros, Alpine's `pkg-config` does not look for libraries and header
|
||||
files there. So the `PKG_CONFIG_LIBDIR` environment variable must be
|
||||
used, or change the install prefix to `/usr`.
|
||||
|
||||
alpine:~/finit# PKG_CONFIG_LIBDIR=/usr/local/lib/pkgconfig ./configure \
|
||||
--enable-rw-rootfs --enable-x11-common-plugin \
|
||||
--enable-alsa-utils-plugin --enable-inetd-echo-plugin \
|
||||
--enable-inetd-chargen-plugin --enable-inetd-daytime-plugin \
|
||||
--enable-inetd-discard-plugin --enable-inetd-time-plugin \
|
||||
--with-heading="Alpine Linux 3.4" --with-hostname=alpine
|
||||
The bundled [build.sh](build.sh) script can be used to configure and
|
||||
build finit:
|
||||
|
||||
The plugins are optional, but the other configure flags are *not*.
|
||||
alpine:~# cd finit
|
||||
alpine:~/finit# ./contrib/alpine/build.sh
|
||||
|
||||
alpine:~/finit# make all install
|
||||
Then run the [install.sh](install.sh) script to install all necessary
|
||||
files, including the sample `finit.conf` and `finit.d/*.conf` files.
|
||||
More on that below.
|
||||
|
||||
The installation skips `/sbin/init`, because it already exists, and
|
||||
Alpine is hard coded to use it. So you have to change the symlink
|
||||
yourself to point to `finit` instead of `/bin/busybox`.
|
||||
alpine:~/finit# ./contrib/alpine/install.sh
|
||||
|
||||
The install script is non-destructive by default, you have to answer
|
||||
*Yes* twice to set up Finit as the system default init. Pay close
|
||||
attention to the last question:
|
||||
|
||||
*** Install Finit as the system default Init (y/N)?
|
||||
|
||||
If you answer `No`, simply by pressing enter, you can change the symlink
|
||||
yourself later on, to point to `finit` instead of `/bin/busybox`:
|
||||
|
||||
alpine:~/finit# cd /sbin
|
||||
alpine:/sbin# rm init
|
||||
alpine:/sbin# ln -s finit init
|
||||
|
||||
Before rebooting, make sure to set up a [/etc/finit.conf](finit.conf),
|
||||
and possibly also an [/etc/rc.local](rc.local) for one-shot set up and
|
||||
initialization like keyboard language etc. You can use the files in
|
||||
this directory as templates -- check them both if they need to be
|
||||
tweaked for your installation, you may not run Dropbear SSH or speak
|
||||
Swedish ...
|
||||
and [/etc/finit.d/](finit.d/) for your services. Samples are included
|
||||
in this directory. Notice the symlinks in `/etc/finit.d/`, which can be
|
||||
managed by the operator at runtime using `initctl enable SERVICE`. You
|
||||
can also use a standard [/etc/rc.local](rc.local) for one-shot tasks and
|
||||
initialization like keyboard language etc.
|
||||
|
||||
[libuEv]: https://github.com/troglobit/libuev
|
||||
[libite]: https://github.com/troglobit/libite
|
||||
|
||||
<!--
|
||||
-- Local Variables:
|
||||
-- mode: markdown
|
||||
-- End:
|
||||
-->
|
||||
[Alpine Linux]: https://www.alpinelinux.org/
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
3.6.2
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
echo
|
||||
echo "*** Configuring Finit for Alpine Linux"
|
||||
|
||||
if [ ! -e configure ]; then
|
||||
echo " The configure script is missing, maybe you're using a version from GIT?"
|
||||
echo " Attempting to run the autogen.sh script, you will need these tools:"
|
||||
echo " autoconf, automake, libtool, pkg-config ..."
|
||||
echo
|
||||
./autogen.sh
|
||||
fi
|
||||
|
||||
# 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.
|
||||
PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig ./configure \
|
||||
--enable-rw-rootfs --enable-progress \
|
||||
--enable-dbus-plugin --enable-x11-common-plugin \
|
||||
--enable-alsa-utils-plugin --enable-inetd-echo-plugin \
|
||||
--enable-inetd-chargen-plugin --enable-inetd-daytime-plugin \
|
||||
--enable-inetd-discard-plugin --enable-inetd-time-plugin \
|
||||
--with-heading="Alpine Linux 3.6" --with-hostname=alpine
|
||||
|
||||
echo
|
||||
echo "*** Building ..."
|
||||
echo
|
||||
make
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo
|
||||
echo "*** The build failed for some reason"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "*** Done"
|
||||
echo
|
||||
|
||||
@@ -1,40 +1,10 @@
|
||||
# /etc/finit.conf: Example for Alpine Linux 3.4
|
||||
# /etc/finit.conf: Example for Alpine Linux
|
||||
# See /etc/finit.d/*.conf and `initctl list` for other services
|
||||
|
||||
# Modules to load
|
||||
#module qxl
|
||||
#module fbcon
|
||||
module button
|
||||
module evdev
|
||||
## Runlevel to start after bootstrap, runlevel 'S'
|
||||
# Default is 2
|
||||
#runlevel 2
|
||||
|
||||
# Runlevel to start after bootstrap, runlevel 'S'
|
||||
runlevel 2
|
||||
## Bootstrap services and tasks
|
||||
# Can be listed here or in /etc/finit.d/*.conf
|
||||
|
||||
# Services to be monitored and respawned as needed
|
||||
service [S12345] /sbin/klogd -n -- Kernel log daemon
|
||||
service [S12345] /sbin/syslogd -n -- Syslog daemon
|
||||
|
||||
# Network bringup script, blocks boot like run stanza, use below task instead
|
||||
#network /sbin/ifup -a
|
||||
|
||||
### Every line below can be a service/task per file in /etc/finit.d/*.conf ###
|
||||
|
||||
# Network bringup not needed if /etc/network/interfaces is used.
|
||||
task [2345] log <svc/sbin/syslogd> /sbin/ifup -a -- Networking
|
||||
|
||||
# Depends on syslogd having started. Redirect any output to log.
|
||||
service [2345] log <svc/sbin/syslogd> /usr/sbin/acpid -f -- ACPI daemon
|
||||
|
||||
# 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
|
||||
|
||||
# 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] <svc/sbin/syslogd> /usr/sbin/crond -f -S -c /etc/crontabs -- Cron daemon
|
||||
|
||||
# Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager)
|
||||
service [2345] /sbin/acpid -f -- ACPI daemon
|
||||
|
||||
# Consoles to start getty on when system is up
|
||||
tty /dev/tty1
|
||||
tty /dev/tty2
|
||||
tty /dev/tty3
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager)
|
||||
# Depends on syslogd having started. Redirect any output to log.
|
||||
service [2345] log <svc/sbin/syslogd> /sbin/acpid -f -- ACPI daemon
|
||||
@@ -0,0 +1 @@
|
||||
service [2345] <svc/sbin/syslogd> /usr/sbin/crond -f -S -c /etc/crontabs -- Cron daemon
|
||||
@@ -0,0 +1,2 @@
|
||||
# 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
|
||||
@@ -0,0 +1,4 @@
|
||||
# Consoles to start getty on when system is up
|
||||
tty /dev/tty1 noclear nowait
|
||||
tty /dev/tty2 noclear nowait
|
||||
tty /dev/tty3 noclear nowait
|
||||
@@ -0,0 +1,2 @@
|
||||
# Oneshot task to run once at bootstrap
|
||||
task [S] zcat /etc/keymap/se.bmap.gz | loadkmap -- Loading keymap
|
||||
@@ -0,0 +1,2 @@
|
||||
# Start klogd as soon as possible, should always run
|
||||
service [S12345] /sbin/klogd -n -- Kernel log daemon
|
||||
@@ -0,0 +1 @@
|
||||
service [2345] /usr/sbin/lxdm -- Lightweight Login Manager
|
||||
@@ -0,0 +1,6 @@
|
||||
## Linux kernel modules to load
|
||||
#module fbcon
|
||||
module button
|
||||
module evdev
|
||||
module mousedev
|
||||
module 8139cp
|
||||
@@ -0,0 +1,2 @@
|
||||
# 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
|
||||
@@ -0,0 +1,2 @@
|
||||
# Start syslogd as soon as possible, should always run
|
||||
service [S12345] /sbin/syslogd -n -- Syslog daemon
|
||||
+1
@@ -0,0 +1 @@
|
||||
available/dropbear.conf
|
||||
+1
@@ -0,0 +1 @@
|
||||
available/getty.conf
|
||||
+1
@@ -0,0 +1 @@
|
||||
available/keymap.conf
|
||||
+1
@@ -0,0 +1 @@
|
||||
available/klogd.conf
|
||||
+1
@@ -0,0 +1 @@
|
||||
available/modules.conf
|
||||
+1
@@ -0,0 +1 @@
|
||||
available/syslogd.conf
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "x`id -u`" != "x0" ]; then
|
||||
echo
|
||||
echo "*** This script must run as root"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Adjust base directory
|
||||
if [ -e alpine-release ]; then
|
||||
cd ../..
|
||||
elif [ ! -e autogen.sh ]; then
|
||||
echo "*** Please run this script from the Finit base directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "*** Install Finit on Alpine Linux"
|
||||
echo "========================================================================"
|
||||
echo "/sbin/finit - PID 1"
|
||||
echo "/lib/finit/plugins/* - All enabled Finit plugins"
|
||||
echo "/etc/finit.conf - Finit configuration file"
|
||||
echo "/etc/finit.d/ - Finit services"
|
||||
echo
|
||||
read -p "Do you want to continue (y/N)? " yorn
|
||||
|
||||
if [ "x$yorn" = "xy" -o "x$yorn" = "xY" ]; then
|
||||
echo
|
||||
echo "*** Installing Finit files ..."
|
||||
make install
|
||||
cd `dirname $0`
|
||||
for file in finit.conf rc.local; do
|
||||
install -vbD $file /etc/$file
|
||||
done
|
||||
cp -va finit.d /etc/
|
||||
|
||||
read -p "*** Install Finit as the system default Init (y/N)? " yorn
|
||||
if [ "x$yorn" = "xy" -o "x$yorn" = "xY" ]; then
|
||||
echo "*** Updating /sbin/init symlink --> finit ..."
|
||||
cd /sbin
|
||||
rm init
|
||||
ln -s finit init
|
||||
fi
|
||||
echo "*** Done"
|
||||
echo
|
||||
else
|
||||
echo
|
||||
echo "*** Aborting install."
|
||||
echo
|
||||
fi
|
||||
@@ -1,2 +1,8 @@
|
||||
#!/bin/sh
|
||||
zcat /etc/keymap/sv-latin1.bmap.gz | loadkmap
|
||||
# This script is executed once at boot, at the very end,
|
||||
# right before starting the TTYs.
|
||||
#
|
||||
# Each line is run in sequence.
|
||||
#
|
||||
# NOTE: Remeber to set the executable bit!
|
||||
#
|
||||
|
||||
+31
-33
@@ -1,20 +1,12 @@
|
||||
HowTo: Finit on Debian Jessie
|
||||
=============================
|
||||
HowTo: Finit on Debian GNU/Linux
|
||||
================================
|
||||
|
||||
Mini HowTo using Finit to boot Debian GNU/Linux 8.5 (Jessie). It is
|
||||
assumed that the user has already installed a compiler, C library header
|
||||
files, and other tools needed to build a GNU configure based project.
|
||||
HowTo use Finit to boot a Debian GNU/Linux system. It is assumed that
|
||||
the user has already installed a compiler, C library header files, and
|
||||
other tools needed to build a GNU configure based project. I.e., at
|
||||
the very least:
|
||||
|
||||
Also, Finit has only been verified to work with the Debian *Server* ed.
|
||||
I.e., during install — skip GNOME and other X stuff to get a plain and
|
||||
usable Debian server install, which we can add X-Window to later :-)
|
||||
|
||||
Now, I started off by replacing systemd from the base install with the
|
||||
old SysV init, using [this HowTo][1], you may not need to do that, but
|
||||
for me it was easier — and also a great rebuttal to all the systemd
|
||||
haters out there (yeah, even though I speak for the alternative PID 1
|
||||
movement I don't hate systemd :P) it is possible to still run Debian
|
||||
without systemd! Anyway, this text was based on that experience.
|
||||
root@debian:~# apt install build-essential
|
||||
|
||||
Like the [Alpine HowTo](../alpine/), you need to install [libuEv][] and
|
||||
[libite][], but since this is Debian — which takes infinite care of its
|
||||
@@ -23,30 +15,36 @@ it installed so it can locate the uEv and lite libraries.
|
||||
|
||||
> With Debian everything just works!™
|
||||
|
||||
The following build and install script can be used to configure, build,
|
||||
install and set up your system to run Finit:
|
||||
... just make sure to install the following, so `ifup` and other basic
|
||||
tools pre-systemd work as intended.
|
||||
|
||||
debian:~/finit$ contrib/debian/build.sh
|
||||
root@debian:~# apt install initscripts console-setup
|
||||
|
||||
Since `/sbin/init` already exists on your system the script creates
|
||||
another entry in your GRUB config, in `/etc/grub.d/40_custom`, where
|
||||
`init=/sbin/finit` is added to your kernel line. You could of course
|
||||
also change the `/sbin/init` symlink and uninstall systemd/SysV init if
|
||||
everything works fine, but that's up to you.
|
||||
The following script can then be used to configure, build, install and
|
||||
set up your system to run Finit:
|
||||
|
||||
Before rebooting, read up on [/etc/finit.conf](finit.conf) and notice
|
||||
how `/etc/start.d/` and `/etc/rc.local` can be used to extend the boot
|
||||
with simpler setup tasks on your system — see the docu for details.
|
||||
user@debian:~/finit$ contrib/debian/build.sh
|
||||
|
||||
However, since `/sbin/init` already exists on your system, the script
|
||||
creates another entry in your GRUB config, in `/etc/grub.d/40_custom`,
|
||||
where `init=/sbin/finit` is added to your kernel line. It is of course
|
||||
also possible to change the default init to Finit, if you do you can
|
||||
remove the custom Grub entry:
|
||||
|
||||
user@debian:~/finit# cd /sbin
|
||||
user@debian:/sbin# sudo rm init
|
||||
user@debian:/sbin# sudo ln -s finit init
|
||||
|
||||
Before rebooting, check the default [/etc/finit.conf](finit.conf) and
|
||||
`/etc/finit.d/*.conf` files. The build + install script above provides
|
||||
a few sample `.conf` files. See `initctl list` after boot for a list of
|
||||
enabled and available services.
|
||||
|
||||
You can also use a standard [/etc/rc.local](rc.local) for one-shot tasks
|
||||
and initialization like keyboard language etc.
|
||||
|
||||
Have fun!
|
||||
/Joachim ツ
|
||||
|
||||
[1]: http://without-systemd.org/wiki/index.php/How_to_remove_systemd_from_a_Debian_jessie/sid_installation
|
||||
[libuEv]: https://github.com/troglobit/libuev
|
||||
[libite]: https://github.com/troglobit/libite
|
||||
|
||||
<!--
|
||||
-- Local Variables:
|
||||
-- mode: markdown
|
||||
-- End:
|
||||
-->
|
||||
|
||||
+13
-9
@@ -11,24 +11,28 @@ echo
|
||||
echo "*** Configuring Finit for Debian"
|
||||
|
||||
if [ ! -e configure ]; then
|
||||
echo " The configure script is missing, maybe you're using a GIT checkout?"
|
||||
echo " Attempting to run the autogen.sh script, you need these tools:"
|
||||
echo " The configure script is missing, maybe you're using a version from GIT?"
|
||||
echo " Attempting to run the autogen.sh script, you will need these tools:"
|
||||
echo " autoconf, automake, libtool, pkg-config ..."
|
||||
echo
|
||||
./autogen.sh
|
||||
fi
|
||||
echo
|
||||
|
||||
./configure --enable-rw-rootfs --enable-dbus-plugin --enable-x11-common-plugin \
|
||||
--enable-alsa-utils-plugin --with-random-seed=/var/lib/urandom/random-seed \
|
||||
--with-heading="Debian GNU/Linux 8.5" --with-hostname=jessie \
|
||||
--enable-inetd-echo-plugin --enable-inetd-chargen-plugin \
|
||||
--enable-inetd-daytime-plugin --enable-inetd-discard-plugin \
|
||||
--enable-inetd-time-plugin
|
||||
# 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.
|
||||
./configure \
|
||||
--enable-rw-rootfs --enable-progress \
|
||||
--enable-dbus-plugin --enable-x11-common-plugin \
|
||||
--enable-alsa-utils-plugin --enable-inetd-echo-plugin \
|
||||
--enable-inetd-chargen-plugin --enable-inetd-daytime-plugin \
|
||||
--enable-inetd-discard-plugin --enable-inetd-time-plugin \
|
||||
--with-random-seed=/var/lib/urandom/random-seed \
|
||||
--with-heading="Debian GNU/Linux" --with-hostname="stretch"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo
|
||||
echo "*** Configure script failed, have you installed libuEV and libite?"
|
||||
echo "*** Configure script failed, have you installed libuEv and libite?"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -1,60 +1,10 @@
|
||||
# /etc/finit.conf: Example for Debian GNU/Linux 8.5
|
||||
# Here we use one big (?) finit.conf, but all non-bootstrap services
|
||||
# can just as easily be listed in a separate /etc/finit.d/*.conf
|
||||
# /etc/finit.conf: Example for Debian GNU/Linux
|
||||
# See /etc/finit.d/*.conf and `initctl list` for other services
|
||||
|
||||
# The host directive is a fallback if /etc/hostname is missing
|
||||
host jessie
|
||||
## Runlevel to start after bootstrap, runlevel 'S'
|
||||
# Default is 2
|
||||
#runlevel 2
|
||||
|
||||
# The user directive is only for the startx directive, which in turn is
|
||||
# just like a service but with a different user. Services can also run
|
||||
# with a different user, using the @username syntax
|
||||
user root
|
||||
## Bootstrap services and tasks
|
||||
# Can be listed here or in /etc/finit.d/*.conf
|
||||
|
||||
# Linux kernel modules to load, /etc/modprobe is not used
|
||||
module button
|
||||
module evdev
|
||||
module loop
|
||||
module psmouse
|
||||
|
||||
# Runlevel to start after bootstrap, runlevel 'S'.
|
||||
# Change this to 3 to start XDM at boot.
|
||||
runlevel 2
|
||||
|
||||
# Some services may need to start very early, e.g. a watchdog daemon.
|
||||
# Runlevel [S] (bootStrap) is useful for that. It cannot be switched
|
||||
# to at runtime either, so tasks and run directives usually live here.
|
||||
# Please note, the run directive is blocking, so be careful!
|
||||
#service [S12345] /sbin/watchdogd -n -- Watchdog daemon
|
||||
#run [S] /sbin/probe -- system probe
|
||||
#run [S] /sbin/setupd --bootstrap -- system bootstrap
|
||||
service [S12345] /usr/sbin/rsyslogd -n -- Syslog daemon
|
||||
|
||||
# Network bringup script not needed if /etc/network/interfaces is used
|
||||
#network service networking start
|
||||
|
||||
# Regular services to be monitored and respawned as needed. Here we use
|
||||
# a (svc) condition, the listed service must be started (waits for the
|
||||
# PID file to be created in /run/*.pid) before starting either service,
|
||||
# (net) conditions are also available.
|
||||
service [2345] <svc/usr/sbin/rsyslogd> log /usr/sbin/acpid -f -- ACPI daemon
|
||||
service [2345] <svc/usr/sbin/rsyslogd> /usr/sbin/sshd -D -- SSH daemon
|
||||
|
||||
# Here we use XDM since it has few dependencies (relatively speaking).
|
||||
# It is also an example of a service (startx is an alias for service)
|
||||
# that does not have a -- description.
|
||||
#service [3] /usr/sbin/lightdm -- X-Window Display Manager
|
||||
startx [3] /usr/bin/xdm -nodaemon
|
||||
|
||||
# Run old-style start scripts from this directory. Very similar to how
|
||||
# SysV init works: 01first, 02second, etc. see run-parsts(8) for details
|
||||
runparts /etc/start.d
|
||||
# |-- S03keyboard-setup
|
||||
# |-- S17kbd
|
||||
# `- S18console-setup
|
||||
|
||||
# Virtual consoles to start getty on. Runlevels, speed & $TERM optional
|
||||
# TTYs are also services, sort of, but they are guaranteed to start at
|
||||
# the very end of the boot sequence. Finit comes with a built-in getty.
|
||||
tty [12345] /dev/tty1 115200 vt100
|
||||
tty [2345] /dev/tty2 38400 linux
|
||||
tty [2345] /dev/tty3 38400 linux
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager)
|
||||
# Depends on rsyslogd having started. Redirect any output to log.
|
||||
service [2345] <svc/usr/sbin/rsyslogd> log /usr/sbin/acpid -f -- ACPI daemon
|
||||
@@ -0,0 +1,2 @@
|
||||
# Oneshot task to run once at bootstrap
|
||||
task [S] /lib/console-setup/console-setup.sh -- Setting up console font and keymap
|
||||
@@ -0,0 +1,4 @@
|
||||
# Consoles to start getty on when system is up
|
||||
tty [12345] /dev/tty1 115200 vt100 noclear nowait
|
||||
tty [2345] /dev/tty2 38400 linux noclear nowait
|
||||
tty [2345] /dev/tty3 38400 linux noclear nowait
|
||||
@@ -0,0 +1,2 @@
|
||||
# Oneshot task to run once at bootstrap
|
||||
task [S] /lib/console-setup/keyboard-setup.sh -- Setting up console keyboard layout
|
||||
@@ -0,0 +1 @@
|
||||
service [3] /usr/sbin/lightdm -- Light Display Manager
|
||||
@@ -0,0 +1,8 @@
|
||||
## Linux kernel modules to load
|
||||
#module fbcon
|
||||
module button
|
||||
module evdev
|
||||
module loop
|
||||
module psmouse
|
||||
module mousedev
|
||||
module 8139cp
|
||||
@@ -0,0 +1,2 @@
|
||||
# Simple NTP client (SNTP)
|
||||
service [2345] <net/route/default> /usr/sbin/ntpclient -n -L pool.ntp.org -- SNTP client
|
||||
@@ -0,0 +1,2 @@
|
||||
# Start rsyslogd as soon as possible, should always run
|
||||
service [S12345] /usr/sbin/rsyslogd -n -- Reliable and extended syslog daemon
|
||||
@@ -0,0 +1,2 @@
|
||||
# Start SSH daemon as soon as basic networking comes up
|
||||
service [2345] <net/lo/up> /usr/sbin/sshd -D -- OpenSSH daemon
|
||||
@@ -0,0 +1,4 @@
|
||||
# Here we use XDM since it has few dependencies (relatively speaking).
|
||||
# It is also an example of a service without a -- description.
|
||||
# service [3] /usr/sbin/lxdm -- Lightweight Login Manager
|
||||
service [3] /usr/bin/xdm -nodaemon
|
||||
@@ -0,0 +1 @@
|
||||
available/console-setup.conf
|
||||
+1
@@ -0,0 +1 @@
|
||||
available/getty.conf
|
||||
@@ -0,0 +1 @@
|
||||
available/keyboard-setup.conf
|
||||
+1
@@ -0,0 +1 @@
|
||||
available/modules.conf
|
||||
+1
@@ -0,0 +1 @@
|
||||
available/rsyslogd.conf
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
available/sshd.conf
|
||||
+17
-19
@@ -1,8 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
SYMLINKS="start.d/*"
|
||||
FILES="finit.conf"
|
||||
|
||||
if [ "x`id -u`" != "x0" ]; then
|
||||
echo
|
||||
echo "=> Unfortunately this script must run as root (sudo) <="
|
||||
@@ -14,19 +11,18 @@ fi
|
||||
grep -q Debian os-release 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
cd ../..
|
||||
elif [ ! -e finit.c ]; then
|
||||
echo "Please run this script from the Finit base directory."
|
||||
elif [ ! -e autogen.sh ]; then
|
||||
echo "*** Please run this script from the Finit base directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Install Finit on Debian 8 (jessie)"
|
||||
echo
|
||||
echo "*** Install Finit on Debian GNU/Linux"
|
||||
echo "========================================================================"
|
||||
echo "/sbin/finit - PID 1"
|
||||
echo "/lib/finit/plugins/* - All enabled Finit plugins"
|
||||
echo "/etc/finit.conf - Instead of units or /etc/init.d Finit can have"
|
||||
echo " one config for your system. Or you can split"
|
||||
echo " it in service(s) per file in /etc/finit.d/"
|
||||
echo "/etc/start.d/ - Simple Debian setup scripts run with run-parts(8)"
|
||||
echo "/etc/finit.conf - Finit configuration file"
|
||||
echo "/etc/finit.d/ - Finit services"
|
||||
echo "/etc/grub.d/40_custom - Add menu entry to the Grub boot loader"
|
||||
echo
|
||||
read -p "Do you want to continue (y/N)? " yorn
|
||||
@@ -36,20 +32,22 @@ if [ "x$yorn" = "xy" -o "x$yorn" = "xY" ]; then
|
||||
echo "Installing Finit files ..."
|
||||
make install
|
||||
cd `dirname $0`
|
||||
mkdir -p /etc/start.d
|
||||
for file in $FILES; do
|
||||
install -vbD $file /etc/$file
|
||||
done
|
||||
for link in $SYMLINKS; do
|
||||
cp -va $link /etc/$link
|
||||
done
|
||||
echo "Setting up a GRUB boot entry ..."
|
||||
install -vbD finit.conf /etc/finit.conf
|
||||
cp -va finit.d /etc/
|
||||
|
||||
echo "*** Setting up a GRUB boot entry ..."
|
||||
MENU=`grep gnu-linux /boot/grub/grub.cfg |head -1 |sed "s/menuentry '\([^']*\).*/\1/"`
|
||||
TYPE=`grep gnu-linux /boot/grub/grub.cfg |head -1 |sed "s/.*' --class \([a-z]*\).*/\1/"`
|
||||
BOOT=`grep set=root /boot/grub/grub.cfg |head -1 |sed 's/.* \([a-f0-9]*-[a-f0-9]*-[a-f0-9]*-[a-f0-9]*-[a-f0-9]*\).*/\1/'`
|
||||
ROOT=`grep root=UUID /boot/grub/grub.cfg |head -1 |sed 's/.*UUID=\([a-f0-9]*-[a-f0-9]*-[a-f0-9]*-[a-f0-9]*-[a-f0-9]*\).*/\1/'`
|
||||
cat grub.d/40_custom | sed "s,\$BOOT,$BOOT,;s,\$ROOT,$ROOT,;s,\$TYPE,$TYPE,;s,\$MENU,$MENU," >/etc/grub.d/40_custom
|
||||
update-grub
|
||||
|
||||
echo
|
||||
echo "*** Done"
|
||||
echo
|
||||
else
|
||||
echo "Aborting install."
|
||||
echo
|
||||
echo "*** Aborting install."
|
||||
echo
|
||||
fi
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../init.d/keyboard-setup
|
||||
@@ -1 +0,0 @@
|
||||
../init.d/kbd
|
||||
@@ -1 +0,0 @@
|
||||
../init.d/console-setup
|
||||
@@ -1,6 +1,5 @@
|
||||
# Sample finit.conf to demonstrate the syntax
|
||||
#
|
||||
user admin
|
||||
host testbed
|
||||
|
||||
# Devices to fsck at boot
|
||||
@@ -1,65 +0,0 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: keyboard-setup
|
||||
# Required-Start: mountkernfs
|
||||
# Required-Stop:
|
||||
# Should-Start: keymap udev
|
||||
# X-Start-Before: checkroot
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# X-Interactive: true
|
||||
# Short-Description: Set preliminary keymap
|
||||
# Description: Set the console keyboard as early as possible
|
||||
# so during the file systems checks the administrator
|
||||
# can interact. At this stage of the boot process
|
||||
# only the ASCII symbols are supported.
|
||||
### END INIT INFO
|
||||
|
||||
set -e
|
||||
|
||||
# This script is not used by keyboard-configuration. It is used
|
||||
# jointly by console-setup and console-setup-mini
|
||||
|
||||
test -f /bin/setupcon || exit 0
|
||||
|
||||
if [ -f /lib/lsb/init-functions ]; then
|
||||
. /lib/lsb/init-functions
|
||||
else
|
||||
log_action_begin_msg () {
|
||||
echo -n "$@... "
|
||||
}
|
||||
|
||||
log_action_end_msg () {
|
||||
if [ "$1" -eq 0 ]; then
|
||||
echo done.
|
||||
else
|
||||
echo failed.
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
stop)
|
||||
# keyboard-setup isn't a daemon
|
||||
;;
|
||||
start|force-reload|restart|reload)
|
||||
case `readlink /proc/self/fd/2` in
|
||||
/dev/tty[0-9]*|/dev/vc/[0-9]*|/dev/console)
|
||||
log_action_begin_msg "Setting preliminary keymap"
|
||||
if setupcon -k; then
|
||||
log_action_end_msg 0
|
||||
else
|
||||
log_action_end_msg $?
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo 'Usage: /etc/init.d/keyboard-setup {start|reload|restart|force-reload|stop}'
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: acpid
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# X-Start-Before: kdm gdm xdm hal
|
||||
# X-Stop-After: kdm gdm xdm hal
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop:
|
||||
# Short-Description: Start the Advanced Configuration and Power Interface daemon
|
||||
# Description: Provide a socket for X11, hald and others to multiplex
|
||||
# kernel ACPI events.
|
||||
### END INIT INFO
|
||||
|
||||
set -e
|
||||
|
||||
ACPID="/usr/sbin/acpid"
|
||||
DEFAULTS="/etc/default/acpid"
|
||||
|
||||
# Check for daemon presence
|
||||
[ -x "$ACPID" ] || exit 0
|
||||
|
||||
OPTIONS=""
|
||||
MODULES=""
|
||||
# Include acpid defaults if available
|
||||
[ -r "$DEFAULTS" ] && . "$DEFAULTS"
|
||||
|
||||
# Get lsb functions
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
# As the name says. If the kernel supports modules, it'll try to load
|
||||
# the ones listed in "MODULES".
|
||||
load_modules() {
|
||||
[ -f /proc/modules ] || return 0
|
||||
if [ "$MODULES" = "all" ]; then
|
||||
MODULES="$(sed -rn 's#^(/lib/modules/[^/]+/)?kernel/(drivers|ubuntu)/acpi/([^/]+/)*(.*)\.ko:.*#\4#p' "/lib/modules/$(uname -r)/modules.dep")"
|
||||
fi
|
||||
|
||||
if [ -z "$MODULES" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
log_begin_msg "Loading ACPI kernel modules..."
|
||||
# work around a bug in initramfs which leaks this env var Launchpad #291619
|
||||
# and a bug in modprobe --all --quiet which doesn't load all modules and
|
||||
# exits with non-zero exit status Debian #504088
|
||||
unset MODPROBE_OPTIONS
|
||||
modprobe --all --use-blacklist $MODULES 2>/dev/null
|
||||
log_end_msg $?
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
load_modules || true
|
||||
log_begin_msg "Starting ACPI services..."
|
||||
start-stop-daemon --start --quiet --oknodo --exec "$ACPID" -- $OPTIONS
|
||||
log_end_msg $?
|
||||
;;
|
||||
stop)
|
||||
log_begin_msg "Stopping ACPI services..."
|
||||
start-stop-daemon --stop --quiet --oknodo --retry 2 --exec "$ACPID"
|
||||
log_end_msg $?
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
sleep 1
|
||||
$0 start
|
||||
;;
|
||||
reload|force-reload)
|
||||
log_begin_msg "Reloading ACPI services..."
|
||||
start-stop-daemon --stop --signal 1 --exec "$ACPID"
|
||||
log_end_msg $?
|
||||
;;
|
||||
status)
|
||||
status_of_proc "$ACPID" acpid
|
||||
;;
|
||||
*)
|
||||
log_success_msg "Usage: /etc/init.d/acpid {start|stop|restart|reload|force-reload|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
@@ -1,259 +0,0 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: kbd
|
||||
# Required-Start: $remote_fs
|
||||
# Required-Stop:
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# X-Interactive: true
|
||||
# Description: Set console screen modes and fonts
|
||||
# Short-Description: Prepare console
|
||||
### END INIT INFO
|
||||
|
||||
# This is the boot script for the `kbd' package.
|
||||
# It loads parameters from /etc/kbd/config and maybe loads
|
||||
# default font and map.
|
||||
# (c) 1997 Yann Dirson
|
||||
|
||||
PKG=kbd
|
||||
if [ -r /etc/$PKG/config ]; then
|
||||
. /etc/$PKG/config
|
||||
fi
|
||||
|
||||
if [ -d /etc/$PKG/config.d ]; then
|
||||
for i in `run-parts --list /etc/$PKG/config.d `; do
|
||||
. $i
|
||||
done
|
||||
fi
|
||||
|
||||
# do some magic with the variables for compatibility with the config
|
||||
# file of console-tools
|
||||
for vc in '' `set | grep "^.*_vc[0-9][0-9]*=" | sed 's/^.*\(_vc[0-9][0-9]*\)=.*/\1/'`
|
||||
do
|
||||
eval [ '"'\${SCREEN_FONT$vc}'"' ] && eval CONSOLE_FONT$vc=\${CONSOLE_FONT$vc:-\${SCREEN_FONT$vc}}
|
||||
eval [ '"'\${SCREEN_FONT_MAP$vc}'"' ] && eval FONT_MAP$vc=\${FONT_MAP$vc:-\${SCREEN_FONT_MAP$vc}}
|
||||
eval [ '"'\${APP_CHARSET_MAP$vc}'"' ] && eval CONSOLE_MAP$vc=\${CONSOLE_MAP$vc:-\${APP_CHARSET_MAP$vc}}
|
||||
done
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
SETFONT_OPT="-v"
|
||||
|
||||
if which setupcon >/dev/null
|
||||
then
|
||||
HAVE_SETUPCON=yes
|
||||
fi
|
||||
|
||||
# set DEVICE_PREFIX depending on devfs/udev
|
||||
if [ -d /dev/vc ]; then
|
||||
DEVICE_PREFIX="/dev/vc/"
|
||||
else
|
||||
DEVICE_PREFIX="/dev/tty"
|
||||
fi
|
||||
|
||||
# determine the system charmap
|
||||
ENV_FILE=''
|
||||
[ -r /etc/environment ] && ENV_FILE="/etc/environment"
|
||||
[ -r /etc/default/locale ] && ENV_FILE="/etc/default/locale"
|
||||
[ "$ENV_FILE" ] && CHARMAP=$(set -a && . "$ENV_FILE" && locale charmap)
|
||||
if [ "$CHARMAP" = "UTF-8" -a -z "$CONSOLE_MAP" ]
|
||||
then
|
||||
UNICODE_MODE=yes
|
||||
fi
|
||||
|
||||
reset_vga_palette ()
|
||||
{
|
||||
if [ -f /proc/fb ]; then
|
||||
# They have a framebuffer device.
|
||||
# That means we have work to do...
|
||||
echo -n "]R"
|
||||
fi
|
||||
}
|
||||
|
||||
unicode_start_stop ()
|
||||
{
|
||||
vc=$1
|
||||
if [ -n "$UNICODE_MODE" -a -z "`eval echo \\$CONSOLE_MAP_vc$vc`" ]; then
|
||||
action=unicode_start
|
||||
else
|
||||
action=unicode_stop
|
||||
fi
|
||||
if [ "${CONSOLE_FONT}" ]; then
|
||||
$action "${CONSOLE_FONT}" < ${DEVICE_PREFIX}$vc > ${DEVICE_PREFIX}$vc 2> /dev/null || true
|
||||
else
|
||||
$action < ${DEVICE_PREFIX}$vc > ${DEVICE_PREFIX}$vc 2> /dev/null || true
|
||||
fi
|
||||
}
|
||||
|
||||
setup ()
|
||||
{
|
||||
# be sure the main program is installed
|
||||
which setfont >/dev/null || return
|
||||
|
||||
VT="no"
|
||||
# If we can't access the console, quit
|
||||
CONSOLE_TYPE=`fgconsole 2>/dev/null` || return
|
||||
|
||||
if [ ! $CONSOLE_TYPE = "serial" ]; then
|
||||
readlink /proc/self/fd/0 | grep -q -e /dev/vc -e '/dev/tty[^p]' -e /dev/console
|
||||
if [ $? -eq 0 ]; then
|
||||
VT="yes"
|
||||
reset_vga_palette
|
||||
fi
|
||||
fi
|
||||
|
||||
[ $VT = "no" ] && return
|
||||
|
||||
# start vcstime
|
||||
if [ "${DO_VCSTIME}" = "yes" ] && which vcstime >/dev/null; then
|
||||
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Starting clock on text console"
|
||||
vcstime &
|
||||
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
|
||||
fi
|
||||
|
||||
if [ -d /etc/init ] && which initctl >/dev/null; then
|
||||
# Upstart
|
||||
LIST_CONSOLES=`cd /etc/init; find -name 'tty*.conf' -printf '%f ' | sed -e 's/[^0-9 ]//g'`
|
||||
else
|
||||
# traditional SysV init
|
||||
LIST_CONSOLES=`sed -e '/^ *#/d' /etc/inittab | grep -e '\<tty[0-9]*\>' | awk -F: '{printf "%s ", $1}'`
|
||||
fi
|
||||
|
||||
# Global default font+map
|
||||
if [ -z "${HAVE_SETUPCON}" -a "${CONSOLE_FONT}" ]; then
|
||||
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up general console font"
|
||||
sfm="${FONT_MAP}" && [ "$sfm" ] && sfm="-u $sfm"
|
||||
acm="${CONSOLE_MAP}" && [ "$acm" ] && acm="-m $acm"
|
||||
|
||||
# Set for the first 6 VCs (as they are allocated in /etc/inittab)
|
||||
for vc in $LIST_CONSOLES
|
||||
do
|
||||
if ! ( unicode_start_stop $vc \
|
||||
&& setfont -C ${DEVICE_PREFIX}$vc ${SETFONT_OPT} $sfm ${CONSOLE_FONT} $acm )
|
||||
then
|
||||
[ "$VERBOSE" != "no" ] && log_action_end_msg 1
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
|
||||
fi
|
||||
|
||||
# Default to Unicode mode for new VTs?
|
||||
if [ -f /sys/module/vt/parameters/default_utf8 ]; then
|
||||
if [ -n "$UNICODE_MODE" ]; then
|
||||
echo 1
|
||||
else
|
||||
echo 0
|
||||
fi > /sys/module/vt/parameters/default_utf8
|
||||
fi
|
||||
|
||||
# Per-VC font+sfm
|
||||
PERVC_FONTS="`set | grep "^CONSOLE_FONT_vc[0-9]*=" | tr -d \' `"
|
||||
if [ -z "${HAVE_SETUPCON}" -a "${PERVC_FONTS}" ]; then
|
||||
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up per-VC fonts"
|
||||
for font in ${PERVC_FONTS}
|
||||
do
|
||||
# extract VC and FONTNAME info from variable setting
|
||||
vc=`echo $font | cut -b16- | cut -d= -f1`
|
||||
eval font=\$CONSOLE_FONT_vc$vc
|
||||
# eventually find an associated SFM
|
||||
eval sfm=\${FONT_MAP_vc${vc}}
|
||||
[ "$sfm" ] && sfm="-u $sfm"
|
||||
if ! ( unicode_start_stop $vc \
|
||||
&& setfont -C ${DEVICE_PREFIX}$vc ${SETFONT_OPT} $sfm $font )
|
||||
then
|
||||
[ "$VERBOSE" != "no" ] && log_action_end_msg 1
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
|
||||
fi
|
||||
|
||||
|
||||
# Per-VC ACMs
|
||||
PERVC_ACMS="`set | grep "^CONSOLE_MAP_vc[0-9]*=" | tr -d \' `"
|
||||
if [ -z "${HAVE_SETUPCON}" -a "${PERVC_ACMS}" ]; then
|
||||
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up per-VC ACM's"
|
||||
for acm in ${PERVC_ACMS}
|
||||
do
|
||||
# extract VC and ACM_FONTNAME info from variable setting
|
||||
vc=`echo $acm | cut -b15- | cut -d= -f1`
|
||||
eval acm=\$CONSOLE_MAP_vc$vc
|
||||
if ! setfont -C "${DEVICE_PREFIX}$vc" ${SETFONT_OPT} -m "$acm"; then
|
||||
[ "$VERBOSE" != "no" ] && log_action_end_msg 1
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
|
||||
fi
|
||||
|
||||
|
||||
# screensaver stuff
|
||||
setterm_args=""
|
||||
if [ "$BLANK_TIME" ]; then
|
||||
setterm_args="$setterm_args -blank $BLANK_TIME"
|
||||
fi
|
||||
if [ "$BLANK_DPMS" ]; then
|
||||
setterm_args="$setterm_args -powersave $BLANK_DPMS"
|
||||
fi
|
||||
if [ "$POWERDOWN_TIME" ]; then
|
||||
setterm_args="$setterm_args -powerdown $POWERDOWN_TIME"
|
||||
fi
|
||||
if [ "$setterm_args" ]; then
|
||||
setterm $setterm_args
|
||||
fi
|
||||
|
||||
# Keyboard rate and delay
|
||||
KBDRATE_ARGS=""
|
||||
if [ -n "$KEYBOARD_RATE" ]; then
|
||||
KBDRATE_ARGS="-r $KEYBOARD_RATE"
|
||||
fi
|
||||
if [ -n "$KEYBOARD_DELAY" ]; then
|
||||
KBDRATE_ARGS="$KBDRATE_ARGS -d $KEYBOARD_DELAY"
|
||||
fi
|
||||
if [ -n "$KBDRATE_ARGS" ]; then
|
||||
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting keyboard rate and delay"
|
||||
kbdrate -s $KBDRATE_ARGS
|
||||
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
|
||||
fi
|
||||
|
||||
# Inform gpm if present, of potential changes.
|
||||
if [ -f /var/run/gpm.pid ]; then
|
||||
kill -s WINCH `cat /var/run/gpm.pid` 2> /dev/null
|
||||
fi
|
||||
|
||||
# Allow user to remap keys on the console
|
||||
if [ -z "${HAVE_SETUPCON}" -a -r /etc/$PKG/remap ]; then
|
||||
dumpkeys < ${DEVICE_PREFIX}1 | sed -f /etc/$PKG/remap | loadkeys --quiet
|
||||
fi
|
||||
|
||||
# Set LEDS here
|
||||
if [ -n "$LEDS" ]; then
|
||||
for i in $LIST_CONSOLES
|
||||
do
|
||||
setleds -D $LEDS < $DEVICE_PREFIX$i
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|reload|restart|force-reload)
|
||||
if [ -n "$HAVE_SETUPCON" ]
|
||||
then
|
||||
log_action_msg "Setting console screen modes"
|
||||
else
|
||||
log_action_msg "Setting console screen modes and fonts"
|
||||
fi
|
||||
setup
|
||||
[ -z "$HAVE_SETUPCON" ] || log_action_msg "Skipping font and keymap setup (handled by console-setup)"
|
||||
;;
|
||||
stop)
|
||||
;;
|
||||
*)
|
||||
setup
|
||||
;;
|
||||
esac
|
||||
|
||||
:
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
Prevent nash-hotplug to keep running after boot using 100% of cpu
|
||||
|
||||
diff -rud mkinitrd-6.0.34-orig/nash/hotplug.c mkinitrd-6.0.34/nash/hotplug.c
|
||||
--- mkinitrd-6.0.34-orig/nash/hotplug.c 2008-03-06 21:20:34.000000000 -0300
|
||||
+++ mkinitrd-6.0.34/nash/hotplug.c 2008-03-12 18:48:46.000000000 -0300
|
||||
@@ -547,7 +547,7 @@
|
||||
nashLogger(nc, NASH_ERROR, "parent exited without telling us\n");
|
||||
close(nc->hp_childfd);
|
||||
nc->hp_childfd = -1;
|
||||
- break;
|
||||
+ exit(1);
|
||||
}
|
||||
count += rc;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Alternative boot method for other distributions than Debian 6.0
|
||||
# Place this file in a /etc/start.d/ directory and add the following
|
||||
# line to /etc/finit.conf:
|
||||
#
|
||||
# runparts /etc/start.d
|
||||
#
|
||||
# At boot finit will run all files, using its built-in run_parts(),
|
||||
# in that directory.
|
||||
#
|
||||
# Here we chain load Debian /etc/rcS.d and /etc/rc2.d directories
|
||||
# in sequence using the standard run-parts tool.
|
||||
run-parts /etc/rcS.d --arg=start
|
||||
run-parts /etc/rc2.d --arg=start
|
||||
|
||||
# You can also place other commands in this services file, akin to
|
||||
# the old finit /usr/sbin/services.sh (not supported anymore).
|
||||
#service acpid start
|
||||
#service networking start
|
||||
#service ssh start
|
||||
@@ -0,0 +1,62 @@
|
||||
HowTo: Finit on Void Linux
|
||||
==========================
|
||||
|
||||
HowTo use Finit to boot an [Void Linux][] system. It is assumed that
|
||||
the user has already installed make, a compiler, C library header files,
|
||||
and other tools needed to build a GNU configure based project.
|
||||
|
||||
To start with you need to first install [libuEv][] and [libite][]. They
|
||||
default to install to `/usr/local`, but unlike Debian and Ubuntu based
|
||||
distros, Void's `pkg-config` does not look for libraries and header
|
||||
files there. So the `PKG_CONFIG_LIBDIR` environment variable must be
|
||||
used, or change the install prefix to `/usr`.
|
||||
|
||||
The bundled [build.sh](build.sh) script can be used to configure and
|
||||
build finit:
|
||||
|
||||
void:~# cd finit
|
||||
void:~/finit# ./contrib/void/build.sh
|
||||
|
||||
Then run the [install.sh](install.sh) script to install all necessary
|
||||
files, including the sample `finit.conf` and `finit.d/*.conf` files.
|
||||
More on that below.
|
||||
|
||||
void:~/finit# ./contrib/void/install.sh
|
||||
|
||||
The install script is (supposed to be) non-destructive by default, you
|
||||
have to answer *Yes* twice to set up Finit as the system default init.
|
||||
Pay close attention to the last question:
|
||||
|
||||
*** Install Finit as the system default Init (y/N)?
|
||||
|
||||
If you answer `No`, simply by pressing enter, you can change the symlink
|
||||
yourself later on, to point to `finit` instead of `runit`:
|
||||
|
||||
void:~/finit# cd /sbin
|
||||
void:/sbin# rm init
|
||||
void:/sbin# ln -s finit init
|
||||
|
||||
Another option is to change the Grub defaults, in `/etc/default/grub`:
|
||||
|
||||
#GRUB_CMDLINE_LINUX_DEFAULT="loglevel=4 slub_debug=P page_poison=1"
|
||||
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=4 init=/sbin/finit"
|
||||
|
||||
Alternatively, you can simply modify the default Grub entry at boot, or
|
||||
set up an alternative Grub entry to include:
|
||||
|
||||
linux /boot/vmlinuz-X.YY.Z ... init=/sbin/finit
|
||||
|
||||
If you modify a Grub configuration file, remember to run:
|
||||
|
||||
update-grub
|
||||
|
||||
Before rebooting, make sure to set up a [/etc/finit.conf](finit.conf),
|
||||
and [/etc/finit.d/](finit.d/) for your services. Samples are included
|
||||
in this directory. Notice the symlinks in `/etc/finit.d/`, which can be
|
||||
managed by the operator at runtime using `initctl enable SERVICE`. You
|
||||
can also use a standard [/etc/rc.local](rc.local) for one-shot tasks and
|
||||
initialization like keyboard language etc.
|
||||
|
||||
[libuEv]: https://github.com/troglobit/libuev
|
||||
[libite]: https://github.com/troglobit/libite
|
||||
[Void Linux]: https://www.voidlinux.eu/
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
echo
|
||||
echo "*** Configuring Finit for Void Linux"
|
||||
|
||||
if [ ! -e configure ]; then
|
||||
echo " The configure script is missing, maybe you're using a version from GIT?"
|
||||
echo " Attempting to run the autogen.sh script, you will need these tools:"
|
||||
echo " autoconf, automake, libtool, pkg-config ..."
|
||||
echo
|
||||
./autogen.sh
|
||||
fi
|
||||
|
||||
# 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.
|
||||
PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig ./configure \
|
||||
--enable-rw-rootfs --enable-progress \
|
||||
--enable-dbus-plugin --enable-x11-common-plugin \
|
||||
--enable-alsa-utils-plugin --enable-inetd-echo-plugin \
|
||||
--enable-inetd-chargen-plugin --enable-inetd-daytime-plugin \
|
||||
--enable-inetd-discard-plugin --enable-inetd-time-plugin \
|
||||
--with-heading="Void Linux" --with-hostname=void
|
||||
|
||||
echo
|
||||
echo "*** Building ..."
|
||||
echo
|
||||
make
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo
|
||||
echo "*** The build failed for some reason"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "*** Done"
|
||||
echo
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# /etc/finit.conf: Example for Void Linux
|
||||
# See /etc/finit.d/*.conf and `initctl list` for other services
|
||||
|
||||
## Runlevel to start after bootstrap, runlevel 'S'
|
||||
# Default is 2
|
||||
#runlevel 2
|
||||
|
||||
## Bootstrap services and tasks
|
||||
# Can be listed here or in /etc/finit.d/*.conf
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
available/acpid.conf
|
||||
@@ -0,0 +1,3 @@
|
||||
# Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager)
|
||||
# Depends on syslogd having started. Redirect any output to log.
|
||||
service [2345] /sbin/acpid -f -- ACPI daemon
|
||||
@@ -0,0 +1 @@
|
||||
service [2345] <svc/sbin/syslogd> /usr/sbin/crond -f -S -c /etc/crontabs -- Cron daemon
|
||||
@@ -0,0 +1 @@
|
||||
service [2345] /usr/sbin/dhcpcd -B -M -- DHCP client
|
||||
@@ -0,0 +1 @@
|
||||
service [S12345] /sbin/dmeventd -f -- Device mapper event daemon
|
||||
@@ -0,0 +1,4 @@
|
||||
# Consoles to start Finit built-in getty on when system is up
|
||||
tty /dev/tty1 noclear nowait
|
||||
tty /dev/tty2 noclear nowait
|
||||
tty /dev/tty3 noclear nowait
|
||||
@@ -0,0 +1,2 @@
|
||||
# Oneshot task to run once at bootstrap
|
||||
task [S] zcat /etc/keymap/se.bmap.gz | loadkmap -- Loading keymap
|
||||
@@ -0,0 +1,2 @@
|
||||
# Start klogd as soon as possible, should always run
|
||||
service [S12345] /sbin/klogd -n -- Kernel log daemon
|
||||
@@ -0,0 +1 @@
|
||||
service [2345] /usr/sbin/lxdm -- Lightweight Login Manager
|
||||
@@ -0,0 +1,6 @@
|
||||
## Linux kernel modules to load
|
||||
#module fbcon
|
||||
module button
|
||||
module evdev
|
||||
module mousedev
|
||||
module 8139cp
|
||||
@@ -0,0 +1,2 @@
|
||||
# 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
|
||||
@@ -0,0 +1,2 @@
|
||||
# Start SSH daemon as soon as basic networking comes up
|
||||
service [2345] <net/lo/up> /usr/sbin/sshd -D -- OpenSSH daemon
|
||||
@@ -0,0 +1,2 @@
|
||||
# Start syslogd as soon as possible, should always run
|
||||
service [S12345] /sbin/syslogd -n -- Syslog daemon
|
||||
@@ -0,0 +1 @@
|
||||
service @uuidd:uuidd [2345] /sbin/uuidd -F -- UUID generation daemon
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
available/dhcpcd.conf
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
available/getty.conf
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
available/sshd.conf
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
available/uuidd.conf
|
||||
Executable
+53
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "x`id -u`" != "x0" ]; then
|
||||
echo
|
||||
echo "*** This script must run as root"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Adjust base directory
|
||||
if [ -e xbps ]; then
|
||||
cd ../..
|
||||
elif [ ! -e autogen.sh ]; then
|
||||
echo "*** Please run this script from the Finit base directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "*** Install Finit on Void Linux"
|
||||
echo "========================================================================"
|
||||
echo "/sbin/finit - PID 1"
|
||||
echo "/lib/finit/plugins/* - All enabled Finit plugins"
|
||||
echo "/etc/finit.conf - Finit configuration file"
|
||||
echo "/etc/finit.d/ - Finit services"
|
||||
echo "/etc/grub.d/40_custom - Add menu entry to the Grub boot loader"
|
||||
echo
|
||||
read -p "Do you want to continue (y/N)? " yorn
|
||||
|
||||
if [ "x$yorn" = "xy" -o "x$yorn" = "xY" ]; then
|
||||
echo
|
||||
echo "*** Installing Finit files ..."
|
||||
make install
|
||||
cd `dirname $0`
|
||||
for file in finit.conf rc.local; do
|
||||
install -vbD $file /etc/$file
|
||||
done
|
||||
cp -va finit.d /etc/
|
||||
|
||||
read -p "*** Install Finit as the system default Init (y/N)? " yorn
|
||||
if [ "x$yorn" = "xy" -o "x$yorn" = "xY" ]; then
|
||||
echo "*** Updating /sbin/init symlink --> finit ..."
|
||||
cd /sbin
|
||||
rm init
|
||||
ln -s finit init
|
||||
fi
|
||||
|
||||
echo "*** Done"
|
||||
echo
|
||||
else
|
||||
echo
|
||||
echo "*** Aborting install."
|
||||
echo
|
||||
fi
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
# This script is executed once at boot, at the very end,
|
||||
# right before starting the TTYs.
|
||||
#
|
||||
# Each line is run in sequence.
|
||||
#
|
||||
# NOTE: Remeber to set the executable bit!
|
||||
@@ -0,0 +1,44 @@
|
||||
# Contributor Code of Conduct
|
||||
|
||||
As contributors and maintainers of this project, and in the interest of
|
||||
fostering an open and welcoming community, we pledge to respect all
|
||||
people who contribute through reporting issues, posting feature
|
||||
requests, updating documentation, submitting pull requests or patches,
|
||||
and other activities.
|
||||
|
||||
We are committed to making participation in this project a
|
||||
harassment-free experience for everyone, regardless of level of
|
||||
experience, gender, gender identity and expression, sexual orientation,
|
||||
disability, personal appearance, body size, race, ethnicity, age,
|
||||
religion, or nationality.
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery
|
||||
* Personal attacks
|
||||
* Trolling or insulting/derogatory comments
|
||||
* Public or private harassment
|
||||
* Publishing other's private information, such as physical or electronic
|
||||
addresses, without explicit permission
|
||||
* Other unethical or unprofessional conduct.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit,
|
||||
or reject comments, commits, code, wiki edits, issues, and other
|
||||
contributions that are not aligned to this Code of Conduct. By adopting
|
||||
this Code of Conduct, project maintainers commit themselves to fairly
|
||||
and consistently applying these principles to every aspect of managing
|
||||
this project. Project maintainers who do not follow or enforce the Code
|
||||
of Conduct may be permanently removed from the project team.
|
||||
|
||||
This code of conduct applies both within project spaces and in public
|
||||
spaces when an individual is representing the project or its community.
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may
|
||||
be reported by opening an issue or contacting one or more of the project
|
||||
maintainers.
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][1],
|
||||
[version 1.2.0][2].
|
||||
|
||||
[1]: http://contributor-covenant.org
|
||||
[2]: http://contributor-covenant.org/version/1/2/0/
|
||||
@@ -0,0 +1,89 @@
|
||||
Contributing to Finit
|
||||
=====================
|
||||
|
||||
We welcome any and all help in the form of bug reports, fixes, patches
|
||||
for new features -- *preferably as GitHub pull requests*. Other methods
|
||||
are of course also possible: emailing the maintainer a patch or even a
|
||||
raw file, or simply emailing a feature request or an alert of a problem.
|
||||
For email questions/requests/alerts there is always the risk of memory
|
||||
exhaustion on the part of the maintainer(s).
|
||||
|
||||
If you are unsure of what to do, or how to implement an idea or bugfix,
|
||||
open an issue with `"[RFC: Unsure if this is a bug ... ?"`, or similar,
|
||||
so we can discuss it. Talking about the code first is the best way to
|
||||
get started before submitting a pull request.
|
||||
|
||||
Either way, when sending an email, patch, or pull request, start by
|
||||
stating the version the change is made against, what it does, and why.
|
||||
|
||||
Please take care to ensure you follow the project coding style and the
|
||||
commit message format. If you follow these recommendations you help
|
||||
the maintainer(s) and make it easier for them to include your code.
|
||||
|
||||
|
||||
Coding Style
|
||||
------------
|
||||
|
||||
> **Tip:** Always submit code that follows the style of surrounding code!
|
||||
|
||||
First of all, lines are allowed to be longer than 72 characters these
|
||||
days. In fact, there exist no enforced maximum, but keeping it around
|
||||
100 chars is OK.
|
||||
|
||||
The coding style itself is strictly Linux [KNF][].
|
||||
|
||||
|
||||
Commit Messages
|
||||
---------------
|
||||
|
||||
Commit messages exist to track *why* a change was made. Try to be as
|
||||
clear and concise as possible in your commit messages, and always, be
|
||||
proud of your work and set up a proper GIT identity for your commits:
|
||||
|
||||
git config --global user.name "Jane Doe"
|
||||
git config --global user.email jane.doe@example.com
|
||||
|
||||
Example commit message from the [Pro Git][gitbook] online book, notice
|
||||
how `git commit -s` is used to automatically add a `Signed-off-by`:
|
||||
|
||||
Brief, but clear and concise summary of changes
|
||||
|
||||
More detailed explanatory text, if necessary. Wrap it to about 72
|
||||
characters or so. In some contexts, the first line is treated as
|
||||
the subject of an email and the rest of the text as the body. The
|
||||
blank line separating the ummary from the body is critical (unless
|
||||
you omit the body entirely); tools like rebase can get confused if
|
||||
you run the two together.
|
||||
|
||||
Further paragraphs come after blank lines.
|
||||
|
||||
- Bullet points are okay, too
|
||||
|
||||
- Typically a hyphen or asterisk is used for the bullet, preceded
|
||||
by a single space, with blank lines in between, but conventions
|
||||
vary here
|
||||
|
||||
Signed-off-by: Jane Doe <jane.doe@example.com>
|
||||
|
||||
|
||||
Another good *counter* example [is this][rambling] ...
|
||||
|
||||
|
||||
Code of Conduct
|
||||
---------------
|
||||
|
||||
It is expected of everyone engaging in the project to, in the words of
|
||||
Bill & Ted; [be excellent to each other][conduct].
|
||||
|
||||
|
||||
[github]: https://github.com/troglobit/finit/
|
||||
[KNF]: https://en.wikipedia.org/wiki/Kernel_Normal_Form
|
||||
[gitbook]: https://git-scm.com/book/ch5-2.html
|
||||
[rambling]: http://stopwritingramblingcommitmessages.com/
|
||||
[conduct]: https://github.com/troglobit/finit/blob/master/CODE-OF-CONDUCT.md
|
||||
|
||||
<!--
|
||||
-- Local Variables:
|
||||
-- mode: markdown
|
||||
-- End:
|
||||
-->
|
||||
+31
-52
@@ -12,16 +12,18 @@ finit is to be a replacement for:
|
||||
* watchdogd
|
||||
|
||||
A small and simple replacement, primarily for embedded systems, with a
|
||||
very low dependency on external packages.
|
||||
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.
|
||||
|
||||
|
||||
General
|
||||
-------
|
||||
|
||||
* Add halt/poweroff/shutdown symlinks to finit and convert reboot, but
|
||||
only install symlinks if these tools don't already exist.
|
||||
* Step state machine at shutdown instead of killing, same as shifting to
|
||||
runlevel 0 or 6, then call external (newly installed?) tool to reboot.
|
||||
* Remove shm, let `initctl` call `api.c` for each `svc_t` instead of
|
||||
opening up the inner parts of PID 1 to other processes. Also, this
|
||||
would prevent issues like #81 from happening.
|
||||
* Add support for timed shutdown in Finit, including cancelled shutdown.
|
||||
* SysV init and systemd use SIGUSR1 to restart their FIFO/D-Bus. Add
|
||||
API restart to SIGHUP callback for the same functionality in Finit.
|
||||
@@ -30,8 +32,8 @@ General
|
||||
* 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.
|
||||
* Add `IFF_RUNNING` support to netlink plugin along `IFF_IUP`
|
||||
* Allow process callbacks to be scripts.
|
||||
* Add `IFF_RUNNING` support to netlink plugin along `IFF_UP`
|
||||
* Allow scripts, instead of C code, as process callbacks
|
||||
* Add support for a pipe/popen where we can listen for `STOP`, `START`
|
||||
and `RELOAD` on `STDOUT` from a script ... call it for example
|
||||
`.monitor=` in `svc_t` ... the script named as the basename of the
|
||||
@@ -40,7 +42,18 @@ General
|
||||
`service <SVC> stop|start|restart|reload|status` on top
|
||||
* Add support for JSON output, or similar, from `initctl show`, e.g.
|
||||
`initctl show --json`
|
||||
* Add PRE and POST hooks for when switching between runlevels
|
||||
* Improve `initctl show SVC` output. Add service uptime, last ten SVC
|
||||
logs/history (historian), etc. Similar to `systemctl show SVC`
|
||||
* [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
|
||||
|
||||
|
||||
Init
|
||||
@@ -55,11 +68,14 @@ to achieve compatibility would be to add a plugin to finit which reads
|
||||
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.
|
||||
* 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
|
||||
@@ -93,44 +109,6 @@ the shell -- that way setting up one-time jobs would not entail
|
||||
re-reading `/etc/finit.conf`
|
||||
|
||||
|
||||
Watchdog
|
||||
--------
|
||||
|
||||
Support for monitoring the health of the system and its processes.
|
||||
|
||||
* Add support for a `/dev/watchdog` built-in to replace both the BusyBox
|
||||
watchdogd and my own refreshed uClinux-dist adaptation,
|
||||
[watchdogd](https://github.com/troglobit/watchdogd)
|
||||
* Add a system supervisor (pmon) to optionally reboot the system when a
|
||||
process stops responding, or when a respawn limit has been reached, as
|
||||
well as when system load gets too high. For details on UNIX loadavg,
|
||||
see http://stackoverflow.com/questions/11987495/linux-proc-loadavg
|
||||
- Default to 0.7 as MAX recommended load before warning and 0.9 reboot
|
||||
* API for processes to register with the watchdog, libwdt
|
||||
- Deeper monitoring of a process' main loop by instrumenting
|
||||
- If a process is not heard from within its subscribed period time
|
||||
reboot system or restart process.
|
||||
- Add client libwdt library, inspired by old Westermo API and the
|
||||
[libwdt][] API published in the [Fritz!Box source dump][], take for
|
||||
instance the `fritzbox7170-source-files-04.87-tar.gz` drop and see
|
||||
the `GPL-release_kernel.tgz` in `drivers/char/avm_new/` for the
|
||||
kernel driver, and the `LGPL-GPL-release_target_tools.tgz` in `wdt/`
|
||||
for the userland API.
|
||||
- When a client process (a standard app/daemon instrumented with
|
||||
libwdt calls in its main loop) registers with the watchdog, we raise
|
||||
the RT priority to 98 (just below the kernel watchdog in prio).
|
||||
This to ensure that system monitoring goes before anything else in
|
||||
the system.
|
||||
- Use UNIX domain sockets for communication between daemon and clients
|
||||
* Separate `/etc/watchdog.conf` configuration file, or a perhaps
|
||||
support for a more generic `/etc/finit.d/PLUGIN.conf`?
|
||||
* Support enable/disable watchdog features:
|
||||
- Supervise processes,
|
||||
- CPU loadavg,
|
||||
- Watch for file descriptor leaks,
|
||||
- etc.
|
||||
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
@@ -140,8 +118,9 @@ Documentation
|
||||
how close Finit3 still is to the original easy-to-use Finit0 :)
|
||||
|
||||
|
||||
[libwdt]: http://www.wehavemorefun.de/fritzbox/Libwdt.so
|
||||
[libwdt]: http://www.wehavemorefun.de/fritzbox/Libwdt.so
|
||||
[Fritz!Box source dump]: ftp://ftp.avm.de/fritz.box/fritzbox.fon_wlan_7170/x_misc/opensrc/
|
||||
[Solaris SMF]: http://www.oracle.com/technetwork/articles/servers-storage-admin/intro-smf-basics-s11-1729181.html
|
||||
|
||||
<!--
|
||||
-- Local Variables:
|
||||
+37
-34
@@ -1,41 +1,51 @@
|
||||
Bootstrap
|
||||
=========
|
||||
|
||||
1. Populate `/dev`
|
||||
2. Parse `/etc/finit.conf`
|
||||
3. Load all `.so` plugins
|
||||
4. Remount/Pivot `/` to get R+W
|
||||
5. Call 1st level hooks, `HOOK_ROOTFS_UP`
|
||||
6. Mount `/etc/fstab` and swap, if available
|
||||
7. Cleanup stale files from `/tmp/*` et al
|
||||
8. Enable SysV init signals
|
||||
9. Call 2nd level hooks, `HOOK_BASEFS_UP`
|
||||
10. Start all 'S' runlevel tasks and services
|
||||
11. Load kernel params from `/etc/sysctl.d/*.conf`, `/etc/sysctl.conf`
|
||||
et al. (Supports all locations that SysV init does.)
|
||||
12. Set hostname and bring up loopback interface
|
||||
13. Call `network` script, if set in `/etc/finit.conf`
|
||||
14. Call 3rd level hooks, `HOOK_NETWORK_UP`
|
||||
15. Switch to the configured runlevel from `/etc/finit.conf`, default 2.
|
||||
1. Prepare emergency shell, if enabled
|
||||
2. Set up initial signal handlers
|
||||
3. Set up default $PATH early
|
||||
4. Mount `/proc` and `/sys`
|
||||
5. Check kernel command line for `--debug` to figure out log level
|
||||
6. Load all `.so` plugins
|
||||
7. Call `fsck` on file systems listed in `/etc/fstab`
|
||||
8. Populate `/dev` using either udev or mdev, depending on system type
|
||||
9. Parse `/etc/finit.conf` and all `/etc/finit.d/*.conf` files
|
||||
10. Start built-in watchdog, if enabled
|
||||
11. Set hostname
|
||||
12. Pivot root, or remount `/` read-write, depending on system type
|
||||
13. Call 1st level hooks, `HOOK_ROOTFS_UP`
|
||||
14. Mount all file systems listed in `/etc/fstab` and swap, if available
|
||||
15. Enable SysV init signals
|
||||
16. Call 2nd level hooks, `HOOK_BASEFS_UP`
|
||||
17. Cleanup stale files from `/tmp/*` et al, handled by `bootmisc` plugin
|
||||
18. Load kernel params from `/etc/sysctl.d/*.conf`, `/etc/sysctl.conf`
|
||||
et al. (Supports all locations that SysV init does.), handled by
|
||||
`procps` plugin
|
||||
19. Start all 'S' runlevel tasks and services
|
||||
20. Bring up loopback interface and all `/etc/network/interfaces`, if
|
||||
the `.conf` setting `network <SCRIPT>` is set, it is called instead
|
||||
21. Call 3rd level hooks, `HOOK_NETWORK_UP`
|
||||
22. Switch to the configured runlevel from `/etc/finit.conf`, default 2.
|
||||
At every runlevel change all `*.conf` files in `/etc/finit.d/` are
|
||||
(re)loaded and new services, tasks, and blocking run commands are
|
||||
started. Provided they are allowed in the new runlevel and all of
|
||||
their conditions, if any, are set.
|
||||
16. Call 4th level hooks, `HOOK_SVC_UP`
|
||||
17. If `runparts <DIR>` is set, [run-parts(8)][] is called on `<DIR>`
|
||||
18. Call `/etc/rc.local`, if it exists and is an executable shell script
|
||||
19. Call 5th level (last) hooks, `HOOK_SYSTEM_UP`
|
||||
20. Start TTYs defined in `/etc/finit.conf`, or rescue on `/dev/console`
|
||||
23. Call 4th level hooks, `HOOK_SVC_UP`
|
||||
24. If `runparts <DIR>` is set, [run-parts(8)][] is called on `<DIR>`
|
||||
25. Call `/etc/rc.local`, if it exists and is an executable shell script
|
||||
26. Call 5th level (last) hooks, `HOOK_SYSTEM_UP`
|
||||
27. Start all configured TTYs, or a fallback shell on `/dev/console`
|
||||
|
||||
In (10) and (15) tasks and services defined in `/etc/finit.conf` are
|
||||
started. Remember, all `service` and `task` stanzas are started in
|
||||
parallel and `run` in sequence, and in the order listed. Hence, to
|
||||
emulate a SysV `/etc/init.d/rcS` one could write a long file with only
|
||||
`run` statements.
|
||||
In (19) and (22) tasks and services defined in `/etc/finit.conf` and
|
||||
`/etc/sysctl.d/*.conf` are started. Remember, all `service` and `task`
|
||||
stanzas are started in parallel and `run` in sequence, and in the order
|
||||
listed. Hence, to emulate a SysV `/etc/init.d/rcS` one could write a
|
||||
long `finit.conf` with only `run` statements.
|
||||
|
||||
Notice the five hook points that are called at various point in the
|
||||
bootstrap process. This is where plugins can extend the boot in any way
|
||||
they please.
|
||||
they please. There are other hook points, e.g. `HOOK_MOUNT_ERROR`, for
|
||||
more on this see [plugins.md](plugins.md).
|
||||
|
||||
For instance, at `HOOK_BASEFS_UP` a plugin could read an XML file from a
|
||||
USB stick, convert/copy its contents to the system's `/etc/` directory,
|
||||
@@ -43,11 +53,4 @@ well before all 'S' runlevel tasks are started. This could be used with
|
||||
system images that are created read-only and all configuration is stored
|
||||
on external media.
|
||||
|
||||
|
||||
[run-parts(8)]: http://manpages.debian.org/cgi-bin/man.cgi?query=run-parts
|
||||
|
||||
<!--
|
||||
-- Local Variables:
|
||||
-- mode: markdown
|
||||
-- End:
|
||||
-->
|
||||
|
||||
+81
-32
@@ -1,30 +1,39 @@
|
||||
Building
|
||||
========
|
||||
|
||||
* [Introduction](#introduction)
|
||||
* [Configure](#configure)
|
||||
* [Example](#example)
|
||||
* [Running](#running)
|
||||
* [Debugging](#debugging)
|
||||
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
Finit comes with a traditional configure script to control features and
|
||||
optional plugins to enable. It does however depend on two external
|
||||
libraries that provide some frog DNA needed:
|
||||
optional plugins to enable. It depends on two external libraries:
|
||||
|
||||
- [libuEv][]
|
||||
- [libite][] (-lite)
|
||||
- [libuEv][], the event loop
|
||||
- [libite][] (-lite), much needed frog DNA
|
||||
|
||||
Like most free/open source software that uses `configure` they deafult
|
||||
to install to `/usr/local`. However, some Linux distributions do no
|
||||
longer search that path for installed software, e.g. Fedora and Alpine
|
||||
Linux. To get finit's configure script to find its dependencies you
|
||||
have to help the `pkg-config` tool a bit if you do not change the
|
||||
default prefix path:
|
||||
**NOTE:** Most free/open source software that uses `configure` default
|
||||
to install to `/usr/local`. However, some Linux distributions do no
|
||||
longer search that path for installed software, e.g. Fedora and Alpine
|
||||
Linux. To get finit's configure script to find its dependencies you
|
||||
have to help the `pkg-config` tool a bit if you do not change the
|
||||
default prefix path:
|
||||
|
||||
PKG_CONFIG_LIBDIR=/usr/local/lib/pkgconfig ./configure
|
||||
|
||||
Below are a few of the main switches to
|
||||
configure:
|
||||
|
||||
Configure
|
||||
---------
|
||||
|
||||
Below are a few of the main switches to configure:
|
||||
|
||||
* `--disable-inetd`: Disable the built-in inetd server.
|
||||
|
||||
* `--enable-embedded`: Target finit for BusyBox getty and mdev instead
|
||||
of a standard Linux distribution with GNU tools and udev.
|
||||
|
||||
* `--enable-rw-rootfs`: Most desktop and server systems boot with the
|
||||
root file stystem read-only. With this setting Finit will remount it
|
||||
as read-write early at boot so the `bootmisc.so` plugin can run.
|
||||
@@ -34,19 +43,21 @@ configure:
|
||||
built-ins (.o files) and all external libraries, except the C library
|
||||
will be linked statically.
|
||||
|
||||
* `--enable-alsa-utils`: Enable the optional `alsa-utils.so` sound plugin.
|
||||
* `--enable-alsa-utils-plugin`: Enable the optional `alsa-utils.so` sound plugin.
|
||||
|
||||
* `--enable-dbus`: Enable the optional D-Bus `dbus.so` plugin.
|
||||
* `--enable-dbus-plugin`: Enable the optional D-Bus `dbus.so` plugin.
|
||||
|
||||
* `--enable-lost`: Enable noisy example plugin for `HOOK_SVC_LOST`.
|
||||
* `--enable-lost-plugin`: Enable noisy example plugin for `HOOK_SVC_LOST`.
|
||||
|
||||
* `--enable-resolvconf`: Enable the `resolvconf.so` optional plugin.
|
||||
* `--enable-resolvconf-plugin`: Enable the `resolvconf.so` optional plugin.
|
||||
|
||||
* `--enable-x11-common`: Enable the optional X Window `x11-common.so` plugin.
|
||||
* `--enable-x11-common-plugin`: Enable the optional X Window `x11-common.so` plugin.
|
||||
|
||||
For more configure flags, see <kbd>./configure --help</kbd>
|
||||
|
||||
**Example**
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
First, unpack the archive:
|
||||
|
||||
@@ -58,7 +69,7 @@ First, unpack the archive:
|
||||
Then configure, build and install:
|
||||
|
||||
```shell
|
||||
$ ./configure --enable-embedded --enable-rw-rootfs --enable-inetd-echo-plugin \
|
||||
$ ./configure --enable-rw-rootfs --enable-inetd-echo-plugin \
|
||||
--enable-inetd-chargen-plugin --enable-inetd-daytime-plugin \
|
||||
--enable-inetd-discard-plugin --enable-inetd-time-plugin \
|
||||
--with-heading="Alpine Linux 3.4" --with-hostname=alpine
|
||||
@@ -75,10 +86,10 @@ staging directory. The environment variable `DESTDIR` controls the
|
||||
destination directory when installing, very useful for building binary
|
||||
standalone packages.
|
||||
|
||||
To target an embedded Linux system, usally a system that use BusyBox
|
||||
tools instead of udev & C:o, add <kbd>--enable-embedded</kbd> to the
|
||||
configure command above. This enables `mdev` instead of `udev` and the
|
||||
BusyBox `getty` syntax. Remember to also change the Linux config to:
|
||||
Finit 3.0 and later can detect if it runs on an embedded system, or a
|
||||
system that use BusyBox tools instead of udev & C:o. On such systems
|
||||
`mdev` instead of `udev` is used. However, remember to also change the
|
||||
Linux config to:
|
||||
|
||||
CONFIG_UEVENT_HELPER_PATH="/sbin/mdev"
|
||||
|
||||
@@ -88,12 +99,50 @@ BusyBox `getty` syntax. Remember to also change the Linux config to:
|
||||
system `/etc/fstab`.
|
||||
|
||||
|
||||
Running
|
||||
-------
|
||||
|
||||
Having successfully built Finit it is now be time to take it for a test
|
||||
drive. The `make install` attempts to set up finit as the system system
|
||||
init, `/sbin/init`, but this is usually a symlink pointing to the
|
||||
current init.
|
||||
|
||||
So either change the symlink, or change your boot loader (GRUB, LOADLIN,
|
||||
LILO, U-Boot/Barebox or RedBoot) configuration to append the following
|
||||
to the kernel command line:
|
||||
|
||||
```shell
|
||||
append="init=/sbin/finit"
|
||||
```
|
||||
|
||||
Remember to also set up an initial `/etc/finit.conf` before rebooting!
|
||||
|
||||
|
||||
Debugging
|
||||
---------
|
||||
|
||||
Add `finit_debug`, or `--debug`, to the kernel command line to enable
|
||||
debug messages.
|
||||
|
||||
```shell
|
||||
append="init=/sbin/finit --debug"
|
||||
```
|
||||
|
||||
To debug startup issues, in particular issues with getty/login, try
|
||||
`configure --enable-fallback-shell`. When no TTYs are detected, and
|
||||
Finit is configured with this option, Finit will try to start a bare
|
||||
`/bin/sh` on the boot console. Remember, this is only for debugging
|
||||
and would leave your production system potentially wide open.
|
||||
|
||||
There is also a rescue shell available, in case Finit crashes and the
|
||||
kernel usually reboots: `configure --enable-emergency-shell`. However,
|
||||
the behavior of Finit is severely limited when this is enabled, so use
|
||||
it only for debugging start up issues when Finit crashes.
|
||||
|
||||
**NOTE:** Neither of these two configure options should be enabled on
|
||||
production systems since they can potentially give a user root access.
|
||||
|
||||
|
||||
[1]: ftp://troglobit.com/finit/finit-3.0.tar.xz
|
||||
[libuEv]: https://github.com/troglobit/libuev
|
||||
[libite]: https://github.com/troglobit/libite
|
||||
|
||||
<!--
|
||||
-- Local Variables:
|
||||
-- mode: markdown
|
||||
-- End:
|
||||
-->
|
||||
|
||||
+47
-34
@@ -3,10 +3,6 @@ Finit Conditions
|
||||
|
||||

|
||||
|
||||
|
||||
Table of Contents
|
||||
-----------------
|
||||
|
||||
* [Introduction](#introduction)
|
||||
* [Triggering](#triggering)
|
||||
* [Built-in Conditions](#built-in--conditions)
|
||||
@@ -17,15 +13,22 @@ Table of Contents
|
||||
Introduction
|
||||
------------
|
||||
|
||||
In addition to declaring allowed runlevels per service, it is also
|
||||
possible to declare user-defined conditions as dependencies. Conditions
|
||||
are specified within angle brackets (<>) in the service stanza.
|
||||
Multiple conditions may be specified separated by comma. Conditions are
|
||||
AND'ed during evaluation, i.e. all conditions must be satisfied in order
|
||||
for a service to run.
|
||||
Conditions are a new addition to Finit, introduced in v3, with the
|
||||
intention of providing a mechanism for common synchronization problems.
|
||||
For example:
|
||||
|
||||
- *"do not start this service until another process has started"*, or
|
||||
- *"do not starty until basic network access is available"*
|
||||
|
||||
Conditions are similar in syntax to declaring runlevels per service.
|
||||
They are specified within angle brackets `<>` and can be applied to any
|
||||
of the `service`, `task`, or `run` stanza. Multiple conditions may be
|
||||
specified separated by comma. Multiple conditions are logically AND'ed
|
||||
during evaluation, i.e. all conditions must be satisfied in order for a
|
||||
service to run.
|
||||
|
||||
|
||||
**Example:**
|
||||
### Example
|
||||
|
||||
```shell
|
||||
service [2345] <svc/sbin/setupd,svc/sbin/zebra> /sbin/netd -- Network monitor
|
||||
@@ -34,14 +37,19 @@ for a service to run.
|
||||
In this example the Network monitor daemon `netd` is not started until
|
||||
both the `svc/sbin/setupd` *and* `svc/sbin/zebra` conditions are
|
||||
satisfied. An `svc` condition is satisfied by the corresponding
|
||||
service's pidfile being created.
|
||||
service's PID file being created.
|
||||
|
||||
**NOTE:** Conditions also stop services when a condition is no longer
|
||||
asserted. I.e., if the Zebra process above stops or restarts, netd
|
||||
will also stop or restart.
|
||||
|
||||
|
||||
Triggering
|
||||
----------
|
||||
|
||||
Conditions are triggered either by plugins or by using the `cond`
|
||||
command of the `initctl` control tool.
|
||||
Conditions are triggered by built-in plugins, but can for debugging
|
||||
purposes also be controlled using the `cond set` and `cond clear`
|
||||
sub-commands to the `initctl` control tool:
|
||||
|
||||
* `initctl cond set your/cond/here`
|
||||
|
||||
@@ -53,31 +61,33 @@ command of the `initctl` control tool.
|
||||
|
||||
Conditions retain their current state until the next reconfiguration or
|
||||
runlevel change. At that point all set conditions transition into the
|
||||
`flux` state, meaning the condition's state is unknown. (See
|
||||
[Internals](#internals) for the rationale behind this.) Thus, after a
|
||||
reconfiguration it is up to the "owner" of the condition to convey the
|
||||
new (or possibly unchanged) state of it.
|
||||
`flux` state, meaning the condition's state is unknown. (For more info
|
||||
on this, see [Internals](#internals).) Thus, after a reconfiguration it
|
||||
is up to the "owner" of the condition to convey the new (or possibly
|
||||
unchanged) state of it.
|
||||
|
||||
|
||||
Built-in Conditions
|
||||
-------------------
|
||||
|
||||
Finit is distributed with a `pidfile` and `netlink` plugin. If enabled,
|
||||
the `pidfile` plugin watches `/var/run/` for PID files created by
|
||||
the `pidfile` plugin watches `/var/run/` for PID files created by the
|
||||
monitored services, and sets a corresponding condition in the `svc/`
|
||||
namespace. Similarily, the `netlink` plugin provides basic conditions
|
||||
for when an interface is brought up/down and when a default route
|
||||
(gateway) is set.
|
||||
(gateway) is set, in the `net/` namespace.
|
||||
|
||||
With the example listed above, finit does not start the `/sbin/netd`
|
||||
daemon until `setupd` and `zebra` has started *and* created their PID
|
||||
files. Which they do when they completed their main tasks of setting up
|
||||
VLANs, bridge, interfaces, etc. When `netd` in turn starts up it
|
||||
creates the file `/var/run/netd.pid`, and the condition `svc/sbin/netd`
|
||||
is satisfied. When the file is removed, the condition is cleared.
|
||||
files. Which they do when they have completed their initial set up and
|
||||
are ready to receive signals.
|
||||
|
||||
The full path to the dependency is needed by finit to match the PID file
|
||||
to a monitored process.
|
||||
to a monitored process. Finit expects monitored services to touch their
|
||||
PID files, i.e. update the mtime, when they reload their configuration
|
||||
files after a `SIGHUP`. Some services do not support `SIGHUP` and are
|
||||
instead restarted, which is a crude but effective way to have the PID
|
||||
file touched (re-created).
|
||||
|
||||
Built-in conditions:
|
||||
|
||||
@@ -86,7 +96,9 @@ Built-in conditions:
|
||||
- `net/<IFNAME>/exist`
|
||||
- `net/<IFNAME>/up`
|
||||
|
||||
Note: `up` is administratively up, `IFF_UP`, not link up, `IFF_RUNNING`.
|
||||
**Note:** `up` means administratively up, the interface flag `IFF_UP`,
|
||||
not link up, `IFF_RUNNING`. This latter conditions is currently not
|
||||
implemented by the `plugins/netlink.c` plugin.
|
||||
|
||||
|
||||
Debugging
|
||||
@@ -127,14 +139,21 @@ Then watch the console for the debug messages and then check the output
|
||||
from `initctl cond show` again. (The client will likely have failed to
|
||||
start, but at least the condition is now satisfied.)
|
||||
|
||||
There is also the `initctl cond dump` command, which dumps all known
|
||||
conditions and their current status.
|
||||
|
||||
|
||||
Internals
|
||||
---------
|
||||
|
||||
Conditions are implemented as simple files in the file system, in the
|
||||
`/var/run/finit/cond/` sub-directory. Use the `initctl cond set/clear`
|
||||
commands to add/remove files in this hierarchy.
|
||||
|
||||
A condition is always in one of three states:
|
||||
|
||||
* `on` (+): The condition is asserted.
|
||||
* `off` (-): The condition is deasserted.
|
||||
* ` on` (+): The condition is asserted.
|
||||
* ` off` (-): The condition is deasserted.
|
||||
* `flux` (~): The conditions state is unknown.
|
||||
|
||||
All conditions that have not explicitly been set are interpreted as
|
||||
@@ -154,9 +173,3 @@ Therefore, any plugin that supplies Finit with conditions must ensure
|
||||
that their state is updated after each reconfiguration. This can be
|
||||
done by binding to the `HOOK_SVC_RECONF` hook. For an example of how
|
||||
to do this, see `plugins/pidfile.c`.
|
||||
|
||||
<!--
|
||||
-- Local Variables:
|
||||
-- mode: markdown
|
||||
-- End:
|
||||
-->
|
||||
|
||||
+136
-71
@@ -1,34 +1,49 @@
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Table of Contents
|
||||
-----------------
|
||||
* [Introduction](#introduction)
|
||||
* [Syntax](#syntax)
|
||||
* [Limitations](#limitations)
|
||||
* [/etc/finit.conf](#etcfinitconf)
|
||||
* [/etc/finit.d](#etcfinitd)
|
||||
|
||||
* [/etc/finit.conf](#etcfinitconf)
|
||||
* [/etc/finit.d](#etcfinitd)
|
||||
|
||||
/etc/finit.conf
|
||||
---------------
|
||||
Introduction
|
||||
------------
|
||||
|
||||
Contrary to most other script based init alternatives (SysV [init][],
|
||||
[upstart][], [systemd][], [OpenRC][], etc.) Finit relies on its main
|
||||
configuration file `/etc/finit.conf` and `/etc/finit.d/`.
|
||||
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.
|
||||
|
||||
The command line arguments given in `/etc/finit.conf` to each service
|
||||
provide a default. A plugin can be used to register a callback to a
|
||||
service and then modify the behavior to suit the current runlevel and
|
||||
system configuration.
|
||||
- `/etc/finit.conf`: main configuration file, read only once at boot
|
||||
- `/etc/finit.d/*.conf`: snippets, usually one service per file
|
||||
|
||||
For instance, before starting a heavily resource intensive service like
|
||||
IPsec or OpenVPN, a callback can check if the outbound interface is up
|
||||
and has an IP address, or just check if the service is disabled — much
|
||||
like what a SysV init start script usually does.
|
||||
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.
|
||||
|
||||
Syntax:
|
||||
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).
|
||||
Any service read from this directory is flagged as a dynamic service, so
|
||||
changes to or removal of `/etc/finit.d/*.conf` files, is detected.
|
||||
|
||||
* `check <DEV>`
|
||||
Run fsck on a file system. Only needed if not listed in `/etc/fstab`,
|
||||
Finit 3.0 and later check all file systems automatically at boot.
|
||||
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).
|
||||
|
||||
|
||||
Syntax
|
||||
------
|
||||
|
||||
* `module <MODULE>`
|
||||
Load a kernel module, with optional arguments
|
||||
@@ -60,11 +75,20 @@ 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. This command is guaranteed to be
|
||||
completed before running the next command.
|
||||
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
|
||||
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
|
||||
```
|
||||
|
||||
* `service [LVLS] <COND> /path/to/daemon ARGS -- Optional description`
|
||||
Service, or daemon, to be monitored and automatically restarted if it
|
||||
@@ -76,6 +100,13 @@ Syntax:
|
||||
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`.
|
||||
|
||||
For a detailed description of conditions, and how to debug them,
|
||||
see the [Finit Conditions](conditions.md) document.
|
||||
|
||||
@@ -121,19 +152,54 @@ Syntax:
|
||||
* `include <CONF>`
|
||||
Include another configuration file. Absolute path required.
|
||||
|
||||
* `tty [LVLS] <DEV> [BAUD] [TERM]`
|
||||
Start a getty on the given TTY device DEV, in the given runlevels. If
|
||||
no tty setting is given in `finit.conf` no login is possible. Use the
|
||||
`service` stanza to start a stand-alone shell for really bare bones
|
||||
systems.
|
||||
* `tty [LVLS] <DEV> [BAUD] [noclear] [nowait] [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. Default baud rate is `38400`.
|
||||
|
||||
Finit comes with a lightweight built-in getty, which after it has
|
||||
opened a TTY and the user has input a username, calls `/bin/login`
|
||||
like any other getty.
|
||||
**Example:**
|
||||
```conf
|
||||
tty [12345] /dev/ttyAMA0 115200 noclear vt220
|
||||
```
|
||||
|
||||
The second 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.
|
||||
|
||||
Notice the ordering, the `TERM` option to the built-in getty must be
|
||||
the last argument.
|
||||
|
||||
On really bare bones systems Finit offers a fallback shell:
|
||||
|
||||
```shell
|
||||
configure --enable-fallback-shell
|
||||
```
|
||||
|
||||
One can also use the `service` stanza to start a stand-alone shell:
|
||||
|
||||
```conf
|
||||
service [12345] /bin/sh -l
|
||||
```
|
||||
|
||||
* `console <DEV>`
|
||||
Use this, along with a matching `tty DEV` line, to mark this TTY as a
|
||||
special "console" port with with `prctl()`. Useful in use-cases when
|
||||
special "console" port with `prctl()`. Useful in use-cases when
|
||||
all logins except the console must be stopped, e.g. when performing a
|
||||
flash upgrade on an embedded system.
|
||||
|
||||
@@ -166,51 +232,50 @@ The `run`, `task`, `service`, or `inetd` stanzas also allow the keyword
|
||||
`log` to redirect `stderr` and `stdout` of the application to syslog,
|
||||
using `logger`.
|
||||
|
||||
Worth noting is that conditions is allowed for all these stanzas. For a
|
||||
detailed description, see the [Conditions](conditions.md) document.
|
||||
|
||||
/etc/finit.d
|
||||
------------
|
||||
|
||||
Finit supports changes to the overall system configuration at runtime.
|
||||
For this purpose the (configurable) directory `/etc/finit.d` is used.
|
||||
Here you can put configuration file snippets, one per service if you
|
||||
like, which are all sourced automatically by finit at boot when loading
|
||||
the static configuration from `/etc/finit.conf`. This is the default
|
||||
behavior, so no include directives are necessary.
|
||||
Limitations
|
||||
-----------
|
||||
|
||||
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).
|
||||
Any service read from this directory is flagged as a dynamic service, so
|
||||
changes to or removal of `/etc/finit.d/*.conf` files, is detected.
|
||||
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. The `finit.conf` file can be used for all possible settings,
|
||||
but `finit.d/*.conf` can only be used for runtime settings.
|
||||
|
||||
On `initctl reload` the following is checked for all services:
|
||||
### /etc/finit.conf
|
||||
|
||||
- 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.
|
||||
This file was the only way to set up and boot a system using Finit. It
|
||||
is used for pre-runtime settings like system hostname, network bringup
|
||||
and shutdown:
|
||||
|
||||
For more info on the different states of a service, see the separate
|
||||
document [Finit Services](service.md).
|
||||
- `host`
|
||||
- `mkdod`
|
||||
- `network`
|
||||
- `runparts`
|
||||
- `include`
|
||||
- `shtudown`
|
||||
- `runlevel`
|
||||
- ... and all configuration stanzas from `/etc/finit.d` below
|
||||
|
||||
The `/etc/finit.d` directory was previously the default Finit `runparts`
|
||||
directory. Finit no longer has a default `runparts`, so make sure to
|
||||
update your setup, or the finit configuration, accordingly.
|
||||
### /etc/finit.d
|
||||
|
||||
**Note:** Configurations read from `/etc/finit.d` are read *after*
|
||||
initial bootstrap, runlevel S(1). Hence, bootstrap services *must* be
|
||||
in `/etc/finit.conf`!
|
||||
Support for partial `.conf` files in `/etc/finit.d` was added to handle
|
||||
changes of the system configuration at runtime. It does *not support*
|
||||
the above `finit.conf` settings described above, only the following:
|
||||
|
||||
- `module`, but only in runlevel `S`
|
||||
- `service`
|
||||
- `task`
|
||||
- `run`
|
||||
- `inetd`
|
||||
- `rlimit`
|
||||
- `tty`
|
||||
- `console`
|
||||
|
||||
**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.
|
||||
|
||||
[init]: http://en.wikipedia.org/wiki/Init
|
||||
[upstart]: http://upstart.ubuntu.com/
|
||||
[systemd]: http://www.freedesktop.org/wiki/Software/systemd/
|
||||
[openrc]: http://www.gentoo.org/proj/en/base/openrc/
|
||||
[run-parts(8)]: http://manpages.debian.org/cgi-bin/man.cgi?query=run-parts
|
||||
|
||||
<!--
|
||||
-- Local Variables:
|
||||
-- mode: markdown
|
||||
-- End:
|
||||
-->
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
Distro Recommendations
|
||||
======================
|
||||
|
||||
By default Finit uses the following directories for configuration files:
|
||||
|
||||
```
|
||||
/etc/
|
||||
|-- finit.d/ -- Regular (enabled) services
|
||||
| |-- lighttpd.conf
|
||||
| `- *.conf
|
||||
|-- finit.conf -- Bootstrap tasks and services
|
||||
:
|
||||
```
|
||||
|
||||
To enable a service one simply drops a small configuration file in the
|
||||
`/etc/finit.d/` directory. This practice works will with systems that
|
||||
keep disabled services elsewhere, or generates them as needed from some
|
||||
other tool.
|
||||
|
||||
Disitributions, however, may want a clearer separation of enabled and
|
||||
available (installed but not enabled) services. They may even want to
|
||||
customize the directories used, for brand labling or uniformity.
|
||||
|
||||
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
|
||||
configuration in this sub-directory enables the service, but it will not
|
||||
be started.
|
||||
|
||||
To change the default configuration directory and configuration file
|
||||
names the Finit `configure` script offers the following two options at
|
||||
build time:
|
||||
|
||||
```sh
|
||||
./configure --with-rcsd=/etc/init.d --with-config=/etc/init.d/init.conf
|
||||
```
|
||||
|
||||
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/init.d/init.conf`:
|
||||
|
||||
```
|
||||
/etc/
|
||||
|-- init.d/
|
||||
| |-- available/ -- Regular (disabled) services
|
||||
| | |-- httpd.conf
|
||||
| | |-- ntpd.conf
|
||||
| | `-- sshd.conf
|
||||
| |-- sshd.conf -- Symlink to available/sshd.conf
|
||||
| `- init.conf -- Bootstrap tasks and services
|
||||
:
|
||||
```
|
||||
|
||||
To facilitate the task of managing configurations, be it a service,
|
||||
task, run, or other stanza, the `initctl` tool has a a few built-in
|
||||
commands:
|
||||
|
||||
```
|
||||
list List all .conf in /etc/finit.d/
|
||||
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/ (activates changes)
|
||||
```
|
||||
|
||||
To enable a service like `sshd.conf`, above, use
|
||||
|
||||
initctl enable sshd
|
||||
|
||||
The `.conf` suffix is not needed, `initctl` adds it implicitly if it is
|
||||
missing. The `disable` command works in a similar fashion.
|
||||
|
||||
Note, however, that `initctl` only operates on symlinks and it always
|
||||
requires the `available/` sub-directory. Any non-symlink in the parent
|
||||
directory, here `/etc/init.d/`, will be considered a system override by
|
||||
`initctl`.
|
||||
|
||||
@@ -123,9 +123,3 @@ some NTP implementations), year 2036!
|
||||
|
||||
|
||||
[TCP Wrappers]: https://en.wikipedia.org/wiki/TCP_Wrapper
|
||||
|
||||
<!--
|
||||
-- Local Variables:
|
||||
-- mode: markdown
|
||||
-- End:
|
||||
-->
|
||||
|
||||
+6
-7
@@ -1,6 +1,12 @@
|
||||
Hooks & Plugins
|
||||
===============
|
||||
|
||||
* [Plugins](#plugins)
|
||||
* [Hooks](#hooks)
|
||||
* [Bootstrap Hooks](#bootstrap-hooks)
|
||||
* [Runtime Hooks](#runtime-hooks)
|
||||
* [Shutdown Hooks](#shutdown-hooks)
|
||||
|
||||
Finit can be extended to add general functionality in the form of I/O
|
||||
monitors, built-in inetd services, or hook plugins.
|
||||
|
||||
@@ -123,10 +129,3 @@ Plugins like `initctl.so` and `tty.so` extend finit by acting on events,
|
||||
they are called I/O plugins and are called from the finit main loop when
|
||||
`poll()` detects an event. See the source code for `plugins/*.c` for
|
||||
more help and ideas.
|
||||
|
||||
|
||||
<!--
|
||||
-- Local Variables:
|
||||
-- mode: markdown
|
||||
-- End:
|
||||
-->
|
||||
|
||||
+4
-9
@@ -14,8 +14,9 @@ state.
|
||||
The current state depends on the two following conditions:
|
||||
|
||||
* `E`: Service enabled. In order for `E` to be satisfied, the service
|
||||
must be allowed to run in the current runlevel and must not be
|
||||
blocked. A service may be blocked for several reasons:
|
||||
must be allowed to run in the current runlevel and not be stopped.
|
||||
|
||||
A service may be stopped, or blocked, for several reasons:
|
||||
|
||||
- The user has manually stopped the service using `initctl stop JOB`
|
||||
- The program exits immediately. I.e. keeps crashing (make sure to use
|
||||
@@ -26,13 +27,7 @@ The current state depends on the two following conditions:
|
||||
|
||||
- `on` (+): The condition is asserted.
|
||||
- `off` (-): The condition is deasserted.
|
||||
- `flux` (~): The conditions state is unknown.
|
||||
- `flux` (~): The condition state is unknown.
|
||||
|
||||
For a detailed description of conditions, and how to debug them,
|
||||
see the [Finit Conditions](conditions.md) document.
|
||||
|
||||
<!--
|
||||
-- Local Variables:
|
||||
-- mode: markdown
|
||||
-- End:
|
||||
-->
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
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: 11 KiB |
@@ -0,0 +1,7 @@
|
||||
_______ __ _____ ___ __ ___________ _______
|
||||
/" "||" \ (\" \|" \ |" \(" _ ")/" __ )
|
||||
(: ______)|| | |.\\ \ | || |)__/ \\__/(__/ _) ./
|
||||
\/ | |: | |: \. \\ | |: | \\_ / / //
|
||||
// ___) |. | |. \ \. | |. | |. | __ \_ \\
|
||||
(: ( /\ |\| \ \ | /\ |\ \: | (: \__) :\
|
||||
\__/ (__\_|_)\___|\____\)(__\_|_) \__| \_______)
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.6 KiB |
@@ -30,6 +30,7 @@ Optional Plugins:])
|
||||
fi])
|
||||
if test "x$enable_plugin" = "xyes"; then
|
||||
AC_DEFINE([HAVE_]PLUGGY[_PLUGIN], 1, [Define to 1 if the $1 plugin is enabled.])
|
||||
plugins="$1 $plugins"
|
||||
fi
|
||||
AM_CONDITIONAL([BUILD_]PLUGGY[_PLUGIN], test "x$enable_plugin" = "xyes")
|
||||
enable_pluggy="$enable_plugin"])
|
||||
|
||||
+6
-4
@@ -1,4 +1,6 @@
|
||||
/*.la
|
||||
/*.lo
|
||||
/.deps/*
|
||||
/.libs/*
|
||||
*.la
|
||||
*.lo
|
||||
.deps/*
|
||||
.libs/*
|
||||
Makefile
|
||||
Makefile.in
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user