mirror of
https://github.com/dockur/windows.git
synced 2026-08-05 13:37:22 +01:00
fix: Detect encoded archive URL extensions (#2060)
This commit is contained in:
+21
-30
@@ -204,7 +204,7 @@ startInstall() {
|
||||
|
||||
if [[ "${VERSION,,}" == "http"* ]]; then
|
||||
|
||||
file=$(basename "${VERSION%%\?*}")
|
||||
file=$(basename "${VERSION%%[\?#]*}")
|
||||
printf -v file '%b' "${file//%/\\x}"
|
||||
file="${file//[!A-Za-z0-9._-]/_}"
|
||||
|
||||
@@ -272,24 +272,6 @@ startInstall() {
|
||||
exit 50
|
||||
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
|
||||
|
||||
if [ -z "$previousBase" ] && hasDisk; then
|
||||
@@ -378,16 +360,7 @@ skipUnattended() {
|
||||
|
||||
# Preserve custom media in place. Downloaded or reused media must be moved
|
||||
# back to persistent storage before the manual fallback is started.
|
||||
if [ -n "$CUSTOM" ]; then
|
||||
BOOT="$iso"
|
||||
REMOVE="N"
|
||||
else
|
||||
if [[ "$iso" != "$BOOT" ]]; then
|
||||
if ! mv -f "$iso" "$BOOT"; then
|
||||
error "Failed to move ISO file: $iso" && return 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
useOriginalImage "$iso"
|
||||
|
||||
finishInstall "$BOOT" "$aborted" "$boot" && return 0
|
||||
return 1
|
||||
@@ -417,10 +390,28 @@ skipInstall() {
|
||||
|
||||
local iso="$1"
|
||||
local previousBase="$2"
|
||||
|
||||
local boot="$STORAGE/windows.boot"
|
||||
|
||||
if [ -n "$previousBase" ]; then
|
||||
|
||||
# Older releases stored the original download name in windows.base. New
|
||||
# releases always store the final ISO name, so migrate legacy state once.
|
||||
if [[ "${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
|
||||
|
||||
# A changed source invalidates an unfinished installation. Back up an
|
||||
# existing installation, but discard stale media when no disk exists yet.
|
||||
if [[ "${STORAGE,,}/${previousBase,,}" != "${iso,,}" ]]; then
|
||||
|
||||
+11
-3
@@ -1057,16 +1057,24 @@ getESD() {
|
||||
|
||||
isCompressed() {
|
||||
|
||||
local url="${1%%\?*}"
|
||||
local url="${1%%[\?#]*}"
|
||||
local file
|
||||
|
||||
file=$(basename "$url")
|
||||
printf -v file '%b' "${file//%/\\x}"
|
||||
|
||||
# The ReactOS latest-build endpoint returns an archive without a filename
|
||||
# extension, so recognize its path explicitly.
|
||||
case "${url,,}" in
|
||||
case "${file,,}" in
|
||||
*.7z | *.zip | *.rar | *.tar | *.cab | *.cpio | \
|
||||
*.lzh | *.lha | *.xar | */latest-x86-gcc-lin-rel )
|
||||
*.lzh | *.lha | *.xar )
|
||||
return 0 ;;
|
||||
esac
|
||||
|
||||
case "${url,,}" in
|
||||
*/latest-x86-gcc-lin-rel ) return 0 ;;
|
||||
esac
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user