summaryrefslogtreecommitdiffstats
path: root/projectroot
diff options
context:
space:
mode:
authorLadislav Michl <ladis@linux-mips.org>2020-01-25 17:19:08 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2020-01-30 21:27:48 +0100
commit9a827af684dae9684e444722eb6af4dbc8950e4f (patch)
tree1f20f4f5d42c84f839a34d32e8f1707b56cd752e /projectroot
parent552dae8bcbf9e7baa8a6cb8d9f24ac4510720f6f (diff)
downloadptxdist-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>
Diffstat (limited to 'projectroot')
-rw-r--r--projectroot/usr/lib/systemd/system/gpsd.service11
-rw-r--r--projectroot/usr/lib/systemd/system/gpsd.socket15
-rw-r--r--projectroot/usr/lib/systemd/system/gpsdctl@.service12
3 files changed, 38 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