summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sci-geosciences/gpsd/files/gpsd.init-2')
-rwxr-xr-xsci-geosciences/gpsd/files/gpsd.init-239
1 files changed, 39 insertions, 0 deletions
diff --git a/sci-geosciences/gpsd/files/gpsd.init-2 b/sci-geosciences/gpsd/files/gpsd.init-2
new file mode 100755
index 000000000000..ad734e34d987
--- /dev/null
+++ b/sci-geosciences/gpsd/files/gpsd.init-2
@@ -0,0 +1,39 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+depend() {
+ after dbus
+ before ntpd
+}
+
+PIDFILE=/var/run/${SVCNAME}.pid
+DAEMON=/usr/sbin/gpsd
+
+checkconfig() {
+ # Note: these GPSD_xxx var names should be kept in sync with the udev rules.
+ if [ -z "${GPSD_SOCKET}" ] && [ -z "${DEVICES}" ]; then
+ GPSD_SOCKET="/var/run/gpsd.sock"
+ fi
+
+ if [ -n "${GPSD_SOCKET}" ]; then
+ GPSD_OPTIONS="${GPSD_OPTIONS} -F ${GPSD_SOCKET}"
+ fi
+}
+
+start() {
+ checkconfig
+ ebegin "Starting gpsd"
+
+ start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- \
+ ${GPSD_OPTIONS} -P ${PIDFILE} ${DEVICES}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping gpsd"
+ start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile ${PIDFILE}
+ eend $?
+ rm -f ${PIDFILE}
+}