packages/utils/gpsd/files/gpsd.init
p-wassi 4a752d7f6f utils/gpsd: fix init script
Add missing character in init script to match config file

Signed-off-by: Paul Wassi <p.wassi@gmx.at>
2017-03-04 12:06:22 +01:00

44 lines
787 B
Bash

#!/bin/sh /etc/rc.common
# Copyright (C) 2009-2011 OpenWrt.org
START=50
USE_PROCD=1
PROG=/usr/sbin/gpsd
NAME=gpsd
validate_section_gpsd()
{
uci_validate_section gpsd gpsd "${1}" \
'enabled:bool:1' \
'device:string' \
'listen_globally:bool:0' \
'port:port:2947'
}
gpsd_instance()
{
local device enabled listen_globally port
validate_section_gpsd "${1}" || {
echo "validation failed"
return 1
}
[ "${enabled}" = "0" ] && return 1
procd_open_instance
procd_set_param command "$PROG" -N -n
[ "${listen_globally}" -ne 0 ] && procd_append_param command -G
procd_append_param command -S "${port}"
procd_append_param command "${device}"
procd_set_param respawn
procd_close_instance
}
start_service()
{
config_load "${NAME}"
config_foreach gpsd_instance gpsd
}