Commit Graph
984 Commits
Author SHA1 Message Date
Joachim Nilsson dd566acfd2 Update ChangeLog and bump version for v3.0-rc1
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
3.0-rc1
2016-09-14 00:04:00 +02:00
Joachim Nilsson 5c56f5c5a7 Fix make distcheck: Add missing header file to build deps.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-13 23:02:01 +02:00
Joachim Nilsson 7ab963a576 Remove eXecutable flag from source files
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-13 23:00:06 +02:00
Joachim Nilsson 73d462c847 utmp_set(): Fix uninitialized return value
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-13 22:47:16 +02:00
Joachim Nilsson 56e94a4e4a Merge branch 'westermo-usr/wkz/timeout'
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-13 21:56:39 +02:00
Joachim Nilsson 51830e0f5b Merge branch 'usr/wkz/timeout' of https://github.com/westermo/finit into westermo-usr/wkz/timeout 2016-09-13 21:53:26 +02:00
Joachim Nilsson 85115eca62 Fix invalid ptr assignment for --enable-static builds
Also changes the default to set $HOME to / instead of nothing.  This can
of course be improved immensely.  Pull requests always welcome ;-)

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-13 21:41:36 +02:00
Joachim Nilsson 659ff9962e Fallback (unused) PLUGIN_PATH for --enable-static builds
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-13 21:41:11 +02:00
Joachim Nilsson 9436c8b73c Minor whitespace cleanup
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-13 21:25:40 +02:00
Joachim Nilsson 5a3397419f Remove support for service callback plugins
This patch removes the now heavily outdated (and non-working) support
for callback plugins.  I.e. plugins that attach themselves to services
listed in /etc/finit.conf and can be queried to determine if a service
should be started or stopped.

The Finit3 support for adding/removing services at runtime with plain
text *.conf files in /etc/finit.d and `initctl reload`, this old, and
rather cumbersome service callback feature, is not longer supported.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-13 21:20:06 +02:00
Tobias Waldekranz 10b72f1d7f service: kill stubborn services, wait before restart
Add support for registering callbacks to be called after a given
timeout.

Use this to implement forceful termination of services that refuse to
terminate upon receiving a SIGTERM. If the service PID is not collected
within 3 seconds, send a SIGKILL to it.

Also, rework restarting of crashing services. When a service crashes for
the first time, try to restart it immediately. If it crashes again, wait
a few seconds before trying again. Just as before, if it continues to
crash, block the service.
2016-09-13 20:26:28 +02:00
Joachim Nilsson 6b237b7b00 Refactor abstraction of svc blocking state
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-12 19:30:48 +02:00
Joachim Nilsson b4f385d2e0 Only log to stderr if opening /dev/kmsg failed for early logging
This patch prevents double critical/error messages from being printed on
the console when there is no syslog daemon running yet.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-08 17:11:52 +02:00
Joachim Nilsson 4b4572de4d Minor refactor of error/debug messages
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-08 17:11:27 +02:00
Joachim Nilsson 19b81cf434 Fix #40, #39: initctl plugin started too early, before /run FS existed
Delay setup of initctl plugin to after the base filesystems are up and
after the bootmisc plugin has run.

This patch factors out the I/O initialization of plugins so it does not
have to run when plugins are loaded.  Instead, plugins can now call this
API to register an I/O callback when they are ready.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-08 12:58:28 +02:00
Joachim Nilsson 3023433def Do not write DEAD_PROCESS records to UTMP, only WTMP
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-08 12:51:32 +02:00
Joachim Nilsson 49968c188b UTMP: Make sure to use the full width of all UTMP fields
In UTMP a terminating zero in string fields is optional, so we need to
take that into account when preparing entrys.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-08 12:51:20 +02:00
Joachim Nilsson 2499405b27 Misc. whitespace fixes, and comment
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-06 00:08:40 +02:00
Joachim Nilsson 9fc1f50678 bootmisc: The getgroup() API returns int not gid_t
Must use int to check for error code (-1) from getgroup() API.
Found by Coverity Scan.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-05 00:55:21 +02:00
Joachim Nilsson b1d709ba22 reboot: CMD_SUSPEND not handled atm by Finit
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-05 00:54:52 +02:00
Joachim Nilsson 5ddc35d387 echo: Mark callback argument as unused
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-05 00:54:29 +02:00
Joachim Nilsson 50632f941b Fix missing initializer for array end marker
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-05 00:46:15 +02:00
Joachim Nilsson 7b215e4fd4 Update dependencies for libuEv and libite (-lite)
This patch makes Finit require libuEv v1.4.2, a minor bugfix update, and
libite (-lite) v1.8.2, which is quite a bit more than just a few bug
fixes.  The most relevant fixes are the removal of implicit logging for
touch(), makedir(), makefifo(), and erase() inline functions.  The
release also removed implicit logging to stderr on error, as well as a
a few build fixes for running on musl libc.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-05 00:24:55 +02:00
Joachim Nilsson bb7208c591 bootmisc: Check return value from chmod() API
Found by Coverity Scan.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-04 23:23:37 +02:00
Joachim Nilsson bb0505f57c bootmisc: Check return value from getgroup() API
Found by Coverity Scan.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-04 23:13:51 +02:00
Joachim Nilsson 4aa569de44 Fix descriptor leak in getty()
Found by Coverity Scan.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-04 23:03:42 +02:00
Joachim Nilsson 512a07a25c Fix resource leak if tty_register() fails (minor)
Found by Coverity Scan.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-04 22:55:21 +02:00
Joachim Nilsson 8cfd11c909 Use safe string copy using strlcpy()
Fixes issues with buffers not being NUL terminated properly.
Found by Coverity Scan.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-04 22:52:34 +02:00
Joachim Nilsson c3adf3bf51 Bump version to v3.0-beta2 no more feature expected
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-04 20:48:49 +02:00
Joachim Nilsson 3ca28e765d Fix #38: Add --enable-emergency-shell fallback debug mode
This patch adds a very special debug mode to Finit.  With this feature
enabled the actual duties of PID 1 is forked off early to a child.  If
that child ever dies, usually due to a SIGSEGV, this wakes up the real
PID 1 which lauches a debug shell on the console.

Remember to disable 'quiet' and enable '--debug' on the kernel command
line to get all the debug logs -- which these days goes into the kernel
log in /dev/kmsg -- simply `cat /dev/kmsg` and use Ctrl-C to get the
shell prompt back.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-04 20:27:12 +02:00
Joachim Nilsson 79207dcb22 Support for starting finit-getty with a given user
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-04 20:02:59 +02:00
Joachim Nilsson 47f3e2ca04 Clarify what --disable-quiet actually does
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-04 18:40:58 +02:00
Joachim Nilsson 2e7bee9f84 Fix #36: Don't delete inetd on failed registration
This patch fixes to root cause to issue #36, reported by Markus Svilans.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-04 17:22:50 +02:00
Joachim Nilsson 2681e4c01a Add early logging support to /dev/kmsg
Very early, before syslogd has started, we have traditionally been
forced to use stdout/stderr for debug, warning and error messages.

With this patch we can now rely on /dev/kmsg to preserve all logs
from early Finit problems.  When syslogd/klogd starts up they read
/dev/kmsg and copy logs to /var/log/* files.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-04 17:19:06 +02:00
Joachim Nilsson 56a3f6882b Improve inetd service registration
- Refactor getent() for improved separation and readability
- Warn and exit if /etc/protocols or /etc/services is missing

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-04 17:17:22 +02:00
Joachim Nilsson 88d8ab67c9 Add _w() for developer warning logs
Adjust debug levels slightly and add _w() macro for LOG_WARNING,
useful when having /dev/kmsg as backend.  The latter outputs any
log <= LOG_ERR to console as well.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-04 17:15:41 +02:00
Joachim Nilsson 74eb2bf4d2 initctl: Add dependency on bootmisc
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-04 17:13:38 +02:00
Joachim Nilsson b3fb9ab3ed Fix placement of newline for early debug
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-04 16:10:23 +02:00
Markus Svilans 308ae609c4 Fix #35: Build fails with --disable-inetd
This patch fixes a build problem when configured without inetd support.

Signed-off-by: Markus Svilans <msvilans@aeonyx.ca>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-08-31 16:30:04 +02:00
Joachim Nilsson e3783e8bac README: Fix spelling error
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-08-26 21:36:04 +02:00
Joachim Nilsson 002b24fbc2 README: Improve ingress
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-08-26 21:34:36 +02:00
Joachim Nilsson 3f71ed352d initctl: Remove confusing/wrong debug message
The 's' runlevel after boot is the traditional single-user rescue mode.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-08-24 22:08:46 +02:00
Joachim Nilsson f7305c36b8 reboot: Clarify -f, --force option in usage text
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-08-24 22:08:26 +02:00
Joachim Nilsson 8bcecd474b Refresh telinit client
- Add support for SysV init setenv to activate poweroff
- Update help text considerably to be more helpful

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-08-24 20:26:09 +02:00
Joachim Nilsson a9a7b08021 Disable login also in shutdown/reboot
Disable login in single-user mode as well as shutdown/reboot

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-08-24 19:27:23 +02:00
Joachim Nilsson 62cb683af0 initctl: Show WTMP log first and active UTMP last
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-08-23 16:35:44 +02:00
Joachim Nilsson 65e44dc88f UTMP: By convention, getty has user "LOGIN"
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-08-23 07:49:32 +02:00
Joachim Nilsson 54467d4467 configure: Minor whitespace changes
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-08-22 12:39:51 +02:00
Joachim Nilsson cfa258e7f2 UTMP: Log to /var/log/wtmp as well as /run/utmp
The UTMP db tracks currently logged in users and WTMP is an audit trail
of all user logins and logouts, as well as runlevel changes and reboot.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-08-22 12:36:17 +02:00
Joachim Nilsson 574760df13 UTMP: Set LOGIN_PROCESS for built-in getty
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-08-22 12:36:03 +02:00