When calling `initctl -b create` from a start script at bootstrap you
risk blocking the boot since Finit currently cannot reply to IPC during
that period.
This patch allows -f to override this builtin check for the following
initctl commands:
- touch
- show
- edit
- create
- delete
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
When the /etc/finit.d/enabled directory is a symlink elsehwere, e.g.,
/var/finit.d/enabled, a relative symlink will not work.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This change adds support for a new command line option finit.config=PATH
which can be used to tell Finit to start with /etc/factory.conf instead
of /etc/finit.conf.
For the complete experience a new top-level configuration file directive
`rcsd PATH` has aslo been added. It in turn can be used by factory.conf
as follows to override /etc/finit.d:
rcsd /etc/factory.d
Manually verified in myLinux
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This change diversifies the exit codes used by initctl on fatal errors.
Previously only Std C codes 0 and 1 were used, with the initctl specific
255 for some cases.
Both the LSB init script codes and BSD sysexits.h codes are used. See
util.c exitcodes[] for the full list. The idea is to complement the
change in 9a76f08, issue #266, so that initctl can be used silently for
scripting purposes.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This patch introduces ERR(), ERRX(), WARN(), and WARNX() as replacements
to their lower case counterparts. These log macros respect the 'quiet'
flag to initctl, leaving only the return code as indicator to user.
Fixes#266
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Explicitly set arg to non-NULL value. The call to conf() later will
steer up the value to point to the full path of the user's finit.conf
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Due to an unfortunate name clash with the DirectFB project LiTE, the
libite (-lite) project had to change its header namespace from
lite/*.h -> libite/*.h
This patch adds support for the new namepace in Finit, triggered by the
define _LIBITE_LITE, from the .pc file read by pkg-config. This should
only be needed on systems that install libite without the compatibility
symlink lite -> libite/ in the staging include directory.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
- List /etc/finit.conf
- Allow edit of /etc/finit.conf, using finit/finit.conf or NULL
- Add helpful question to edit /etc/finit.conf if no edit arg.
- Show available files if delete has no arg, like disable
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
For commands like `initctl show foo`, initctl looks in the available/
subdirectory for `foo.conf`. This patch adds support for falling back
to return `/etc/finit.d/foo.conf` if the service doesn't exist in the
`/etc/finit.d/available/` subdirectory.
Static services, outside of the `enabled/` handling, live in the base
dirctory and this is what you expect from the tool. "Do what I mean"
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
- Decleare some return values with (void)fn(), for cases where
we don't care (dropping table headers), or best effor
- Check return value from fgets() and chdir() in some cases that
are valid, i.e., continuing execution is pointless
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
If mg doesn't exist, command doesn't evaluate the second argument (vi),
so we need to use `... || command -v vi` instead. Found during demo,
because why not.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Turns out that on some systems, that has none of the first two, and
neither of the two environment variables set in ${VISUAL:-${EDITOR}},
they evaluate to 'sh /etc/finit.d/file.conf', which is true, so we
wouldn't even try mg or vi ...
This patch reverts to the spirit of Andreas Egebergs initial commit,
which turns out to be a better solution anyway :)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
A system may, or may not, have the available/ and enabled/
subdirectories in /etc/finit.d. This is up to distros but
we support the following, example uses /etc/finit.d as the
FINIT_RCSD base directory:
1. No subdirectories
- enable: nop
- disable: nop
2. Only available/
- enable: checks if there's a service in available/
then symlinks to /etc/finit.d/
- disable: checks if service in /etc/finit.d is a
symlink, then removes it
3. Both available/ and enabled/
- enable: relative symlink in enabled/ is created if
service is available in available/
- disable: symlink in enabled/ is removed if exists
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>