apt-delay, or stop beeing tired waiting for apt beeing so slow !
The discussion about hooks in dpkg able to run some kind of commands (ldconfig, update-menus, …) occured more than once on the list. I've grown tired of many of the packages upgrades that wanted to rebuild my initrd's three time in a round, or to the incessant fc-cache runs, and so on.
So I've hacked a tool called apt-delay, that achieves that, through some hacky $PATH manipulations, diverts some commands to very small ones that just record that they have been called, and then an apt DPkg::Post-Invoke command lists all of them, and run them at the end of each dpkg round.
Even it may look ugly, it's very small, sloccount says:
ansic: 548 (91.79%) sh: 49 (8.21%)
It now only deals with update-initramfs, ldconfig and update-menus, as a proof of concept.
You can try it yourself, you just need to:
$ git clone git://git.madism.org/apt-delay/
$ cd apt-delay
$ debuild # only needs debhelper
$ sudo dpkg -i ../apt-delay_0.0.1_${arch}.deb
and that's all.
You may want to tweak /etc/apt/apt.conf.d/99apt-delay and use /usr/lib/apt-delay/post-invoke -d that will enable some debug output, so that you can see at each apt run what has been delayed or not.
Please remember that this is a proof of concept (even if it should not harm your computer, it may have problems, or even be broken sometimes ;P)
Comments, thoughs, ideas are obviously welcomed.
