aboutsummaryrefslogtreecommitdiff
path: root/sh/user-init.sh.in
blob: a438be551f6c03119f34d1e492dd140519e82882 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!@SHELL@

. @LIBEXECDIR@/sh/functions.sh

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}";;
	*) eerror "no argument given to $0"r exit 1
esac

mkdir -p "$_sysconf/runlevels/$_runlevel"

openrc --user "$_runlevel"