aboutsummaryrefslogtreecommitdiffstats
path: root/main/gpsd/gpsd.initd
diff options
context:
space:
mode:
Diffstat (limited to 'main/gpsd/gpsd.initd')
-rw-r--r--main/gpsd/gpsd.initd48
1 files changed, 24 insertions, 24 deletions
diff --git a/main/gpsd/gpsd.initd b/main/gpsd/gpsd.initd
index ea7f2ad477..d2a30071a2 100644
--- a/main/gpsd/gpsd.initd
+++ b/main/gpsd/gpsd.initd
@@ -1,38 +1,38 @@
#!/sbin/openrc-run
-# Copyright 2012 Nathan Angelacos
-
-description="GPS daemon"
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
depend() {
- need net
- after firewall
- use ntp-server
+ after dbus
+ before ntpd
}
-GPS=${SVCNAME#*.}
-if [ -n "${GPS}" ] && [ ${SVCNAME} != "gpsd" ]; then
- GPSPID="/var/run/gpsd.${GPS}.pid"
-else
- GPSPID="/var/run/gpsd.pid"
-fi
+PIDFILE=/var/run/${SVCNAME}.pid
+DAEMON=/usr/sbin/gpsd
-start() {
+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 [ -z "${DEVICE}" ]; then
- eerror "Specify a GPS device in /etc/conf.d/${SVCNAME}"
- return 1
- fi
+ if [ -n "${GPSD_SOCKET}" ]; then
+ GPSD_OPTIONS="${GPSD_OPTIONS} -F ${GPSD_SOCKET}"
+ fi
+}
+start() {
+ checkconfig
ebegin "Starting gpsd"
- start-stop-daemon --start --quiet \
- --exec /usr/sbin/gpsd \
- -- ${ARGS} -P "${GPSPID}" ${DEVICE}
- eend $? "Failed to start 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 \
- --pidfile "${GPSPID}"
- eend $? "Failed to stop gpsd"
+ start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile ${PIDFILE}
+ eend $?
+ rm -f ${PIDFILE}
}