仅当我在具有每月数据限制的手机上运行 apt update 时才获取差异?

仅当我在具有每月数据限制的手机上运行 apt update 时才获取差异?

我正在运行 Ubuntu 20.04。我通过手机连接到互联网,每月数据流量有限制。当我运行

apt update

它从存储库中获取了大约 60 MB 的数据。有没有办法只获取之前运行的之间的差异apt update

编辑:

sudo apt update 
Hit:1 http://archive.canonical.com/ubuntu focal InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-security InRelease [109 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-updates/main Sources [364 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates/multiverse Sources [9,912 B]
Get:8 http://archive.ubuntu.com/ubuntu focal-updates/restricted Sources [10.1 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal-updates/universe Sources [146 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [795 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/main Translation-en [192 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal-updates amd64 Contents (deb) [29.7 MB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [143 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/restricted Translation-en [21.3 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [736 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/universe Translation-en [152 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [16.9 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-updates/multiverse Translation-en [5,076 B]
Get:19 http://archive.ubuntu.com/ubuntu focal-security/universe Sources [42.9 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal-security/main Sources [122 kB]   
Get:21 http://archive.ubuntu.com/ubuntu focal-security/restricted Sources [8,960 B]
Get:22 http://archive.ubuntu.com/ubuntu focal-security/main amd64 Packages [480 kB]
Get:23 http://archive.ubuntu.com/ubuntu focal-security/main Translation-en [105 kB]
Get:24 http://archive.ubuntu.com/ubuntu focal-security amd64 Contents (deb) [23.6 MB]
Get:25 http://archive.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [120 kB]
Get:26 http://archive.ubuntu.com/ubuntu focal-security/restricted Translation-en [17.6 kB]
Get:27 http://archive.ubuntu.com/ubuntu focal-security/universe amd64 Packages [532 kB]
Get:27 http://archive.ubuntu.com/ubuntu focal-security/universe amd64 Packages [532 kB]
Get:28 http://archive.ubuntu.com/ubuntu focal-security/universe Translation-en [74.5 kB]

看看这些:

Get:12 http://archive.ubuntu.com/ubuntu focal-updates amd64 Contents (deb) [29.7 MB]

Get:24 http://archive.ubuntu.com/ubuntu focal-security amd64 Contents (deb) [23.6 MB]

答案1

正如@nobody 所暗示的,你正在下载的这些大文件来自apt-file。基于文档/etc/apt/apt.conf.d/50apt-file.conf,您可以通过修改文件并运行来进行配置/usr/share/doc/apt-file/examples/apt-file-2-update.sh

.deb从那里,你可以使用以下命令为这些文件设置本地缓存:

$ mkdir -p ~/.cache/apt-file ~/.config
$ touch ~/.cache/apt-file/dpkg-status
$ sed '/^Dir::State/ d; /^Dir::Cache/ d;' \
       /usr/share/doc/apt-file/examples/apt-file.conf \
       > ~/.config/apt-file.conf
$ cat <<EOF >> ~/.config/apt-file.conf
       Dir::State "$HOME/.cache/apt-file";
       Dir::Cache "$HOME/.cache/apt-file";
       Dir::State::status "$HOME/.cache/apt-file/dpkg-status";

从那里,您可以apt-file通过调用以下命令独立更新缓存apt

$ apt-file -c ~/.config/apt-file.conf update

这是直接从手册页,因此可能需要进行一些调整。

相关内容