misc updates
[hcoop/scripts.git] / mailman-update-exim-db
index 86a0601..414a6a0 100755 (executable)
@@ -12,6 +12,7 @@ MMDIR=/var/lib/mailman
 LISTDIR=$MMDIR/lists
 BINDIR=$MMDIR/bin
 TABLE=/etc/exim4/mailmandb
+TABLE_EXT=/etc/exim4/mailmandb-ext
 
 # Use return as separator, never space or tab.
 IFS="
@@ -29,10 +30,15 @@ fi
 # Iterate through available lists
 for i in $(find $LISTDIR -mindepth 1 -maxdepth 1 -type d -print); do
     LIST=$(basename $i)
-    DOMAIN=$(su list -c "$BINDIR/config_list -o - $LIST" | \
+    DOMAIN=$(sudo -u list $BINDIR/config_list -o - $LIST | \
         grep -E "^host_name = '.+'" 2>/dev/null | \
         sed -r -e "s/host_name = '(.+)'/\\1/")
     if test -n "$LIST" && test -n "$DOMAIN"; then
-        echo "$LIST: $DOMAIN" >> $TABLE
+        echo "$LIST@$DOMAIN: true" >> $TABLE
     fi
 done
+
+# Add extras file, for aliases of domains and whatnot
+if test -f $TABLE_EXT; then
+    cat $TABLE_EXT >> $TABLE
+fi