]> git.deb.at Git - deb/packages.git/blob - cron.d/050checkinst
050checkinst: Use dpkg-checkbuilddeps to test for missing packages
[deb/packages.git] / cron.d / 050checkinst
1 #! /bin/sh
2
3 . `dirname $0`/../config.sh
4
5 # Test whether all required packages are installed and generate a mail
6 # if they aren't, so that the admin is informed.
7
8 locales="de_DE.UTF-8 en_US.UTF-8 nl_NL fr_FR.UTF-8 uk_UA.UTF-8"
9
10 packages=`tempfile`
11 locs=`tempfile`
12 cache=`tempfile`
13 trap "rm -f $packages $locs" INT EXIT
14
15 cd $topdir
16 dpkg-checkbuilddeps >> $packages 2>&1
17
18 for l in $locales
19 do
20     if ! grep -q "^$l" /etc/locale.gen
21     then
22         echo "Locale $l missing." >> $locs
23         echo >> $locs
24     fi
25 done
26
27 if [ -n "$cachedir" ]
28 then
29     if [ ! -d "$cachedir" ]
30     then
31         echo "cachedir missing." >> $cache
32     else
33         perm=$(ls -ld "$cachedir" | perl -ne 'print "ok" if /^drwxrws--- \d+ www-data/')
34         if [ -z "$perm" ]
35         then
36             echo "cachedir has wrong permissions." >> $cache
37             echo "make sure it is writable by the web server." >> $cache
38         fi
39     fi
40 fi
41
42 if [ -s $packages -o -s $locs -o -s $cache ]
43 then
44     (
45         echo "Subject: Problem packages.debian.org on `hostname -s`"
46         echo "To: ${admin_email}"
47         echo
48         echo "On host `hostname -f`"
49         echo
50         if [ -s $packages ]
51         then
52             echo "Missing packages:"
53             echo
54             cat $packages
55         fi
56         if [ -s $locs ]
57         then
58             echo "Missing locales:"
59             echo
60             cat $locs
61         fi
62         if [ -s $cache ]
63         then
64             echo "Problems with cachedir:"
65             echo
66             cat $cache
67         fi
68     ) | /usr/sbin/sendmail -t
69 fi
70