How can I run a command before apt-get starts to download a package?
I know about the dpkg pre-invoke hook ( hook a script to apt-get ), but that seems to be run after the download.
$ apt-get update Get: 11 http://security.debian.org/ wheezy/updates/main qemu amd64 1.1.2+dfsg-6a+deb7u7 [115 kB] Fetched 70.9 MB in 10s (6,776 kB/s) refreshing freenet index --2015-05-19 15:55:25-- http://127.0.0.1:8888/freenet:USK@oRy7ltZLJM-w-kcOBdiZS1pAA8P-BxZ3BPiiqkmfk0E,6a1KFG6S-Bwp6E-MplW52iH~Y3La6GigQVQDeMjI6rg,AQACAAE/deb.mempo.org/-42/
What we need is to run a command before the download. More exactly: The script must run after calling apt-get but before apt-get accesses any online resource.
Is there something like a Pre-Download hook?
It is important that the installation can be done without having to replace the script apt-get (and without doing anything else which could be undone by an update).