qubes_core 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. modprobe netbk
  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. secondary_dns=$(/usr/bin/xenstore-read qubes_netvm_secondary_dns)
  23. echo "NS1=$gateway" > /var/run/qubes/qubes_ns
  24. echo "NS2=$secondary_dns" >> /var/run/qubes/qubes_ns
  25. /usr/lib/qubes/qubes_setup_dnat_to_ns
  26. echo "1" > /proc/sys/net/ipv4/ip_forward
  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