Hi,

On Sat, Mar 11, 2017 at 02:35:20PM +0100, Wolfgang Schweer wrote:
> > To recap, the behaviour should be as follows (IMHO):
> > on fresh install, the service is disabled and not started
> > on upgrade
> > * if the service was enabled, it remains enabled and gets restarted
> > * if the service was disabled, it remains so and is not started
> 
> Yeah; good summary.
> If the half-broken --no-start option would be used (to fix the RC bug) 
> then maybe a NEWS.Debian file could be shipped to inform about the steps 
> to take in case of upgrades.

Agreed.

But with the help of fsateler and the postinst of src:puppet, I think I now
have a working solution. Just call update-rc.d disable on a fresh install.

Can you please test the attached patch?

Regards
Evgeni

>From 87320b76e2d7c7e055eb6ae85828d22c90d02442 Mon Sep 17 00:00:00 2001
From: Evgeni Golov <evg...@debian.org>
Date: Sat, 11 Mar 2017 14:58:59 +0100
Subject: [PATCH] call update-rc.d thinkfan disable on fresh installs

Closes: #758579
---
 debian/thinkfan.lintian-overrides |  3 +++
 debian/thinkfan.postinst          | 21 +++++++++++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 debian/thinkfan.lintian-overrides
 create mode 100644 debian/thinkfan.postinst

diff --git a/debian/thinkfan.lintian-overrides b/debian/thinkfan.lintian-overrides
new file mode 100644
index 0000000..62ce724
--- /dev/null
+++ b/debian/thinkfan.lintian-overrides
@@ -0,0 +1,3 @@
+# pre-deployment of a disabled service as dh_installinit is
+# not capable to do so for us.
+thinkfan: duplicate-updaterc.d-calls-in-postinst thinkfan
diff --git a/debian/thinkfan.postinst b/debian/thinkfan.postinst
new file mode 100644
index 0000000..7ea8f60
--- /dev/null
+++ b/debian/thinkfan.postinst
@@ -0,0 +1,21 @@
+#!/bin/sh
+# postinst script for thinkfan
+#
+# see: dh_installdeb(1)
+
+set -e
+
+if [ "$1" = "configure" ]; then
+	if [ -x "/etc/init.d/thinkfan" ] && [ -z "$2" ]; then
+		# Disable the service by default on new installations
+		update-rc.d thinkfan defaults >/dev/null || true
+		update-rc.d thinkfan disable >/dev/null || true
+	fi
+fi
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
-- 
2.11.0

Reply via email to