如何获取一个 deb 包依赖项的所有 URL?

如何获取一个 deb 包依赖项的所有 URL?

我想检查是否可以列出指定系统所需的所有依赖项的 URL。

假设我想安装一个软件,它依赖于 100 多个单独的包,而我需要获取几十个这样的包。碰巧我处于一个限制性代理(当然是地狱)内,它要求我指定我需要访问的每个 URL。

我发现我可以使用 apt-rdepends 来获取依赖包的列表。但是我如何获取正确到 URL 的依赖项(假设 *.ubuntu.com 没问题)

答案1

您可以使用 apt-get 和--print-uris显示 URI 的选项:

sudo apt-get --print-uris install geany
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  geany-common
Suggested packages:
  libvte9
The following NEW packages will be installed:
  geany geany-common
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,242 kB of archives.
After this operation, 8,894 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
'http://archive.ubuntu.com/ubuntu/pool/universe/g/geany/geany-common_1.22+dfsg-2ubuntu1_all.deb' geany-common_1.22+dfsg-2ubuntu1_all.deb 2153292 MD5Sum:e7dc7ca72d4e3b27ebfeadaea9fb3289
'http://archive.ubuntu.com/ubuntu/pool/universe/g/geany/geany_1.22+dfsg-2ubuntu1_amd64.deb' geany_1.22+dfsg-2ubuntu1_amd64.deb 1089150 MD5Sum:e201bf70fc0ef23b0f64c410125814cb

这是最简单的方法,无需安装任何额外的东西。

apt-get man 摘录:

--print-uris
       Instead of fetching the files to install their URIs are printed. Each URI will have the path, the
       destination file name, the size and the expected MD5 hash. Note that the file name to write to
       will not always match the file name on the remote site! This also works with the source and update
       commands. When used with the update command the MD5 and size are not included, and it is up to the
       user to decompress any compressed files. Configuration Item: APT::Get::Print-URIs.

相关内容