diff --git a/docs/environment.md b/docs/environment.md index d1dde1b8..15506d28 100644 --- a/docs/environment.md +++ b/docs/environment.md @@ -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. | diff --git a/src/define.sh b/src/define.sh index ff881b7c..4e1aa6d4 100644 --- a/src/define.sh +++ b/src/define.sh @@ -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 diff --git a/src/install.sh b/src/install.sh index a3783d15..cd955298 100644 --- a/src/install.sh +++ b/src/install.sh @@ -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|[^<]*|$host|g" "$asset" || return 1 sed -i -E "s|[^<]*|$HEIGHT|g" "$asset" || return 1 sed -i -E "s|[^<]*|$WIDTH|g" "$asset" || return 1 @@ -1231,6 +1229,11 @@ updateXML() { sed -i "s|0409:00000409|$value|g" "$asset" || return 1 fi + if [ -n "$HOST" ]; then + host=$(escapeXMLSed "$HOST") || return 1 + sed -i -E "s|[^<]*|$host|g" "$asset" || return 1 + fi + domain="$DOMAIN" workgroup="$WORKGROUP"