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.

41 lines
683 B

  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2008-2014 OpenWrt.org
  3. START=99
  4. STOP=99
  5. USE_PROCD=1
  6. PROG=/usr/bin/socat
  7. NAME=socat
  8. validate_section_socat()
  9. {
  10. uci_load_validate socat socat "$1" "$2" \
  11. 'enable:bool:1' \
  12. 'SocatOptions:string'
  13. }
  14. socat_instance()
  15. {
  16. [ "$2" = 0 ] || {
  17. echo "validation failed"
  18. return 1
  19. }
  20. [ "$enable" = "0" ] && return 1
  21. procd_open_instance
  22. procd_set_param command "$PROG"
  23. procd_append_param command $SocatOptions
  24. procd_close_instance
  25. }
  26. start_service () {
  27. config_load "$NAME"
  28. config_foreach validate_section_socat socat socat_instance
  29. }
  30. service_triggers() {
  31. procd_add_reload_trigger "$NAME"
  32. procd_add_validation validate_section_socat
  33. }