feat: Automatically execute script after installation (#423)
This commit is contained in:
parent
3390ef8101
commit
02c95fb960
|
@ -462,6 +462,11 @@
|
||||||
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
||||||
<Description>Enable File Sharing</Description>
|
<Description>Enable File Sharing</Description>
|
||||||
</SynchronousCommand>
|
</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>
|
||||||
</FirstLogonCommands>
|
</FirstLogonCommands>
|
||||||
</component>
|
</component>
|
||||||
</settings>
|
</settings>
|
||||||
|
|
|
@ -470,6 +470,11 @@
|
||||||
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
||||||
<Description>Enable File Sharing</Description>
|
<Description>Enable File Sharing</Description>
|
||||||
</SynchronousCommand>
|
</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>
|
||||||
</FirstLogonCommands>
|
</FirstLogonCommands>
|
||||||
</component>
|
</component>
|
||||||
</settings>
|
</settings>
|
||||||
|
|
|
@ -468,6 +468,11 @@
|
||||||
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
||||||
<Description>Enable File Sharing</Description>
|
<Description>Enable File Sharing</Description>
|
||||||
</SynchronousCommand>
|
</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>
|
||||||
</FirstLogonCommands>
|
</FirstLogonCommands>
|
||||||
</component>
|
</component>
|
||||||
</settings>
|
</settings>
|
||||||
|
|
|
@ -464,6 +464,11 @@
|
||||||
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
||||||
<Description>Enable File Sharing</Description>
|
<Description>Enable File Sharing</Description>
|
||||||
</SynchronousCommand>
|
</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>
|
||||||
</FirstLogonCommands>
|
</FirstLogonCommands>
|
||||||
</component>
|
</component>
|
||||||
</settings>
|
</settings>
|
||||||
|
|
|
@ -485,6 +485,11 @@
|
||||||
<CommandLine>reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV2 /d 0 /t REG_DWORD /f</CommandLine>
|
<CommandLine>reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV2 /d 0 /t REG_DWORD /f</CommandLine>
|
||||||
<Description>Disable unsupported hardware notifications</Description>
|
<Description>Disable unsupported hardware notifications</Description>
|
||||||
</SynchronousCommand>
|
</SynchronousCommand>
|
||||||
|
<SynchronousCommand wcm:action="add">
|
||||||
|
<Order>24</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>
|
</FirstLogonCommands>
|
||||||
</component>
|
</component>
|
||||||
</settings>
|
</settings>
|
||||||
|
|
|
@ -487,6 +487,11 @@
|
||||||
<CommandLine>reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV2 /d 0 /t REG_DWORD /f</CommandLine>
|
<CommandLine>reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV2 /d 0 /t REG_DWORD /f</CommandLine>
|
||||||
<Description>Disable unsupported hardware notifications</Description>
|
<Description>Disable unsupported hardware notifications</Description>
|
||||||
</SynchronousCommand>
|
</SynchronousCommand>
|
||||||
|
<SynchronousCommand wcm:action="add">
|
||||||
|
<Order>24</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>
|
</FirstLogonCommands>
|
||||||
</component>
|
</component>
|
||||||
</settings>
|
</settings>
|
||||||
|
|
|
@ -302,6 +302,11 @@
|
||||||
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
||||||
<Description>Enable File Sharing</Description>
|
<Description>Enable File Sharing</Description>
|
||||||
</SynchronousCommand>
|
</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>
|
||||||
</FirstLogonCommands>
|
</FirstLogonCommands>
|
||||||
</component>
|
</component>
|
||||||
</settings>
|
</settings>
|
||||||
|
|
|
@ -341,6 +341,11 @@
|
||||||
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
||||||
<Description>Enable File Sharing</Description>
|
<Description>Enable File Sharing</Description>
|
||||||
</SynchronousCommand>
|
</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>
|
||||||
</FirstLogonCommands>
|
</FirstLogonCommands>
|
||||||
</component>
|
</component>
|
||||||
</settings>
|
</settings>
|
||||||
|
|
|
@ -371,6 +371,11 @@
|
||||||
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
||||||
<Description>Enable File Sharing</Description>
|
<Description>Enable File Sharing</Description>
|
||||||
</SynchronousCommand>
|
</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>
|
||||||
</FirstLogonCommands>
|
</FirstLogonCommands>
|
||||||
</component>
|
</component>
|
||||||
</settings>
|
</settings>
|
||||||
|
|
|
@ -375,6 +375,11 @@
|
||||||
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
||||||
<Description>Enable File Sharing</Description>
|
<Description>Enable File Sharing</Description>
|
||||||
</SynchronousCommand>
|
</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>
|
||||||
</FirstLogonCommands>
|
</FirstLogonCommands>
|
||||||
</component>
|
</component>
|
||||||
</settings>
|
</settings>
|
||||||
|
|
|
@ -375,6 +375,11 @@
|
||||||
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
||||||
<Description>Enable File Sharing</Description>
|
<Description>Enable File Sharing</Description>
|
||||||
</SynchronousCommand>
|
</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>
|
||||||
</FirstLogonCommands>
|
</FirstLogonCommands>
|
||||||
</component>
|
</component>
|
||||||
</settings>
|
</settings>
|
||||||
|
|
|
@ -305,6 +305,11 @@
|
||||||
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
||||||
<Description>Enable File Sharing</Description>
|
<Description>Enable File Sharing</Description>
|
||||||
</SynchronousCommand>
|
</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>
|
||||||
</FirstLogonCommands>
|
</FirstLogonCommands>
|
||||||
</component>
|
</component>
|
||||||
</settings>
|
</settings>
|
||||||
|
|
|
@ -326,6 +326,11 @@
|
||||||
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
||||||
<Description>Enable File Sharing</Description>
|
<Description>Enable File Sharing</Description>
|
||||||
</SynchronousCommand>
|
</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>
|
||||||
</FirstLogonCommands>
|
</FirstLogonCommands>
|
||||||
</component>
|
</component>
|
||||||
</settings>
|
</settings>
|
||||||
|
|
|
@ -335,6 +335,11 @@
|
||||||
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
<CommandLine>netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes</CommandLine>
|
||||||
<Description>Enable File Sharing</Description>
|
<Description>Enable File Sharing</Description>
|
||||||
</SynchronousCommand>
|
</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>
|
||||||
</FirstLogonCommands>
|
</FirstLogonCommands>
|
||||||
</component>
|
</component>
|
||||||
</settings>
|
</settings>
|
||||||
|
|
|
@ -259,6 +259,11 @@
|
||||||
<CommandLine>reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f</CommandLine>
|
<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>
|
<Description>Enable RemoteAPP to launch unlisted programs</Description>
|
||||||
</SynchronousCommand>
|
</SynchronousCommand>
|
||||||
|
<SynchronousCommand wcm:action="add">
|
||||||
|
<Order>20</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>
|
</FirstLogonCommands>
|
||||||
</component>
|
</component>
|
||||||
</settings>
|
</settings>
|
||||||
|
|
15
readme.md
15
readme.md
|
@ -168,9 +168,7 @@ docker run -it --rm --name windows -p 8006:8006 --device=/dev/kvm --cap-add NET_
|
||||||
|
|
||||||
* ### How do I customize the installation?
|
* ### How do I customize the installation?
|
||||||
|
|
||||||
You can customize any part of the automatic installation, and even execute certain commands at boot if needed.
|
You can customize every setting used by the automatic installation. Download the XML file corresponding to your Windows version, for example [win11x64.xml](https://raw.githubusercontent.com/dockur/windows/master/assets/win11x64.xml). Then apply your modifications to it, and add this line to your compose file:
|
||||||
|
|
||||||
Download the XML file corresponding to your Windows version, for example [win11x64.xml](https://raw.githubusercontent.com/dockur/windows/master/assets/win11x64.xml). Then apply your modifications to it, and add this line to your compose file:
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -179,6 +177,17 @@ docker run -it --rm --name windows -p 8006:8006 --device=/dev/kvm --cap-add NET_
|
||||||
|
|
||||||
Replace the example path `/home/user/custom.xml` with the filename of the modified XML file.
|
Replace the example path `/home/user/custom.xml` with the filename of the modified XML file.
|
||||||
|
|
||||||
|
* ### 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 other files it needs (programs to install for example). Then bind it in your compose file like this:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
volumes:
|
||||||
|
- /home/user/example:/storage/oem
|
||||||
|
```
|
||||||
|
|
||||||
|
The example path `/home/user/example` will be copied to `C:\OEM` during installation and the containing `install.bat` will be executed.
|
||||||
|
|
||||||
* ### How do I perform a manual installation?
|
* ### How do I perform a manual installation?
|
||||||
|
|
||||||
It's best to use the automatic installation, as it optimizes various settings for use with this container. These tweaks will give you maximum performance and prevent common issues.
|
It's best to use the automatic installation, as it optimizes various settings for use with this container. These tweaks will give you maximum performance and prevent common issues.
|
||||||
|
|
|
@ -1082,6 +1082,35 @@ updateImage() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copyOEM() {
|
||||||
|
local dir="$1"
|
||||||
|
local folder="$STORAGE/oem"
|
||||||
|
local src
|
||||||
|
|
||||||
|
[ ! -d "$folder" ] && folder="$STORAGE/OEM"
|
||||||
|
[ ! -d "$folder" ] && folder="$STORAGE/shared/oem"
|
||||||
|
[ ! -d "$folder" ] && folder="$STORAGE/shared/OEM"
|
||||||
|
[ ! -d "$folder" ] && return 0
|
||||||
|
|
||||||
|
local msg="Copying OEM folder to image..."
|
||||||
|
info "$msg" && html "$msg"
|
||||||
|
|
||||||
|
src=$(find "$dir" -maxdepth 1 -type d -iname sources | head -n 1)
|
||||||
|
|
||||||
|
if [ ! -d "$src" ]; then
|
||||||
|
error "failed to locate 'sources' folder in ISO image!" && return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local dest="$src/\$OEM\$/\$1/"
|
||||||
|
mkdir -p "$dest"
|
||||||
|
|
||||||
|
if ! cp -r "$folder" "$dest"; then
|
||||||
|
error "Failed to copy OEM folder!" && return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
buildImage() {
|
buildImage() {
|
||||||
|
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
|
@ -1242,6 +1271,10 @@ if ! rm -f "$ISO" 2> /dev/null; then
|
||||||
rm -f "$ISO"
|
rm -f "$ISO"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! copyOEM "$DIR"; then
|
||||||
|
exit 63
|
||||||
|
fi
|
||||||
|
|
||||||
if ! buildImage "$DIR"; then
|
if ! buildImage "$DIR"; then
|
||||||
exit 65
|
exit 65
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue