mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH] gpsd: Optionally install systemd unit files
Date: Mon, 6 Jan 2020 11:56:11 +0100	[thread overview]
Message-ID: <20200106105611.GC5858@pengutronix.de> (raw)
In-Reply-To: <20191206103527.GA2137842@lenoch>

On Fri, Dec 06, 2019 at 11:35:27AM +0100, Ladislav Michl wrote:
> On Fri, Dec 06, 2019 at 11:21:56AM +0100, Michael Olbrich wrote:
> > On Fri, Dec 06, 2019 at 09:05:14AM +0100, Ladislav Michl wrote:
> > > Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> > > ---
> > >  Note, udev rules and sysv init script are left as an excercise
> > >  for respective users (I do not have hardware to test with) :)
> > > 
> > >  ...ice-files-to-match-installation-path.patch | 37 +++++++++++++++++++
> > >  patches/gpsd-3.19/series                      |  3 +-
> > >  projectroot/etc/default/gpsd                  |  5 +++
> > >  rules/gpsd.in                                 |  6 +++
> > >  rules/gpsd.make                               | 14 +++++++
> > >  5 files changed, 64 insertions(+), 1 deletion(-)
> > >  create mode 100644 patches/gpsd-3.19/0003-Fix-systemd-service-files-to-match-installation-path.patch
> > >  create mode 100644 projectroot/etc/default/gpsd
> > > 
> > > diff --git a/patches/gpsd-3.19/0003-Fix-systemd-service-files-to-match-installation-path.patch b/patches/gpsd-3.19/0003-Fix-systemd-service-files-to-match-installation-path.patch
> > > new file mode 100644
> > > index 000000000..e88320b91
> > > --- /dev/null
> > > +++ b/patches/gpsd-3.19/0003-Fix-systemd-service-files-to-match-installation-path.patch
> > > @@ -0,0 +1,37 @@
> > > +From: Ladislav Michl <ladis@linux-mips.org>
> > > +Date: Fri, 6 Dec 2019 08:12:03 +0100
> > > +Subject: [PATCH] Fix systemd service files to match installation path
> > > +
> > > +---
> > > + systemd/gpsd.service     | 3 +--
> > > + systemd/gpsdctl@.service | 5 ++---
> > 
> > I'd prefer custom files in projectroot instead of the patch.
> 
> Well, I decided to patch gpsd instead of projectroot file as this way we
> notice something changed upstream. But I have no strong preference here.
> 
> > > + 2 files changed, 3 insertions(+), 5 deletions(-)
> > > +
> > > +diff --git a/systemd/gpsd.service b/systemd/gpsd.service
> > > +index c1f193cc6942..6fa229561adf 100644
> > > +--- a/systemd/gpsd.service
> > > ++++ b/systemd/gpsd.service
> > > +@@ -7,8 +7,7 @@ After=chronyd.service
> > > + [Service]
> > > + Type=forking
> > > + EnvironmentFile=-/etc/default/gpsd
> > > +-EnvironmentFile=-/etc/sysconfig/gpsd
> > > +-ExecStart=/usr/local/sbin/gpsd $GPSD_OPTIONS $OPTIONS $DEVICES
> > > ++ExecStart=/usr/sbin/gpsd $GPSD_OPTIONS $DEVICES
> > > + 
> > > + [Install]
> > > + WantedBy=multi-user.target
> > > +diff --git a/systemd/gpsdctl@.service b/systemd/gpsdctl@.service
> > > +index 1c80101de340..58c5176defae 100644
> > > +--- a/systemd/gpsdctl@.service
> > > ++++ b/systemd/gpsdctl@.service
> > > +@@ -8,7 +8,6 @@ After=dev-%i.device
> > > + Type=oneshot
> > > + Environment="GPSD_SOCKET=/var/run/gpsd.sock"
> > > + EnvironmentFile=-/etc/default/gpsd
> > > +-EnvironmentFile=-/etc/sysconfig/gpsd
> > > + RemainAfterExit=yes
> > > +-ExecStart=/bin/sh -c "[ \"$USBAUTO\" = true ] && /usr/local/sbin/gpsdctl add /dev/%I || :"
> > > +-ExecStop=/bin/sh -c "[ \"$USBAUTO\" = true ] && /usr/local/sbin/gpsdctl remove /dev/%I || :"
> > > ++ExecStart=/bin/sh -c "[ \"$USBAUTO\" = true ] && /usr/sbin/gpsdctl add /dev/%I || :"
> > > ++ExecStop=/bin/sh -c "[ \"$USBAUTO\" = true ] && /usr/sbin/gpsdctl remove /dev/%I || :"
> > > diff --git a/patches/gpsd-3.19/series b/patches/gpsd-3.19/series
> > > index 32349387e..9250c5aaf 100644
> > > --- a/patches/gpsd-3.19/series
> > > +++ b/patches/gpsd-3.19/series
> > > @@ -2,4 +2,5 @@
> > >  #tag:base --start-number 1
> > >  0001-Search-for-ncursesw-pkgconfig.patch
> > >  0002-Fix-python-binding-cross-compilation.patch
> > > -# a402ea49345e59dc5c9f5487c0ce65c6  - git-ptx-patches magic
> > > +0003-Fix-systemd-service-files-to-match-installation-path.patch
> > > +# 4ae3d41ecea44cc4df7cf9e46c50b850  - git-ptx-patches magic
> > > diff --git a/projectroot/etc/default/gpsd b/projectroot/etc/default/gpsd
> > > new file mode 100644
> > > index 000000000..8a860598b
> > > --- /dev/null
> > > +++ b/projectroot/etc/default/gpsd
> > > @@ -0,0 +1,5 @@
> > > +# Devices gpsd should connect at boot time
> > > +DEVICES=""
> > > +
> > > +# Other options passed to gpsd
> > > +GPSD_OPTIONS=""
> > 
> > No. Overwriting this file or the service file in the BSP make no
> > difference. There is no admin who might want to modify this file. Just
> > provide a service without the EnvironmentFile=. It can be overwritten in
> > the BSP if necessary.
> 
> This will add additional work for whoever wants to support sysv init as
> config is shared.

Only if someone uses both systemd and sysv init and I don't think anyone
does this in one project.

> Also I recently added Linux-PAM, shadow-utils, updated SELinux and added

You've updated the SELinux packages? I've moved that stuff to staging
because it was very old. And I've not used tested this in a long time. So
you'll need to upstream your SELinux packages or the SELinux support will
be removed completely in a year or so.

> global PAM and ACL options, so I feel this could be pretty decent desktop
> distro with myself as an admin ;-)

I'd like to keep PTXdist as simple as possible in that regard. And in this
case drop-in files work just as well as a EnvironmentFile=.

> So dropping config option and using BSP files if found sounds sane to me.
> Or is failing out on not found file preferable? (as default service file
> makes no sense)

Please add the units to projectroot/ in PTXdist. This should work out of
the box without extra files. Just make the units as simple as possible.

Michael

> 	ladis
> 
> > Michael
> > 
> > > diff --git a/rules/gpsd.in b/rules/gpsd.in
> > > index 660088969..aebf735d6 100644
> > > --- a/rules/gpsd.in
> > > +++ b/rules/gpsd.in
> > > @@ -278,6 +278,12 @@ menu "install options"
> > >  		  queries with a format that is substantially easier to
> > >  		  parse than the NMEA 0183 emitted by most GPS receivers.
> > >  
> > > +	config GPSD_SYSTEMD_UNIT
> > > +		bool
> > > +		default y
> > > +		depends on INITMETHOD_SYSTEMD && GPSD_GPSD
> > > +		prompt "systemd unit files for gpsd"
> > > +
> > >  	config GPSD_GPS2UDP
> > >  		bool
> > >  		prompt "gps2udp"
> > > diff --git a/rules/gpsd.make b/rules/gpsd.make
> > > index ae4e0628e..a3a5c8ba4 100644
> > > --- a/rules/gpsd.make
> > > +++ b/rules/gpsd.make
> > > @@ -151,6 +151,12 @@ ifneq ($(call remove_quotes,$(PTXCONF_GPSD_MAX_DEVICES)),)
> > >  GPSD_CONF_OPT += max_devices=$(PTXCONF_GPSD_MAX_DEVICES)
> > >  endif
> > >  
> > > +# ----------------------------------------------------------------------------
> > > +# Install
> > > +# ----------------------------------------------------------------------------
> > > +
> > > +GPSD_INSTALL_OPT := udev-install
> > > +
> > >  # ----------------------------------------------------------------------------
> > >  # Target-Install
> > >  # ----------------------------------------------------------------------------
> > > @@ -174,6 +180,14 @@ endif
> > >  ifdef PTXCONF_GPSD_PYTHON
> > >  	@$(call install_glob, gpsd, 0, 0, -, \
> > >  		/usr/lib/python$(PYTHON3_MAJORMINOR), *.so *.py)
> > > +endif
> > > +ifdef PTXCONF_GPSD_SYSTEMD_UNIT
> > > +	@$(call install_alternative, gpsd, 0, 0, 644, /etc/default/gpsd)
> > > +	@$(call install_alternative, gpsd, 0, 0, 644, /lib/systemd/system/gpsdctl@.service)
> > > +	@$(call install_alternative, gpsd, 0, 0, 644, /lib/systemd/system/gpsd.service)
> > > +	@$(call install_link, gpsd, ../gpsd.service, \
> > > +		/lib/systemd/system/multi-user.target.wants/gpsd.service)
> > > +	@$(call install_alternative, gpsd, 0, 0, 644, /lib/systemd/system/gpsd.socket)
> > >  endif
> > >  	@$(call install_finish, gpsd)
> > >  
> > > -- 
> > > 2.24.0
> > > 
> > > 
> > > _______________________________________________
> > > ptxdist mailing list
> > > ptxdist@pengutronix.de
> > > 
> > 
> > -- 
> > Pengutronix e.K.                           |                             |
> > Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> > 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> > Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> > 
> > _______________________________________________
> > ptxdist mailing list
> > ptxdist@pengutronix.de
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

      reply	other threads:[~2020-01-06 10:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-06  8:05 Ladislav Michl
2019-12-06 10:21 ` Michael Olbrich
2019-12-06 10:35   ` Ladislav Michl
2020-01-06 10:56     ` Michael Olbrich [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200106105611.GC5858@pengutronix.de \
    --to=m.olbrich@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox