2021-09-18 04:38:08 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# extract iso
|
|
|
|
mkdir -p /mnt/iso
|
|
|
|
mount -o loop Win10* /mnt/iso
|
|
|
|
|
2021-09-25 01:13:08 +00:00
|
|
|
## copy iso files
|
2021-09-18 04:38:08 +00:00
|
|
|
mkdir -p win
|
|
|
|
cp -r /mnt/iso/* win/
|
|
|
|
|
2021-09-25 01:13:08 +00:00
|
|
|
## clean up mount
|
2021-09-18 04:38:08 +00:00
|
|
|
umount /mnt/iso
|
|
|
|
rm -rf /mnt/iso
|
2021-09-25 03:23:34 +00:00
|
|
|
rm win*
|
2021-09-18 04:38:08 +00:00
|
|
|
|
2021-09-25 01:13:08 +00:00
|
|
|
# end extract iso
|
|
|
|
|
|
|
|
# add answerfile
|
|
|
|
cp autounattend.xml win/
|
2021-09-18 04:38:08 +00:00
|
|
|
|
|
|
|
# recreate iso
|
|
|
|
dd if=win of=win.iso
|
|
|
|
|
|
|
|
# clean up iso extract
|
|
|
|
rm -rf win
|
|
|
|
|
|
|
|
# qemu
|
2021-09-25 18:05:46 +00:00
|
|
|
# install qemu libvirt-daemon spice-vdagent spice-client-gtk
|
2021-09-18 04:38:08 +00:00
|
|
|
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 \
|
2021-09-25 18:05:46 +00:00
|
|
|
-drive file=/dev/sdb,cache=none,if=virtio \ # change drive if needed
|
2021-09-18 04:38:08 +00:00
|
|
|
-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}
|