#!/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