“ppa-purge”和“add-apt-repository -r”之间的区别?

ppa-purgeadd-apt-repository -r之间的主要区别是什么。 哪一个更好的清除剩余项目和使用一个在另一个上的原因? add-apt-repository -r应该做ppa-purge吗?

编辑:还要从apt的密钥环中删除密钥吗?

根据我的理解,区别在于他们删除PPA 所做的事情。

ppa-purge – 禁用PPA并恢复到官方软件包(如果适用)。 例如,如果我添加了xorg-edgers PPA并安装了Nvidia驱动程序,如果我对所述PPA执行ppa-purge ,它不仅会禁用xorg-edgers PPA,还会还原PPA中的NVIDIA驱动程序在官方Ubuntu存储库中找到的官方文件。

add-apt-repository -r – 只删除所说的PPA。 不会还原任何包。

案例场景可能是:

  • 如果您想从PPA保留包裹但想要删除实际的PPA。 例如,如果你想从PPA添加Ubuntu Tweak Package但是想要删除PPA,你可以使用add-apt-repository来安装Ubuntu Tweak。

  • 当你想回到官方软件包并停止使用具有更新/实验包的PPA时(如内核版本软件包,专有软件包……)。 在这种情况下,您可能希望使用ppa-purge,假设您的目的是返回官方版本。 这与删除安装的每个PPA包然后执行以下操作相同:

     sudo apt-get update sudo apt-get upgrade sudo apt-get install PACKAGES 

对于大多数情况, add-apt-repository应该足以添加和删除PPA。 使用ppa-purge只能帮助您实际删除软件包并安装不常见的官方版本的小案例,因为大多数用户添加PPA以获得比Ubuntu附带的更好的东西。 例如kazam(来自Kazam PPA),专有video驱动程序(来自swat-x或xorg-edgers PPA),甚至谷歌Chrome和VirtualBox。 即使他们删除它,只有2或3个命令从已删除的PPA中删除当前包并安装官方包。

考虑到所有这些,它只是归结为用户想要对PPA相关的包进行的操作。

apt-add-repository页说明了这个命令:

  REPOSITORY can be either a line that can be added directly to sources.list(5), in the form ppa:/ for adding Personal Package Archives, or a distribution component to enable. In the first form, REPOSITORY will just be appended to /etc/apt/sources.list. In the second form, ppa:/ will be expanded to the full deb line of the PPA and added into a new file in the /etc/apt/sources.list.d/ directory. The GPG public key of the newly added PPA will also be downloaded and added to apt's keyring. In the third form, the given distribution component will be enabled for all sources. 

和:

 -r, --remove Remove the specified repository 

所以add-apt-repository只是添加和删除/etc/apt/sources.list/etc/apt/sources.list.d/中的行。

ppa-purge页说:

 NAME ppa-purge - disables a PPA and reverts to official packages DESCRIPTION This script provides a bash shell script capable of automatically downgrading all packages in a given PPA back to the ubuntu versions. You have to run it using root privileges because of the package manager. 

因此, ppa-purge不仅会删除PPA,还会将任何软件包降级回其默认版本。 这在测试beta或更新版本的软件时很有用。