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
874 B

  1. #!/bin/sh /etc/rc.common
  2. START=85
  3. USE_PROCD=1
  4. trm_script="/usr/bin/travelmate.sh"
  5. trm_iface="$(uci -q get travelmate.global.trm_iface)"
  6. boot()
  7. {
  8. ubus -t 30 wait_for network.interface
  9. rc_procd start_service
  10. }
  11. start_service()
  12. {
  13. procd_open_instance "travelmate"
  14. procd_set_param env trm_procd="true"
  15. procd_set_param command "${trm_script}" "${@}"
  16. procd_set_param stdout 1
  17. procd_set_param stderr 1
  18. procd_close_instance
  19. }
  20. service_triggers()
  21. {
  22. local iface
  23. procd_add_config_trigger "config.change" "travelmate" /etc/init.d/travelmate start
  24. if [ -z "${trm_iface}" ]
  25. then
  26. procd_add_raw_trigger "interface.*.down" 1000 /etc/init.d/travelmate start
  27. else
  28. for iface in ${trm_iface}
  29. do
  30. procd_add_interface_trigger "interface.*.down" "${iface}" /etc/init.d/travelmate start
  31. done
  32. fi
  33. }