3 if [ -d /var/athena ] && [ -w /var/athena ]; then
4 exec >/var/athena/moira_update.log 2>&1
6 exec >/tmp/moira_update.log 2>&1
9 # The following exit codes are defined and MUST BE CONSISTENT with the
10 # error codes the library uses:
12 MR_MISSINGFILE=47836473
19 TARFILE=/var/tmp/acl.out
20 SRCDIR=/var/tmp/acltmp
22 # Alert if the tar file does not exist
23 test -r $TARFILE || exit $MR_MISSINGFILE
25 # Make a temporary directory to unpack the tar file into
27 mkdir $SRCDIR || exit $MR_MKCRED
28 cd $SRCDIR || exit $MR_MKCRED
29 tar xpf $TARFILE || exit $MR_TARERR
31 # Copy over each file which is new or has changed
32 for file in `find . -type f -print | sed -e 's/^\.//'`; do
33 if [ $file = /etc/passwd -o $file = /etc/passwd.local ]; then
34 # Make sure that there is a head file, or that the generated
35 # file contains an entry for root.
36 if [ ! -f $file.head ]; then
37 if egrep -s ^root: .$file; then
40 status=$MR_MISSINGFILE
44 elif [ $file = /etc/group -o $file = /etc/group.local ]; then
45 # Make sure that there is a head file, or that the generated
46 # file contains a group with gid 0.
47 if [ ! -f $file.head ]; then
48 if awk -F: '$3 == "0" { exit 1; }' $file; then
49 status=$MR_MISSINGFILE
55 if [ -f $file.head ]; then
60 if [ -f $file.tail ]; then
66 # Note that "$file" is a full pathname, and so ".$file" means
67 # the copy of file in the directory hierarchy rooted at ".",
68 # not "$file with a . prepended to its basename".
70 # Create a tmp file with the correct owner and mode
77 # Now dump the correct data into the tmp file without changing its
79 cat $head .$file $tail > $file.$$
81 if cmp -s $file.$$ $file; then
88 # Test if a site-specific post dcm script exists, and run it if it does
89 if [ -x /etc/athena/postacldcm ]; then
90 /etc/athena/postacldcm >/dev/null 2>&1
94 elif [ -x /usr/local/sbin/postacldcm ]; then
95 /usr/local/sbin/postacldcm >/dev/null 2>&1
104 test -f $TARFILE && rm -f $TARFILE
105 test -f $0 && rm -f $0