diff options
-rw-r--r-- | Makefile | 10 | ||||
-rwxr-xr-x | bin/postfix-show-virtual-map | 21 |
2 files changed, 30 insertions, 1 deletions
@@ -11,7 +11,7 @@ FAIL = exit 1 dep_dir = $1 $(shell find $1) users = $(call dep_dir,users) -all: PHONY pacman-keyring +all: PHONY pacman-keyring postfix-virtual-map clean: PHONY rm -rf output/cache @@ -20,6 +20,14 @@ distclean: PHONY #### +postfix-virtual-map: PHONY output/postfix-virtual-map/virtual-parabola.nu + +output/postfix-virtual-map/virtual-parabola.nu: ${users} + ${MKDIRS} ${@D} + bin/postfix-show-virtual-map > $@ + +#### + pacman-keyring: PHONY \ output/pacman-keyring/${KEYRING_NAME}.gpg \ output/pacman-keyring/${KEYRING_NAME}-trusted \ diff --git a/bin/postfix-show-virtual-map b/bin/postfix-show-virtual-map new file mode 100755 index 0000000..1203c63 --- /dev/null +++ b/bin/postfix-show-virtual-map @@ -0,0 +1,21 @@ +#!/usr/bin/env ruby +# Usage: postfix-show-virtual-map > ${file} && postmap hash:${file} +cfg_groups = [ "hackers", "fellows" ] + +###################################################################### +require 'yaml' + +users = Dir.glob("users/*.yml").map{|f|YAML::load(open(f))} + .find_all{|u|u["groups"] and not (u["groups"] & cfg_groups).empty?} + +users.each do |user| + if user["email"] and user["email"].length > 0 + if user["email"][0] =~ /.*@parabola.nu$/ + if user["email"].length > 1 + puts "#{user["username"]}@parabola.nu #{user["email"][1]}" + end + else + puts "#{user["username"]}@parabola.nu #{user["email"][0]}" + end + end +end |