#!/bin/sh

set -e

DESC="Graphical Environment"
NAME="session"

. /etc/environment
[ -x /usr/share/ubuntu-mid-default-settings/mid-gui-start ] || exit 0

. /lib/init/vars.sh
. /lib/lsb/init-functions

case "$1" in
  start)
    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
    start session
    case "$?" in
      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
      *) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    ;;
  stop)
    [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
    stop session
    case "$?" in
      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
      *) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    ;;
  status)
    status session
    ;;
  restart)
    [ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME"
    start session
    case "$?" in
      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
      *) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    stop session
    case "$?" in
      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
      *) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    ;;
esac 

