5 # Simple wrapper script for cron to use - check for updated packages
6 # and mail admin with any recommended upgrades.
8 # Assumes that apt is configured correctly before we start...
10 # Steve McIntyre 26/09/2001
16 TMPFILE=/etc/apt/update.tmp
18 . /etc/apt/update.conf
20 for CHROOT in $CHROOTS
22 if [ $CHROOT = / ] ; then
27 $CHR apt-get update > $TMPFILE 2>&1
29 if [ $error -ne 0 ] ; then
30 echo $CHR update failed with error $error
33 # And also check for warnings:
35 if [ $? -eq 0 ] ; then
36 echo "$CHR update gave the following warnings:"
41 THIS_LIST=`$CHR apt-get -s -u dist-upgrade | awk '/^Inst/ {print $2}'`
42 if [ "$THIS_LIST"x != ""x ] ; then
43 UPDATE_LIST="$UPDATE_LIST\n$CHROOT:\n"
46 UPDATE_LIST="$UPDATE_LIST $PKG\n"
48 CHROOT_UPDATED="$CHROOT_UPDATED $CHROOT"
52 if [ "$UPDATE_LIST"x != ""x ] ; then
53 # If we've been configured to download packages, grab them now
55 if [ "$DOWNLOAD_DEBS"x = "yes"x ] ; then
56 for CHROOT in $CHROOT_UPDATED
58 if [ $CHROOT = / ] ; then
63 $CHR apt-get -d -y dist-upgrade > /dev/null
65 if [ $error -ne 0 ] ; then
66 echo $CHR package download failed with error $error
69 UPDATE_LIST="$UPDATE_LIST\n\nPackage(s) downloaded and ready to install\n"
72 printf "$UPDATE_LIST\n"