[package] update gpsd to 2.94, add config, init and hotplug scripts, patch from Roberto Riggio
[openwrt.org/packages.git] / net / gpsd / files / gpsd.init
blob:a/net/gpsd/files/gpsd.init -> blob:b/net/gpsd/files/gpsd.init
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
# Copyright (C) 2009 OpenWrt.org # Copyright (C) 2009-2011 OpenWrt.org
START=50 START=50
   
NAME=gpsd NAME=gpsd
PIDF=/var/run/$NAME.pid PIDF=/var/run/$NAME.pid
PROG=/usr/sbin/$NAME PROG=/usr/sbin/$NAME
   
start() { start() {
config_load gpsd config_load gpsd
config_get device core device config_get device core device
config_get port core port config_get port core port
  config_get_bool listen_globally core listen_globally
config_get_bool enabled core enabled config_get_bool enabled core enabled
[ "$enabled" != "1" ] && exit [ "$enabled" != "1" ] && exit
logger -t "$NAME" "Starting..." logger -t "$NAME" "Starting..."
[ ! -c "$device" ] && { [ ! -c "$device" ] && {
logger -t "$NAME" "Unable to find device $device. Exiting." logger -t "$NAME" "Unable to find device $device. Exiting."
exit 1 exit 1
} }
$PROG -n -P $PIDF -S $port $device [ "$listen_globally" != "0" ] && append args "-G"
  $PROG -n -P $PIDF -S $port $args $device
} }
   
stop() { stop() {
logger -t "$NAME" "Stopping..." logger -t "$NAME" "Stopping..."
[ -f "$PIDF" ] && { [ -f "$PIDF" ] && {
read PID < "$PIDF" read PID < "$PIDF"
kill -9 $PID kill -9 $PID
rm $PIDF rm $PIDF
} }
} }
   
comments