Set up an MTA on your system if you haven't already, so that emails sent from the command line will work.
Install the bsd-mailx
package to give you a standard command mail
to send emails to the MTA from the command line.
Write a script as follows:
#!/bin/sh
mkdir -p ~/new-package-detector
cd ~/new-package-detector
apt-cache search .|awk '{print $1}'|sort|uniq > new-package-list
if [ -f old-package-list ]; then
comm -23 new-package-list old-package-list > new-in-repository
if [ -s new-in-repository ]; then
mail -s 'New packages available' int_ua@example.com < new-in-repository
fi
fi
mv new-package-list old-package-list
Then set up a cron job to run your script regularly. You might need to add an apt-get update
to the start of the script, too, in order to make sure that it happens before the check.
apt-get update
and I currenly see them only in Synaptic. But I want an automatic notification, not to check them manually. – int_ua Aug 08 '12 at 18:26