Wednesday, May 9, 2018

Configure APT to also cache all dependencies of a package?


I want to know if there is a way to configure APT to also download all the dependencies (as deep as the dependency spiral goes) of a package and cache them in /var/cache/apt/archives.


EDIT:
It seems that using apt instead of apt-get causes no caches to be downloaded. Can anybody confirm this please?




WHAT I TRIED:


I tried installing texlive-full with --install-recommends and saw that there are 155 packages to install but APT only cached texlive-full.deb.


Possible solutions:



  1. Ask apt to install all those 155 packages which would cause them all to be cached. But this works only for dependencies that are one level deep.


  2. Use apt-rdepends:

    apt-get --print-uris --yes -d --reinstall install "$1" | grep "http://" | awk '{print$1}' | xargs -I'{}' echo {} | tee "$2"

    This spits out the url of all dependencies of given packages ($1) to a file ($2) which can then be input to wget.



Although 2 is the most feasible solution, it costs me bandwidth by having to download packages twice. And I don't want to create a local apt-mirror using apt-mirror.



This is likely the easiest method:


apt download $(apt-rdepends |grep -v "^ ")

No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...