description "Location Services Trust Store Daemon"

# try to start this on session startup or once ubuntu-location-service finished
# starting; if dbus is available and location-service isn't or vice-versa,
# startup will fail but the next event firing will trigger another start
start on (started dbus and xsession SESSION=ubuntu-touch) or \
    indicator-services-start or \
    (dbus BUS=system SIGNAL=NameOwnerChanged INTERFACE=org.freedesktop.DBus OBJPATH=/org/freedesktop/DBus ARG0=com.ubuntu.location.Service ARG2!="") 

stop on desktop-end or \
    indicator-services-end or \
    (dbus BUS=system SIGNAL=NameOwnerChanged INTERFACE=org.freedesktop.DBus OBJPATH=/org/freedesktop/DBus ARG0=com.ubuntu.location.Service ARG2="")

respawn

script
    # XXX LP #1369692
    sleep 2

    exec /usr/bin/trust-stored-skeleton \
        --remote-agent DBusRemoteAgent --bus=system \
        --local-agent MirAgent \
        --trusted-mir-socket=/var/run/user/$(id -u)/mir_socket_trusted \
        --for-service UbuntuLocationService \
        --with-text-domain ubuntu-location-service \
        --store-bus session
end script
