summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrichard <richard>2014-09-13 09:47:11 +0000
committerrichard <richard>2014-09-13 09:47:11 +0000
commit7e91dd5ff58b97a5e212771883aa410a7d438832 (patch)
treefb7f53a680cf53a2e7cc46a7911d9bb54ce95303
parentfb66d4ecba5ed9117ec5ba69bd470351bd6ada4a (diff)
downloadpkgsrc-7e91dd5ff58b97a5e212771883aa410a7d438832.tar.gz
Add smf support and solaris-specific console_user verification
bump PKGREVISION
-rw-r--r--sysutils/dbus/Makefile6
-rw-r--r--sysutils/dbus/distinfo3
-rwxr-xr-xsysutils/dbus/files/smf/dbus.sh35
-rw-r--r--sysutils/dbus/files/smf/manifest.xml47
-rw-r--r--sysutils/dbus/patches/patch-dbus_dbus-sysdeps-util-unix.c57
5 files changed, 146 insertions, 2 deletions
diff --git a/sysutils/dbus/Makefile b/sysutils/dbus/Makefile
index 579efb4b594..1c77fd17f30 100644
--- a/sysutils/dbus/Makefile
+++ b/sysutils/dbus/Makefile
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.72 2014/07/06 14:54:32 wiz Exp $
+# $NetBSD: Makefile,v 1.73 2014/09/13 09:47:11 richard Exp $
DISTNAME= dbus-1.8.6
+PKGREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= http://dbus.freedesktop.org/releases/dbus/
@@ -24,6 +25,9 @@ BUILD_DEFS+= VARBASE
OWN_DIRS_PERMS+= ${VARBASE}/db/dbus ${DBUS_USER} ${DBUS_GROUP} 0755
SPECIAL_PERMS+= libexec/dbus-daemon-launch-helper ${REAL_ROOT_USER} ${DBUS_GROUP} 4511
+SMF_METHODS= dbus
+SMF_NAME= dbus
+
.include "../../mk/bsd.prefs.mk"
CONFIGURE_ARGS+= --localstatedir=${VARBASE:Q}
diff --git a/sysutils/dbus/distinfo b/sysutils/dbus/distinfo
index 32929909acc..72d2564b9d0 100644
--- a/sysutils/dbus/distinfo
+++ b/sysutils/dbus/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.57 2014/07/06 14:54:32 wiz Exp $
+$NetBSD: distinfo,v 1.58 2014/09/13 09:47:11 richard Exp $
SHA1 (dbus-1.8.6.tar.gz) = ad7cb87cdce66533479a9d7c1c956bdb0243ad87
RMD160 (dbus-1.8.6.tar.gz) = 78dcfa48f4d780b27a8c144e481bc285fcf5fd62
@@ -11,3 +11,4 @@ SHA1 (patch-ba) = f9126faf18cd19e897865748ebea1011fe516225
SHA1 (patch-bus_dir-watch-kqueue.c) = 86a1f0f78b4d16d8ab29d351057885d8001dd39c
SHA1 (patch-configure) = 08fb6cc6e9bc9f23825a6a0f2b8b241169d1cda7
SHA1 (patch-dbus_dbus-sysdeps-unix.c) = 043e7bf03686f51faf763f87f43e00308b29571e
+SHA1 (patch-dbus_dbus-sysdeps-util-unix.c) = 9c967cdac585220a3e65443dc9642e7d4478567c
diff --git a/sysutils/dbus/files/smf/dbus.sh b/sysutils/dbus/files/smf/dbus.sh
new file mode 100755
index 00000000000..60435df4d4c
--- /dev/null
+++ b/sysutils/dbus/files/smf/dbus.sh
@@ -0,0 +1,35 @@
+#!/sbin/sh
+
+. /lib/svc/share/smf_include.sh
+
+# SMF_FMRI is the name of the target service. This allows multiple instances
+# to use the same script.
+
+if [ ! -x @PREFIX@/bin/dbus-daemon ]; then
+ echo "@PREFIX@/bin/dbus-daemon not found or not executable"
+ exit $SMF_EXIT_ERR_FATAL
+fi
+
+if [ ! -f @VARBASE@/db/dbus/machine-id ]; then
+ @PREFIX@/bin/dbus-uuidgen --ensure
+fi
+
+case "$1" in
+'start')
+ if [ -f @VARBASE@/run/dbus/pid ]; then
+ rm -f @VARBASE@/run/dbus/pid
+ fi
+ @PREFIX@/bin/dbus-daemon --system
+ err=$?
+ if [ $err -ne 0 ]; then
+ echo "dbus failed to start: error $err"
+ exit $SMF_EXIT_ERR_FATAL
+ fi
+ ;;
+*)
+ echo "Usage: $0 { start }"
+ exit $SMF_EXIT_ERR_FATAL
+ ;;
+esac
+
+exit $SMF_EXIT_OK
diff --git a/sysutils/dbus/files/smf/manifest.xml b/sysutils/dbus/files/smf/manifest.xml
new file mode 100644
index 00000000000..6ef87bff577
--- /dev/null
+++ b/sysutils/dbus/files/smf/manifest.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<service_bundle type='manifest' name='@SMF_NAME@'>
+ <service
+ name='@SMF_PREFIX@/@SMF_NAME@'
+ type='service'
+ version='1'>
+ <create_default_instance enabled='false' />
+ <single_instance />
+ <dependency name='usr'
+ type='service'
+ grouping='require_all'
+ restart_on='none'>
+ <service_fmri value='svc:/system/filesystem/minimal' />
+ </dependency>
+ <exec_method
+ type='method'
+ name='start'
+ exec='@PREFIX@/@SMF_METHOD_FILE.dbus@ start'
+ timeout_seconds='30'>
+ <method_context>
+ <method_credential user='@DBUS_USER@' group='@DBUS_GROUP@' />
+ </method_context>
+ </exec_method>
+ <exec_method
+ type='method'
+ name='stop'
+ exec=':kill'
+ timeout_seconds='30' />
+ <property_group name='startd' type='framework'>
+ <!-- sub-process core dumps shouldn't restart session -->
+ <propval name='ignore_error' type='astring'
+ value='core,signal' />
+ </property_group>
+ <stability value='Unstable' />
+ <template>
+ <common_name>
+ <loctext xml:lang='C'>
+ D-BUS message bus
+ </loctext>
+ </common_name>
+ <documentation>
+ <manpage title='dbus-daemon' section='1' />
+ </documentation>
+ </template>
+ </service>
+</service_bundle>
diff --git a/sysutils/dbus/patches/patch-dbus_dbus-sysdeps-util-unix.c b/sysutils/dbus/patches/patch-dbus_dbus-sysdeps-util-unix.c
new file mode 100644
index 00000000000..85dc387305a
--- /dev/null
+++ b/sysutils/dbus/patches/patch-dbus_dbus-sysdeps-util-unix.c
@@ -0,0 +1,57 @@
+$NetBSD: patch-dbus_dbus-sysdeps-util-unix.c,v 1.3 2014/09/13 09:47:11 richard Exp $
+
+add solaris specific console_user test
+
+--- dbus/dbus-sysdeps-util-unix.c.orig 2014-01-25 12:39:25.000000000 +0000
++++ dbus/dbus-sysdeps-util-unix.c
+@@ -54,6 +54,10 @@
+ #include <syslog.h>
+ #endif
+
++#if defined(__sun) && defined(__SVR4)
++#include <pwd.h>
++#endif
++
+ #ifdef HAVE_SYS_SYSLIMITS_H
+ #include <sys/syslimits.h>
+ #endif
+@@ -556,8 +560,31 @@ _dbus_user_at_console (const char *usern
+
+ DBusString u, f;
+ dbus_bool_t result;
++#if defined(__sun) && defined(__SVR4)
++ struct passwd *passwd_entry;
++#endif
+
+ result = FALSE;
++
++#if defined(__sun) && defined(__SVR4)
++ passwd_entry = getpwnam (username);
++ if (passwd_entry != NULL)
++ {
++ struct stat st;
++ uid_t uid;
++
++ uid = passwd_entry->pw_uid;
++
++ if (stat ("/dev/vt/console_user", &st) == 0 && st.st_uid == uid)
++ {
++ /*
++ * Owner is allowed to take over. Before we have real
++ * ownership in HAL, assume it's the console owner.
++ */
++ result = TRUE;
++ }
++ }
++#else
+ if (!_dbus_string_init (&f))
+ {
+ _DBUS_SET_OOM (error);
+@@ -582,6 +609,7 @@ _dbus_user_at_console (const char *usern
+
+ out:
+ _dbus_string_free (&f);
++#endif
+
+ return result;
+ }