feat: win2k22

This commit is contained in:
ange 2024-02-27 17:33:02 +01:00
parent c41373c309
commit c96fd4bee7
Signed by: ange
GPG Key ID: 9E0C4157BB7BEB1D
4 changed files with 60 additions and 0 deletions

21
win2k22/create.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash -e
cd "$(dirname "$0")"
. ./lib.sh
if [ -f hda.qcow2 ]; then
echo -e "Disk file exists. Are you sure you don't want" \
"\e[1m\e[31m./run.sh\e[0m?\nCtrl-C to interrupt" >&2
read -r
fi
qemu-img create -f qcow2 hda.qcow2 40G
CMD=(
"${CMD[@]}"
-drive file=win2k22.iso,index=1,media=cdrom,readonly=on \
-drive file=virtio.iso,index=2,media=cdrom,readonly=on \
#-drive file.driver=http,file.filename=http://example.com/image.qcow2
-nic none # you don't want internet access for a windows installation
)
"${CMD[@]}"

8
win2k22/download_isos.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash -e
win2k22='https://go.microsoft.com/fwlink/p/?LinkID=2195280'
virtio='https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/virtio-win.iso'
curl -LC- \
-o win2k22.iso "$win2k22" \
-o virtio.iso "$virtio"

25
win2k22/lib.sh Normal file
View File

@ -0,0 +1,25 @@
#!/bin/bash -e
RAM="$(free -g | awk '/^Mem:/{print $2 - 2}')"
if [ "$RAM" -le 2 ]; then RAM=2
elif [ "$RAM" -gt 32 ]; then RAM=32; fi
RAM="${RAM}G"
CMD=(
qemu-system-x86_64
-accel kvm
#-drive file.driver=virtio,file=hda.qcow2,index=0,media=disk
-m "2G,maxmem=$RAM"
# virtio drivers
## disk
-blockdev driver=file,node-name=hda-file,filename=hda.qcow2
-blockdev driver=qcow2,node-name=hda,file=hda-file
-device virtio-blk-pci,drive=hda
## gpu
-vga virtio
## network
-netdev user,id=n0
-device virtio-net-pci,netdev=n0
)

6
win2k22/run.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash -e
cd "$(dirname "$0")"
. ./lib.sh
"${CMD[@]}" \
#-device usb-host,vendorid=vendor,productid=product