Commit Graph
2017 Commits
Author SHA1 Message Date
Tobias Waldekranz 9c8df123e8 Always run banner plugin hook
Upcoming external plugin support means that even though there are no
internal plugins that depend on this hook, there might be external
ones.
2020-10-13 15:23:41 +02:00
Tobias Waldekranz e558d5871b Move argument-hiding magic together with argument parsing
Everything else Finit does related to parsing the incoming arguments
is in conf.c, so it makes sense for this block to also reside there.
2020-10-12 13:09:41 +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 Wiberg 8a8a51e23c Merge pull request #132 from firasuke/patch-1
Fix styling
2020-09-13 08:31:33 +02:00
Firas Khalil Khana c3e0a205f9 Fix styling 2020-09-12 16:21:13 +03:00
Joachim Wiberg 24a78d3246 Update copyright years and author last name
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2020-09-02 23:38:11 +02:00
Joachim Wiberg 31f6362e2e Update author (my) last name
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2020-09-02 23:38:11 +02:00
Joachim Nilsson 946ca09c54 Merge pull request #130 from roycyt/fix-typo
doc/distro.md: fix typo
2020-07-10 11:07:47 +02:00
Roy Chen 552f52e061 doc/distro.md: fix typo 2020-07-10 14:49:16 +08:00
Joachim Nilsson 57ab42bb7f Final (?) change to banner, use standard unicode bullet U+25CF
This patch to the banner "hello" is hopefully the last in this new style
progress.  Previous efforts have used unicode symbols not available in
all fonts.  This time we standardize on one that looks good both the
default Ubuntu Mono and Source Code Pro fonts.  It's a bit small in my
preferred font, Envy Code R, but that might be a mistake in the font.

Not tested with PuTTY or Windows Hyper Terminal.  I think they use the
Courier font by default, both of them, which I have tested.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-07-01 16:27:47 +02:00
Joachim Nilsson b7e4310542 Drop final period '.' in new style progress
Some ppl have their own '.' in service descriptions, adding anther just
messes things up and is confusing.  The old style progress still adds
dots, but thats for padding up to [ OK ].

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-07-01 16:12:57 +02:00
Joachim Nilsson 15ee8f172b Skip loopback in ifup if its already up, for containers
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-07-01 13:38:36 +02:00
Joachim Nilsson 9e778aa7e8 Treat finit.conf tty console as /dev/console
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-07-01 13:13:45 +02:00
Joachim Nilsson 16e401f253 Revert "Add support for 'console' as compat alias to '@console'"
Because we want to reserve @console for going dumpster diving in
/sys/class/tty/console/active and 'console' to mean the literal
/dev/console

This reverts commit 217df432d6.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-07-01 13:10:10 +02:00
Joachim Nilsson fdead062cd Support reading --debug et al from process command line
Up until now Finit has only read /proc/cmdline to determine debug level,
single user mode, etc.  This patch is one in a series to make enable it
to run also in containers.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-07-01 13:08:41 +02:00
Joachim Nilsson df54f5a59c plugins: modprobe: Skip for systems without modules
Skip for systems without modules, e.g. small embedded or containers

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-07-01 13:07:57 +02:00
Joachim Nilsson 2dd5d40833 Switch traffic lights to more readily available unicode symbols
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-06-26 07:01:35 +02:00
Joachim Nilsson 0d41ff77be Minor, adjust heading
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-06-26 07:01:35 +02:00
Joachim Nilsson 76c2054fa6 Merge pull request #128 from liuming50/dont-hard-code-etc-hostname
Dont hard code etc hostname
2020-06-09 11:30:37 +02:00
Ming Liu 1fa6a98e79 modules-load.c: allow MODULES_LOAD_PATH to be overridden
Define MODULES_LOAD_PATH only when it's unset, this allows it to be
overridden, for instance, by passing CFLAGS.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
2020-06-09 10:54:09 +02:00
Ming Liu a7adff4c4b helpers.c: dont hard code /etc/hostname
Introduce a macro HOSTNAME_PATH instead.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
2020-06-09 10:51:19 +02:00
Joachim Nilsson af6f71abe4 Create SECURITY.md 2020-05-22 09:39:16 +02:00
Joachim Nilsson 9eb8e8dd99 Only track built-in watchdogd, not external ones
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-05-03 12:01:41 +02:00
Joachim Nilsson 23461f1ef5 Track built-in watchdogd immediately after registering it
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-05-03 12:00:35 +02:00
Joachim Nilsson 3b63946973 svc: The 'id' is optional now, lets default it to "" if unset
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-05-03 12:00:28 +02:00
Joachim Nilsson 1eca65fcda plugins: rtc: Move TZ set/unset to rtc plugin from Finit main
This patch makes the RTC plugin a bit more stand-alone, it is now also
back in the hands of the user to set a default timezone.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-05-03 11:04:48 +02:00
Joachim Nilsson b364492a8c Refactor prepare_tty() & C:o, pass tty around
Most of the helper functions around TTYs assumed that STDIN_FILENO was
already set up and unique for the give TTY they operated on.  It turns
out it wasn't.  This patch refactors the open() of TTYs to ensure we
do not clobber our TTY settings with multiple calls to tcsetattr() for
the same TTY.

Took a while to track this one down.  Usually I don't run systems with
more than one TTY, but the Alpine system on my home server did, and boy
I've never been this close to giving up on computers, ever.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-27 01:30:34 +02:00
Joachim Nilsson 484aa0ba97 Fix issue with VINTR, VEOF et al not being restored after boot
On Alpine Linux 3.6 the tcsetattr() calls failed.  This turned out to be
a deeply rooted issue not limited to just musl libc.  The workaround is
to call tcsetattr() in several rounds.  In particular the modem signals,
c_cflag bits, always fail, so we take a bet on Linux having set up the
terminals (hope as a strategy) and ignore that problem, for now.

Also, use TCSAFLUSH with tcsetattr(), that seems to work better and is
what BusyBox stty use.

The local CTL() macro is replaced with CTL() from ttydefaults.h, which
exists also in musl libc.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-26 22:06:59 +02:00
Joachim Nilsson 83078d1947 Ignore ENOENT from realpath(), origin probably moved
The svc_find_by_pidfile() function is called async from the pidfile
plugin, so by the time the queue is processed the origin may have
moved or been removed even.  Safe to ignore.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-26 21:46:24 +02:00
Joachim Nilsson e02f8cf353 Check result of fsck before attempting remounting / read-write
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-26 21:45:12 +02:00
Joachim Nilsson 317fe7aceb Follow-up to e16a6ad: cgroups must be initialized after /sys
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-26 21:41:53 +02:00
Joachim Nilsson 54fd38adcc Default to set TZ=UTC0 for RTC plugin
This patch sets the TZ variable to a sane default, UTC.  Fixing, at
least, the time restore problems of the RTC plugin.

Also, let the C library figure out DST, as the docs say -1 does ...

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-26 21:38:07 +02:00
Joachim Nilsson 5fd5e722a8 Only mount /proc if it isn't already mounted
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-26 15:05:17 +02:00
Joachim Nilsson e16a6ad4f0 Check if /sys exists and only mount if /sys isn't already mounted
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-26 15:04:56 +02:00
Joachim Nilsson 2f87c10cf1 Remount / as read-write as soon as possible (after fsck)
We may need to create directories early, e.g., /sys and directories in
/var that plugins rely on.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-26 14:56:45 +02:00
Joachim Nilsson 389328c99f Allow fsck for read-only mounted filesystems
When starting up a system booted from initramfs / may already be
mounted (read-only), so we can safely fsck it before proceeding
to remount it as read-write later (possibly).

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-26 14:55:38 +02:00
Joachim Nilsson e3884597a5 Delay mount of /proc & /sys to *after* emergency_shell()
In case we run into problems mounting /sys or /proc we should have
signals and the optional emergency shell available for recovery.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-26 14:55:38 +02:00
Joachim Nilsson dc99d8637b Let create() macro return result of operation
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-26 14:55:38 +02:00
Joachim Nilsson 2a4052bd8d plugins: modprobe: Never follow symlinks in /sys/devices
Unlike find(1), nftw(3) defaults to follow symlinks.  For some kernel
configurations this turned out to be detrimental and caused the plugin
to loop forever scanning modalias files.

Also, check if /sys is mounted before even calling nftw().

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-26 14:55:38 +02:00
Joachim Nilsson 3f5ff0d339 Export ismnt() and fismnt() helper functions, for modprobe plugin
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-26 14:55:38 +02:00
Joachim Nilsson 37d92e87bc sig.c: Skip unknown signals, e.g. musl libc does not define SIGCLD
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-26 11:29:19 +02:00
Joachim Nilsson 9d9b6b5201 Update ChangeLog and bump version for v3.2-rc3
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
3.2-rc3
2020-04-23 18:06:25 +02:00
Joachim Nilsson c0b74c5e53 Fix minor build warning for --disable-inetd
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 2b2c6aaf4e docs: Relocate GitHub specific files to .github/
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-23 17:46:22 +02:00
Joachim Nilsson 8ed37f5fa0 Always append /ID to cond if run/task/service is declared with :ID
This patch is a follow-up to the idea introduced in 1d6737e, but this
time we make sure to always append the svc ID to conditions if their
.conf has been declared with :ID

Meaning, the following .conf:

    service :0 /sbin/teamd --config-file /etc/teamd-lag0.conf
    service :1 /sbin/teamd --config-file /etc/teamd-lag0.conf

results in the following two conditions:

    svc/sbin/teamd/0
    svc/sbin/teamd/1

With a custom 'name:foo':

    service name:lag :0 /sbin/teamd
    service name:lag :1 /sbin/teamd

the resulting conditions look even prettier:

    svc/lag/0
    svc/lag/1

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-23 15:22:29 +02:00
Joachim Nilsson 8fe4aad53e Make run/task/service :ID optional, default to zero/NULL
This patch makes the ':ID' field optional when registering non-inetd
run/taks/service etc.  It has always been optional in the .conf files,
but internally we defaulted to ':1'.

To open up for more useful conditions we now default to zero/NULL :ID,
meaning the user now *must* keep track of the :ID field if they have
multiple services with the same name.  This should already have been
an issue since such services would likely have conflicted with their
PID files (same name).  So it's unlikely to affect any user severely.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-23 15:21:28 +02:00
Joachim Nilsson 54e5fd2a78 initctl: Show :ID in process listing(s) only if non-zero
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-23 15:14:09 +02:00
Joachim Nilsson 1d6737eac1 Custom conditions include :ID; 'name:foo :bar' => svc/foo/bar
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-23 09:56:30 +02:00
Joachim Nilsson fa0c2f7050 Custom name:foo will now create condition svc/foo w/o path
When registering a service there is the option to set a custom PID file,
and even tell Finit to maintain that PID file in case the daemon doesn't

Until now there hasn't been a way to create custom conditions though ...

This patch leverages the new 'name:foo' argument to tas/run/services to
trigger condition 'svc/foo' (notice lack of path!) when a custom name is
set and either the default, or the custom, PID file is created.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-23 08:57:12 +02:00