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.

39 lines
619 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_validate_section socat socat "${1}" \
  11. 'enable:bool:1' \
  12. 'SocatOptions:string'
  13. return $?
  14. }
  15. socat_instance()
  16. {
  17. local SocatOptions enable
  18. validate_section_socat "${1}" || {
  19. echo "validation failed"
  20. return 1
  21. }
  22. [ "${enable}" = "0" ] && return 1
  23. procd_open_instance
  24. procd_set_param command "$PROG"
  25. procd_append_param command ${SocatOptions}
  26. procd_close_instance
  27. }
  28. start_service () {
  29. config_load "${NAME}"
  30. config_foreach socat_instance socat
  31. }