For very few packages I'd like to know after an apt-get update if a newer version is available, is there already some option to do that?
I'm thinking about using apt.conf and Post-Invoke but done nothing yet.
You could use apt-show-versions (in the package with the same name); running
apt-show-versions -u will list all the packages installed on your system for which a newer version is available (using apt's database, so you need to run apt-get update as you mention).
You can list packages as arguments to apt-show-versions to limit the list to those packages only; thus, running
apt-show-versions -u ${YOUR_WATCHED_PACKAGES} after apt-get update will show you the information you're after. You could automate that using Post-Invoke as you mention.
One simple way would be to run:
apt-get -s --only-upgrade install package1 package2 ... You could put that in a script that builds the package list from a file, runs apt-get update and then the command above.
So, I ended up with the thing below for now, it seems to work, would have been nice if -u supported more packages, watching many may become slow.
/etc/apt/watch a text file with one package name for line (# comments supported)
/usr/local/bin/apt-watch.sh:
#!/bin/sh test -f /etc/apt/watch || exit 0 apt-show-versions -u $(grep -v ^# /etc/apt/watch) >/tmp/apt.watch if [ $(cat /tmp/apt.watch | wc -l) -gt 0 ] ; then cat /tmp/apt.watch | mail root -s '[apt watch] upgrades available' fi /etc/apt/apt.conf.d/99-apt-watch:
# check upgrades avaiable for watched packages APT::Update::Post-Invoke { "[ ! -x /usr/local/bin/apt-watch.sh ] || /usr/local/bin/apt-watch.sh || true"; }; apt-show-versions's command line; so apt-show-versions -u $(grep -v ^# /etc/apt/watch) should work... -u with multiple packages, perhaps did something wrong, cool