2024-07-19 06:37:39 +02:00
|
|
|
# As usual this is a systemd drop-in, so I can adjust what gpsd.service does
|
|
|
|
# without having to fight with package management.
|
2024-07-18 12:03:09 +02:00
|
|
|
[Service]
|
2024-07-18 16:14:45 +02:00
|
|
|
Type=exec
|
2024-07-19 06:37:39 +02:00
|
|
|
# In case the file exists, I can throw my own additional options there
|
2024-07-18 12:03:09 +02:00
|
|
|
EnvironmentFile=-/etc/gpsd.aminda.conf
|
2024-07-19 06:37:39 +02:00
|
|
|
# Kernel module possibly required for USB GPS devices especially with Chrony?
|
2024-07-18 16:14:45 +02:00
|
|
|
ExecStartPre=-/usr/sbin/modprobe pps_ldisc
|
2024-07-19 06:37:39 +02:00
|
|
|
# Handle failure situation of the socket not going away (ExecStartPost=)
|
2024-07-19 06:57:30 +02:00
|
|
|
ExecStartPre=-/usr/bin/rm -vf /var/run/gps-share.sock
|
2024-07-19 06:37:39 +02:00
|
|
|
# Empty ExecStart= before the actual ExecStart= removes the original
|
|
|
|
# ExecStart= line
|
|
|
|
ExecStart=
|
|
|
|
ExecStart=/usr/sbin/gpsd /dev/gps0 --nowait --foreground $AMINDAGPSD
|
|
|
|
# Creating a socket for geoclue to connect to
|
|
|
|
# Credit: @schnell at https://gitlab.freedesktop.org/geoclue/geoclue/-/issues/145#note_1772702
|
2024-07-19 06:57:30 +02:00
|
|
|
ExecStartPost=/bin/sh -c "(sleep 5 && gpspipe --nmea | ( read; read; read; cat ) | ncat --verbose --keep-open --listen --unixsock /var/run/gps-share.sock&)"
|
2024-07-19 06:37:39 +02:00
|
|
|
# In case of clean shutdown, remove the socket for restart
|
2024-07-19 06:57:30 +02:00
|
|
|
ExecStopPost=-/usr/bin/rm -vf /var/run/gps-share.sock
|
2024-07-19 06:37:39 +02:00
|
|
|
# Missing from the original unit, will reconnect all GPS says man gpsd
|
2024-07-18 16:14:45 +02:00
|
|
|
ExecReload=/usr/bin/killall -HUP gpsd
|
2024-07-19 06:37:39 +02:00
|
|
|
# Avoiding systemd considering the unit as failed.
|
2024-07-18 16:14:45 +02:00
|
|
|
Restart=always
|
|
|
|
RestartSec=5s
|
2024-07-19 06:37:39 +02:00
|
|
|
# vim: filetype=systemd
|