@@ -8,6 +8,7 @@ EX_UNAVAILABLE=69
88verify-file () {
99 local sig=" $1 "
1010 local doc=" $2 "
11+ local keyid
1112
1213 # The GPG binary is required to be present in order to perform file download
1314 # verification. If it is not present, return EX_UNAVAILABLE.
@@ -19,8 +20,12 @@ verify-file() {
1920 # The verification key must be present, or it must be possible to download it
2021 # from the keyserver to perform file verification. If it is not present,
2122 # return EX_UNAVAILABLE.
22- if ! { gpg --list-keys " $PT_key_id " || gpg --keyserver " $PT_key_server " --recv-key " $PT_key_id " ; } then
23- echo " Unable to download verification key ${PT_key_id} "
23+ keyid=$( gpg --list-packets --with-colons " $sig " | awk ' /:signature packet:/{print $NF; exit 0}' )
24+ if [[ -z " $keyid " ]]; then
25+ echo " Unable to determine verification key from ${sig} "
26+ return " $EX_UNAVAILABLE "
27+ elif ! { gpg --list-keys " $keyid " || gpg --keyserver " $PT_key_server " --recv-key " $keyid " ; } then
28+ echo " Unable to download verification key ${keyid} "
2429 return " $EX_UNAVAILABLE "
2530 fi
2631
@@ -37,14 +42,15 @@ verify-file() {
3742download () {
3843 printf ' %s\n' " Downloading: ${1} "
3944 tmp_file=$( mktemp)
40- echo " Temporary file created at: ${tmp_file} "
45+ echo " Downloading to temporary file ${tmp_file} "
4146
4247 if curl -s -f -L -o ${tmp_file} " $1 " ; then
48+ echo " Moving ${tmp_file} to target path ${2} "
4349 mv " ${tmp_file} " " $2 "
4450 return 0
4551 else
4652 echo " Error: Curl has failed to download the file"
47- echo " Removing temporary file: ${tmp_file} "
53+ echo " Removing temporary file ${tmp_file} "
4854 rm " ${tmp_file} "
4955 return 1
5056 fi
0 commit comments