Linux HOWTOs

About | Home | Search


HOWTO: dbus
Description: A simple way for applications to talk to one another
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# D-Bus 1.0.3
# ===========
# Slackware 12.0's 'dbus' package includes version 1.0.2

# 1.0.3 is considered the latest "legacy" release.  The latest
# "stable" release is considered version 1.1.20, which will
# become the 1.2.x stable series.  I'm in a hurry as I write this, so
# I'll upgrade to 1.1.20 or 1.2.x (if it's released by then) next time.

# Don't be too worried with the version difference if you're upgrading from
# something like 0.62  Here are all of the non-rc releases since then:
# 0.90, 0.91, 0.92, 1.0.0, 1.0.1, 1.0.2, 1.0.3

# Prerequisites:
# expat (default) or libxml (if you pass --with-xml=libxml)
# pkg-config
# SELinux (for SELinux support; pass --enable-selinux)
# XFree86 or X.org (you can try (I never have) --without-x to skip)
# xmlto (optional; pass --enable-xml-docs)
# doxygen (optional; pass --enable-doxygen-docs)

cd
test -f installed/dbus-1.0.3.tar.gz && mv installed/dbus-1.0.3.tar.gz .
test ! -f dbus-1.0.3.tar.gz &&
 wget http://dbus.freedesktop.org/releases/dbus/dbus-1.0.3.tar.gz
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "dbus-?.*" -exec rm -r {} \;
tar xzvf ~/dbus-1.0.3.tar.gz
cd dbus-1.0.3
test $UID = 0 && chown -R root:root .

# If you enable dnotify in your kernel (CONFIG_DNOTIFY), configure will
# see that.  (without --enable-dnotify)

# You can change the default user (messagebus) by passing another username
# to --with-dbus-user

./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make

# Become root to install it
su

# This will back up, then zap your existing configuration.  You can
# certainly skip this part if you have customizations or know you don't
# need the default config files that come with the new version.
# If you do skip this, you'll find the default ones in the source
# directory here:
# bus/system.conf
# bus/session.conf
test -d /etc/dbus-1 &&
 ( cd /etc/dbus-1
   tar cjvf ~/backup/dbus-$(date +%Y%m%d).tar.bz2 .
   test $? -eq 0 && ( cd .. ; rm -r ./dbus-1 ) )

# If you have an old D-Bus init-script, shut down D-Bus and rename
# the init script to .old
test -x /etc/rc.d/rc.messagebus && /etc/rc.d/rc.messagebus stop
test -f /etc/rc.d/rc.messagebus &&
 ( mv -f /etc/rc.d/rc.messagebus /etc/rc.d/rc.messagebus.old
   chmod 600 /etc/rc.d/rc.messagebus.old )

# Remove the Slackware package, remove old shared library files,
# remove old socket files, etc.:
test -x /sbin/removepkg && /sbin/removepkg dbus
rm -f /usr/lib/libdbus-1.so.*
test -d /var/lib/dbus && rm -r /var/lib/dbus
test -d /var/run/dbus && rm -r /var/run/dbus

# Install the new version
make install
ldconfig

# By default it will use /var/run/dbus and /var/lib/dbus and it will run as
# user 'messagebus'.  Create that user, 'make install' should've already
# created those directories, set their ownership:
test ! -d /var/lib/dbus && mkdir -p /var/lib/dbus
test ! -d /var/run/dbus && mkdir -p /var/run/dbus
id messagebus > /dev/null 2>&1 || useradd -d / -g root messagebus
chown messagebus /var/lib/dbus /var/run/dbus
chmod 755 /var/lib/dbus /var/run/dbus

# If you do use Slackware, you may want to use the Slackware D-Bus init
# script instead of the one that comes with the D-Bus source.  If so,
# either look at /etc/rc.d/rc.messagebus.old if there is one, or you can
# find it here)
#
# Slackware uses /var/run/dbus/dbus.pid, I leave it at the default
# location of /var/run/dbus/pid, so if you use the Slackware init
# script, make sure you fix the PIDFILE line
#
# After running 'make install', Slackware gets a new /etc/rc.d/rc.messagebus
# script.  Run this to start D-Bus:
/etc/rc.d/rc.messagebus start

## Slackware 12.0 will automatically start D-Bus on boot-up (out of rc.M)
## if you have that init script and it's executable, and it will stop it
## (out of rc.0/rc.6)
##
## If you run an older version, add something like this to rc.local:
# if [ -x /etc/rc.d/rc.messagebus ]; then
#   /etc/rc.d/rc.messagebus start
# fi

# Make sure your non-root user can remove the source directory later
chown -R $USER .
chmod -R u+rw .

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/dbus-?.*.tar.*
mv dbus-1.0.3.tar.gz installed/


# D-Bus bindings
# ==============

# GLib 0.74
# =========
# Slackware 12.0's 'dbus-glib' package includes version 0.73

# Prerequisites:
# gettext
# expat or libxml (pass --with-xml=libxml/expat to pick one or the other)
# pkg-config
# D-Bus
# doxygen (for the doxygen documentation)
# xmlto (for the XML documentation)

cd
test -f installed/dbus-glib-0.74.tar.gz &&
 mv installed/dbus-glib-0.74.tar.gz .
test ! -f dbus-glib-0.74.tar.gz &&
 wget http://dbus.freedesktop.org/releases/dbus-glib/dbus-glib-0.74.tar.gz
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "dbus-glib-*" -exec rm -r {} \;
tar xzvf ~/dbus-glib-0.74.tar.gz
cd dbus-glib-0.74
test $UID = 0 && chown -R root:root .
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make

# Become root to install it
su

rm -f /usr/lib/libdbus-glib-1.so.*
make install
ldconfig

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/gbus-glib-*.tar.*
mv dbus-glib-0.74.tar.gz installed/


# Python 0.82.3
# =============
# Prerequisites:
# gettext
# expat or libxml (pass --with-xml=libxml/expat to pick one or the other)
# pkg-config
# D-Bus
# dbus-glib
# doxygen (for the doxygen documentation)
# xmlto (for the XML documentation)
# Python >= 2.4

cd
test -f installed/dbus-python-0.82.3.tar.gz &&
 mv installed/dbus-python-0.82.3.tar.gz .
test ! -f dbus-python-0.82.3.tar.gz &&
 wget http://dbus.freedesktop.org/releases/dbus-python/\
dbus-python-0.82.3.tar.gz
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "dbus-python-*" -exec rm -r {} \;
tar xzvf ~/dbus-python-0.82.3.tar.gz
cd dbus-python-0.82.3
test $UID = 0 && chown -R root:root .
./configure --prefix=/usr
make
su -c "make install"
cd
mkdir -p -m 0700 installed
rm -f installed/gbus-glib-*.tar.*
mv dbus-python-0.82.3.tar.gz installed/


# Java 2.4
# ========
# This is one of the three available versions of Java D-Bus.

# Prerequisites:
# A Java 1.5-compliant VM and compiler
# Unix sockets, debug, and hexdump libraries (below)
# D-Bus
# LaTeX, tex4ht, docbook (Slackware includes this in sgml-tools/linuxdoc-tools) for the documentation

cd
test -f installed/libmatthew-java-0.6.tar.gz &&
 mv installed/libmatthew-java-0.6.tar.gz .
test ! -f libmatthew-java-0.6.tar.gz &&
 wget http://www.matthew.ath.cx/projects/java/libmatthew-java-0.6.tar.gz
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "libmatthew-java-*" -exec rm -r {} \;
tar xzvf ~/libmatthew-java-0.6.tar.gz
cd libmatthew-java-0.6
test $UID = 0 && chown -R root:root .
# I don't know if it's the "proper" fix or not, but I changed 5.0 to 1.5
# in the Makefile, then it compiled OK
su -c "make install"
cd
mkdir -p -m 0700 installed
rm -f installed/libmatthew-java-*.tar.*
mv libmatthew-java-0.6.tar.gz installed/

cd
test -f installed/dbus-java-2.4.tar.gz &&
 mv installed/dbus-java-2.4.tar.gz .
test ! -f dbus-java-2.4.tar.gz &&
 wget http://dbus.freedesktop.org/releases/dbus-java/\
dbus-java-2.4.tar.gz
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "libdbus-java-*" -exec rm -r {} \;
tar xzvf ~/dbus-java-2.4.tar.gz
cd dbus-java-2.4
test $UID = 0 && chown -R root:root .
make JAVAUNIXLIBDIR=/usr/local/lib/jni JAVAUNIXJARDIR=/usr/local/share/java
# I don't have a docbook-to-man (and docbook2man didn't work), so -i
# ignores the error
su -c "make -i install"
cd
mkdir -p -m 0700 installed
rm -f installed/libdbus-java-*.tar.*
mv dbus-java-2.4.tar.gz installed/


# Qt4
# ===
# Qt4 bindings are distributed with Qt4 itself


# Perl (Net::DBus)
# ====
su -c "perl -MCPAN -e shell"
o conf make_install_arg UNINST=1
o conf prerequisites_policy follow
install Bundle::CPAN
install Net::DBus
exit


# Qt3 0.8
# =======
# Slackware 12.0's 'dbus-qt3' package includes version 0.70

# Prerequisites:
# XFree86 or X.org
# zlib
# libpng
# libjpeg
# Perl
# Qt
# D-Bus

cd
test -f installed/libdbus-1-qt3-0.8.tar.gz &&
 mv installed/libdbus-1-qt3-0.8.tar.gz .
test ! -f libdbus-1-qt3-0.8.tar.gz &&
 wget http://people.freedesktop.org/~krake/dbus-1-qt3/\
libdbus-1-qt3-0.8.tar.gz
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "libdbus-1-qt3-*" -exec rm -r {} \;
tar xzvf ~/libdbus-1-qt3-0.8.tar.gz
cd libdbus-1-qt3-0.8
test $UID = 0 && chown -R root:root .
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make

# Become root to install it
su

rm -f /usr/lib/libdbus-qt-1.* /usr/lib/libdbus-1-qt3.so.*
make install
ldconfig

# Make sure your non-root user can remove the source directory later
chown -R $USER .
chmod -R u+rw .

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/libdbus-1-qt3-*.tar.*
mv libdbus-1-qt3-0.8.tar.gz installed/


# If you ever want to uninstall D-Bus, this should do it:
# ('make uninstall' should do it, the rest is to make sure)
cd
su
killall dbus-daemon
test -d src/dbus-* && ( cd src/dbus-* ; make uninstall )
test -d /etc/dbus-1 && rm -r /etc/dbus-1
test -d /usr/include/dbus-1.0 && rm -r /usr/include/dbus-1.0
test -d /usr/lib/dbus-1.0 && rm -r /usr/lib/dbus-1.0
test -d /usr/lib/python2.4/site-packages/dbus &&
 rm -r /usr/lib/python2.4/site-packages/dbus
( cd /usr/bin ; rm -f dbus-binding-tool dbus-cleanup-sockets \
 dbus-daemon dbus-launch dbus-monitor dbus-send dbus-viewer )
( cd /usr/lib ; rm -f libdbus-1.* libdbus-1-qt3.* libdbus-glib-1.* \
 libdbus-qt-1.* )
( cd /usr/lib/pkgconfig ; rm -f dbus-1.pc dbus-glib-1.pc )
( cd /usr/man/man1 ; rm -f dbus-cleanup-sockets.1 dbus-daemon.1 \
 dbus-launch.1 dbus-monitor.1 dbus-send.1 )
rm -f /etc/rc.d/rc.messagebus /usr/lib/python2.4/site-packages/dbus/dbus.pth
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "dbus-*" -exec rm -r {} \;
rm -f ~/installed/dbus-*.tar.*

Back to the list


Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>