Commit Graph
161 Commits
Author SHA1 Message Date
Joachim Nilsson b68c5c1291 Fix #45: add support for rlimit per service/run/task/inetd/tty
This patch extends the existing rlimit implementation to support setting
limits per service, run/task, inetd, and tty.

Use rlimit in /etc/finit.conf to change the global setting, which is
then inherited to each /etc/finit.d/*.conf.  For each .conf file the
rlimit is reinitialized to the global finit.conf settings.

Also, add `unlimited` keyword, to replace the now deprecated `infinity`
keyword.  The latter is however kept, for compatibility with previous
releases, for the foreseeable future.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-26 16:35:37 +01:00
Joachim Nilsson 3fd45eac7c bootmisc: Handle _PATH_VARDB inconsistency gracefully
Some systems use /var/db while others use /var/lib/misc, we need to
support both and cannot rely on _PATH_VARDB, since it too might not
be set properly.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-14 15:24:25 +01:00
Joachim Nilsson 5af1f05606 plugin: Only close() PID file descriptors >0, skip -1
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-14 14:34:08 +01:00
Joachim Nilsson 6b2678c2ed pidfile: On HOOK_SVC_RECONF the netlink plugin must run first
When performing an `initctl reload` with one (unchanged) service
depending on, e.g. `net/iface/lo`, its condition will not be set
to ON by the pidfile plugin unless the netlink plugin hook runs
first.

Example:

    service <net/iface/lo> /sbin/dropbear ...

Which provides the <svc/sbin/dropbear> condition, will not be
set by pidfile.so during `initctl reload` because dropbear is
still SIGSTP:ed waiting for <net/iface/lo>.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-24 15:55:35 +02:00
Joachim Nilsson faca84a590 Fix GCC 7 string truncation warning, too small temporary buffer
In GCC 7 the -Wall infers the new -Wformat-truncation which finds
problems with string truncation in functions like snprintf().

This patch fixes a problem in condition parsing for very long
PID filenames which might be truncated in internal buffers
causing a mismatch in Finit condition tracking.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-19 09:58:05 +02:00
Joachim Nilsson 920df09cd5 Fix GCC 7 warning, convert "Fall through" to "fallthrough" comment
In GCC 7 the -Wextra infers the new -Wimplicit-fallthrough which can be
suppressed by adding a simple comment

    /* fallthrough */

Which we had, but was too verbose (and misspelled) for GCC to notice.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-19 09:58:05 +02:00
Joachim Nilsson bacaea0e02 bootmisc: Fix misspelled uuidd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-18 10:14:56 +02:00
Joachim Nilsson 07d6e69c30 bootmisc: Check return value from getgroup()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-18 10:10:13 +02:00
Joachim Nilsson d2053bd07d bootmisc: Follow-up to f4662d8
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-18 10:09:15 +02:00
Joachim Nilsson f4662d8c06 boomisc: Create /run/uuid for Void Linux if uuid user exists
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-18 10:05:46 +02:00
Joachim Nilsson 7a2667d34c plugins/dbus: Free cmd returned from which() when done
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-15 23:01:10 +02:00
Joachim Nilsson f39cd50762 plugins/dbus: Use cmd found by which() to start dbus-daemon
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-15 22:48:04 +02:00
Joachim Nilsson ddeed15191 plugins/dbus: Start dbus-daemon with absolut path
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-15 22:45:01 +02:00
Joachim Nilsson b02f241e5e plugin/dbus.c: Minor, documentation
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-15 21:18:21 +02:00
Joachim Nilsson 888ce56f3e plugin/dbus.c: Register dbus-daemon as a service
This patch changes how the D-Bus plugin starts dbus-daemon, from being
started in the background to letting Finit start and monitor it.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-15 20:46:22 +02:00
Joachim Nilsson 6818813ff8 plugins/dbus: Conditionalize, don't run if dbus-daemon is missing
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-13 08:02:59 +02:00
Joachim Nilsson c8d8c817e7 Minor, cleanup
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-11 21:29:21 +02:00
Joachim Nilsson 448c6749d6 Add missing debug calls to RTM_NEWLINK and RTM_DELLINK
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-10 22:53:19 +02:00
Joachim Nilsson a2f4b35e4e Fix #77: Remove deprecated startx and user .conf settings
It is strongly recommended to instead use the service stanza to start
XDM/GDM, or use startx after a regular login.

Note: the `user NAME` setting was always reserved for use with startx

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-08-30 15:01:05 +02:00
Joachim Nilsson 963b736d8b tty: Refactor, remove useless runlevel argument
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-09 15:05:32 +02:00
Joachim Nilsson 6f61e8e915 Remove hard-coded paths to system tools available in $PATH
Since at least a44daf2 both run() and run_interactive() can access all
system tools in _PATH_STDPATH.  A system that uses non-standard paths,
e.g. /system/bin and /apps/bin, should update _PATH_STDPATH.

For reference, see issue #69 and PRs #70 and #72.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-03 13:18:42 +02:00
Joachim Nilsson 9c6e046d93 Remove hard-coded paths to system tools available in $PATH
This patch implemements a new feature of libite v1.9.1, whichp(), which
instead of fexist() that requires an absolute path, searches $PATH.

For reference, see issue #69 and PRs #70 and #72.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-03 13:13:55 +02:00
Joachim Nilsson 30822f0d68 Remove UNUSED() macro and disable the compiler warning instead
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-02 21:59:23 +02:00
Joachim Nilsson a31ecb32e1 Fix problem with building from a separate build directory
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-06-05 01:07:47 +02:00
Joachim Nilsson a0e17c8f47 Relocate create() from bootmisc plugin to helpers.h
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-01-25 19:40:06 +01:00
Joachim Nilsson 1d39decaf1 Update .gitignore files
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-01-16 07:32:09 +01:00
Joachim Nilsson fff68b7b06 Relocate source files to an src/ subdirectory
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-01-16 01:31:02 +01:00
Joachim Nilsson 044ded3045 Fix #61: Reassert net/* conditions after initctl reload
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-01-16 01:09:06 +01:00
Joachim Nilsson 0cccc629bf pidfile: Ensure svc is always followed by a slash
A service need no longer be fully qualified path.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-01-16 01:02:40 +01:00
Joachim Nilsson 57181264e9 pidfile: Make sure to set a default name for plugin
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-01-16 01:02:16 +01:00
Joachim Nilsson 4321038518 bootmisc: Minor refactor
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-01-16 00:59:32 +01:00
Joachim Nilsson d5942f3267 Minor whitespace fixes
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-01-11 17:40:10 +01:00
Mattias Walström 816aa9a17c pidfile: Run the reconf-callback again until no application are in flux
If a service depend on the service last in the list the application
will be kept in flux state forever.

Signed-off-by: Mattias Walström <mattias.walstrom@westermo.se>
2017-01-11 16:25:04 +01:00
Joachim Nilsson 892ac2edb2 Fix #47: Relocate sysctl.conf setup to procps plugin
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-12-08 08:17:38 +01:00
Joachim Nilsson 1dc67acd40 chargen: Make sure to check target buffer size
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-12-05 08:37:41 +01:00
Joachim Nilsson b9ae4d04ef bootmisc: Replace homegrown desym() with realpath()
Followup to issue #49.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-11-21 15:01:59 +01:00
Joachim Nilsson 47060c9738 bootclean: Resolve any symlinks in tmpfs check
Followup to issue #49.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-11-21 09:41:30 +01:00
Joachim Nilsson 846692ca03 Fix #49: Skip tmpfs directories at bootclean
We can safely skip tmpfs, nothing to clean from previous boot there.
In fact, if we clean it we may spoil things for udev, which saves
pre-boot files in /run/udev.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-11-20 19:29:42 +01: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 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 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 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
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 f9732a6fb9 Fix warnings: type mismatch and unused parameters
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-18 10:27:03 +02:00