Commit Graph
1211 Commits
Author SHA1 Message Date
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
Joachim Nilsson 670f08ce51 Refactor, move logit() and log macros to log.c + log.h
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-01 20:34:37 +02:00
Joachim Nilsson 82661346b7 Follow-up to 885056a, collapse and simplify code
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-01 20:34:26 +02:00
Joachim Nilsson b2ac81540f Merge branch 'enable-disable-services'
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-01 18:02:52 +02:00
Joachim Nilsson fd861e1691 conf.c: Log warning for dangling .conf symlinks in /etc/finit.d/
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-01 17:52:15 +02:00
Joachim Nilsson 76b5bdc2c4 conf.c: Simplify .conf load/parse debug messages
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-01 16:06:01 +02:00
Joachim Nilsson 0ec5ad6961 TODO: Remember the idea of creating service stanzas using initctl
See issue #69 for a background.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-01 12:18:46 +02:00
Joachim Nilsson 1c2dcd9acc doc: Add distribution recommendations and tips, issue #71
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-01 12:17:57 +02:00
Joachim Nilsson 018a87286c initctl: Sort commands in usage according to topic
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-06-30 12:12:13 +02:00
Joachim Nilsson d0a3b4b019 Note neat feature of Solaris SMF, enable service temporarily
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-06-30 10:41:24 +02:00
Joachim Nilsson 3428cd48b7 Fix #71: Add support for enabling/disabling services in /etc/finit.d
This patch adds support for enabling and disabling services in
/etc/finit.d/ by adding another subdirectory:

    /etc/finit.d/available

Enabled service/run/task stanzas are by convention symlinked
to the parent dir.  The initctl tool has three new convenience
commands to facilitate operating with this:

   initctl list
   initctl enable  <CONF>
   initctl disable <CONF>

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-06-29 22:23:38 +02:00
Joachim Nilsson 023a881fb9 Enable more compiler warnings by default, except unused parameters
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-06-29 22:23:09 +02:00