Commit Graph
118 Commits
Author SHA1 Message Date
Joachim Wiberg ccfea59cb3 Bump version for Finit v4.0-rc2 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-03-07 18:50:50 +01:00
Joachim Wiberg 305ad302f2 Refactor, reduce code duplication
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-03-07 10:28:54 +01:00
Joachim Wiberg 4bcfd606b4 Refactor screen_init(), use methods developed in pimd project
- Refactor screen_init()
  - use native impl. of TTY probing from pimd project
    - check if TIOCWINSZ works
    - check if we're running in watch(1), for initctl
  - check if ANSI goto(999,999) escape seq. works (invasive)
  - fallback to 80x24
- Drop screen_exit()
- Rename screen_init() to get_width(), for now, matching pimd
- Relocate call in main() to banner(), first fn to write to TTY

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-03-04 23:23:31 +01:00
Joachim Wiberg 439699ef52 configure: improve --with-sysconfig help text slightly
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-03-03 07:06:17 +01:00
Joachim Wiberg f20936dae0 configure: slight reorder; first enable -> then disable options
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-03-03 07:05:55 +01:00
Joachim Wiberg ecc8b2dcf9 Bump version for v4.0-rc1
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-28 23:23:55 +01:00
Joachim Wiberg 3b64b155d4 Update build deps, need libite (-lite) at least v2.2.0 for systemf()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-28 23:17:47 +01:00
Joachim Wiberg 7f6ccfabb2 Merge pull request #158 from troglobit/wip-tests
Test framework and a small set of basic tests

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-28 22:40:55 +01:00
Joachim Wiberg 84be93e013 build: Put all GNU autotools support files in aux/
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-28 11:54:17 +01:00
Joachim Wiberg 2bfede2cfe Add /lib/finit/sample.conf for initctl create
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-28 10:26:39 +01:00
Joachim Wiberg 6862d7cd5f Refactor --with-sysconfig, default to /etc/default and /etc/conf.d
Both Debian and Builroot based systems use /etc/default and
Alpine Linux use /etc/conf.d, so let's just put both in by
default.  If the directories exist we monitor them.

The --with-syconfig configure option is now disabled by default.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-28 09:53:48 +01:00
Joachim Wiberg 41092095f5 configure: allow custom directory for --with-sysconfig
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-26 10:32:54 +01:00
Joachim Wiberg 3ae609c341 configure: minor refactor, simplify to reduce duplication
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-26 10:32:41 +01:00
Joachim Wiberg 435211765c Follow-up to f4a0b99: track modifications of service env: files
Add support for monitoring environment files for services declared with
the `env:[-]/path/to/file` option.  The default path to such files has
been chosen to follow Debian and Buildroot /etc/default/*

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-26 10:23:24 +01:00
Joachim Wiberg e3b27d47bc Follow-up to dfd41a1: fix default finit.conf path regression
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-26 09:52:42 +01:00
Joachim Wiberg 45a374b50a configure: allow custom directory for --with-sysconfig
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-25 18:28:11 +01:00
Jacques de Laval 48b732e53d test: Let Autoconf generate env vars for tests
This simplifies the setup script a lot, and also makes it easier to
run tests independently.

Signed-off-by: Jacques de Laval <jacques@de-laval.se>
2021-02-25 17:37:24 +01:00
Joachim Wiberg dfd41a1b37 configure: minor refactor, simplify to reduce duplication
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-25 17:17:30 +01:00
Joachim Wiberg 74d3194775 Follow-up to f4a0b99: track modifications of service env: files
Add support for monitoring environment files for services declared with
the `env:[-]/path/to/file` option.  The default path to such files has
been chosen to follow Debian and Buildroot /etc/default/*

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-25 17:14:26 +01:00
Jacques de Laval 11841ceb5d test: Clean up Automake integration of tests
Signed-off-by: Jacques de Laval <jacques@de-laval.se>
2021-02-22 22:07:17 +01:00
Joachim Wiberg 35e4e0d073 Drop confusing splash cmdline and --enable-progress configure option
This patch reverts back to the progress/status behavior of Finit < v3.0
because this is what most users expect, including the maintainer.  The
resulting code and configure script is a lot simpler to understand and
maintain:

- No more --enable-progress or --enable-progress-classic configure
  flags.  Instead a progress_style variable in helpers.c that can
  be changed at compile time for those that really need it.
- No more 'splash' kernel commnand line option.  This turned out to
  be *very* confusing to many users who believed it was some sort of
  graphical splash screen à la Plymouth.

Also, when Finit debug is enabled we now have a global 'debug' flag
which now alo controls if klogctl() should be called to prevent the
kernel logs to the console or not.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-14 20:11:08 +01:00
Joachim Wiberg 260288a184 configure: restore tar.xz dists, be nice to downstream
In the v4 bump we removed tar.xz archives in favor of bringing back
tar.gz.  This was a bit premature and could easily cause unnecessary
headaches downstream.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-13 12:07:20 +01:00
Jacques de Laval cb64c068e3 Fix #136: drop old init client tool
The SysV API compatibility layer gives too little value to be worth
the effort of maintaining it. Users are encouraged to use the
`initctl` tool instead.

Signed-off-by: Jacques de Laval <jacques@de-laval.se>
2021-02-11 17:52:08 +01:00
Joachim Wiberg e88a9b14ff Fix #101: remove built-in inetd from finit
This patch removes the built-in inetd support from Finit.  We recommend
using an external inetd instead, e.g. xinetd.

If you liked the feature set our inetd provided; filtering per interface
and port redirection, then please let us know or use the code in this
patch (MIT licensed) to recreate it.  We are open to reintroducing it,
but then as a stand-alone daemon like the bundled watchdogd and getty.

So long for now, old friend.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-11 12:46:40 +01:00
Joachim Wiberg c93e9a30cd Scrap v3.2 release cycle and move to v4.0 directly
Planned changes will directly change the behavior of conditions, and
instead of having to implement compatibility wrappers and further
complicate the code, we've taken the decision to go for v4 directly.
This allows us to also rip out the complex inetd support.

Other changes in this commit:

- Revert back to .tar.gz distribution archives, by popular demand
- Add .sha256 checksum for .tar.gz archive

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-10 11:47:26 +01:00
Joachim Wiberg 5d7ce3a92b configure: drop remaining --with-console, auto-probed now
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-08 20:20:08 +01:00
Joachim Wiberg 82664396d6 Refactor 3e8d63c: use consoles from /sys/class/tty/console/active
As documented in the kernel docs and systemd[1], the default system
console is the first listed in /sys/class/tty/console/active, which
is the reverse order of console= given on the kernel cmdline.

Some distros don't have console= on their default command line in
their bootloader, e.g. Alpine Linux, some multiple, e.g Buildroot.
Instead of relying on the value given at configure time we probe
sysfs and open all (at most three) consoles listed.  This way we
at least get the default console for our progress output.

- drop old --with-console from configure script
- drop /proc/cmdline fishing in favor of sysfs
- replace CONSOLE from configure with new console()

[1]: http://0pointer.de/blog/projects/serial-console.html

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-08 20:09:49 +01:00
Joachim Wiberg aa4addfa86 configure: drop note at bottom, we use std gnu defaults now
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-08 09:28:36 +01:00
Joachim Wiberg 06fdcf51b9 configure: revert to using GNU defaults, update summary
- Changing the GNU defaults is messy.  The best way is to leave them
  alone and let the user set their install locations themselves.
- Show --exec-prefix in config Summary, that's where the binaries go

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-08 07:58:25 +01:00
Tobias Waldekranz adcc78039e Bring back the hotplug-daemon-heuristic as a plugin
This way, the default behavior stays the same, but users can opt out
by disabling the plugin.
2020-10-20 14:57:10 +02:00
Joachim Wiberg 2ce1a003d5 Add notice about default paths to configure summary
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2020-09-16 06:39:47 +02:00
Joachim Nilsson 9d9b6b5201 Update ChangeLog and bump version for v3.2-rc3
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-23 18:06:25 +02:00
Joachim Nilsson 88a6864fd4 Relocate docs/ --> doc/, like most other projects have
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-23 17:53:36 +02:00
Joachim Nilsson aa08221666 configure: Remove --enable-rw-rootfs detect using /etc/fstab instead
This patch removes the --enable-rw-rootfs build flag.  Like OpenRC we
now check /etc/fstab instad; if `/` is listed *and* doesn't have the
`ro` flag set, we remount / read-write.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-22 20:08:52 +02:00
Joachim Nilsson d797754ca8 Update ChangeLog and bump version for v3.2-rc2
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-11 23:54:26 +02:00
Joachim Nilsson ca3fc057f2 configure: Change semantics of 33bb6ed, logit enabled by default
The logit tool is not just used by scripts and such, when logger is
absent.  It is also used by Finit internally to redirect logging of
services to syslog and/or log file, with log rotation.

This patch reverts the default to enabled.  Someone explicitly has
to disable logit now to get less functionality.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-03-30 11:56:39 +02:00
Joachim Nilsson bf6e599584 Handle log redirect to syslog when logit is disabled
`--disable-logit` at configure time means redirecting stdout from a
service to a file is completely disabled.  Fallback to `logger` can
not be guaranteed to provide log file rotation, so all logs will be
sent to syslog instead.  In case logger is also missing, a simple
redirect using fork() + syslog() is used as fallback.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-03-30 11:53:43 +02:00
Joachim Nilsson e301877b16 Follow-up to 12d14aa, configurable auto-reload of .conf files
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-02-26 11:13:06 +01:00
Joachim Nilsson 33bb6ed5ac Add --enable-logit to configure, disabled by default
Since sysklogd now ships an excellent enhanced logger tool there is no
need for Finit to provide its own tool for the same purpose by default.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-07 13:02:06 +01:00
Joachim Nilsson 636f6678ed Introducing Finit progress 𝓜𝓸𝓭𝓮𝓻𝓷
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-02 14:59:32 +01:00
Joachim Nilsson abccb26a83 Check for pkg-config in configure before looking for deps
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-07-04 22:26:08 +02:00
Robert Andersson 33fd6f0049 Add modules-load.d plugin
This plugin scans /etc/modules-load.d for modules to modprobe.

Signed-off-by: Robert Andersson <robert.m.andersson@se.atlascopco.com>
2018-10-22 12:51:58 +02:00
Joachim Nilsson 5579ba16b1 Bump version for v3.2-rc1 pre-release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-10-16 08:58:56 +02:00
Joachim Nilsson 5e6f64eec9 Bump version for new v3.2 release cycle
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-10-11 16:10:29 +02:00
Joachim Nilsson fb16abd855 Require new libuEV API: uev_init1() to enforce a small event cache
In cases where you have multiple events pending in the cache and some
event may cause later ones, already sent by the kernel to userspace,
to be deleted the pointer returned to the event loop for this later
event may be deleted.

There are two ways around this (accessing deleted memory); 1) use this
function to initialize your event loop and set maxevents to 1, 2) use a
free list in you application that you garbage collect at intervals
relevant to your application.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-10-04 21:53:36 +02:00
Joachim Nilsson 682e80fed5 Remove HOOK_SVC_LOST, recommend using accounting instead
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-30 11:28:27 +02:00
Joachim Nilsson 9516c28a8a Add support for disabling (build+)install of docs and contrib section
In massively parallel builds we've seen finit fail in the install phase
of the contrib section with:

ln: failed to create symbolic link '/home/bob/jenkins/workspace/WeOS-feature_5.x_igmp-mld-snooping/staging/share/doc/finit/contrib/alpine/finit.d/getty.conf': No such file or directory
ln: failed to create symbolic link '/home/bob/jenkins/workspace/WeOS-feature_5.x_igmp-mld-snooping/staging/share/doc/finit/contrib/alpine/finit.d/keymap.conf': No such file or directory
ln: failed to create symbolic link '/home/bob/jenkins/workspace/WeOS-feature_5.x_igmp-mld-snooping/staging/share/doc/finit/contrib/alpine/finit.d/modules.conf': No such file or directory
ln: failed to create symbolic link '/home/bob/jenkins/workspace/WeOS-feature_5.x_igmp-mld-snooping/staging/share/doc/finit/contrib/alpine/finit.d/klogd.conf': No such file or directory
ln: failed to create symbolic link '/home/bob/jenkins/workspace/WeOS-feature_5.x_igmp-mld-snooping/staging/share/doc/finit/contrib/alpine/finit.d/syslogd.conf': No such file or directory

This patch is a countermeasure since fixing the root cause may take a
while (to be prioritized).

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-28 11:25:52 +02:00
Joachim Nilsson 3a1ad67e92 Convert built-in watchdog to a standalone mini watchdogd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-07-09 23:49:04 +02:00
Joachim Nilsson 6d41725387 Bump version for v3.1 release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-01-23 14:51:55 +01:00
Joachim Nilsson 227e4fa097 Create destination contrib/*/finit.d dir if missing
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-01-22 19:03:06 +01:00