mirror of
https://github.com/dockur/windows.git
synced 2026-08-05 13:37:22 +01:00
fix: Normalize downloaded boot image filenames (#2055)
This commit is contained in:
+41
-3
@@ -200,6 +200,7 @@ startInstall() {
|
|||||||
if [ -z "$CUSTOM" ]; then
|
if [ -z "$CUSTOM" ]; then
|
||||||
|
|
||||||
local file="${VERSION//\//}.iso"
|
local file="${VERSION//\//}.iso"
|
||||||
|
local boot="$file"
|
||||||
|
|
||||||
if [[ "${VERSION,,}" == "http"* ]]; then
|
if [[ "${VERSION,,}" == "http"* ]]; then
|
||||||
|
|
||||||
@@ -207,6 +208,21 @@ startInstall() {
|
|||||||
printf -v file '%b' "${file//%/\\x}"
|
printf -v file '%b' "${file//%/\\x}"
|
||||||
file="${file//[!A-Za-z0-9._-]/_}"
|
file="${file//[!A-Za-z0-9._-]/_}"
|
||||||
|
|
||||||
|
boot="$file"
|
||||||
|
|
||||||
|
if isCompressed "$VERSION" || [[ "${boot,,}" == *.esd ]]; then
|
||||||
|
boot="${boot%.*}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -n "$boot" ] || boot="download"
|
||||||
|
[[ "${boot,,}" == *.iso ]] || boot+=".iso"
|
||||||
|
|
||||||
|
case "${boot,,}" in
|
||||||
|
"windows."* )
|
||||||
|
error "The download filename \"$file\" uses the reserved \"windows.*\" namespace!"
|
||||||
|
exit 58 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
local language
|
local language
|
||||||
@@ -215,11 +231,12 @@ startInstall() {
|
|||||||
|
|
||||||
if [ -n "$language" ] && [[ "${language,,}" != "en" ]]; then
|
if [ -n "$language" ] && [[ "${language,,}" != "en" ]]; then
|
||||||
file="${VERSION//\//}_${language,,}.iso"
|
file="${VERSION//\//}_${language,,}.iso"
|
||||||
|
boot="$file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BOOT="$STORAGE/$file"
|
BOOT="$STORAGE/$boot"
|
||||||
|
|
||||||
REUSED_ISO=""
|
REUSED_ISO=""
|
||||||
[ -s "$BOOT" ] && REUSED_ISO="Y"
|
[ -s "$BOOT" ] && REUSED_ISO="Y"
|
||||||
@@ -255,6 +272,24 @@ startInstall() {
|
|||||||
exit 50
|
exit 50
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Older releases stored the original download name in windows.base. New
|
||||||
|
# releases always store the final ISO name, so migrate legacy state once.
|
||||||
|
if [ -n "$previousBase" ] && [[ "${previousBase,,}" != *.iso ]]; then
|
||||||
|
|
||||||
|
if isCompressed "$previousBase" || [[ "${previousBase,,}" == *.esd ]]; then
|
||||||
|
previousBase="${previousBase%.*}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -n "$previousBase" ] || previousBase="download"
|
||||||
|
previousBase+=".iso"
|
||||||
|
|
||||||
|
if ! writeState "base" "$previousBase"; then
|
||||||
|
error "Failed to migrate the previous installation state!"
|
||||||
|
exit 50
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
skipInstall "$BOOT" "$previousBase" && return 1
|
skipInstall "$BOOT" "$previousBase" && return 1
|
||||||
|
|
||||||
if [ -z "$previousBase" ] && hasDisk; then
|
if [ -z "$previousBase" ] && hasDisk; then
|
||||||
@@ -270,8 +305,11 @@ startInstall() {
|
|||||||
|
|
||||||
if [ -z "$CUSTOM" ]; then
|
if [ -z "$CUSTOM" ]; then
|
||||||
|
|
||||||
ISO=$(basename "$BOOT")
|
if [ -n "$REUSED_ISO" ]; then
|
||||||
ISO="$TMP/$ISO"
|
ISO="$TMP/$(basename "$BOOT")"
|
||||||
|
else
|
||||||
|
ISO="$TMP/$file"
|
||||||
|
fi
|
||||||
|
|
||||||
# Work from the temporary directory so the persistent source path can
|
# Work from the temporary directory so the persistent source path can
|
||||||
# later contain either the preserved ISO or the rebuilt installation image.
|
# later contain either the preserved ISO or the rebuilt installation image.
|
||||||
|
|||||||
Reference in New Issue
Block a user