From d191d0da444d679816cb7d260d3aa5ef390aec84 Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Fri, 8 Oct 2021 02:04:30 +0100 Subject: [PATCH] Add unattended configuration for Windows 10 and 11 Automates some of the install/configuration steps for Windows 10 and 11, most notably essential drivers and disk formatting. --- README.md | 5 +- quickemu | 6 +++ quickget | 156 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2159835..a26f2e8 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ See this (old) video where I explain some of my motivations for creating Quickem * [procps](https://gitlab.com/procps-ng/procps) * [python3](https://www.python.org/) * [macrecovery](https://github.com/acidanthera/OpenCorePkg/tree/master/Utilities/macrecovery) + * [mkisofs](http://cdrtools.sourceforge.net/private/cdrecord.html) * [usbutils](https://github.com/gregkh/usbutils) * [util-linux](https://github.com/karelzak/util-linux) * [sed](https://www.gnu.org/software/sed/) @@ -240,10 +241,6 @@ quickget windows 11 quickemu --vm windows-11.conf ``` - * During the Windows install you will be asked *"Where do you want to install Windows?"* - * Click **Load driver** and **OK** on the dialogue box that pops up. - * Select `VirtIO SCSI controller (E:\amd64\w10\viostor.inf)` from the list and click **Next**. - * The disk will now be available for partitioning and formatting. * Complete the installation as you normally would. * Post-install: * Run the VirtIO installer (`virtio-win-gt-x64`) from the CD Drive (E:). diff --git a/quickemu b/quickemu index 001d8e0..7d8db55 100755 --- a/quickemu +++ b/quickemu @@ -666,6 +666,12 @@ function vm_boot() { args+=(-drive media=cdrom,index=1,file="${fixed_iso}") fi + # Attached the unattended configuration to Windows guests when booting from ISO + if [ -n "${iso}" ] && [ "${guest_os}" == "windows" ] && [ -e "${VMDIR}/unattended.iso" ]; then + # shellcheck disable=SC2054 + args+=(-drive media=cdrom,index=2,file="${VMDIR}/unattended.iso") + fi + if [ "${guest_os}" == "macos" ]; then # shellcheck disable=SC2054 args+=(-device ahci,id=ahci diff --git a/quickget b/quickget index 403431f..75fd716 100755 --- a/quickget +++ b/quickget @@ -81,6 +81,153 @@ function releases_windows() { 11 } +function unattended_windows() { + cat << 'EOF' > "${1}" + + + + + + + + + true + + + + + + + + 0 + true + + + 1 + EFI + 100 + + + 2 + MSR + 512 + + + 3 + Primary + true + + + + + 1 + 1 + + FAT32 + + + 2 + 3 + + C + NTFS + + + + OnError + + + + OnError + + 0 + 3 + + + + + true + + VK7JG-NPHTM-C97JM-9MPGT-3V66T + Never + + + + true + Never + + + + + + + + + E:\amd64\w10 + + + E:\viogpudo\w10\amd64 + + + E:\viorng\w10\amd64 + + + E:\NetKVM\w10\amd64 + + + + + + + + * + + Wimpys World + Quickemu + 24/7 + + Wimpys World + https://github.com/wimpysworld/quickemu/issues + + Wimpys World + + + + + + + true + true + + + + +EOF +} + function web_get() { local DIR="${2}" local FILE="" @@ -382,6 +529,15 @@ function get_windows() { echo "Downloading virtio-win.iso..." web_get "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso" "${VM_PATH}" + #if [ ! -e "${VM_PATH}/unattended.iso" ]; then + case ${RELEASE} in + 10|11) + echo "Making unattended.iso" + unattended_windows "${VM_PATH}/unattended/autounattend.xml" + mkisofs -quiet -l -o "${VM_PATH}/unattended.iso" "${VM_PATH}/unattended/" + ;; + esac + #fi make_vm_config "${FILE_NAME}" "virtio-win.iso" start_vm_info