diff options
Diffstat (limited to 'sh')
-rw-r--r-- | sh/meson.build | 1 | ||||
-rw-r--r-- | sh/user-init.sh.in | 28 |
2 files changed, 29 insertions, 0 deletions
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" |