2 DIR=/etc/remctl/sipb-xen-auto
3 TEMPLATE=$DIR/conf.template
4 MACHINEDIR=$DIR/machine.d
5 MOIRADIR=$DIR/moira-acl
6 MOIRATMP=$DIR/moira-tmp
7 MACHINETMP=$DIR/machine-list-tmp
8 AUTOMACHINELIST=$DIR/auto-machine-list
9 AUTOMOIRALIST=$DIR/auto-moira-list
16 sed "s/#MACHINENAME#/$machine/g" "$TEMPLATE" | \
17 sed "s,#BINDIR#,$BINDIR,g" >| "$MACHINETMP"
18 if ! cmp -s "$MACHINEDIR/$machine" "$MACHINETMP"; then
19 mv "$MACHINETMP" "$MACHINEDIR/$machine"
28 # Should perhaps replace with LDAP, but fine for now.
30 # We should do more careful error checking so we don't take away
31 # all bits and delete the moira-acl files whenever there's an AFS
33 pts membership system:"$group" -noauth | tail -n+2 | \
36 sed 's/$/@ATHENA.MIT.EDU/g' >| "$MOIRATMP"
37 if test -s "$MOIRATMP"; then
38 if ! cmp -s "$MOIRADIR/$group" "$MOIRATMP"; then
39 mv "$MOIRATMP" "$MOIRADIR/$group"
42 if test -e "$MOIRADIR/$group"; then
52 if ! perl -0e 'exit($ARGV[0] !~ /^[A-Za-z0-9][A-Za-z0-9._-]*$/)' -- "$machinename"; then
53 echo "Bad machine name"
60 update_moiragroup "$2"
64 # update the remctl.conf definitions
65 for machine in `cat "$AUTOMACHINELIST"`; do
66 update_machine "$machine"
70 # update our moira ACL lists
71 for group in `cat "$AUTOMOIRALIST"`; do
72 update_moiragroup "$group"
76 # update the list of maintained machines
77 /bin/ls "$ACLDIR" >| "$AUTOMACHINELIST"
80 # update the moira list-of-lists
81 # /bin/ls "$MOIRADIR" >| "$AUTOMOIRALIST" # BAD IDEA in case of outage
83 # This extracts the list of all moira lists we care about, and updates those.
84 grep -R moira "$ACLDIR/" /etc/remctl/acl/ | perl -pe 's/.*moira-acl\/(.*)/$1/g' >| "$AUTOMOIRALIST"
88 check_machine_name "$machine"
89 rm -f "$ACLDIR"/"$machine"
90 rm -f "$MACHINEDIR"/"$machine"
96 check_machine_name "$oldmachine"
97 check_machine_name "$newmachine"
98 mv "$ACLDIR"/"$oldmachine" "$ACLDIR"/"$newmachine"
99 rm -f "$MACHINEDIR"/"$oldmachine"
104 check_machine_name "$machine"
105 if [ -e "$ACLDIR"/"$machine" ]; then
106 echo "Machine already registered"
109 echo "include /etc/remctl/acl/web" > "$ACLDIR/$machine"
113 "$0" auto_machine_list
116 remctl-moira-update|all)
117 "$0" auto_machine_list