根据手册页:
apt 有参数 full-upgradeapt-get有参数dist-upgrade。两者是同一个命令吗?
顺便说一句:这是 Ubuntu 16.04 中官方推荐的命令?apt或者apt-get?
sch*_*hod 52
apt full-upgrade执行与 相同的功能apt-get dist-upgrade。
男人
full-upgrade (apt-get(8)) 执行升级功能,但如果需要将当前安装的软件包作为整体升级,则会删除当前安装的软件包。
人 apt-get
dist-upgrade 除了执行升级功能外,还智能处理新版本包的依赖变化;apt-get 有一个“智能”的冲突解决系统,它会在必要时尝试升级最重要的软件包,而牺牲不太重要的软件包。因此 dist-upgrade 命令可能会删除一些软件包。/etc/apt/sources.list 文件包含从中检索所需包文件的位置列表。另请参阅 apt_preferences(5) 以了解覆盖单个包的常规设置的机制。
ber*_*nie 13
是的,它们是相同的命令。aptcmdline/apt.cc 源文件的这一部分证明了这一点:
static std::vector<aptDispatchWithHelp> GetCommands() /*{{{*/
{
return {
// [snip]
// system wide stuff
{"update", &DoUpdate, _("update list of available packages")},
{"upgrade", &DoUpgrade, _("upgrade the system by installing/upgrading packages")},
{"full-upgrade", &DoDistUpgrade, _("upgrade the system by removing/installing/upgrading packages")},
// misc
{"edit-sources", &EditSources, _("edit the source information file")},
{"moo", &DoMoo, nullptr},
// for compat with muscle memory
{"dist-upgrade", &DoDistUpgrade, nullptr},
// [snip]
};
}
Run Code Online (Sandbox Code Playgroud)
为了完整性,cmdline/apt-get.cc:
static std::vector<aptDispatchWithHelp> GetCommands() /*{{{*/
{
return {
// [snip]
{"dist-upgrade", &DoDistUpgrade, _("Distribution upgrade, see apt-get(8)")},
{"full-upgrade", &DoDistUpgrade, nullptr},
// [snip]
};
}
Run Code Online (Sandbox Code Playgroud)
对于两者apt和apt-get,full-upgrade并且dist-upgrade两者都指代相同的DoDistUpgrade功能,因此做完全相同的事情。
我首先发布此信息是为了在编辑中补充 schod 的答案,但它被拒绝了,所以我自己回答...
小智 6
使用 apt 作为首选,但如果您正在编写脚本,请使用 apt-get。apt-get 具有更稳定的输出(这意味着输出格式尽可能保持不变,以免破坏自动解析输出的脚本)。apt-get 还有一些 apt 中不可用的低级命令。
apt 和 apt-get 的手册页对 full-upgrade 和 dist-upgrade 的描述略有不同,但它们可能是相同的命令(apt 接受 dist-upgrade 作为 full-upgrade 的别名)。这是 apt-get 稳定性的一个很好的例子。在 apt 中,名称被更改为更加用户友好,而在 apt-get 中,名称保持不变,以免破坏与旧脚本的兼容性。
| 归档时间: |
|
| 查看次数: |
114573 次 |
| 最近记录: |