X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-remote.git/blobdiff_plain/fe1a4b1ab1f289737bd9cf03374debba59c260b5..d54eb5008a740ad3a8f01e5136e62637f2e236d5:/files/etc/remctl/sipb-xen-auto/remctl-update.sh diff --git a/files/etc/remctl/sipb-xen-auto/remctl-update.sh b/files/etc/remctl/sipb-xen-auto/remctl-update.sh index b0a96fb..3999144 100755 --- a/files/etc/remctl/sipb-xen-auto/remctl-update.sh +++ b/files/etc/remctl/sipb-xen-auto/remctl-update.sh @@ -13,12 +13,12 @@ ACLDIR=$DIR/acl update_machine() { machine=$1 - sed "s/#MACHINENAME#/$machine/g" $TEMPLATE | \ - sed "s,#BINDIR#,$BINDIR,g" >| $MACHINETMP - if ! cmp -s $MACHINEDIR/$machine $MACHINETMP; then - mv $MACHINETMP $MACHINEDIR/$machine + sed "s/#MACHINENAME#/$machine/g" "$TEMPLATE" | \ + sed "s,#BINDIR#,$BINDIR,g" >| "$MACHINETMP" + if ! cmp -s "$MACHINEDIR/$machine" "$MACHINETMP"; then + mv "$MACHINETMP" "$MACHINEDIR/$machine" else - rm -f $MACHINETMP + rm -f "$MACHINETMP" fi } @@ -30,20 +30,18 @@ update_moiragroup() # We should do more careful error checking so we don't take away # all bits and delete the moira-acl files whenever there's an AFS # outage. - pts membership system:$group -noauth | tail -n+2 | \ - sed 's/\./\//' | \ - sed 's/^ //' | \ - sed 's/$/@ATHENA.MIT.EDU/g' >| $MOIRATMP - if test -s $MOIRATMP; then - if ! cmp -s $MOIRADIR/$group $MOIRATMP; then - mv $MOIRATMP $MOIRADIR/$group + pts membership -nameorid "system:$group" -noauth | tail -n+2 | \ + sed 's/\./\//; s/^ //; s/$/@ATHENA.MIT.EDU/g' >| "$MOIRATMP" + if test -s "$MOIRATMP"; then + if ! cmp -s "$MOIRADIR/$group" "$MOIRATMP"; then + mv "$MOIRATMP" "$MOIRADIR/$group" fi else - if test -e $MOIRADIR/$group; then - rm $MOIRADIR/$group + if test -e "$MOIRADIR/$group"; then + rm "$MOIRADIR/$group" fi fi - rm -f $MOIRATMP + rm -f "$MOIRATMP" } case "$1" in @@ -53,26 +51,26 @@ case "$1" in all_machines) # update the remctl.conf definitions - for machine in `cat $AUTOMACHINELIST`; do - update_machine $machine + for machine in `cat "$AUTOMACHINELIST"`; do + update_machine "$machine" done ;; all_moira) # update our moira ACL lists - for group in `cat $AUTOMOIRALIST`; do - update_moiragroup $group + for group in `cat "$AUTOMOIRALIST"`; do + update_moiragroup "$group" done ;; auto_machine_list) # update the list of maintained machines - /bin/ls $ACLDIR >| $AUTOMACHINELIST + /bin/ls "$ACLDIR" >| "$AUTOMACHINELIST" ;; auto_moira_list) # update the moira list-of-lists - # /bin/ls $MOIRADIR >| $AUTOMOIRALIST # BAD IDEA in case of outage + # /bin/ls "$MOIRADIR" >| "$AUTOMOIRALIST" # BAD IDEA in case of outage # This extracts the list of all moira lists we care about, and updates those. - grep -R moira $ACLDIR/ /etc/remctl/acl/ | perl -pe 's/.*moira-acl\/(.*)/$1/g' >| $AUTOMOIRALIST + grep -R moira "$ACLDIR/" /etc/remctl/acl/ | perl -pe 's/.*moira-acl\/(.*)/$1/g' >| "$AUTOMOIRALIST" ;; all) "$0" auto_machine_list