Commit Graph
1035 Commits
Author SHA1 Message Date
Joachim Nilsson 0f61b0792b Minor cleanup
No need to assign result = 0 since that is the default, also
no other case sets result to OK.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-23 13:10:20 +02:00
Joachim Nilsson bab13c9cef bootclean: Followup to a013e48, reduced verbosity
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-23 11:28:24 +02:00
Joachim Nilsson 9c9fe51eee Fine grained signaling of processes at shutdown
This patch replaces kill(-1, signo) with a more fine grained
do_kill(signo) that traverses each /proc/PID, skipping kernel
threads and special [0][0] == '@' processes.

The reason for this patch is not only future compliance with
freedesktop.org standards, but also a way of not killing any
critical processes at shutdown, e.g. mdadm or watchdogd.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-23 00:28:41 +02:00
Joachim Nilsson 4f8211f6a1 Beautify 'mount -a' error message at boot
This patch from TroglOS makes sure to print any error message from mount
after [FAIL] is printed.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-22 18:36:51 +02:00
Joachim Nilsson 5fc3a0a3b9 Move HOOK_SHUTDOWN so it runs right before runlevel change
The shutdown hook is supposed to run right before services start
receiving SIGTERM.  Change due to previous refactor.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-16 23:06:17 +02:00
Joachim Nilsson 67c55145b9 Fix warning for comment in comment
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-10 00:03:08 +02:00
Joachim Nilsson fc2489d9e1 Remove or mark unused variables
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-10 00:02:45 +02:00
Joachim Nilsson a384a95529 Add missing warning flags and enable STD:GNU99
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-10 00:02:10 +02:00
Joachim Nilsson a013e48ab5 Run bootclean() from bootmisc plugin instead
This patch moves both the definition and the call to bootclean() from
finit.c to the bootmisc plugin.  We want to call bootclean() *after*
any /run and /var file systems have been mounted.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-09 23:15:06 +02:00
Joachim Nilsson 24a0ddfc59 Minor, remove TODO comment, fixed now.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-06 23:07:07 +02:00
Joachim Nilsson 3da4c2abe9 README: Add requirements to ToC
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-05 23:16:09 +02:00
Joachim Nilsson 2950820d34 README: Add requirements section
- New requirements section about what Finit expects from the system
- Remove commented out `udevadm settle` code, now in README

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-05 23:14:21 +02:00
Joachim Nilsson 75b1ac8199 Fix CID 171497, ignore return value from remove()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-04 12:37:36 +02:00
Joachim Nilsson 8f05b36551 Do not call udevadm settle, only Debian uses this
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-04 12:12:59 +02:00
Joachim Nilsson 0f840e6576 Do not force silent mode on udev systems
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-04 12:12:59 +02:00
Joachim Nilsson 451f63ebe0 Clean up unused local variables
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-02 23:11:49 +02:00
Joachim Nilsson 2dc9daf118 Clear screen in silent mode
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-02 23:10:49 +02:00
Joachim Nilsson 3c67a10347 Actually unblock signals for child processes
Also, make them session leader so they can manage their own offspring if
needed.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-02 23:08:39 +02:00
Joachim Nilsson 6885a9f868 Systems with udev/udevadm mess up /dev/console => silence console
On systems with systemd-udev/udevadm the trigger addition of devices at
boot wrecks havoc of /dev/console.  This patch forces Finit to go silent
by default on such systems.  Far from ideal, but since the actual root
cause for this messup is unknown this will have to do for now.

Also, add a settle timeout of 120 sec to the udev device tree population.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-02 23:08:18 +02:00
Joachim Nilsson 38142baa93 Do not fork external process, use sync(2) instead
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-02 14:06:06 +02:00
Joachim Nilsson 34bdbdb3b1 resolvconf: Simplify and fix buglet
- The /dev/shm/ directories are no longer needed
- Do not create the resolv.conf symlink

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-02 13:14:16 +02:00
Joachim Nilsson 83af7e8e9d resolvconf: Initial cleanup of plugin
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-02 13:06:03 +02:00
Joachim Nilsson 4eb5f8a0dc bootmisc: /var/lock/subsys created by D-Bus plugin
No need to create it twice.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-02 12:05:27 +02:00
Joachim Nilsson e03b358ff0 Fix #46: Set correct umask() before makedir() and chmod()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-02 11:42:40 +02:00
Wang He d2846b805a Fix issue #42: Skip base directories in bootclean.
Signed-off-by: Wang He <xw897002528@gmail.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-02 11:07:54 +02:00
Joachim Nilsson 07d767e1af Fix issue #42: Use ftw() to recursively clean up dirs.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-30 23:01:26 +02:00
Joachim Nilsson d423e6b774 doc: Reminder about conditions for run/task/service/inetd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-26 21:43:56 +02:00
Joachim Nilsson bb89bdd8a9 Refactor fallback handling in getent()
This patch factors out the fgetint() fallback code for parsing
/etc/services and /etc/protocols.  Useful on systems with a
malfunctioning C library.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-26 21:42:34 +02:00
Joachim Nilsson 5cc98f6e53 inetd: List service/proto in error message
Improve error when failing to register an inetd service.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-26 21:41:28 +02:00
Joachim Nilsson a6300f6ac6 Fix warning on 32-bit ARM: 2 << 31 overflows int
Thanks to GCC 6.1 for finding this.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-26 21:40:31 +02:00
Joachim Nilsson aeabb4d2ea Realign logo and mention systemd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-21 15:40:27 +02:00
Joachim Nilsson dcbb429863 Remove logo HTML+CSS alignment screws up rendering
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-21 15:11:14 +02:00
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