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 |
+16
-16
@@ -2,34 +2,34 @@
|
|||||||
*.o
|
*.o
|
||||||
*.so
|
*.so
|
||||||
*.gz
|
*.gz
|
||||||
*.map
|
GPATH
|
||||||
configure
|
GRTAGS
|
||||||
Makefile
|
GSYMS
|
||||||
Makefile.in
|
GTAGS
|
||||||
/.deps/*
|
|
||||||
/.libs/*
|
# GNU configure and build system
|
||||||
/finit
|
|
||||||
/initctl
|
|
||||||
/reboot
|
|
||||||
/config.h
|
|
||||||
/config.mk
|
|
||||||
/GPATH
|
|
||||||
/GRTAGS
|
|
||||||
/GSYMS
|
|
||||||
/GTAGS
|
|
||||||
/autom4te.cache/*
|
/autom4te.cache/*
|
||||||
/aclocal.m4
|
/aclocal.m4
|
||||||
/ar-lib
|
/ar-lib
|
||||||
/compile
|
/compile
|
||||||
|
/config.h
|
||||||
|
/config.mk
|
||||||
/config.guess
|
/config.guess
|
||||||
/config.h.in
|
/config.h.in
|
||||||
/config.log
|
/config.log
|
||||||
/config.status
|
/config.status
|
||||||
/config.sub
|
/config.sub
|
||||||
|
/configure
|
||||||
/depcomp
|
/depcomp
|
||||||
/install-sh
|
/install-sh
|
||||||
/libtool
|
/libtool
|
||||||
/ltmain.sh
|
/ltmain.sh
|
||||||
|
|
||||||
/missing
|
/missing
|
||||||
|
/Makefile
|
||||||
|
/Makefile.in
|
||||||
/stamp-h1
|
/stamp-h1
|
||||||
|
|
||||||
|
# TroglOS build system
|
||||||
|
/.config
|
||||||
|
/.stamp
|
||||||
|
/.unpacked
|
||||||
|
|||||||
+3
-3
@@ -34,11 +34,11 @@ addons:
|
|||||||
|
|
||||||
install:
|
install:
|
||||||
- wget https://github.com/troglobit/libuev/releases/download/v1.5.2/libuev-1.5.2.tar.xz
|
- 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.8.2/libite-1.8.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 libuev-1.5.2.tar.xz
|
||||||
- tar xf libite-1.8.2.tar.xz
|
- tar xf libite-1.9.2.tar.xz
|
||||||
- (cd libuev-1.5.2 && ./configure --prefix=/tmp && make && make install-strip)
|
- (cd libuev-1.5.2 && ./configure --prefix=/tmp && make && make install-strip)
|
||||||
- (cd libite-1.8.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
|
# Custom build script for the time being, no "make test" yet
|
||||||
script:
|
script:
|
||||||
|
|||||||
+92
-7
@@ -3,14 +3,67 @@ Change Log
|
|||||||
|
|
||||||
All relevant changes are documented in this file.
|
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
|
### 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 service states based on user defined conditions
|
||||||
* Manage dependencies between services, w/ conditions (pidfile plugin)
|
* 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
|
* Support for dynamically reloading Finit configuration at runtime
|
||||||
* Refactor to use GNU configure and build system
|
* Refactor to use GNU configure and build system
|
||||||
* New hooks for for detecting lost and started services (lost plugin)
|
* 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
|
* Add simple built-in getty
|
||||||
* Greatly improved accounting support, both UTMP and WTMP fixes+features
|
* Greatly improved accounting support, both UTMP and WTMP fixes+features
|
||||||
* Improved udev support, on non-embedded systems
|
* Improved udev support, on non-embedded systems
|
||||||
* Improvide shutdown and file-system unmount support (Debian)
|
* Improved shutdown and file-system unmount support (Debian)
|
||||||
* Added `--enable-emergency-shell` (configure) fallback debug mode
|
|
||||||
* Support SysV init `/etc/rc.local`
|
* Support SysV init `/etc/rc.local`
|
||||||
* Inetd protection against UDP looping attacks
|
* Inetd protection against UDP looping attacks
|
||||||
* Support systems with `/run` instead of `/var/run` (bootmisc plugin)
|
* 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 OpenRC-like support for sysctl.d/*.conf
|
||||||
* Add support for Debian/BusyBox `/etc/network/interfaces`
|
* Add support for Debian/BusyBox `/etc/network/interfaces`
|
||||||
* Add support for running fsck on file systems in `/etc/fstab`
|
* 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
|
[2.4][] - 2015-12-04
|
||||||
@@ -514,7 +598,8 @@ Major bug fix release.
|
|||||||
|
|
||||||
* Initial 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.4]: https://github.com/troglobit/finit/compare/2.3...2.4
|
||||||
[2.3]: https://github.com/troglobit/finit/compare/2.2...2.3
|
[2.3]: https://github.com/troglobit/finit/compare/2.2...2.3
|
||||||
[2.2]: https://github.com/troglobit/finit/compare/2.1...2.2
|
[2.2]: https://github.com/troglobit/finit/compare/2.1...2.2
|
||||||
|
|||||||
+5
-99
@@ -1,105 +1,11 @@
|
|||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
sbin_PROGRAMS = finit initctl reboot
|
SUBDIRS = plugins src
|
||||||
finit_SOURCES = api.c \
|
doc_DATA = README.md LICENSE contrib/finit.conf
|
||||||
cond.c cond-w.c cond.h \
|
EXTRA_DIST = README.md LICENSE ChangeLog.md contrib/finit.conf
|
||||||
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 \
|
|
||||||
util.c util.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
|
|
||||||
if WATCHDOGD
|
|
||||||
finit_SOURCES += watchdog.c watchdog.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 \
|
|
||||||
util.c util.h utmp-api.c utmp-api.h
|
|
||||||
initctl_CFLAGS = $(lite_CFLAGS)
|
|
||||||
initctl_LDADD = $(lite_LIBS)
|
|
||||||
|
|
||||||
reboot_SOURCES = reboot.c util.c util.h
|
|
||||||
|
|
||||||
INIT_LNKS = telinit init
|
|
||||||
REBOOT_LNKS = shutdown halt poweroff 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
|
|
||||||
|
|
||||||
# Compat hook
|
# Compat hook
|
||||||
install-dev: install-pkgincludeHEADERS
|
install-dev:
|
||||||
|
@make -C src 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 install."; \
|
|
||||||
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
|
|
||||||
|
|
||||||
# Target to run when building a release
|
# Target to run when building a release
|
||||||
release: dist
|
release: dist
|
||||||
|
|||||||
@@ -1,99 +1,141 @@
|
|||||||
<p align="center"><img src="images/finit3.png" alt="Finit: Fast Init" /></p>
|
<img align="right" src="images/finit3.png" alt="Finit: Fast Init">
|
||||||
|
|
||||||
Table of Contents
|
|
||||||
-----------------
|
|
||||||
[![Travis Status]][Travis] [![Coverity Status]][Coverity Scan]
|
|
||||||
|
|
||||||
* [Introduction](#introduction)
|
* [Introduction](#introduction)
|
||||||
* [Features](#features)
|
* [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)
|
* [Bootstrap](doc/bootstrap.md#bootstrap)
|
||||||
* [Runlevels](#runlevels)
|
* [Runlevels](#runlevels)
|
||||||
* [Inetd](doc/inetd.md#inetd)
|
* [Syntax](doc/config.md#syntax)
|
||||||
* [Hooks, Callbacks & Plugins](doc/plugins.md#hooks-callbacks--plugins)
|
* [Inetd](doc/inetd.md#inetd)
|
||||||
|
* [Runparts & /etc/rc.local](#runparts--etcrclocal)
|
||||||
|
* [Hooks, Callbacks & Plugins](doc/plugins.md#hooks-callbacks--plugins)
|
||||||
* [Rebooting & Halting](#rebooting--halting)
|
* [Rebooting & Halting](#rebooting--halting)
|
||||||
* [Commands & Status](#commands--status)
|
* [Commands & Status](#commands--status)
|
||||||
* [Building](doc/build.md#building)
|
* [Building](doc/build.md#building)
|
||||||
|
* [Running](doc/build.md#running)
|
||||||
|
* [Debugging](doc/build.md#debugging)
|
||||||
* [Requirements](#requirements)
|
* [Requirements](#requirements)
|
||||||
* [Running](#running)
|
|
||||||
* [Debugging](#debugging)
|
|
||||||
* [Origin & References](#origin--references)
|
* [Origin & References](#origin--references)
|
||||||
|
|
||||||
|
|
||||||
Introduction
|
Introduction
|
||||||
------------
|
------------
|
||||||
|
[![License Badge][]][License] [![Travis Status]][Travis] [![Coverity Status]][Coverity Scan]
|
||||||
|
|
||||||
Finit is an EeePC Fastinit inspired clone with [process supervision][1]
|
Finit is a simple alternative to [SysV init][4] and [systemd][6]. It
|
||||||
similar to that of D.J. Bernstein's [daemontools][2] and Gerrit Pape's
|
was reverse engineered from the [EeePC fastinit][] ten years ago by
|
||||||
[runit][3]. It also supports free-form conditions based on events, e.g.
|
[Claudio Matsuoka][] — "gaps filled with frog DNA …"
|
||||||
triggering on PID file creation, Netlink events like a default route or
|
|
||||||
interfaces coming up, or even custom events. Similar to [systemd][6].
|
|
||||||
|
|
||||||
Finit focuses on small and embedded Linux systems, although fully usable
|
Focus is on small and embedded systems, although Finit is fully usable
|
||||||
on servers and desktops as well. See the [contrib section](contrib/)
|
on server and desktop systems as well. For working examples, see the
|
||||||
for Debian and Alpine Linux examples.
|
[contrib/](contrib/) section where both [Debian](contrib/debian/) and
|
||||||
|
up to date [Alpine Linux](contrib/alpine/) tutorials can be found.
|
||||||
|
|
||||||
Traditional [SysV init][4] style systems are scripted. For low-resource
|

|
||||||
embedded systems this is quite resource intensive and often leads to
|
The screenshot shows [Alpine Linux](https://www.alpinelinux.org/).
|
||||||
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.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
**Example /etc/finit.conf:**
|
Example
|
||||||
|
-------
|
||||||
|
|
||||||
```
|
This example `/etc/finit.conf` can also be split up in multiple `.conf`
|
||||||
# Fallback if /etc/hostname is missing
|
files in `/etc/finit.d`. Available, but not yet enabled, services can
|
||||||
host wopr
|
be placed in `/etc/finit.d/available` and enabled by an operator using
|
||||||
|
the [initctl](#commands--status) tool.
|
||||||
|
|
||||||
# Runlevel to start after bootstrap, runlevel 'S'
|
```ApacheConf
|
||||||
runlevel 2
|
# Fallback if /etc/hostname is missing
|
||||||
|
host default
|
||||||
|
|
||||||
# Services to be monitored and respawned as needed
|
# Runlevel to start after bootstrap, 'S', default: 2
|
||||||
service [S12345] /sbin/watchdogd -L -f -- System watchdog daemon
|
runlevel 2
|
||||||
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
|
# Services to be monitored and respawned as needed
|
||||||
# the service/run/task keyword and the command.
|
service [S12345] /sbin/watchdogd -L -f -- System watchdog daemon
|
||||||
service :1 [2345] /sbin/merecat -n -p 80 /var/www -- Web server
|
service [S12345] /sbin/syslogd -n -b 3 -D -- System log daemon
|
||||||
service :2 [2345] /sbin/merecat -n -p 8080 /var/www -- Old web server
|
service [S12345] /sbin/klogd -n -- Kernel log daemon
|
||||||
|
service [2345] /sbin/lldpd -d -c -M1 -H0 -i -- LLDP daemon (IEEE 802.1ab)
|
||||||
|
|
||||||
# Alternative method instead of below runparts, can also use /etc/rc.local
|
# For multiple instances of the same service, add :ID somewhere between
|
||||||
#task [S] /etc/init.d/keyboard-setup start -- Setting up preliminary keymap
|
# the service/run/task keyword and the command.
|
||||||
#task [S] /etc/init.d/acpid start -- Starting ACPI Daemon
|
service :1 [2345] /sbin/merecat -n -p 80 /var/www -- Web server
|
||||||
#task [S] /etc/init.d/kbd start -- Preparing console
|
service :2 [2345] /sbin/merecat -n -p 8080 /var/www -- Old web server
|
||||||
|
|
||||||
# Inetd services to start on demand, with alternate ports and filtering
|
# Alternative method instead of below runparts, can also use /etc/rc.local
|
||||||
inetd ftp/tcp nowait [2345] /sbin/uftpd -i -f -- FTP daemon
|
#task [S] /etc/init.d/keyboard-setup start -- Setting up preliminary keymap
|
||||||
inetd tftp/udp wait [2345] /sbin/uftpd -i -y -- TFTP daemon
|
#task [S] /etc/init.d/acpid start -- Starting ACPI Daemon
|
||||||
inetd time/udp wait [2345] internal -- UNIX rdate service
|
#task [S] /etc/init.d/kbd start -- Preparing console
|
||||||
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
|
# Inetd services to start on demand, with alternate ports and filtering
|
||||||
# runparts /etc/start.d
|
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
|
||||||
|
|
||||||
# Virtual consoles to start built-in getty on
|
# Run start scripts from this directory
|
||||||
tty [12345] /dev/tty1 115200 linux
|
# runparts /etc/start.d
|
||||||
tty [12345] /dev/ttyAMA0 115200 vt100
|
|
||||||
|
# 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
|
The `service` stanza, as well as `task`, `run`, `inetd` and others are
|
||||||
a look at the `contrib/` section with [Alpine Linux](contrib/alpine/),
|
described in full in [doc/config.md](doc/config.md). Here's a quick
|
||||||
[Debian](contrib/debian/), support and more.
|
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
|
Features
|
||||||
@@ -103,6 +145,7 @@ Features
|
|||||||
|
|
||||||
Start, monitor and restart services should they fail.
|
Start, monitor and restart services should they fail.
|
||||||
|
|
||||||
|
|
||||||
**Inetd**
|
**Inetd**
|
||||||
|
|
||||||
Finit comes with a built-in [inetd server](doc/inetd.md). No need to
|
Finit comes with a built-in [inetd server](doc/inetd.md). No need to
|
||||||
@@ -114,23 +157,30 @@ interface, reducing the need for a full blown firewall.
|
|||||||
|
|
||||||
Built-in optional inetd services:
|
Built-in optional inetd services:
|
||||||
|
|
||||||
- echo RFC862
|
- echo [RFC862][]
|
||||||
- chargen RFC864
|
- chargen [RFC864][]
|
||||||
- daytime RFC867
|
- daytime [RFC867][]
|
||||||
- discard RFC863
|
- discard [RFC863][]
|
||||||
- time (rdate) RFC868
|
- time (rdate) [RFC868][]
|
||||||
|
|
||||||
For more information, see [doc/inetd.md](doc/inetd.md).
|
For more information, see [doc/inetd.md](doc/inetd.md).
|
||||||
|
|
||||||
|
|
||||||
**Getty**
|
**Getty**
|
||||||
|
|
||||||
Finit also comes with a built-in Getty for Linux console TTYs. It can
|
Finit supports external getty but also comes with a limited built-in
|
||||||
parse `/etc/inittab` and set the speed. Then `/bin/login` handles all
|
Getty, useful for really small systems. A getty sets up the TTY and
|
||||||
nasty bits with PAM etc.
|
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**
|
||||||
|
|
||||||
@@ -177,7 +227,7 @@ calls its built-in [run-parts(8)][] on the `runparts <DIR>` directory,
|
|||||||
and `/etc/rc.local`, in that order if they exist.
|
and `/etc/rc.local`, in that order if they exist.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
runparts /etc/rc.d/
|
runparts /etc/rc.d/
|
||||||
```
|
```
|
||||||
|
|
||||||
No configuration stanza in `/etc/finit.conf` is required for `rc.local`.
|
No configuration stanza in `/etc/finit.conf` is required for `rc.local`.
|
||||||
@@ -205,16 +255,17 @@ To specify an allowed set of runlevels for a `service`, `run` command,
|
|||||||
`task`, or `tty`, add `[NNN]` to your `/etc/finit.conf`, like this:
|
`task`, or `tty`, add `[NNN]` to your `/etc/finit.conf`, like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
service [S12345] /sbin/syslogd -n -x -- System log daemon
|
service [S12345] /sbin/syslogd -n -x -- System log daemon
|
||||||
run [S] /etc/init.d/acpid start -- Starting ACPI Daemon
|
run [S] /etc/init.d/acpid start -- Starting ACPI Daemon
|
||||||
task [S] /etc/init.d/kbd start -- Preparing console
|
task [S] /etc/init.d/kbd start -- Preparing console
|
||||||
service [S12345] /sbin/klogd -n -x -- Kernel log daemon
|
service [S12345] /sbin/klogd -n -x -- Kernel log daemon
|
||||||
tty [12345] /dev/tty1
|
|
||||||
tty [2] /dev/tty2
|
tty [12345] /dev/tty1
|
||||||
tty [2] /dev/tty3
|
tty [2] /dev/tty2
|
||||||
tty [2] /dev/tty4
|
tty [2] /dev/tty3
|
||||||
tty [2] /dev/tty5
|
tty [2] /dev/tty4
|
||||||
tty [2] /dev/tty6
|
tty [2] /dev/tty5
|
||||||
|
tty [2] /dev/tty6
|
||||||
```
|
```
|
||||||
|
|
||||||
In this example syslogd is first started, in parallel, and then acpid is
|
In this example syslogd is first started, in parallel, and then acpid is
|
||||||
@@ -226,16 +277,27 @@ service.
|
|||||||
|
|
||||||
Again, tasks and services are started in parallel, while run commands
|
Again, tasks and services are started in parallel, while run commands
|
||||||
are called in the order listed and subsequent commands are not started
|
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
|
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
|
argument, e.g. <kbd>init 5</kbd>, or using `initctl runlevel 5`, both
|
||||||
runlevels Finit also automatically reloads all `.conf` files in the
|
switch to runlevel 5. When changing runlevels Finit also automatically
|
||||||
`/etc/finit.d/` directory. So if you want to set a new system config,
|
reloads all `.conf` files in the `/etc/finit.d/` directory. So if you
|
||||||
switch to runlevel 1, change all config files in the system, and touch
|
want to set a new system config, switch to runlevel 1, change all config
|
||||||
all `.conf` files in `/etc/finit.d` before switching back to the
|
files in the system, and touch all `.conf` files in `/etc/finit.d`
|
||||||
previous runlevel again — that way Finit can both stop old services and
|
before switching back to the previous runlevel again — that way Finit
|
||||||
start any new ones for you, without rebooting the system.
|
can both stop old services and start any new ones for you, without
|
||||||
|
rebooting the system.
|
||||||
|
|
||||||
|
|
||||||
Rebooting & Halting
|
Rebooting & Halting
|
||||||
@@ -256,21 +318,23 @@ Finit also listens to the classic SysV init FIFO, used by `telinit`.
|
|||||||
Support for this is implemented by the `initctl.so` plugin. Hence,
|
Support for this is implemented by the `initctl.so` plugin. Hence,
|
||||||
`telinit q` will work as the UNIX beards intended.
|
`telinit q` will work as the UNIX beards intended.
|
||||||
|
|
||||||
~ # telinit -h
|
```shell
|
||||||
Usage: telinit [OPTIONS] [q | Q | 0-9]
|
~ # telinit -h
|
||||||
|
Usage: telinit [OPTIONS] [q | Q | 0-9]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-h, --help This help text
|
-h, --help This help text
|
||||||
-V, --version Show Finit version
|
-V, --version Show Finit version
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
0 Power-off the system, same as initctl poweroff
|
0 Power-off the system, same as initctl poweroff
|
||||||
6 Reboot the system, same as initctl reboot
|
6 Reboot the system, same as initctl reboot
|
||||||
2, 3, 4, 5 Change runlevel. Starts services in new runlevel, stops any
|
2, 3, 4, 5 Change runlevel. Starts services in new runlevel, stops any
|
||||||
services in prev. runlevel that are not allowed in new.
|
services in prev. runlevel that are not allowed in new.
|
||||||
q, Q Reload *.conf in /etc/finit.d/, same as initctl reload or
|
q, Q Reload *.conf in /etc/finit.d/, same as initctl reload or
|
||||||
sending SIGHUP to PID 1
|
sending SIGHUP to PID 1
|
||||||
1, s, S Enter system rescue mode, runlevel 1
|
1, s, S Enter system rescue mode, runlevel 1
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
Commands & Status
|
Commands & Status
|
||||||
@@ -280,29 +344,31 @@ Finit also implements a more modern API to query status, and start/stop
|
|||||||
services, called `initctl`. Unlike `telinit` the `initctl` tool does
|
services, called `initctl`. Unlike `telinit` the `initctl` tool does
|
||||||
not return until the given command has fully completed.
|
not return until the given command has fully completed.
|
||||||
|
|
||||||
~ $ initctl -h
|
```shell
|
||||||
Usage: initctl [OPTIONS] <COMMAND>
|
~ $ initctl -h
|
||||||
|
Usage: initctl [OPTIONS] <COMMAND>
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-d, --debug Debug initctl (client)
|
-d, --debug Debug initctl (client)
|
||||||
-v, --verbose Verbose output
|
-v, --verbose Verbose output
|
||||||
-h, --help This help text
|
-h, --help This help text
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
debug Toggle Finit (daemon) debug
|
debug Toggle Finit (daemon) debug
|
||||||
help This help text
|
help This help text
|
||||||
reload Reload *.conf in /etc/finit.d/ and activate changes
|
reload Reload *.conf in /etc/finit.d/ and activate changes
|
||||||
runlevel [0-9] Show or set runlevel: 0 halt, 6 reboot
|
runlevel [0-9] Show or set runlevel: 0 halt, 6 reboot
|
||||||
status | show Show status of services
|
status | show Show status of services
|
||||||
cond set <COND> Set (assert) condition => +COND
|
cond set <COND> Set (assert) condition => +COND
|
||||||
cond clear <COND> Clear (deassert) condition => -COND
|
cond clear <COND> Clear (deassert) condition => -COND
|
||||||
cond flux <COND> Emulate flux condition => ~COND
|
cond show Show condition status
|
||||||
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
|
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
|
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
|
restart <JOB|NAME>[:ID] Restart (stop/start) service by job# or name
|
||||||
reload <JOB|NAME>[:ID] Reload (SIGHUP) service by job# or name
|
reload <JOB|NAME>[:ID] Reload (SIGHUP) service by job# or name
|
||||||
version Show Finit version
|
version Show Finit version
|
||||||
|
```
|
||||||
|
|
||||||
For services *not* supporting `SIGHUP` the `<!>` notation in the .conf
|
For services *not* supporting `SIGHUP` the `<!>` notation in the .conf
|
||||||
file must be used to tell Finit to stop and start it on `reload` and
|
file must be used to tell Finit to stop and start it on `reload` and
|
||||||
@@ -314,17 +380,18 @@ the current runlevel these services will not be respawned automatically
|
|||||||
by Finit if they exit (crash). Hence, if the runlevel is 2, the below
|
by Finit if they exit (crash). Hence, if the runlevel is 2, the below
|
||||||
Dropbear SSH service will not be restarted if it is killed or exits.
|
Dropbear SSH service will not be restarted if it is killed or exits.
|
||||||
|
|
||||||
~ $ initctl status -v
|
```shell
|
||||||
1 running 476 [S12345] /sbin/watchdog -T 16 -t 2 -F /dev/watchdog
|
~ $ initctl status -v
|
||||||
2 running 477 [S12345] /sbin/syslogd -n -b 3 -D
|
1 running 476 [S12345] /sbin/watchdog -T 16 -t 2 -F /dev/watchdog
|
||||||
3 running 478 [S12345] /sbin/klogd -n
|
2 running 477 [S12345] /sbin/syslogd -n -b 3 -D
|
||||||
4:1 inetd 0 [2345] internal time allow *:37
|
3 running 478 [S12345] /sbin/klogd -n
|
||||||
4:2 inetd 0 [2345] internal time allow *:37
|
4:1 inetd 0 [2345] internal time allow *:37,!eth0
|
||||||
4:3 inetd 0 [2345] internal 3737 allow *:3737
|
4:2 inetd 0 [2345] internal time allow eth0:3737
|
||||||
5:1 inetd 0 [2345] /sbin/telnetd allow *:23 deny eth0,eth1
|
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
|
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:1 inetd 0 [345] /sbin/dropbear allow eth0:222
|
||||||
6:2 inetd 0 [345] /sbin/dropbear allow *:22 deny eth0
|
6:2 inetd 0 [345] /sbin/dropbear allow *:22 deny eth0
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
@@ -341,7 +408,9 @@ 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
|
done slightly differently and on systems with udev you might want to add
|
||||||
the following one-shot task early in your `/etc/finit.conf`:
|
the following one-shot task early in your `/etc/finit.conf`:
|
||||||
|
|
||||||
run [S] /sbin/udevadm settle --timeout=120 -- Waiting for udev
|
```conf
|
||||||
|
run [S] /sbin/udevadm settle --timeout=120 -- Waiting for udev
|
||||||
|
```
|
||||||
|
|
||||||
Finit has a built-in Getty for TTYs, but requires a working `/bin/login`
|
Finit has a built-in Getty for TTYs, but requires a working `/bin/login`
|
||||||
or `/bin/sh`, if no TTYs are configured in `/etc/finit.conf`.
|
or `/bin/sh`, if no TTYs are configured in `/etc/finit.conf`.
|
||||||
@@ -353,43 +422,6 @@ The built-in Inetd requires `/etc/services` and `/etc/protocols` to work
|
|||||||
with port names rather than numbers.
|
with port names rather than numbers.
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
|
|
||||||
Origin & References
|
Origin & References
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
@@ -409,19 +441,24 @@ and proposed extensions.
|
|||||||
[5]: http://en.wikipedia.org/wiki/Runlevel
|
[5]: http://en.wikipedia.org/wiki/Runlevel
|
||||||
[6]: https://www.freedesktop.org/wiki/Software/systemd/
|
[6]: https://www.freedesktop.org/wiki/Software/systemd/
|
||||||
[9]: https://github.com/troglobit/troglos
|
[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
|
[run-parts(8)]: http://manpages.debian.org/cgi-bin/man.cgi?query=run-parts
|
||||||
[original finit]: http://helllabs.org/finit/
|
[original finit]: http://helllabs.org/finit/
|
||||||
[EeePC fastinit]: http://wiki.eeeuser.com/boot_process:the_boot_process
|
[EeePC fastinit]: http://wiki.eeeuser.com/boot_process:the_boot_process
|
||||||
[Claudio Matsuoka]: https://github.com/cmatsuoka
|
[Claudio Matsuoka]: https://github.com/cmatsuoka
|
||||||
[Joachim Nilsson]: http://troglobit.com
|
[Joachim Nilsson]: http://troglobit.com
|
||||||
[GitHub]: https://github.com/troglobit/finit
|
[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]: https://travis-ci.org/troglobit/finit
|
||||||
[Travis Status]: https://travis-ci.org/troglobit/finit.png?branch=master
|
[Travis Status]: https://travis-ci.org/troglobit/finit.png?branch=master
|
||||||
[Coverity Scan]: https://scan.coverity.com/projects/3545
|
[Coverity Scan]: https://scan.coverity.com/projects/3545
|
||||||
[Coverity Status]: https://scan.coverity.com/projects/3545/badge.svg
|
[Coverity Status]: https://scan.coverity.com/projects/3545/badge.svg
|
||||||
|
|
||||||
<!--
|
|
||||||
-- 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)
|
|
||||||
+84
-46
@@ -1,10 +1,10 @@
|
|||||||
AC_INIT(Finit, 3.0-rc2, 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_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz subdir-objects])
|
||||||
AM_SILENT_RULES([yes])
|
AM_SILENT_RULES([yes])
|
||||||
|
|
||||||
AC_CONFIG_SRCDIR([finit.c])
|
AC_CONFIG_SRCDIR([src/finit.c])
|
||||||
AC_CONFIG_HEADER([config.h])
|
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()
|
# Older versions of autoconf (<2.58) do not have AC_CONFIG_MACRO_DIR()
|
||||||
#m4_include([m4/plugin.m4])
|
#m4_include([m4/plugin.m4])
|
||||||
@@ -24,8 +24,8 @@ AC_PROG_INSTALL
|
|||||||
|
|
||||||
# Configuration.
|
# Configuration.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_CHECK_HEADERS(fstaby.h)
|
AC_CHECK_HEADERS([fstaby.h termios.h])
|
||||||
AC_CHECK_FUNCS(strstr getopt getfsenty)
|
AC_CHECK_FUNCS([strstr getopt getfsenty])
|
||||||
|
|
||||||
# Check for uint[8,16,32]_t
|
# Check for uint[8,16,32]_t
|
||||||
AC_TYPE_UINT8_T
|
AC_TYPE_UINT8_T
|
||||||
@@ -34,30 +34,37 @@ AC_TYPE_UINT32_T
|
|||||||
|
|
||||||
# Check for required libraries
|
# Check for required libraries
|
||||||
PKG_CHECK_MODULES([uev], [libuev >= 1.5.2])
|
PKG_CHECK_MODULES([uev], [libuev >= 1.5.2])
|
||||||
PKG_CHECK_MODULES([lite], [libite >= 1.8.2])
|
PKG_CHECK_MODULES([lite], [libite >= 1.9.2])
|
||||||
|
|
||||||
# Check for configured Finit features
|
# Check for configured Finit features
|
||||||
AC_ARG_ENABLE(emergency_shell,
|
AC_ARG_ENABLE(emergency_shell,
|
||||||
AS_HELP_STRING([--enable-emergency-shell], [Experimental emergency fallback at boot.
|
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,
|
AC_ARG_ENABLE(fallback_shell,
|
||||||
AS_HELP_STRING([--enable-fallback-shell], [Start a shell if no TTYs can start.]))
|
AS_HELP_STRING([--enable-fallback-shell], [Start a shell if no TTYs can start]),,[
|
||||||
|
enable_fallback_shell=no])
|
||||||
|
|
||||||
AC_ARG_ENABLE(rw-rootfs,
|
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,
|
AC_ARG_ENABLE(progress,
|
||||||
AS_HELP_STRING([--enable-silent], [Completely silent operation, not even boot messages]))
|
AS_HELP_STRING([--enable-progress], [Pre Finit v3 bootup progress and heading]),,[
|
||||||
|
enable_progress=no])
|
||||||
|
|
||||||
AC_ARG_ENABLE(watchdog,
|
AC_ARG_ENABLE(watchdog,
|
||||||
AS_HELP_STRING([--enable-watchdog], [Enable built-in watchdog, uses /dev/watchdog]))
|
AS_HELP_STRING([--enable-watchdog], [Enable built-in watchdog, uses /dev/watchdog]),,[
|
||||||
|
enable_watchdog=no])
|
||||||
|
|
||||||
AC_ARG_ENABLE(inetd,
|
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,
|
AC_ARG_ENABLE(logrotate,
|
||||||
AS_HELP_STRING([--disable-quiet], [Default Finit obeys the kernel quiet option]))
|
AS_HELP_STRING([--disable-logrotate], [Disable built-in rotation of /var/log/wtmp, default enabled]),,[
|
||||||
|
enable_logrotate=yes])
|
||||||
|
|
||||||
# Check for extra plugins to enable
|
# Check for extra plugins to enable
|
||||||
enable_all_plugins=auto
|
enable_all_plugins=auto
|
||||||
@@ -80,7 +87,7 @@ AC_ARG_WITH(heading,
|
|||||||
|
|
||||||
AC_ARG_WITH(fifo,
|
AC_ARG_WITH(fifo,
|
||||||
AS_HELP_STRING([--with-fifo=FIFO], [FIFO for init/telinit clients, default /var/run/initctl]),
|
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,
|
AC_ARG_WITH(plugindir,
|
||||||
AS_HELP_STRING([--with-plugindir=DIR], [Finit plugin directory, default /lib/finit/plugins]),
|
AS_HELP_STRING([--with-plugindir=DIR], [Finit plugin directory, default /lib/finit/plugins]),
|
||||||
@@ -103,10 +110,6 @@ AC_ARG_WITH(console,
|
|||||||
AS_HELP_STRING([--with-console=DEV], [Console to use, default: /dev/console]),
|
AS_HELP_STRING([--with-console=DEV], [Console to use, default: /dev/console]),
|
||||||
[console=$withval], [console=/dev/console])
|
[console=$withval], [console=/dev/console])
|
||||||
|
|
||||||
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,
|
AC_ARG_WITH(hostname,
|
||||||
AS_HELP_STRING([--with-hostname=NAME], [If /etc/hostname is missing, default: noname]),
|
AS_HELP_STRING([--with-hostname=NAME], [If /etc/hostname is missing, default: noname]),
|
||||||
[hostname=$withval], [hostname=noname])
|
[hostname=$withval], [hostname=noname])
|
||||||
@@ -132,48 +135,46 @@ AS_IF([test "x$enable_fallback_shell" = "xyes"], [
|
|||||||
AS_IF([test "x$enable_rw_rootfs" = "xyes"], [
|
AS_IF([test "x$enable_rw_rootfs" = "xyes"], [
|
||||||
AC_DEFINE(REMOUNT_ROOTFS, 1, [Remount / as rw at boot])])
|
AC_DEFINE(REMOUNT_ROOTFS, 1, [Remount / as rw at boot])])
|
||||||
|
|
||||||
AS_IF([test "x$enable_silent" = "xyes"], [
|
AS_IF([test "x$enable_progress" = "xyes"], [
|
||||||
AC_DEFINE(SILENT_MODE, 1, [Completely silent operation, not even boot messages])
|
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"], [
|
AS_IF([test "x$enable_watchdog" = "xyes"], [
|
||||||
AC_DEFINE(BUILTIN_WATCHDOG, 1, [Enable built-in watchdog, kicks on /dev/watchdog])])
|
AC_DEFINE(BUILTIN_WATCHDOG, 1, [Enable built-in watchdog, kicks on /dev/watchdog])])
|
||||||
|
|
||||||
### Disable features ###########################################################################
|
### Disable features ###########################################################################
|
||||||
AS_IF([test "x$enable_inetd" != "xno"],
|
AS_IF([test "x$enable_inetd" != "xno"], [
|
||||||
enable_inetd="yes", [
|
enable_inetd="yes"
|
||||||
AC_DEFINE(INETD_DISABLED, 1, [Disable built-in inetd])])
|
AC_DEFINE(INETD_ENABLED, 1, [Enable built-in inetd])])
|
||||||
|
|
||||||
AS_IF([test "x$enable_quiet" != "xno"], [
|
AS_IF([test "x$enable_logrotate" != "xno"], [
|
||||||
AC_DEFINE(QUIET_MODE, 1, [Silent, after initial boot, no stopping/starting messages. Default: 1])
|
AC_DEFINE(LOGROTATE_ENABLED, 1, [Enable built-in rotation of /var/log/wtmp et al.])])
|
||||||
], [
|
|
||||||
AC_DEFINE(QUIET_MODE, 0, [Silent, after initial boot, no stopping/starting messages. Default: 1])])
|
|
||||||
|
|
||||||
### With features ##############################################################################
|
### With features ##############################################################################
|
||||||
AS_IF([test "x$with_fifo" != "xno"], [
|
AS_IF([test "x$with_fifo" != "xno"], [
|
||||||
AS_IF([test "x$fifo" = "xyes"], [
|
AS_IF([test "x$fifo" = "xyes"], [
|
||||||
fifo='/var/run/initctl'])])
|
fifo='$localstatedir/run/initctl'])])
|
||||||
AC_EXPAND_DIR(lurvig, "$fifo")
|
AC_EXPAND_DIR(fifo_path, "$fifo")
|
||||||
AC_DEFINE_UNQUOTED(FINIT_FIFO, "$lurvig", [FIFO for old style init/telinit client programs])
|
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$with_config" != "xno"], [
|
||||||
AS_IF([test "x$config" = "xyes"], [
|
AS_IF([test "x$config" = "xyes"], [
|
||||||
conf=$sysconfdir/finit.conf])])
|
conf=$sysconfdir/finit.conf])])
|
||||||
AC_EXPAND_DIR(lurvig, "$conf")
|
AC_EXPAND_DIR(conf_path, "$conf")
|
||||||
AC_DEFINE_UNQUOTED(FINIT_CONF, "$lurvig", [Main Finit configuration file, default /etc/finit.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$with_rcsd" != "xno"], [
|
||||||
AS_IF([test "x$rcsd" = "xyes"], [
|
AS_IF([test "x$rcsd" = "xyes"], [
|
||||||
rcsd=$sysconfdir/finit.d])])
|
rcsd=$sysconfdir/finit.d])])
|
||||||
AC_EXPAND_DIR(lurvig, "$rcsd")
|
AC_EXPAND_DIR(rcsd_path, "$rcsd")
|
||||||
AC_DEFINE_UNQUOTED(FINIT_RCSD, "$lurvig", [Finit rcS.d/, default /etc/finit.d])
|
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$with_rc_local" != "xno"], [
|
||||||
AS_IF([test "x$rclocal" = "xyes"], [
|
AS_IF([test "x$rclocal" = "xyes"], [
|
||||||
rclocal=$sysconfdir/rc.local])])
|
rclocal=$sysconfdir/rc.local])])
|
||||||
AC_EXPAND_DIR(lurvig, "$rclocal")
|
AC_EXPAND_DIR(rclocal_path, "$rclocal")
|
||||||
AC_DEFINE_UNQUOTED(FINIT_RC_LOCAL, "$lurvig", [Compat SysV /etc/rc.local file to run last at boot.])
|
AC_DEFINE_UNQUOTED(FINIT_RC_LOCAL, "$rclocal_path", [Compat SysV /etc/rc.local file to run last at boot.])
|
||||||
|
|
||||||
AS_IF([test "x$with_heading" != "xno"], [
|
AS_IF([test "x$with_heading" != "xno"], [
|
||||||
AS_IF([test "x$heading" = "xyes"], [
|
AS_IF([test "x$heading" = "xyes"], [
|
||||||
@@ -185,11 +186,6 @@ AS_IF([test "x$with_console" != "xno"], [
|
|||||||
console=/dev/console])])
|
console=/dev/console])])
|
||||||
AC_DEFINE_UNQUOTED(CONSOLE, "$console", [Default console to use])
|
AC_DEFINE_UNQUOTED(CONSOLE, "$console", [Default console to use])
|
||||||
|
|
||||||
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$with_hostname" != "xno"], [
|
||||||
AS_IF([test "x$hostname" = "xyes"], [
|
AS_IF([test "x$hostname" = "xyes"], [
|
||||||
hostname=noname])])
|
hostname=noname])])
|
||||||
@@ -203,8 +199,8 @@ AS_IF([test "x$with_runlevel" != "xno"], [
|
|||||||
AS_IF([test "x$with_random_seed" != "xno"], [
|
AS_IF([test "x$with_random_seed" != "xno"], [
|
||||||
AS_IF([test "x$random_seed" = "xyes"], [
|
AS_IF([test "x$random_seed" = "xyes"], [
|
||||||
random_seed=/var/lib/misc/random-seed])
|
random_seed=/var/lib/misc/random-seed])
|
||||||
AC_EXPAND_DIR(lurvig, "$random_seed")
|
AC_EXPAND_DIR(random_path, "$random_seed")
|
||||||
AC_DEFINE_UNQUOTED(RANDOMSEED, "$lurvig", [Improve random at boot by seeding it with sth from before.])])
|
AC_DEFINE_UNQUOTED(RANDOMSEED, "$random_path", [Improve random at boot by seeding it with sth from before.])])
|
||||||
|
|
||||||
# Control build with automake flags
|
# Control build with automake flags
|
||||||
AM_CONDITIONAL(STATIC, [test "x$enable_static" = "xyes"])
|
AM_CONDITIONAL(STATIC, [test "x$enable_static" = "xyes"])
|
||||||
@@ -213,3 +209,45 @@ AM_CONDITIONAL(WATCHDOGD, [test "x$enable_watchdog" = "xyes"])
|
|||||||
|
|
||||||
# Generate all files
|
# Generate all files
|
||||||
AC_OUTPUT
|
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
|
HowTo use Finit to boot an [Alpine Linux][] system. It is assumed that
|
||||||
that the user has already installed a compiler, C library header files,
|
the user has already installed make, a compiler, C library header files,
|
||||||
and other tools needed to build a GNU configure based project.
|
and other tools needed to build a GNU configure based project.
|
||||||
|
|
||||||
To start with you need to first install [libuEv][] and [libite][], by
|
To start with you need to first install [libuEv][] and [libite][]. They
|
||||||
default they install to `/usr/local` and Alpine's `pkg-config` does not
|
default to install to `/usr/local`, but unlike Debian and Ubuntu based
|
||||||
look for libraries and header files there. So the `PKG_CONFIG_LIBDIR`
|
distros, Alpine's `pkg-config` does not look for libraries and header
|
||||||
environment variable has to be used:
|
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 \
|
The bundled [build.sh](build.sh) script can be used to configure and
|
||||||
--enable-rw-rootfs --enable-x11-common-plugin \
|
build finit:
|
||||||
--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 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:~/finit# ./contrib/alpine/install.sh
|
||||||
Alpine is hard coded to use it. So you have to change the symlink
|
|
||||||
yourself to point to `finit` instead of `/bin/busybox`.
|
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:~/finit# cd /sbin
|
||||||
alpine:/sbin# rm init
|
alpine:/sbin# rm init
|
||||||
alpine:/sbin# ln -s finit init
|
alpine:/sbin# ln -s finit init
|
||||||
|
|
||||||
Before rebooting, make sure to set up a [/etc/finit.conf](finit.conf),
|
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
|
and [/etc/finit.d/](finit.d/) for your services. Samples are included
|
||||||
initialization like keyboard language etc. You can use the files in
|
in this directory. Notice the symlinks in `/etc/finit.d/`, which can be
|
||||||
this directory as templates -- check them both if they need to be
|
managed by the operator at runtime using `initctl enable SERVICE`. You
|
||||||
tweaked for your installation, you may not run Dropbear SSH or speak
|
can also use a standard [/etc/rc.local](rc.local) for one-shot tasks and
|
||||||
Swedish ...
|
initialization like keyboard language etc.
|
||||||
|
|
||||||
[libuEv]: https://github.com/troglobit/libuev
|
[libuEv]: https://github.com/troglobit/libuev
|
||||||
[libite]: https://github.com/troglobit/libite
|
[libite]: https://github.com/troglobit/libite
|
||||||
|
[Alpine Linux]: https://www.alpinelinux.org/
|
||||||
<!--
|
|
||||||
-- Local Variables:
|
|
||||||
-- mode: markdown
|
|
||||||
-- End:
|
|
||||||
-->
|
|
||||||
|
|||||||
@@ -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
|
## Runlevel to start after bootstrap, runlevel 'S'
|
||||||
#module qxl
|
# Default is 2
|
||||||
#module fbcon
|
#runlevel 2
|
||||||
module button
|
|
||||||
module evdev
|
|
||||||
|
|
||||||
# Runlevel to start after bootstrap, runlevel 'S'
|
## Bootstrap services and tasks
|
||||||
runlevel 2
|
# 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
|
#!/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
|
HowTo use Finit to boot a Debian GNU/Linux system. It is assumed that
|
||||||
assumed that the user has already installed a compiler, C library header
|
the user has already installed a compiler, C library header files, and
|
||||||
files, and other tools needed to build a GNU configure based project.
|
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.
|
root@debian:~# apt install build-essential
|
||||||
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.
|
|
||||||
|
|
||||||
Like the [Alpine HowTo](../alpine/), you need to install [libuEv][] and
|
Like the [Alpine HowTo](../alpine/), you need to install [libuEv][] and
|
||||||
[libite][], but since this is Debian — which takes infinite care of its
|
[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!™
|
> With Debian everything just works!™
|
||||||
|
|
||||||
The following build and install script can be used to configure, build,
|
... just make sure to install the following, so `ifup` and other basic
|
||||||
install and set up your system to run Finit:
|
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
|
The following script can then be used to configure, build, install and
|
||||||
another entry in your GRUB config, in `/etc/grub.d/40_custom`, where
|
set up your system to run Finit:
|
||||||
`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.
|
|
||||||
|
|
||||||
Before rebooting, read up on [/etc/finit.conf](finit.conf) and notice
|
user@debian:~/finit$ contrib/debian/build.sh
|
||||||
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.
|
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!
|
Have fun!
|
||||||
/Joachim ツ
|
/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
|
[libuEv]: https://github.com/troglobit/libuev
|
||||||
[libite]: https://github.com/troglobit/libite
|
[libite]: https://github.com/troglobit/libite
|
||||||
|
|
||||||
<!--
|
|
||||||
-- Local Variables:
|
|
||||||
-- mode: markdown
|
|
||||||
-- End:
|
|
||||||
-->
|
|
||||||
|
|||||||
+13
-9
@@ -11,24 +11,28 @@ echo
|
|||||||
echo "*** Configuring Finit for Debian"
|
echo "*** Configuring Finit for Debian"
|
||||||
|
|
||||||
if [ ! -e configure ]; then
|
if [ ! -e configure ]; then
|
||||||
echo " The configure script is missing, maybe you're using a GIT checkout?"
|
echo " The configure script is missing, maybe you're using a version from GIT?"
|
||||||
echo " Attempting to run the autogen.sh script, you need these tools:"
|
echo " Attempting to run the autogen.sh script, you will need these tools:"
|
||||||
echo " autoconf, automake, libtool, pkg-config ..."
|
echo " autoconf, automake, libtool, pkg-config ..."
|
||||||
echo
|
echo
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
|
|
||||||
./configure --enable-rw-rootfs --enable-dbus-plugin --enable-x11-common-plugin \
|
# The plugins are optional, but you may need D-Bus and X11 if you want
|
||||||
--enable-alsa-utils-plugin --with-random-seed=/var/lib/urandom/random-seed \
|
# to run X-Window, the other configure flags are however required.
|
||||||
--with-heading="Debian GNU/Linux 8.5" --with-hostname=jessie \
|
./configure \
|
||||||
--enable-inetd-echo-plugin --enable-inetd-chargen-plugin \
|
--enable-rw-rootfs --enable-progress \
|
||||||
--enable-inetd-daytime-plugin --enable-inetd-discard-plugin \
|
--enable-dbus-plugin --enable-x11-common-plugin \
|
||||||
--enable-inetd-time-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
|
if [ $? -ne 0 ]; then
|
||||||
echo
|
echo
|
||||||
echo "*** Configure script failed, have you installed libuEV and libite?"
|
echo "*** Configure script failed, have you installed libuEv and libite?"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,60 +1,10 @@
|
|||||||
# /etc/finit.conf: Example for Debian GNU/Linux 8.5
|
# /etc/finit.conf: Example for Debian GNU/Linux
|
||||||
# Here we use one big (?) finit.conf, but all non-bootstrap services
|
# See /etc/finit.d/*.conf and `initctl list` for other services
|
||||||
# can just as easily be listed in a separate /etc/finit.d/*.conf
|
|
||||||
|
|
||||||
# The host directive is a fallback if /etc/hostname is missing
|
## Runlevel to start after bootstrap, runlevel 'S'
|
||||||
host jessie
|
# Default is 2
|
||||||
|
#runlevel 2
|
||||||
|
|
||||||
# The user directive is only for the startx directive, which in turn is
|
## Bootstrap services and tasks
|
||||||
# just like a service but with a different user. Services can also run
|
# Can be listed here or in /etc/finit.d/*.conf
|
||||||
# with a different user, using the @username syntax
|
|
||||||
user root
|
|
||||||
|
|
||||||
# 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
|
#!/bin/sh
|
||||||
|
|
||||||
SYMLINKS="start.d/*"
|
|
||||||
FILES="finit.conf"
|
|
||||||
|
|
||||||
if [ "x`id -u`" != "x0" ]; then
|
if [ "x`id -u`" != "x0" ]; then
|
||||||
echo
|
echo
|
||||||
echo "=> Unfortunately this script must run as root (sudo) <="
|
echo "=> Unfortunately this script must run as root (sudo) <="
|
||||||
@@ -14,19 +11,18 @@ fi
|
|||||||
grep -q Debian os-release 2>/dev/null
|
grep -q Debian os-release 2>/dev/null
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
cd ../..
|
cd ../..
|
||||||
elif [ ! -e finit.c ]; then
|
elif [ ! -e autogen.sh ]; then
|
||||||
echo "Please run this script from the Finit base directory."
|
echo "*** Please run this script from the Finit base directory."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Install Finit on Debian 8 (jessie)"
|
echo
|
||||||
|
echo "*** Install Finit on Debian GNU/Linux"
|
||||||
echo "========================================================================"
|
echo "========================================================================"
|
||||||
echo "/sbin/finit - PID 1"
|
echo "/sbin/finit - PID 1"
|
||||||
echo "/lib/finit/plugins/* - All enabled Finit plugins"
|
echo "/lib/finit/plugins/* - All enabled Finit plugins"
|
||||||
echo "/etc/finit.conf - Instead of units or /etc/init.d Finit can have"
|
echo "/etc/finit.conf - Finit configuration file"
|
||||||
echo " one config for your system. Or you can split"
|
echo "/etc/finit.d/ - Finit services"
|
||||||
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/grub.d/40_custom - Add menu entry to the Grub boot loader"
|
echo "/etc/grub.d/40_custom - Add menu entry to the Grub boot loader"
|
||||||
echo
|
echo
|
||||||
read -p "Do you want to continue (y/N)? " yorn
|
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 ..."
|
echo "Installing Finit files ..."
|
||||||
make install
|
make install
|
||||||
cd `dirname $0`
|
cd `dirname $0`
|
||||||
mkdir -p /etc/start.d
|
install -vbD finit.conf /etc/finit.conf
|
||||||
for file in $FILES; do
|
cp -va finit.d /etc/
|
||||||
install -vbD $file /etc/$file
|
|
||||||
done
|
echo "*** Setting up a GRUB boot entry ..."
|
||||||
for link in $SYMLINKS; do
|
|
||||||
cp -va $link /etc/$link
|
|
||||||
done
|
|
||||||
echo "Setting up a GRUB boot entry ..."
|
|
||||||
MENU=`grep gnu-linux /boot/grub/grub.cfg |head -1 |sed "s/menuentry '\([^']*\).*/\1/"`
|
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/"`
|
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/'`
|
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/'`
|
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
|
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
|
update-grub
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "*** Done"
|
||||||
|
echo
|
||||||
else
|
else
|
||||||
echo "Aborting install."
|
echo
|
||||||
|
echo "*** Aborting install."
|
||||||
|
echo
|
||||||
fi
|
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
|
# Sample finit.conf to demonstrate the syntax
|
||||||
#
|
#
|
||||||
user admin
|
|
||||||
host testbed
|
host testbed
|
||||||
|
|
||||||
# Devices to fsck at boot
|
# 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:
|
||||||
|
-->
|
||||||
+23
-9
@@ -12,14 +12,18 @@ finit is to be a replacement for:
|
|||||||
* watchdogd
|
* watchdogd
|
||||||
|
|
||||||
A small and simple replacement, primarily for embedded systems, with a
|
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
|
General
|
||||||
-------
|
-------
|
||||||
|
|
||||||
* Add halt/poweroff/shutdown symlinks to finit and convert reboot, but
|
* Remove shm, let `initctl` call `api.c` for each `svc_t` instead of
|
||||||
only install symlinks if these tools don't already exist.
|
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.
|
* Add support for timed shutdown in Finit, including cancelled shutdown.
|
||||||
* SysV init and systemd use SIGUSR1 to restart their FIFO/D-Bus. Add
|
* SysV init and systemd use SIGUSR1 to restart their FIFO/D-Bus. Add
|
||||||
API restart to SIGHUP callback for the same functionality in Finit.
|
API restart to SIGHUP callback for the same functionality in Finit.
|
||||||
@@ -28,8 +32,8 @@ General
|
|||||||
* Add `finit.conf` support for ctrl-alt-delete (SIGINT) and kbrequest,
|
* Add `finit.conf` support for ctrl-alt-delete (SIGINT) and kbrequest,
|
||||||
i.e. KeyboardSignal, (SIGWINCH) behavior. Using conditions to a task,
|
i.e. KeyboardSignal, (SIGWINCH) behavior. Using conditions to a task,
|
||||||
e.g, <sys/key/ctrlaltdel> and <sys/key/signal> like SIGPWR handling.
|
e.g, <sys/key/ctrlaltdel> and <sys/key/signal> like SIGPWR handling.
|
||||||
* Add `IFF_RUNNING` support to netlink plugin along `IFF_IUP`
|
* Add `IFF_RUNNING` support to netlink plugin along `IFF_UP`
|
||||||
* Allow process callbacks to be scripts.
|
* Allow scripts, instead of C code, as process callbacks
|
||||||
* Add support for a pipe/popen where we can listen for `STOP`, `START`
|
* Add support for a pipe/popen where we can listen for `STOP`, `START`
|
||||||
and `RELOAD` on `STDOUT` from a script ... call it for example
|
and `RELOAD` on `STDOUT` from a script ... call it for example
|
||||||
`.monitor=` in `svc_t` ... the script named as the basename of the
|
`.monitor=` in `svc_t` ... the script named as the basename of the
|
||||||
@@ -38,9 +42,18 @@ General
|
|||||||
`service <SVC> stop|start|restart|reload|status` on top
|
`service <SVC> stop|start|restart|reload|status` on top
|
||||||
* Add support for JSON output, or similar, from `initctl show`, e.g.
|
* Add support for JSON output, or similar, from `initctl show`, e.g.
|
||||||
`initctl show --json`
|
`initctl show --json`
|
||||||
* Improve output of `initctl show SVC`, list service uptime, last
|
* Improve `initctl show SVC` output. Add service uptime, last ten SVC
|
||||||
ten relevant logs, etc. Similar to `systemctl show SVC`
|
logs/history (historian), etc. Similar to `systemctl show SVC`
|
||||||
* Add PRE and POST hooks for when switching between runlevels
|
* [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
|
Init
|
||||||
@@ -105,8 +118,9 @@ Documentation
|
|||||||
how close Finit3 still is to the original easy-to-use Finit0 :)
|
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/
|
[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:
|
-- Local Variables:
|
||||||
+37
-34
@@ -1,41 +1,51 @@
|
|||||||
Bootstrap
|
Bootstrap
|
||||||
=========
|
=========
|
||||||
|
|
||||||
1. Populate `/dev`
|
1. Prepare emergency shell, if enabled
|
||||||
2. Parse `/etc/finit.conf`
|
2. Set up initial signal handlers
|
||||||
3. Load all `.so` plugins
|
3. Set up default $PATH early
|
||||||
4. Remount/Pivot `/` to get R+W
|
4. Mount `/proc` and `/sys`
|
||||||
5. Call 1st level hooks, `HOOK_ROOTFS_UP`
|
5. Check kernel command line for `--debug` to figure out log level
|
||||||
6. Mount `/etc/fstab` and swap, if available
|
6. Load all `.so` plugins
|
||||||
7. Cleanup stale files from `/tmp/*` et al
|
7. Call `fsck` on file systems listed in `/etc/fstab`
|
||||||
8. Enable SysV init signals
|
8. Populate `/dev` using either udev or mdev, depending on system type
|
||||||
9. Call 2nd level hooks, `HOOK_BASEFS_UP`
|
9. Parse `/etc/finit.conf` and all `/etc/finit.d/*.conf` files
|
||||||
10. Start all 'S' runlevel tasks and services
|
10. Start built-in watchdog, if enabled
|
||||||
11. Load kernel params from `/etc/sysctl.d/*.conf`, `/etc/sysctl.conf`
|
11. Set hostname
|
||||||
et al. (Supports all locations that SysV init does.)
|
12. Pivot root, or remount `/` read-write, depending on system type
|
||||||
12. Set hostname and bring up loopback interface
|
13. Call 1st level hooks, `HOOK_ROOTFS_UP`
|
||||||
13. Call `network` script, if set in `/etc/finit.conf`
|
14. Mount all file systems listed in `/etc/fstab` and swap, if available
|
||||||
14. Call 3rd level hooks, `HOOK_NETWORK_UP`
|
15. Enable SysV init signals
|
||||||
15. Switch to the configured runlevel from `/etc/finit.conf`, default 2.
|
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
|
At every runlevel change all `*.conf` files in `/etc/finit.d/` are
|
||||||
(re)loaded and new services, tasks, and blocking run commands are
|
(re)loaded and new services, tasks, and blocking run commands are
|
||||||
started. Provided they are allowed in the new runlevel and all of
|
started. Provided they are allowed in the new runlevel and all of
|
||||||
their conditions, if any, are set.
|
their conditions, if any, are set.
|
||||||
16. Call 4th level hooks, `HOOK_SVC_UP`
|
23. Call 4th level hooks, `HOOK_SVC_UP`
|
||||||
17. If `runparts <DIR>` is set, [run-parts(8)][] is called on `<DIR>`
|
24. 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
|
25. Call `/etc/rc.local`, if it exists and is an executable shell script
|
||||||
19. Call 5th level (last) hooks, `HOOK_SYSTEM_UP`
|
26. Call 5th level (last) hooks, `HOOK_SYSTEM_UP`
|
||||||
20. Start TTYs defined in `/etc/finit.conf`, or rescue on `/dev/console`
|
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
|
In (19) and (22) tasks and services defined in `/etc/finit.conf` and
|
||||||
started. Remember, all `service` and `task` stanzas are started in
|
`/etc/sysctl.d/*.conf` are started. Remember, all `service` and `task`
|
||||||
parallel and `run` in sequence, and in the order listed. Hence, to
|
stanzas are started in parallel and `run` in sequence, and in the order
|
||||||
emulate a SysV `/etc/init.d/rcS` one could write a long file with only
|
listed. Hence, to emulate a SysV `/etc/init.d/rcS` one could write a
|
||||||
`run` statements.
|
long `finit.conf` with only `run` statements.
|
||||||
|
|
||||||
Notice the five hook points that are called at various point in the
|
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
|
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
|
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,
|
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
|
system images that are created read-only and all configuration is stored
|
||||||
on external media.
|
on external media.
|
||||||
|
|
||||||
|
|
||||||
[run-parts(8)]: http://manpages.debian.org/cgi-bin/man.cgi?query=run-parts
|
[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
|
Building
|
||||||
========
|
========
|
||||||
|
|
||||||
|
* [Introduction](#introduction)
|
||||||
|
* [Configure](#configure)
|
||||||
|
* [Example](#example)
|
||||||
|
* [Running](#running)
|
||||||
|
* [Debugging](#debugging)
|
||||||
|
|
||||||
|
|
||||||
|
Introduction
|
||||||
|
------------
|
||||||
|
|
||||||
Finit comes with a traditional configure script to control features and
|
Finit comes with a traditional configure script to control features and
|
||||||
optional plugins to enable. It does however depend on two external
|
optional plugins to enable. It depends on two external libraries:
|
||||||
libraries that provide some frog DNA needed:
|
|
||||||
|
|
||||||
- [libuEv][]
|
- [libuEv][], the event loop
|
||||||
- [libite][] (-lite)
|
- [libite][] (-lite), much needed frog DNA
|
||||||
|
|
||||||
Like most free/open source software that uses `configure` they deafult
|
**NOTE:** Most free/open source software that uses `configure` default
|
||||||
to install to `/usr/local`. However, some Linux distributions do no
|
to install to `/usr/local`. However, some Linux distributions do no
|
||||||
longer search that path for installed software, e.g. Fedora and Alpine
|
longer search that path for installed software, e.g. Fedora and Alpine
|
||||||
Linux. To get finit's configure script to find its dependencies you
|
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
|
have to help the `pkg-config` tool a bit if you do not change the
|
||||||
default prefix path:
|
default prefix path:
|
||||||
|
|
||||||
PKG_CONFIG_LIBDIR=/usr/local/lib/pkgconfig ./configure
|
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.
|
* `--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
|
* `--enable-rw-rootfs`: Most desktop and server systems boot with the
|
||||||
root file stystem read-only. With this setting Finit will remount it
|
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.
|
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
|
built-ins (.o files) and all external libraries, except the C library
|
||||||
will be linked statically.
|
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>
|
For more configure flags, see <kbd>./configure --help</kbd>
|
||||||
|
|
||||||
**Example**
|
|
||||||
|
Example
|
||||||
|
-------
|
||||||
|
|
||||||
First, unpack the archive:
|
First, unpack the archive:
|
||||||
|
|
||||||
@@ -58,7 +69,7 @@ First, unpack the archive:
|
|||||||
Then configure, build and install:
|
Then configure, build and install:
|
||||||
|
|
||||||
```shell
|
```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-chargen-plugin --enable-inetd-daytime-plugin \
|
||||||
--enable-inetd-discard-plugin --enable-inetd-time-plugin \
|
--enable-inetd-discard-plugin --enable-inetd-time-plugin \
|
||||||
--with-heading="Alpine Linux 3.4" --with-hostname=alpine
|
--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
|
destination directory when installing, very useful for building binary
|
||||||
standalone packages.
|
standalone packages.
|
||||||
|
|
||||||
To target an embedded Linux system, usally a system that use BusyBox
|
Finit 3.0 and later can detect if it runs on an embedded system, or a
|
||||||
tools instead of udev & C:o, add <kbd>--enable-embedded</kbd> to the
|
system that use BusyBox tools instead of udev & C:o. On such systems
|
||||||
configure command above. This enables `mdev` instead of `udev` and the
|
`mdev` instead of `udev` is used. However, remember to also change the
|
||||||
BusyBox `getty` syntax. Remember to also change the Linux config to:
|
Linux config to:
|
||||||
|
|
||||||
CONFIG_UEVENT_HELPER_PATH="/sbin/mdev"
|
CONFIG_UEVENT_HELPER_PATH="/sbin/mdev"
|
||||||
|
|
||||||
@@ -88,12 +99,50 @@ BusyBox `getty` syntax. Remember to also change the Linux config to:
|
|||||||
system `/etc/fstab`.
|
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
|
[1]: ftp://troglobit.com/finit/finit-3.0.tar.xz
|
||||||
[libuEv]: https://github.com/troglobit/libuev
|
[libuEv]: https://github.com/troglobit/libuev
|
||||||
[libite]: https://github.com/troglobit/libite
|
[libite]: https://github.com/troglobit/libite
|
||||||
|
|
||||||
<!--
|
|
||||||
-- Local Variables:
|
|
||||||
-- mode: markdown
|
|
||||||
-- End:
|
|
||||||
-->
|
|
||||||
|
|||||||
+47
-34
@@ -3,10 +3,6 @@ Finit Conditions
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
Table of Contents
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
* [Introduction](#introduction)
|
* [Introduction](#introduction)
|
||||||
* [Triggering](#triggering)
|
* [Triggering](#triggering)
|
||||||
* [Built-in Conditions](#built-in--conditions)
|
* [Built-in Conditions](#built-in--conditions)
|
||||||
@@ -17,15 +13,22 @@ Table of Contents
|
|||||||
Introduction
|
Introduction
|
||||||
------------
|
------------
|
||||||
|
|
||||||
In addition to declaring allowed runlevels per service, it is also
|
Conditions are a new addition to Finit, introduced in v3, with the
|
||||||
possible to declare user-defined conditions as dependencies. Conditions
|
intention of providing a mechanism for common synchronization problems.
|
||||||
are specified within angle brackets (<>) in the service stanza.
|
For example:
|
||||||
Multiple conditions may be specified separated by comma. Conditions are
|
|
||||||
AND'ed during evaluation, i.e. all conditions must be satisfied in order
|
- *"do not start this service until another process has started"*, or
|
||||||
for a service to run.
|
- *"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
|
```shell
|
||||||
service [2345] <svc/sbin/setupd,svc/sbin/zebra> /sbin/netd -- Network monitor
|
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
|
In this example the Network monitor daemon `netd` is not started until
|
||||||
both the `svc/sbin/setupd` *and* `svc/sbin/zebra` conditions are
|
both the `svc/sbin/setupd` *and* `svc/sbin/zebra` conditions are
|
||||||
satisfied. An `svc` condition is satisfied by the corresponding
|
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
|
Triggering
|
||||||
----------
|
----------
|
||||||
|
|
||||||
Conditions are triggered either by plugins or by using the `cond`
|
Conditions are triggered by built-in plugins, but can for debugging
|
||||||
command of the `initctl` control tool.
|
purposes also be controlled using the `cond set` and `cond clear`
|
||||||
|
sub-commands to the `initctl` control tool:
|
||||||
|
|
||||||
* `initctl cond set your/cond/here`
|
* `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
|
Conditions retain their current state until the next reconfiguration or
|
||||||
runlevel change. At that point all set conditions transition into the
|
runlevel change. At that point all set conditions transition into the
|
||||||
`flux` state, meaning the condition's state is unknown. (See
|
`flux` state, meaning the condition's state is unknown. (For more info
|
||||||
[Internals](#internals) for the rationale behind this.) Thus, after a
|
on this, see [Internals](#internals).) Thus, after a reconfiguration it
|
||||||
reconfiguration it is up to the "owner" of the condition to convey the
|
is up to the "owner" of the condition to convey the new (or possibly
|
||||||
new (or possibly unchanged) state of it.
|
unchanged) state of it.
|
||||||
|
|
||||||
|
|
||||||
Built-in Conditions
|
Built-in Conditions
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
Finit is distributed with a `pidfile` and `netlink` plugin. If enabled,
|
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/`
|
monitored services, and sets a corresponding condition in the `svc/`
|
||||||
namespace. Similarily, the `netlink` plugin provides basic conditions
|
namespace. Similarily, the `netlink` plugin provides basic conditions
|
||||||
for when an interface is brought up/down and when a default route
|
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`
|
With the example listed above, finit does not start the `/sbin/netd`
|
||||||
daemon until `setupd` and `zebra` has started *and* created their PID
|
daemon until `setupd` and `zebra` has started *and* created their PID
|
||||||
files. Which they do when they completed their main tasks of setting up
|
files. Which they do when they have completed their initial set up and
|
||||||
VLANs, bridge, interfaces, etc. When `netd` in turn starts up it
|
are ready to receive signals.
|
||||||
creates the file `/var/run/netd.pid`, and the condition `svc/sbin/netd`
|
|
||||||
is satisfied. When the file is removed, the condition is cleared.
|
|
||||||
|
|
||||||
The full path to the dependency is needed by finit to match the PID file
|
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:
|
Built-in conditions:
|
||||||
|
|
||||||
@@ -86,7 +96,9 @@ Built-in conditions:
|
|||||||
- `net/<IFNAME>/exist`
|
- `net/<IFNAME>/exist`
|
||||||
- `net/<IFNAME>/up`
|
- `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
|
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
|
from `initctl cond show` again. (The client will likely have failed to
|
||||||
start, but at least the condition is now satisfied.)
|
start, but at least the condition is now satisfied.)
|
||||||
|
|
||||||
|
There is also the `initctl cond dump` command, which dumps all known
|
||||||
|
conditions and their current status.
|
||||||
|
|
||||||
|
|
||||||
Internals
|
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:
|
A condition is always in one of three states:
|
||||||
|
|
||||||
* `on` (+): The condition is asserted.
|
* ` on` (+): The condition is asserted.
|
||||||
* `off` (-): The condition is deasserted.
|
* ` off` (-): The condition is deasserted.
|
||||||
* `flux` (~): The conditions state is unknown.
|
* `flux` (~): The conditions state is unknown.
|
||||||
|
|
||||||
All conditions that have not explicitly been set are interpreted as
|
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
|
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
|
done by binding to the `HOOK_SVC_RECONF` hook. For an example of how
|
||||||
to do this, see `plugins/pidfile.c`.
|
to do this, see `plugins/pidfile.c`.
|
||||||
|
|
||||||
<!--
|
|
||||||
-- Local Variables:
|
|
||||||
-- mode: markdown
|
|
||||||
-- End:
|
|
||||||
-->
|
|
||||||
|
|||||||
+133
-71
@@ -1,34 +1,49 @@
|
|||||||
Configuration
|
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][],
|
Finit can be configured using only the original `/etc/finit.conf` file
|
||||||
[upstart][], [systemd][], [OpenRC][], etc.) Finit relies on its main
|
or in combination with `/etc/finit.d/*.conf`. Finit 3 can even start a
|
||||||
configuration file `/etc/finit.conf` and `/etc/finit.d/`.
|
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
|
- `/etc/finit.conf`: main configuration file, read only once at boot
|
||||||
provide a default. A plugin can be used to register a callback to a
|
- `/etc/finit.d/*.conf`: snippets, usually one service per file
|
||||||
service and then modify the behavior to suit the current runlevel and
|
|
||||||
system configuration.
|
|
||||||
|
|
||||||
For instance, before starting a heavily resource intensive service like
|
Not all configuration directives are available in `/etc/finit.d/*.conf`
|
||||||
IPsec or OpenVPN, a callback can check if the outbound interface is up
|
and some directives are only available at bootstrap, runlevel `S`, see
|
||||||
and has an IP address, or just check if the service is disabled — much
|
the section [Limitations](#limitations) below for details.
|
||||||
like what a SysV init start script usually does.
|
|
||||||
|
|
||||||
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>`
|
On `initctl reload` the following is checked for all services:
|
||||||
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.
|
- 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>`
|
* `module <MODULE>`
|
||||||
Load a kernel module, with optional arguments
|
Load a kernel module, with optional arguments
|
||||||
@@ -60,11 +75,20 @@ Syntax:
|
|||||||
|
|
||||||
* `run [LVLS] <COND> /path/to/cmd ARGS -- Optional description`
|
* `run [LVLS] <COND> /path/to/cmd ARGS -- Optional description`
|
||||||
One-shot command to run in sequence when entering a runlevel, with
|
One-shot command to run in sequence when entering a runlevel, with
|
||||||
optional arguments and description. This command is guaranteed to be
|
optional arguments and description.
|
||||||
completed before running the next command.
|
|
||||||
|
`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`
|
* `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 [LVLS] <COND> /path/to/daemon ARGS -- Optional description`
|
||||||
Service, or daemon, to be monitored and automatically restarted if it
|
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
|
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,
|
For a detailed description of conditions, and how to debug them,
|
||||||
see the [Finit Conditions](conditions.md) document.
|
see the [Finit Conditions](conditions.md) document.
|
||||||
|
|
||||||
@@ -121,19 +152,54 @@ Syntax:
|
|||||||
* `include <CONF>`
|
* `include <CONF>`
|
||||||
Include another configuration file. Absolute path required.
|
Include another configuration file. Absolute path required.
|
||||||
|
|
||||||
* `tty [LVLS] <DEV> [BAUD] [TERM]`
|
* `tty [LVLS] <DEV> [BAUD] [noclear] [nowait] [TERM]`
|
||||||
Start a getty on the given TTY device DEV, in the given runlevels. If
|
`tty [LVLS] <CMD> <ARGS> [noclear] [nowait]`
|
||||||
no tty setting is given in `finit.conf` no login is possible. Use the
|
The first variant of this option uses the built-in getty on the given
|
||||||
`service` stanza to start a stand-alone shell for really bare bones
|
TTY device DEV, in the given runlevels. Default baud rate is `38400`.
|
||||||
systems.
|
|
||||||
|
|
||||||
Finit comes with a lightweight built-in getty, which after it has
|
**Example:**
|
||||||
opened a TTY and the user has input a username, calls `/bin/login`
|
```conf
|
||||||
like any other getty.
|
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>`
|
* `console <DEV>`
|
||||||
Use this, along with a matching `tty DEV` line, to mark this TTY as a
|
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
|
all logins except the console must be stopped, e.g. when performing a
|
||||||
flash upgrade on an embedded system.
|
flash upgrade on an embedded system.
|
||||||
|
|
||||||
@@ -170,50 +236,46 @@ Worth noting is that conditions is allowed for all these stanzas. For a
|
|||||||
detailed description, see the [Conditions](conditions.md) document.
|
detailed description, see the [Conditions](conditions.md) document.
|
||||||
|
|
||||||
|
|
||||||
/etc/finit.d
|
Limitations
|
||||||
------------
|
-----------
|
||||||
|
|
||||||
Finit supports changes to the overall system configuration at runtime.
|
To understand the limitations of `finit.conf` vs `finit.d` it is useful
|
||||||
For this purpose the (configurable) directory `/etc/finit.d` is used.
|
to picture the different phases of the system: bootstrap, runtime, and
|
||||||
Here you can put configuration file snippets, one per service if you
|
shutdown. The `finit.conf` file can be used for all possible settings,
|
||||||
like, which are all sourced automatically by finit at boot when loading
|
but `finit.d/*.conf` can only be used for runtime settings.
|
||||||
the static configuration from `/etc/finit.conf`. This is the default
|
|
||||||
behavior, so no include directives are necessary.
|
|
||||||
|
|
||||||
To add a new service, simply drop a `.conf` file in `/etc/finit.d` and
|
### /etc/finit.conf
|
||||||
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.
|
|
||||||
|
|
||||||
On `initctl reload` the following is checked for all services:
|
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:
|
||||||
|
|
||||||
- If a service's `.conf` file has been removed, or its conditions are no
|
- `host`
|
||||||
longer satisifed, the service is stopped.
|
- `mkdod`
|
||||||
- If the file is modified, or a service it depends on has been reloaded,
|
- `network`
|
||||||
the service is reloaded (stopped and started).
|
- `runparts`
|
||||||
- If a new service is added it is automatically started — respecting
|
- `include`
|
||||||
runlevels and return values from any callbacks.
|
- `shtudown`
|
||||||
|
- `runlevel`
|
||||||
|
- ... and all configuration stanzas from `/etc/finit.d` below
|
||||||
|
|
||||||
For more info on the different states of a service, see the separate
|
### /etc/finit.d
|
||||||
document [Finit Services](service.md).
|
|
||||||
|
|
||||||
The `/etc/finit.d` directory was previously the default Finit `runparts`
|
Support for partial `.conf` files in `/etc/finit.d` was added to handle
|
||||||
directory. Finit no longer has a default `runparts`, so make sure to
|
changes of the system configuration at runtime. It does *not support*
|
||||||
update your setup, or the finit configuration, accordingly.
|
the above `finit.conf` settings described above, only the following:
|
||||||
|
|
||||||
**Note:** Configurations read from `/etc/finit.d` are read *after*
|
- `module`, but only in runlevel `S`
|
||||||
initial bootstrap, runlevel S(1). Hence, bootstrap services *must* be
|
- `service`
|
||||||
in `/etc/finit.conf`!
|
- `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
|
[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
|
[TCP Wrappers]: https://en.wikipedia.org/wiki/TCP_Wrapper
|
||||||
|
|
||||||
<!--
|
|
||||||
-- Local Variables:
|
|
||||||
-- mode: markdown
|
|
||||||
-- End:
|
|
||||||
-->
|
|
||||||
|
|||||||
+6
-7
@@ -1,6 +1,12 @@
|
|||||||
Hooks & Plugins
|
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
|
Finit can be extended to add general functionality in the form of I/O
|
||||||
monitors, built-in inetd services, or hook plugins.
|
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
|
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
|
`poll()` detects an event. See the source code for `plugins/*.c` for
|
||||||
more help and ideas.
|
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:
|
The current state depends on the two following conditions:
|
||||||
|
|
||||||
* `E`: Service enabled. In order for `E` to be satisfied, the service
|
* `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
|
must be allowed to run in the current runlevel and not be stopped.
|
||||||
blocked. A service may be blocked for several reasons:
|
|
||||||
|
A service may be stopped, or blocked, for several reasons:
|
||||||
|
|
||||||
- The user has manually stopped the service using `initctl stop JOB`
|
- The user has manually stopped the service using `initctl stop JOB`
|
||||||
- The program exits immediately. I.e. keeps crashing (make sure to use
|
- 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.
|
- `on` (+): The condition is asserted.
|
||||||
- `off` (-): The condition is deasserted.
|
- `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,
|
For a detailed description of conditions, and how to debug them,
|
||||||
see the [Finit Conditions](conditions.md) document.
|
see the [Finit Conditions](conditions.md) document.
|
||||||
|
|
||||||
<!--
|
|
||||||
-- Local Variables:
|
|
||||||
-- mode: markdown
|
|
||||||
-- End:
|
|
||||||
-->
|
|
||||||
|
|||||||
+6
-11
@@ -6,12 +6,13 @@ Though Finit comes with its own tools for (poweroff, halt, reboot), for
|
|||||||
compatibility with the existing BusyBox toolset the following signals
|
compatibility with the existing BusyBox toolset the following signals
|
||||||
have been adopted:
|
have been adopted:
|
||||||
|
|
||||||
|
* `SIGHUP`
|
||||||
|
Same effect as `finit q`, `init q`, or `initctl reload`, reloads all
|
||||||
|
*.conf files in `/etc/finit.d/`
|
||||||
* `SIGUSR1`
|
* `SIGUSR1`
|
||||||
Same effect as `finit q`, reloads all *.conf files in `/etc/finit.d/`
|
Calls shutdown hooks, including `HOOK_SHUTDOWN`, stopping all running
|
||||||
* `SIGUSR1`
|
processes, and unmounts all file systems. Then tells kernel to halt.
|
||||||
Calls shutdown hooks, including HOOK_SHUTDOWN, stops all running
|
Most people these days want `SIGUSR2` though.
|
||||||
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.
|
SysV init and systemd use this to re-open their FIFO/D-Bus.
|
||||||
* `SIGUSR2`
|
* `SIGUSR2`
|
||||||
@@ -33,9 +34,3 @@ have been adopted:
|
|||||||
UPS status. Traditionally SysV init read /etc/powerstatus and
|
UPS status. Traditionally SysV init read /etc/powerstatus and
|
||||||
acted on "OK", "FAIL", or "LOW" and then removed the file.
|
acted on "OK", "FAIL", or "LOW" and then removed the file.
|
||||||
Finit currently forwards this to `SIGUSR2`.
|
Finit currently forwards this to `SIGUSR2`.
|
||||||
|
|
||||||
<!--
|
|
||||||
-- Local Variables:
|
|
||||||
-- mode: markdown
|
|
||||||
-- End:
|
|
||||||
-->
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -30,6 +30,7 @@ Optional Plugins:])
|
|||||||
fi])
|
fi])
|
||||||
if test "x$enable_plugin" = "xyes"; then
|
if test "x$enable_plugin" = "xyes"; then
|
||||||
AC_DEFINE([HAVE_]PLUGGY[_PLUGIN], 1, [Define to 1 if the $1 plugin is enabled.])
|
AC_DEFINE([HAVE_]PLUGGY[_PLUGIN], 1, [Define to 1 if the $1 plugin is enabled.])
|
||||||
|
plugins="$1 $plugins"
|
||||||
fi
|
fi
|
||||||
AM_CONDITIONAL([BUILD_]PLUGGY[_PLUGIN], test "x$enable_plugin" = "xyes")
|
AM_CONDITIONAL([BUILD_]PLUGGY[_PLUGIN], test "x$enable_plugin" = "xyes")
|
||||||
enable_pluggy="$enable_plugin"])
|
enable_pluggy="$enable_plugin"])
|
||||||
|
|||||||
+6
-4
@@ -1,4 +1,6 @@
|
|||||||
/*.la
|
*.la
|
||||||
/*.lo
|
*.lo
|
||||||
/.deps/*
|
.deps/*
|
||||||
/.libs/*
|
.libs/*
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
AM_LDFLAGS = -module -avoid-version -shared
|
AM_LDFLAGS = -module -avoid-version -shared
|
||||||
AM_CFLAGS = -W -Wall -Wextra -std=gnu99
|
AM_CFLAGS = -W -Wall -Wextra -Wno-unused-parameter -std=gnu99
|
||||||
AM_CPPFLAGS = -U_FORTIFY_SOURCE
|
AM_CPPFLAGS = -I$(top_srcdir)/src -U_FORTIFY_SOURCE
|
||||||
AM_CPPFLAGS += -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_GNU_SOURCE -D_DEFAULT_SOURCE
|
AM_CPPFLAGS += -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_GNU_SOURCE -D_DEFAULT_SOURCE
|
||||||
AM_CPPFLAGS += $(lite_CFLAGS)
|
AM_CPPFLAGS += $(lite_CFLAGS)
|
||||||
|
|
||||||
|
|||||||
@@ -22,23 +22,23 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <lite/lite.h>
|
#include <lite/lite.h>
|
||||||
#include "../finit.h"
|
#include "finit.h"
|
||||||
#include "../helpers.h"
|
#include "helpers.h"
|
||||||
#include "../plugin.h"
|
#include "plugin.h"
|
||||||
|
|
||||||
#define ALSACTL "/usr/sbin/alsactl"
|
#define ALSACTL "alsactl"
|
||||||
|
|
||||||
static void save(void *UNUSED(arg))
|
static void save(void *arg)
|
||||||
{
|
{
|
||||||
if (fexist(ALSACTL)) {
|
if (whichp(ALSACTL)) {
|
||||||
_d("Saving sound settings ...");
|
_d("Saving sound settings ...");
|
||||||
run_interactive(ALSACTL " -g store", "Saving sound settings");
|
run_interactive(ALSACTL " -g store", "Saving sound settings");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void restore(void *UNUSED(arg))
|
static void restore(void *arg)
|
||||||
{
|
{
|
||||||
if (fexist(ALSACTL)) {
|
if (whichp(ALSACTL)) {
|
||||||
_d("Restoring sound settings ...");
|
_d("Restoring sound settings ...");
|
||||||
run_interactive(ALSACTL " -g restore", "Restoring sound settings");
|
run_interactive(ALSACTL " -g restore", "Restoring sound settings");
|
||||||
}
|
}
|
||||||
|
|||||||
+24
-16
@@ -26,11 +26,11 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <lite/lite.h>
|
#include <lite/lite.h>
|
||||||
|
|
||||||
#include "../config.h"
|
#include "config.h"
|
||||||
#include "../finit.h"
|
#include "finit.h"
|
||||||
#include "../helpers.h"
|
#include "helpers.h"
|
||||||
#include "../plugin.h"
|
#include "plugin.h"
|
||||||
#include "../utmp-api.h"
|
#include "utmp-api.h"
|
||||||
|
|
||||||
static int is_tmpfs(char *path)
|
static int is_tmpfs(char *path)
|
||||||
{
|
{
|
||||||
@@ -64,15 +64,9 @@ static int is_tmpfs(char *path)
|
|||||||
return tmpfs;
|
return tmpfs;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void create(char *path, mode_t mode, uid_t uid, gid_t gid)
|
static int do_clean(const char *fpath, const struct stat *sb, int tflag, struct FTW *ftw)
|
||||||
{
|
{
|
||||||
if (touch(path) || chmod(path, mode) || chown(path, uid, gid))
|
if (ftw->level == 0)
|
||||||
_w("Failed creating %s properl.", path);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int do_clean(const char *fpath, const struct stat *UNUSED(sb), int UNUSED(tflag), struct FTW *ftwbuf)
|
|
||||||
{
|
|
||||||
if (ftwbuf->level == 0)
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
_d("Removing %s ...", fpath);
|
_d("Removing %s ...", fpath);
|
||||||
@@ -102,9 +96,9 @@ static void bootclean(void)
|
|||||||
/*
|
/*
|
||||||
* Setup standard FHS 2.3 structure in /var, and write runlevel to UTMP
|
* Setup standard FHS 2.3 structure in /var, and write runlevel to UTMP
|
||||||
*/
|
*/
|
||||||
static void setup(void *UNUSED(arg))
|
static void setup(void *arg)
|
||||||
{
|
{
|
||||||
int gid;
|
int uid, gid;
|
||||||
|
|
||||||
/* Cleanup stale files, if any still linger on. */
|
/* Cleanup stale files, if any still linger on. */
|
||||||
bootclean();
|
bootclean();
|
||||||
@@ -168,8 +162,22 @@ static void setup(void *UNUSED(arg))
|
|||||||
makedir("/var/run/quagga", 0755); /* Needed by Quagga */
|
makedir("/var/run/quagga", 0755); /* Needed by Quagga */
|
||||||
makedir("/var/log/quagga", 0755); /* Needed by Quagga */
|
makedir("/var/log/quagga", 0755); /* Needed by Quagga */
|
||||||
makedir("/var/run/sshd", 01755); /* OpenSSH */
|
makedir("/var/run/sshd", 01755); /* OpenSSH */
|
||||||
|
|
||||||
|
gid = getgroup("tty");
|
||||||
|
if (gid < 0)
|
||||||
|
gid = 0;
|
||||||
makefifo("/dev/xconsole", 0640); /* sysklogd */
|
makefifo("/dev/xconsole", 0640); /* sysklogd */
|
||||||
chown("/dev/xconsole", 0, getgroup("tty"));
|
chown("/dev/xconsole", 0, gid);
|
||||||
|
|
||||||
|
/* Void Linux has a uuidd that runs as uuid:uuid and needs /run/uuid */
|
||||||
|
uid = getuser("uuidd", NULL);
|
||||||
|
if (uid >= 0) {
|
||||||
|
gid = getgroup("uuidd");
|
||||||
|
if (gid < 0)
|
||||||
|
gid = 0;
|
||||||
|
makedir("/var/run/uuidd", 0755);
|
||||||
|
chown("/var/run/uuidd", uid, gid);
|
||||||
|
}
|
||||||
|
|
||||||
umask(022);
|
umask(022);
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user