mirror of
https://github.com/dockur/windows.git
synced 2026-08-03 12:37:20 +01:00
feat: Add post-install command support (#1887)
This commit is contained in:
+3
-2
@@ -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. |
|
| `PASSWORD` | `admin` | Password for the Windows account. |
|
||||||
| `DOMAIN` | | Active Directory domain to join during installation. |
|
| `DOMAIN` | | Active Directory domain to join during installation. |
|
||||||
| `KEY` | | Windows product key used to install and activate Windows. |
|
| `KEY` | | Windows product key used to install and activate Windows. |
|
||||||
| `MANUAL` | `N` | Enables manual installation instead of unattended installation. |
|
|
||||||
|
|
||||||
## 🧠 CPU and Memory
|
## 🧠 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_INTERVAL` | `5` | Polling interval in seconds. |
|
||||||
| `BALLOONING_DEBUG` | `N` | Enables debug output for the ballooning monitor. |
|
| `BALLOONING_DEBUG` | `N` | Enables debug output for the ballooning monitor. |
|
||||||
|
|
||||||
## 💿 Installation Media
|
## 💿 Installation
|
||||||
|
|
||||||
| Variable | Default | Description |
|
| 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. |
|
| `ESD` | `Y` | Enables downloading Windows through the ESD-based installation method. |
|
||||||
| `VERIFY` | `N` | Verifies downloaded installation media against predefined checksums. |
|
| `VERIFY` | `N` | Verifies downloaded installation media against predefined checksums. |
|
||||||
| `REMOVE` | `Y` | Deletes the downloaded Windows ISO after installation to save space. |
|
| `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
|
## 🔌 Shutdown
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
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 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).
|
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.
|
||||||
|
|
||||||
Then bind that folder in your compose file like this:
|
Then bind that folder in your compose file like this:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
volumes:
|
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?
|
### How do I perform a manual installation?
|
||||||
|
|
||||||
|
|||||||
+22
-6
@@ -1347,23 +1347,39 @@ validVersion() {
|
|||||||
addFolder() {
|
addFolder() {
|
||||||
|
|
||||||
local src="$1"
|
local src="$1"
|
||||||
local folder="/oem"
|
local folder="/oem" file=""
|
||||||
|
local dest="$src/\$OEM\$/\$1/OEM"
|
||||||
|
|
||||||
[ ! -d "$folder" ] && folder="/OEM"
|
[ ! -d "$folder" ] && folder="/OEM"
|
||||||
[ ! -d "$folder" ] && folder="$STORAGE/oem"
|
[ ! -d "$folder" ] && folder="$STORAGE/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"
|
info "$msg" && html "$msg"
|
||||||
|
|
||||||
local dest="$src/\$OEM\$/\$1/OEM"
|
|
||||||
mkdir -p "$dest" || return 1
|
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
|
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 [ -f "$file" ]; then
|
||||||
if ! unix2dos -q "$file"; then
|
if ! unix2dos -q "$file"; then
|
||||||
error "Failed to convert $file to DOS format!"
|
error "Failed to convert $file to DOS format!"
|
||||||
|
|||||||
Reference in New Issue
Block a user