On Wed, Mar 26, 2014 at 3:46 AM, Simon McVittie <s...@debian.org> wrote:
On Tue, 25 Mar 2014 at 22:41:32 -0007, Cameron Norman wrote:
> It also uses the --nopidfile option to start dbus.

Does the combination of "expect fork" and "there is no pid file" work
properly? I'm somewhat surprised if it does; but if Upstart has some
clever trick to follow processes even though they double-fork (like systemd's
use of cgroups), then that's fine.


Yes it works perfectly. Instead of using cgroups, Upstart uses ptrace to track forks and double forks, not PID files (it stops tracing it after the daemon is done forking).

> Please consider this for inclusion
‘2’
More specifically, is anyone volunteering to maintain dbus' Upstart support by watching bug reports and "owning" any relevant bugs? I'm not going to test this configuration, and if it causes RC bugs that aren't addressed by an Upstart user, I'd be inclined to revert it rather than spending time on it.


Reverting this if it causes problems is more than sensible. I am using and testing dbus with Upstart on my machine, and will try to fix any bugs that occur or are reported. That said, I do not think malfunction under the non-default init system or not sysv would be considered RC, or am I wrong?

> +stop on deconfiguring-networking

This appears to have caused some rather upset bug reports in Ubuntu
(<https://bugs.freedesktop.org/show_bug.cgi?id=76344>,
<https://bugs.launchpad.net/ubuntu/+source/dbus/+bug/1072518>)
and I don't really want to have to field those bug reports in Debian too.

I believe the rationale is that dbus-daemon is in /usr which could
conceivably be NFS. Ubuntu's src:dbus packages install more of their
contents to the root directory. I briefly tried to do similarly in Debian,
but it caused regressions, so I had to revert it.


unmounted-remote-filesystems seems to be what I want, but that hangs shutdown because it is emitted by an init script that is supposed to stop after dbus has stopped. I guess I will just have to `stop on runlevel [016]`.

System service-activation will not work correctly until
/usr/share/dbus-1/system-services becomes available, so moving the
daemon to the rootfs probably doesn't help as much as you might think.

> +start on local-filesystems
‘6’

`start on local-filesystems and mounted MOUNTPOINT=/usr` would not work because the mounted event is a hook, so it would lock mountall up. I guess I will just change it to filesystem for now and then deal with the strange mounting events later (I think I will write a mount bridge that hooks into the real kernel events instead of relying on mountall to emit them, but that is once school calms down :).

I have attached the revised version.

Thanks for your time,
--
Cameron Norman
diff -Nru dbus-1.8.0/debian/changelog dbus-1.8.0/debian/changelog
--- dbus-1.8.0/debian/changelog	2014-02-26 05:15:58.000000000 -0800
+++ dbus-1.8.0/debian/changelog	2014-03-25 15:32:27.000000000 -0700
@@ -1,3 +1,15 @@
+dbus (1.8.0-2.1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * Add Upstart integration:
+    - Check if init is upstart in the init.d script and exit
+      appropiately
+    - Add Upstart job
+    - Depend on lsb-base that provides init_is_upstart function
+    - Prompt for reboot on post-install always
+
+ -- Cameron Norman <camerontnor...@gmail.com>  Tue, 25 Mar 2014 15:29:17 -0700
+
 dbus (1.8.0-2) unstable; urgency=low
 
   * debian/rules: look for DEB_BUILD_PROFILES, the new name for
diff -Nru dbus-1.8.0/debian/control dbus-1.8.0/debian/control
--- dbus-1.8.0/debian/control	2014-02-26 05:15:58.000000000 -0800
+++ dbus-1.8.0/debian/control	2014-03-25 15:29:10.000000000 -0700
@@ -57,7 +57,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.8.0/debian/dbus.init dbus-1.8.0/debian/dbus.init
--- dbus-1.8.0/debian/dbus.init	2014-02-26 05:15:58.000000000 -0800
+++ dbus-1.8.0/debian/dbus.init	2014-03-25 15:27:16.000000000 -0700
@@ -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.8.0/debian/dbus.postinst dbus-1.8.0/debian/dbus.postinst
--- dbus-1.8.0/debian/dbus.postinst	2014-02-26 05:15:58.000000000 -0800
+++ dbus-1.8.0/debian/dbus.postinst	2014-03-25 14:51:12.000000000 -0700
@@ -38,11 +38,9 @@
     # 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
-        # trigger an update notification which recommends to reboot
-        [ -x /usr/share/update-notifier/notify-reboot-required ] && \
-            /usr/share/update-notifier/notify-reboot-required || true
-    fi
+    # trigger an update notification which recommends to reboot
+    [ -x /usr/share/update-notifier/notify-reboot-required ] && \
+        /usr/share/update-notifier/notify-reboot-required || true
 fi
 
 # This is what the init script would do, but it's simpler (and less
diff -Nru dbus-1.8.0/debian/dbus.upstart dbus-1.8.0/debian/dbus.upstart
--- dbus-1.8.0/debian/dbus.upstart	1969-12-31 16:00:00.000000000 -0800
+++ dbus-1.8.0/debian/dbus.upstart	2014-03-25 15:24:38.000000000 -0700
@@ -0,0 +1,25 @@
+# dbus - D-Bus system message bus daemon
+#
+# The D-Bus system message bus allows system daemons
+# and user applications to communicate.
+
+description "dbus - D-Bus system message bus daemon"
+
+start on filesystem
+stop on runlevel [016]
+
+oom score -900
+
+expect fork
+respawn
+
+pre-start script
+	mkdir -p /var/run/dbus
+	chown messagebus:messagebus /var/run/dbus
+	
+	exec dbus-uuidgen --ensure
+end script
+
+exec dbus-daemon --system --nopidfile --fork
+
+post-start exec kill -USR1 1

Reply via email to