Commit Graph
3235 Commits
Author SHA1 Message Date
Joachim Wiberg f89b508c01 .github: don't fail because tree returns non-zero ...
Has it always been like this, or have they "recently" changed the
behavior of the tree command?

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-07 07:32:02 +01:00
Joachim Wiberg dda8c7c3ac .github: split install & inspect into separate steps to debug
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-07 07:26:20 +01:00
Joachim Wiberg e2d9aab70d .github: step libuEv and libite versions
GitHub have now stepped their 'ubuntu-latest' image to Ubuntu 22.04.
With that comes the GLIBC bump to >= 2.34 which require aligning the
time bits and file offset bits to 64 bits.  This is libuev v2.4.0.

We also make sure to align libite to the same version between the
workflows to avoid any nasty surprises.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-07 07:00:51 +01:00
Joachim Wiberg 3df154b798 Fix #325: allow custom modprobe command in modules-load.d plugin
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-06 14:01:20 +01:00
Joachim Wiberg 3d9cbaf040 fgetval(): handle extra separators betwee key and value
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-06 14:00:31 +01:00
Joachim Wiberg 70c2939596 Fix #315: add environment variables to hook scripts
All hook scripts are called with at least one environment variable set,
FINIT_HOOK_NAME, useful when reusing the same hook script for multiple
hook points.  It is set to the string name, also used by the path, e.g.,
hook/net/up.

For all hook points from hook/sys/shutdown and later, FINIT_SHUTDOWN is
also set, to one of:  halt, poweroff, reboot.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-23 22:51:40 +01:00
Joachim Wiberg d4ee44e27f doc: minor, fix spelling
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-23 22:51:06 +01:00
Joachim Wiberg 0498326962 Fix #318: only show "[ OK ] Calling foo" progress for runparts ...
For all other run_parts() use-cases we just give the script control over
stdout/stderr to prevent clobbering ANSI color escape codes.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-23 21:49:30 +01:00
Joachim Wiberg c84ababbd4 Fix #317: make sure hook scripts don't run twice
Also fixes #316

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-23 21:44:31 +01:00
Joachim Wiberg 67ea42c87b Reduce debug noise from run_parts() slightly
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-23 21:12:30 +01:00
Joachim Wiberg a2ab45cad7 network: log output from ifup without trailing newline
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-23 21:08:50 +01:00
Joachim Wiberg f3fcca6150 Revert "Refactor, enter main event loop earlier"
This reverts commit 03c08d3970 due to it
breaking handling of bootstrap tasks, causing endless boot loop.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-23 17:54:32 +01:00
Joachim Wiberg 2b65d8f1e9 Follow-up to 9046b6f, don't warn() on empty lines, drop line debug
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-23 17:54:32 +01:00
Joachim Wiberg 7c2abf69c4 Add missing (new) service state strings
Also, reorder to match state enum order.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-23 17:54:32 +01:00
Joachim Wiberg 457c0a246f Fix #320: close API/IPC socket immediately in shutdown/reboot
This protects against any hook scripts or services calling initctl when
we're going down.  There's no way to service these requests anyway, so
no point in keeping the socket open.  This way initctl can check for
the existence of the socket before attempting any IPC command.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-22 08:10:49 +01:00
Joachim Wiberg 1a439baf68 Further improve runparts/hook script docs, add limitations
Issue #320

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-22 08:06:26 +01:00
Joachim Wiberg 68ce78b3fe Fix #319: add missing HOOK_NETWORK_DN
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-21 20:04:32 +01:00
Joachim Wiberg 72e27e99e5 .github: run tests as recommended in test/README.md
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-21 20:04:32 +01:00
Joachim Wiberg a436382886 Improve documentation for runparts and hook scripts
Issue #315.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-21 18:11:58 +01:00
Joachim Wiberg 6bbfc7b1f1 getty: extend issue parser with /etc/os-release support
Add support for /etC/os-release, with fallback to /usr/lib/os-release,
overriding some traditional modifiers with the os-release variant.  The
traditional values for these modifiers are taken from uname, which on
Linux systems are pretty useless since they always return the kernel
name and version instead of the distro/OS values.

E.g., \s becomes PRETTY_NAME instead of 'Linux' and \v becomes the
pretty VERSION, while \r becomes VERSION_ID.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-20 10:44:30 +01:00
Joachim Wiberg 006dd12b09 initctl: recactor, share fgetval() with rest of Finit
Note: this highly useful function should probably migrate to libite.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-20 10:43:30 +01:00
Joachim Wiberg d3a0631390 Add references to service-per-conf and link to finit.conf(5)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-19 10:11:18 +01:00
Joachim Wiberg 9046b6fe2b Fix #186: allow continuation character in .conf files
This change makes it possible to use the standard continuation character
in .conf files.  For example:

    service [23456]     \
         log:stderr     \
         <!pid/foo>     \
         bar            \
         -- This is the bar service, it depends on foo # comment that's dropped

Notice the additional support for comments on .conf lines.  If you use
the comment character today you must change to escape it.  Like this:

    service :2 foo -- Foo \#2

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-19 10:11:11 +01:00
Joachim Wiberg f217794773 Fix #314: call cond_update() also when removing all service/foo/*
When removing a whole tree of conditions we need to walk through each
and call cond_update() to ensure that all dependant tasks are stopped
and put back in waiting.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-15 09:24:54 +01:00
Joachim Wiberg 11e02fabb3 test: update test to detect all corner cases of bug #314
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-15 09:24:28 +01:00
Joachim Wiberg 8b9bb1c7ce Fix #314: skip restart if conditions are lost
This change prevents Finit from attempting to continue restarting
crashing services that've lost their conditions.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-15 01:03:10 +01:00
Joachim Wiberg 2a7abf1db0 test: enable new depserv test
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-15 00:56:03 +01:00
Joachim Wiberg 34b8c5a3ba test: check for spice on Arrakis, I hear it's good
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-14 23:45:37 +01:00
Joachim Wiberg 8e056422fc test: new shell helper function run()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-14 23:45:17 +01:00
Joachim Wiberg 94e8b185b4 test: add some spice to serv
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-14 23:45:04 +01:00
Joachim Wiberg 996d3960e1 test: touch pidfile on SIGHUP, the default Finit notify mechanism
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-14 18:53:24 +01:00
Joachim Wiberg 3b19734f63 test: new regression test, verify dependency vs restart handling
Bug #314

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-14 08:39:10 +01:00
Joachim Wiberg 64e7c0cd9e test: -P implies -p
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-14 08:18:18 +01:00
Joachim Wiberg 4d0c88bd7a man: add missing period at end of sentences
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-14 07:33:44 +01:00
Joachim Wiberg 9e8c601507 man: rewrite status command description
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-14 07:28:59 +01:00
Joachim Wiberg b26104466a Overdue version bump into v4.4-dev release cycle
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-11 21:54:22 +01:00
Joachim Wiberg bd25bf65ce test: ensure /run is a unique ramdisk for each test instance
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-11 21:54:01 +01:00
Joachim Wiberg edd3b41adf .github: only archive .log files
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-11 18:20:17 +01:00
Joachim Wiberg 28ca3fcc5c .github: restore -j1 for distcheck
Hopefully prevent spurious failures, dunno why atm., parallel checks
should work now. (Works locally with make -j20 check)

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-11 16:50:45 +01:00
Joachim Wiberg 3b601d0115 Fix issue with services suddenly converting to 'forking' type
When a service starts up the pidfile.so plugin automatically detects any
new pidfiles that show up in the system.  If it finds a matching service
which does not have a custom configured pidfile, it auto-assigns the
detected pidfile to the service.

However, when the user later calls `initctl reload` to update the
running configuration set, Finit service_register() mistakenly will
set the service to forking since it now suddenly has a pidfile ...

The new style way of configuring a forking service is to set the

     type:forking

option.  The old compat way was to set `pid:!/path/to/pidfile`, so
in service_register() we must be very careful not to interpret the
registered pidfile as confiugred by the user -- i.e., check the pid
option.

Bug #313

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-11 16:35:58 +01:00
Joachim Wiberg 1ef9a9f128 Cancel pending restart timer on initctl stop/start/restart/reload
When a service crashes Finit launches a restart timer that periodically
will try restart the service.  If a user calls `initctl stop foo` finit
must cancel this timer callback, otherwise we may end up with a weird
state where Finit thinkgs the service is running, but pid: 0, i.e., not
started.

Note: this fix has been expanded upon from the proof of concept
      submitted by Jack Newman.

Bug #313

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-11 16:34:50 +01:00
Joachim Wiberg d612a86c3b test. drop fozza dependency
Obvious dev. test :-)

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-11 16:19:54 +01:00
Joachim Wiberg 5d3cd05202 .github: split distcheck into separate check + distcheck steps
- We want log files from check archived
 - We want to verify that checks can run from tarball

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-11 16:13:32 +01:00
Joachim Wiberg 726f7ba229 test: new regression test for bug #313
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-11 15:53:48 +01:00
Joachim Wiberg 61dab8bd75 test: add support for new helper functions, skip/fail/check_dep
Also, make sure to exit each test with the correct exit status.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-11 15:52:37 +01:00
Joachim Wiberg a7e81f45c6 test: slay must cache oldpid to an instance specific ramdisk
Running tests in massive parallel causes failing startk-kill-service.sh.
This in turn was caused by the shared test tool 'slay' that cached its
"oldpid" file to a shared area of the rootfs (tenv-root).  It must use a
test instance-specific ramdisk.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-11 12:38:14 +01:00
Joachim Wiberg be4062f019 test: log service.sh output to stderr
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-11 12:37:57 +01:00
Joachim Wiberg 035f06e137 initctl: dump svc type and forking in JSON output
First set of svc_t properties not possible to debug otherwise.  See
issue #313 for a background.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-11 12:11:24 +01:00
Joachim Wiberg 2f91ab5eac Fix #235: support for overriding /etc/finit.conf and /etc/finit.d
This change adds support for a new command line option finit.config=PATH
which can be used to tell Finit to start with /etc/factory.conf instead
of /etc/finit.conf.

For the complete experience a new top-level configuration file directive
`rcsd PATH` has aslo been added.  It in turn can be used by factory.conf
as follows to override /etc/finit.d:

    rcsd /etc/factory.d

Manually verified in myLinux

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-10 17:21:33 +01:00
Joachim Wiberg f6b5b0260b Fix #312: restart services with respawn set, e.g. ttys, immediately
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-09 20:27:16 +01:00