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

fix: Do not set computername if not explictly provided (#1922)

This commit is contained in:
Kroese
2026-07-21 13:24:14 +02:00
committed by GitHub
parent da73600b14
commit a831593327
3 changed files with 14 additions and 13 deletions
+4 -4
View File
@@ -12,7 +12,7 @@ An empty default means the variable is unset and its value is determined automat
| `EDITION` | | Windows edition to install, such as `core` for Windows Server Core. |
| `LANGUAGE` | `en-US` | Windows display language, such as `English`, `en-US`, or `en`. |
| `KEY` | | Windows product key used to install and activate Windows. |
| `REGION` | | Windows regional format. Uses `LANGUAGE` when unset. |
| `REGION` | | Regional format. Uses `LANGUAGE` when unset. |
| `KEYBOARD` | | Keyboard layout. Uses `LANGUAGE` when unset. |
| `USERNAME` | `Docker` | Name of the Windows user account. |
| `PASSWORD` | `admin` | Password for the Windows account. |
@@ -55,14 +55,14 @@ An empty default means the variable is unset and its value is determined automat
| Variable | Default | Description |
|---|---|---|
| `NETWORK` | | Network mode, such as `nat`, `user`, or `N` to disable networking. |
| `DHCP` | `N` | Enables macvtap networking so Windows receives an address from the external LAN through DHCP. |
| `HOST` | `Windows` | Computer name assigned to Windows and advertised on the network. |
| `DHCP` | `N` | Enables macvtap networking so Windows receives a DHCP address. |
| `HOST` | | Optional Windows computer name and advertised network hostname. |
| `IP` | | Overrides the automatically selected guest IPv4 address. |
| `MAC` | | Guest network adapter MAC address. |
| `ADAPTER` | `virtio-net-pci` | QEMU network adapter model. |
| `DEV` | `eth0` | Container network interface used as the uplink. |
| `MTU` | | MTU assigned to the guest network interface. |
| `MASK` | `255.255.255.0` | IPv4 netmask. |
| `MASK` | `255.255.255.0` | IPv4 netmask for guest network. |
| `TAP` | `qemu` | TAP or macvtap interface name. |
| `BRIDGE` | `docker` | Bridge name used for NAT networking. |
| `HOST_PORTS` | | Ports excluded from guest forwarding. |
+3 -5
View File
@@ -1338,10 +1338,7 @@ validateComputerName() {
local value="$1"
if [ -z "$value" ]; then
value="$APP"
HOST="$value"
fi
[ -z "$value" ] && return 0
if [ "${#value}" -gt 15 ]; then
error "The HOST variable cannot contain more than 15 characters!"
@@ -1764,13 +1761,14 @@ prepareInstall() {
local username="${USERNAME:-Docker}"
local password="${PASSWORD:-admin}"
local workgroup="${WORKGROUP:-WORKGROUP}"
local sifHost sifUsername sifPassword sifOrganization sifWorkgroup
local regUsername regPassword
validateLegacyUsername "$username" "$desc" || return 1
validatePassword "$password" "$desc" || return 1
sifHost=$(escapeSIFValue "$HOST") || return 1
sifHost=$(escapeSIFValue "${HOST:-*}") || return 1
sifUsername=$(escapeSIFValue "$username") || return 1
sifPassword=$(escapeSIFValue "$password") || return 1
sifOrganization=$(escapeSIFValue "$APP for $ENGINE") || return 1
+7 -4
View File
@@ -1184,9 +1184,9 @@ updateXML() {
local asset="$1"
local language="$2"
local app value culture region keyboard edition key
local app value culture region keyboard edition
local user user_xml auth_user admin pass pw
local domain qualifier host workgroup
local domain qualifier host workgroup key
[ -z "$WIDTH" ] && WIDTH="1280"
[ -z "$HEIGHT" ] && HEIGHT="720"
@@ -1199,10 +1199,8 @@ updateXML() {
validatePassword "$PASSWORD" || return 1
app=$(escapeXMLSed "$APP for $ENGINE") || return 1
host=$(escapeXMLSed "$HOST") || return 1
sed -i "s|>Windows for Docker<|>$app<|g" "$asset" || return 1
sed -i -E "s|<ComputerName>[^<]*</ComputerName>|<ComputerName>$host</ComputerName>|g" "$asset" || return 1
sed -i -E "s|<VerticalResolution>[^<]*</VerticalResolution>|<VerticalResolution>$HEIGHT</VerticalResolution>|g" "$asset" || return 1
sed -i -E "s|<HorizontalResolution>[^<]*</HorizontalResolution>|<HorizontalResolution>$WIDTH</HorizontalResolution>|g" "$asset" || return 1
@@ -1231,6 +1229,11 @@ updateXML() {
sed -i "s|<InputLocale>0409:00000409</InputLocale>|<InputLocale>$value</InputLocale>|g" "$asset" || return 1
fi
if [ -n "$HOST" ]; then
host=$(escapeXMLSed "$HOST") || return 1
sed -i -E "s|<ComputerName>[^<]*</ComputerName>|<ComputerName>$host</ComputerName>|g" "$asset" || return 1
fi
domain="$DOMAIN"
workgroup="$WORKGROUP"