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

Ali*_*rld 43 ppa add-apt-repository

ppa-purge和之间的主要区别是什么add-apt-repository -r。哪一个更好地清除剩余项目和使用一个的理由?是否add-apt-repository -r应该做些什么ppa-purge呢?

编辑:还要从 apt 的钥匙圈中删除钥匙吗?

Lui*_*ado 54

据我了解,不同之处在于他们删除 PPA所做的工作。

ppa-purge - 禁用 PPA 并在适用时恢复为官方软件包。例如,如果我添加了 xorg-edgers PPA 并安装了 Nvidia 驱动程序,如果我ppa-purge在上述 PPA 上执行一个操作,它不仅会禁用 xorg-edgers PPA,还会将 NVIDIA 驱动程序从 PPA 中的驱动程序恢复为官方驱动程序在官方 Ubuntu 存储库中找到的。

add-apt-repository -r - 只会删除上述 PPA。不会还原任何包。

案例场景可能是:

  • 当您想要保留 PPA 中的包但想要删除实际 PPA 时。例如,如果您想从 PPA 添加 Ubuntu Tweak 包,但随后又想删除 PPA,您可以使用add-apt-repository,这将保留 Ubuntu Tweak 的安装。

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

    sudo apt-get update  
    sudo apt-get upgrade
    sudo apt-get install PACKAGES
    
    Run Code Online (Sandbox Code Playgroud)

在大多数情况下,add-apt-repository应该足以添加和删除 PPA。使用ppa-purge只能在您想要实际删除软件包并安装正式版本的小情况下有所帮助,这并不常见,因为大多数用户添加 PPA 以获得比 Ubuntu 附带的更好的东西。像 kazam(来自 Kazam PPA)、专有视频驱动程序(来自 swat-x 或 xorg-edgers PPA),甚至是 Google Chrome 和 VirtualBox 等。即使他们删除了它,也只需 2 或 3 个命令即可从已删除的 PPA 中删除当前包并安装官方包。

考虑到所有这些,它只是归结为用户想要对与 PPA 相关的包做什么。


Set*_*eth 12

apt-add-repository手册页说,这对命令:

   REPOSITORY can  be  either  a  line  that  can  be  added  directly  to
   sources.list(5),  in the form ppa:<user>/<ppa-name> 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:<user>/<ppa-name> 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.  
Run Code Online (Sandbox Code Playgroud)

和:

-r, --remove Remove the specified repository  
Run Code Online (Sandbox Code Playgroud)

所以,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.  
Run Code Online (Sandbox Code Playgroud)

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