From b2878b7a9e640ebf9da254d54479adc6514743f7 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 20 Mar 2009 06:02:37 +0100 Subject: [PATCH] dbus: add a rc.d script, create dbus user/group dbus for binpkgs. --HG-- extra : convert_revision : 48ea6899a325893f2d5ca0f61159b37085e79a47 --- templates/dbus/INSTALL | 26 ++++++++++++++++++++++++++ templates/dbus/REMOVE | 11 +++++++++++ templates/dbus/files/dbus | 27 +++++++++++++++++++++++++++ templates/dbus/template | 13 +++++++++---- 4 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 templates/dbus/INSTALL create mode 100644 templates/dbus/REMOVE create mode 100644 templates/dbus/files/dbus diff --git a/templates/dbus/INSTALL b/templates/dbus/INSTALL new file mode 100644 index 0000000000..ecc7b58e3f --- /dev/null +++ b/templates/dbus/INSTALL @@ -0,0 +1,26 @@ +# +# This script fixes permissions for dbus-daemon-launch-helper +# and creates the dbus system user/group. +# +dbus_launch="./usr/libexec/dbus-daemon-launch-helper" + +case "$2" in +pre) + ;; +post) + echo "Running $3-$4 post installation hooks..." + if getent group dbus >/dev/null; then + chroot . groupadd -r dbus + [ $? -eq 0 ] && echo "Created dbus system group." + fi + if getent passwd dbus >/dev/null; then + chroot . useradd -c "System message bus" \ + -d /var/run/dbus \ + -s /sbin/nologin -g dbus -r dbus && \ + chroot . passwd -l dbus &>/dev/null + [ $? -eq 0 ] && echo "Created dbus system user." + fi + chroot . chown root:dbus ${dbus_launch} + chroot . chmod 4750 ${dbus_launch} + ;; +esac diff --git a/templates/dbus/REMOVE b/templates/dbus/REMOVE new file mode 100644 index 0000000000..357867a83a --- /dev/null +++ b/templates/dbus/REMOVE @@ -0,0 +1,11 @@ +# +# This script removes the dbus user/group. +# +case "$2" in +pre) + chroot . userdel dbus &>/dev/null + [ $? -eq 0 ] && echo "Removed dbus system user/group." + ;; +post) + ;; +esac diff --git a/templates/dbus/files/dbus b/templates/dbus/files/dbus new file mode 100644 index 0000000000..cedd28820d --- /dev/null +++ b/templates/dbus/files/dbus @@ -0,0 +1,27 @@ +#!/bin/sh +# +# PROVIDE: dbus +# REQUIRE: DAEMON +# KEYWORD: shutdown + +. /etc/rc.subr + +name="dbus" +rcvar=$name +command="/usr/bin/dbus-daemon" +command_args="--system" +pidfile="/var/run/dbus/pid" +start_precmd=dbus_prestart + +dbus_prestart() { + dir="/var/run/dbus" + if [ ! -d $dir ]; then + mkdir $dir + chmod 0755 $dir + chown dbus:dbus $dir + fi + /usr/bin/dbus-uuidgen --ensure +} + +load_rc_config $name +run_rc_command "$1" diff --git a/templates/dbus/template b/templates/dbus/template index d9ebada097..0739dc7eff 100644 --- a/templates/dbus/template +++ b/templates/dbus/template @@ -1,13 +1,12 @@ # Template file for 'dbus' pkgname=dbus -sourcepkg=dbus +sourcepkg=$pkgname version=1.2.12 distfiles="http://dbus.freedesktop.org/releases/dbus/$pkgname-$version.tar.gz" build_style=gnu_configure configure_args="--disable-selinux --enable-userdb-cache --with-xml=expat - --localstatedir=/var --without-x" -make_install_args="DBUS_DAEMONDIR=$XBPS_DESTDIR/$pkgname-$version/usr/sbin - DBUS_DATADIR=$XBPS_DESTDIR/$pkgname-$version/usr/share" + --localstatedir=/var --without-x --disable-dnotify --enable-inotify + --with-dbus-user=dbus" short_desc="Message bus system" maintainer="Juan RP " checksum=b2ec81e7d9fa5e24f67baccfd9af2755a7797a65cb4c3cad10d023867f2bd220 @@ -30,3 +29,9 @@ Add_dependency full glibc Add_dependency full expat Add_dependency run dbus-libs Add_dependency build pkg-config + +post_install() +{ + rm -rf ${DESTDIR}/var/run + install -D -m755 ${FILESDIR}/dbus ${DESTDIR}/etc/rc.d/dbus +}