diff --git a/.devcontainer.json b/.devcontainer.json new file mode 100644 index 0000000..14d70b4 --- /dev/null +++ b/.devcontainer.json @@ -0,0 +1,6 @@ +{ + "name": "windows", + "service": "windows", + "forwardPorts": [8006], + "dockerComposeFile": "compose.yml" +} diff --git a/Dockerfile b/Dockerfile index ba6997b..384d40b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ARG VERSION_ARG="latest" FROM scratch AS build-amd64 -COPY --from=qemux/qemu-docker:6.13 / / +COPY --from=qemux/qemu:7.10 / / ARG DEBCONF_NOWARNINGS="yes" ARG DEBIAN_FRONTEND="noninteractive" @@ -10,19 +10,14 @@ ARG DEBCONF_NONINTERACTIVE_SEEN="true" RUN set -eu && \ apt-get update && \ apt-get --no-install-recommends -y install \ - bc \ - jq \ - curl \ - 7zip \ wsdd \ samba \ - xz-utils \ wimtools \ dos2unix \ cabextract \ - genisoimage \ libxml2-utils \ - libarchive-tools && \ + libarchive-tools \ + netcat-openbsd && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* diff --git a/assets/win10x64-enterprise-eval.xml b/assets/win10x64-enterprise-eval.xml index df17cbe..15cf47e 100644 --- a/assets/win10x64-enterprise-eval.xml +++ b/assets/win10x64-enterprise-eval.xml @@ -415,6 +415,11 @@ 20 + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file + + + 21 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win10x64-enterprise.xml b/assets/win10x64-enterprise.xml index 5b60828..8523316 100644 --- a/assets/win10x64-enterprise.xml +++ b/assets/win10x64-enterprise.xml @@ -418,6 +418,11 @@ 20 + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file + + + 21 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win10x64-iot.xml b/assets/win10x64-iot.xml index 9516684..fc80dc5 100644 --- a/assets/win10x64-iot.xml +++ b/assets/win10x64-iot.xml @@ -424,6 +424,11 @@ 20 + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file + + + 21 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win10x64-ltsc.xml b/assets/win10x64-ltsc.xml index 108db1f..8cdc2de 100644 --- a/assets/win10x64-ltsc.xml +++ b/assets/win10x64-ltsc.xml @@ -421,6 +421,11 @@ 20 + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file + + + 21 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win10x64.xml b/assets/win10x64.xml index 0b19f99..dbcbb51 100644 --- a/assets/win10x64.xml +++ b/assets/win10x64.xml @@ -418,6 +418,11 @@ 20 + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file + + + 21 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win11x64-enterprise-eval.xml b/assets/win11x64-enterprise-eval.xml index b8c3cbf..7822f82 100644 --- a/assets/win11x64-enterprise-eval.xml +++ b/assets/win11x64-enterprise-eval.xml @@ -102,6 +102,10 @@ 4 reg.exe add "HKLM\SYSTEM\Setup\MoSetup" /v AllowUpgradesWithUnsupportedTPMOrCPU /t REG_DWORD /d 1 /f + + 5 + reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\msiserver" /v Start /t REG_DWORD /d 2 /f + @@ -264,6 +268,11 @@ reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f Set Network Location to Home + + 26 + pnputil -i -a C:\Windows\Drivers\viogpudo\viogpudo.inf + Install VirtIO display driver + @@ -443,19 +452,29 @@ 22 - pnputil -i -a C:\Windows\Drivers\viogpudo\viogpudo.inf - Install VirtIO display driver - - - 23 cmd /C rd /q C:\Windows.old Remove empty Windows.old folder + + 23 + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file + 24 - cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" + cmd /C if exist "C:\OEM\install.bat" cmd /C C:\OEM\install.bat Execute custom script from the OEM folder if exists + + 25 + reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "IPAutoconfigurationEnabled" /t REG_DWORD /d 0 /f + Disable ip autoconfiguration for network interfaces + + + 26 + cmd /C "type nul > \\host.lan\Data\prepared" + Let host known that all configuration is done + diff --git a/assets/win11x64-enterprise.xml b/assets/win11x64-enterprise.xml index fc8562a..6620eb7 100644 --- a/assets/win11x64-enterprise.xml +++ b/assets/win11x64-enterprise.xml @@ -105,6 +105,10 @@ 4 reg.exe add "HKLM\SYSTEM\Setup\MoSetup" /v AllowUpgradesWithUnsupportedTPMOrCPU /t REG_DWORD /d 1 /f + + 5 + reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\msiserver" /v Start /t REG_DWORD /d 2 /f + @@ -267,6 +271,11 @@ reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f Set Network Location to Home + + 26 + pnputil -i -a C:\Windows\Drivers\viogpudo\viogpudo.inf + Install VirtIO display driver + @@ -446,21 +455,30 @@ 22 - pnputil -i -a C:\Windows\Drivers\viogpudo\viogpudo.inf - Install VirtIO display driver - - - 23 cmd /C rd /q C:\Windows.old Remove empty Windows.old folder + + 23 + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file + 24 - cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" + cmd /C if exist "C:\OEM\install.bat" cmd /C C:\OEM\install.bat Execute custom script from the OEM folder if exists + + 25 + reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "IPAutoconfigurationEnabled" /t REG_DWORD /d 0 /f + Disable ip autoconfiguration for network interfaces + + + 26 + cmd /C "type nul > \\host.lan\Data\prepared" + Let host known that all configuration is done + - diff --git a/assets/win11x64-iot.xml b/assets/win11x64-iot.xml index 0de7bb4..4707774 100644 --- a/assets/win11x64-iot.xml +++ b/assets/win11x64-iot.xml @@ -105,6 +105,10 @@ 4 reg.exe add "HKLM\SYSTEM\Setup\MoSetup" /v AllowUpgradesWithUnsupportedTPMOrCPU /t REG_DWORD /d 1 /f + + 5 + reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\msiserver" /v Start /t REG_DWORD /d 2 /f + @@ -267,6 +271,11 @@ reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f Set Network Location to Home + + 26 + pnputil -i -a C:\Windows\Drivers\viogpudo\viogpudo.inf + Install VirtIO display driver + @@ -446,19 +455,29 @@ 22 - pnputil -i -a C:\Windows\Drivers\viogpudo\viogpudo.inf - Install VirtIO display driver - - - 23 cmd /C rd /q C:\Windows.old Remove empty Windows.old folder + + 23 + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file + 24 - cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" + cmd /C if exist "C:\OEM\install.bat" cmd /C C:\OEM\install.bat Execute custom script from the OEM folder if exists + + 25 + reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "IPAutoconfigurationEnabled" /t REG_DWORD /d 0 /f + Disable ip autoconfiguration for network interfaces + + + 26 + cmd /C "type nul > \\host.lan\Data\prepared" + Let host known that all configuration is done + diff --git a/assets/win11x64-ltsc.xml b/assets/win11x64-ltsc.xml index 8e42eb6..4359b1c 100644 --- a/assets/win11x64-ltsc.xml +++ b/assets/win11x64-ltsc.xml @@ -105,6 +105,10 @@ 4 reg.exe add "HKLM\SYSTEM\Setup\MoSetup" /v AllowUpgradesWithUnsupportedTPMOrCPU /t REG_DWORD /d 1 /f + + 5 + reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\msiserver" /v Start /t REG_DWORD /d 2 /f + @@ -267,6 +271,11 @@ reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f Set Network Location to Home + + 26 + pnputil -i -a C:\Windows\Drivers\viogpudo\viogpudo.inf + Install VirtIO display driver + @@ -446,19 +455,29 @@ 22 - pnputil -i -a C:\Windows\Drivers\viogpudo\viogpudo.inf - Install VirtIO display driver - - - 23 cmd /C rd /q C:\Windows.old Remove empty Windows.old folder + + 23 + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file + 24 - cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" + cmd /C if exist "C:\OEM\install.bat" cmd /C C:\OEM\install.bat Execute custom script from the OEM folder if exists + + 25 + reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "IPAutoconfigurationEnabled" /t REG_DWORD /d 0 /f + Disable ip autoconfiguration for network interfaces + + + 26 + cmd /C "type nul > \\host.lan\Data\prepared" + Let host known that all configuration is done + diff --git a/assets/win11x64.xml b/assets/win11x64.xml index 3130bb4..bec96d4 100644 --- a/assets/win11x64.xml +++ b/assets/win11x64.xml @@ -105,6 +105,10 @@ 4 reg.exe add "HKLM\SYSTEM\Setup\MoSetup" /v AllowUpgradesWithUnsupportedTPMOrCPU /t REG_DWORD /d 1 /f + + 5 + reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\msiserver" /v Start /t REG_DWORD /d 2 /f + @@ -267,6 +271,11 @@ reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f Set Network Location to Home + + 26 + pnputil -i -a C:\Windows\Drivers\viogpudo\viogpudo.inf + Install VirtIO display driver + @@ -446,19 +455,29 @@ 22 - pnputil -i -a C:\Windows\Drivers\viogpudo\viogpudo.inf - Install VirtIO display driver - - - 23 cmd /C rd /q C:\Windows.old Remove empty Windows.old folder + + 23 + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file + 24 - cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" + cmd /C if exist "C:\OEM\install.bat" cmd /C C:\OEM\install.bat Execute custom script from the OEM folder if exists + + 25 + reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "IPAutoconfigurationEnabled" /t REG_DWORD /d 0 /f + Disable ip autoconfiguration for network interfaces + + + 26 + cmd /C "type nul > \\host.lan\Data\prepared" + Let host known that all configuration is done + diff --git a/assets/win2008r2-eval.xml b/assets/win2008r2-eval.xml index ed35737..bd3d074 100644 --- a/assets/win2008r2-eval.xml +++ b/assets/win2008r2-eval.xml @@ -290,6 +290,11 @@ 19 + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file + + + 20 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win2008r2.xml b/assets/win2008r2.xml index bd75078..f1e87d6 100644 --- a/assets/win2008r2.xml +++ b/assets/win2008r2.xml @@ -293,6 +293,11 @@ 19 + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file + + + 20 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win2012r2-eval.xml b/assets/win2012r2-eval.xml index fcb7c32..b454f2a 100644 --- a/assets/win2012r2-eval.xml +++ b/assets/win2012r2-eval.xml @@ -308,6 +308,11 @@ 16 + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file + + + 17 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win2012r2.xml b/assets/win2012r2.xml index dea2c37..06c8030 100644 --- a/assets/win2012r2.xml +++ b/assets/win2012r2.xml @@ -311,6 +311,11 @@ 16 + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file + + + 17 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win2016-eval.xml b/assets/win2016-eval.xml index 66fc244..5a3f668 100644 --- a/assets/win2016-eval.xml +++ b/assets/win2016-eval.xml @@ -328,6 +328,11 @@ 20 + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file + + + 21 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win2016.xml b/assets/win2016.xml index 1336e3f..7300fed 100644 --- a/assets/win2016.xml +++ b/assets/win2016.xml @@ -331,6 +331,11 @@ 20 + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file + + + 21 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win2019-eval.xml b/assets/win2019-eval.xml index e9aebfd..6de9fd1 100644 --- a/assets/win2019-eval.xml +++ b/assets/win2019-eval.xml @@ -332,6 +332,11 @@ 20 + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file + + + 21 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/custom.xml b/assets/win2019-hv.xml similarity index 63% rename from custom.xml rename to assets/win2019-hv.xml index de1a76b..d07259d 100644 --- a/custom.xml +++ b/assets/win2019-hv.xml @@ -8,6 +8,7 @@ 0409:00000409 en-US en-US + en-US en-US @@ -61,10 +62,17 @@ + + + /IMAGE/NAME + Hyper-V Server 2019 SERVERHYPERCORE + + 0 3 + OnError false @@ -80,36 +88,11 @@ true Docker Windows for Docker - - VK7JG-NPHTM-C97JM-9MPGT-3V66T - false false - - - 1 - reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassTPMCheck /t REG_DWORD /d 1 /f - - - 2 - reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassSecureBootCheck /t REG_DWORD /d 1 /f - - - 3 - reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassRAMCheck /t REG_DWORD /d 1 /f - - - 4 - reg.exe add "HKLM\SYSTEM\Setup\MoSetup" /v AllowUpgradesWithUnsupportedTPMOrCPU /t REG_DWORD /d 1 /f - - - 5 - reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\msiserver" /v Start /t REG_DWORD /d 2 /f - - @@ -166,113 +149,29 @@ 0409:00000409 en-US en-US + en-US en-US 1 - reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" /v BypassNRO /t REG_DWORD /d 1 /f - - - 2 - reg.exe load "HKU\mount" "C:\Users\Default\NTUSER.DAT" - - - 3 - reg.exe add "HKU\mount\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "ContentDeliveryAllowed" /t REG_DWORD /d 0 /f - - - 4 - reg.exe add "HKU\mount\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "FeatureManagementEnabled" /t REG_DWORD /d 0 /f - - - 5 - reg.exe add "HKU\mount\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "OEMPreInstalledAppsEnabled" /t REG_DWORD /d 0 /f - - - 6 - reg.exe add "HKU\mount\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "PreInstalledAppsEnabled" /t REG_DWORD /d 0 /f - - - 7 - reg.exe add "HKU\mount\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "PreInstalledAppsEverEnabled" /t REG_DWORD /d 0 /f - - - 8 - reg.exe add "HKU\mount\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SilentInstalledAppsEnabled" /t REG_DWORD /d 0 /f - - - 9 - reg.exe add "HKU\mount\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SoftLandingEnabled" /t REG_DWORD /d 0 /f - - - 10 - reg.exe add "HKU\mount\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContentEnabled" /t REG_DWORD /d 0 /f - - - 11 - reg.exe add "HKU\mount\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-310093Enabled" /t REG_DWORD /d 0 /f - - - 12 - reg.exe add "HKU\mount\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338387Enabled" /t REG_DWORD /d 0 /f - - - 13 - reg.exe add "HKU\mount\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338388Enabled" /t REG_DWORD /d 0 /f - - - 14 - reg.exe add "HKU\mount\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338389Enabled" /t REG_DWORD /d 0 /f - - - 15 - reg.exe add "HKU\mount\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338393Enabled" /t REG_DWORD /d 0 /f - - - 16 - reg.exe add "HKU\mount\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-353698Enabled" /t REG_DWORD /d 0 /f - - - 17 - reg.exe add "HKU\mount\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SystemPaneSuggestionsEnabled" /t REG_DWORD /d 0 /f - - - 18 - reg.exe add "HKU\mount\Software\Policies\Microsoft\Windows\CloudContent" /v "DisableCloudOptimizedContent" /t REG_DWORD /d 1 /f - - - 19 - reg.exe add "HKU\mount\Software\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsConsumerFeatures" /t REG_DWORD /d 1 /f - - - 20 - reg.exe add "HKU\mount\Software\Policies\Microsoft\Windows\CloudContent" /v "DisableConsumerAccountStateContent" /t REG_DWORD /d 1 /f - - - 21 - reg.exe unload "HKU\mount" - - - 22 - reg.exe add "HKLM\Software\Policies\Microsoft\Windows\CloudContent" /v "DisableCloudOptimizedContent" /t REG_DWORD /d 1 /f - - - 23 - reg.exe add "HKLM\Software\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsConsumerFeatures" /t REG_DWORD /d 1 /f - - - 24 - reg.exe add "HKLM\Software\Policies\Microsoft\Windows\CloudContent" /v "DisableConsumerAccountStateContent" /t REG_DWORD /d 1 /f - - - 25 reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f Set Network Location to Home + + 2 + dism.exe /online /Disable-Feature /FeatureName:Microsoft-Hyper-V /NoRestart + Disable Hyper-V role + + + true + + + true + false @@ -289,8 +188,6 @@ - - true @@ -350,64 +247,64 @@ 2 - reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "RequireSecuritySignature" /t REG_DWORD /d 0 /f - Disable SMB signing requirement - - - 3 reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v LimitBlankPasswordUse /t REG_DWORD /d 0 /f Allow RDP login with blank password - 4 + 3 reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f Enable option for passwordless sign-in - 5 + 4 cmd /C wmic useraccount where name="Docker" set PasswordExpires=false Password Never Expires - 6 + 5 cmd /C POWERCFG -H OFF Disable Hibernation - 7 + 6 cmd /C POWERCFG -X -monitor-timeout-ac 0 Disable monitor blanking - 8 + 7 reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f Disable first-run experience in Edge - 9 + 8 reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f Show file extensions in Explorer - 10 + 9 reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f Zero Hibernation File - 11 + 10 reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f Disable Hibernation - 12 + 11 cmd /C POWERCFG -X -standby-timeout-ac 0 Disable Sleep - 13 + 12 reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f Enable RemoteAPP to launch unlisted programs + + 13 + reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f + Remove Search from the Taskbar + 14 reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f @@ -440,39 +337,14 @@ 20 - reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV1 /d 0 /t REG_DWORD /f - Disable unsupported hardware notifications + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file 21 - reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV2 /d 0 /t REG_DWORD /f - Disable unsupported hardware notifications - - - 22 - pnputil -i -a C:\Windows\Drivers\viogpudo\viogpudo.inf - Install VirtIO display driver - - - 23 - cmd /C rd /q C:\Windows.old - Remove empty Windows.old folder - - - 24 - cmd /C if exist "C:\OEM\install.bat" cmd /C C:\OEM\install.bat + cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists - - 25 - reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "IPAutoconfigurationEnabled" /t REG_DWORD /d 0 /f - Disable ip autoconfiguration for network interfaces - - - 26 - cmd /C "type nul > \\host.lan\Data\prepared" - Let host known that all configuration is done - diff --git a/assets/win2019.xml b/assets/win2019.xml index aa43463..e07ef29 100644 --- a/assets/win2019.xml +++ b/assets/win2019.xml @@ -335,6 +335,11 @@ 20 + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file + + + 21 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win2022-eval.xml b/assets/win2022-eval.xml index 782752e..9059ab5 100644 --- a/assets/win2022-eval.xml +++ b/assets/win2022-eval.xml @@ -332,6 +332,11 @@ 20 + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file + + + 21 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win2022.xml b/assets/win2022.xml index 3b61f90..2cdfb86 100644 --- a/assets/win2022.xml +++ b/assets/win2022.xml @@ -335,6 +335,11 @@ 20 + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file + + + 21 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win2025-eval.xml b/assets/win2025-eval.xml index 9d90c77..52303b5 100644 --- a/assets/win2025-eval.xml +++ b/assets/win2025-eval.xml @@ -159,6 +159,11 @@ reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f Set Network Location to Home + + 2 + pnputil -i -a C:\Windows\Drivers\viogpudo\viogpudo.inf + Install VirtIO display driver + @@ -337,13 +342,13 @@ 21 - pnputil -i -a C:\Windows\Drivers\viogpudo\viogpudo.inf - Install VirtIO display driver + cmd /C rd /q C:\Windows.old + Remove empty Windows.old folder 22 - cmd /C rd /q C:\Windows.old - Remove empty Windows.old folder + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file 23 diff --git a/assets/win2025.xml b/assets/win2025.xml index 7e543a2..bef8e3f 100644 --- a/assets/win2025.xml +++ b/assets/win2025.xml @@ -162,6 +162,11 @@ reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f Set Network Location to Home + + 2 + pnputil -i -a C:\Windows\Drivers\viogpudo\viogpudo.inf + Install VirtIO display driver + @@ -340,13 +345,13 @@ 21 - pnputil -i -a C:\Windows\Drivers\viogpudo\viogpudo.inf - Install VirtIO display driver + cmd /C rd /q C:\Windows.old + Remove empty Windows.old folder 22 - cmd /C rd /q C:\Windows.old - Remove empty Windows.old folder + cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts + Add entry in hosts file 23 diff --git a/assets/win7x64-enterprise-eval.xml b/assets/win7x64-enterprise-eval.xml new file mode 100644 index 0000000..4b7ce48 --- /dev/null +++ b/assets/win7x64-enterprise-eval.xml @@ -0,0 +1,288 @@ + + + + + + en-US + + 0409:00000409 + en-US + en-US + en-US + + + + OnError + + 0 + true + + + 1 + Primary + 100 + + + 2 + Primary + true + + + + + NTFS + + 1 + true + 1 + 0x27 + + + true + NTFS + + C + 2 + 2 + + + + + + + + + Windows 7 Enterprise + /IMAGE/NAME + + + + 0 + 2 + + false + + + + true + Never + + + false + Never + + + true + Docker + Windows for Docker + + false + + false + + + + + + false + + + + + true + + + 1 + + + + + true + + + * + + Dockur + Windows for Docker + + + + 1 + + + true + true + https://google.com + about:blank + + + true + true + https://google.com + about:blank + + + 0 + + + 1 + + + 0409:00000409 + en-US + en-US + en-US + + + false + + + 0 + + + + + true + all + @FirewallAPI.dll,-28752 + + + + + + + + + + Docker + Administrators + + + true</PlainText> + </Password> + </LocalAccount> + </LocalAccounts> + <AdministratorPassword> + <Value>password</Value> + <PlainText>true</PlainText> + </AdministratorPassword> + </UserAccounts> + <AutoLogon> + <Username>Docker</Username> + <Enabled>true</Enabled> + <LogonCount>65432</LogonCount> + <Password> + <Value /> + <PlainText>true</PlainText> + </Password> + </AutoLogon> + <Display> + <ColorDepth>32</ColorDepth> + <HorizontalResolution>1920</HorizontalResolution> + <VerticalResolution>1080</VerticalResolution> + </Display> + <OOBE> + <HideEULAPage>true</HideEULAPage> + <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> + <NetworkLocation>Home</NetworkLocation> + <ProtectYourPC>3</ProtectYourPC> + <SkipUserOOBE>true</SkipUserOOBE> + <SkipMachineOOBE>true</SkipMachineOOBE> + </OOBE> + <RegisteredOrganization>Dockur</RegisteredOrganization> + <RegisteredOwner>Windows for Docker</RegisteredOwner> + <FirstLogonCommands> + <SynchronousCommand wcm:action="add"> + <Order>1</Order> + <CommandLine>reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f</CommandLine> + <Description>Allow guest access to network shares</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>2</Order> + <CommandLine>reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v LimitBlankPasswordUse /t REG_DWORD /d 0 /f</CommandLine> + <Description>Allow RDP login with blank password</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>3</Order> + <CommandLine>cmd /C wmic useraccount where name="Docker" set PasswordExpires=false</CommandLine> + <Description>Password Never Expires</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>4</Order> + <CommandLine>cmd /C POWERCFG -H OFF</CommandLine> + <Description>Disable Hibernation</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>5</Order> + <CommandLine>cmd /C POWERCFG -X -monitor-timeout-ac 0</CommandLine> + <Description>Disable monitor blanking</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>6</Order> + <CommandLine>reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f</CommandLine> + <Description>Disable Network Discovery popup</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>7</Order> + <CommandLine>reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f</CommandLine> + <Description>Disable Network Discovery popup</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>8</Order> + <CommandLine>reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f</CommandLine> + <Description>Disable Network Discovery popup</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>9</Order> + <CommandLine>reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f</CommandLine> + <Description>Disable first-run experience in Edge</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>10</Order> + <CommandLine>reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f</CommandLine> + <Description>Show file extensions in Explorer</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>11</Order> + <CommandLine>reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f</CommandLine> + <Description>Zero Hibernation File</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>12</Order> + <CommandLine>reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f</CommandLine> + <Description>Disable Hibernation</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>13</Order> + <CommandLine>cmd /C POWERCFG -X -standby-timeout-ac 0</CommandLine> + <Description>Disable Sleep</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>14</Order> + <CommandLine>reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f</CommandLine> + <Description>Enable RemoteAPP to launch unlisted programs</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>15</Order> + <CommandLine>netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes</CommandLine> + <Description>Enable Network Discovery</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>16</Order> + <CommandLine>netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes</CommandLine> + <Description>Enable File Sharing</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>17</Order> + <CommandLine>cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts</CommandLine> + <Description>Add entry in hosts file</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>18</Order> + <CommandLine>cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"</CommandLine> + <Description>Execute custom script from the OEM folder if exists</Description> + </SynchronousCommand> + </FirstLogonCommands> + </component> + </settings> +</unattend> diff --git a/assets/win7x64-enterprise.xml b/assets/win7x64-enterprise.xml index 14c4060..f64a076 100644 --- a/assets/win7x64-enterprise.xml +++ b/assets/win7x64-enterprise.xml @@ -278,6 +278,11 @@ </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>17</Order> + <CommandLine>cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts</CommandLine> + <Description>Add entry in hosts file</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>18</Order> <CommandLine>cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"</CommandLine> <Description>Execute custom script from the OEM folder if exists</Description> </SynchronousCommand> diff --git a/assets/win7x64-ultimate.xml b/assets/win7x64-ultimate.xml index f3c1ae3..aa8117d 100644 --- a/assets/win7x64-ultimate.xml +++ b/assets/win7x64-ultimate.xml @@ -278,6 +278,11 @@ </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>17</Order> + <CommandLine>cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts</CommandLine> + <Description>Add entry in hosts file</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>18</Order> <CommandLine>cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"</CommandLine> <Description>Execute custom script from the OEM folder if exists</Description> </SynchronousCommand> diff --git a/assets/win7x64.xml b/assets/win7x64.xml index b9f2908..f0056e2 100644 --- a/assets/win7x64.xml +++ b/assets/win7x64.xml @@ -278,6 +278,11 @@ </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>17</Order> + <CommandLine>cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts</CommandLine> + <Description>Add entry in hosts file</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>18</Order> <CommandLine>cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"</CommandLine> <Description>Execute custom script from the OEM folder if exists</Description> </SynchronousCommand> diff --git a/assets/win7x86-enterprise.xml b/assets/win7x86-enterprise.xml index ef606e5..acf676f 100644 --- a/assets/win7x86-enterprise.xml +++ b/assets/win7x86-enterprise.xml @@ -278,6 +278,11 @@ </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>17</Order> + <CommandLine>cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts</CommandLine> + <Description>Add entry in hosts file</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>18</Order> <CommandLine>cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"</CommandLine> <Description>Execute custom script from the OEM folder if exists</Description> </SynchronousCommand> diff --git a/assets/win7x86-ultimate.xml b/assets/win7x86-ultimate.xml index f0748cd..c6beb01 100644 --- a/assets/win7x86-ultimate.xml +++ b/assets/win7x86-ultimate.xml @@ -278,6 +278,11 @@ </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>17</Order> + <CommandLine>cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts</CommandLine> + <Description>Add entry in hosts file</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>18</Order> <CommandLine>cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"</CommandLine> <Description>Execute custom script from the OEM folder if exists</Description> </SynchronousCommand> diff --git a/assets/win7x86.xml b/assets/win7x86.xml index c5cd323..74a9064 100644 --- a/assets/win7x86.xml +++ b/assets/win7x86.xml @@ -278,6 +278,11 @@ </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>17</Order> + <CommandLine>cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts</CommandLine> + <Description>Add entry in hosts file</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>18</Order> <CommandLine>cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"</CommandLine> <Description>Execute custom script from the OEM folder if exists</Description> </SynchronousCommand> diff --git a/assets/win81x64-enterprise-eval.xml b/assets/win81x64-enterprise-eval.xml index 2fe8c73..7aee42a 100644 --- a/assets/win81x64-enterprise-eval.xml +++ b/assets/win81x64-enterprise-eval.xml @@ -293,6 +293,11 @@ </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>16</Order> + <CommandLine>cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts</CommandLine> + <Description>Add entry in hosts file</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>17</Order> <CommandLine>cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"</CommandLine> <Description>Execute custom script from the OEM folder if exists</Description> </SynchronousCommand> diff --git a/assets/win81x64-enterprise.xml b/assets/win81x64-enterprise.xml index d6c72dc..d2d49fc 100644 --- a/assets/win81x64-enterprise.xml +++ b/assets/win81x64-enterprise.xml @@ -296,6 +296,11 @@ </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>16</Order> + <CommandLine>cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts</CommandLine> + <Description>Add entry in hosts file</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>17</Order> <CommandLine>cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"</CommandLine> <Description>Execute custom script from the OEM folder if exists</Description> </SynchronousCommand> diff --git a/assets/win81x64.xml b/assets/win81x64.xml index e5e268e..d4b9d5c 100644 --- a/assets/win81x64.xml +++ b/assets/win81x64.xml @@ -303,6 +303,11 @@ </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>16</Order> + <CommandLine>cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts</CommandLine> + <Description>Add entry in hosts file</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>17</Order> <CommandLine>cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"</CommandLine> <Description>Execute custom script from the OEM folder if exists</Description> </SynchronousCommand> diff --git a/assets/winvistax64-enterprise.xml b/assets/winvistax64-enterprise.xml index 50527a0..04a3f5b 100644 --- a/assets/winvistax64-enterprise.xml +++ b/assets/winvistax64-enterprise.xml @@ -252,6 +252,11 @@ </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>22</Order> + <CommandLine>cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts</CommandLine> + <Description>Add entry in hosts file</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>23</Order> <CommandLine>cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"</CommandLine> <Description>Execute custom script from the OEM folder if exists</Description> </SynchronousCommand> diff --git a/assets/winvistax64-ultimate.xml b/assets/winvistax64-ultimate.xml index 14c627d..a391a96 100644 --- a/assets/winvistax64-ultimate.xml +++ b/assets/winvistax64-ultimate.xml @@ -252,6 +252,11 @@ </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>22</Order> + <CommandLine>cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts</CommandLine> + <Description>Add entry in hosts file</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>23</Order> <CommandLine>cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"</CommandLine> <Description>Execute custom script from the OEM folder if exists</Description> </SynchronousCommand> diff --git a/assets/winvistax64.xml b/assets/winvistax64.xml index f753ea3..a2fda33 100644 --- a/assets/winvistax64.xml +++ b/assets/winvistax64.xml @@ -252,6 +252,11 @@ </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>22</Order> + <CommandLine>cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts</CommandLine> + <Description>Add entry in hosts file</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>23</Order> <CommandLine>cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"</CommandLine> <Description>Execute custom script from the OEM folder if exists</Description> </SynchronousCommand> diff --git a/assets/winvistax86-enterprise.xml b/assets/winvistax86-enterprise.xml index d087355..2dc58fa 100644 --- a/assets/winvistax86-enterprise.xml +++ b/assets/winvistax86-enterprise.xml @@ -252,6 +252,11 @@ </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>22</Order> + <CommandLine>cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts</CommandLine> + <Description>Add entry in hosts file</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>23</Order> <CommandLine>cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"</CommandLine> <Description>Execute custom script from the OEM folder if exists</Description> </SynchronousCommand> diff --git a/assets/winvistax86-ultimate.xml b/assets/winvistax86-ultimate.xml index 417722e..b7d35cc 100644 --- a/assets/winvistax86-ultimate.xml +++ b/assets/winvistax86-ultimate.xml @@ -252,6 +252,11 @@ </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>22</Order> + <CommandLine>cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts</CommandLine> + <Description>Add entry in hosts file</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>23</Order> <CommandLine>cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"</CommandLine> <Description>Execute custom script from the OEM folder if exists</Description> </SynchronousCommand> diff --git a/assets/winvistax86.xml b/assets/winvistax86.xml index 172e5dd..3bec2e6 100644 --- a/assets/winvistax86.xml +++ b/assets/winvistax86.xml @@ -252,6 +252,11 @@ </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>22</Order> + <CommandLine>cmd /C echo 20.20.20.1 host.lan >> %WINDIR%\system32\drivers\etc\hosts</CommandLine> + <Description>Add entry in hosts file</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>23</Order> <CommandLine>cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"</CommandLine> <Description>Execute custom script from the OEM folder if exists</Description> </SynchronousCommand> diff --git a/compose.yml b/compose.yml index ac286af..df5adc1 100644 --- a/compose.yml +++ b/compose.yml @@ -16,23 +16,28 @@ services: DISK_FMT: "qcow2" NETWORK: "Y" DEBUG: "Y" + COMMIT: "Y" devices: - /dev/kvm - /dev/net/tun cap_add: - NET_ADMIN + ports: + - 8006:8006 + - 3389:3389/tcp + - 3389:3389/udp + restart: always stop_grace_period: 2m volumes: + - ./windows:/storage - ./scripts:/oem - - ./custom.xml:/custom.xml - - ./custom.iso:/custom.iso windows-installed: image: $IMAGE_NAME:$IMAGE_VERSION container_name: windows-installed privileged: true healthcheck: - test: "[ -f /storage/ready ] || exit 1" + test: "[ -f /local/ready ] || exit 1" interval: 30s retries: 20 start_period: 60s @@ -46,4 +51,9 @@ services: - /dev/net/tun cap_add: - NET_ADMIN + ports: + - 8006:8006 + - 3389:3389/tcp + - 3389:3389/udp + restart: always stop_grace_period: 2m diff --git a/kubernetes.yml b/kubernetes.yml index 2de24a4..fa8eef0 100644 --- a/kubernetes.yml +++ b/kubernetes.yml @@ -10,68 +10,91 @@ spec: requests: storage: 64Gi --- -apiVersion: v1 -kind: Pod +apiVersion: apps/v1 +kind: Deployment metadata: name: windows labels: name: windows spec: - containers: - - name: windows - image: dockurr/windows - env: - - name: VERSION - value: "11" - - name: RAM_SIZE - value: "4G" - - name: CPU_CORES - value: "2" - - name: DISK_SIZE - value: "64G" - ports: - - containerPort: 8006 - - containerPort: 3389 - - containerPort: 3389 - protocol: UDP - securityContext: - capabilities: - add: - - NET_ADMIN - privileged: true - volumeMounts: - - mountPath: /storage - name: storage - - mountPath: /dev/kvm - name: dev-kvm - - mountPath: /dev/net/tun - name: dev-tun - terminationGracePeriodSeconds: 120 - volumes: - - name: storage - persistentVolumeClaim: - claimName: windows-pvc - - hostPath: - path: /dev/kvm - name: dev-kvm - - hostPath: - path: /dev/net/tun - type: CharDevice - name: dev-tun + replicas: 1 + selector: + matchLabels: + app: windows + template: + metadata: + labels: + app: windows + spec: + containers: + - name: windows + image: dockurr/windows + env: + - name: VERSION + value: "11" + - name: DISK_SIZE + value: "64G" + ports: + - containerPort: 8006 + name: http + protocol: TCP + - containerPort: 3389 + name: rdp + protocol: TCP + - containerPort: 3389 + name: udp + protocol: UDP + - containerPort: 5900 + name: vnc + protocol: TCP + securityContext: + capabilities: + add: + - NET_ADMIN + privileged: true + volumeMounts: + - mountPath: /storage + name: storage + - mountPath: /dev/kvm + name: dev-kvm + - mountPath: /dev/net/tun + name: dev-tun + terminationGracePeriodSeconds: 120 + volumes: + - name: storage + persistentVolumeClaim: + claimName: windows-pvc + - hostPath: + path: /dev/kvm + name: dev-kvm + - hostPath: + path: /dev/net/tun + type: CharDevice + name: dev-tun --- apiVersion: v1 kind: Service metadata: name: windows spec: + internalTrafficPolicy: Cluster ports: - - name: tcp-8006 - port: 8006 - - name: tcp-3389 - port: 3389 - - name: udp-3389 - port: 3389 - protocol: UDP + - name: http + port: 8006 + protocol: TCP + targetPort: 8006 + - name: rdp + port: 3389 + protocol: TCP + targetPort: 3389 + - name: udp + port: 3389 + protocol: UDP + targetPort: 3389 + - name: vnc + port: 5900 + protocol: TCP + targetPort: 5900 selector: - name: windows - type: NodePort + app: windows + type: ClusterIP diff --git a/prepare_image.sh b/prepare_image.sh index 93f97dc..aee267c 100755 --- a/prepare_image.sh +++ b/prepare_image.sh @@ -4,7 +4,7 @@ set -Eeuo pipefail source env.sh echo "start to build and install windows" -docker compose up windows-build -d --build +docker compose up windows-build -d --build --force-recreate echo "streaming logs..." docker logs -f windows-build | tee windows-build.log & diff --git a/readme.md b/readme.md index e63e2a9..dbbd035 100644 --- a/readme.md +++ b/readme.md @@ -26,7 +26,7 @@ Windows inside a Docker container. ## Usage 🐳 -Via Docker Compose: +##### Via Docker Compose: ```yaml services: @@ -44,30 +44,27 @@ services: - 8006:8006 - 3389:3389/tcp - 3389:3389/udp + volumes: + - ./windows:/storage + restart: always stop_grace_period: 2m ``` -Via Docker CLI: +##### Via Docker CLI: ```bash -docker run -it --rm -p 8006:8006 --device=/dev/kvm --device=/dev/net/tun --cap-add NET_ADMIN --stop-timeout 120 dockurr/windows +docker run -it --rm --name windows -p 8006:8006 --device=/dev/kvm --device=/dev/net/tun --cap-add NET_ADMIN -v ${PWD:-.}/windows:/storage --stop-timeout 120 dockurr/windows ``` -Via Kubernetes: +##### Via Kubernetes: ```shell kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/master/kubernetes.yml ``` -## Compatibility ⚙️ +##### Via Github Codespaces: -| **Product** | **Platform** | | -|---|---|---| -| Docker Engine | Linux| ✅ | -| Docker Desktop | Linux | ❌ | -| Docker Desktop | macOS | ❌ | -| Docker Desktop | Windows 11 | ✅ | -| Docker Desktop | Windows 10 | ❌ | +[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/dockur/windows) ## FAQ 💬 @@ -75,7 +72,7 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas Very simple! These are the steps: - - Start the container and connect to [port 8006](http://localhost:8006) using your web browser. + - Start the container and connect to [port 8006](http://127.0.0.1:8006/) using your web browser. - Sit back and relax while the magic happens, the whole installation will be performed fully automatic. @@ -94,28 +91,29 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas Select from the values below: - | **Value** | **Version** | **Size** | + | **Value** | **Version** | **Size** | |---|---|---| - | `11` | Windows 11 Pro | 5.4 GB | - | `11l` | Windows 11 LTSC | 4.2 GB | - | `11e` | Windows 11 Enterprise | 5.8 GB | + | `11` | Windows 11 Pro | 5.4 GB | + | `11l` | Windows 11 LTSC | 4.7 GB | + | `11e` | Windows 11 Enterprise | 4.0 GB | |||| - | `10` | Windows 10 Pro | 5.7 GB | - | `10l` | Windows 10 LTSC | 4.6 GB | - | `10e` | Windows 10 Enterprise | 5.2 GB | + | `10` | Windows 10 Pro | 5.7 GB | + | `10l` | Windows 10 LTSC | 4.6 GB | + | `10e` | Windows 10 Enterprise | 5.2 GB | |||| - | `8e` | Windows 8.1 Enterprise | 3.7 GB | - | `7e` | Windows 7 Enterprise | 3.0 GB | - | `ve` | Windows Vista Enterprise | 3.0 GB | - | `xp` | Windows XP Professional | 0.6 GB | - |||| - | `2025` | Windows Server 2025 | 5.0 GB | - | `2022` | Windows Server 2022 | 4.7 GB | - | `2019` | Windows Server 2019 | 5.3 GB | - | `2016` | Windows Server 2016 | 6.5 GB | - | `2012` | Windows Server 2012 | 4.3 GB | - | `2008` | Windows Server 2008 | 3.0 GB | - | `2003` | Windows Server 2003 | 0.6 GB | + | `8e` | Windows 8.1 Enterprise | 3.7 GB | + | `7e` | Windows 7 Enterprise | 3.0 GB | + | `ve` | Windows Vista Enterprise | 3.0 GB | + | `xp` | Windows XP Professional | 0.6 GB | + | `2k` | Windows 2000 Professional | 0.4 GB | + |||| + | `2025` | Windows Server 2025 | 5.6 GB | + | `2022` | Windows Server 2022 | 4.7 GB | + | `2019` | Windows Server 2019 | 5.3 GB | + | `2016` | Windows Server 2016 | 6.5 GB | + | `2012` | Windows Server 2012 | 4.3 GB | + | `2008` | Windows Server 2008 | 3.0 GB | + | `2003` | Windows Server 2003 | 0.6 GB | > [!TIP] > To install ARM64 versions of Windows use [dockur/windows-arm](https://github.com/dockur/windows-arm/). @@ -126,10 +124,10 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas ```yaml volumes: - - /var/win:/storage + - ./windows:/storage ``` - Replace the example path `/var/win` with the desired storage folder. + Replace the example path `./windows` with the desired storage folder or named volume. ### How do I change the size of the disk? @@ -145,60 +143,20 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas ### How do I share files with the host? - Open 'File Explorer' and click on the 'Network' section, you will see a computer called `host.lan`. Double-click it and it will show a folder called `Data`, which can be bound to any folder on your host via the compose file: + Open 'File Explorer' and click on the 'Network' section, you will see a computer called `host.lan`. + + Double-click it and it will show a folder called `Data`, which can be bound to any folder on your host via the compose file: ```yaml volumes: - - /home/user/example:/data + - ./example:/data ``` - The example folder `/home/user/example` will be available as ` \\host.lan\Data`. + The example folder `./example` will be available as ` \\host.lan\Data`. > [!TIP] > You can map this path to a drive letter in Windows, for easier access. -### How do I install a custom image? - - In order to download an unsupported ISO image that is not selectable from the list above, specify the URL of that ISO in the `VERSION` environment variable, for example: - - ```yaml - environment: - VERSION: "https://example.com/win.iso" - ``` - - Alternatively, you can also skip the download and use a local file instead, by binding it in your compose file in this way: - - ```yaml - volumes: - - /home/user/example.iso:/custom.iso - ``` - - Replace the example path `/home/user/example.iso` with the filename of your desired ISO file, the value of `VERSION` will be ignored in this case. - -### How do I run a script after installation? - - To run your own script after installation, you can create a file called `install.bat` and place it in a folder together with any additional files it needs (software to be installed for example). - - Then bind that folder in your compose file like this: - - ```yaml - volumes: - - /home/user/example:/oem - ``` - - The example folder `/home/user/example` will be copied to `C:\OEM` during installation and the containing `install.bat` will be executed during the last step. - -### How do I perform a manual installation? - - It's best to stick to the automatic installation, as it adjusts various settings to prevent common issues when running Windows inside a virtual environment. - - However, if you insist on performing the installation manually, add the following environment variable to your compose file: - - ```yaml - environment: - MANUAL: "Y" - ``` - ### How do I change the amount of CPU or RAM? By default, the container will be allowed to use a maximum of 2 CPU cores and 4 GB of RAM. @@ -213,9 +171,9 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas ### How do I configure the username and password? - By default, a user called `Docker` is created during the installation, with an empty password. + By default, a user called `Docker` is created during installation and its password is `admin`. - If you want to use different credentials, you can change them in your compose file: + If you want to use different credentials, you can configure them in your compose file (only before installation): ```yaml environment: @@ -225,7 +183,9 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas ### How do I select the Windows language? - By default, the English version of Windows will be downloaded. But you can add the `LANGUAGE` environment variable to your compose file, in order to specify an alternative language: + By default, the English version of Windows will be downloaded. + + But before installation you can add the `LANGUAGE` environment variable to your compose file, in order to specify an alternative language: ```yaml environment: @@ -236,7 +196,7 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas ### How do I select the keyboard layout? - If you want to use a keyboard layout or locale that is not the default for your selected language, you can add the `KEYBOARD` and `REGION` variables with a culture code, like this: + If you want to use a keyboard layout or locale that is not the default for your selected language, you can add `KEYBOARD` and `REGION` variables like this (before installation): ```yaml environment: @@ -244,15 +204,62 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas KEYBOARD: "en-US" ``` -> [!NOTE] -> Changing these values will have no effect after the installation has been performed already. Use the control panel inside Windows in that case. -> +### How do I select the edition? + + Windows Server offers a minimalistic Core edition without a GUI. To select those non-standard editions, you can add a `EDITION` variable like this (before installation): + + ```yaml + environment: + EDITION: "core" + ``` + +### How do I install a custom image? + + In order to download an unsupported ISO image, specify its URL in the `VERSION` environment variable: + + ```yaml + environment: + VERSION: "https://example.com/win.iso" + ``` + + Alternatively, you can also skip the download and use a local file instead, by binding it in your compose file in this way: + + ```yaml + volumes: + - ./example.iso:/custom.iso + ``` + + Replace the example path `./example.iso` with the filename of your desired ISO file. The value of `VERSION` will be ignored in this case. + +### How do I run a script after installation? + + To run your own script after installation, you can create a file called `install.bat` and place it in a folder together with any additional files it needs (software to be installed for example). + + Then bind that folder in your compose file like this: + + ```yaml + volumes: + - ./example:/oem + ``` + + The example folder `./example` will be copied to `C:\OEM` and the containing `install.bat` will be executed during the last step of the automatic installation. + +### How do I perform a manual installation? + + It's recommended to stick to the automatic installation, as it adjusts various settings to prevent common issues when running Windows inside a virtual environment. + + However, if you insist on performing the installation manually at your own risk, add the following environment variable to your compose file: + + ```yaml + environment: + MANUAL: "Y" + ``` ### How do I connect using RDP? The web-viewer is mainly meant to be used during installation, as its picture quality is low, and it has no audio or clipboard for example. - So for a better experience you can connect using any Microsoft Remote Desktop client to the IP of the container, using the username `Docker` and by leaving the password empty. + So for a better experience you can connect using any Microsoft Remote Desktop client to the IP of the container, using the username `Docker` and password `admin`. There is a RDP client for [Android](https://play.google.com/store/apps/details?id=com.microsoft.rdc.androidx) available from the Play Store and one for [iOS](https://apps.apple.com/nl/app/microsoft-remote-desktop/id714464092?l=en-GB) in the Apple Store. For Linux you can use [FreeRDP](https://www.freerdp.com/) and on Windows just type `mstsc` in the search box. @@ -297,7 +304,7 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas After configuring the container for [macvlan](#how-do-i-assign-an-individual-ip-address-to-the-container), it is possible for Windows to become part of your home network by requesting an IP from your router, just like a real PC. - To enable this mode, add the following lines to your compose file: + To enable this mode, in which the container and Windows will have separate IP addresses, add the following lines to your compose file: ```yaml environment: @@ -308,9 +315,6 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas - 'c *:* rwm' ``` -> [!NOTE] -> In this mode, the container and Windows will each have their own separate IPs. - ### How do I add multiple disks? To create additional disks, modify your compose file like this: @@ -320,18 +324,18 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas DISK2_SIZE: "32G" DISK3_SIZE: "64G" volumes: - - /home/example:/storage2 - - /mnt/data/example:/storage3 + - ./example2:/storage2 + - ./example3:/storage3 ``` ### How do I pass-through a disk? - It is possible to pass-through disk devices directly by adding them to your compose file in this way: + It is possible to pass-through disk devices or partitions directly by adding them to your compose file in this way: ```yaml devices: - /dev/sdb:/disk1 - - /dev/sdc:/disk2 + - /dev/sdc1:/disk2 ``` Use `/disk1` if you want it to become your main drive (which will be formatted during installation), and use `/disk2` and higher to add them as secondary drives (which will stay untouched). @@ -347,14 +351,20 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas - /dev/bus/usb ``` -> [!IMPORTANT] -> If the device is a USB disk drive, please wait until after the installation is completed before connecting it. Otherwise the installation may fail, as the order of the disks can get rearranged. + If the device is a USB disk drive, please wait until after the installation is fully completed before connecting it. Otherwise the installation may fail, as the order of the disks can get rearranged. ### How do I verify if my system supports KVM? - Only Linux and Windows 11 support KVM virtualization, macOS and Windows 10 do not unfortunately. - - You can run the following commands in Linux to check your system: + First check if your software is compatible using this chart: + + | **Product** | **Linux** | **Win11** | **Win10** | **macOS** | + |---|---|---|---|---| + | Docker CLI | ✅ | ✅ | ❌ | ❌ | + | Docker Desktop | ❌ | ✅ | ❌ | ❌ | + | Podman CLI | ✅ | ✅ | ❌ | ❌ | + | Podman Desktop | ✅ | ✅ | ❌ | ❌ | + + After that you can run the following commands in Linux to check your system: ```bash sudo apt install cpu-checker @@ -369,16 +379,16 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas - you are not using a cloud provider, as most of them do not allow nested virtualization for their VPS's. - If you do not receive any error from `kvm-ok` but the container still complains about KVM, please check whether: - - - you are not using "Docker Desktop for Linux" as it does not support KVM, instead make use of Docker Engine directly. - - - it could help to add `privileged: true` to your compose file (or `sudo` to your `docker run` command), to rule out any permission issue. + If you did not receive any error from `kvm-ok` but the container still complains about a missing KVM device, it could help to add `privileged: true` to your compose file (or `sudo` to your `docker` command) to rule out any permission issue. ### How do I run macOS in a container? You can use [dockur/macos](https://github.com/dockur/macos) for that. It shares many of the same features, except for the automatic installation. +### How do I run a Linux desktop in a container? + + You can use [qemus/qemu](https://github.com/qemus/qemu) in that case. + ### Is this project legal? Yes, this project contains only open-source code and does not distribute any copyrighted material. Any product keys found in the code are just generic placeholders provided by Microsoft for trial purposes. So under all applicable laws, this project will be considered legal. diff --git a/src/define.sh b/src/define.sh index 279468b..69896b1 100644 --- a/src/define.sh +++ b/src/define.sh @@ -1,10 +1,12 @@ #!/usr/bin/env bash set -Eeuox pipefail +: "${KEY:=""}" : "${WIDTH:=""}" : "${HEIGHT:=""}" : "${VERIFY:=""}" : "${REGION:=""}" +: "${EDITION:=""}" : "${MANUAL:=""}" : "${REMOVE:=""}" : "${VERSION:=""}" @@ -15,7 +17,6 @@ set -Eeuox pipefail : "${PASSWORD:=""}" MIRRORS=3 -PLATFORM="x64" parseVersion() { @@ -62,7 +63,7 @@ parseVersion() { ;; "7" | "7e" | "win7" | "win7e" | "windows7" | "windows 7" ) VERSION="win7x64" - [ -z "$DETECTED" ] && DETECTED="win7x64-enterprise" + [ -z "$DETECTED" ] && DETECTED="win7x64-enterprise-eval" ;; "7u" | "win7u" | "windows7u" | "windows 7u" ) VERSION="win7x64-ultimate" @@ -88,6 +89,9 @@ parseVersion() { "xp64" | "xpx64" | "5x64" | "winxp64" | "winxpx64" | "windowsxp64" | "windowsxpx64" ) VERSION="winxpx64" ;; + "2k" | "2000" | "win2k" | "win2000" | "windows2k" | "windows2000" ) + VERSION="win2kx86" + ;; "25" | "2025" | "win25" | "win2025" | "windows2025" | "windows 2025" ) VERSION="win2025-eval" ;; @@ -100,6 +104,9 @@ parseVersion() { "16" | "2016" | "win16" | "win2016" | "windows2016" | "windows 2016" ) VERSION="win2016-eval" ;; + "hv" | "hyperv" | "hyper v" | "hyper-v" | "19hv" | "2019hv" | "win2019hv" ) + VERSION="win2019-hv" + ;; "2012" | "2012r2" | "win2012" | "win2012r2" | "windows2012" | "windows 2012" ) VERSION="win2012r2-eval" ;; @@ -416,6 +423,7 @@ printVersion() { "win95"* ) desc="Windows 95" ;; "win2k"* ) desc="Windows 2000" ;; "winvista"* ) desc="Windows Vista" ;; + "win2019-hv"* ) desc="Hyper-V Server" ;; "win2003"* ) desc="Windows Server 2003" ;; "win2008"* ) desc="Windows Server 2008" ;; "win2012"* ) desc="Windows Server 2012" ;; @@ -460,6 +468,9 @@ printEdition() { *"-education" ) edition="Education" ;; + *"-hv" ) + edition="2019" + ;; *"-iot" | *"-iot-eval" ) edition="LTSC" ;; @@ -481,11 +492,12 @@ printEdition() { "winvista"* ) edition="Business" ;; - "win2025"* | "win2022"* | "win2019"* | "win2016"* ) - edition="Standard" - ;; - "win2012"* | "win2008"* | "win2003"* ) - edition="Standard" + "win2025"* | "win2022"* | "win2019"* | "win2016"* | "win2012"* | "win2008"* | "win2003"* ) + case "${EDITION^^}" in + *"DATACENTER"* ) edition="Datacenter" ;; + "CORE" | "STANDARDCORE" ) edition="Core" ;; + * ) edition="Standard" ;; + esac ;; esac @@ -548,6 +560,9 @@ fromFile() { "tiny10"* | "tiny_10"* ) id="tiny10" ;; + *"_serverhypercore_"* ) + id="win2019${add}-hv" + ;; *"server2025"* | *"server_2025"* ) id="win2025${add}" ;; @@ -592,7 +607,9 @@ fromName() { *"windows 7"* ) id="win7${arch}" ;; *"windows 8"* ) id="win81${arch}" ;; *"windows 10"* ) id="win10${arch}" ;; + *"optimum 10"* ) id="win10${arch}" ;; *"windows 11"* ) id="win11${arch}" ;; + *"optimum 11"* ) id="win11${arch}" ;; *"windows vista"* ) id="winvista${arch}" ;; *"server 2025"* ) id="win2025${add}" ;; *"server 2022"* ) id="win2022${add}" ;; @@ -601,6 +618,7 @@ fromName() { *"server 2012"* ) id="win2012r2${add}" ;; *"server 2008"* ) id="win2008r2${add}" ;; *"server 2003"* ) id="win2003r2${add}" ;; + *"hyper-v server"* ) id="win2019${add}" ;; esac echo "$id" @@ -621,6 +639,7 @@ getVersion() { *" home"* ) id="$id-home" ;; *" starter"* ) id="$id-starter" ;; *" ultimate"* ) id="$id-ultimate" ;; + *" enterprise evaluation"* ) id="$id-enterprise-eval" ;; *" enterprise"* ) id="$id-enterprise" ;; esac ;; @@ -643,6 +662,7 @@ getVersion() { "win2025"* | "win2022"* | "win2019"* | "win2016"* | "win2012"* | "win2008"* | "win2003"* ) case "${name,,}" in *" evaluation"* ) id="$id-eval" ;; + *"hyper-v server"* ) id="$id-hv" ;; esac ;; esac @@ -665,6 +685,9 @@ switchEdition() { "win81${PLATFORM,,}-enterprise-eval" ) DETECTED="win81${PLATFORM,,}-enterprise" ;; + "win7${PLATFORM,,}" | "win7${PLATFORM,,}-enterprise-eval" ) + DETECTED="win7${PLATFORM,,}-enterprise" + ;; "win2025-eval" ) DETECTED="win2025" ;; "win2022-eval" ) DETECTED="win2022" ;; "win2019-eval" ) DETECTED="win2019" ;; @@ -681,6 +704,7 @@ getMido() { local id="$1" local lang="$2" local ret="$3" + local url="" local sum="" local size="" @@ -692,16 +716,14 @@ getMido() { sum="b56b911bf18a2ceaeb3904d87e7c770bdf92d3099599d61ac2497b91bf190b11" ;; "win11x64-enterprise-eval" ) - size=6209064960 - sum="c8dbc96b61d04c8b01faf6ce0794fdf33965c7b350eaa3eb1e6697019902945c" + size=4295096320 + sum="dad633276073f14f3e0373ef7e787569e216d54942ce522b39451c8f2d38ad43" + url="https://software-static.download.prss.microsoft.com/dbazure/888969d5-f34g-4e03-ac9d-1f9786c66749/26100.1.240331-1435.ge_release_CLIENTENTERPRISEEVAL_OEMRET_A64FRE_en-us.iso" ;; - "win11x64-enterprise-ltsc-eval" ) - size=4428627968 - sum="8abf91c9cd408368dc73aab3425d5e3c02dae74900742072eb5c750fc637c195" - ;; - "win11x64-enterprise-iot-eval" ) - size=4428627968 - sum="8abf91c9cd408368dc73aab3425d5e3c02dae74900742072eb5c750fc637c195" + "win11x64-enterprise-iot-eval" | "win11x64-enterprise-ltsc-eval" ) + size=5060020224 + sum="2cee70bd183df42b92a2e0da08cc2bb7a2a9ce3a3841955a012c0f77aeb3cb29" + url="https://software-static.download.prss.microsoft.com/dbazure/888969d5-f34g-4e03-ac9d-1f9786c66749/26100.1.240331-1435.ge_release_CLIENT_IOT_LTSC_EVAL_x64FRE_en-us.iso" ;; "win10x64" ) size=6140975104 @@ -710,45 +732,59 @@ getMido() { "win10x64-enterprise-eval" ) size=5550497792 sum="ef7312733a9f5d7d51cfa04ac497671995674ca5e1058d5164d6028f0938d668" + url="https://software-static.download.prss.microsoft.com/dbazure/988969d5-f34g-4e03-ac9d-1f9786c66750/19045.2006.220908-0225.22h2_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso" ;; "win10x64-enterprise-ltsc-eval" ) size=4898582528 sum="e4ab2e3535be5748252a8d5d57539a6e59be8d6726345ee10e7afd2cb89fefb5" + url="https://software-download.microsoft.com/download/pr/19044.1288.211006-0501.21h2_release_svc_refresh_CLIENT_LTSC_EVAL_x64FRE_en-us.iso" ;; "win81x64-enterprise-eval" ) size=3961473024 sum="2dedd44c45646c74efc5a028f65336027e14a56f76686a4631cf94ffe37c72f2" + url="https://download.microsoft.com/download/B/9/9/B999286E-0A47-406D-8B3D-5B5AD7373A4A/9600.17050.WINBLUE_REFRESH.140317-1640_X64FRE_ENTERPRISE_EVAL_EN-US-IR3_CENA_X64FREE_EN-US_DV9.ISO" ;; "win2025-eval" ) - size=5307996160 - sum="16442d1c0509bcbb25b715b1b322a15fb3ab724a42da0f384b9406ca1c124ed4" + size=6014152704 + sum="d0ef4502e350e3c6c53c15b1b3020d38a5ded011bf04998e950720ac8579b23d" + url="https://software-static.download.prss.microsoft.com/dbazure/888969d5-f34g-4e03-ac9d-1f9786c66749/26100.1742.240906-0331.ge_release_svc_refresh_SERVER_EVAL_x64FRE_en-us.iso" ;; "win2022-eval" ) size=5044094976 sum="3e4fa6d8507b554856fc9ca6079cc402df11a8b79344871669f0251535255325" + url="https://software-static.download.prss.microsoft.com/sg/download/888969d5-f34g-4e03-ac9d-1f9786c66749/SERVER_EVAL_x64FRE_en-us.iso" ;; "win2019-eval" ) size=5652088832 sum="6dae072e7f78f4ccab74a45341de0d6e2d45c39be25f1f5920a2ab4f51d7bcbb" + url="https://software-download.microsoft.com/download/pr/17763.737.190906-2324.rs5_release_svc_refresh_SERVER_EVAL_x64FRE_en-us_1.iso" + ;; + "win2019-hv" ) + size=3072712704 + sum="48e9b944518e5bbc80876a9a7ff99716f386f404f4be48dca47e16a66ae7872c" + url="https://software-download.microsoft.com/download/pr/17763.557.190612-0019.rs5_release_svc_refresh_SERVERHYPERCORE_OEM_x64FRE_en-us.ISO" ;; "win2016-eval" ) size=6972221440 sum="1ce702a578a3cb1ac3d14873980838590f06d5b7101c5daaccbac9d73f1fb50f" + url="https://software-download.microsoft.com/download/pr/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO" ;; "win2012r2-eval" ) size=4542291968 sum="6612b5b1f53e845aacdf96e974bb119a3d9b4dcb5b82e65804ab7e534dc7b4d5" + url="https://download.microsoft.com/download/6/2/A/62A76ABB-9990-4EFC-A4FE-C7D698DAEB96/9600.17050.WINBLUE_REFRESH.140317-1640_X64FRE_SERVER_EVAL_EN-US-IR3_SSS_X64FREE_EN-US_DV9.ISO" ;; "win2008r2" ) size=3166840832 sum="30832ad76ccfa4ce48ccb936edefe02079d42fb1da32201bf9e3a880c8ed6312" + url="https://download.microsoft.com/download/4/1/D/41DEA7E0-B30D-4012-A1E3-F24DC03BA1BB/7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso" ;; esac case "${ret,,}" in "sum" ) echo "$sum" ;; "size" ) echo "$size" ;; - *) echo "";; + *) echo "$url";; esac return 0 @@ -770,25 +806,23 @@ getLink1() { case "${id,,}" in "win11x64" | "win11x64-enterprise" | "win11x64-enterprise-eval" ) - size=5946128384 - sum="5bb1459034f50766ee480d895d751af73a4af30814240ae32ebc5633546a5af7" - url="11/en-us_windows_11_23h2_x64.iso" + size=5332989952 + sum="aa1ad990f930d907b7a34ea897abbb0dfbe47552ca8acc146f92e40381839e05" + url="11/en-us_windows_11_24h2_x64.iso" ;; "win11x64-iot" | "win11x64-enterprise-iot-eval" ) - [[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-us" ]] && return 0 size=5144817664 sum="4f59662a96fc1da48c1b415d6c369d08af55ddd64e8f1c84e0166d9e50405d7a" url="11/X23-81951_26100.1742.240906-0331.ge_release_svc_refresh_CLIENT_ENTERPRISES_OEM_x64FRE_en-us.iso" ;; "win11x64-ltsc" | "win11x64-enterprise-ltsc-eval" ) - [[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-us" ]] && return 0 size=5144817664 sum="4f59662a96fc1da48c1b415d6c369d08af55ddd64e8f1c84e0166d9e50405d7a" url="11/X23-81951_26100.1742.240906-0331.ge_release_svc_refresh_CLIENT_ENTERPRISES_OEM_x64FRE_en-us.iso" ;; "win10x64" | "win10x64-enterprise" | "win10x64-enterprise-eval" ) - size=5623582720 - sum="57371545d752a79a8a8b163b209c7028915da661de83516e06ddae913290a855" + size=5535252480 + sum="557871965263d0fd0a1ea50b5d0d0d7cb04a279148ca905c1c675c9bc0d5486c" url="10/en-us_windows_10_22h2_x64.iso" ;; "win10x64-iot" | "win10x64-enterprise-iot-eval" ) @@ -841,7 +875,7 @@ getLink1() { sum="dfd9890881b7e832a927c38310fb415b7ea62ac5a896671f2ce2a111998f0df8" url="server/2008r2/en_windows_server_2008_r2_with_sp1_x64_dvd_617601-018.iso" ;; - "win7x64" | "win7x64-enterprise" ) + "win7x64" | "win7x64-enterprise" | "win7x64-enterprise-eval" ) size=3182604288 sum="ee69f3e9b86ff973f632db8e01700c5724ef78420b175d25bae6ead90f6805a7" url="7/en_windows_7_enterprise_with_sp1_x64_dvd_u_677651.iso" @@ -851,7 +885,7 @@ getLink1() { sum="0b738b55a5ea388ad016535a5c8234daf2e5715a0638488ddd8a228a836055a1" url="7/en_windows_7_with_sp1_x64.iso" ;; - "win7x86" | "win7x86-enterprise" ) + "win7x86" | "win7x86-enterprise" | "win7x86-enterprise-eval" ) size=2434502656 sum="8bdd46ff8cb8b8de9c4aba02706629c8983c45e87da110e64e13be17c8434dad" url="7/en_windows_7_enterprise_with_sp1_x86_dvd_u_677710.iso" @@ -881,6 +915,11 @@ getLink1() { sum="8fac68e1e56c64ad9a2aa0ad464560282e67fa4f4dd51d09a66f4e548eb0f2d6" url="xp/professional/en_win_xp_pro_x64_vl.iso" ;; + "win2kx86" ) + size=331701982 + sum="a93251b31f92316411bb48458a695d9051b13cdeba714c46f105012fdda45bf3" + url="2000/5.00.2195.6717_x86fre_client-professional_retail_en-us.7z" + ;; esac case "${ret,,}" in @@ -925,7 +964,7 @@ getLink2() { sum="dfd9890881b7e832a927c38310fb415b7ea62ac5a896671f2ce2a111998f0df8" url="Windows%20Server%202008%20R2/en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso" ;; - "win7x64" | "win7x64-enterprise" ) + "win7x64" | "win7x64-enterprise" | "win7x64-enterprise-eval" ) size=3182604288 sum="ee69f3e9b86ff973f632db8e01700c5724ef78420b175d25bae6ead90f6805a7" url="Windows%207/en_windows_7_enterprise_with_sp1_x64_dvd_u_677651.iso" @@ -935,7 +974,7 @@ getLink2() { sum="36f4fa2416d0982697ab106e3a72d2e120dbcdb6cc54fd3906d06120d0653808" url="Windows%207/en_windows_7_ultimate_with_sp1_x64_dvd_u_677332.iso" ;; - "win7x86" | "win7x86-enterprise" ) + "win7x86" | "win7x86-enterprise" | "win7x86-enterprise-eval" ) size=2434502656 sum="8bdd46ff8cb8b8de9c4aba02706629c8983c45e87da110e64e13be17c8434dad" url="Windows%207/en_windows_7_enterprise_with_sp1_x86_dvd_u_677710.iso" @@ -1019,11 +1058,40 @@ getLink3() { sum="a11116c0645d892d6a5a7c585ecc1fa13aa66f8c7cc6b03bf1f27bd16860cc35" url="tiny-10-23-h2/tiny10%20x64%2023h2.iso" ;; + "win7x64" | "win7x64-enterprise" | "win7x64-enterprise-eval" ) + size=3182604288 + sum="ee69f3e9b86ff973f632db8e01700c5724ef78420b175d25bae6ead90f6805a7" + url="en_windows_7_enterprise_with_sp1_x64_dvd_u_677651_202006/en_windows_7_enterprise_with_sp1_x64_dvd_u_677651.iso" + ;; + "win7x64-ultimate" ) + size=3320903680 + sum="36f4fa2416d0982697ab106e3a72d2e120dbcdb6cc54fd3906d06120d0653808" + url="win7-ult-sp1-english/Win7_Ult_SP1_English_x64.iso" + ;; + "win7x86" | "win7x86-enterprise" | "win7x86-enterprise-eval" ) + size=2434502656 + sum="8bdd46ff8cb8b8de9c4aba02706629c8983c45e87da110e64e13be17c8434dad" + url="en_windows_7_enterprise_with_sp1_x86_dvd_u_677710_202006/en_windows_7_enterprise_with_sp1_x86_dvd_u_677710.iso" + ;; + "win7x86-ultimate" ) + size=2564476928 + sum="e2c009a66d63a742941f5087acae1aa438dcbe87010bddd53884b1af6b22c940" + url="win7-ult-sp1-english/Win7_Ult_SP1_English_x32.iso" + ;; "winxpx86" ) size=617756672 sum="62b6c91563bad6cd12a352aa018627c314cfc5162d8e9f8af0756a642e602a46" url="XPPRO_SP3_ENU/en_windows_xp_professional_with_service_pack_3_x86_cd_x14-80428.iso" ;; + "winxpx64" ) + size=614166528 + sum="8fac68e1e56c64ad9a2aa0ad464560282e67fa4f4dd51d09a66f4e548eb0f2d6" + url="windows-xp-all-sp-msdn-iso-files-en-de-ru-tr-x86-x64/en_win_xp_sp1_pro_x64_vl.iso" + ;; + "win2kx86" ) + size=386859008 + sum="e3816f6e80b66ff686ead03eeafffe9daf020a5e4717b8bd4736b7c51733ba22" + url="MicrosoftWindows2000BuildCollection/5.00.2195.6717_x86fre_client-professional_retail_en-us-ZRMPFPP_EN.iso" esac case "${ret,,}" in @@ -1110,66 +1178,12 @@ isESD() { return 1 } -isMG() { - - local id="$1" - local lang="$2" - - case "${id,,}" in - "win11${PLATFORM,,}" ) - return 0 - ;; - "win11${PLATFORM,,}-enterprise" | "win11${PLATFORM,,}-enterprise-eval" ) - return 0 - ;; - "win11${PLATFORM,,}-ltsc" | "win11${PLATFORM,,}-enterprise-ltsc-eval" ) - return 0 - ;; - "win11${PLATFORM,,}-iot" | "win11${PLATFORM,,}-enterprise-iot-eval" ) - return 0 - ;; - "win10${PLATFORM,,}" ) - return 0 - ;; - "win10${PLATFORM,,}-enterprise" | "win10${PLATFORM,,}-enterprise-eval" ) - return 0 - ;; - "win10${PLATFORM,,}-ltsc" | "win10${PLATFORM,,}-enterprise-ltsc-eval" ) - return 0 - ;; - "win10${PLATFORM,,}-iot" | "win10${PLATFORM,,}-enterprise-iot-eval" ) - return 0 - ;; - "win81${PLATFORM,,}-enterprise" | "win81${PLATFORM,,}-enterprise-eval" ) - return 0 - ;; - "win2025" | "win2025-eval" | "win2022" | "win2022-eval" | "win2019" | "win2019-eval" ) - return 0 - ;; - "win2016" | "win2016-eval" | "win2012r2" | "win2012r2-eval" | "win2008r2" | "win2008r2-eval" ) - return 0 - ;; - "win7x64" | "win7x64-enterprise" | "win7x64-ultimate" | "win7x86" | "win7x86-enterprise" | "win7x86-ultimate" ) - return 0 - ;; - "winvistax64" | "winvistax64-enterprise" | "winvistax64-ultimate" | "winvistax86" | "winvistax86-enterprise" | "winvistax86-ultimate" ) - return 0 - ;; - "winxpx86" | "winxpx64" ) - return 0 - ;; - esac - - return 1 -} - validVersion() { local id="$1" local lang="$2" local url - isMG "$id" "$lang" && return 0 isESD "$id" "$lang" && return 0 isMido "$id" "$lang" && return 0 @@ -1207,118 +1221,111 @@ addFolder() { return 0 } -migrateFiles() { - - local base="$1" - local version="$2" - local file="" - - [ -f "$base" ] && return 0 - - [[ "${version,,}" == "tiny10" ]] && file="tiny10_x64_23h2.iso" - [[ "${version,,}" == "tiny11" ]] && file="tiny11_2311_x64.iso" - [[ "${version,,}" == "core11" ]] && file="tiny11_core_x64_beta_1.iso" - [[ "${version,,}" == "winxpx86" ]] && file="en_windows_xp_professional_with_service_pack_3_x86_cd_x14-80428.iso" - [[ "${version,,}" == "winvistax64" ]] && file="en_windows_vista_sp2_x64_dvd_342267.iso" - [[ "${version,,}" == "win7x64" ]] && file="en_windows_7_enterprise_with_sp1_x64_dvd_u_677651.iso" - - [ ! -f "$STORAGE/$file" ] && return 0 - mv -f "$STORAGE/$file" "$base" || return 1 - - return 0 -} - prepareInstall() { local dir="$2" local desc="$3" - local arch="$4" - local key="$5" - local driver="$6" + local driver="$4" local drivers="/tmp/drivers" - rm -rf "$drivers" - mkdir -p "$drivers" - ETFS="[BOOT]/Boot-NoEmul.img" if [ ! -f "$dir/$ETFS" ] || [ ! -s "$dir/$ETFS" ]; then error "Failed to locate file \"$ETFS\" in $desc ISO image!" && return 1 fi - local msg="Adding drivers to image..." - info "$msg" && html "$msg" - - if ! bsdtar -xf /drivers.txz -C "$drivers"; then - error "Failed to extract drivers!" && return 1 - fi - - local target + local arch target + [ -d "$dir/AMD64" ] && arch="amd64" || arch="x86" [[ "${arch,,}" == "x86" ]] && target="$dir/I386" || target="$dir/AMD64" - if [ ! -f "$drivers/viostor/$driver/$arch/viostor.sys" ]; then - error "Failed to locate required storage drivers!" && return 1 + if [ ! -d "$target" ]; then + error "Failed to locate directory \"$target\" in $desc ISO image!" && return 1 fi - cp -L "$drivers/viostor/$driver/$arch/viostor.sys" "$target" || return 1 + if [[ "${driver,,}" == "xp" ]] || [[ "${driver,,}" == "2k3" ]]; then - mkdir -p "$dir/\$OEM\$/\$1/Drivers/viostor" || return 1 - cp -L "$drivers/viostor/$driver/$arch/viostor.cat" "$dir/\$OEM\$/\$1/Drivers/viostor" || return 1 - cp -L "$drivers/viostor/$driver/$arch/viostor.inf" "$dir/\$OEM\$/\$1/Drivers/viostor" || return 1 - cp -L "$drivers/viostor/$driver/$arch/viostor.sys" "$dir/\$OEM\$/\$1/Drivers/viostor" || return 1 + local msg="Adding drivers to image..." + info "$msg" && html "$msg" + + rm -rf "$drivers" + mkdir -p "$drivers" + + if ! bsdtar -xf /drivers.txz -C "$drivers"; then + error "Failed to extract drivers!" && return 1 + fi + + if [ ! -f "$drivers/viostor/$driver/$arch/viostor.sys" ]; then + error "Failed to locate required storage drivers!" && return 1 + fi + + cp -L "$drivers/viostor/$driver/$arch/viostor.sys" "$target" || return 1 + + mkdir -p "$dir/\$OEM\$/\$1/Drivers/viostor" || return 1 + cp -L "$drivers/viostor/$driver/$arch/viostor.cat" "$dir/\$OEM\$/\$1/Drivers/viostor" || return 1 + cp -L "$drivers/viostor/$driver/$arch/viostor.inf" "$dir/\$OEM\$/\$1/Drivers/viostor" || return 1 + cp -L "$drivers/viostor/$driver/$arch/viostor.sys" "$dir/\$OEM\$/\$1/Drivers/viostor" || return 1 + + if [ ! -f "$drivers/NetKVM/$driver/$arch/netkvm.sys" ]; then + error "Failed to locate required network drivers!" && return 1 + fi + + mkdir -p "$dir/\$OEM\$/\$1/Drivers/NetKVM" || return 1 + cp -L "$drivers/NetKVM/$driver/$arch/netkvm.cat" "$dir/\$OEM\$/\$1/Drivers/NetKVM" || return 1 + cp -L "$drivers/NetKVM/$driver/$arch/netkvm.inf" "$dir/\$OEM\$/\$1/Drivers/NetKVM" || return 1 + cp -L "$drivers/NetKVM/$driver/$arch/netkvm.sys" "$dir/\$OEM\$/\$1/Drivers/NetKVM" || return 1 + + if [ ! -f "$target/TXTSETUP.SIF" ]; then + error "The file TXTSETUP.SIF could not be found!" && return 1 + fi + + sed -i '/^\[SCSI.Load\]/s/$/\nviostor=viostor.sys,4/' "$target/TXTSETUP.SIF" + sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\nviostor.sys=1,,,,,,4_,4,1,,,1,4/' "$target/TXTSETUP.SIF" + sed -i '/^\[SCSI\]/s/$/\nviostor=\"Red Hat VirtIO SCSI Disk Device\"/' "$target/TXTSETUP.SIF" + sed -i '/^\[HardwareIdsDatabase\]/s/$/\nPCI\\VEN_1AF4\&DEV_1001\&SUBSYS_00000000=\"viostor\"/' "$target/TXTSETUP.SIF" + sed -i '/^\[HardwareIdsDatabase\]/s/$/\nPCI\\VEN_1AF4\&DEV_1001\&SUBSYS_00020000=\"viostor\"/' "$target/TXTSETUP.SIF" + sed -i '/^\[HardwareIdsDatabase\]/s/$/\nPCI\\VEN_1AF4\&DEV_1001\&SUBSYS_00021AF4=\"viostor\"/' "$target/TXTSETUP.SIF" + sed -i '/^\[HardwareIdsDatabase\]/s/$/\nPCI\\VEN_1AF4\&DEV_1001\&SUBSYS_00000000=\"viostor\"/' "$target/TXTSETUP.SIF" + + if [ ! -d "$drivers/sata/xp/$arch" ]; then + error "Failed to locate required SATA drivers!" && return 1 + fi + + mkdir -p "$dir/\$OEM\$/\$1/Drivers/sata" || return 1 + cp -Lr "$drivers/sata/xp/$arch/." "$dir/\$OEM\$/\$1/Drivers/sata" || return 1 + cp -Lr "$drivers/sata/xp/$arch/." "$target" || return 1 + + sed -i '/^\[SCSI.Load\]/s/$/\niaStor=iaStor.sys,4/' "$target/TXTSETUP.SIF" + sed -i '/^\[FileFlags\]/s/$/\niaStor.sys = 16/' "$target/TXTSETUP.SIF" + sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\niaStor.cat = 1,,,,,,,1,0,0/' "$target/TXTSETUP.SIF" + sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\niaStor.inf = 1,,,,,,,1,0,0/' "$target/TXTSETUP.SIF" + sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\niaStor.sys = 1,,,,,,4_,4,1,,,1,4/' "$target/TXTSETUP.SIF" + sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\niaStor.sys = 1,,,,,,,1,0,0/' "$target/TXTSETUP.SIF" + sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\niaahci.cat = 1,,,,,,,1,0,0/' "$target/TXTSETUP.SIF" + sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\niaAHCI.inf = 1,,,,,,,1,0,0/' "$target/TXTSETUP.SIF" + sed -i '/^\[SCSI\]/s/$/\niaStor=\"Intel\(R\) SATA RAID\/AHCI Controller\"/' "$target/TXTSETUP.SIF" + sed -i '/^\[HardwareIdsDatabase\]/s/$/\nPCI\\VEN_8086\&DEV_2922\&CC_0106=\"iaStor\"/' "$target/TXTSETUP.SIF" + + rm -rf "$drivers" - if [ ! -f "$drivers/NetKVM/$driver/$arch/netkvm.sys" ]; then - error "Failed to locate required network drivers!" && return 1 fi - mkdir -p "$dir/\$OEM\$/\$1/Drivers/NetKVM" || return 1 - cp -L "$drivers/NetKVM/$driver/$arch/netkvm.cat" "$dir/\$OEM\$/\$1/Drivers/NetKVM" || return 1 - cp -L "$drivers/NetKVM/$driver/$arch/netkvm.inf" "$dir/\$OEM\$/\$1/Drivers/NetKVM" || return 1 - cp -L "$drivers/NetKVM/$driver/$arch/netkvm.sys" "$dir/\$OEM\$/\$1/Drivers/NetKVM" || return 1 - - if [ ! -f "$target/TXTSETUP.SIF" ]; then - error "The file TXTSETUP.SIF could not be found!" && return 1 - fi - - sed -i '/^\[SCSI.Load\]/s/$/\nviostor=viostor.sys,4/' "$target/TXTSETUP.SIF" - sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\nviostor.sys=1,,,,,,4_,4,1,,,1,4/' "$target/TXTSETUP.SIF" - sed -i '/^\[SCSI\]/s/$/\nviostor=\"Red Hat VirtIO SCSI Disk Device\"/' "$target/TXTSETUP.SIF" - sed -i '/^\[HardwareIdsDatabase\]/s/$/\nPCI\\VEN_1AF4\&DEV_1001\&SUBSYS_00000000=\"viostor\"/' "$target/TXTSETUP.SIF" - sed -i '/^\[HardwareIdsDatabase\]/s/$/\nPCI\\VEN_1AF4\&DEV_1001\&SUBSYS_00020000=\"viostor\"/' "$target/TXTSETUP.SIF" - sed -i '/^\[HardwareIdsDatabase\]/s/$/\nPCI\\VEN_1AF4\&DEV_1001\&SUBSYS_00021AF4=\"viostor\"/' "$target/TXTSETUP.SIF" - sed -i '/^\[HardwareIdsDatabase\]/s/$/\nPCI\\VEN_1AF4\&DEV_1001\&SUBSYS_00000000=\"viostor\"/' "$target/TXTSETUP.SIF" - - if [ ! -d "$drivers/sata/xp/$arch" ]; then - error "Failed to locate required SATA drivers!" && return 1 - fi - - mkdir -p "$dir/\$OEM\$/\$1/Drivers/sata" || return 1 - cp -Lr "$drivers/sata/xp/$arch/." "$dir/\$OEM\$/\$1/Drivers/sata" || return 1 - cp -Lr "$drivers/sata/xp/$arch/." "$target" || return 1 - - sed -i '/^\[SCSI.Load\]/s/$/\niaStor=iaStor.sys,4/' "$target/TXTSETUP.SIF" - sed -i '/^\[FileFlags\]/s/$/\niaStor.sys = 16/' "$target/TXTSETUP.SIF" - sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\niaStor.cat = 1,,,,,,,1,0,0/' "$target/TXTSETUP.SIF" - sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\niaStor.inf = 1,,,,,,,1,0,0/' "$target/TXTSETUP.SIF" - sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\niaStor.sys = 1,,,,,,4_,4,1,,,1,4/' "$target/TXTSETUP.SIF" - sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\niaStor.sys = 1,,,,,,,1,0,0/' "$target/TXTSETUP.SIF" - sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\niaahci.cat = 1,,,,,,,1,0,0/' "$target/TXTSETUP.SIF" - sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\niaAHCI.inf = 1,,,,,,,1,0,0/' "$target/TXTSETUP.SIF" - sed -i '/^\[SCSI\]/s/$/\niaStor=\"Intel\(R\) SATA RAID\/AHCI Controller\"/' "$target/TXTSETUP.SIF" - sed -i '/^\[HardwareIdsDatabase\]/s/$/\nPCI\\VEN_8086\&DEV_2922\&CC_0106=\"iaStor\"/' "$target/TXTSETUP.SIF" - - rm -rf "$drivers" - local pid file setup setup=$(find "$target" -maxdepth 1 -type f -iname setupp.ini | head -n 1) - pid=$(<"$setup") - pid="${pid:(-4)}" - pid="${pid:0:3}" - if [[ "$pid" == "270" ]]; then - warn "this version of $desc requires a volume license key (VLK), it will ask for one during installation." + if [ -n "$setup" ]; then + + pid=$(<"$setup") + pid="${pid:(-4)}" + pid="${pid:0:3}" + + if [[ "$pid" == "270" ]]; then + warn "this version of $desc requires a volume license key (VLK), it will ask for one during installation." + fi + fi + mkdir -p "$dir/\$OEM\$" + if ! addFolder "$dir"; then error "Failed to add OEM folder to image!" && return 1 fi @@ -1333,11 +1340,48 @@ prepareInstall() { XHEX=$(printf '%x\n' "$WIDTH") YHEX=$(printf '%x\n' "$HEIGHT") - local username="Docker" - local password="*" + local username="" + local password="" - [ -n "$PASSWORD" ] && password="$PASSWORD" [ -n "$USERNAME" ] && username=$(echo "$USERNAME" | sed 's/[^[:alnum:]@!._-]//g') + [ -z "$username" ] && username="Docker" + + [ -n "$PASSWORD" ] && password=$(echo "$PASSWORD" | sed 's/"//g') + [ -z "$password" ] && password="admin" + + local ip="20.20.20.1" + [ -n "${VM_NET_IP:-}" ] && ip="${VM_NET_IP%.*}.1" + + # These are not pirated keys, they come from the official MS documentation. + case "${driver,,}" in + "xp" ) + + if [[ "${arch,,}" == "x86" ]]; then + # Windows XP Professional x86 generic key (no activation, trial-only) + [ -z "$KEY" ] && KEY="DR8GV-C8V6J-BYXHG-7PYJR-DB66Y" + else + # Windows XP Professional x64 generic key (no activation, trial-only) + [ -z "$KEY" ] && KEY="B2RBK-7KPT9-4JP6X-QQFWM-PJD6G" + fi ;; + + "2k3" ) + + if [[ "${arch,,}" == "x86" ]]; then + # Windows Server 2003 Standard x86 generic key (no activation, trial-only) + [ -z "$KEY" ] && KEY="QKDCQ-TP2JM-G4MDG-VR6F2-P9C48" + else + # Windows Server 2003 Standard x64 generic key (no activation, trial-only) + [ -z "$KEY" ] && KEY="P4WJG-WK3W7-3HM8W-RWHCK-8JTRY" + fi ;; + + "2k" ) + + # Windows 2000 Professional x86 generic key + KEY="G74HG-XXQTJ-RTX64-QKP3F-HKHXP" ;; + + * ) error "Unknown version: \"$driver\"" && return 1 ;; + + esac find "$target" -maxdepth 1 -type f -iname winnt.sif -exec rm {} \; @@ -1376,7 +1420,7 @@ prepareInstall() { echo " FullName=\"$username\"" echo " ComputerName=\"*\"" echo " OrgName=\"Windows for Docker\"" - echo " ProductKey=$key" + echo " ProductID=$KEY" echo "" echo "[Identification]" echo " JoinWorkgroup = WORKGROUP" @@ -1435,12 +1479,14 @@ prepareInstall() { echo "[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]" echo "\"HideFileExt\"=dword:00000000" echo "" + echo "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer]" + echo "\"NoWelcomeScreen\"=\"1\"" + echo "" echo "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]" - echo "\"DefaultUserName\"=\"$username\"" - echo "\"DefaultDomainName\"=\"Dockur\"" - echo "\"AltDefaultUserName\"=\"$username\"" - echo "\"AltDefaultDomainName\"=\"Dockur\"" echo "\"AutoAdminLogon\"=\"1\"" + echo "\"DefaultUserName\"=\"$username\"" + echo "\"DefaultPassword\"=\"$password\"" + echo "\"DefaultDomainName\"=\"Dockur\"" echo "" echo "[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Video\{23A77BF7-ED96-40EC-AF06-9B1F4867732A}\0000]" echo "\"DefaultSettings.BitsPerPel\"=dword:00000020" @@ -1511,6 +1557,14 @@ prepareInstall() { echo "" echo "Call Domain.MoveHere(LocalAdminADsPath, \"$username\")" echo "" + echo "With (CreateObject(\"Scripting.FileSystemObject\"))" + echo " SysRoot = WshShell.ExpandEnvironmentStrings(\"%SystemRoot%\")" + echo " Set oFile = .OpenTextFile(SysRoot & \"\system32\drivers\etc\hosts\", 8, true)" + echo " oFile.Write(\"$ip host.lan\")" + echo " oFile.Close()" + echo " Set oFile = Nothing" + echo "End With" + echo "" } | unix2dos > "$dir/\$OEM\$/admin.vbs" { echo "[COMMANDS]" @@ -1522,56 +1576,6 @@ prepareInstall() { return 0 } -prepare2k3() { - - local iso="$1" - local dir="$2" - local desc="$3" - local driver="2k3" - local arch key - - [ -d "$dir/AMD64" ] && arch="amd64" || arch="x86" - - if [[ "${arch,,}" == "x86" ]]; then - # Windows Server 2003 Standard x86 generic key (no activation, trial-only) - # This is not a pirated key, it comes from the official MS documentation. - key="QKDCQ-TP2JM-G4MDG-VR6F2-P9C48" - else - # Windows Server 2003 Standard x64 generic key (no activation, trial-only) - # This is not a pirated key, it comes from the official MS documentation. - key="P4WJG-WK3W7-3HM8W-RWHCK-8JTRY" - fi - - prepareInstall "$iso" "$dir" "$desc" "$arch" "$key" "$driver" || return 1 - - return 0 -} - -prepareXP() { - - local iso="$1" - local dir="$2" - local desc="$3" - local driver="xp" - local arch key - - [ -d "$dir/AMD64" ] && arch="amd64" || arch="x86" - - if [[ "${arch,,}" == "x86" ]]; then - # Windows XP Professional x86 generic key (no activation, trial-only) - # This is not a pirated key, it comes from the official MS documentation. - key="DR8GV-C8V6J-BYXHG-7PYJR-DB66Y" - else - # Windows XP Professional x64 generic key (no activation, trial-only) - # This is not a pirated key, it comes from the official MS documentation. - key="B2RBK-7KPT9-4JP6X-QQFWM-PJD6G" - fi - - prepareInstall "$iso" "$dir" "$desc" "$arch" "$key" "$driver" || return 1 - - return 0 -} - prepareLegacy() { local iso="$1" @@ -1656,22 +1660,34 @@ setMachine() { "win9"* ) ETFS="[BOOT]/Boot-1.44M.img" ;; "win2k"* ) - ETFS="[BOOT]/Boot-NoEmul.img" ;; + if ! prepareInstall "$iso" "$dir" "$desc" "2k"; then + error "Failed to prepare $desc ISO!" && return 1 + fi ;; "winxp"* ) - if ! prepareXP "$iso" "$dir" "$desc"; then + if ! prepareInstall "$iso" "$dir" "$desc" "xp"; then error "Failed to prepare $desc ISO!" && return 1 fi ;; "win2003"* ) - if ! prepare2k3 "$iso" "$dir" "$desc"; then + if ! prepareInstall "$iso" "$dir" "$desc" "2k3"; then error "Failed to prepare $desc ISO!" && return 1 fi ;; esac case "${id,,}" in - "win9"* | "win2k"* ) + "win9"* ) + USB="no" + VGA="cirrus" DISK_TYPE="auto" + ADAPTER="rtl8139" MACHINE="pc-i440fx-2.4" BOOT_MODE="windows_legacy" ;; + "win2k"* ) + VGA="cirrus" + MACHINE="pc" + USB="pci-ohci" + DISK_TYPE="auto" + ADAPTER="rtl8139" + BOOT_MODE="windows_legacy" ;; "winxp"* | "win2003"* ) DISK_TYPE="blk" BOOT_MODE="windows_legacy" ;; diff --git a/src/entry.sh b/src/entry.sh index 4de2f59..88b102c 100755 --- a/src/entry.sh +++ b/src/entry.sh @@ -1,16 +1,17 @@ #!/usr/bin/env bash set -Eeuox pipefail +: "${APP:="Windows"}" +: "${PLATFORM:="x64"}" : "${BOOT_MODE:="windows"}" - -APP="Windows" -SUPPORT="https://github.com/dockur/windows" +: "${SUPPORT:="https://github.com/dockur/windows"}" cd /run +. utils.sh # Load functions . reset.sh # Initialize system . define.sh # Define versions -. mido.sh # Download code +. mido.sh # Download Windows . install.sh # Run installation . disk.sh # Initialize disks . display.sh # Initialize graphics @@ -56,7 +57,10 @@ terminal bg_pid=$! tail -fn +0 "$QEMU_LOG" 2>/dev/null & -cat "$QEMU_TERM" 2>/dev/null | tee "$QEMU_PTY" & +cat "$QEMU_TERM" 2>/dev/null | tee "$QEMU_PTY" | + sed -u -e 's/\x1B\[[=0-9;]*[a-z]//gi' \ + -e 's/failed to load Boot/skipped Boot/g' \ + -e 's/0): Not Found/0)/g' & term_pd=$! wait $bg_pid diff --git a/src/install.sh b/src/install.sh index f392c0e..a37124b 100644 --- a/src/install.sh +++ b/src/install.sh @@ -10,21 +10,31 @@ EFISYS="efi/microsoft/boot/efisys_noprompt.bin" skipInstall() { local iso="$1" + local method="" local magic byte local boot="$STORAGE/windows.boot" local previous="$STORAGE/windows.base" if [ -f "$previous" ]; then previous=$(<"$previous") + previous="${previous//[![:print:]]/}" if [ -n "$previous" ]; then - previous="$STORAGE/$previous" - if [[ "${previous,,}" != "${iso,,}" ]]; then + if [[ "${STORAGE,,}/${previous,,}" != "${iso,,}" ]]; then if [ -f "$boot" ] && hasDisk; then - info "Detected that the version was changed, but ignoring this because Windows is already installed." - info "Please start with an empty /storage folder, if you want to install a different version of Windows." + if [[ "${iso,,}" == "${STORAGE,,}/windows."* ]]; then + method="your custom .iso file" + else + if [[ "${previous,,}" != "windows."* ]]; then + method="the VERSION variable" + fi + fi + if [ -n "$method" ]; then + info "Detected that $method was changed, but ignoring this because Windows is already installed." + info "Please start with an empty /storage folder, if you want to install a different version of Windows." + fi return 0 fi - [ -f "$previous" ] && rm -f "$previous" + rm -f "$STORAGE/$previous" return 1 fi fi @@ -76,8 +86,6 @@ startInstall() { BOOT="$STORAGE/$file" - ! migrateFiles "$BOOT" "$VERSION" && error "Migration failed!" && exit 57 - fi skipInstall "$BOOT" && return 1 @@ -120,6 +128,8 @@ finishInstall() { rm -f "$STORAGE/windows.old" rm -f "$STORAGE/windows.vga" + rm -f "$STORAGE/windows.net" + rm -f "$STORAGE/windows.usb" rm -f "$STORAGE/windows.args" rm -f "$STORAGE/windows.base" rm -f "$STORAGE/windows.boot" @@ -162,10 +172,22 @@ finishInstall() { echo "$ARGS" > "$STORAGE/windows.args" fi + if [ -n "${VGA:-}" ] && [[ "${VGA:-}" != "virtio"* ]]; then + echo "$VGA" > "$STORAGE/windows.vga" + fi + + if [ -n "${USB:-}" ] && [[ "${USB:-}" != "qemu-xhci"* ]]; then + echo "$USB" > "$STORAGE/windows.usb" + fi + if [ -n "${DISK_TYPE:-}" ] && [[ "${DISK_TYPE:-}" != "scsi" ]]; then echo "$DISK_TYPE" > "$STORAGE/windows.type" fi + if [ -n "${ADAPTER:-}" ] && [[ "${ADAPTER:-}" != "virtio-net-pci" ]]; then + echo "$ADAPTER" > "$STORAGE/windows.net" + fi + rm -rf "$TMP" return 0 } @@ -177,6 +199,7 @@ abortInstall() { local efi [[ "${iso,,}" == *".esd" ]] && exit 60 + [[ "${UNPACK:-}" == [Yy1]* ]] && exit 60 efi=$(find "$dir" -maxdepth 1 -type d -iname efi | head -n 1) @@ -201,11 +224,23 @@ abortInstall() { detectCustom() { - local file base + local dir file base + local fname="custom.iso" + local boot="$STORAGE/windows.boot" + CUSTOM="" - file=$(find / -maxdepth 1 -type f -iname custom.iso | head -n 1) - [ ! -s "$file" ] && file=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.iso | head -n 1) + dir=$(find / -maxdepth 1 -type d -iname "$fname" | head -n 1) + [ ! -d "$dir" ] && dir=$(find "$STORAGE" -maxdepth 1 -type d -iname "$fname" | head -n 1) + + if [ -d "$dir" ]; then + if ! hasDisk || [ ! -f "$boot" ]; then + error "The bind $dir maps to a file that does not exist!" && return 1 + fi + fi + + file=$(find / -maxdepth 1 -type f -iname "$fname" | head -n 1) + [ ! -s "$file" ] && file=$(find "$STORAGE" -maxdepth 1 -type f -iname "$fname" | head -n 1) if [ ! -s "$file" ] && [[ "${VERSION,,}" != "http"* ]]; then base=$(basename "$VERSION") @@ -246,12 +281,12 @@ extractESD() { mkdir -p "$dir" size=16106127360 - size_gb=$(( (size + 1073741823)/1073741824 )) + size_gb=$(formatBytes "$size") space=$(df --output=avail -B 1 "$dir" | tail -n 1) - space_gb=$(( (space + 1073741823)/1073741824 )) + space_gb=$(formatBytes "$space") if (( size > space )); then - error "Not enough free space in $STORAGE, have $space_gb GB available but need at least $size_gb GB." && return 1 + error "Not enough free space in $STORAGE, have $space_gb available but need at least $size_gb." && return 1 fi local esdImageCount @@ -316,7 +351,7 @@ extractImage() { local dir="$2" local version="$3" local desc="local ISO" - local size size_gb space space_gb + local file size size_gb space space_gb if [ -z "$CUSTOM" ]; then desc="downloaded ISO" @@ -337,16 +372,16 @@ extractImage() { mkdir -p "$dir" size=$(stat -c%s "$iso") - size_gb=$(( (size + 1073741823)/1073741824 )) + size_gb=$(formatBytes "$size") space=$(df --output=avail -B 1 "$dir" | tail -n 1) - space_gb=$(( (space + 1073741823)/1073741824 )) + space_gb=$(formatBytes "$space") if ((size<100000000)); then error "Invalid ISO file: Size is smaller than 100 MB" && return 1 fi if (( size > space )); then - error "Not enough free space in $STORAGE, have $space_gb GB available but need at least $size_gb GB." && return 1 + error "Not enough free space in $STORAGE, have $space_gb available but need at least $size_gb." && return 1 fi rm -rf "$dir" @@ -355,7 +390,26 @@ extractImage() { error "Failed to extract ISO file: $iso" && return 1 fi - LABEL=$(isoinfo -d -i "$iso" | sed -n 's/Volume id: //p') + if [[ "${UNPACK:-}" != [Yy1]* ]]; then + + LABEL=$(isoinfo -d -i "$iso" | sed -n 's/Volume id: //p') + + else + + file=$(find "$dir" -maxdepth 1 -type f -iname "*.iso" | head -n 1) + + if [ -z "$file" ]; then + error "Failed to find any .iso file in archive!" && return 1 + fi + + if ! 7z x "$file" -o"$dir" > /dev/null; then + error "Failed to extract archive!" && return 1 + fi + + LABEL=$(isoinfo -d -i "$file" | sed -n 's/Volume id: //p') + rm -f "$file" + + fi return 0 } @@ -489,6 +543,10 @@ setXML() { local file="/custom.xml" + if [ -d "$file" ]; then + error "The bind $file maps to a file that does not exist!" && exit 67 + fi + [ ! -f "$file" ] || [ ! -s "$file" ] && file="$STORAGE/custom.xml" [ ! -f "$file" ] || [ ! -s "$file" ] && file="/run/assets/custom.xml" [ ! -f "$file" ] || [ ! -s "$file" ] && file="$1" @@ -573,6 +631,10 @@ detectImage() { info "Detected: $desc" setXML "" && return 0 + if [[ "$DETECTED" == "win81x86"* ]] || [[ "$DETECTED" == "win10x86"* ]]; then + error "The 32-bit version of $desc is not supported!" && return 1 + fi + msg="the answer file for $desc was not found ($DETECTED.xml)" local fallback="/run/assets/${DETECTED%%-*}.xml" @@ -620,6 +682,10 @@ updateXML() { local language="$2" local culture region user admin pass keyboard + if [ -n "${VM_NET_IP:-}" ]; then + sed -i "s/ 20.20.20.1 / ${VM_NET_IP%.*}.1 /g" "$asset" + fi + [ -z "$HEIGHT" ] && HEIGHT="720" [ -z "$WIDTH" ] && WIDTH="1280" @@ -657,15 +723,26 @@ updateXML() { sed -i "s/<Username>Docker<\/Username>/<Username>$user<\/Username>/g" "$asset" fi - if [ -n "$PASSWORD" ]; then - pass=$(printf '%s' "${PASSWORD}Password" | iconv -f utf-8 -t utf-16le | base64 -w 0) - admin=$(printf '%s' "${PASSWORD}AdministratorPassword" | iconv -f utf-8 -t utf-16le | base64 -w 0) - sed -i "s/<Value>password<\/Value>/<Value>$admin<\/Value>/g" "$asset" - sed -i "s/<PlainText>true<\/PlainText>/<PlainText>false<\/PlainText>/g" "$asset" - sed -z "s/<Password>...........<Value \/>/<Password>\n <Value>$pass<\/Value>/g" -i "$asset" - sed -z "s/<Password>...............<Value \/>/<Password>\n <Value>$pass<\/Value>/g" -i "$asset" - sed -z "s/<AdministratorPassword>...........<Value \/>/<AdministratorPassword>\n <Value>$admin<\/Value>/g" -i "$asset" - sed -z "s/<AdministratorPassword>...............<Value \/>/<AdministratorPassword>\n <Value>$admin<\/Value>/g" -i "$asset" + [ -n "$PASSWORD" ] && pass="$PASSWORD" || pass="admin" + + pw=$(printf '%s' "${pass}Password" | iconv -f utf-8 -t utf-16le | base64 -w 0) + admin=$(printf '%s' "${pass}AdministratorPassword" | iconv -f utf-8 -t utf-16le | base64 -w 0) + + sed -i "s/<Value>password<\/Value>/<Value>$admin<\/Value>/g" "$asset" + sed -i "s/<PlainText>true<\/PlainText>/<PlainText>false<\/PlainText>/g" "$asset" + sed -z "s/<Password>...........<Value \/>/<Password>\n <Value>$pw<\/Value>/g" -i "$asset" + sed -z "s/<Password>...............<Value \/>/<Password>\n <Value>$pw<\/Value>/g" -i "$asset" + sed -z "s/<AdministratorPassword>...........<Value \/>/<AdministratorPassword>\n <Value>$admin<\/Value>/g" -i "$asset" + sed -z "s/<AdministratorPassword>...............<Value \/>/<AdministratorPassword>\n <Value>$admin<\/Value>/g" -i "$asset" + + if [ -n "$EDITION" ]; then + [[ "${EDITION^^}" == "CORE" ]] && EDITION="STANDARDCORE" + sed -i "s/SERVERSTANDARD<\/Value>/SERVER${EDITION^^}<\/Value>/g" "$asset" + fi + + if [ -n "$KEY" ]; then + sed -i '/<ProductKey>/,/<\/ProductKey>/d' "$asset" + sed -i "s/<\/UserData>/ <ProductKey>\n <Key>${KEY}<\/Key>\n <WillShowUI>OnError<\/WillShowUI>\n <\/ProductKey>\n <\/UserData>/g" "$asset" fi return 0 @@ -677,8 +754,13 @@ addDriver() { local path="$2" local target="$3" local driver="$4" + local desc="" local folder="" + if [ -z "$id" ]; then + warn "no Windows version specified for \"$driver\" driver!" && return 0 + fi + case "${id,,}" in "win7x86"* ) folder="w7/x86" ;; "win7x64"* ) folder="w7/amd64" ;; @@ -698,7 +780,12 @@ addDriver() { esac if [ -z "$folder" ]; then - warn "no \"$driver\" driver found for \"$DETECTED\" !" && return 0 + desc=$(printVersion "$id" "$id") + if [[ "${id,,}" != *"x86"* ]]; then + warn "no \"$driver\" driver available for \"$desc\" !" && return 0 + else + warn "no \"$driver\" driver available for the 32-bit version of \"$desc\" !" && return 0 + fi fi [ ! -d "$path/$driver/$folder" ] && return 0 @@ -731,6 +818,11 @@ addDrivers() { local msg="Adding drivers to image..." info "$msg" && html "$msg" + if [ -z "$version" ]; then + version="win11x64" + warn "Windows version unknown, falling back to Windows 11 drivers..." + fi + if ! bsdtar -xf /drivers.txz -C "$drivers"; then error "Failed to extract drivers from archive!" && return 1 fi @@ -924,12 +1016,12 @@ buildImage() { fi size=$(du -h -b --max-depth=0 "$dir" | cut -f1) - size_gb=$(( (size + 1073741823)/1073741824 )) + size_gb=$(formatBytes "$size") space=$(df --output=avail -B 1 "$TMP" | tail -n 1) - space_gb=$(( (space + 1073741823)/1073741824 )) + space_gb=$(formatBytes "$space") if (( size > space )); then - error "Not enough free space in $STORAGE, have $space_gb GB available but need at least $size_gb GB." && return 1 + error "Not enough free space in $STORAGE, have $space_gb available but need at least $size_gb." && return 1 fi if [[ "${BOOT_MODE,,}" != "windows_legacy" ]]; then @@ -973,52 +1065,47 @@ bootWindows() { if [ -f "$STORAGE/windows.args" ]; then ARGS=$(<"$STORAGE/windows.args") + ARGS="${ARGS//[![:print:]]/}" ARGUMENTS="$ARGS ${ARGUMENTS:-}" fi + if [ -s "$STORAGE/windows.vga" ] && [ -f "$STORAGE/windows.vga" ]; then + if [ -z "${VGA:-}" ]; then + VGA=$(<"$STORAGE/windows.vga") + VGA="${VGA//[![:print:]]/}" + fi + fi + + if [ -s "$STORAGE/windows.usb" ] && [ -f "$STORAGE/windows.usb" ]; then + if [ -z "${USB:-}" ]; then + USB=$(<"$STORAGE/windows.usb") + USB="${USB//[![:print:]]/}" + fi + fi + + if [ -s "$STORAGE/windows.net" ] && [ -f "$STORAGE/windows.net" ]; then + if [ -z "${ADAPTER:-}" ]; then + ADAPTER=$(<"$STORAGE/windows.net") + ADAPTER="${ADAPTER//[![:print:]]/}" + fi + fi + if [ -s "$STORAGE/windows.type" ] && [ -f "$STORAGE/windows.type" ]; then - [ -z "${DISK_TYPE:-}" ] && DISK_TYPE=$(<"$STORAGE/windows.type") + if [ -z "${DISK_TYPE:-}" ]; then + DISK_TYPE=$(<"$STORAGE/windows.type") + DISK_TYPE="${DISK_TYPE//[![:print:]]/}" + fi fi if [ -s "$STORAGE/windows.mode" ] && [ -f "$STORAGE/windows.mode" ]; then BOOT_MODE=$(<"$STORAGE/windows.mode") - if [ -s "$STORAGE/windows.old" ] && [ -f "$STORAGE/windows.old" ]; then - [[ "${PLATFORM,,}" == "x64" ]] && MACHINE=$(<"$STORAGE/windows.old") - fi - return 0 + BOOT_MODE="${BOOT_MODE//[![:print:]]/}" fi - # Migrations - - [[ "${PLATFORM,,}" != "x64" ]] && return 0 - - if [ -f "$STORAGE/windows.old" ]; then - MACHINE=$(<"$STORAGE/windows.old") - [ -z "$MACHINE" ] && MACHINE="q35" - BOOT_MODE="windows_legacy" - echo "$BOOT_MODE" > "$STORAGE/windows.mode" - return 0 - fi - - local creation="1.10" - local minimal="2.14" - - if [ -f "$STORAGE/windows.ver" ]; then - creation=$(<"$STORAGE/windows.ver") - [[ "${creation}" != *"."* ]] && creation="$minimal" - fi - - # Force secure boot on installs created prior to v2.14 - if (( $(echo "$creation < $minimal" | bc -l) )); then - if [[ "${BOOT_MODE,,}" == "windows" ]]; then - BOOT_MODE="windows_secure" - echo "$BOOT_MODE" > "$STORAGE/windows.mode" - if [ -f "$STORAGE/windows.rom" ] && [ ! -f "$STORAGE/$BOOT_MODE.rom" ]; then - mv -f "$STORAGE/windows.rom" "$STORAGE/$BOOT_MODE.rom" - fi - if [ -f "$STORAGE/windows.vars" ] && [ ! -f "$STORAGE/$BOOT_MODE.vars" ]; then - mv -f "$STORAGE/windows.vars" "$STORAGE/$BOOT_MODE.vars" - fi + if [ -s "$STORAGE/windows.old" ] && [ -f "$STORAGE/windows.old" ]; then + if [[ "${PLATFORM,,}" == "x64" ]]; then + MACHINE=$(<"$STORAGE/windows.old") + MACHINE="${MACHINE//[![:print:]]/}" fi fi diff --git a/src/mido.sh b/src/mido.sh index cd4171f..5258d1b 100644 --- a/src/mido.sh +++ b/src/mido.sh @@ -93,6 +93,7 @@ download_windows() { # uuidgen: For MacOS (installed by default) and other systems (e.g. with no /proc) that don't have a kernel interface for generating random UUIDs session_id=$(cat /proc/sys/kernel/random/uuid 2> /dev/null || uuidgen --random) + session_id="${session_id//[![:print:]]/}" # Get product edition ID for latest release of given Windows version # Product edition ID: This specifies both the Windows release (e.g. 22H2) and edition ("multi-edition" is default, either Home/Pro/Edu/etc., we select "Pro" in the answer files) in one number @@ -208,6 +209,9 @@ download_windows_eval() { "win2022-eval" ) enterprise_type="server" windows_version="windows-server-2022" ;; + "win2019-hv" ) + enterprise_type="server" + windows_version="hyper-v-server-2019" ;; "win2019-eval" ) enterprise_type="server" windows_version="windows-server-2019" ;; @@ -242,10 +246,10 @@ download_windows_eval() { [[ "$DEBUG" == [Yy1]* ]] && echo "Getting download link.." - if [[ "$enterprise_type" == "iot" ]]; then - filter="https://go.microsoft.com/fwlink/?linkid=[0-9]\+&clcid=0x[0-9a-z]\+&culture=${culture,,}&country=${country^^}" - else - filter="https://go.microsoft.com/fwlink/p/?LinkID=[0-9]\+&clcid=0x[0-9a-z]\+&culture=${culture,,}&country=${country^^}" + filter="https://go.microsoft.com/fwlink/?linkid=[0-9]\+&clcid=0x[0-9a-z]\+&culture=${culture,,}&country=${country,,}" + + if ! echo "$iso_download_page_html" | grep -io "$filter" > /dev/null; then + filter="https://go.microsoft.com/fwlink/p/?linkid=[0-9]\+&clcid=0x[0-9a-z]\+&culture=${culture,,}&country=${country,,}" fi iso_download_links=$(echo "$iso_download_page_html" | grep -io "$filter") || { @@ -310,7 +314,7 @@ getWindows() { info "$msg" && html "$msg" case "${version,,}" in - "win2008r2" | "win81${PLATFORM,,}-enterprise"* | "win11${PLATFORM,,}-enterprise-iot"* | "win11${PLATFORM,,}-enterprise-ltsc"* ) + "win2008r2" | "win81${PLATFORM,,}"* | "win11${PLATFORM,,}-enterprise-iot"* | "win11${PLATFORM,,}-enterprise-ltsc"* ) if [[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-"* ]]; then error "No download in the $language language available for $edition!" MIDO_URL="" && return 1 @@ -335,7 +339,7 @@ getWindows() { "win11${PLATFORM,,}-enterprise"* | "win10${PLATFORM,,}-enterprise"* ) download_windows_eval "$version" "$lang" "$edition" && return 0 ;; - "win2025-eval" | "win2022-eval" | "win2019-eval" | "win2016-eval" | "win2012r2-eval" ) + "win2025-eval" | "win2022-eval" | "win2019-eval" | "win2019-hv" | "win2016-eval" | "win2012r2-eval" ) download_windows_eval "$version" "$lang" "$edition" && return 0 ;; "win81${PLATFORM,,}-enterprise"* | "win2008r2" ) @@ -343,53 +347,10 @@ getWindows() { * ) error "Invalid VERSION specified, value \"$version\" is not recognized!" ;; esac - if [[ "${PLATFORM,,}" != "x64" ]]; then - MIDO_URL="" - return 1 - fi + MIDO_URL=$(getMido "$version" "$lang" "") + [ -z "$MIDO_URL" ] && return 1 - if [[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-"* ]]; then - MIDO_URL="" - return 1 - fi - - case "${version,,}" in - "win81${PLATFORM,,}-enterprise"* ) - MIDO_URL="https://download.microsoft.com/download/B/9/9/B999286E-0A47-406D-8B3D-5B5AD7373A4A/9600.17050.WINBLUE_REFRESH.140317-1640_X64FRE_ENTERPRISE_EVAL_EN-US-IR3_CENA_X64FREE_EN-US_DV9.ISO" - return 0 - ;; - "win11${PLATFORM,,}-enterprise-iot"* | "win11${PLATFORM,,}-enterprise-ltsc"* ) - MIDO_URL="https://software-static.download.prss.microsoft.com/dbazure/888969d5-f34g-4e03-ac9d-1f9786c66749/26100.1.240331-1435.ge_release_CLIENT_IOT_LTSC_EVAL_x64FRE_en-us.iso" - return 0 - ;; - "win2025-eval" ) - MIDO_URL="https://software-static.download.prss.microsoft.com/dbazure/888969d5-f34g-4e03-ac9d-1f9786c66749/26100.1.240331-1435.ge_release_SERVER_EVAL_x64FRE_en-us.iso" - return 0 - ;; - "win2022-eval" ) - MIDO_URL="https://software-static.download.prss.microsoft.com/sg/download/888969d5-f34g-4e03-ac9d-1f9786c66749/SERVER_EVAL_x64FRE_en-us.iso" - return 0 - ;; - "win2019-eval" ) - MIDO_URL="https://software-download.microsoft.com/download/pr/17763.737.190906-2324.rs5_release_svc_refresh_SERVER_EVAL_x64FRE_en-us_1.iso" - return 0 - ;; - "win2016-eval" ) - MIDO_URL="https://software-download.microsoft.com/download/pr/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO" - return 0 - ;; - "win2012r2-eval" ) - MIDO_URL="https://download.microsoft.com/download/6/2/A/62A76ABB-9990-4EFC-A4FE-C7D698DAEB96/9600.17050.WINBLUE_REFRESH.140317-1640_X64FRE_SERVER_EVAL_EN-US-IR3_SSS_X64FREE_EN-US_DV9.ISO" - return 0 - ;; - "win2008r2" ) - MIDO_URL="https://download.microsoft.com/download/4/1/D/41DEA7E0-B30D-4012-A1E3-F24DC03BA1BB/7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso" - return 0 - ;; - esac - - MIDO_URL="" - return 1 + return 0 } getCatalog() { @@ -429,243 +390,6 @@ getCatalog() { return 0 } -getMG() { - - local version="$1" - local lang="$2" - local desc="$3" - - local locale="" - local culture="" - local language="" - local user_agent="" - - user_agent=$(get_agent) - language=$(getLanguage "$lang" "desc") - culture=$(getLanguage "$lang" "culture") - - local msg="Requesting download link from massgrave.dev..." - info "$msg" && html "$msg" - - local pattern="" - local locale="${culture,,}" - local platform="${PLATFORM,,}" - local url="https://massgrave.dev/" - - if [[ "${PLATFORM,,}" != "arm64" ]]; then - - case "${version,,}" in - "win11${PLATFORM,,}" ) - url+="windows_11_links" - pattern="consumer" - ;; - "win11${PLATFORM,,}-enterprise" | "win11${PLATFORM,,}-enterprise-eval" ) - url+="windows_11_links" - pattern="business" - ;; - "win11${PLATFORM,,}-ltsc" | "win11${PLATFORM,,}-enterprise-ltsc-eval" ) - url+="windows_ltsc_links" - pattern="11_enterprise_ltsc" - ;; - "win11${PLATFORM,,}-iot" | "win11${PLATFORM,,}-enterprise-iot-eval" ) - url+="windows_ltsc_links" - pattern="11_iot" - ;; - "win10${PLATFORM,,}" ) - url+="windows_10_links" - pattern="consumer" - ;; - "win10${PLATFORM,,}-enterprise" | "win10${PLATFORM,,}-enterprise-eval" ) - url+="windows_10_links" - pattern="business" - ;; - "win10${PLATFORM,,}-ltsc" | "win10${PLATFORM,,}-enterprise-ltsc-eval" ) - url+="windows_ltsc_links" - pattern="10_enterprise_ltsc" - ;; - "win10${PLATFORM,,}-iot" | "win10${PLATFORM,,}-enterprise-iot-eval" ) - url+="windows_ltsc_links" - pattern="10_iot" - ;; - "win81${PLATFORM,,}-enterprise" | "win81${PLATFORM,,}-enterprise-eval" ) - url+="windows_8.1_links" - pattern="8.1_enterprise" - locale=$(getLanguage "$lang" "code") - [[ "$locale" == "sr" ]] && locale="sr-latn" - ;; - "win2025" | "win2025-eval" ) - url+="windows_server_links" - pattern="server_2025" - ;; - "win2022" | "win2022-eval" ) - url+="windows_server_links" - pattern="server_2022" - ;; - "win2019" | "win2019-eval" ) - url+="windows_server_links" - pattern="server_2019" - ;; - "win2016" | "win2016-eval" ) - url+="windows_server_links" - pattern="server_2016" - locale=$(getLanguage "$lang" "code") - [[ "$locale" == "hk" ]] && locale="ct" - [[ "$locale" == "tw" ]] && locale="ct" - ;; - "win2012r2" | "win2012r2-eval" ) - url+="windows_server_links" - pattern="server_2012_r2" - locale=$(getLanguage "$lang" "code") - ;; - "win2008r2" | "win2008r2-eval" ) - url+="windows_server_links" - pattern="server_2008_r2" - locale=$(getLanguage "$lang" "code") - ;; - "win7x64" | "win7x64-enterprise" ) - url+="windows_7_links" - pattern="enterprise" - locale=$(getLanguage "$lang" "code") - ;; - "win7x64-ultimate" ) - url+="windows_7_links" - pattern="ultimate" - locale=$(getLanguage "$lang" "code") - ;; - "win7x86" | "win7x86-enterprise" ) - platform="x86" - url+="windows_7_links" - pattern="enterprise" - locale=$(getLanguage "$lang" "code") - ;; - "win7x86-ultimate" ) - platform="x86" - url+="windows_7_links" - pattern="ultimate" - locale=$(getLanguage "$lang" "code") - ;; - "winvistax64" | "winvistax64-enterprise" ) - url+="windows_vista_links" - pattern="enterprise" - locale=$(getLanguage "$lang" "code") - ;; - "winvistax64-ultimate" ) - url+="windows_vista_links" - pattern="sp2" - locale=$(getLanguage "$lang" "code") - ;; - "winvistax86" | "winvistax86-enterprise" ) - platform="x86" - url+="windows_vista_links" - pattern="enterprise" - locale=$(getLanguage "$lang" "code") - ;; - "winvistax86-ultimate" ) - platform="x86" - url+="windows_vista_links" - pattern="sp2" - locale=$(getLanguage "$lang" "code") - ;; - "winxpx86" ) - platform="x86" - url+="windows_xp_links" - pattern="xp" - locale=$(getLanguage "$lang" "code") - [[ "$locale" == "pt" ]] && locale="pt-br" - [[ "$locale" == "pp" ]] && locale="pt-pt" - [[ "$locale" == "cn" ]] && locale="zh-hans" - [[ "$locale" == "hk" ]] && locale="zh-hk" - [[ "$locale" == "tw" ]] && locale="zh-tw" - ;; - "winxpx64" ) - url+="windows_xp_links" - pattern="xp" - locale=$(getLanguage "$lang" "code") - ;; - esac - - else - - case "${version,,}" in - "win11${PLATFORM,,}" | "win11${PLATFORM,,}-enterprise" | "win11${PLATFORM,,}-enterprise-eval" ) - url+="windows_arm_links" - pattern="11_business" - ;; - "win11${PLATFORM,,}-ltsc" | "win11${PLATFORM,,}-enterprise-ltsc-eval" ) - url+="windows_arm_links" - pattern="11_iot_enterprise_ltsc" - ;; - "win10${PLATFORM,,}" | "win10${PLATFORM,,}-enterprise" | "win10${PLATFORM,,}-enterprise-eval" ) - url+="windows_arm_links" - pattern="Pro_10" - locale="$language" - [[ "$locale" == "Chinese" ]] && locale="ChnSimp" - [[ "$locale" == "Chinese HK" ]] && locale="ChnTrad" - [[ "$locale" == "Chinese TW" ]] && locale="ChnTrad" - ;; - "win10${PLATFORM,,}-ltsc" | "win10${PLATFORM,,}-enterprise-ltsc-eval" ) - url+="windows_arm_links" - pattern="10_iot_enterprise_ltsc" - ;; - esac - - fi - - local body="" - - [[ "$DEBUG" == [Yy1]* ]] && echo "Parsing product page: ${url}" - body=$(curl --silent --max-time 30 --user-agent "$user_agent" --location --max-filesize 1M --fail --proto =https --tlsv1.2 --http1.1 -- "$url") || { - handle_curl_error "$?" "Massgrave" - return $? - } - - local list="" - list=$(echo "$body" | xmllint --html --nonet --xpath "//a[contains(text(), '.iso')]" - 2>/dev/null) - - local result="" - result=$(echo "$list" | grep -i "${platform}" | grep "${pattern}" | grep -i -m 1 "${locale,,}_") - result=$(echo "$result" | sed -r 's/.*href="([^"]+).*/\1/g') - local page="$result" - - if [ -z "$page" ]; then - if [[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-"* ]]; then - error "No download in the $language language available for $desc!" - else - error "Failed to parse download link for $desc! Please report this at $SUPPORT/issues." - fi - return 1 - fi - - [[ "$DEBUG" == [Yy1]* ]] && echo "Parsing download page: ${page}" - result=$(curl --silent --max-time 30 --request GET --user-agent "$user_agent" --referer "$url" --head --proto =https --tlsv1.2 --http1.1 -- "$page") || { - handle_curl_error "$?" "Massgrave" - return $? - } - - if [[ "${result,,}" == *"content-type: text"* ]]; then - body=$(curl --silent --max-time 30 --user-agent "$user_agent" --referer "$url" --location --max-filesize 1M --fail --proto =https --tlsv1.2 --http1.1 -- "$page") || { - handle_curl_error "$?" "Massgrave" - return $? - } - - list=$(echo "$body" | xmllint --html --nonet --xpath "//a[contains(@href, '.iso')]" - 2>/dev/null) - list=$(echo "$list" | sed -r 's/.*href="([^"]+).*/\1/g') - page=$(echo "$list" | sed 's/&amp;/\&/g;') - - if [ -z "$page" ]; then - if [[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-"* ]]; then - error "No download in the $language language available for $desc!" - else - error "Failed to parse download link for $desc! Please report this at $SUPPORT/issues." - fi - return 1 - fi - fi - - MG_URL="$page" - return 0 -} - getESD() { local dir="$1" @@ -748,6 +472,18 @@ getESD() { return 0 } +isCompressed() { + + local file="$1" + + case "${file,,}" in + *".7z" | *".zip" | *".rar" | *".lzma" | *".bz" | *".bz2" ) + return 0 ;; + esac + + return 1 +} + verifyFile() { local iso="$1" @@ -756,7 +492,9 @@ verifyFile() { local check="$4" if [ -n "$size" ] && [[ "$total" != "$size" ]] && [[ "$size" != "0" ]]; then - warn "The downloaded file has an unexpected size: $total bytes, while expected value was: $size bytes. Please report this at $SUPPORT/issues" + if [[ "$VERIFY" == [Yy1]* ]] || [[ "$DEBUG" == [Yy1]* ]]; then + warn "The downloaded file has a different size ( $total bytes) than expected ( $size bytes). Please report this at $SUPPORT/issues" + fi fi local hash="" @@ -779,7 +517,7 @@ verifyFile() { info "Succesfully verified ISO!" && return 0 fi - error "The downloaded file has an invalid $algo checksum: $hash , while expected value was: $check. Please report this at $SUPPORT/issues" + error "The downloaded file has an unknown $algo checksum: $hash , as the expected value was: $check. Please report this at $SUPPORT/issues" return 1 } @@ -791,14 +529,16 @@ downloadFile() { local size="$4" local lang="$5" local desc="$6" - local rc total progress domain dots space folder + local msg="Downloading $desc" + local rc total total_gb progress domain dots space folder rm -f "$iso" if [ -n "$size" ] && [[ "$size" != "0" ]]; then folder=$(dirname -- "$iso") space=$(df --output=avail -B 1 "$folder" | tail -n 1) - (( size > space )) && error "Not enough free space left to download file!" && return 1 + total_gb=$(formatBytes "$space") + (( size > space )) && error "Not enough free space to download file, only $total_gb left!" && return 1 fi # Check if running with interactive TTY or redirected to docker log @@ -808,8 +548,8 @@ downloadFile() { progress="--progress=dot:giga" fi - local msg="Downloading $desc" html "$msg..." + /run/progress.sh "$iso" "$size" "$msg ([P])..." & domain=$(echo "$url" | awk -F/ '{print $3}') dots=$(echo "$domain" | tr -cd '.' | wc -c) @@ -820,7 +560,6 @@ downloadFile() { fi info "$msg..." - /run/progress.sh "$iso" "$size" "$msg ([P])..." & { wget "$url" -O "$iso" -q --timeout=30 --no-http-keep-alive --show-progress "$progress"; rc=$?; } || : @@ -828,17 +567,19 @@ downloadFile() { if (( rc == 0 )) && [ -f "$iso" ]; then total=$(stat -c%s "$iso") + total_gb=$(formatBytes "$total") if [ "$total" -lt 100000000 ]; then - error "Invalid download link: $url (is only $total bytes?). Please report this at $SUPPORT/issues." && return 1 + error "Invalid download link: $url (is only $total_gb ?). Please report this at $SUPPORT/issues." && return 1 fi verifyFile "$iso" "$size" "$total" "$sum" || return 1 + isCompressed "$url" && UNPACK="Y" html "Download finished successfully..." && return 0 fi msg="Failed to download $url" (( rc == 3 )) && error "$msg , cannot write file (disk full?)" && return 1 (( rc == 4 )) && error "$msg , network failure!" && return 1 - (( rc == 8 )) && error "$msg , server issued an error response!" && return 1 + (( rc == 8 )) && error "$msg , server issued an error response! Please report this at $SUPPORT/issues." && return 1 error "$msg , reason: $rc" return 1 @@ -856,12 +597,14 @@ downloadImage() { local msg="Will retry after $delay seconds..." if [[ "${version,,}" == "http"* ]]; then + base=$(basename "$iso") desc=$(fromFile "$base") downloadFile "$iso" "$version" "" "" "" "$desc" && return 0 info "$msg" && html "$msg" && sleep "$delay" downloadFile "$iso" "$version" "" "" "" "$desc" && return 0 rm -f "$iso" + return 1 fi @@ -950,31 +693,6 @@ downloadImage() { done - if isMG "$version" "$lang"; then - - if [[ "$tried" != "n" ]]; then - info "Failed to download $desc, will try a diferent method now..." - fi - - tried="y" - success="n" - - if getMG "$version" "$lang" "$desc"; then - success="y" - else - info "$msg" && html "$msg" && sleep "$delay" - getMG "$version" "$lang" "$desc" && success="y" - fi - - if [[ "$success" == "y" ]]; then - downloadFile "$iso" "$MG_URL" "" "" "$lang" "$desc" && return 0 - info "$msg" && html "$msg" && sleep "$delay" - downloadFile "$iso" "$MG_URL" "" "" "$lang" "$desc" && return 0 - rm -f "$iso" - fi - - fi - return 1 } diff --git a/src/network.sh b/src/network.sh index e9b82c9..6112244 100755 --- a/src/network.sh +++ b/src/network.sh @@ -85,7 +85,7 @@ configure_guest_network_interface() { fi RETRIES=10 - for i in $(seq 1 $RETRIES); do + for j in $(seq 1 $RETRIES); do OUTPUT=$(python3 /run/qga.py powershell -Command "(\$(Get-NetAdapter -Name '$INTERFACE_NAME').Status)") STATUS=$(echo "$OUTPUT" | grep -A1 'STDOUT:' | tail -n1 | tr -d '\r' | xargs) @@ -94,8 +94,8 @@ configure_guest_network_interface() { echo "Interface '$INTERFACE_NAME' is up!" break else - echo "Waiting for interface '$INTERFACE_NAME' to be up... ($i/$RETRIES)" - sleep $SLEEP + echo "Waiting for interface '$INTERFACE_NAME' to be up... ($j/$RETRIES)" + sleep 1 fi done diff --git a/src/samba.sh b/src/samba.sh index 321d05d..4ef366c 100644 --- a/src/samba.sh +++ b/src/samba.sh @@ -14,6 +14,10 @@ if [[ "$DHCP" == [Yy1]* ]]; then interface="$VM_NET_DEV" fi +if [[ "${NETWORK,,}" == "user"* ]]; then + interface="127.0.0.1" +fi + addShare() { local dir="$1" local name="$2" @@ -99,6 +103,11 @@ for dir in "${dirs[@]}"; do addShare "$dir" "$dir_name" "Shared $dir_name" || error "Failed to create shared folder for $dir!" done +# Fix Samba permissions +[ -d /run/samba/msg.lock ] && chmod -R 0755 /run/samba/msg.lock +[ -d /var/log/samba/cores ] && chmod -R 0700 /var/log/samba/cores +[ -d /var/cache/samba/msg.lock ] && chmod -R 0755 /var/cache/samba/msg.lock + if ! smbd; then error "Samba daemon failed to start!" smbd -i --debug-stdout || true