Commit Graph
1190 Commits
Author SHA1 Message Date
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
Joachim Nilsson 36f38d5a13 initctl: Only append space between args, not at last arg
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-06-29 22:21:33 +02:00
Joachim Nilsson d4001064a0 configure: Fix hard coded FIFO path, found by previous commit
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-06-11 22:52:09 +02:00
Joachim Nilsson fffdad7645 configure: Add neat summary of settings, from lldpd
Hat tip to @vincentbernat

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-06-11 22:19:54 +02:00
Joachim Nilsson 32612929d9 doc/conditions.md: Attempt to clarify PID file dependency handling
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-06-10 19:49:36 +02:00
Joachim Nilsson d49683cfb6 TODO: Update and clarify introduction a bit
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-06-10 19:46:19 +02:00
Joachim Nilsson 9ca5ec16af doc/config.md: Minor refactor to add an Introduction section
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-06-10 19:44:48 +02:00
Joachim Nilsson 7041813966 Update Makefile after service script move
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-06-05 01:08:46 +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 b1ea279940 Move helper script 'service' to contrib/
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-06-05 01:00:40 +02:00
Joachim Nilsson 82172e65fa Fix indentation
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-06-05 00:56:24 +02:00
Joachim Nilsson dfedb231dc Add MIT license badge to README
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-06-05 00:54:45 +02:00
Joachim Nilsson 5f5be8d74e Merge pull request #73 from westermo/wmo/inetd-remove-ntoh-on-proto
inetd: remove ntoh on proto
2017-04-25 13:34:19 +02:00
Petrus Hellgren fafeaf661a inetd: remove ntoh on proto
getprotobyname() returns p_proto in host endian, so it should not be
converted with ntoh. (Note: getservbyname() on the other hand does
return s_port in network endian)

Signed-off-by: Petrus Hellgren <petrus.hellgren@westermo.se>
2017-04-25 10:39:09 +02:00
Joachim Nilsson 06d3161ffe Merge pull request #72 from abucodonosor/master
Some cleanup

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-03-28 18:43:32 +02:00
crazy 885056a6c9 networking(): check first ifup exists
Check first ifup exists before using it since
   this is really something only exits on some
   distros an in different ways. Debian/Ubunu has
   an package for this while others have it in the
   initscripts package(s) , meaning the file can be
   around even without the prog.

Signed-off-by: crazy <crazy@frugalware.org>
2017-03-28 13:21:20 +02:00
crazy a44daf20cb finit.c: set _PATH_STDPATH much earlier
This should allow us to run 'prog' without
     absolute paths.  Eg:

     run("/bin/foo"); -> run("foo");

     However we still need absolute PATH for
     checking since fexist() need full path right now.

Signed-off-by: crazy <crazy@frugalware.org>
2017-03-28 13:21:18 +02:00
crazy 67435d2034 finit.h: added fallback for _PATH_{STDPATH,VARRUN} in case is not defined
That should never be needed , however I saw
  already systems with broken paths.h so better
  have something around in case something breaks.

Signed-off-by: crazy <crazy@frugalware.org>
2017-03-28 13:21:14 +02:00
Joachim Nilsson cd5348dffd Add a set of contributing guidelines
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-03-21 07:58:57 +01:00
Joachim Nilsson 6e4b698fac Add Code of Conduct document
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-03-21 07:49:19 +01:00
Joachim Nilsson c135a83cb3 Check if /proc/bus/usb exists before trying to mount it
Most newer kernels have usbfs disabled by default.
See issue #69 for details.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-03-20 20:41:09 +01:00
Joachim Nilsson 37d391d53a doc/build.md: Remove mention of --enable-embedded configure option
As suggested in GitHub issue #68.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-03-17 16:55:02 +01:00