Commit Graph
116 Commits
Author SHA1 Message Date
Joachim Nilsson 1677436137 initctl: Allow C99 style
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-26 10:39:45 +02:00
Joachim Nilsson 56eec5164d Minor, update code comment
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-25 19:02:19 +02:00
Joachim Nilsson d22ffa05bd initctl: Refactor initctl list slightly
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-24 20:41:40 +02:00
Joachim Nilsson 2e66db3fea helpers.c:printv() - Iterate over size of buffer
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-24 20:40:44 +02:00
Joachim Nilsson 686193b701 Only load modules at bootstrap
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-10 14:03:56 +02:00
Joachim Nilsson b43bca529c Minor, fix build error
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-10 13:57:23 +02:00
Joachim Nilsson 545171a8b2 Minor, improve comments in parse_dynamic()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-10 13:50:44 +02:00
Joachim Nilsson d54d5b7f20 Allow kernel modules to be loaded from /etc/finit.d/*.conf
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-10 13:48:07 +02:00
Joachim Nilsson 633a56054b Add support for boot[S]trap services in /etc/finit.d/*.conf
This patch enables support for bootstrap services in /etc/finit.d/

Please note, however, that this does not mean that all configuration
directives are now allowed in /etc/finit.d/*.conf -- the intention is
only to simplify distribution setups.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-10 13:21:11 +02:00
Joachim Nilsson f3a000560f exec_runtask(): Refactor, remove GLIBC:isms to build with musl
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-04 20:05:22 +02:00
Joachim Nilsson 9e7e92b4b7 run stanzas are never caught in service_monitor()
A run stanza blocks operation by calling waitpid(), so it will never be
caught by the service_monitor() function.  Hence, we need to clean up
any bootsrap calls after waitpid(), or at least perform a manual state
change.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-04 16:02:23 +02:00
Joachim Nilsson 29822ef0f7 Always collect bootstrap tasks, regardless of previous runlevel
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-04 16:02:01 +02:00
Joachim Nilsson 718e82bc10 svc_clean_dynamic(): Actually clean dirty services ...
Add missing call to svc_mark_clean() in while() loop.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-04 16:01:05 +02:00
Joachim Nilsson 684314db0f Allow pipe + redirect in task/run stanzas, exec() in /bin/sh
This patch extends the capabilities of task and run .conf stanzas by
enabling pipes and redirects.

Example:

    task [s] echo "foo" | cat >/tmp/bar
    run  [s] echo "$HOME" >/tmp/secret

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-04 16:00:49 +02:00
Joachim Nilsson 8eea64cebf getty: Set $TERM environment variable if given in tty config
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-01 06:41:22 +02:00
Joachim Nilsson b8a7cb6b93 tty-register(): Fix regression in built-in TTY baud + term parser
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-01 06:40:52 +02:00
Joachim Nilsson 529b39ebba tty: Add 'noclear' + 'nowait' options to built-in and external tty's
This patch aligns the two tty configuration stanzas, thus clear and wait
are now the default for both.

    tty [LVLS] <DEV> [BAUD] [noclear] [nowait] [TERM]
    tty [LVLS] <CMD> <ARGS> [noclear] [nowait]

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-01 06:10:08 +02:00
Joachim Nilsson f029ba2111 Reorder functions a bit, group run_getty*() family
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-01 05:50:50 +02:00
Joachim Nilsson 277c3dbb14 getty: Remove TTY clear from built-in getty, delegate to run_getty()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-01 05:47:53 +02:00
Joachim Nilsson f273ecc135 Fix #79: Add 'nowait' option to tty setting, external getty
This patch makes it possible to disable the "Please press Enter" prompt
when using an external getty. Simply append `nowait` to the .conf entry
and Finit will spawn the getty immediately.

A future patch will add support for `noclear` as well to external getty,
as well as a change in default (=> `wait`) for the built-in getty.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-08-31 00:51:11 +02:00
Joachim Nilsson 2fe257b7af getty.c: Handle Ctrl-U properly, erase line to beginning
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-08-30 17:19:43 +02:00
Joachim Nilsson 907595d9ed getty.c: Ignore signals like SIGINT, SIGHUP
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-08-30 17:19:12 +02:00
Joachim Nilsson 55c12aa6f6 Remove developer debug message
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-08-30 15:08:14 +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 dec21e758a Fix #78: Support agetty cmd line format for external getty
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-08-30 14:44:10 +02:00
Joachim Nilsson f7b9b7be96 tty.c: Free memory for external getty on tty_unregister()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-08-27 16:57:26 +02:00
Joachim Nilsson 74affb32d3 tty_register(): Fix parser for external getty
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-08-27 16:43:01 +02:00
Joachim Nilsson 675f82a6b9 run_getty2(): Minor fixes only, whitespace + cautionary _exit()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-08-27 16:41:58 +02:00
Joachim Nilsson 19fcfcfef4 Initial support for external getty
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-08-27 15:02:55 +02:00
Joachim Nilsson 7c50d86a55 Restore pre built-in run_getty() as run_getty2()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-08-27 15:01:42 +02:00
Joachim Nilsson b629348973 Refactor TTY exec, prepare for external getty
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-08-27 15:00:43 +02:00
Joachim Nilsson 054baed134 Reap zombie processes in emergency shell mode, issue #76
The emergency shell is just a Finit debug mode.  This patch adresses a
concern from GitHub issue #76, with zombie processes in this mode.

Emergency shell could be further improved, e.g. informing the real Finit
process of each collected child (zombie) to be restarted if needed.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-08-15 08:09:19 +02:00
Joachim Nilsson b20fafd9fa tty.c: Add support for reloading a single TTY
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-14 11:03:59 +02:00
Joachim Nilsson 62081d9525 tty.c: Refactor, break out enabled check + stop/start
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-14 11:03:10 +02:00
Joachim Nilsson 100b4c70e4 tty_enabled(): Simplify, tty_exists() checks for existence
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-14 10:54:51 +02:00
Joachim Nilsson 14ee218443 Refactor, use libite (-lite) version of initscr()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-09 16:25:22 +02:00
Joachim Nilsson 8aef1e76c3 Follow-up to eec32e2: Support for removing TTYs at runtime
In commit eec32e2 support for reloading TTY configurations was added.
This patch is a follow-up to that with support for cleaning up and
removing allocated TTYs.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-09 15:05:32 +02:00
Joachim Nilsson 44f69bd575 Check if symlink with lstat(), mtime with stat()
With the new scheme using /etc/finit.d/available/, and symlinks from
there to the enabled directory, we need to check mtime of .conf files
using stat(), not lstat() which we need to check if .conf is a symlink.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-09 15:05:32 +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 4cc3aed139 Avoid 2 sec block of Finit when stopping TTYs
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-09 15:05:32 +02:00
Joachim Nilsson d34ee62f77 Update copyright years
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-08 15:32:24 +02:00
Joachim Nilsson e48901b90f tty: Clear tty before login: prompt by default, add 'noclear' option
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-08 15:31:59 +02:00
Joachim Nilsson 60f73dc952 tty.c: Refactor parsing of tty .conf stanza in tty_register()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-08 15:30:51 +02:00
Joachim Nilsson eec32e299b Allow loading TTYs from /etc/finit.d rather than /etc/finit.conf
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-08 15:28:22 +02:00
Joachim Nilsson fe362341dc finit.conf: Remove check config, replaced by fsck over /etc/fstab
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-08 15:01:31 +02:00
Joachim Nilsson 8505db24b7 Refactor, rename local variables
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-08 12:28:52 +02:00
Joachim Nilsson 560adb2065 Remove debug message(s) from tty_fallback()
When the TTY fallback mechanism is enabled tty_fallback() prints this
annoying debug message whenever *any* is process is collected by PID 1:

   "Not starting fallback (%d) shell, lost pid %d", fallback, lost"

This patch removes it, and a two other useless debug messages.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-08 11:06:28 +02:00
Joachim Nilsson 6676d4b50c Silence service start/stop *before* launching TTYs
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-08 11:04:50 +02:00
Joachim Nilsson c1bd3961cf log_init(): If called with debug disbled set (or restore) LOG_NOTICE
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-08 00:11:24 +02:00
Joachim Nilsson 4fa47eaf71 log_init(): If debug mode enabled, set loglevel LOG_DEBUG
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-08 00:08:27 +02:00