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.

57 lines
1.1 KiB

  1. #!/bin/sh /etc/rc.common
  2. START=54
  3. STOP=54
  4. PROG_NAT64="/usr/bin/jool"
  5. PROG_SIIT="/usr/bin/jool_siit"
  6. CONFIGFILE_NAT64="/etc/jool/jool-nat64.conf.json"
  7. CONFIGFILE_SIIT="/etc/jool/jool-siit.conf.json"
  8. config_parser(){
  9. enabled=0
  10. enabled_nat64=0
  11. enabled_siit=0
  12. config_load "jool"
  13. #verify if the services are enabled in the configuration and populate it's variables
  14. config_get_bool enabled general enabled 0
  15. config_get_bool enabled_nat64 nat64 enabled 0
  16. config_get_bool enabled_siit siit enabled 0
  17. #If the main service is not enabled exit
  18. [ "$enabled" -eq 0 ] && return 1
  19. #if nat64 is enabled continue
  20. if [ "$enabled_nat64" -gt 0 ]; then
  21. #check if the orer is to start or stop
  22. if [ "$1" -gt 0 ]; then
  23. #start jool
  24. $PROG_NAT64 file handle $CONFIGFILE_NAT64
  25. else
  26. $PROG_NAT64 -f $CONFIGFILE_NAT64 instance remove
  27. fi
  28. fi
  29. #if siit is enabled continue
  30. if [ "$enabled_siit" -gt 0 ]; then
  31. #check if the orer is to start or stop
  32. if [ "$1" -gt 0 ]; then
  33. #start jool
  34. $PROG_SIIT file handle $CONFIGFILE_SIIT
  35. else
  36. $PROG_SIIT -f $CONFIGFILE_SIIT instance remove
  37. fi
  38. fi
  39. }
  40. start() {
  41. config_parser 1
  42. }
  43. stop() {
  44. config_parser 0
  45. }