summaryrefslogtreecommitdiff
path: root/gis/gpsd/rc.gpsd.new
diff options
context:
space:
mode:
authorDavid Spencer <baildon.research@googlemail.com>2014-02-05 00:01:02 +0700
committerErik Hanson <erik@slackbuilds.org>2014-02-08 11:10:10 -0600
commitb9fe91a6a6ca4c16369b0867db2e65f51ab39984 (patch)
tree6527795ca1ccaa3e00a87d4e866ae931fc1a572a /gis/gpsd/rc.gpsd.new
parent774dab7d85268a94737b5a6bed2e8dc76af48062 (diff)
downloadslackbuilds-b9fe91a6a6ca4c16369b0867db2e65f51ab39984.tar.gz
gis/gpsd: Updated for version 3.10 + Moved from System category.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'gis/gpsd/rc.gpsd.new')
-rw-r--r--gis/gpsd/rc.gpsd.new61
1 files changed, 61 insertions, 0 deletions
diff --git a/gis/gpsd/rc.gpsd.new b/gis/gpsd/rc.gpsd.new
new file mode 100644
index 0000000000..0db22b9600
--- /dev/null
+++ b/gis/gpsd/rc.gpsd.new
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# /etc/rc.d/rc.gpsd
+# Start/stop/restart gpsd
+# Sebastian Arcus and David Spencer
+#
+# To enable automatic discovery of your GPS device by udev, uncomment the
+# appropriate line of /etc/udev/rules.d/97-gpsd.rules
+#
+# Configuration options may be set in /etc/rc.d/rc.gpsd.conf
+# but the defaults will usually be adequate.
+
+gpsd_start() {
+
+ if [ ! -x /lib/udev/gpsd.hotplug ]; then
+ echo "$(basename $0): /lib/udev/gpsd.hotplug not found (or not executable); cannot start."
+ exit 1
+ fi
+
+ if [ -r /etc/rc.d/rc.gpsd.conf ]; then
+ . /etc/rc.d/rc.gpsd.conf
+ fi
+ # Set config defaults in case the .conf file was absent or bogus
+ GPSD_DEVICES="${GPSD_DEVICES:-/dev/gps*}"
+ GPSD_OPTIONS="${GPSD_OPTIONS:-}"
+ GPSD_SOCKET="${GPSD_SOCKET:-/var/run/gpsd.sock}"
+
+ for DEVNAME in $GPSD_DEVICES; do
+ if [ -e $DEVNAME ]; then
+ echo "$(basename $0): Starting gpsd for $DEVNAME"
+ ACTION=add DEVNAME=$DEVNAME /lib/udev/gpsd.hotplug
+ else
+ echo "$(basename $0): $DEVNAME not found, gpsd not started"
+ fi
+ done
+
+}
+
+gpsd_stop() {
+ echo "Stopping gpsd..."
+ killall gpsd >/dev/null 2>&1
+ return 0
+}
+
+case "$1" in
+ start)
+ gpsd_start
+ ;;
+ stop)
+ gpsd_stop
+ ;;
+ restart)
+ gpsd_stop
+ sleep 1
+ gpsd_start
+ ;;
+ *)
+ echo "Usage: $0 start|stop|restart"
+ exit 1
+ ;;
+esac