From fd961d2ea0eea2cc60f4af1aca6b6e7711d43995 Mon Sep 17 00:00:00 2001 From: "Anna (navi) Figueiredo Gomes" Date: Fri, 12 Jul 2024 00:51:12 +0200 Subject: openrc-user: init script for users adds a new multiplexed script for starting user sessions. it also sets up XDG_RUNTIME_DIR. Signed-off-by: Anna (navi) Figueiredo Gomes --- sh/meson.build | 1 + sh/user-init.sh.in | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 sh/user-init.sh.in (limited to 'sh') diff --git a/sh/meson.build b/sh/meson.build index e8849d40..bbc95c25 100644 --- a/sh/meson.build +++ b/sh/meson.build @@ -28,6 +28,7 @@ sh_config = [ scripts_config = [ 'gendepends.sh.in', 'openrc-run.sh.in', + 'user-init.sh.in', ] if os == 'Linux' diff --git a/sh/user-init.sh.in b/sh/user-init.sh.in new file mode 100644 index 00000000..eaedc631 --- /dev/null +++ b/sh/user-init.sh.in @@ -0,0 +1,28 @@ +#!@SHELL@ + +sourcex() +{ + if [ "$1" = "-e" ]; then + shift + [ -e "$1" ] || return 1 + fi + if ! . "$1"; then + eerror "$RC_SVCNAME: error loading $1" + exit 1 + fi +} + +_sysconf="${XDG_CONFIG_HOME:-${HOME}/.config}/openrc" + +sourcex -e "@SYSCONFDIR@/rc.conf" +sourcex -e "$_sysconf/rc.conf" + +case $1 in + start) _runlevel="${rc_user_runlevel:-default}";; + stop) _runlevel="${rc_user_shutdown_runlevel:-none}";; + *) exit 1 +esac + +mkdir -p "$_sysconf/runlevels/$_runlevel" + +openrc --user "$_runlevel" -- cgit v1.2.3