Skip to content

Commit 317a051

Browse files
committed
Add fallback cache for keys in ppa.sh
1 parent dfcda83 commit 317a051

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/scripts/tools/ppa.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,14 @@ update_lists() {
6666

6767
# Function to get fingerprint from an Ubuntu PPA.
6868
ubuntu_fingerprint() {
69-
ppa=$1
70-
get -s -n "" "${lp_api[@]/%//~${ppa%/*}/+archive/${ppa##*/}}" | jq -r '.signing_key_fingerprint'
69+
ppa="$1"
70+
ppa_uri="~${ppa%/*}/+archive/ubuntu/${ppa##*/}"
71+
get -s -n "" "${lp_api[0]}/$ppa_uri" | jq -er '.signing_key_fingerprint' 2>/dev/null \
72+
|| get -s -n "" "${lp_api[1]}/$ppa_uri" | jq -er '.signing_key_fingerprint' 2>/dev/null \
73+
|| get -s -n "" "$ppa_sp/keys/$ppa.fingerprint"
7174
}
7275

76+
7377
# Function to get fingerprint from a Debian PPA.
7478
debian_fingerprint() {
7579
ppa=$1
@@ -93,6 +97,7 @@ add_key() {
9397
sks_params="op=get&options=mr&exact=on&search=0x$fingerprint"
9498
key_urls=("${sks[@]/%/\/pks\/lookup\?"$sks_params"}")
9599
fi
100+
key_urls+=("$ppa_sp/keys/$ppa.gpg")
96101
[ ! -e "$key_source" ] && get -q -n "$key_file" "${key_urls[@]}"
97102
if [[ "$(file "$key_file")" =~ .*('Public-Key (old)'|'Secret-Key') ]]; then
98103
sudo gpg --batch --yes --dearmor "$key_file" >/dev/null 2>&1 && sudo mv "$key_file".gpg "$key_file"

0 commit comments

Comments
 (0)