Created
May 31, 2011 16:06
-
-
Save andrusha/1000766 to your computer and use it in GitHub Desktop.
Windows XP QEMU virtual machine startup script with KVM, VDE networking & Samba
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
TAP_INTERFACE="tap0" | |
IMAGE_DIR="/media/files/virtual" | |
ARGS="-enable-kvm -drive file=$IMAGE_DIR/winxp.img,index=0,cache=writeback,media=disk -boot c -net nic,vlan=0,macaddr=52:54:00:00:EE:02,model=rtl8139 -net vde,vlan=0 -m 1024 -localtime -usbdevice tablet -vga std -smb qemu -cpu Nehalem" | |
if [ "$(lsmod | grep kvm | wc -l)" -eq 0 ] | |
then | |
echo "Loading KVM modules..." | |
sudo modprobe kvm | |
sudo modprobe kvm-intel | |
fi | |
if [ "$(lsmod | grep tun | wc -l)" -eq 0 ] | |
then | |
echo "Loading TUN/TAP module..." | |
sudo modprobe tun | |
echo "Bringing up $TAP_INTERFACE..." | |
sudo ifconfig $TAP_INTERFACE up | |
fi | |
# Checking for VDE switch | |
if [ ! "$(pidof vde_switch)" ] | |
then | |
echo "Starting VDE-switch..." | |
sudo vde_switch -daemon -mod 660 -group kvm -hub -tap $TAP_INTERFACE | |
fi | |
# Checking for VDE config-daemon | |
if [ ! "$(pidof slirpvde)" ] | |
then | |
echo "Starting VDE config-daemon" | |
sudo slirpvde --dhcp --daemon | |
fi | |
# Checking for Samba | |
if [ ! "$(pidof smbd)" ] | |
then | |
echo "Starting Samba..." | |
sudo /etc/rc.d/samba start | |
fi | |
echo "Starting QEMU with..." | |
echo $ARGS | |
echo "...." | |
exec qemu-system-x86_64 $ARGS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment