#!/bin/sh

##############################
## D-BUS DAEMON INIT SCRIPT ##
##############################

## Callum Dickinson <gcfreak_ag20@hotmail.com>
## Sonic Team Junior <http://www.srb2.org>
## http://mb.srb2.org/showthread.php?t=31137
## svn://code.srb2.org/SRB2/branches/WII

## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.

## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.


## Any lines in this file preceeded by a hash ('#') indicates a comment, and is not read by the interpreter.

#--------------------#
. /lib/lsb/init-functions
. /etc/profile
LOGFILE="$LOGDIR/$ME.log"
#--------------------#

case "$1" in
	"start") log_action_begin_msg "Starting D-Bus"
		rm -f /var/run/dbus/pid > /dev/null 2>&1
		dbus-daemon --config-file=/etc/dbus-1/system.conf > /dev/null 2>&1
		log_action_end_msg 0
   		;;
	"stop") log_action_begin_msg "Stopping D-Bus"
		killall dbus-daemon > /dev/null 2>&1
		rm -f /var/run/dbus/pid > /dev/null 2>&1
		log_action_end_msg 0
		;;
	restart|reload|force-reload) log_action_begin_msg "Restarting D-Bus"
		killall dbus-daemon > /dev/null 2>&1
		rm -f /var/run/dbus/pid > /dev/null 2>&1
		dbus-daemon --config-file=/etc/dbus-1/system.conf > /dev/null 2>&1
		log_action_end_msg 0
   		;;
	*) print "Usage: /etc/init.d/dbus {start|stop|restart|reload|force-reload}" && exit 1;;
esac
