feat: Allow product key configuration (#275)

This commit is contained in:
Kroese 2025-03-13 12:45:24 +01:00 committed by GitHub
parent 66d5c41083
commit 2dbed4ead7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 2 deletions

View file

@ -174,7 +174,7 @@ The example folder `./example` will be available as ` \\host.lan\Data`.
By default, a user called `Docker` (with an empty password) is created during installation.
If you want to use different credentials, you can configure them (only BEFORE installation) in your compose file:
If you want to use different credentials, you can configure them in your compose file (only before installation):
```yaml
environment:
@ -197,7 +197,7 @@ The example folder `./example` will be available as ` \\host.lan\Data`.
### 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, before installation you can add `KEYBOARD` and `REGION` variables 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:
@ -205,6 +205,15 @@ The example folder `./example` will be available as ` \\host.lan\Data`.
KEYBOARD: "en-US"
```
### How do I set the product key?
By default, an evaluation version of Windows will be installed, but if you have product key you can add a `KEY` variable like this (before installation):
```yaml
environment:
KEY: "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
```
### How do I install a custom image?
In order to download an unsupported ISO image, specify its URL in the `VERSION` environment variable:

View file

@ -1,6 +1,7 @@
#!/usr/bin/env bash
set -Eeuo pipefail
: "${KEY:=""}"
: "${WIDTH:=""}"
: "${HEIGHT:=""}"
: "${VERIFY:=""}"

View file

@ -681,6 +681,11 @@ updateXML() {
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
}