]> andersk Git - moira.git/blob - gen/zephyr.sh
Actually replace the files that changes, as opposed to only replacing
[moira.git] / gen / zephyr.sh
1 #!/bin/sh
2 # $Id$
3
4 # The following exit codes are defined and MUST BE CONSISTENT with the
5 # error codes the library uses:
6 MR_MISSINGFILE=47836473
7 MR_MKCRED=47836474
8 MR_TARERR=47836476
9
10 hup=no
11 PATH=/bin
12 TARFILE=/var/tmp/zephyr.out
13
14 # Alert if the tar file does not exist
15 test -r $TARFILE || exit $MR_MISSINGFILE
16
17 # Make a temporary directory to unpack the tar file into
18 mkdir /etc/athena/zephyr/acl.new
19 cd /etc/athena/zephyr/acl.new || exit $MR_MKCRED
20 tar xf $TARFILE || exit $MR_TARERR
21
22 # Copy over each file which is new or has changed
23 for file in *; do
24     if [ -f ../acl/$file ]; then
25         cmp -s $file ../acl/$file       
26         if [ $? != 0 ]; then
27             mv $file ../acl/$file
28             hup=yes
29         fi
30     else
31         mv $file ../acl/$file
32         hup=yes
33     fi
34 done
35
36 # HUP zephyrd if needed
37 case $hup in
38 yes)
39     pid=`ps -ef | awk '/[^\]]zephyrd/ { print $2; }'`
40     kill -HUP $pid
41     sleep 5
42     ;;
43 esac
44
45 # cleanup
46 rm -rf /etc/athena/zephyr/acl.new
47 test -f $TARFILE && rm -f $TARFILE
48 test -f $0 && rm -f $0
49
50 exit 0
51
This page took 0.040687 seconds and 5 git commands to generate.