Package: accountsservice
Version: 0.6.12-2
Tags: patch

accountsservice package doesn't have a way to shut down the daemon on
package upgrades/removals, so it really needs to have it. Attached patch
adds .postinst and .postrm files, so that is done on upgrades and
removals of the package
=== added file 'debian/accountsservice.postinst'
--- debian/accountsservice.postinst	1970-01-01 00:00:00 +0000
+++ debian/accountsservice.postinst	2011-06-15 10:48:05 +0000
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+set -e
+
+get_pid() {
+    [ -n "$1" ] || return 0
+    [ -S /var/run/dbus/system_bus_socket ] || return 0
+
+    dbus-send --system --dest=org.freedesktop.DBus --print-reply \
+              /org/freedesktop/DBus org.freedesktop.DBus.GetConnectionUnixProcessID \
+              string:$1 2>/dev/null | awk '/uint32/ {print $2}'
+}
+
+if [ "$1" = "configure" ]; then
+   # stop accounts-daemon
+   pid=$(get_pid org.freedesktop.Accounts)
+   kill $pid 2>/dev/null || true
+
+   # restart daemon if it was running before
+   [ -z "$pid" ] || /usr/lib/accountsservice/accounts-daemon & >/dev/null || true # will trigger through D-Bus activation
+fi

=== added file 'debian/accountsservice.prerm'
--- debian/accountsservice.prerm	1970-01-01 00:00:00 +0000
+++ debian/accountsservice.prerm	2011-06-15 10:42:18 +0000
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+get_pid() {
+    [ -n "$1" ] || return 0
+    [ -S /var/run/dbus/system_bus_socket ] || return 0
+
+    dbus-send --system --dest=org.freedesktop.DBus --print-reply \
+              /org/freedesktop/DBus org.freedesktop.DBus.GetConnectionUnixProcessID \
+              string:$1 2>/dev/null | awk '/uint32/ {print $2}'
+}
+
+if [ "$1" = "remove" ]; then
+    kill $(get_pid org.freedesktop.Accounts) 2>/dev/null || true
+fi

=== modified file 'debian/changelog'
--- debian/changelog	2011-06-05 12:40:37 +0000
+++ debian/changelog	2011-06-15 10:44:25 +0000
@@ -1,3 +1,11 @@
+accountsservice (0.6.12-3) unstable; urgency=low
+
+  * debian/accountsservice.postinst:
+  * debian/accountsservice.prerm:
+    - Add scripts to shut down daemon on package upgrades/removals
+
+ -- Rodrigo Moya <rodrigo.m...@canonical.com>  Wed, 15 Jun 2011 12:43:36 +0200
+
 accountsservice (0.6.12-2) unstable; urgency=low
 
   * Disable 0005-gdm_config_file_path.patch in debian/patches/ubuntu.series as

Reply via email to