4 # The following exit codes are defined and MUST BE CONSISTENT with the
5 # error codes the library uses:
6 MR_MISSINGFILE=47836473
13 TARFILE=/var/tmp/acl.out
15 # Alert if the tar file does not exist
16 test -r $TARFILE || exit $MR_MISSINGFILE
18 # Make a temporary directory to unpack the tar file into
19 mkdir /var/tmp/acltmp || exit $MR_MKCRED
20 cd /var/tmp/acltmp || exit $MR_MKCRED
21 tar xpf $TARFILE || exit $MR_TARERR
23 # Copy over each file which is new or has changed
24 for file in `find . -type f -print | sed -e 's/^\.//'`; do
25 if [ $file = /etc/passwd -o $file = /etc/passwd.local ]; then
26 # Make sure that there is a head file, or that the generated
27 # file contains an entry for root.
28 if [ ! -f $file.head ]; then
29 if egrep -s ^root: .$file; then
36 elif [ $file = /etc/group -o $file = /etc/group.local ]; then
37 # Make sure that there is a head file, or that the generated
38 # file contains a group with gid 0.
39 if [ ! -f $file.head ]; then
40 if awk -F: '$3 == "0" { exit 1; }'; then
47 if [ -f $file.head ]; then
52 if [ -f $file.tail ]; then
58 # Note that "$file" is a full pathname, and so ".$file" means
59 # the copy of file in the directory hierarchy rooted at ".",
60 # not "$file with a . prepended to its basename".
62 # Create a tmp file with the correct owner and mode
69 # Now dump the correct data into the tmp file without changing its
71 cat $head .$file $tail > $file.$$
73 if cmp -s $file.$$ $file; then
82 rm -rf /var/tmp/acltmp
83 test -f $TARFILE && rm -f $TARFILE
84 test -f $0 && rm -f $0