aboutsummaryrefslogtreecommitdiffstats
path: root/conf/system/afm-user-setup.sh.in
blob: e1c107060d2b7aa05be3e3c252808bdcbc8bee6e (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
31
32
#!/bin/sh

uid="$1"
bdir=/run/user
udir="$bdir/$uid"

dodir() {
	local x smackset="$1"
	shift
	for x; do
		test -e "$x" || mkdir -m 700 "$x"
		chmod 700 "$x"
		chown "$uid:$uid" "$x"
		chsmack $smackset "$x"
	done
}

dodir '-T -a User::App-Shared' "$bdir" "$udir"
dodir '-t -a User::App-Shared'  "$udir/usrshr"
dodir '-T -a System::Shared' "$udir/apis"
dodir '-t -a System::Shared' "$udir/apis/ws" "$udir/apis/link"

doln() {
	if ! test -e "$2"; then
		ln -sf "$1" "$2"
		chown -h "$uid:$uid" "$2"
		chsmack -a 'System::Shared' "$2"
	fi
}

doln @afm_platform_rundir@/display/wayland-0 $udir/wayland-0