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.

46 lines
1.0 KiB

  1. #!/bin/sh /etc/rc.common
  2. #
  3. # Copyright (C) 2016-2019 eGloo, Incorporated
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. START=50
  7. STOP=50
  8. USE_PROCD=1
  9. PROG=/usr/sbin/netifyd
  10. start_netifyd() {
  11. local instance enabled autoconfig internal_if external_if
  12. instance="$1"
  13. config_get_bool enabled "$instance" enabled 0
  14. [ "$enabled" -eq 0 ] && return 0
  15. [ ! -d /var/run/netifyd ] && mkdir -p /var/run/netifyd
  16. config_get_bool autoconfig "$instance" autoconfig 1
  17. if [ "$autoconfig" -gt 0 ] ; then
  18. source /usr/share/netifyd/functions.sh
  19. load_modules
  20. NETIFYD_AUTODETECT=yes
  21. NETIFYD_OPTS=$(auto_detect_options)
  22. else
  23. config_get internal_if "$instance" internal_if "eth0"
  24. config_get external_if "$instance" external_if "eth1"
  25. NETIFYD_OPTS="-E $external_if -I $internal_if"
  26. fi
  27. procd_open_instance
  28. procd_set_param command $PROG -R $NETIFYD_OPTS
  29. procd_set_param file /etc/netifyd.conf
  30. procd_set_param respawn
  31. procd_close_instance
  32. }
  33. start_service() {
  34. config_load netifyd
  35. config_foreach start_netifyd netifyd
  36. }