aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2017-01-02 03:39:00 -0300
committerdequis <dx@dxzone.com.ar>2017-01-02 03:53:25 -0300
commit73e2b690e1e98a6390e04ad2026f89944ee3c521 (patch)
treea088dcef29c18bfc47d271bd72cb98a5a9becab9
parent7a3d2c7d612aba056153ed9eb6c460bc303fcd9e (diff)
debian: add preinst script for a smoother transition to systemd units
This fixes an issue when upgrading from an initscripts based release like 3.4.2 to the current version, in which the old daemon is still running when systemd tries to start it, so it fails to start due to bind and fails to stop because it doesn't use pidfiles. To get around this, the preinst script kills the initscripts-started daemon the first time when upgrading from something old enough, using the pidfile.
-rw-r--r--debian/bitlbee-common.preinst20
1 files changed, 20 insertions, 0 deletions
diff --git a/debian/bitlbee-common.preinst b/debian/bitlbee-common.preinst
new file mode 100644
index 00000000..ad4b5a79
--- /dev/null
+++ b/debian/bitlbee-common.preinst
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+set -e
+
+NAME=bitlbee
+PIDFILE=/var/run/$NAME.pid
+
+# git revision 7949d5a introduced dh_systemd.
+DH_SYSTEMD_REV="3.4.2+20160612+master+41-g7949d5a-git"
+
+# if upgrading from something older (including 3.4.2), kill the old daemon.
+# do this just once, this time, to allow systemd to manage it.
+if [ "$1" = 'upgrade' ]; then
+ if dpkg --compare-versions $2 lt $DH_SYSTEMD_REV; then
+ # we may not have init scripts here
+ start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE --name $NAME
+ fi
+fi
+
+#DEBHELPER#