#!/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@/weston/wayland-0 $udir/wayland-0