Package: dbus
Version: 1.6.12-1
Severity: normal
Tags: patch
User: upst...@packages.debian.org
Usertags: upstart-job

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Dear Maintainer,

please consider applying the following patch that adds upstart
integration for the dbus package.

The patch below follows debian policy on alternative init systems [1]
and recommended practices in making upstart compatible init scripts
[2]. The upstart job attached will continue to honour existing
settings for additional parameters from /etc/default/dbus, just like
the current init.d script. Also conditional check whether dbus is
running under upstart is added in the dbus.postinst for the upgrade
notification.

I have tested proposed changes on debian sid, with both sysvinit and upstart.

[1] http://www.debian.org/doc/debian-policy/ch-opersys.html#s-alternateinit
[2] https://wiki.ubuntu.com/UpstartCompatibleInitScripts

Regards,

Dmitrijs.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBCAAGBQJRug4yAAoJEIh7YGGLPBauYkcP/A2qsljEVpxNSAmeakpDnLZY
NuE9xVTfcPZ6gYIz4KAVSt6RFfbXPSzRp8mVNXrIUdKF4X/uSAy0XuhTysgQi4KR
pGj1RSNb69ZVbBWPHyTeejUyooCoqQ4/5EJKdVcfG1ZixNoAmBL5F2GK/+887yHN
fUhPgij3u8mskHUfQAgmND9quAsX/ewcS2w9xHs30PHiF3Y+LRkz7onKmygyBulJ
uPp7a30POZB1dzGOZUg4h7KjqdMXHiD+9Scx/gw1i8Lyx6iQZvHp257Ez+7Eo6iW
UugYSXpC5yeaaBdIXtkHV0dbeLeH/kvW1MwFulmC4H4j0Mng+1cq2+EvmN/DVcP4
1s2kNIElMYHwqUOoyN7H3HurHZEnksKyeE2l2TOAh0pN15ufnMVYg07OiITJiIag
v5xBIwVz58q86YEF4i8DCn1DsljF3eaYVHUhU2X4D47laSRBaMi2YwXbh+Rh9oVC
F6WnDY2HvxKr4NQs9+WZF1cY42G7c/HOWQ5TMh4YCix1WJEU5+rOoXw+Uz81B/ZD
wPqunaNeyJVRb/uSBFwXQIN2HB7UvsZuaf9tjRzYZjqQHHew74m9nCvIgi4Xa5CV
mbh37p7+mbNcj0yTH/+ESfOzO64p8WD+FBskbYadstg98NthPVXbgnqHsNHzFrx2
Ohpg5ErLR/r9pDA3AjrY
=sYr6
-----END PGP SIGNATURE-----
diff -Nru dbus-1.6.12/debian/changelog dbus-1.6.12/debian/changelog
--- dbus-1.6.12/debian/changelog	2013-06-12 14:41:05.000000000 +0100
+++ dbus-1.6.12/debian/changelog	2013-06-13 18:11:34.000000000 +0100
@@ -1,3 +1,15 @@
+dbus (1.6.12-1.1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * Add upstart integration:
+    - Check if init is upstart in the init.d script and exit
+    appropriately.
+    - Add upstart job, preserving setting $PARAMS via /etc/defaults/dbus.
+    - Depend on lsb-base that provides init_is_upstart function.
+    - Also check with upstart, if reboot-required should be triggered.
+
+ -- Dmitrijs Ledkovs <dmitrij.led...@ubuntu.com>  Thu, 13 Jun 2013 17:18:48 +0100
+
 dbus (1.6.12-1) unstable; urgency=high
 
   * New upstream stable release 1.6.12
diff -Nru dbus-1.6.12/debian/control dbus-1.6.12/debian/control
--- dbus-1.6.12/debian/control	2013-06-12 14:41:05.000000000 +0100
+++ dbus-1.6.12/debian/control	2013-06-13 17:18:41.000000000 +0100
@@ -50,7 +50,7 @@
 Depends: ${shlibs:Depends},
          ${misc:Depends},
          adduser,
-         lsb-base (>= 3.2-14)
+         lsb-base (>= 4.1+Debian3)
 Suggests: dbus-x11
 Multi-Arch: foreign
 Description: simple interprocess messaging system (daemon and utilities)
diff -Nru dbus-1.6.12/debian/dbus.init dbus-1.6.12/debian/dbus.init
--- dbus-1.6.12/debian/dbus.init	2013-06-12 14:41:05.000000000 +0100
+++ dbus-1.6.12/debian/dbus.init	2013-06-13 17:18:41.000000000 +0100
@@ -97,6 +97,17 @@
   log_action_end_msg $?
 }
 
+if init_is_upstart; then
+    case "$1" in
+	stop)
+	    exit 0
+	    ;;
+	*)
+	    exit 1
+	    ;;
+    esac
+fi
+
 case "$1" in
   start)
     start_it_up
diff -Nru dbus-1.6.12/debian/dbus.postinst dbus-1.6.12/debian/dbus.postinst
--- dbus-1.6.12/debian/dbus.postinst	2013-06-12 14:41:05.000000000 +0100
+++ dbus-1.6.12/debian/dbus.postinst	2013-06-13 18:10:30.000000000 +0100
@@ -38,7 +38,14 @@
     # system bus is not supported by upstream). The code added by
     # dh_installinit -r creates a start action, below.
 
-    if [ -x "/etc/init.d/dbus" ] && /etc/init.d/dbus status > /dev/null; then
+    REBOOT=""
+    if which initctl >/dev/null && initctl version | grep -q upstart; then
+	REBOOT=$(status "dbus" 2>/dev/null | awk '/[0-9]$/ { print $NF }')
+    elif [ -x "/etc/init.d/dbus" ] && /etc/init.d/dbus status > /dev/null; then
+	REBOOT=yes
+    fi
+
+    if [ -n "$REBOOT" ]; then
         # trigger an update notification which recommends to reboot
         [ -x /usr/share/update-notifier/notify-reboot-required ] && \
             /usr/share/update-notifier/notify-reboot-required || true
diff -Nru dbus-1.6.12/debian/dbus.upstart dbus-1.6.12/debian/dbus.upstart
--- dbus-1.6.12/debian/dbus.upstart	1970-01-01 01:00:00.000000000 +0100
+++ dbus-1.6.12/debian/dbus.upstart	2013-06-13 17:18:41.000000000 +0100
@@ -0,0 +1,28 @@
+# dbus - D-Bus system message bus
+#
+# The D-Bus system message bus allows system daemons and user applications
+# to communicate.
+
+description	"D-Bus system message bus"
+
+start on local-filesystems
+stop on deconfiguring-networking
+
+expect fork
+respawn
+
+pre-start script
+    mkdir -p /var/run/dbus
+    chown messagebus:messagebus /var/run/dbus
+
+    exec dbus-uuidgen --ensure
+end script
+
+script
+	. /etc/default/dbus || :
+	exec dbus-daemon --system $PARAMS --fork
+end script
+
+post-start exec kill -USR1 1
+
+post-stop exec rm -f /var/run/dbus/pid

Reply via email to