@@ -29,21 +29,21 @@ get() {
2929 fi
3030}
3131
32+ ubuntu_fingerprint () {
33+ local ppa=$1
34+ ppa_uri=" ~${ppa%/* } /+archive/ubuntu/${ppa##*/ } "
35+ get -s " " " ${lp_api[0]} /$ppa_uri " | jq -er ' .signing_key_fingerprint' 2> /dev/null \
36+ || get -s " " " ${lp_api[1]} /$ppa_uri " | jq -er ' .signing_key_fingerprint' 2> /dev/null \
37+ || get -s " " " $ppa_sp /keys/$ppa .fingerprint"
38+ }
39+
3240get_launchpad_key () {
33- local pa =$1
41+ local ppa =$1
3442 local key_file=$2
35- sks=(
36- ' https://keyserver.ubuntu.com'
37- ' https://pgp.mit.edu'
38- ' https://keys.openpgp.org'
39- )
40- lp_api=(
41- ' https://api.launchpad.net/1.0'
42- ' https://api.launchpad.net/devel'
43- )
44- fingerprint=" $( get -s " " " ${lp_api[@]/%// ~${ppa%/* } / +archive/ ubuntu/ ${ppa##*/ } } " | jq -r ' .signing_key_fingerprint' ) "
43+ fingerprint=" $( " ${ID} " _fingerprint " $ppa " ) "
4544 sks_params=" op=get&options=mr&exact=on&search=0x$fingerprint "
4645 key_urls=(" ${sks[@]/%/ \/ pks\/ lookup\? " $sks_params " } " )
46+ key_urls+=(" $ppa_sp /keys/$ppa .gpg" )
4747 get -q " $key_file " " ${key_urls[@]} "
4848 if [[ " $( file " $key_file " ) " =~ .* (' Public-Key (old)' | ' Secret-Key' ) ]]; then
4949 gpg --batch --yes --dearmor " $key_file " && mv " $key_file " .gpg " $key_file "
@@ -62,8 +62,7 @@ add_ppa_helper() {
6262 echo " deb [arch=" $( dpkg --print-architecture) " signed-by=$key_file ] $ppa_url $VERSION_CODENAME $branches " | tee -a " $list_dir " /" ${ppa%%/* } " -" $ID " -" ${ppa#*/ } " -" $VERSION_CODENAME " .list
6363}
6464
65- add_ppa () {
66- . /etc/os-release
65+ add_ppa () {
6766 export _APTMGR=apt-get
6867 apt-get update && apt-get install -y curl sudo file jq gnupg
6968 add_ppa_helper apt-fast/stable main
@@ -77,4 +76,15 @@ add_ppa() {
7776 apt-get update
7877}
7978
79+ . /etc/os-release
80+ sks=(
81+ ' https://keyserver.ubuntu.com'
82+ ' https://pgp.mit.edu'
83+ ' https://keys.openpgp.org'
84+ )
85+ ppa_sp=' https://ppa.setup-php.com'
86+ lp_api=(
87+ ' https://api.launchpad.net/1.0'
88+ ' https://api.launchpad.net/devel'
89+ )
8090arch=$( dpkg --print-architecture)
0 commit comments