aboutsummaryrefslogtreecommitdiff
path: root/data/unity-greeter-session-broadcast-session.conf
blob: db2425cbfd2bc3777c30dc88290dea37f28f7475 (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
33
34
35
description "Unity Greeter Session Broadcast Session Component"
author "Ted Gould <ted@canonical.com>"

task

emits application-start

#TODO: Check GSettings Key
start on dbus BUS=system SIGNAL="StartApplication" INTERFACE="com.canonical.Unity.Greeter.Broadcast" PATH="/com/canonical/Unity/Greeter/Broadcast"

pre-start script
	PATH="/bin:/usr/bin:/sbin:/usr/sbin"

	if [ -z $ARG0 ] ; then
		stop
		exit 1
	fi
	if [ $ARG0 != $USER ] ; then
		stop
		exit 1
	fi

	OWNER=`gdbus call --system --dest org.freedesktop.DBus --object-path / --method org.freedesktop.DBus.GetNameOwner com.canonical.Unity.Greeter.Broadcast | cut -d "'" -f 2`

	if [ -z $OWNER ] ; then
		stop
		exit 1
	fi
	if [ $OWNER != $SENDER ] ; then
		stop
		exit 1
	fi
end script

exec /sbin/initctl emit application-start APP_ID=${ARG1}