mirror of
https://github.com/dockur/windows.git
synced 2024-11-28 09:35:42 +00:00
fix: Password encoding failure (#532)
This commit is contained in:
parent
f8cff00334
commit
b32e66bc1d
@ -1,5 +1,5 @@
|
|||||||
FROM scratch
|
FROM scratch
|
||||||
COPY --from=qemux/qemu-docker:5.06 / /
|
COPY --from=qemux/qemu-docker:5.07 / /
|
||||||
|
|
||||||
ARG VERSION_ARG="0.0"
|
ARG VERSION_ARG="0.0"
|
||||||
ARG DEBCONF_NOWARNINGS="yes"
|
ARG DEBCONF_NOWARNINGS="yes"
|
||||||
|
@ -7,17 +7,6 @@ FB="falling back to manual installation!"
|
|||||||
ETFS="boot/etfsboot.com"
|
ETFS="boot/etfsboot.com"
|
||||||
EFISYS="efi/microsoft/boot/efisys_noprompt.bin"
|
EFISYS="efi/microsoft/boot/efisys_noprompt.bin"
|
||||||
|
|
||||||
hasDisk() {
|
|
||||||
|
|
||||||
[ -b "/disk1" ] && return 0
|
|
||||||
[ -b "/dev/disk1" ] && return 0
|
|
||||||
[ -b "${DEVICE:-}" ] && return 0
|
|
||||||
[ -s "$STORAGE/data.img" ] && return 0
|
|
||||||
[ -s "$STORAGE/data.qcow2" ] && return 0
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
skipInstall() {
|
skipInstall() {
|
||||||
|
|
||||||
local iso="$1"
|
local iso="$1"
|
||||||
@ -187,28 +176,22 @@ abortInstall() {
|
|||||||
|
|
||||||
detectCustom() {
|
detectCustom() {
|
||||||
|
|
||||||
local file=""
|
local file base
|
||||||
local size base
|
|
||||||
|
|
||||||
CUSTOM=""
|
CUSTOM=""
|
||||||
|
|
||||||
if [[ "${VERSION,,}" != "http"* ]]; then
|
file=$(find / -maxdepth 1 -type f -iname custom.iso | head -n 1)
|
||||||
base="${VERSION/\/storage\//}"
|
[ ! -s "$file" ] && file=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.iso | head -n 1)
|
||||||
[[ "$base" == "."* ]] && base="${file:1}"
|
|
||||||
[[ "$base" == *"/"* ]] && base=""
|
if [ ! -s "$file" ] && [[ "${VERSION,,}" != "http"* ]]; then
|
||||||
[ -n "$base" ] && file=$(find "$STORAGE" -maxdepth 1 -type f -iname "$base" | head -n 1)
|
base=$(basename "$VERSION")
|
||||||
|
file="$STORAGE/$base"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -z "$file" ] && file=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.iso | head -n 1)
|
|
||||||
[ -z "$file" ] && file=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.img | head -n 1)
|
|
||||||
|
|
||||||
base="/custom.iso"
|
|
||||||
[ -f "$base" ] && [ -s "$base" ] && file="$base"
|
|
||||||
|
|
||||||
if [ ! -f "$file" ] || [ ! -s "$file" ]; then
|
if [ ! -f "$file" ] || [ ! -s "$file" ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
local size
|
||||||
size="$(stat -c%s "$file")"
|
size="$(stat -c%s "$file")"
|
||||||
[ -z "$size" ] || [[ "$size" == "0" ]] && return 0
|
[ -z "$size" ] || [[ "$size" == "0" ]] && return 0
|
||||||
|
|
||||||
@ -624,7 +607,7 @@ updateXML() {
|
|||||||
|
|
||||||
local asset="$1"
|
local asset="$1"
|
||||||
local language="$2"
|
local language="$2"
|
||||||
local culture region admin pass keyboard
|
local culture region user admin pass keyboard
|
||||||
|
|
||||||
culture=$(getLanguage "$language" "culture")
|
culture=$(getLanguage "$language" "culture")
|
||||||
|
|
||||||
@ -648,16 +631,18 @@ updateXML() {
|
|||||||
sed -i "s/<InputLocale>0409:00000409<\/InputLocale>/<InputLocale>$keyboard<\/InputLocale>/g" "$asset"
|
sed -i "s/<InputLocale>0409:00000409<\/InputLocale>/<InputLocale>$keyboard<\/InputLocale>/g" "$asset"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$USERNAME" ]; then
|
user=$(echo "$USERNAME" | sed 's/[^[:alnum:]@!._-]//g')
|
||||||
sed -i "s/<Name>Docker<\/Name>/<Name>$USERNAME<\/Name>/g" "$asset"
|
|
||||||
sed -i "s/where name=\"Docker\"/where name=\"$USERNAME\"/g" "$asset"
|
if [ -n "$user" ]; then
|
||||||
sed -i "s/<FullName>Docker<\/FullName>/<FullName>$USERNAME<\/FullName>/g" "$asset"
|
sed -i "s/<Name>Docker<\/Name>/<Name>$user<\/Name>/g" "$asset"
|
||||||
sed -i "s/<Username>Docker<\/Username>/<Username>$USERNAME<\/Username>/g" "$asset"
|
sed -i "s/where name=\"Docker\"/where name=\"$user\"/g" "$asset"
|
||||||
|
sed -i "s/<FullName>Docker<\/FullName>/<FullName>$user<\/FullName>/g" "$asset"
|
||||||
|
sed -i "s/<Username>Docker<\/Username>/<Username>$user<\/Username>/g" "$asset"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$PASSWORD" ]; then
|
if [ -n "$PASSWORD" ]; then
|
||||||
pass=$(printf '%s' "${PASSWORD}Password" | iconv -f utf-8 -t utf-16le | base64)
|
pass=$(printf '%s' "${PASSWORD}Password" | iconv -f utf-8 -t utf-16le | base64 -w 0)
|
||||||
admin=$(printf '%s' "${PASSWORD}AdministratorPassword" | iconv -f utf-8 -t utf-16le | base64)
|
admin=$(printf '%s' "${PASSWORD}AdministratorPassword" | iconv -f utf-8 -t utf-16le | base64 -w 0)
|
||||||
sed -i "s/<Value>password<\/Value>/<Value>$admin<\/Value>/g" "$asset"
|
sed -i "s/<Value>password<\/Value>/<Value>$admin<\/Value>/g" "$asset"
|
||||||
sed -i "s/<PlainText>true<\/PlainText>/<PlainText>false<\/PlainText>/g" "$asset"
|
sed -i "s/<PlainText>true<\/PlainText>/<PlainText>false<\/PlainText>/g" "$asset"
|
||||||
sed -z "s/<Password>...........<Value \/>/<Password>\n <Value>$pass<\/Value>/g" -i "$asset"
|
sed -z "s/<Password>...........<Value \/>/<Password>\n <Value>$pass<\/Value>/g" -i "$asset"
|
||||||
@ -894,11 +879,6 @@ bootWindows() {
|
|||||||
|
|
||||||
rm -rf "$TMP"
|
rm -rf "$TMP"
|
||||||
|
|
||||||
if [ ! -f "$BOOT" ] || [ ! -s "$BOOT" ]; then
|
|
||||||
BOOT="/custom.iso"
|
|
||||||
[ ! -f "$BOOT" ] && BOOT="${STORAGE}$BOOT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ "${PLATFORM,,}" == "arm64" ]] && VGA="virtio-gpu"
|
[[ "${PLATFORM,,}" == "arm64" ]] && VGA="virtio-gpu"
|
||||||
|
|
||||||
if [ -s "$STORAGE/windows.mode" ] && [ -f "$STORAGE/windows.mode" ]; then
|
if [ -s "$STORAGE/windows.mode" ] && [ -f "$STORAGE/windows.mode" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user