Skip to content
Snippets Groups Projects
setenv-@MOD@ 1.03 KiB
Newer Older
Eric Vidal's avatar
Eric Vidal committed
[main]
@type = oneshot
@name = setenv-@MOD@
@description = "Set well-know variable for @MOD@ user"
@user = (root)

[start]
@build = auto
@runas = @MOD@
@execute = 
(
	execl-subuidgid
	backtick -n HOME { homeof @MOD@ }
	importas -u HOME HOME
	redirfd -w 1 ${HOME}/.66/conf/boot-user-@MOD@.conf

	## GENERAL VARIABLES

	if { 66-echo HOME=${HOME} }
	if { 66-echo LOGNAME=@MOD@ }
	if { 66-echo USER=@MOD@ }

	foreground { 
		importas PATH PATH 
		66-echo PATH=${PATH} 
	}
	foreground {
		backtick -D /usr/bin/sh -n shell {
			pipeline { getent passwd ${UID} }
			cut -d: -f7 
		}
		importas -u shell shell
		if { 66-echo SHELL=${shell} } 
	}

	## DBUS

	if { 66-echo DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${UID}/dbus }

	## XDG variables
				
	if { 66-echo XDG_RUNTIME_DIR=/run/user/${UID} }
	if { 66-echo XDG_CACHE_HOME=${HOME}/.cache }
	if { 66-echo XDG_CONFIG_HOME=${HOME}/.config }
	if { 66-echo XDG_DATA_HOME=${HOME}/.local/share }
	if { 66-echo XDG_DATA_DIRS=${HOME}/.local/share:/usr/local/share:/usr/share }
	66-echo XDG_SESSION_CLASS=user

)