qubes_core 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/sh
  2. #
  3. # chkconfig: 345 90 90
  4. # description: Executes Qubes core scripts at VM boot
  5. #
  6. # Source function library.
  7. . /etc/rc.d/init.d/functions
  8. start()
  9. {
  10. echo -n $"Executing Qubes Core scripts NetVM:"
  11. if ! [ -x /usr/bin/xenstore-read ] ; then
  12. echo "ERROR: /usr/bin/xenstore-read not found!"
  13. exit 1
  14. fi
  15. name=$(/usr/bin/xenstore-read name)
  16. hostname $name
  17. # Setup gateway for all the VMs this netVM is serviceing...
  18. brctl addbr br0
  19. gateway=$(/usr/bin/xenstore-read qubes_netvm_gateway)
  20. netmask=$(/usr/bin/xenstore-read qubes_netvm_netmask)
  21. network=$(/usr/bin/xenstore-read qubes_netvm_network)
  22. ifconfig br0 $gateway netmask $netmask up
  23. echo "1" > /proc/sys/net/ipv4/ip_forward
  24. dnsmasq --listen-address $gateway --bind-interfaces
  25. #now done by iptables rc script
  26. # iptables -t nat -A POSTROUTING -s $network/$netmask -j MASQUERADE
  27. success
  28. echo ""
  29. return 0
  30. }
  31. stop()
  32. {
  33. return 0
  34. }
  35. case "$1" in
  36. start)
  37. start
  38. ;;
  39. stop)
  40. stop
  41. ;;
  42. *)
  43. echo $"Usage: $0 {start|stop}"
  44. exit 3
  45. ;;
  46. esac
  47. exit $RETVAL