1
0

rtl_ais.init 745 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/sh /etc/rc.common
  2. START=99
  3. USE_PROCD=1
  4. PROG=/usr/bin/rtl_ais
  5. validate_rtl_ais_section() {
  6. uci_validate_section "rtl_ais" "rtl_ais" "$1" \
  7. 'enabled:bool' \
  8. 'ppm:range(-100,100):0'
  9. }
  10. load_rtl_ais() {
  11. local cfg="$1"
  12. local enabled ppm
  13. validate_rtl_ais_section "$cfg" || { echo "validation failed"; return 1; }
  14. [ "$enabled" = "1" ] || return 1
  15. procd_open_instance
  16. procd_set_param command "$PROG" -p "$ppm"
  17. procd_set_param stdout 1
  18. procd_set_param stderr 1
  19. procd_set_param respawn
  20. procd_close_instance
  21. }
  22. start_service() {
  23. config_load "rtl_ais"
  24. config_foreach load_rtl_ais "rtl_ais"
  25. }
  26. service_triggers() {
  27. procd_add_reload_trigger "rtl_ais"
  28. procd_add_validation validate_rtl_ais_section
  29. }