diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2006-07-26 04:59:26 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2006-07-26 04:59:26 +0000 |
commit | 6e664ba3dd89a53814aa037892a81fa4c72393f2 (patch) | |
tree | 19e1569a70c61036b59680b59f64ef26c2f0b637 | |
parent | 38af43c1b42475ed9b2025834b9df94baf183eca (diff) | |
download | gpsd-6e664ba3dd89a53814aa037892a81fa4c72393f2.tar.gz |
Debian init files from Tilman Koschnick <til@subnetz.org>.
-rw-r--r-- | contrib/README | 2 | ||||
-rw-r--r-- | contrib/etc_default_gpsd | 5 | ||||
-rw-r--r-- | contrib/etc_init.d_gpsd | 71 |
3 files changed, 78 insertions, 0 deletions
diff --git a/contrib/README b/contrib/README new file mode 100644 index 00000000..1d90a6a9 --- /dev/null +++ b/contrib/README @@ -0,0 +1,2 @@ +etc_default_gpsd and etc_init.d_gpsd are Debian init files to be +used when it is desired to support gpsd using a set of serial GPSes. diff --git a/contrib/etc_default_gpsd b/contrib/etc_default_gpsd new file mode 100644 index 00000000..a82b793b --- /dev/null +++ b/contrib/etc_default_gpsd @@ -0,0 +1,5 @@ +# Default settings for gpsd. This file is sourced from +# /etc/init.d/gpsd. +START_DAEMON="false" +DAEMON_OPTS="" +DEVICES="" diff --git a/contrib/etc_init.d_gpsd b/contrib/etc_init.d_gpsd new file mode 100644 index 00000000..e7b56dff --- /dev/null +++ b/contrib/etc_init.d_gpsd @@ -0,0 +1,71 @@ +#! /bin/sh +# +# Author: Tilman Koschnick <til@subnetz.org>. +# + +### BEGIN INIT INFO +# Provides: gpsd +# Required-Start: $syslog $network +# Required-Stop: $syslog $network +# Default-Start: 2 3 4 5 +# Default-Stop: S 1 0 6 +### END INIT INFO + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/bin/gpsd +NAME=gpsd +DESC="GPS daemon" +PIDFILE="/var/run/gpsd.pid" +SELF=$(cd $(dirname $0); pwd -P)/$(basename $0) + +test -x $DAEMON || exit 0 + +# include gpsd defaults +if [ -f /etc/default/gpsd ] ; then + . /etc/default/gpsd +else + echo "$NAME: Cannot find /etc/default/gpsd - failed." + exit 1 +fi + +set -e + +case "$1" in + start) + if [ "x$START_DAEMON" = "xtrue" ] ; then + echo -n "Starting $DESC: $NAME" + start-stop-daemon --start --quiet \ + --exec $DAEMON -- $DAEMON_OPTS -P $PIDFILE $DEVICES \ + && echo "." \ + || echo " - failed." + else + echo "$NAME is configured not to start automatically at boot time." + echo " To change this, modify /etc/default/gpsd." + fi + ;; + stop) + if [ "x$START_DAEMON" = "xtrue" ] ; then + echo -n "Stopping $DESC: $NAME" + start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE + echo "." + else + echo "$NAME is configured not to start automatically at boot time." + echo " To change this, run 'dpkg-reconfigure gpsd'." + fi + ;; + reload|force-reload) + echo "$DESC: Resetting connection to GPS device." + start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE + ;; + restart) + set +e; $SELF stop; set -e + $SELF start + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 |