summaryrefslogtreecommitdiffstats
path: root/conf/system/afm-user-setup.sh.in
blob: 1b619a0ff12241bf0187b9682f3255f08c97a68b (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' "$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