Skip to content

Commit 6e8cee9

Browse files
committed
Merge branch 'morten/fix-download'
* morten/fix-download: repro: Ensure we are checking for bootstrap ending with gz or zst
2 parents 1b17527 + 7b770b7 commit 6e8cee9

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

repro.in

+16-16
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ BUILDDIRECTORY=/var/lib/repro
1616
KEYRINGCACHE="${BUILDDIRECTORY}/keyring"
1717

1818
BOOTSTRAPMIRROR="https://geo.mirror.pkgbuild.com/iso/latest"
19-
readonly bootstrap_img=archlinux-bootstrap-"$(uname -m)".tar.gz
19+
BOOTSTRAP_IMG=archlinux-bootstrap-"$(uname -m)".tar
2020
CONFIGDIR='REPRO_CONFIG_DIR'
2121

2222
HOSTMIRROR="https://geo.mirror.pkgbuild.com/\$repo/os/\$arch"
@@ -283,7 +283,21 @@ function init_chroot(){
283283
# - with empty directory in the follow-up lock - if using test/mkdir/lock
284284
lock 9 "$BUILDDIRECTORY"/root.lock
285285
if [ ! -d "$BUILDDIRECTORY"/root ]; then
286-
get_bootstrap_img
286+
init_gnupg
287+
288+
if ! compgen -G "$IMGDIRECTORY/$bootstrap_img"* > /dev/null; then
289+
msg "Downloading bootstrap image..."
290+
291+
for ext in zst gz; do
292+
bootstrap_img="$BOOTSTRAP_IMG.$ext"
293+
( cd "$IMGDIRECTORY" && curl -f --remote-name-all "$BOOTSTRAPMIRROR/$bootstrap_img"{,.sig} )
294+
if ! gpg --verify "$IMGDIRECTORY/$bootstrap_img.sig" "$IMGDIRECTORY/$bootstrap_img"; then
295+
error "Can't verify image"
296+
exit 1
297+
fi
298+
break
299+
done
300+
fi
287301

288302
msg "Preparing chroot"
289303
trap '{ cleanup_root_volume; exit 1; }' ERR
@@ -555,20 +569,6 @@ __END__
555569
fi
556570
}
557571

558-
# Desc: Fetches a bootstrap image and verifies the signature
559-
function get_bootstrap_img() {
560-
init_gnupg
561-
562-
if [ ! -e "$IMGDIRECTORY/$bootstrap_img" ]; then
563-
msg "Downloading bootstrap image..."
564-
( cd "$IMGDIRECTORY" && curl -f --remote-name-all "$BOOTSTRAPMIRROR/$bootstrap_img"{,.sig} )
565-
if ! gpg --verify "$IMGDIRECTORY/$bootstrap_img.sig" "$IMGDIRECTORY/$bootstrap_img"; then
566-
error "Can't verify image"
567-
exit 1
568-
fi
569-
fi
570-
}
571-
572572
# Desc: Prints the help section
573573
function print_help() {
574574
cat <<__END__

0 commit comments

Comments
 (0)