2011-03-11 01:38:04 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# chkconfig: 345 90 90
|
|
|
|
# description: Executes Qubes core scripts at NetVM boot
|
|
|
|
#
|
|
|
|
# Source function library.
|
|
|
|
. /etc/rc.d/init.d/functions
|
|
|
|
|
|
|
|
start()
|
|
|
|
{
|
|
|
|
if ! [ -x /usr/bin/xenstore-read ] ; then
|
|
|
|
echo "ERROR: /usr/bin/xenstore-read not found!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
type=$(/usr/bin/xenstore-read qubes_vm_type)
|
|
|
|
if [ "$type" == "NetVM" ]; then
|
2012-01-30 14:20:02 +01:00
|
|
|
/usr/lib/qubes/network-manager-prepare-conf-dir
|
2011-03-11 01:38:04 +01:00
|
|
|
/sbin/service NetworkManager start
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo -n $"Executing Qubes Core scripts NetVM:"
|
|
|
|
|
|
|
|
# Setup gateway for all the VMs this netVM is serviceing...
|
|
|
|
network=$(/usr/bin/xenstore-read qubes_netvm_network 2>/dev/null)
|
|
|
|
if [ "x$network" != "x" ]; then
|
|
|
|
gateway=$(/usr/bin/xenstore-read qubes_netvm_gateway)
|
|
|
|
netmask=$(/usr/bin/xenstore-read qubes_netvm_netmask)
|
|
|
|
secondary_dns=$(/usr/bin/xenstore-read qubes_netvm_secondary_dns)
|
2011-09-08 01:06:39 +02:00
|
|
|
modprobe netbk 2> /dev/null || modprobe xen-netback
|
2011-03-11 01:38:04 +01:00
|
|
|
echo "NS1=$gateway" > /var/run/qubes/qubes_ns
|
|
|
|
echo "NS2=$secondary_dns" >> /var/run/qubes/qubes_ns
|
|
|
|
/usr/lib/qubes/qubes_setup_dnat_to_ns
|
|
|
|
echo "1" > /proc/sys/net/ipv4/ip_forward
|
|
|
|
fi
|
2011-03-21 13:54:35 +01:00
|
|
|
|
2011-03-11 01:38:04 +01:00
|
|
|
success
|
|
|
|
echo ""
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
stop()
|
|
|
|
{
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stop
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo $"Usage: $0 {start|stop}"
|
|
|
|
exit 3
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit $RETVAL
|