2010-04-05 20:58:57 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# chkconfig: 345 90 90
|
|
|
|
# description: Executes Qubes core scripts at VM boot
|
|
|
|
#
|
|
|
|
# Source function library.
|
|
|
|
. /etc/rc.d/init.d/functions
|
|
|
|
|
|
|
|
start()
|
|
|
|
{
|
|
|
|
echo -n $"Executing Qubes Core scripts:"
|
|
|
|
|
|
|
|
if ! [ -x /usr/bin/xenstore-read ] ; then
|
|
|
|
echo "ERROR: /usr/bin/xenstore-read not found!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
name=$(/usr/bin/xenstore-read name)
|
|
|
|
hostname $name
|
|
|
|
|
2010-05-20 17:28:29 +02:00
|
|
|
ip=$(/usr/bin/xenstore-read qubes_ip)
|
|
|
|
netmask=$(/usr/bin/xenstore-read qubes_netmask)
|
|
|
|
gateway=$(/usr/bin/xenstore-read qubes_gateway)
|
|
|
|
secondary_dns=$(/usr/bin/xenstore-read qubes_secondary_dns)
|
|
|
|
if [ x$ip != x ]; then
|
|
|
|
/sbin/ifconfig eth0 $ip netmask $netmask up
|
|
|
|
/sbin/route add default gw $gateway
|
|
|
|
echo "nameserver $gateway" > /etc/resolv.conf
|
|
|
|
echo "nameserver $secondary_dns" >> /etc/resolv.conf
|
|
|
|
fi
|
|
|
|
if ! [ -L /home ] ; then
|
|
|
|
mv /home /home.orig
|
|
|
|
ln -s /rw/home /home
|
|
|
|
fi
|
|
|
|
if ! [ -L /usr/local ] ; then
|
2010-05-20 16:52:47 +02:00
|
|
|
mv /usr/local /usr/local.orig
|
|
|
|
ln -s /rw/usrlocal /usr/local
|
2010-05-20 17:28:29 +02:00
|
|
|
fi
|
|
|
|
#make it last, we want all above to work without /rw mounted
|
|
|
|
if ! [ -d /rw/usrlocal ] ; then
|
2010-05-20 16:52:47 +02:00
|
|
|
cp -a /usr/local.orig /rw/usrlocal
|
2010-04-05 20:58:57 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
[ -x /rw/config/rc.local ] && /rw/config/rc.local
|
|
|
|
success
|
|
|
|
echo ""
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
stop()
|
|
|
|
{
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stop
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo $"Usage: $0 {start|stop}"
|
|
|
|
exit 3
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit $RETVAL
|