File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed
Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 77# 2: builder_path
88function update_builders() {
99 __update_builders=
10- local builder_path current_ns current_builder update_status s3date_remote update_count
10+ local builder_path current_ns current_builder update_status s3date_remote update_count max_cap
1111 current_ns=" $1 "
1212 builder_path=" $2 "
1313 update_count=0
@@ -26,9 +26,10 @@ function update_builders() {
2626 get_stage3_archive_regex " ${STAGE3_BASE} "
2727 # shellcheck disable=SC2154
2828 if [[ " ${__fetch_stage3_archive_name} " =~ ${__get_stage3_archive_regex} ]]; then
29- s3date_remote=" ${BASH_REMATCH[1]} "
29+ max_cap=" ${# BASH_REMATCH[@]} "
30+ s3date_remote=" ${BASH_REMATCH[$((max_cap-3))]} "
3031 # add time string if captured
31- [[ -n " ${BASH_REMATCH[2 ]} " ]] && s3date_remote+=" ${BASH_REMATCH[2 ]} "
32+ [[ -n " ${BASH_REMATCH[$((max_cap-2)) ]} " ]] && s3date_remote+=" ${BASH_REMATCH[$((max_cap-2)) ]} "
3233 # shellcheck disable=SC2153
3334 if is_newer_stage3_date " ${STAGE3_DATE} " " ${s3date_remote} " ; then
3435 sed -E -i' ' s/^STAGE3_DATE=\(\"\|\'\) ? [0-9]* \( T[0-9]* Z\) ? \(\"\|\'\) ? /STAGE3_DATE=\' " ${s3date_remote} " \' /g \
Original file line number Diff line number Diff line change @@ -366,22 +366,25 @@ function get_stage3_archive_regex() {
366366 __get_stage3_archive_regex=
367367 local stage3_base
368368 stage3_base=" $1 "
369- __get_stage3_archive_regex=" ${stage3_base// +/ \\ +} -([0-9]{8})(T[0-9]{6}Z)?\\ .tar\\ .(bz2|xz)"
369+ __get_stage3_archive_regex=" ${stage3_base// +/ ( \\ +| % 2B)? } -([0-9]{8})(T[0-9]{6}Z)?\\ .tar\\ .(bz2|xz)"
370370}
371371
372372# Fetch latest stage3 archive name/type, returns exit signal 3 if no archive could be found
373373function fetch_stage3_archive_name() {
374374 __fetch_stage3_archive_name=
375375 ARCH=" ${ARCH:- amd64} "
376376 ARCH_URL=" ${ARCH_URL:- ${MIRROR} releases/ ${ARCH} / autobuilds/ current-${STAGE3_BASE} / } "
377- local remote_files remote_line remote_date remote_file_type
377+ local remote_files remote_line remote_date remote_file_type max_cap
378378 readarray -t remote_files <<< " $(wget -qO- " ${ARCH_URL} " )"
379379 remote_date=0
380380 get_stage3_archive_regex " ${STAGE3_BASE} "
381381 for remote_line in " ${remote_files[@]} " ; do
382- if [[ " ${remote_line} " =~ ${__get_stage3_archive_regex} \< ]]; then
383- is_newer_stage3_date " ${remote_date} " " ${BASH_REMATCH[1]}${BASH_REMATCH[2]} " \
384- && { remote_date=" ${BASH_REMATCH[1]}${BASH_REMATCH[2]} " ; remote_file_type=" ${BASH_REMATCH[3]} " ; }
382+ if [[ " ${remote_line} " =~ href= \" ${__get_stage3_archive_regex} \" ]]; then
383+ max_cap=" ${# BASH_REMATCH[@]} "
384+ is_newer_stage3_date " ${remote_date} " " ${BASH_REMATCH[$((max_cap-3))]}${BASH_REMATCH[$((max_cap-2))]} " \
385+ && { remote_date=" ${BASH_REMATCH[$((max_cap-3))]}${BASH_REMATCH[$((max_cap-2))]} " ;
386+ remote_file_type=" ${BASH_REMATCH[$((max_cap-1))]} " ; }
387+ break
385388 fi
386389 done
387390 [[ " ${remote_date// [!0-9]/ } " -eq 0 ]] && return 3
You can’t perform that action at this time.
0 commit comments