#!/bin/sh

set -e
case "$1" in
  configure|triggered)
    [ -f /opt/catorise/menu ] || cp /opt/catorise/menu.base /opt/catorise/menu

    # One time v0.0.3 upgrade
    [ "$1" == 'configure' ] && echo -e 'ovi: ovi\nrtcom-call-ui: network\nrtcom-messaging-ui: network' >>/opt/catorise/menu

    chmod 666 /opt/catorise/menu
    echo -n "Catorise: Updating menu structure... "
    /opt/catorise/catorise
    echo "done."
  ;;
esac
