Age | Commit message (Collapse) | Author |
|
when generating back references, attempt to instantiate missing
services.
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
in preparation for dynamic service discovery, modularize the dependency
tree generation and update into distinct functions. also helps with
readability.
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
since it's not possible to differentiate the option set from an user
configuration file versus the system wide, for user-mode openrc, use
XDG_STATE_DIR (~/.local/state) unconditionally for now.
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
it's created in /run/openrc/dynamic and linked to the service in /etc at
login.
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
some changes for code redability, and fixing leaking the whole internals
of the deptree at the end of rc_deptree_update.
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
use the realpath of the target to locate which sysconf dir it's in,
using it as a base to load the config file. the service path is then
normalized from the symlink without dereferencing it.
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
adds a new multiplexed script for starting user sessions. it also sets
up XDG_RUNTIME_DIR.
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
add two api functions, `rc_service_dir` and `rc_sysconf_dir`, both are
generate paths (and sub-paths) for resources, and meant to replace the
hardcoded variables like `RC_SVCDIR`.
those functions differ by dynamically switching between the system path,
or the user path, set in their home folder or runtime directory.
this lays out the intial support for user services.
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
Bash completion has two official completion directories:
- completionsdir, a lazy loading mechanism
- compatdir, an eager loading mechanism
Modern style is to use lazy loading if possible. It is modern
technology, speeds up your shell by deferring loads, and is generally
recommended for applications to prefer by default. It requires you name
your completion script using the same name as the command to complete.
Every distro prefers you do this, but only because bash-completion
itself does.
The openrc-service-script completion doesn't provide a completion for a
command called openrc-service-script. It cannot use the lazy loading
mechanism and emits a warning in Gentoo's policy lints as a result.
Installing to the completionsdir is therefore a useless no-op. Better to
install nothing.
The compatdir is the correct location for completions that cannot be
lazy loaded and must be loaded at shell startup in order to correctly
register themselves for a globbed list of commands that can only be
ascertained dynamically at shell startup. The alternative is to have
every command that can be globbed install a symlink to
openrc-service-script, and install openrc-service-script to a third
location.
|
|
X-Gentoo-Bug-URL: https://bugs.gentoo.org/925409
|
|
Use heap allocations instead. This avoids warnings:
```
../src/librc/librc.c: In function ‘rc_service_mark’:
../src/librc/librc.c:817:58: warning: ‘/’ directive output may be truncated writing 1 byte into a region of size between 0 and 4095 [-Wformat-truncation=]
817 | snprintf(was, sizeof(was), "%s/%s/%s",
| ^
../src/librc/librc.c:817:25: note: ‘snprintf’ output 3 or more bytes (assuming 4098) into a destination of size 4096
817 | snprintf(was, sizeof(was), "%s/%s/%s",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
818 | file, dir->value, base);
| ~~~~~~~~~~~~~~~~~~~~~~~
../src/librc/librc.c:822:58: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
822 | snprintf(was, sizeof(was), "%s/%s", file, dir->value);
| ^
../src/librc/librc.c:822:25: note: ‘snprintf’ output 2 or more bytes (assuming 4097) into a destination of size 4096
822 | snprintf(was, sizeof(was), "%s/%s", file, dir->value);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
|
|
|
|
|
|
|
|
|
|
Remove the mention of linking with libtermcap from einfo(3), and fix
some comments in libeinfo.c to more accurately reflect the new
situation.
|
|
Remove the curses code and make the HAVE_TERMCAP-gated "fallbacks"
always present. This makes an ANSI terminal required for colors.
X-Gentoo-Bug: https://bugs.gentoo.org/904277
Closes: https://github.com/OpenRC/openrc/issues/619
|
|
|
|
Two issues here:
* The 'split-usr' meson option wasn't doing anything, it tried to check
if /bin was a symlink, but nothing acted on this information.
* The actual rootprefix default was decided based on whether /bin was a symlink
which is flaky if e.g. building on a merged-usr system for use on a non-merged-usr
system.
People can set -Drootprefix=/usr if they wish.
There's no real advantage to installing to /usr over / as the compat. symlinks
are really here to stay. If someone really does care about this, they can bring
it back and do it properly, but it doesn't seem worth it to me at all.
Bug: https://bugs.gentoo.org/927776
Fixes: cc0037e9caaee05af0fdedafc5798c2a7aa9bdb8
Fixes: f2362cc277023550b2482215b4a1cd7142639427
Fixes: #696
|
|
|
|
|
|
This fixes #684.
|
|
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
|
|
were made.
|
|
This close #664
|
|
|
|
|
|
|
|
This binary is a copy of the openrc binary. Referring to it as rc was
deprecated in 2016, so we should be able to drop it at this point.
|
|
Fixes the problem described in https://bugs.gentoo.org/916947 -
start-stop-daemon hangs in infinite loop when stopping some daemons on
linux 6.6+
It appears linux 6.6 reworked tmpfs, and since then it triggers this
problem in openrc: when iterating over files via readdir, running rename
on a file could result in reading the same file again with next readdir
call.
The Open Group manual for readdir explicitly states "If a file is
removed from or added to the directory after the most recent call to
opendir() or rewinddir(), whether a subsequent call to readdir() returns
an entry for that file is unspecified.". Linux man page don't seem to
mention that, but don't seem to say anything to contradict that either.
So I presume we can't rely on some specific behaviour here.
Bug: https://bugs.gentoo.org/916947
|
|
965de92b37cbe8d8670f6cc956e1d10677551e19 changed the default cgroup mode which
exposes an issue in init.d/cgroups.in.
While mount_cgroups defaults to 'unified' if rc_cgroup_mode is unset, cgroup2_controllers
has no default and therefore has a mismatch with the logic in mount_cgroups. The
two should be consistent so the flow makes sense, as mount_cgroups expects a certain
path to be taken in cgroup2_controllers.
Make cgroup2_controllers default to 'unified' if rc_cgroup_mode is unset, just
like mount_cgroups.
Bug: https://bugs.gentoo.org/916964
Thanks-to: acab@digitalfuture.it
|
|
|
|
|
|
|
|
|
|
This improves resource management by assigning services to individual
cgroups.
X-Gentoo-Bug: https://bugs.gentoo.org/914972
|
|
When building on embedded SDKs such as Buildroot or Yocto, if OpenRC has a
previous installation, the package will fail the installation step as the
openrc-init is already a symlink to "${DESTDIR}/${sbindir}"/init. Force
symlinking to prevent errors when reinstalling the package.
|
|
With the addition of logger process redirect in supervise-daemon,
pipes.c and pipes.h are now included in both s-s-d and supervise-daemon.
Thus it makes sense to move the source files to the src/shared dir.
|
|
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.
|
|
|
|
|
|
Add fallback for the close_range syscall wrapper. This is needed for
musl libc, which currently does not have a close_range wrapper.
Also set errno on errors.
|
|
Set file descriptors to CLOEXEC instead of closing them before exec,
similar to what we do in supervise-daemon.
Use the share cloexec_fds_from() helper for this.
closefrom() is no longer used so remove the test.
|
|
Move logic to set file descriptors to a cloexec_fds_from() function in
misc.c so it can be shared by both supervisor-daemon and
start-stop-daemon, and hide the details behind.
|
|
Use HAVE_CLOSE_RANGE to tell if system provides a close_range(2)
wrapper, which better explains the purpose.
Add a compat inline which returns -1 if close_range is unavailable.
|
|
It is apparently for a piece of code that no longer exist.
There don't seem to be any part of the code referring to this directory (anymore, if there was).
|
|
|