Commit Graph
1222 Commits
Author SHA1 Message Date
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
Joachim Nilsson e5f47024af early_logit(): If debug mode enable, also print to stderr
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-08 00:07:49 +02:00
Joachim Nilsson 115b5f1ca7 Add HOOK_BANNER for plugins to override the default Finit banner()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-08 00:07:21 +02:00
Joachim Nilsson 878885e2b2 Load plugins much earlier, for future banner plugin
This patch moves the plugin loader much earlier, making it possible to
provide a custom banner/logo in a plugin.

To facilitate this move we need to also move banner later and parsing
of the kernel cmdline earlier, right after mouting /proc.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-08 00:05:07 +02:00
Joachim Nilsson 709e4230c8 plugin: Add private method plugin_exists() to check for HOOKs
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-07 23:33:43 +02:00
Joachim Nilsson 46c5e41b68 README: Reduce indentation of code blocks, use ``` instead
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-07 23:18:06 +02:00
Joachim Nilsson 0b43d0dc70 Refactor screen_init(), preparing for migration to libite
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-07 23:00:27 +02:00
Joachim Nilsson 99f3f0291a Makefile.am: Fix cut-and-paste error
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-04 21:48:16 +02:00
Joachim Nilsson 6d3d190134 reboot: Add search path to libite (-lite) headers and .so
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-04 21:40:46 +02:00
Joachim Nilsson 769659767c Minor, comment fixes only
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-04 21:12:54 +02:00
Joachim Nilsson 99818f9ce0 Convert banner() and printv() to use new screen_init() values
This patch changes the traditional look of the Finit boot sequence.
Now we stick to the screen width probed by screen_init(), or max
132 chars.

Also, some minor cleanup of the currently unused print_timestamp()
method used by printv() when showing [ OK ] or [FAIL] of services
at boot.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-04 20:59:49 +02:00
Joachim Nilsson be6f0de0df Add util.c:screen_init() to probe screen size once per boot
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-04 20:58:43 +02:00
Joachim Nilsson 405cf4d997 initctl: Use actual terminal/screen width for table listings
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-04 12:55:34 +02:00
Joachim Nilsson 91480a0f02 configure: Check for termios.h, needed by screen_width()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-04 12:55:10 +02:00
Joachim Nilsson 90793c71a2 util: Import screen_width() developed for the SMCRoute project
This patch introduces the screen_width() method from the SMCRoute
project.  The code is hereby also available under MIT/X11.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-04 12:53:19 +02:00
Joachim Nilsson 9bcb3e5778 initctl: top:ify table headings, i.e. use captial letters
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-04 12:39:41 +02:00
Joachim Nilsson c97e23bd58 initctl: Remove currently unused -d debug flag
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-04 12:38:22 +02:00
Joachim Nilsson 73f1b986dd initctl: Fix regression in initctl utmp
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-04 12:37:59 +02:00
Joachim Nilsson b06502b0cb initctl: Use printheader() from libite for table headings
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-04 12:37:20 +02:00
Joachim Nilsson c4b6fab3f3 Travis-CI: Update with latest version of libite, v1.9.1
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-03 16:46:52 +02:00
Joachim Nilsson 109b5bb9df Update TODO, some completed and some deprecated features
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-03 15:16:36 +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 e46e3cdcb6 log.c: Filter debug messages by default, like before refactor
Ways to log:
- Set debug, using kernel cmdline, or edit the sources
- Change loglevel severity, default blocks > LOG_NOTICE

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-02 21:56:19 +02:00
Joachim Nilsson 260335a19f Usability, a servivce stopped by a user is stopped, not blocked
The generic term for a non-running service is blocked, but a service may
be blocked for several different reasons.  When a user stops a service
with `initctl stop` the intuitive expected output from `initctl show` is
"stopped" not "blocked".

When the user later restarts the service with `initctl start` it may of
course be blocked due to wrong runlevel or a missing condition.  As can
be expected from the service's configuration.

The rest of the patch refactors the internal API names a bit to reflect
this change.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-02 15:42:44 +02:00
Joachim Nilsson 516dbcc512 Remove --disable-quiet and quiet mode, default to a sane behavior
This patch is a follow-up to 1f1c2e0 which introduced the new semantics
for the very confusing quiet and silent modes.

The initial idea was to loosely follow the kernel cmdline 'quiet' option
and as a working concept this was good.  The resulting code, however,
became unnecessarily complex and the configure options impossible to
explain.

With this patch the quiet mode, and thus the --disable-quiet configure
option, is removed.  Finit now defaults to a sane behavior: services are
shown only at startup.   The --enable-silent option works like it did
before, silencing everything.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-02 13:40:54 +02:00
Joachim Nilsson 7a48240856 log.c: Do reopen syslog() when toggling debug => LOG_PERROR
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-02 13:19:22 +02:00
Joachim Nilsson cda5938215 helpers.c: New function, printv()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-02 12:43:41 +02:00
Joachim Nilsson cd947a69a8 log.c: New functions to hide access to quiet and silent flags
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-02 12:42:44 +02:00
Joachim Nilsson 60df2f2ea9 Minor, cleanup old requirement for clients to set silent
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-02 12:41:23 +02:00
Joachim Nilsson 51e1a907e6 log.c: New log_is_debug() function, hide access to debug variable
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-02 12:40:50 +02:00
Joachim Nilsson e9d5512e1a Refactor, simplify ... print() APIs already check if silent
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-02 12:38:35 +02:00
Joachim Nilsson bd54cf6dee log.c: New log_init() function, called at initial bootstrap
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-02 12:34:12 +02:00
Joachim Nilsson 1036c365b8 log.c: New log_exit() function, called at shutdown
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-02 12:31:38 +02:00
Joachim Nilsson 8ce330bcdb log.c: Rename log_toggle_debug() --> log_debug()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-02 12:28:16 +02:00
Joachim Nilsson 8161e8d153 Simplify log message from kernel cmdline parser
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-02 01:26:36 +02:00
Joachim Nilsson ec52a6a240 Set correct syslog() log level based on debug flag
Also, refactor logging to /dev/kmsg to separate function.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-01 22:23:53 +02:00
Joachim Nilsson 9a4f46dba4 Install log.h for external plugins
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-01 20:36:47 +02:00
Joachim Nilsson 5e8cb63f9a Refactor, _d() et al to use logit() instead of err.h
This patch is the first in a series of changes to clean up the internal
logging APIs of Finit:

  1. Convert log macros to use logit() for everything (this patch)
  2. Set correct syslog() log level based on debug flag
  3. Do closelog()/openlog() when toggling debug flag to control LOG_PERROR

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-01 20:34:37 +02:00
Joachim Nilsson d1df837d04 Refactor, move debug toggle to log.c:log_toggle_debug()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-01 20:34:37 +02:00