]> andersk Git - moira.git/blob - gen/zephyr.sh
fix two bugs noticed by kretch
[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         if cmp -s $file ../acl/$file; then
26             mv $file ../acl/$file
27             hup=yes
28         fi
29     else
30         mv $file ../acl/$file
31         hup=yes
32     fi
33 done
34
35 # HUP zephyrd if needed
36 case $hup in
37 yes)
38     pid=`ps -ef | awk '/[^\]]zephyrd/ { print $2; }'`
39     kill -HUP $pid
40     sleep 5
41     ;;
42 esac
43
44 # cleanup
45 rm -rf /etc/athena/zephyr/acl.new
46 test -f $TARFILE && rm -f $TARFILE
47 test -f $0 && rm -f $0
48
49 exit 0
50
This page took 0.035894 seconds and 5 git commands to generate.