7199N/A#!/bin/sh
7199N/A#
7199N/A# Copyright 2008, 2016, Oracle and/or its affiliates. All rights reserved.
7199N/A#
7199N/A# For modifying parameters passed to gdm, do not edit this script.
7199N/A# Instead use svccfg(1m) to modify the SMF repository. For example:
7199N/A#
7199N/A# # svccfg
7199N/A# svc:> select application/graphical-login/gdm
7199N/A# svc:/application/graphical-login/gdm> setprop gdm/args = "--fatal-warnings"
7199N/A# svc:/application/graphical-login/gdm> exit
7199N/A
7199N/A. /lib/svc/share/smf_include.sh
7199N/A
7199N/ACK_FMRI='svc:/system/consolekit'
7199N/Asessions="$(eval "echo $(svcprop -p consolekit/sessions $CK_FMRI)")"
7199N/A
7199N/Acase "$1" in
7199N/A'start')
7199N/A FMRI=svc:/application/graphical-login/gdm
7199N/A
7199N/A arg="$(eval "echo $(svcprop -p gdm/args $FMRI)")"
7199N/A
7199N/A /usr/sbin/gdm $arg &
7199N/A
7199N/A rc=$?
7199N/A if [[ $rc != 0 ]]; then
7199N/A echo "$0: gdm failed with $rc"
7199N/A exit $SMF_EXIT_ERR_FATAL
7199N/A fi
7199N/A
7199N/A # If no static sessions started, start dynamic ones
7199N/A if [[ -z "$sessions" && -x /usr/lib/ConsoleKit/dsession ]]; then
7199N/A sleep 2
7199N/A /usr/lib/ConsoleKit/dsession --init
7199N/A fi
7199N/A ;;
7199N/A
7199N/A'stop')
7199N/A if [[ -z "$sessions" && -x /usr/lib/ConsoleKit/dsession ]]; then
7199N/A /usr/lib/ConsoleKit/dsession --fini
7199N/A fi
7199N/A
7199N/A PIDFILE='/var/run/gdm/gdm.pid'
7199N/A if [[ ! -f $PIDFILE ]] ; then
7199N/A echo "$PIDFILE doesn't exist, perhaps GDM isn't running"
7199N/A else
7199N/A kill -TERM $(cat $PIDFILE) && sleep 5
7199N/A fi
7199N/A # kill any stragglers that gdm itself didn't kill off
7199N/A smf_kill_contract $2 TERM 1 30
7199N/A [[ $? -ne 0 ]] && exit 1
7199N/A ;;
7199N/A
7199N/A*)
7199N/A echo "Usage: $0 { start | stop }"
7199N/A exit $SMF_EXIT_ERR_FATAL
7199N/A ;;
7199N/Aesac
7199N/A
7199N/Aexit $SMF_EXIT_OK