是否可以将PPA存储库添加到/etc/apt/source.list?


12

通过sudo add-apt-repository '<deb url codename component>',将存储库添加到/etc/apt/source.list文件。

通过sudo add-apt-repository ppa:<user>/<ppa-name>,我看到所有的ppa存储库都添加到了/etc/apt/source.list.d目录中:

$ ls /etc/apt/sources.list.d/
ferramroberto-sopcast-precise.list
ferramroberto-sopcast-precise.list.save
google-talkplugin.list
google-talkplugin.list.save
kalakris-okular-precise.list
kalakris-okular-precise.list.save
linrunner-thinkpad-extras-precise.list
linrunner-thinkpad-extras-precise.list.save
precise-partner.list
precise-partner.list.save
staticfloat-julia-deps-precise.list
staticfloat-juliareleases-precise.list
staticfloat-juliareleases-precise.list.save
telepathy-ppa-precise.list
telepathy-ppa-precise.list.save
ubuntu-wine-ppa-precise.list
ubuntu-wine-ppa-precise.list.save
venerix-blug-precise.list
venerix-blug-precise.list.save
  1. 可以将ppa存储库添加到/etc/apt/source.list文件的末尾吗?

  2. 为什么对PPA存储库与非PPA存储库的处理方式不同?

  3. 是否有其他与ppa类似的非ppa存储库?

  4. sudo add-apt-repository '<deb url codename component>'PPA存储库添加到/etc/apt/source.list或/etc/apt/source.list.d下的某些文件吗?

Answers:


11
  1. 是的,可以将PPA添加到中/etc/apt/source.list,类似于debian(deb)信息库。

    deb http://ppa.launchpad.net/<ppa-name>/ppa/ubuntu <release-code-name> main 
    deb-src http://ppa.launchpad.net/<ppa-name>/ppa/ubuntu <release-code-name> main
    

    WineHq的示例: ppa debian存储库链接

  2. 思想只是使事情易于管理,/etc/apt/source.list仅留给官方发布存储库。所有其他存储库都转到/etc/apt/source.list.d/。便于:

    1. 添加(创建文件然后编辑现有文件,这也是避免重复的部分解决方案)
    2. 删除(解析/etc/apt/source.list相关行的外观)
    3. 备份/还原(使用文件/etc/apt/source.list.d/夹的压缩存档)
    4. 避免以大量修改为目标破坏事物 /etc/apt/source.list
  3. /etc/apt/source.list.d/如果以ppa:<user>/<ppa-name>表格形式编写,PPA总是添加到文件夹中。

    参考: man add-apt-repository

    REPOSITORY STRING
           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.
    
  4. 好吧,捷径似乎只有PPA /etc/apt/sources.list.d/add-apt-repository或者apt-add-repository是Ubuntu专用工具。我能想到的只是Ubuntu决定保留个人PPA的决定。

    但是,您可以将其修改为仅使用/etc/apt/sources.list。这是一个python3脚本。修改/usr/bin/add-apt-repository行:

    shortcut = shortcut_handler(line)
    

    将其替换为下面的内容,以将ppa快捷方式表单解析为deb线形式:

    shortcut = shortcut_handler(shortcut_handler(line).expand(sp.distro.codename)[0])
    

请注意,奇怪的是,非PPA仓库会添加到中/etc/apt/sources.list
saiarcot895 2014年

1
@ saiarcot895,我认为这add-apt-repository是为了简化PPA的工作而写的,第一名。这里是提交时的提交说明:“ 新的帮助程序脚本“ add-apt-repository”,可用于从命令行启用存储库。对于例如“ add-apt-repository ppa:gnome-desktop”有用bazaar.launchpad.net/~ubuntu-core-dev/software-properties/main/…– user.dz 2014
08
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.