mirror of
https://gitea.blesmrt.net/mikaela/shell-things.git
synced 2024-11-22 03:09:22 +01:00
systemd: move gpsd nmea socket from gpsd to geoclue
This commit is contained in:
parent
bcdd54426c
commit
a8530221aa
@ -1,4 +1,4 @@
|
||||
[network-nmea]
|
||||
enable=true
|
||||
# Refer to ../../systemd/system/gpsd.service.d/aminda-additions.conf
|
||||
nmea-socket=/var/run/gps-share.sock
|
||||
# Refer to ../../systemd/system/geoclue.service.d/gpsd-socket.conf
|
||||
nmea-socket=/tmp/gps-share.sock
|
||||
|
21
etc/systemd/system/geoclue.service.d/gpsd-socket.conf
Normal file
21
etc/systemd/system/geoclue.service.d/gpsd-socket.conf
Normal file
@ -0,0 +1,21 @@
|
||||
# systemd drop-in for ensuring geoclue has a socket to get GPS location from
|
||||
|
||||
# Weak dependency of geoclue pulling gpsd on so gpspipe might work?
|
||||
[Unit]
|
||||
Wants=gpsd.service gpsd.socket
|
||||
|
||||
# NOTE: /tmp is not /tmp, because the unit has systemd PrivateTmp. And
|
||||
# SELINUX dislikes this, so
|
||||
# ausearch -c 'geoclue' --raw | audit2allow -M my-geoclue
|
||||
# semodule -X 300 -i my-geoclue.pp
|
||||
|
||||
[Service]
|
||||
# Handle failure situation of the socket not going away (ExecStartPost=)
|
||||
ExecStartPre=-/tmp/gps-share.sock
|
||||
# Creating a socket for geoclue to connect to
|
||||
# Credit: @schnell at https://gitlab.freedesktop.org/geoclue/geoclue/-/issues/145#note_1772702
|
||||
ExecStartPost=/bin/sh -c "(gpspipe --nmea | ( read; read; read; cat ) | ncat --verbose --keep-open --listen --unixsock /tmp/gps-share.sock&)"
|
||||
# In case of clean shutdown, remove the socket for restart
|
||||
ExecStopPost=-/usr/bin/rm -vf /tmp/gps-share.sock
|
||||
|
||||
# vim: filetype=systemd
|
@ -6,17 +6,10 @@ Type=exec
|
||||
EnvironmentFile=-/etc/gpsd.aminda.conf
|
||||
# Kernel module possibly required for USB GPS devices especially with Chrony?
|
||||
ExecStartPre=-/usr/sbin/modprobe pps_ldisc
|
||||
# Handle failure situation of the socket not going away (ExecStartPost=)
|
||||
ExecStartPre=-/usr/bin/rm -vf /var/run/gps-share.sock
|
||||
# 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
|
||||
ExecStartPost=/bin/sh -c "(sleep 5 && gpspipe --nmea | ( read; read; read; cat ) | ncat --verbose --keep-open --listen --unixsock /var/run/gps-share.sock&)"
|
||||
# In case of clean shutdown, remove the socket for restart
|
||||
ExecStopPost=-/usr/bin/rm -vf /var/run/gps-share.sock
|
||||
# Missing from the original unit, will reconnect all GPS says man gpsd
|
||||
ExecReload=/usr/bin/killall -HUP gpsd
|
||||
# Avoiding systemd considering the unit as failed.
|
||||
|
Loading…
Reference in New Issue
Block a user