Browse Source

rtl-ais: Update init script

This replaces the use of uci_validate_section() with
uci_load_validate(), which removes the need to declare local variables
for every config option.

This also fixes some space-indented lines to use tabs.

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
lilik-openwrt-22.03
Jeffery To 6 years ago
committed by Nuno Goncalves
parent
commit
da2974620e
2 changed files with 8 additions and 9 deletions
  1. +1
    -1
      utils/rtl-ais/Makefile
  2. +7
    -8
      utils/rtl-ais/files/rtl_ais.init

+ 1
- 1
utils/rtl-ais/Makefile View File

@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=rtl-ais
PKG_VERSION:=0.3
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/dgiardini/rtl-ais/tar.gz/v$(PKG_VERSION)?


+ 7
- 8
utils/rtl-ais/files/rtl_ais.init View File

@ -6,7 +6,7 @@ USE_PROCD=1
PROG=/usr/bin/rtl_ais
validate_rtl_ais_section() {
uci_validate_section "rtl_ais" "rtl_ais" "$1" \
uci_load_validate "rtl_ais" "rtl_ais" "$1" "$2" \
'enabled:bool' \
'ppm:range(-100,100):0'
}
@ -14,22 +14,21 @@ validate_rtl_ais_section() {
load_rtl_ais() {
local cfg="$1"
local enabled ppm
validate_rtl_ais_section "$cfg" || { echo "validation failed"; return 1; }
[ "$2" = 0 ] || { echo "validation failed"; return 1; }
[ "$enabled" = "1" ] || return 1
procd_open_instance
procd_set_param command "$PROG" -p "$ppm"
procd_open_instance
procd_set_param command "$PROG" -p "$ppm"
procd_set_param stdout 1
procd_set_param stderr 1
procd_set_param respawn
procd_close_instance
procd_set_param respawn
procd_close_instance
}
start_service() {
config_load "rtl_ais"
config_foreach load_rtl_ais "rtl_ais"
config_foreach validate_rtl_ais_section "rtl_ais" load_rtl_ais
}
service_triggers() {


Loading…
Cancel
Save