Hi.

I did some digging into this and it seems that the issue is that the
debhelper includes sections from dh_installsystemd which both unmasks and
starts the service (irregardless of what has been done before).

A quick-and-dirty fix to this is to move the debhelper section in
debian/hostapd.postinst before the check if the package should be masked (I
tested this and it worked for me). The problem with this is that systemd
will try to activate the service once before masking it and that it relies
on the fact that hostapd has died before running the check.

What I decided to do for myself was to override the dh_installsystemd
target in the rules file and install it as an else if the package was not
decided to be masked. I'm not sure if this is what the package maintainer
aims to do with the postinst, but it should solve the problem described in
the bug.

I've attached a patch with the aforementioned fix, the patch is built on
d569f1dda5f4bd1c4b36bb438dc94fd6c85a6def (2:2.7+git20190128+0c1e29f-5)
commit 44d1af878437cb9becac07ec59a6b3591cf08606
Author: Kristofer Hansson <kristofer.hans...@icomera.com>
Date:   Tue May 28 13:27:45 2019 +0000

    wpa (2:2.7+git20190128+0c1e29f-5+nmu1) unstable; urgency=medium
    
    * Made sure that hostapd is unmasked if no config available.
    (Closes: #928948)

diff --git a/debian/changelog b/debian/changelog
index 35a81f4..72a2389 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+wpa (2:2.7+git20190128+0c1e29f-5+nmu1) unstable; urgency=medium
+
+  * Made sure that hostapd is unmasked if no config available.
+    (Closes: #928948)
+
+ -- Kristofer Hansson <kristofer.hans...@icomera.com>  Tue, 28 May 2019 13:26:31 +0000
+
 wpa (2:2.7+git20190128+0c1e29f-5) unstable; urgency=high
 
   * Fix security issue 2019-5:
diff --git a/debian/hostapd.postinst.post-systemd b/debian/hostapd.postinst.post-systemd
new file mode 100644
index 0000000..6ed40de
--- /dev/null
+++ b/debian/hostapd.postinst.post-systemd
@@ -0,0 +1,2 @@
+    fi
+fi
\ No newline at end of file
diff --git a/debian/hostapd.postinst b/debian/hostapd.postinst.pre-systemd
old mode 100755
new mode 100644
similarity index 72%
rename from debian/hostapd.postinst
rename to debian/hostapd.postinst.pre-systemd
index 8966f83..45e0cc8
--- a/debian/hostapd.postinst
+++ b/debian/hostapd.postinst.pre-systemd
@@ -1,16 +1,8 @@
-#!/bin/sh
-
-set -e
-
 if [ -d /run/systemd/system ] && [ "$1" = configure ]
 then
     DAEMON_CONF=
     . /etc/default/hostapd
     if [ -z "$DAEMON_CONF" ] && [ ! -r /etc/hostapd/hostapd.conf ] && ! systemctl --quiet is-active hostapd.service
     then
-	    systemctl mask hostapd.service
-    fi
-fi
-
-#DEBHELPER#
-exit 0
+        systemctl mask hostapd.service
+    else
diff --git a/debian/rules b/debian/rules
index 9f68be3..cd78839 100755
--- a/debian/rules
+++ b/debian/rules
@@ -87,6 +87,11 @@ override_dh_install:
 	install --mode=755 -D wpa_supplicant/wpa_supplicant-udeb \
 		debian/wpasupplicant-udeb/sbin/wpa_supplicant
 
+override_dh_installsystemd:
+	cat debian/hostapd.postinst.pre-systemd >> debian/.debhelper/generated/hostapd/postinst.service
+	dh_installsystemd
+	cat debian/hostapd.postinst.post-systemd >> debian/.debhelper/generated/hostapd/postinst.service
+
 override_dh_installchangelogs:
 	dh_installchangelogs --package=hostapd hostapd/ChangeLog
 	dh_installchangelogs --package=wpasupplicant wpa_supplicant/ChangeLog

Reply via email to