#!/bin/bash
# Contact: Pekka Lundstrom  <pekka.lundstrom@jollamobile.com>
#
# Copyright (c) 2013, Jolla Ltd.
# All rights reserved.
#
#
# This script will start jolla-alarm-ui
# It will be started differently depending on are we in USER
# or in ACTDEAD state

if [ -f /run/systemd/boot-status/ACT_DEAD ]; then
    # We are starting alarm in act-dead mode
    # Must set some env variables
    eval $(grep -h '^[A-Z].*=' /var/lib/environment/compositor/*.conf /var/lib/environment/actdead/*.conf | sed -e 's/^/export /' -e 's/=/="/' -e 's/$/"/' -e 's/""/"/g')
    exec /usr/bin/jolla-alarm-ui --actdead $LIPSTICK_OPTIONS
else
    # Normal user state, use invoker
    exec /usr/bin/invoker --type=silica-qt5 -o -s -n -d 10 /usr/bin/jolla-alarm-ui
fi
