summaryrefslogtreecommitdiff
path: root/systemd
diff options
context:
space:
mode:
authorBernd Zeimetz <bernd@bzed.de>2014-08-17 12:21:14 +0200
committerBernd Zeimetz <bernd@bzed.de>2014-08-17 12:21:14 +0200
commit5c7a4fe2eb6d6ce071d3c50aba76f9a9b4753931 (patch)
tree4fe620727ad494624e198cc16134a69826571a96 /systemd
parentbdafaf38d1eb4cd35e1d1daf5bad842962b1aa18 (diff)
downloadgpsd-5c7a4fe2eb6d6ce071d3c50aba76f9a9b4753931.tar.gz
Bring systemd handing into a useful shape.
I'm merging the changes that were done in the gpsd packaging in Fedora and Debian. With systemd being enabled, the hotplug script is not being used anymore, instead run the gpsdctl@.service unit. /etc/default/gpsd and /etc/sysconfig/gpsd are read as EnvironmentFile to keep the shipped config useable on RedHat/Debian-like systems at least. The udev-install rule now also depends on systemd_install and systemctl_daemon_reload. With these changes, hotplugging on systemd enabled systems seems to work well on Debian and Fedora.
Diffstat (limited to 'systemd')
-rw-r--r--systemd/gpsd.service4
-rw-r--r--systemd/gpsd.socket1
-rw-r--r--systemd/gpsdctl@.service13
3 files changed, 17 insertions, 1 deletions
diff --git a/systemd/gpsd.service b/systemd/gpsd.service
index 8deaf759..ef760a1e 100644
--- a/systemd/gpsd.service
+++ b/systemd/gpsd.service
@@ -3,7 +3,9 @@ Description=GPS (Global Positioning System) Daemon
Requires=gpsd.socket
[Service]
-ExecStart=/usr/sbin/gpsd -N
+EnvironmentFile=-/etc/default/gpsd
+EnvironmentFile=-/etc/sysconfig/gpsd
+ExecStart=/usr/sbin/gpsd -N $GPSD_OPTIONS $DEVICES
[Install]
Also=gpsd.socket
diff --git a/systemd/gpsd.socket b/systemd/gpsd.socket
index 4836c4ea..4c1502af 100644
--- a/systemd/gpsd.socket
+++ b/systemd/gpsd.socket
@@ -3,6 +3,7 @@ Description=GPS (Global Positioning System) Daemon Sockets
[Socket]
ListenStream=/var/run/gpsd.sock
+ListenStream=[::1]:2947
ListenStream=127.0.0.1:2947
SocketMode=0600
diff --git a/systemd/gpsdctl@.service b/systemd/gpsdctl@.service
new file mode 100644
index 00000000..58c5176d
--- /dev/null
+++ b/systemd/gpsdctl@.service
@@ -0,0 +1,13 @@
+[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"
+EnvironmentFile=-/etc/default/gpsd
+RemainAfterExit=yes
+ExecStart=/bin/sh -c "[ \"$USBAUTO\" = true ] && /usr/sbin/gpsdctl add /dev/%I || :"
+ExecStop=/bin/sh -c "[ \"$USBAUTO\" = true ] && /usr/sbin/gpsdctl remove /dev/%I || :"