1
0
mirror of https://github.com/dockur/windows.git synced 2026-07-27 21:42:36 +07:00

feat: Add post-install command support (#1887)

This commit is contained in:
Kroese
2026-07-19 00:33:00 +02:00
committed by GitHub
parent c9e09156a5
commit 9409c06e32
3 changed files with 37 additions and 13 deletions
+3 -2
View File
@@ -17,7 +17,6 @@ An empty default means the variable is unset and its value is determined automat
| `PASSWORD` | `admin` | Password for the Windows account. |
| `DOMAIN` | | Active Directory domain to join during installation. |
| `KEY` | | Windows product key used to install and activate Windows. |
| `MANUAL` | `N` | Enables manual installation instead of unattended installation. |
## 🧠 CPU and Memory
@@ -146,7 +145,7 @@ Also see [Dynamic memory allocation](https://github.com/qemus/qemu/blob/master/d
| `BALLOONING_INTERVAL` | `5` | Polling interval in seconds. |
| `BALLOONING_DEBUG` | `N` | Enables debug output for the ballooning monitor. |
## 💿 Installation Media
## 💿 Installation
| Variable | Default | Description |
|---|---|---|
@@ -154,6 +153,8 @@ Also see [Dynamic memory allocation](https://github.com/qemus/qemu/blob/master/d
| `ESD` | `Y` | Enables downloading Windows through the ESD-based installation method. |
| `VERIFY` | `N` | Verifies downloaded installation media against predefined checksums. |
| `REMOVE` | `Y` | Deletes the downloaded Windows ISO after installation to save space. |
| `MANUAL` | `N` | Enables manual installation instead of unattended installation. |
| `COMMAND` | | Command to be executed during the final step of automatic installation. |
## 🔌 Shutdown
+12 -5
View File
@@ -272,18 +272,25 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas
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?
### How do I run a command after installation?
To execute a single command during the final step of the automatic installation, add the `COMMAND` environment variable:
```yaml
environment:
COMMAND: 'reg add "HKLM\Software\Example" /v Enabled /t REG_DWORD /d 1 /f'
```
To run a script or include additional files, create a file called `install.bat` and place it in a folder together with any files it needs, such as software to be installed.
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
- ./example:/oem
```
The example folder `./example` will be copied to `C:\OEM` and the `install.bat` file inside that folder will be executed during the last step of the automatic installation.
The example folder `./example` will be copied to `C:\OEM` and the `install.bat` file inside it will be executed during the final step of the automatic installation.
### How do I perform a manual installation?
+22 -6
View File
@@ -1347,23 +1347,39 @@ validVersion() {
addFolder() {
local src="$1"
local folder="/oem"
local folder="/oem" file=""
local dest="$src/\$OEM\$/\$1/OEM"
[ ! -d "$folder" ] && folder="/OEM"
[ ! -d "$folder" ] && folder="$STORAGE/oem"
[ ! -d "$folder" ] && folder="$STORAGE/OEM"
[ ! -d "$folder" ] && return 0
[ ! -d "$folder" ] && folder=""
local msg="Adding OEM folder to image..."
[ -z "$folder" ] && [ -z "$COMMAND" ] && return 0
local msg="Adding OEM files to image..."
info "$msg" && html "$msg"
local dest="$src/\$OEM\$/\$1/OEM"
mkdir -p "$dest" || return 1
cp -Lr "$folder/." "$dest" || return 1
local file
if [ -n "$folder" ]; then
cp -Lr "$folder/." "$dest" || return 1
fi
file=$(find "$dest" -maxdepth 1 -type f -iname install.bat -print -quit) || return 1
if [ -n "$COMMAND" ]; then
[ -z "$file" ] && file="$dest/install.bat"
if [ -s "$file" ]; then
printf '\n' >> "$file" || return 1
fi
printf '%s\n' "$COMMAND" >> "$file" || return 1
fi
if [ -f "$file" ]; then
if ! unix2dos -q "$file"; then
error "Failed to convert $file to DOS format!"