替换已弃用的“add-apt-repository ppa”的确切命令:/` 使用 gpg、curl 等

替换已弃用的“add-apt-repository ppa”的确切命令:/` 使用 gpg、curl 等

我明白那个add-apt-repository已被弃用因为它会全局添加 repo 密钥,而不是专门为需要它的包添加。但是,我在网上看到的示例并没有展示如何处理ppa:<username>/<package>

我可以看到什么命令(确切地)应该取代弃用的 apt-key?但是我从未使用过 apt-key,而且示例也没有显示如何处理 ppa 部分。

以下是现已过时的命令(openconnect 需要 vpnc,我认为它托管在同一个 ppa 下?):

apt update

apt install software-properties-common

add-apt-repository ppa:dwmw2/openconnect

apt install vpnc

apt install openconnect

如果我可以解压ppa:dwmw2/openconnect以单独下载密钥并添加存储库,我可以按照现有的说明分别进行替换apt-keyapt-add-repository并为所有其他存储库添加执行此操作。

子问题

add-apt-repository通过屏幕抓取来做到这一点https://launchpad.net/~dwmw2/+archive/ubuntu/openconnect

不,我仍然缺少关键块,因为当我这样做时:

curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.14 (GNU/Linux)

mQENBFI3HsoBCADXDtbNJnxbPqB1vDNtCsqhe49vFYsZN9IOZsZXgp7aHjh6CJBD
A+bGFOwyhbd7at35jQjWAw1O3cfYsKAmFy+Ar3LHCMkV3oZspJACTIgCrwnkic/9
CUliQe324qvObU2QRtP4Fl0zWcfb/S8UYzWXWIFuJqMvE9MaRY1bwUBvzoqavLGZ
j3SF1SPO+TB5QrHkrQHBsmX+Jda6d4Ylt8/t6CvMwgQNlrlzIO9WT+YN6zS+sqHd
1YK/aY5qhoLNhp9G/HxhcSVCkLq8SStj1ZZ1S9juBPoXV1ZWNbxFNGwOh/NYGldD
2kmBf3YgCqeLzHahsAEpvAm8TBa7Q9W21C8vABEBAAG0RUVsYXN0aWNzZWFyY2gg
KEVsYXN0aWNzZWFyY2ggU2lnbmluZyBLZXkpIDxkZXZfb3BzQGVsYXN0aWNzZWFy
Y2gub3JnPokBOA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StkIuWgR7U2r+a210W6vnUxU4oN0PmM
cursYPyeV0NX/KQeUeNMwGTFB6QHS/anRaGQewijkrYYoTNtfllxIu9XYmiBERQ/
qPDlGRlOgVTd9xUfHFkzB52c70E=
=92oX
-----END PGP PUBLIC KEY BLOCK-----

这种格式看起来不像

Signing key:
4096R/DBBE5FF954B458D1A0875E8A9FCCDFFB8838752F
Fingerprint:
DBBE5FF954B458D1A0875E8A9FCCDFFB8838752F

gpg --dearmor产生二进制输出: Dearmored Elastasearch GPG 密钥

哈哈!我想我至少在这里找到了部分答案: https://help.launchpad.net/Packaging/PPA/InstallingSoftware#On_older_.28pre_9.10.29_Ubuntu_systems

现在:

# apt update
...

# apt install gpg
...

# gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/openconnect.gpg --keyserver keyserver.ubuntu.com --recv-keys DBBE5FF954B458D1A0875E8A9FCCDFFB8838752F
gpg: keybox '/usr/share/keyrings/openconnect.gpg' created
gpg: /tmp/trustdb.gpg: trustdb created
gpg: key 9FCCDFFB8838752F: public key "Launchpad PPA for dwmw2" imported
gpg: Total number processed: 1
gpg:               imported: 1

# echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/openconnect.gpg] https://ppa.launchpadcontent.net/dwmw2/openconnect/ubuntu bionic main' >/etc/apt/sources.list.d/openconnect.list

# apt update
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease                                                      
Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease                                              
Ign:4 https://ppa.launchpadcontent.net/dwmw2/openconnect/ubuntu bionic InRelease                            
Hit:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease                                           
Err:6 https://ppa.launchpadcontent.net/dwmw2/openconnect/ubuntu bionic Release         
  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 185.125.190.52 443]
Reading package lists... Done                              
W: https://ppa.launchpadcontent.net/dwmw2/openconnect/ubuntu/dists/bionic/InRelease: No system certificates available. Try installing ca-certificates.
W: https://ppa.launchpadcontent.net/dwmw2/openconnect/ubuntu/dists/bionic/Release: No system certificates available. Try installing ca-certificates.
E: The repository 'https://ppa.launchpadcontent.net/dwmw2/openconnect/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

可以轻松修复: apt-get update 失败,因为 nodesource 上的握手失败导致证书验证失败

现在:

# apt update
Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://security.ubuntu.com/ubuntu bionic-security InRelease                                                                 
Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease                                             
Hit:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease                                           
Get:5 https://ppa.launchpadcontent.net/dwmw2/openconnect/ubuntu bionic InRelease [15.9 kB]                  
Get:6 https://ppa.launchpadcontent.net/dwmw2/openconnect/ubuntu bionic/main amd64 Packages [1437 B]
Fetched 17.3 kB in 1s (14.5 kB/s)  
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.

相关内容