You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.4 KiB

  1. #!/bin/sh /etc/rc.common
  2. USE_PROCD=1
  3. START=95
  4. STOP=01
  5. CONFIGURATION=netstinky
  6. validate_ids_section()
  7. {
  8. uci_load_validate netstinky netstinky "$1" "$2" \
  9. 'interface:string:lan' \
  10. 'port:uinteger:8089' \
  11. 'updatehost:string' \
  12. 'updateport:uinteger' \
  13. 'sslnoverify:bool:false'
  14. }
  15. netstinky_instance()
  16. {
  17. [ "$2" = 0 ] || {
  18. echo "validation failed"
  19. return 1
  20. }
  21. procd_open_instance
  22. procd_set_param command /usr/bin/nsids
  23. if [ -n "${interface}" ]; then
  24. local iface
  25. network_get_device iface "${interface}"
  26. procd_append_param command -i "${iface}"
  27. fi
  28. procd_append_param command -p "${port}"
  29. [ -n "${updatehost}" ] && procd_append_param command --update-host "${updatehost}"
  30. [ -n "${updateport}" ] && procd_append_param command --update-port "${updateport}"
  31. [ "${sslnoverify}" -eq 1 ] && procd_append_param command --ssl-no-verify
  32. procd_set_param stderr 1
  33. procd_set_param stdout 1
  34. procd_add_mdns "netstinky" "tcp" "$port"
  35. procd_close_instance
  36. }
  37. start_service()
  38. {
  39. . /lib/functions/network.sh
  40. config_load "${CONFIGURATION}"
  41. config_foreach validate_ids_section netstinky netstinky_instance
  42. }
  43. service_triggers()
  44. {
  45. procd_add_config_trigger "config.change" "netstinky" /etc/init.d/nsids reload
  46. config_load "${CONFIGURATION}"
  47. procd_add_validation validate_ids_section
  48. }