#!/bin/sh
# postinst script for mint-fm2
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

if [ ! -L /usr/bin/mint-fm2 ]
then
  ln -s /usr/lib/linuxmint/mint-fm2/mint-fm2 /usr/bin/mint-fm2
fi

# Check if upstart is running
upstartCheck=$(status upstart-udev-bridge | grep "upstart-udev-bridge start/running" | cat)


# Block starting the daemon till upstart registers it
if [ -n "$upstartCheck" ]
then
  while [ "$(status mint-fm2)" != "mint-fm2 stop/waiting" ] ; do echo "waiting..." ; sleep 1 ; done

  start mint-fm2
else
  echo "Upstart not running"
fi

echo "****************************************"
echo "This debian package will setup the system
wide daemon to monitor for changes. You will 
also have to launch the menu in your Fluxbox 
startup file (~/.fluxbox/startup). Simply add
the following line at an appropriate place.
mint-fm2 start"
echo "****************************************"
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
    

exit 0











