diff options
author | Ladislav Michl <ladis@linux-mips.org> | 2020-01-25 17:19:08 +0100 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2020-01-30 21:27:48 +0100 |
commit | 9a827af684dae9684e444722eb6af4dbc8950e4f (patch) | |
tree | 1f20f4f5d42c84f839a34d32e8f1707b56cd752e | |
parent | 552dae8bcbf9e7baa8a6cb8d9f24ac4510720f6f (diff) | |
download | ptxdist-9a827af684dae9684e444722eb6af4dbc8950e4f.tar.gz ptxdist-9a827af684dae9684e444722eb6af4dbc8950e4f.tar.xz |
gpsd: Optionally install systemd unit files
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r-- | projectroot/usr/lib/systemd/system/gpsd.service | 11 | ||||
-rw-r--r-- | projectroot/usr/lib/systemd/system/gpsd.socket | 15 | ||||
-rw-r--r-- | projectroot/usr/lib/systemd/system/gpsdctl@.service | 12 | ||||
-rw-r--r-- | rules/gpsd.in | 11 | ||||
-rw-r--r-- | rules/gpsd.make | 15 |
5 files changed, 64 insertions, 0 deletions
diff --git a/projectroot/usr/lib/systemd/system/gpsd.service b/projectroot/usr/lib/systemd/system/gpsd.service new file mode 100644 index 000000000..53c0b96bb --- /dev/null +++ b/projectroot/usr/lib/systemd/system/gpsd.service @@ -0,0 +1,11 @@ +[Unit] +Description=GPS (Global Positioning System) Daemon +Requires=gpsd.socket + +[Service] +Type=forking +ExecStart=/usr/sbin/gpsd @ARGS@ + +[Install] +WantedBy=multi-user.target +Also=gpsd.socket diff --git a/projectroot/usr/lib/systemd/system/gpsd.socket b/projectroot/usr/lib/systemd/system/gpsd.socket new file mode 100644 index 000000000..bc7682116 --- /dev/null +++ b/projectroot/usr/lib/systemd/system/gpsd.socket @@ -0,0 +1,15 @@ +[Unit] +Description=GPS (Global Positioning System) Daemon Sockets + +[Socket] +ListenStream=/var/run/gpsd.sock +ListenStream=[::1]:2947 +ListenStream=127.0.0.1:2947 +# To allow gpsd remote access, start gpsd with the -G option and +# uncomment the next two lines: +# ListenStream=[::1]:2947 +# ListenStream=0.0.0.0:2947 +SocketMode=0600 + +[Install] +WantedBy=sockets.target diff --git a/projectroot/usr/lib/systemd/system/gpsdctl@.service b/projectroot/usr/lib/systemd/system/gpsdctl@.service new file mode 100644 index 000000000..24d291408 --- /dev/null +++ b/projectroot/usr/lib/systemd/system/gpsdctl@.service @@ -0,0 +1,12 @@ +[Unit] +Description=Manage %I for GPS daemon +Requires=gpsd.socket +BindsTo=dev-%i.device +After=dev-%i.device + +[Service] +Type=oneshot +Environment="GPSD_SOCKET=/var/run/gpsd.sock" +RemainAfterExit=yes +ExecStart=/usr/bin/gpsdctl add /dev/%I +ExecStop=/usr/bin/gpsdctl remove /dev/%I diff --git a/rules/gpsd.in b/rules/gpsd.in index 660088969..57731d040 100644 --- a/rules/gpsd.in +++ b/rules/gpsd.in @@ -278,6 +278,17 @@ 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_GPSD_ARGS + string + depends on GPSD_SYSTEMD_UNIT + prompt "gpsd arguments" + config GPSD_GPS2UDP bool prompt "gps2udp" diff --git a/rules/gpsd.make b/rules/gpsd.make index ae4e0628e..afe02c925 100644 --- a/rules/gpsd.make +++ b/rules/gpsd.make @@ -171,6 +171,21 @@ $(STATEDIR)/gpsd.targetinstall: ifdef PTXCONF_GPSD_GPSD @$(call install_copy, gpsd, 0, 0, 0755, -, /usr/sbin/gpsd) endif +ifdef PTXCONF_GPSD_SYSTEMD_UNIT + @$(call install_alternative, gpsd, 0, 0, 644, \ + /usr/lib/systemd/system/gpsd.service) + @$(call install_replace, gpsd, \ + /usr/lib/systemd/system/gpsd.service, \ + @ARGS@, $(PTXCONF_GPSD_GPSD_ARGS)) + @$(call install_link, gpsd, ../gpsd.service, \ + /usr/lib/systemd/system/multi-user.target.wants/gpsd.service) + @$(call install_alternative, gpsd, 0, 0, 644, \ + /usr/lib/systemd/system/gpsd.socket) +ifdef PTXCONF_GPSD_GPSCTL + @$(call install_alternative, gpsd, 0, 0, 644, \ + /usr/lib/systemd/system/gpsdctl@.service) +endif +endif ifdef PTXCONF_GPSD_PYTHON @$(call install_glob, gpsd, 0, 0, -, \ /usr/lib/python$(PYTHON3_MAJORMINOR), *.so *.py) |