[package] update gpsd to 2.94, add config, init and hotplug scripts, patch from Rober...
[openwrt/svn-archive/archive.git] / net / gpsd / files / gpsd.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2009 OpenWrt.org
3 START=50
4
5 NAME=gpsd
6 PIDF=/var/run/$NAME.pid
7 PROG=/usr/sbin/$NAME
8
9 start() {
10 config_load gpsd
11 config_get device core device
12 config_get port core port
13 config_get_bool enabled core enabled
14 [ "$enabled" != "1" ] && exit
15 logger -t "$NAME" "Starting..."
16 [ ! -c "$device" ] && {
17 logger -t "$NAME" "Unable to find device $device. Exiting."
18 exit 1
19 }
20 $PROG -n -P $PIDF -S $port $device
21 }
22
23 stop() {
24 logger -t "$NAME" "Stopping..."
25 [ -f "$PIDF" ] && {
26 read PID < "$PIDF"
27 kill -9 $PID
28 rm $PIDF
29 }
30 }