#!/bin/sh
# $Id$
+if [ -d /var/athena ] && [ -w /var/athena ]; then
+ exec >/var/athena/moira_update.log 2>&1
+else
+ exec >/tmp/moira_update.log 2>&1
+fi
# The following exit codes are defined and MUST BE CONSISTENT with the
# error codes the library uses:
+MR_NOCRED=47836470
MR_MISSINGFILE=47836473
MR_MKCRED=47836474
MR_TARERR=47836476
PATH=/bin:/usr/bin
TARFILE=/var/tmp/acl.out
+SRCDIR=/var/tmp/acltmp
# Alert if the tar file does not exist
test -r $TARFILE || exit $MR_MISSINGFILE
# Make a temporary directory to unpack the tar file into
-mkdir /var/tmp/acltmp || exit $MR_MKCRED
-cd /var/tmp/acltmp || exit $MR_MKCRED
+rm -rf $SRCDIR
+mkdir $SRCDIR || exit $MR_MKCRED
+cd $SRCDIR || exit $MR_MKCRED
tar xpf $TARFILE || exit $MR_TARERR
# Copy over each file which is new or has changed
if egrep -s ^root: .$file; then
:
else
- status=MR_MISSINGFILE
+ status=$MR_MISSINGFILE
break
fi
fi
# Make sure that there is a head file, or that the generated
# file contains a group with gid 0.
if [ ! -f $file.head ]; then
- if awk -F: '$3 == "0" { exit 1; }'; then
- status=MR_MISSINGFILE
+ if awk -F: '$3 == "0" { exit 1; }' $file; then
+ status=$MR_MISSINGFILE
break
fi
fi
fi
done
+# Test if a site-specific post dcm script exists, and run it if it does
+if [ -x /etc/athena/postacldcm ]; then
+ /etc/athena/postacldcm >/dev/null 2>&1
+ if [ $? != 0 ]; then
+ exit $MR_NOCRED
+ fi
+fi
+
# cleanup
cd /
-rm -rf /var/tmp/acltmp
+rm -rf $SRCDIR
test -f $TARFILE && rm -f $TARFILE
test -f $0 && rm -f $0