mirror of
https://github.com/dockur/windows.git
synced 2026-08-24 15:48:59 +01:00
feat: Hide first-logon console during answer generation (#2152)
This commit is contained in:
@@ -71,6 +71,11 @@ updateXML() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! updateLogonCommandXML "$asset"; then
|
||||
error "Failed to update first-logon command in answer file!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! updateEditionXML "$asset"; then
|
||||
error "Failed to update edition settings in answer file!"
|
||||
return 1
|
||||
@@ -521,6 +526,38 @@ updateAutologinXML() {
|
||||
return 0
|
||||
}
|
||||
|
||||
updateLogonCommandXML() {
|
||||
|
||||
local asset="$1"
|
||||
|
||||
case "${DETECTED,,}" in
|
||||
"winvista"* ) return 0 ;;
|
||||
esac
|
||||
|
||||
local command="$XML_COMPONENT_SHELL_OOBE/u:FirstLogonCommands/u:SynchronousCommand/u:CommandLine"
|
||||
local expected='cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon'
|
||||
local hidden="powershell.exe -NoLogo -NoProfile -NonInteractive -WindowStyle Hidden -Command \"& \$env:ComSpec /d /c ('call ' + [char]34 + \$env:WINDIR + '\Setup\Scripts\SetupComplete.cmd' + [char]34 + ' logon'); exit \$LASTEXITCODE\""
|
||||
|
||||
local count value
|
||||
count=$(getXMLNodeCount "$asset" "$command") || return 1
|
||||
|
||||
if [ "$count" != "1" ]; then
|
||||
error "Failed to find a unique first-logon command in answer file: $asset"
|
||||
return 1
|
||||
fi
|
||||
|
||||
value=$(xmlstarlet sel -N "$XML_NS_UNATTEND_ARG" -T -t -v "string($command)" "$asset") || return 1
|
||||
|
||||
if [ "$value" != "$expected" ]; then
|
||||
error "Unexpected first-logon command in answer file: $asset"
|
||||
return 1
|
||||
fi
|
||||
|
||||
xmlstarlet ed -L -N "$XML_NS_UNATTEND_ARG" -u "$command" -v "$hidden" "$asset" || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
updateProductKey() {
|
||||
|
||||
local script="$1"
|
||||
|
||||
Reference in New Issue
Block a user