#!/bin/sh
#
# Copyright 2005 Zach Borgerding <zborgerd@gmail.com>
# Available under the terms of the GNU GPL.
#

NAME="dbus"
VERSION="0.50"
REVISION="7"

PKG_SOURCEURL='http://$NAME.freedesktop.org/releases/$NAME-$VERSION.tar.gz'
PKG_PATCH[0]="rc.messagebus"
PKG_PATCH[1]="dbus.sh"

. $DLG_ROOT/config
. $DLG_ROOT/SCRIPTS/dropline-functions.sh

# The protection offered by this is no longer needed since we're using a
# sysvinit script now.
#configfile /etc/rc.d/rc.messagebus

cflags
prepare
analyzesource
configure --enable-glib \
	  --enable-python \
	  --with-system-pid-file=/var/run/dbus.pid \
	  --with-system-socket=/var/lib/dbus/system_bus_socket \
	  --with-session-socket-dir=/tmp \
	  --with-dbus-user=messagebus \
	  --enable-mono 

make
makeinstall install-strip

# remove the init script that they try to install
rm $PKG_STAGEROOT$PKG_SYSCONFDIR/rc.d/rc.messagebus

# and insert our rc.dbus script instead
spewdo "mkdir -p $PKG_STAGEROOT$PKG_SYSCONFDIR/rc.d"
findpatch initscript ${PKG_PATCH[0]}
sysvinitsetup $initscript 345 90

# insert the dbus.sh script into profile.d
spewdo "mkdir -p $PKG_STAGEROOT$PKG_SYSCONFDIR/profile.d"
findpatch filename ${PKG_PATCH[1]}
spewdo "install -m 755 $filename $PKG_STAGEROOT$PKG_SYSCONFDIR/profile.d/dbus.sh"

# Kill off spurious empty & unused directory and create a newer, saner one.
spewdo "removedir $PKG_STAGEROOT/var/lib/run/dbus"
spewdo "createdir $PKG_STAGEROOT/var/lib/dbus"

tidydocumentation
analyzebinaries
finalizepackage
packagize
cleanup
