summaryrefslogtreecommitdiffstats
path: root/system/gpsd/rc.gpsd.new
diff options
context:
space:
mode:
author David Spencer <baildon.research@googlemail.com>2011-09-07 23:21:01 -0400
committer Niels Horn <niels.horn@slackbuilds.org>2011-09-21 19:48:31 -0300
commite6f17288e3d02ddfe3eeb063b637d0986c7bce5f (patch)
tree02765da686bdf6831a4e3dfb22e518835e509d02 /system/gpsd/rc.gpsd.new
parent9080a47e3d7349cc58bf15b944af817a25cf39b2 (diff)
downloadslackbuilds-e6f17288e3d02ddfe3eeb063b637d0986c7bce5f.tar.gz
slackbuilds-e6f17288e3d02ddfe3eeb063b637d0986c7bce5f.tar.xz
system/gpsd: Downgraded to version 2.95 due to API breakage.
Added rc.* files and *.desktop files. Added udev rules and scripts. Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
Diffstat (limited to 'system/gpsd/rc.gpsd.new')
-rw-r--r--system/gpsd/rc.gpsd.new60
1 files changed, 60 insertions, 0 deletions
diff --git a/system/gpsd/rc.gpsd.new b/system/gpsd/rc.gpsd.new
new file mode 100644
index 0000000000..0eee30306a
--- /dev/null
+++ b/system/gpsd/rc.gpsd.new
@@ -0,0 +1,60 @@
+#!/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.wrapper ]; then
+ echo "$(basename $0): /lib/udev/gpsd.hotplug.wrapper not found (or not executable); cannot start."
+ 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.wrapper
+ 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