# $1 should be URL to compressed tarball for which .DIGEST.asc file exists #setopt warncreateglobal local destdir digest_uri digest metalink local -a files destdir=${2:-.} digest_uri=${1}.DIGESTS.asc #digest_uri=$( ${0:h}/resolve_txt_uri $1 ).DIGESTS.asc || exit $? digest=$( wget -q -O - $digest_uri ) || return $? gpg --verify --batch <<<$digest || return $? digest=$( sed -n '/^-----BEGIN PGP SIGNED MESSAGE-----$/,/^-----BEGIN PGP SIGNATURE-----$/p' <<<$digest ) || return $? files=( $( gawk <<<$digest -f $FSB_SCRIPTS_DIR/list_digest_files.awk | grep -Ee '\.tar(\.(gz|bz2|lzma|xz))?$' ) ) if [[ $#files != 1 ]]; then fsb_error "got $#files tarballs inside digest, one expected" return 1 fi metalink=$( gawk -v urls=${digest_uri:h} -f $FSB_SCRIPTS_DIR/digest_to_metalink.awk <<<$digest ) || return $? aria2c --check-integrity=true \ --continue=true \ --dir=$destdir \ -l /dev/stderr \ --quiet=true \ --log-level=notice \ -M - <<<$metalink || return $? echo ${destdir}/${files}