diff --git a/assets/win10arm64.xml b/assets/win10arm64.xml
index b2ec26e..e7c0a4d 100644
--- a/assets/win10arm64.xml
+++ b/assets/win10arm64.xml
@@ -464,6 +464,11 @@
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes
Enable File Sharing
+
+ 23
+ 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/win11arm64.xml b/assets/win11arm64.xml
index 94b5e6e..686020e 100644
--- a/assets/win11arm64.xml
+++ b/assets/win11arm64.xml
@@ -488,6 +488,11 @@
reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV2 /d 0 /t REG_DWORD /f
Disable unsupported hardware notifications
+
+ 24
+ 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/readme.md b/readme.md
index 0fbd9b8..fdd17a5 100644
--- a/readme.md
+++ b/readme.md
@@ -155,9 +155,7 @@ docker run -it --rm --name windows -p 8006:8006 --device=/dev/kvm --cap-add NET_
* ### How do I customize the installation?
- You can customize any part of the automatic installation, and even execute certain commands at boot if needed.
-
- Download the XML file corresponding to your Windows version, for example [win11arm64.xml](https://raw.githubusercontent.com/dockur/windows-arm/master/assets/win11arm64.xml). Then apply your modifications to it, and add this line to your compose file:
+ You can customize every setting used by the automatic installation. Download the XML file corresponding to your Windows version, for example [win11arm64.xml](https://raw.githubusercontent.com/dockur/windows/master/assets/win11arm64.xml). Then apply your modifications to it, and add this line to your compose file:
```yaml
volumes:
@@ -166,6 +164,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.
+* ### 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 assign an individual IP address to the container?
By default, the container uses bridge networking, which shares the IP address with the host.
diff --git a/src/install.sh b/src/install.sh
index cb0bb4d..ae93b9b 100644
--- a/src/install.sh
+++ b/src/install.sh
@@ -638,6 +638,35 @@ updateImage() {
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() {
local dir="$1"
@@ -736,6 +765,10 @@ if ! rm -f "$ISO" 2> /dev/null; then
rm -f "$ISO"
fi
+if ! copyOEM "$DIR"; then
+ exit 63
+fi
+
if ! buildImage "$DIR"; then
exit 65
fi