Skip to content

Commit 2dbed4e

Browse files
authored
feat: Allow product key configuration (#275)
1 parent 66d5c41 commit 2dbed4e

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

readme.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ The example folder `./example` will be available as ` \\host.lan\Data`.
174174

175175
By default, a user called `Docker` (with an empty password) is created during installation.
176176

177-
If you want to use different credentials, you can configure them (only BEFORE installation) in your compose file:
177+
If you want to use different credentials, you can configure them in your compose file (only before installation):
178178

179179
```yaml
180180
environment:
@@ -197,14 +197,23 @@ The example folder `./example` will be available as ` \\host.lan\Data`.
197197

198198
### How do I select the keyboard layout?
199199

200-
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:
200+
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):
201201

202202
```yaml
203203
environment:
204204
REGION: "en-US"
205205
KEYBOARD: "en-US"
206206
```
207207

208+
### How do I set the product key?
209+
210+
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):
211+
212+
```yaml
213+
environment:
214+
KEY: "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
215+
```
216+
208217
### How do I install a custom image?
209218

210219
In order to download an unsupported ISO image, specify its URL in the `VERSION` environment variable:

src/define.sh

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env bash
22
set -Eeuo pipefail
33

4+
: "${KEY:=""}"
45
: "${WIDTH:=""}"
56
: "${HEIGHT:=""}"
67
: "${VERIFY:=""}"

src/install.sh

+5
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,11 @@ updateXML() {
681681
sed -i "s/SERVERSTANDARD<\/Value>/SERVER${EDITION^^}<\/Value>/g" "$asset"
682682
fi
683683

684+
if [ -n "$KEY" ]; then
685+
sed -i '/<ProductKey>/,/<\/ProductKey>/d' "$asset"
686+
sed -i "s/<\/UserData>/ <ProductKey>\n <Key>${KEY}<\/Key>\n <WillShowUI>OnError<\/WillShowUI>\n <\/ProductKey>\n <\/UserData>/g" "$asset"
687+
fi
688+
684689
return 0
685690
}
686691

0 commit comments

Comments
 (0)