![可以将 ppa 存储库添加到 /etc/apt/source.list 吗?](https://linux22.com/image/974565/%E5%8F%AF%E4%BB%A5%E5%B0%86%20ppa%20%E5%AD%98%E5%82%A8%E5%BA%93%E6%B7%BB%E5%8A%A0%E5%88%B0%20%2Fetc%2Fapt%2Fsource.list%20%E5%90%97%EF%BC%9F.png)
通过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
可以将 ppa 存储库添加到 /etc/apt/source.list 文件的末尾吗?
为什么 ppa 存储库与非 ppa 存储库的处理方式不同?
是否有其他非 ppa 存储库与 ppa 存储库处理方式类似?
是否会将
sudo add-apt-repository '<deb url codename component>'
ppa 存储库添加到 /etc/apt/source.list,或者添加到 /etc/apt/source.list.d 下的某些文件中?
答案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 的示例:
只是想让事情以某种方式轻松管理,
/etc/apt/source.list
只留下官方发布的存储库。所有其他存储库都归/etc/apt/source.list.d/
。易于:- 添加(创建文件然后编辑现有文件,这也是避免重复的部分解决方案)
- 删除(通过解析
/etc/apt/source.list
查看相关行) - 备份/恢复(使用
/etc/apt/source.list.d/
文件夹的压缩档案) - 避免因过多的编辑目标而破坏事物
/etc/apt/source.list
/etc/apt/source.list.d/
如果以表格形式写入,PPA 总是会被添加到文件夹中ppa:<user>/<ppa-name>
。参考:
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.
嗯,似乎只有 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])