3

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.

3 Answers 3

4

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.

0
0

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.

0

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"; }; 
2
  • 1
    You can specify multiple packages on apt-show-versions's command line; so apt-show-versions -u $(grep -v ^# /etc/apt/watch) should work... Commented Sep 6, 2015 at 12:42
  • @StephenKitt thanks, it does work, thought I had checked -u with multiple packages, perhaps did something wrong, cool Commented Sep 7, 2015 at 9:20

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.