Control: tag -1 patch

El jueves, 9 de mayo de 2019 02:56:07 -03 Bernd Zeimetz escribió:
> Am 9. Mai 2019 03:15:08 MESZ schrieb "Lisandro Damián Nicanor Pérez Meyer" 
> <perezme...@gmail.com>:
[snip]
> >> Why?  gpsd should never ever be started automatically.
> >
> >I really don't want to sound aggressive nor anoying here here, but
> >just want to make use of a real-case example. Embedded system running
> >Debian in the middle of nowhere without internet connection and no
> >real time clock. GPS has a backup battery that helps maintain it's
> >clock when not powered, so it will have a valid time as soon as it's
> >being turned on. System starts and gpsd is used as fast as possible to
> >get data into ntp (needs -n). No gpsd clients are present, so nobody
> >will call it's socket.
> 
> Gpsdctl will do this for you,  when triggered by udev.

Except in the cases when udev can't handle it.
 
> >> Actually I think the solution you are looking for is to configure
> >
> >udev to handle your gps device properly. Unfortunately most gps devices
> >use standard usb to serial converters,  so we can't handle them all or
> >it will break other things.
> >
> >For those use cases there is gpsd's -n option, like in my example
> >above.
> 
> You can do this,  but this is neither how upstream intends this to work nor
> how you should do this. Udev is the proper way,  then unplugging and
> attaching the GPS will also work.

Oh, I now see why we might be disagreeing. I actually came to this because
we where discussing this in gpsd-dev. I'm not entirely sure to which exact
point you are referring, so:

- The -n option: this option is actually intended for those use cases where
  (a) you need to set up the system clock through gpsd and
  (b) when the user has a device that can't be detected by udev. I have
  actually been accepted a patch in order to clarify this a few days ago:

<http://git.savannah.gnu.org/cgit/gpsd.git/commit/?id=a3adc5e0b4e669b43af860aad56ddd8dbc826bef>

- Using systemd. I know that upstream developers don't precisely like systemd,
  but doesn't means it can be used. Actually it's a point in which we even
  agree with Fedora maintainers [a] and Gary Miller even asked for a more
  detailed way to set this up so it can be documented [b]. Actually from that
  same mail one could say that upstream does not likes the gpsd.socket unit
  file behavior, but I think we both agree that this works as expected.

[a] <http://lists.nongnu.org/archive/html/gpsd-dev/2019-05/msg00019.html>
[b] <http://lists.nongnu.org/archive/html/gpsd-dev/2019-05/msg00026.html>

> For those few cases where this doesn't work,  I think modifying a Systemd
> unit is no problem at all.

We can make it not even simpler but even (almost) distro-agnostic. I've
attached a patch for this (also created a merge request in your github
repo in case it fits you better). As you can see it's pretty straightforward,
just keep the WantedBy target in the unit file and use dh_installsystemd to
let the unit file be installed but not enabled nor started.

I have tested this in an up to date buster installation without issues.

**Please note**: with the current gpsd package in buster, and at least on
my system, gpsd will get started upon installation, but will not if the
machine is later rebooted. The same will keep happening with the attached
patch. I'm using a virtual machine to test, so that might be related.

Really trying to get the best for our users, Lisandro.

-- 
Lisandro Damián Nicanor Pérez Meyer
http://perezmeyer.com.ar/
http://perezmeyer.blogspot.com/
From 994ca106856edda4376b028bbbd6afc6d893485c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lisandro=20Dami=C3=A1n=20Nicanor=20P=C3=A9rez=20Meyer?=
 <perezme...@gmail.com>
Date: Wed, 8 May 2019 23:47:41 -0300
Subject: [PATCH] Allow gpsd.service to be enabled by the admin at boot time.

Be sure to keep it disabled. The admin needs to explicitely start
it if needed.
---
 debian/changelog                    | 8 ++++++++
 debian/patches/full-systemd-support | 5 ++---
 debian/rules                        | 3 ++-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 16bb69795..773da9499 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+gpsd (3.17-6.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Allow a sysadmin to start gpsd.service at boot time by enabling the unit
+    file, keeping it disabled at package installation (Closes: #928681).
+
+ -- Lisandro Damián Nicanor Pérez Meyer <lisan...@debian.org>  Wed, 08 May 2019 23:43:41 -0300
+
 gpsd (3.17-6) unstable; urgency=medium
 
   * [0a8e4e18] Pull json fixes from upstream to fix a stack-based
diff --git a/debian/patches/full-systemd-support b/debian/patches/full-systemd-support
index 4624e110a..0fd20724c 100644
--- a/debian/patches/full-systemd-support
+++ b/debian/patches/full-systemd-support
@@ -1,6 +1,6 @@
 --- a/systemd/gpsd.service
 +++ b/systemd/gpsd.service
-@@ -7,9 +7,7 @@ After=chronyd.service
+@@ -7,8 +7,7 @@ After=chronyd.service
  [Service]
  Type=forking
  EnvironmentFile=-/etc/default/gpsd
@@ -9,5 +9,4 @@
 +ExecStart=/usr/sbin/gpsd $GPSD_OPTIONS $DEVICES
  
  [Install]
--WantedBy=multi-user.target
- Also=gpsd.socket
+ WantedBy=multi-user.target
diff --git a/debian/rules b/debian/rules
index e458b9ca1..7e7e5a6fe 100755
--- a/debian/rules
+++ b/debian/rules
@@ -190,7 +190,8 @@ binary: install-stamp
 	dh_installdocs 
 	dh_installman 
 	dh_installmenu 
-	dh_systemd_enable -pgpsd
+	dh_installsystemd -pgpsd --restart-after-upgrade gpsdctl@.service gpsd.socket
+	dh_installsystemd -pgpsd --no-enable --no-start gpsd.service
 	dh_installinit
 	dh_systemd_start -pgpsd --restart-after-upgrade
 	dh_installexamples 
-- 
2.20.1

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to