mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-09-08 22:04:10 +07:00
Add fallback cache for keys in ppa.sh
This commit is contained in:
@ -66,10 +66,14 @@ update_lists() {
|
|||||||
|
|
||||||
# Function to get fingerprint from an Ubuntu PPA.
|
# Function to get fingerprint from an Ubuntu PPA.
|
||||||
ubuntu_fingerprint() {
|
ubuntu_fingerprint() {
|
||||||
ppa=$1
|
ppa="$1"
|
||||||
get -s -n "" "${lp_api[@]/%//~${ppa%/*}/+archive/${ppa##*/}}" | jq -r '.signing_key_fingerprint'
|
ppa_uri="~${ppa%/*}/+archive/ubuntu/${ppa##*/}"
|
||||||
|
get -s -n "" "${lp_api[0]}/$ppa_uri" | jq -er '.signing_key_fingerprint' 2>/dev/null \
|
||||||
|
|| get -s -n "" "${lp_api[1]}/$ppa_uri" | jq -er '.signing_key_fingerprint' 2>/dev/null \
|
||||||
|
|| get -s -n "" "$ppa_sp/keys/$ppa.fingerprint"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Function to get fingerprint from a Debian PPA.
|
# Function to get fingerprint from a Debian PPA.
|
||||||
debian_fingerprint() {
|
debian_fingerprint() {
|
||||||
ppa=$1
|
ppa=$1
|
||||||
@ -93,6 +97,7 @@ add_key() {
|
|||||||
sks_params="op=get&options=mr&exact=on&search=0x$fingerprint"
|
sks_params="op=get&options=mr&exact=on&search=0x$fingerprint"
|
||||||
key_urls=("${sks[@]/%/\/pks\/lookup\?"$sks_params"}")
|
key_urls=("${sks[@]/%/\/pks\/lookup\?"$sks_params"}")
|
||||||
fi
|
fi
|
||||||
|
key_urls+=("$ppa_sp/keys/$ppa.gpg")
|
||||||
[ ! -e "$key_source" ] && get -q -n "$key_file" "${key_urls[@]}"
|
[ ! -e "$key_source" ] && get -q -n "$key_file" "${key_urls[@]}"
|
||||||
if [[ "$(file "$key_file")" =~ .*('Public-Key (old)'|'Secret-Key') ]]; then
|
if [[ "$(file "$key_file")" =~ .*('Public-Key (old)'|'Secret-Key') ]]; then
|
||||||
sudo gpg --batch --yes --dearmor "$key_file" >/dev/null 2>&1 && sudo mv "$key_file".gpg "$key_file"
|
sudo gpg --batch --yes --dearmor "$key_file" >/dev/null 2>&1 && sudo mv "$key_file".gpg "$key_file"
|
||||||
|
Reference in New Issue
Block a user