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.

40 lines
913 B

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