gpsd: update to version 3.5 from cerowrt + chrpath removal patch
[openwrt.org/packages.git] / net / gpsd / files / gpsd.init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh /etc/rc.common
# Copyright (C) 2009-2011 OpenWrt.org
START=50

NAME=gpsd
PIDF=/var/run/$NAME.pid
PROG=/usr/sbin/$NAME

start() {
    config_load gpsd
    config_get device core device
    config_get port core port
    config_get_bool listen_globally core listen_globally
    config_get_bool enabled core enabled
    [ "$enabled" != "1" ] && exit
    logger -t "$NAME" "Starting..."
    [ ! -c "$device" ] && {
        logger -t "$NAME" "Unable to find device $device. Exiting."
        exit 1
    }
    [ "$listen_globally" != "0" ] && append args "-G"
    $PROG -n -P $PIDF -S $port $args $device
}

stop() {
    logger -t "$NAME" "Stopping..."
    [ -f "$PIDF" ] && {
        read PID < "$PIDF"
        kill -9 $PID
        rm $PIDF
    }
}

comments