From 7b770b73a2f478bc2f6da0d6f7f095e4ee1e79bf Mon Sep 17 00:00:00 2001 From: Morten Linderud Date: Thu, 2 May 2024 17:02:28 +0200 Subject: [PATCH] repro: Ensure we are checking for bootstrap ending with gz or zst Signed-off-by: Morten Linderud --- repro.in | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/repro.in b/repro.in index ac638d9..2f667fe 100755 --- a/repro.in +++ b/repro.in @@ -16,7 +16,7 @@ BUILDDIRECTORY=/var/lib/repro KEYRINGCACHE="${BUILDDIRECTORY}/keyring" BOOTSTRAPMIRROR="https://geo.mirror.pkgbuild.com/iso/latest" -readonly bootstrap_img=archlinux-bootstrap-"$(uname -m)".tar.gz +BOOTSTRAP_IMG=archlinux-bootstrap-"$(uname -m)".tar CONFIGDIR='REPRO_CONFIG_DIR' HOSTMIRROR="https://geo.mirror.pkgbuild.com/\$repo/os/\$arch" @@ -283,7 +283,21 @@ function init_chroot(){ # - with empty directory in the follow-up lock - if using test/mkdir/lock lock 9 "$BUILDDIRECTORY"/root.lock if [ ! -d "$BUILDDIRECTORY"/root ]; then - get_bootstrap_img + init_gnupg + + if ! compgen -G "$IMGDIRECTORY/$bootstrap_img"* > /dev/null; then + msg "Downloading bootstrap image..." + + for ext in zst gz; do + bootstrap_img="$BOOTSTRAP_IMG.$ext" + ( cd "$IMGDIRECTORY" && curl -f --remote-name-all "$BOOTSTRAPMIRROR/$bootstrap_img"{,.sig} ) + if ! gpg --verify "$IMGDIRECTORY/$bootstrap_img.sig" "$IMGDIRECTORY/$bootstrap_img"; then + error "Can't verify image" + exit 1 + fi + break + done + fi msg "Preparing chroot" trap '{ cleanup_root_volume; exit 1; }' ERR @@ -555,20 +569,6 @@ __END__ fi } -# Desc: Fetches a bootstrap image and verifies the signature -function get_bootstrap_img() { - init_gnupg - - if [ ! -e "$IMGDIRECTORY/$bootstrap_img" ]; then - msg "Downloading bootstrap image..." - ( cd "$IMGDIRECTORY" && curl -f --remote-name-all "$BOOTSTRAPMIRROR/$bootstrap_img"{,.sig} ) - if ! gpg --verify "$IMGDIRECTORY/$bootstrap_img.sig" "$IMGDIRECTORY/$bootstrap_img"; then - error "Can't verify image" - exit 1 - fi - fi -} - # Desc: Prints the help section function print_help() { cat <<__END__