5 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/etc:/usr/etc:/usr/athena/bin:/usr/local/bin
8 if [ -d /var/athena ] && [ -w /var/athena ]; then
9 exec >/var/athena/moira_update.log 2>&1
11 exec >/tmp/moira_update.log 2>&1
14 # The following exit codes are defined and MUST BE CONSISTENT with
15 # error codes the library uses:
17 MR_MISSINGFILE=47836473
20 root=/usr/local/sendmail
22 if [ -s $root/etc/access.new ]; then
23 cp /dev/null $root/etc/access.tmp
25 if [ -s $root/etc/efl-access ]; then
26 cat $root/etc/efl-access >> $root/etc/access.tmp
29 cat $root/etc/access.new >> $root/etc/access.tmp
30 mv $root/etc/access.tmp $root/etc/access.new
31 chmod 644 $root/etc/access.new
36 if [ ! -s $root/etc/access ]; then
37 logger -p mail.error -t access.sh "No current access file, aborting."
41 # Play it safe and be sure we have reasonable data
42 olines=`wc -l $root/etc/access | awk '{print $1}'`
43 nlines=`wc -l $root/etc/access.new | awk '{print $1}'`
44 diff=`expr $nlines - $olines`
45 thresh=`expr $olines / 10`
48 if [ $nlines -eq 0 ]; then
49 logger -p mail.error -t access.sh "Recieved empty access file, aborting."
53 # If its a greater than 10% shift bomb out to be safe
54 if [ $diff -gt $thresh ]; then
55 logger -p mail.error -t access.sh "Access changes threshold exceeded, aborting."
59 cp /dev/null $root/etc/access.new.db
61 $root/sbin/makemap btree $root/etc/access.new < $root/etc/access.new
66 mv $root/etc/access $root/etc/access.old
67 mv $root/etc/access.new $root/etc/access
68 rm -f $root/etc/access.old.db
69 ln $root/etc/access.db $root/etc/access.old.db
70 mv $root/etc/access.new.db $root/etc/access.db