@@ -264,23 +264,34 @@ download_windows_eval() {
264264 }
265265
266266 case " $enterprise_type " in
267+ " iot" | " ltsc" )
268+ case " ${PLATFORM,,} " in
269+ " x64" )
270+ if [[ " $windows_version " != " windows-10" * ]]; then
271+ iso_download_link=$( echo " $iso_download_links " | head -n 1)
272+ else
273+ iso_download_link=$( echo " $iso_download_links " | head -n 4 | tail -n 1)
274+ fi ;;
275+ " arm64" )
276+ iso_download_link=$( echo " $iso_download_links " | head -n 2 | tail -n 1) ;;
277+ * )
278+ error " Invalid platform specified, value \" $PLATFORM \" is not recognized!" && return 1 ;;
279+ esac ;;
267280 " enterprise" )
268- iso_download_link=$( echo " $iso_download_links " | head -n 2 | tail -n 1)
269- ;;
270- " iot" )
271- if [[ " ${PLATFORM,,} " == " x64" ]]; then
272- iso_download_link=$( echo " $iso_download_links " | head -n 1)
273- fi
274- if [[ " ${PLATFORM,,} " == " arm64" ]]; then
275- iso_download_link=$( echo " $iso_download_links " | head -n 2 | tail -n 1)
276- fi
277- ;;
278- " ltsc" )
279- iso_download_link=$( echo " $iso_download_links " | head -n 4 | tail -n 1)
280- ;;
281+ case " ${PLATFORM,,} " in
282+ " x64" )
283+ if [[ " $windows_version " != " windows-10" * ]]; then
284+ iso_download_link=$( echo " $iso_download_links " | head -n 1)
285+ else
286+ iso_download_link=$( echo " $iso_download_links " | head -n 2 | tail -n 1)
287+ fi ;;
288+ " arm64" )
289+ iso_download_link=$( echo " $iso_download_links " | head -n 2 | tail -n 1) ;;
290+ * )
291+ error " Invalid platform specified, value \" $PLATFORM \" is not recognized!" && return 1 ;;
292+ esac ;;
281293 " server" )
282- iso_download_link=$( echo " $iso_download_links " | head -n 1)
283- ;;
294+ iso_download_link=$( echo " $iso_download_links " | head -n 1) ;;
284295 * )
285296 error " Invalid type specified, value \" $enterprise_type \" is not recognized!" && return 1 ;;
286297 esac
@@ -323,8 +334,7 @@ getWindows() {
323334
324335 case " ${version,,} " in
325336 " win11${PLATFORM,,} " ) ;;
326- " win11${PLATFORM,,} -enterprise-iot" * ) ;;
327- " win11${PLATFORM,,} -enterprise-ltsc" * ) ;;
337+ " win11${PLATFORM,,} -enterprise" * ) ;;
328338 * )
329339 if [[ " ${PLATFORM,,} " != " x64" ]]; then
330340 error " No download for the ${PLATFORM^^} platform available for $edition !"
@@ -396,10 +406,11 @@ getESD() {
396406 local version=" $2 "
397407 local lang=" $3 "
398408 local desc=" $4 "
409+ local result
399410 local culture
400411 local language
401412 local editionName
402- local winCatalog size
413+ local winCatalog
403414
404415 culture=$( getLanguage " $lang " " culture" )
405416 winCatalog=$( getCatalog " $version " " url" )
@@ -441,32 +452,57 @@ getESD() {
441452 error " Failed to find $xFile in $wFile !" && return 1
442453 fi
443454
444- local edQuery=' //File[Architecture="' ${PLATFORM} ' "][Edition="' ${editionName} ' "]'
455+ local edQuery=' //File[Architecture="' ${PLATFORM,,} ' "][Edition="' ${editionName} ' "]'
456+ result=$( xmllint --nonet --xpath " ${edQuery} " " $dir /$xFile " 2> /dev/null)
457+
458+ if [ -z " $result " ]; then
459+
460+ edQuery=' //File[Architecture="' ${PLATFORM^^} ' "][Edition="' ${editionName} ' "]'
461+ result=$( xmllint --nonet --xpath " ${edQuery} " " $dir /$xFile " 2> /dev/null)
462+
463+ if [ -z " $result " ]; then
464+
465+ desc=$( printEdition " $version " " $desc " )
466+ language=$( getLanguage " $lang " " desc" )
467+ error " No download link available for $desc !" && return 1
468+ fi
469+
470+ fi
445471
446472 echo -e ' <Catalog>' > " $dir /$fFile "
447- xmllint --nonet --xpath " ${edQuery} " " $dir / $xFile " >> " $dir /$fFile " 2> /dev/null
473+ echo " $result " >> " $dir /$fFile "
448474 echo -e ' </Catalog>' >> " $dir /$fFile "
449475
450- xmllint --nonet --xpath " //File[LanguageCode=\" ${culture,,} \" ]" " $dir /$fFile " > " $dir / $eFile "
476+ result= $( xmllint --nonet --xpath " //File[LanguageCode=\" ${culture,,} \" ]" " $dir /$fFile " 2> /dev/null )
451477
452- size=$( stat -c%s " $dir /$eFile " )
453- if (( size< 20 )) ; then
478+ if [ -z " $result " ]; then
454479 desc=$( printEdition " $version " " $desc " )
455480 language=$( getLanguage " $lang " " desc" )
456481 error " No download in the $language language available for $desc !" && return 1
457482 fi
458483
484+ echo " $result " > " $dir /$eFile "
485+
459486 local tag=" FilePath"
460- ESD=$( xmllint --nonet --xpath " //$tag " " $dir /$eFile " | sed -E -e " s/<[\/]?$tag >//g" )
487+ ESD=$( xmllint --nonet --xpath " //$tag " " $dir /$eFile " | sed -E -e " s/<[\/]?$tag >//g" 2> /dev/null )
461488
462489 if [ -z " $ESD " ]; then
463490 error " Failed to find ESD URL in $eFile !" && return 1
464491 fi
465492
466493 tag=" Sha1"
467- ESD_SUM=$( xmllint --nonet --xpath " //$tag " " $dir /$eFile " | sed -E -e " s/<[\/]?$tag >//g" )
494+ ESD_SUM=$( xmllint --nonet --xpath " //$tag " " $dir /$eFile " | sed -E -e " s/<[\/]?$tag >//g" 2> /dev/null)
495+
496+ if [ -z " $ESD_SUM " ]; then
497+ error " Failed to find ESD checksum in $eFile !" && return 1
498+ fi
499+
468500 tag=" Size"
469- ESD_SIZE=$( xmllint --nonet --xpath " //$tag " " $dir /$eFile " | sed -E -e " s/<[\/]?$tag >//g" )
501+ ESD_SIZE=$( xmllint --nonet --xpath " //$tag " " $dir /$eFile " | sed -E -e " s/<[\/]?$tag >//g" 2> /dev/null)
502+
503+ if [ -z " $ESD_SIZE " ]; then
504+ error " Failed to find ESD filesize in $eFile !" && return 1
505+ fi
470506
471507 rm -rf " $dir "
472508 return 0
@@ -561,6 +597,7 @@ downloadFile() {
561597 fi
562598
563599 info " $msg ..."
600+ [[ " $DEBUG " == [Yy1]* ]] && echo " Downloading $url "
564601
565602 { wget " $url " -O " $iso " -q --timeout=30 --no-http-keep-alive --user-agent " $agent " --show-progress " $progress " ; rc=$? ; } || :
566603
0 commit comments