#!/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
    ENV_SET=$(cat /var/lib/environment/compositor/*.conf)
    while read ENV_PAIR
    do
        eval export `echo $ENV_PAIR`
    done < <(echo "$ENV_SET")
    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
