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.
This commit is contained in:
Martin Wimpress 2021-10-08 02:04:30 +01:00
parent 8106026fd0
commit d191d0da44
No known key found for this signature in database
GPG Key ID: 61DF940515E06DA3
3 changed files with 163 additions and 4 deletions

View File

@ -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) * [procps](https://gitlab.com/procps-ng/procps)
* [python3](https://www.python.org/) * [python3](https://www.python.org/)
* [macrecovery](https://github.com/acidanthera/OpenCorePkg/tree/master/Utilities/macrecovery) * [macrecovery](https://github.com/acidanthera/OpenCorePkg/tree/master/Utilities/macrecovery)
* [mkisofs](http://cdrtools.sourceforge.net/private/cdrecord.html)
* [usbutils](https://github.com/gregkh/usbutils) * [usbutils](https://github.com/gregkh/usbutils)
* [util-linux](https://github.com/karelzak/util-linux) * [util-linux](https://github.com/karelzak/util-linux)
* [sed](https://www.gnu.org/software/sed/) * [sed](https://www.gnu.org/software/sed/)
@ -240,10 +241,6 @@ quickget windows 11
quickemu --vm windows-11.conf 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. * Complete the installation as you normally would.
* Post-install: * Post-install:
* Run the VirtIO installer (`virtio-win-gt-x64`) from the CD Drive (E:). * Run the VirtIO installer (`virtio-win-gt-x64`) from the CD Drive (E:).

View File

@ -666,6 +666,12 @@ function vm_boot() {
args+=(-drive media=cdrom,index=1,file="${fixed_iso}") args+=(-drive media=cdrom,index=1,file="${fixed_iso}")
fi 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 if [ "${guest_os}" == "macos" ]; then
# shellcheck disable=SC2054 # shellcheck disable=SC2054
args+=(-device ahci,id=ahci args+=(-device ahci,id=ahci

156
quickget
View File

@ -81,6 +81,153 @@ function releases_windows() {
11 11
} }
function unattended_windows() {
cat << 'EOF' > "${1}"
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!--
For documentation on components:
http://technet.microsoft.com/en-us/library/ff699038.aspx
-->
<settings pass="generalize">
<!--
The PersistAllDeviceInstalls setting indicates whether all plug and
play devices on the destination computer remain installed during the
generalize configuration pass.
-->
<component name="Microsoft-Windows-PnPSysprep"
processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35"
language="neutral"
versionScope="nonSxS">
<PersistAllDeviceInstalls>true</PersistAllDeviceInstalls>
</component>
</settings>
<settings pass="windowsPE">
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<DiskConfiguration>
<Disk wcm:action="add">
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
<CreatePartitions>
<CreatePartition wcm:action="add">
<Order>1</Order>
<Type>EFI</Type>
<Size>100</Size>
</CreatePartition>
<CreatePartition wcm:action="add">
<Order>2</Order>
<Type>MSR</Type>
<Size>512</Size>
</CreatePartition>
<CreatePartition wcm:action="add">
<Order>3</Order>
<Type>Primary</Type>
<Extend>true</Extend>
</CreatePartition>
</CreatePartitions>
<ModifyPartitions>
<ModifyPartition wcm:action="add">
<Order>1</Order>
<PartitionID>1</PartitionID>
<Label>System</Label>
<Format>FAT32</Format>
</ModifyPartition>
<ModifyPartition wcm:action="add">
<Order>2</Order>
<PartitionID>3</PartitionID>
<Label>Windows</Label>
<Letter>C</Letter>
<Format>NTFS</Format>
</ModifyPartition>
</ModifyPartitions>
</Disk>
<WillShowUI>OnError</WillShowUI>
</DiskConfiguration>
<ImageInstall>
<OSImage>
<WillShowUI>OnError</WillShowUI>
<InstallTo>
<DiskID>0</DiskID>
<PartitionID>3</PartitionID>
</InstallTo>
</OSImage>
</ImageInstall>
<UserData>
<AcceptEula>true</AcceptEula>
<ProductKey>
<key>VK7JG-NPHTM-C97JM-9MPGT-3V66T</key>
<WillShowUI>Never</WillShowUI>
</ProductKey>
</UserData>
<DynamicUpdate>
<Enable>true</Enable>
<WillShowUI>Never</WillShowUI>
</DynamicUpdate>
</component>
<component name="Microsoft-Windows-PnpCustomizationsWinPE"
publicKeyToken="31bf3856ad364e35" language="neutral"
versionScope="nonSxS" processorArchitecture="amd64">
<!--
This makes the VirtIO drivers available to Windows, assuming that
the VirtIO driver disk
(https://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/)
is available as drive E:
-->
<DriverPaths>
<PathAndCredentials wcm:action="add" wcm:keyValue="1">
<Path>E:\amd64\w10</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="2">
<Path>E:\viogpudo\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="3">
<Path>E:\viorng\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="4">
<Path>E:\NetKVM\w10\amd64</Path>
</PathAndCredentials>
</DriverPaths>
</component>
</settings>
<settings pass="specialize">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<ComputerName>*</ComputerName>
<OEMInformation>
<Manufacturer>Wimpys World</Manufacturer>
<Model>Quickemu</Model>
<SupportHours>24/7</SupportHours>
<SupportPhone></SupportPhone>
<SupportProvider>Wimpys World</SupportProvider>
<SupportURL>https://github.com/wimpysworld/quickemu/issues</SupportURL>
</OEMInformation>
<OEMName>Wimpys World</OEMName>
</component>
</settings>
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<OOBE>
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
</OOBE>
</component>
</settings>
</unattend>
EOF
}
function web_get() { function web_get() {
local DIR="${2}" local DIR="${2}"
local FILE="" local FILE=""
@ -382,6 +529,15 @@ function get_windows() {
echo "Downloading virtio-win.iso..." echo "Downloading virtio-win.iso..."
web_get "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso" "${VM_PATH}" 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" make_vm_config "${FILE_NAME}" "virtio-win.iso"
start_vm_info start_vm_info