2 # Alex Dehnert --- 2009-04-23
3 # Attempt to update the list of UA lists
4 # Takes the container mailing lists on the commandline
10 prev=${prev:-ua-lists}
11 anti=${anti:-ua-foreign-lists}
12 nativepat=${nativepat:-ua}
17 lists=$(blanche $prev | grep LIST | cut -d : -f 2)
18 for list in $lists; do # for each list we already know about
19 # Add a list's sublists
20 for newlist in $(blanche $list | grep LIST | cut -d : -f 2); do
21 blanche $prev -a $newlist;
23 # Add a list's owner and memacl
24 owner=$(athrun ops qy -s -f ace_name glin $list)
25 towner=$(athrun ops qy -s -f ace_type glin $list)
26 if [[ "$towner" == "LIST" ]]; then
27 blanche $prev -a $owner
29 macl=$(athrun ops qy -s -f memace_name glin $list)
30 tmacl=$(athrun ops qy -s -f memace_type glin $list)
31 if [[ "$tmacl" == "LIST" ]]; then
32 blanche $prev -a $macl
35 owned=$(athrun ops qy -s get_ace_use list $list | grep -v ^$prev\$ | grep LIST | cut -d " " -f 2)
36 for newlist in $owned; do
37 blanche $prev -a $newlist;
40 ) 2>&1 | grep -v "Record already exists" | grep -v "moira (query): No records in database match query"
43 echo Current members: $(blanche $prev -m | wc)
44 echo Expanding out lists
46 echo New members: $(blanche $prev -m | wc)
47 echo Removing foreign lists
48 for list in $(blanche $anti | grep LIST | cut -d : -f 2); do blanche $prev -d $list; done
49 echo Finalized members: $(blanche $prev -m | wc)
52 echo Likely foreign members
53 blanche $prev | grep LIST: | sed -e "s/^LIST://" | egrep -v "$nativepat"