Commit Graph
1003 Commits
Author SHA1 Message Date
Joachim Nilsson 077d52d209 Attempt new right-floating logo
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-21 15:09:55 +02:00
Joachim Nilsson 44f5de188d Update screenshot to Finit3
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-18 19:04:55 +02:00
Joachim Nilsson 191e5440b2 tty.c: Fix minor regression from f9732a6
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-18 18:52:56 +02:00
Joachim Nilsson a2b0d00058 reboot: Add poweroff symlink, now also supported
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-18 18:32:53 +02:00
Joachim Nilsson e8fa827026 README: Further cleanup and refactoring
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-18 18:32:38 +02:00
Joachim Nilsson 89105090ed Massive update, cleanup of README
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-18 16:53:20 +02:00
Joachim Nilsson 6ce218612b Fix build warnings if fallback shell is disabled
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-18 12:11:07 +02:00
Wang He dd87c81adc Create missing /var/lock/subsys dir in dbus plugin
Signed-off-by: Wang He <xw897002528@gmail.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-18 12:09:05 +02:00
Wang He 37f3478873 Run udev triggers to add subsystems and devices
Without trigger, kernel modules won't be loaded automatically.  Also
devices are not managed.  For example, i915 was not loaded after boot
and my network card was not renamed from wlan0 to wlp3s0, which means
it was not handled properly by udev.

Signed-off-by: Wang He <xw897002528@gmail.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-18 12:06:12 +02:00
Wang He a64259362e Clean up hidden dot files from /tmp
Signed-off-by: Wang He <xw897002528@gmail.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-18 12:02:36 +02:00
Wang He 3554138118 Sync needed before remount R/O
Signed-off-by: Wang He <xw897002528@gmail.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-18 12:00:16 +02:00
Joachim Nilsson f7d6d269c7 Change to runlevel 0/6 on reboot/halt/poweroff
This patch fixes a long-standing issue with how Finit handles shutdown,
reboot and poweroff -- and even runlevel changes to runlevel 0 and 6.

Prior to this patch sig.c:do_shutdown() was called immediately on any
of the above events, disregarding any services that a user might have
wanted to run as part of the shutdown/reboot.

With this change the handling is unified in all frontends to instead
do a runlevel change followed by the do_shutdown() action.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-18 11:50:07 +02:00
Joachim Nilsson 2c1e9877f9 Touch /etc/nologin when runlevel change comes in
The /etc/nologin file must be set as soon as the runlevel change to
0/1/6 comes in, not when done with runlevel change and services have
been started, if any.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-18 11:24:10 +02:00
Joachim Nilsson a94c97221e Force all log messages to console in --debug mode
As a last ditch effort to understand why an embedded system doesn't
boot, the operator should be able to see as much logs as possible
when enabling --debug mode on the kernel command line.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-18 10:27:03 +02:00
Joachim Nilsson f9732a6fb9 Fix warnings: type mismatch and unused parameters
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-18 10:27:03 +02:00
Joachim Nilsson 581fc956be Staticify local variable
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-18 10:27:03 +02:00
Joachim Nilsson ee901b018c Finit bringup: add optional fallback shell
This patch adds an `--enable-fallback-shell` option to confiugre.
When enabled Finit will start `/bin/sh` on the console, but only
if there are no active TTYs running in the current runlevel.

With this it will be easier to do board bringup with Finit, but it also
enables using the fallback shell in a rescue mode (runlevel) where no
TTYs are allowed to run.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-18 10:27:03 +02:00
Joachim Nilsson d373ebfdd7 New function tty_num_active()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-17 22:52:21 +02:00
Joachim Nilsson 698b87dd35 Clean out remnants of old (now unused) fallback shell
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-17 21:09:45 +02:00
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