#!/bin/sh
#
# /etc/rc.d/rc.consolekit
#
# Start/stop consolekit-kit daemon.
#
# This daemon is used by polkit's console auth agent.

# Start consolekit:
ck_start() {
  echo "Starting ConsoleKit daemon:  /usr/sbin/console-kit-daemon"
  /usr/sbin/console-kit-daemon
}

# Stop consolekit:
ck_stop() {
  if [ -r /var/run/ConsoleKit/pid ]; then
    kill -HUP $(cat /var/run/ConsoleKit/pid)
    rm -f /var/run/ConsoleKit/pid
  else
    killall -HUP -q console-kit-daemon
  fi
}

case "$1" in
'start')
  ck_start
  ;;
'stop')
  ck_stop
  ;;
*)
  echo "Usage: $0 start|stop"
esac