diff options
author | Anna (navi) Figueiredo Gomes <navi@vlhl.dev> | 2024-03-20 23:45:47 +0100 |
---|---|---|
committer | Anna (navi) Figueiredo Gomes <navi@vlhl.dev> | 2024-07-19 20:40:28 +0200 |
commit | c34fcd63f05044f9034b26c52f19c91e04668da7 (patch) | |
tree | 8ef449218cf736057197cd39fba1dac6117216c3 /sh | |
parent | 917a7031d946c0b608517936fab0f54689167265 (diff) |
openrc: dynamic paths for user services
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>
Diffstat (limited to 'sh')
-rw-r--r-- | sh/gendepends.sh.in | 19 | ||||
-rw-r--r-- | sh/openrc-run.sh.in | 2 |
2 files changed, 16 insertions, 5 deletions
diff --git a/sh/gendepends.sh.in b/sh/gendepends.sh.in index 5852c772..8ce1c87f 100644 --- a/sh/gendepends.sh.in +++ b/sh/gendepends.sh.in @@ -53,11 +53,21 @@ depend() { : } +_dirs=" + @SYSCONFDIR@/init.d + @PKG_PREFIX@/etc/init.d + @LOCAL_PREFIX@/etc/init.d +" + +if yesno "$RC_USER_SERVICES"; then + _dirs=" + @SYSCONFDIR@/user.d/init.d + ${XDG_CONFIG_HOME:-${HOME}/.config}/openrc/init.d + " +fi + _done_dirs= -for _dir in \ -@SYSCONFDIR@/init.d \ -@PKG_PREFIX@/etc/init.d \ -@LOCAL_PREFIX@/etc/init.d +for _dir in ${_dirs} do [ -d "$_dir" ] || continue @@ -127,3 +137,4 @@ do ) done done +unset _dirs diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in index 5d0eeffa..cd81f3fb 100644 --- a/sh/openrc-run.sh.in +++ b/sh/openrc-run.sh.in @@ -43,7 +43,7 @@ sourcex "@LIBEXECDIR@/sh/functions.sh" sourcex "@LIBEXECDIR@/sh/rc-functions.sh" case $RC_SYS in PREFIX|SYSTEMD-NSPAWN) ;; - *) sourcex -e "@LIBEXECDIR@/sh/rc-cgroup.sh";; + *) yesno "$RC_USER_SERVICES" || sourcex -e "@LIBEXECDIR@/sh/rc-cgroup.sh";; esac # Support LiveCD foo |