050checkinst: No dependencies on gettext and/or generated locale
[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 packages=`tempfile`
9 cache=`tempfile`
10 trap "rm -f $packages $locs" INT EXIT
11
12 cd $topdir
13 dpkg-checkbuilddeps >> $packages 2>&1
14
15 if [ -n "$cachedir" ]
16 then
17     if [ ! -d "$cachedir" ]
18     then
19         echo "cachedir missing." >> $cache
20     else
21         perm=$(ls -ld "$cachedir" | perl -ne 'print "ok" if /^drwxrws--- \d+ www-data/')
22         if [ -z "$perm" ]
23         then
24             echo "cachedir has wrong permissions." >> $cache
25             echo "make sure it is writable by the web server." >> $cache
26         fi
27     fi
28 fi
29
30 if [ -s $packages -o -s $cache ]
31 then
32     (
33         echo "Subject: Problem packages.debian.org on `hostname -s`"
34         echo "To: ${admin_email}"
35         echo
36         echo "On host `hostname -f`"
37         echo
38         if [ -s $packages ]
39         then
40             echo "Missing packages:"
41             echo
42             cat $packages
43         fi
44         if [ -s $locs ]
45         then
46             echo "Missing locales:"
47             echo
48             cat $locs
49         fi
50         if [ -s $cache ]
51         then
52             echo "Problems with cachedir:"
53             echo
54             cat $cache
55         fi
56     ) | tee /dev/stderr | /usr/sbin/sendmail -t
57 fi