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
|
|
|
|
|
2011-07-02 13:12:53 +02:00
|
|
|
modprobe evtchn
|
2011-07-02 00:24:20 +02:00
|
|
|
modprobe u2mfn
|
|
|
|
|
2011-04-07 18:43:52 +02:00
|
|
|
# Set permissions to /proc/xen/xenbus, so normal user can use xenstore-read
|
|
|
|
chmod 666 /proc/xen/xenbus
|
|
|
|
|
2010-04-05 20:58:57 +02:00
|
|
|
name=$(/usr/bin/xenstore-read name)
|
2010-07-30 16:01:15 +02:00
|
|
|
if ! [ -f /etc/this_is_dvm ] ; then
|
|
|
|
# we don't want to set hostname for DispVM
|
|
|
|
# because it makes some of the pre-created dotfiles invalid (e.g. .kde/cache-<hostname>)
|
|
|
|
# (let's be frank: nobody's gonna use xterm on DispVM)
|
|
|
|
hostname $name
|
|
|
|
fi
|
2010-04-05 20:58:57 +02:00
|
|
|
|
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
|
2010-09-06 17:24:12 +02:00
|
|
|
/sbin/ifconfig eth0 $ip netmask 255.255.255.255 up
|
|
|
|
/sbin/route add default dev eth0
|
2010-05-20 17:28:29 +02:00
|
|
|
echo "nameserver $gateway" > /etc/resolv.conf
|
|
|
|
echo "nameserver $secondary_dns" >> /etc/resolv.conf
|
|
|
|
fi
|
2010-06-18 16:21:04 +02:00
|
|
|
|
2010-06-02 15:50:22 +02:00
|
|
|
if [ -e /dev/xvdb ] ; then
|
|
|
|
mount /rw
|
2010-06-18 16:21:04 +02:00
|
|
|
|
2010-06-02 15:50:22 +02:00
|
|
|
if ! [ -d /rw/home ] ; then
|
|
|
|
echo
|
|
|
|
echo "--> Virgin boot of the VM: Linking /home to /rw/home"
|
2010-10-04 19:36:54 +02:00
|
|
|
|
2010-06-02 15:50:22 +02:00
|
|
|
mkdir -p /rw/config
|
2010-10-04 19:36:54 +02:00
|
|
|
touch /rw/config/rc.local
|
|
|
|
|
2010-06-02 15:50:22 +02:00
|
|
|
mkdir -p /rw/home
|
|
|
|
cp -a /home.orig/user /home
|
|
|
|
|
2010-10-04 19:36:54 +02:00
|
|
|
mkdir -p /rw/usrlocal
|
|
|
|
cp -a /usr/local.orig/* /usr/local
|
|
|
|
|
|
|
|
touch /var/lib/qubes/first_boot_completed
|
2010-06-02 15:50:22 +02:00
|
|
|
fi
|
2010-04-05 20:58:57 +02:00
|
|
|
fi
|
|
|
|
|
2011-03-23 11:34:01 +01:00
|
|
|
/usr/lib/qubes/qrexec_agent 2>/var/log/qubes/qrexec_agent.log &
|
|
|
|
|
2010-04-05 20:58:57 +02:00
|
|
|
[ -x /rw/config/rc.local ] && /rw/config/rc.local
|
2011-03-31 15:15:10 +02:00
|
|
|
|
|
|
|
if ! [ -f /home/user/.gnome2/nautilus-scripts/.scripts_created ] ; then
|
|
|
|
echo "Creating symlinks for nautilus actions..."
|
|
|
|
su user -c 'mkdir -p /home/user/.gnome2/nautilus-scripts'
|
|
|
|
su user -c 'ln -s /usr/lib/qubes/qvm-copy-to-vm2.gnome /home/user/.gnome2/nautilus-scripts/"Copy to other AppVM"'
|
|
|
|
su user -c 'ln -s /usr/bin/qvm-open-in-dvm2 /home/user/.gnome2/nautilus-scripts/"Open in DisposableVM"'
|
|
|
|
su user -c 'touch /home/user/.gnome2/nautilus-scripts/.scripts_created'
|
|
|
|
fi
|
|
|
|
|
2010-04-05 20:58:57 +02:00
|
|
|
success
|
|
|
|
echo ""
|
2011-06-26 18:57:46 +02:00
|
|
|
|
|
|
|
type=$(/usr/bin/xenstore-read qubes_vm_type)
|
|
|
|
if [ "$type" == "ProxyVM" ]; then
|
|
|
|
/sbin/service ntpd start
|
|
|
|
fi
|
2010-04-05 20:58:57 +02:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
stop()
|
|
|
|
{
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stop
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo $"Usage: $0 {start|stop}"
|
|
|
|
exit 3
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit $RETVAL
|