start on started dbus
stop on stopping dbus

script

  echo "duokan.conf 1206"

  rm -f /var/local/upstart/*restarts

  if [ -f /mnt/us/startup.sh ] ; then
    chmod +x /mnt/us/startup.sh
    /mnt/us/startup.sh
  fi
    
  if [ -f /mnt/us/DUOKAN_DISABLE ] ; then
    exit
  fi

  if [ -f /mnt/us/DUOKAN_NO ] ; then
    exit
  fi

  if [ ! -d /mnt/us/DK_System ] ; then  
    exit
  fi

  sleep 8

  if [ -f /etc/init.d/DK_update ] ; then
    /etc/init.d/DK_update
  fi
  
  if [ -f /etc/init.d/DK_run ] ; then
	/etc/init.d/DK_run
  fi

  killall -9 KindleApp
  sleep 1
  DUOKANPID=`ps -A | grep KindleApp | awk '{print $1}'`
  if [ -z "$DUOKANPID" ] ; then
    start x
  fi
end script