windows_init/init.sh

48 lines
927 B
Bash

#!/bin/sh
# extract iso
mkdir -p /mnt/iso
mount -o loop Win10* /mnt/iso
## copy iso files
mkdir -p win
cp -r /mnt/iso/* win/
## clean up mount
umount /mnt/iso
rm -rf /mnt/iso
rm win*
# end extract iso
# add answerfile
cp autounattend.xml win/
# recreate iso
dd if=win of=win.iso
# clean up iso extract
rm -rf win
# qemu
# install qemu libvirt-daemon spice-vdagent spice-client-gtk
SPICE_PORT=5924
qemu-system-x86_64 \
-enable-kvm \
-daemonize \
-cpu host \
-smp 4 \
-net nic \
-net user,hostname=windowsvm \
-m 8G \
-vga qxl \
-boot d \
-cdrom win.iso \
-drive file=/dev/sdb,cache=none,if=virtio \ # change drive if needed
-spice port=${SPICE_PORT},disable-ticketing \
-device virtio-serial \
-chardev spicevmc,id=vdagent,name=vdagent \
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0
exec spicy --title Windows 127.0.0.1 -p ${SPICE_PORT}