Skip to content

Commit

Permalink
repro: Ensure we are checking for bootstrap ending with gz or zst
Browse files Browse the repository at this point in the history
Signed-off-by: Morten Linderud <[email protected]>
  • Loading branch information
Foxboron committed May 2, 2024
1 parent 1b17527 commit 7b770b7
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions repro.in
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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__
Expand Down

0 comments on commit 7b770b7

Please sign in to comment.