shorewall-lite.initd-r2 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #!/sbin/openrc-run
  2. # Copyright 1999-2016 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. if [ "${RC_SVCNAME}" = "shorewall6-lite" ]; then
  5. PRODUCT_NAME="Shorewall6-Lite"
  6. command="/usr/sbin/shorewall6-lite"
  7. else
  8. PRODUCT_NAME="Shorewall-Lite"
  9. command="/usr/sbin/shorewall-lite"
  10. fi
  11. description="The Shoreline Firewall Lite, more commonly known as \"${PRODUCT_NAME}\", is"
  12. description="${description} a high-level tool for configuring Netfilter."
  13. extra_commands="clear"
  14. extra_started_commands="reload reset"
  15. description_clear="Clear will remove all rules and chains installed by"
  16. description_clear="${description_clear} ${PRODUCT_NAME}. The firewall is"
  17. description_clear="${description_clear} then wide open and unprotected."
  18. description_reload="Reload is similar to \"${RC_SERVICE} start\" except that it assumes"
  19. description_reload="${description_reload} that the firewall is already started."
  20. description_reload="${description_reload} Existing connections are maintained."
  21. description_reset="All the packet and byte counters in the firewall are reset."
  22. depend() {
  23. provide firewall
  24. after ulogd
  25. }
  26. clear() {
  27. ebegin "Clearing all ${RC_SVCNAME} rules and setting policy to ACCEPT"
  28. ${command} ${OPTIONS} clear 1>/dev/null
  29. eend $?
  30. }
  31. reload() {
  32. ebegin "Reloading ${RC_SVCNAME}"
  33. ${command} ${OPTIONS} reload ${RELOADOPTIONS} 1>/dev/null
  34. eend $?
  35. }
  36. reset() {
  37. ebegin "Resetting the packet and byte counters in ${RC_SVCNAME}"
  38. ${command} ${OPTIONS} reset 1>/dev/null
  39. eend $?
  40. }
  41. restart() {
  42. local _retval
  43. ebegin "Restarting ${RC_SVCNAME}"
  44. ${command} status 1>/dev/null
  45. _retval=$?
  46. if [ ${_retval} = '0' ]; then
  47. svc_start
  48. else
  49. ${command} ${OPTIONS} restart ${RESTARTOPTIONS} 1>/dev/null
  50. fi
  51. eend $?
  52. }
  53. start() {
  54. ebegin "Starting ${RC_SVCNAME}"
  55. ${command} ${OPTIONS} start ${STARTOPTIONS} 1>/dev/null
  56. eend $?
  57. }
  58. status() {
  59. local _retval
  60. ${command} status 1>/dev/null
  61. _retval=$?
  62. if [ ${_retval} = '0' ]; then
  63. einfo 'status: started'
  64. mark_service_started "${SVCNAME}"
  65. return 0
  66. else
  67. einfo 'status: stopped'
  68. mark_service_stopped "${SVCNAME}"
  69. return 3
  70. fi
  71. }
  72. stop() {
  73. ebegin "Stopping ${RC_SVCNAME}"
  74. ${command} ${OPTIONS} stop ${STOPOPTIONS} 1>/dev/null
  75. eend $?
  76. }