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