qubes-firewall 944 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/bash
  2. #
  3. # chkconfig: 345 92 92
  4. # description: Starts Qubes Firewall monitor
  5. #
  6. # Source function library.
  7. # shellcheck disable=SC1091
  8. . /etc/rc.d/init.d/functions
  9. # Source Qubes library.
  10. # shellcheck source=init/functions
  11. . /usr/lib/qubes/init/functions
  12. PIDFILE=/var/run/qubes/qubes-firewall.pid
  13. start()
  14. {
  15. have_qubesdb || return
  16. if qsvc qubes-firewall ; then
  17. echo -n $"Starting Qubes Firewall monitor:"
  18. /sbin/ethtool -K "$(get_qubes_managed_iface)" sg off
  19. /usr/sbin/qubes-firewall &
  20. success
  21. echo ""
  22. fi
  23. }
  24. stop()
  25. {
  26. if [ -r $PIDFILE ]; then
  27. echo -n "Stopping Qubes Firewall monitor:"
  28. # shellcheck disable=SC2015
  29. kill -9 "$(cat "$PIDFILE")" 2>/dev/null && success || failure
  30. echo ""
  31. fi
  32. return 0
  33. }
  34. case "$1" in
  35. start)
  36. start
  37. ;;
  38. stop)
  39. stop
  40. ;;
  41. *)
  42. echo $"Usage: $0 {start|stop}"
  43. exit 3
  44. ;;
  45. esac
  46. # shellcheck disable=SC2086
  47. exit $RETVAL