@@ -591,12 +591,6 @@ Optional:
591591 warn " Disable signature check, gpg not available"
592592 }
593593
594- if [ $check_signature -eq 0 ]; then
595- FILES=()
596- else
597- FILES=(" CHECKSUMS" " CHECKSUMS.gpg" )
598- fi
599-
600594 IFS=$' \n '
601595
602596 ppa_uri=$ppa_index ${version% \. 0} " /"
@@ -609,8 +603,23 @@ Optional:
609603 exit 1
610604 fi
611605
612- index=${index##* <table}
606+ index=${index%%* <table}
607+
608+ FILES=()
609+
610+ found_arch=0
611+ uses_subfolders=0
612+ section_end=" ^[[:space:]]*<br>[[:space:]]*$"
613613 for line in $index ; do
614+ if [[ $line =~ $build_succeeded_text ]]; then
615+ found_arch=1
616+ continue
617+ elif [ $found_arch -eq 0 ]; then
618+ continue
619+ elif [[ $line =~ $section_end ]]; then
620+ break
621+ fi
622+
614623 [[ " $line " =~ linux-(image(-(un)? signed)? | headers| modules)-[0-9]+\. [0-9]+\. [0-9]+-[0-9]{6}.*? _(${arch} | all).deb ]] || continue
615624
616625 [ $use_lowlatency -eq 0 ] && [[ " $line " =~ " -lowlatency" ]] && continue
@@ -623,10 +632,22 @@ Optional:
623632 line=${line##* href=\" }
624633 line=${line%% \" >* }
625634
635+ if [ $uses_subfolders -eq 0 ] && [[ $line =~ ${arch} /linux ]]; then
636+ uses_subfolders=1
637+ fi
638+
626639 FILES+=(" $line " )
627640 done
628641 unset IFS
629642
643+ if [ $check_signature -eq 1 ]; then
644+ if [ $uses_subfolders -eq 0 ]; then
645+ FILES+=(" CHECKSUMS" " CHECKSUMS.gpg" )
646+ else
647+ FILES+=(" ${arch} /CHECKSUMS" " ${arch} /CHECKSUMS.gpg" )
648+ fi
649+ fi
650+
630651 if [ ${# FILES[@]} -ne $expected_files_count ]; then
631652 if [ $assume_yes -eq 0 ]; then
632653 logn " Expected to need to download $expected_files_count files but found ${# FILES[@]} , continue? (y/N)"
@@ -642,14 +663,15 @@ Optional:
642663 debs=()
643664 log " Will download ${# FILES[@]} files from $ppa_host :"
644665 for file in " ${FILES[@]} " ; do
645- monitor_progress " Downloading $file " " $workdir$file "
646- download $ppa_host " $ppa_uri$file " > " $workdir$file "
666+ workfile=${file##*/ }
667+ monitor_progress " Downloading $file " " $workdir$workfile "
668+ download $ppa_host " $ppa_uri$file " > " $workdir$workfile "
647669
648- remove_http_headers " $workdir$file "
670+ remove_http_headers " $workdir$workfile "
649671 end_monitor_progress
650672
651- if [[ " $file " =~ \. deb ]]; then
652- debs+=(" $file " )
673+ if [[ " $workfile " =~ \. deb ]]; then
674+ debs+=(" $workfile " )
653675 fi
654676 done
655677
0 commit comments