Now that the bug that made it fail is fixed, use the
start-stop-daemon readiness notification mechanism when
launching s6-svscan.
(We do not run s6-svscan under supervise-daemon because that
would needlessly lengthen the supervision chain. Yo dawg,
we heard you like supervisors.)
In order to avoid breaking things for the 3 users who use the old
s6 support, add compatibility.
When command= is empty and a service directory exists in /var/svc.d,
use that service directory instead of creating it from the service
file data.
this turns mouninfo into a multicall binary which can also do
parallel unmounting. most mountinfo code is unchanged; only
notable change is find_mounts() now returns the number of mounts
found and also takes the "process" function as an argument; so
that is_mounted() can be implemented on top of it.
do_unmount mostly follows the logic of previous code. some
notable changes:
- do_unmount is now "lazy" when it comes to retrying failed
unmounts. it will greedily keep running unmount as long as it
can before it looks at the "waiting" queue.
- it will check if the mountpoint is still mounted or not when
umount returns non-zero exit code. this is due to the fact that
multiple umount calls might race to unmount a shared mount. so
if umount fails _but_ the mountpoint is no longer mounted, we
assume success.
- do_unmount used to fail if fuser did not find any pids using
the mount. the new code tries one more time; the rationale being
that there's a gap between the umount call and the fuser call,
and so whatever was using the mount before might have stopped
using it now and so it's worth another attempt.
Fixes: https://github.com/OpenRC/openrc/issues/662
Closes: https://github.com/OpenRC/openrc/pull/698
_eindent() already limits the width, so the additional limit in eindent
is not needed. It also prevented proper alignment of corresponding
eindent and eoutdent calls when the limit was exceeded.
This commit modernizes the support for the supervisor=s6
backend. It reworks how the supervision tree is started and
how the services are defined.
The s6-svscan service now runs its own catch-all logger,
logging to $RC_SVCDIR/s6-logs.
A service defining supervisor=s6 now has an automatic "need"
dependency to s6-svscan. A service directory will be automatically
built from the information in the service file, under the
$RC_SVCDIR/s6-services repository. These service directories are
cached until the service file (or config) changes. So, services
don't need to provide their service directories themselves
anymore; they still can, but they'll need to do the s6-sv[un]link
thing themselves.
The documentation has been updated.
Anna, please add yourself to the AUTHORS file, because it is
ridiculous that I am now in it and you are not.
readiness notification is experimental, and imo naming it 'ready' was a
mistake, most other projects call them notify-fd, notify-socket, etc
systemd's protocol in particular, we plan to support a few more keys
than just "READY=1" (namely "STATUS" to begin with), so 'notify' is a
better variable name in my view
this means users can reliably do checks like `--ifstarted status` from
profile scripts at login, and be sure certain environment variables can
be set as the listening services for them will already be running if
they're on the boot user runlevel
instead, move caches to /var/cache/openrc. If /var is not mounted, cache
will not be used and the deptree would be regenerated
user services use ${XDG_CACHE_HOME}/rc, defaulting to ~/.cache
Closes: https://github.com/OpenRC/openrc/issues/339
OpenRC already supports redirecting standard output/error of services.
This patch adds support for redirecting standard input as well. I
encountered the lack of this feature while working on a user service for
a Wayland compositor status bar which reads status text to be displayed
from stdin. Input redirection allows me to connect this user services to
another user service providing the status text via a named pipe.
Note that input redirection is also supported by SystemD (and
potentially other service supervisors) through the `StandardInput=`
directive [1].
[1]: https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#StandardInput=
Without this patch, OpenRC loads user configuration files for
system-supplied services from `~/.config/rc/$SERVICE` instead of
`~/.config/rc/conf.d/$SERVICE`. Since the latter is documented in the
user-guide, and used for user services not supplied by the system, I
believe it to be the correct location.
Note that the `_usr_conf_d` variable is probably a bit inappropriately
named as the similarly named `_conf_d` points to the system conf.d
directory while `_usr_conf_d` points to the base rc configuration
directory. Therefore, while at it, rename `_usr_conf_d` to `_usr_conf`
to avoid this confusion in the future.
This is a fixup for ae9d743207f27481efe2c80593eea51cd8742ab2.
This change removes the ROOTPREFIX build setting.
If your OS expects to have / mounted earlier in the boot process than
/usr, you will need to pass the appropriate directory settings to "meson
setup" as part of the build process, for example:
$ meson setup \
--bindir /bin --libdir /lib64 --libexecdir /lib --sbindir /sbin \
build
also, move plugins to ```libdir/rc/plugins``` which is the standard
location for plugins accessed via dlopen.
Some services, like docker, creates and manages /sys/fs/cgroup/<service>
themselves. Avoid conflict with the openrc created cgroup path by adding
a `openrc.` prefix.
Fixes: https://github.com/OpenRC/openrc/issues/680
Allows redirecting process stdin and stdout to another process,
just like is already possible with start-stop-daemon.
Also added --stdout-logger and --stderr-logger to the man page.
If supervise_daemon_args is not set *or empty*, it defaults to
`start_stop_daemon_args`. This is bad because supervise-daemon doesn't
accept the same options as `start-stop-daemon`. So if we set e.g.
`start_stop_daemon_args="--wait 50"`, but not `supervise_daemon_args`,
and the user adds `supervisor=supervise-daemon` to the corresponding
/etc/conf.d/<service> file, the service will fail to start due to
unrecognized option "wait".
It would be best to remove this fallback, but that might break some
existing scripts that depend on it. So this commit just changes it to
use `start_stop_daemon_args` as the default for `supervise_daemon_args`
only if `supervise_daemon_args` is not set at all, but not if it's
empty.
This at least simplifies workarounds; we can just add
`supervise_daemon_args="$supervise_daemon_args"` to init scripts.
This fixes#558.
previously broken in 6034866d1c74d5a23eb9f3e0ebf40c9d278aac93
caused *_logger options to be passed unquoted, so
`error_logger="logger -t .."` would pass -t to s-s-d and fail to start
the service.
Fixes: #531
- drop old build system
- move shared include and source files to common directory
- drop "rc-" prefix from shared include and source files
- move executable-specific code to individual directories under src
- adjust top-level .gitignore file for new build system
This closes#489.
This add No New Privs flag for start-stop-daemon and supervise-daemon
by adding --no-new-privs flag. As a result, the user set the No New
Privs flag for the program should run with.
see PR_SET_NO_NEW_PRIVS prctl(2)