#!/bin/bash # Alex Dehnert --- 2009-04-23 # Attempt to update the list of UA lists # Takes the container mailing lists on the commandline prev=$1 anti=$2 nativepat=$3 prev=${prev:-ua-lists} anti=${anti:-ua-foreign-lists} nativepat=${nativepat:-ua} function add_lists { ( for list in $(blanche $prev | grep LIST | cut -d : -f 2); do # for each list we already know about # Add a list's sublists for newlist in $(blanche $list | grep LIST | cut -d : -f 2); do blanche $prev -a $newlist; done; # Add a list's owner and memacl owner=$(athrun ops qy -s -f ace_name glin $list) towner=$(athrun ops qy -s -f ace_type glin $list) if [[ "$towner" == "LIST" ]]; then blanche $prev -a $owner fi macl=$(athrun ops qy -s -f memace_name glin $list) tmacl=$(athrun ops qy -s -f memace_type glin $list) if [[ "$tmacl" == "LIST" ]]; then blanche $prev -a $macl fi done ) 2>&1 | grep -v "Record already exists" } echo Current members: $(blanche $prev -m | wc) echo Expanding out lists add_lists add_lists echo New members: $(blanche $prev -m | wc) echo Removing foreign lists for list in $(blanche $anti | grep LIST | cut -d : -f 2); do blanche $prev -d $list; done echo Finalized members: $(blanche $prev -m | wc) echo echo Likely foreign members blanche $prev | grep LIST: | sed -e "s/^LIST://" | grep -v $nativepat