This patch adds a `nologin` flag to the `tty` configuration directive,
making it possible to set up really simple embedded systems with no
login.
Example, put the following line in `/etc/finit.d/getty.conf` to get
a "Please press Enter to ..." prompt before being presented with a
root shell prompt.
tty [12345] @console noclear nologin
Needless to say, this is not very secure, but can be really useful
for developer setups, during board bringup, or similar.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
In f3669c7 the difference between static and dynamic services was
removed. This led to a regression in handling internally created
services for, e.g., dbus-daemon and udevd, mentioned in issue #90.
This patch introduces a "protected" flag for svc_t to prevent the
mark-and-sweep handling of regularly loaded services.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
The new condition triggered hooks requrie /var/run/finit/cond to
be set up before calling the first user-configurable hooks.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
- Add newline to cond generation ID, like PID files, easier when
debugging. Does not affect fscanf() in cond_get_gen()
- Update copyright years
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Until now Finit has used mtime to determine if a file has been changed,
or simply touched to request reload, when `initctl reload` is called.
Using mtime for this purpose is a monumentally bad idea since time can
be changed at any point: a user may adjust the time, NTP continously
tunes the clock, and time stamps are stored as the walltime. So if we
compare timestamps against the last time we (booted or) did reload, we
would miss .conf file changes.
This patch replaces the mtime mistake with an inotify watcher for the
following files: /etc/finit.d/*.conf, /etc/finit.d/available/*.conf,
and /etc/finit.conf. All file changes between (bootstraps and) calls
to `initctl reload` are tracked, like the mtime backend it replaces.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
TIL, using mtimes for tracking event orderings is a monumentally bad
idea (queue the nodding UNIX-beards). Mtimes are in wallclock time which
is not necessarily monotonically increasing. A user may adjust the time,
an NTP daemon will continously tune the clock and so on.
Instead, store an explicit generation number in each condition file,
which will be monotonically increased by finit on each reconf.
The following configuration directives, previously only allowed
in /etc/finit.conf, are now also only allowed in runlevel S, i.e.
at bootstrap:
- host
- mknod
- network
- runparts
- runlevel
This change is in preparation for allowing reload of finit.conf
as well as /etc/finit.d/*.conf, which we already support.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This is a prelude to a major behavioral change. The difference between
a static and dynamic service will be removed in Finit v3.1. This means
all .conf files, including /etc/finit.conf, will be re-read on reload.
However, not all configuration directives will be re-read, some will
only be applicable at bootstrap, i.e. runlevel S.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch moves the networking bit to the latter part of bootstrap,
called finalize(), in favor of starting the event loop earlier.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This change removes a long standing kernel requirement and architectural
mishap in the design of Finit v1. It is no longer necessary to include
CONFIG_SYSVIPC in the kernel to use Finit and its command line tool
initctl. It is also no longer possible to connect to the internals of
PID 1 using shmat(), the initctl tool has already been updated to use
the domain socket API.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This change is one of the required intermediate steps to remove the
shared memory store for all svc_t, this in turn to avoid any external
programs manipulating the internal memory of PID 1.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
For ease of use, allow short forms of commands, like:
initctl h
initctl c d
initctl l
Also, default to show conditions if no argument to cond is given.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
We need the name client.c for the client side of api.c, so let's rename
the client to its traditional name.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Previously UDP packets were never dropped and if a request came
from a not valid interface inetd got stuck in an inifinite
loop looking at the same packet every time and not dropping it.
Signed-off-by: Lennart Eriksson <lennart.eriksson@westermo.se>
This patch fixes the problem with run/task jobs with conditions, run at
runlevel S (bootstrap), not being given enough time to actually start
and run even once.
The new svc counter 'once' is now inspected before transitioning away
from runlevel S to the configured runlevel. A global (currently hard
coded) timeout of 10 sec is given to all run/tasks.
As a spin-off, this patch starts up the event loop much earlier than
before. Meaning the initial runlevel change at boot is now done in
a finalize() callback when all run/tasks have completed, or when the
global timeout has expired. Starting the event loop earlier gives us
the possibility to rely on the pidfile plugin to provide our run/tasks
with the conditions necessary to start.
TODO: What remains is to add similar handling to all runlevel
transitions, not just the initial one at boot.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>