diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-06-15 16:53:59 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-06-15 16:53:59 -0400 |
commit | c10faa5b2b617d5d62407567cd8d495d7ddddeb6 (patch) | |
tree | 6181f3a1e71403cc1e54c32ca244c819040c9562 /scripts/postfix-generate-virtual-map | |
parent | 1a435c0f4b41904025d0f263734cb9aea6a03b13 (diff) |
git mv bin scripts
Diffstat (limited to 'scripts/postfix-generate-virtual-map')
-rwxr-xr-x | scripts/postfix-generate-virtual-map | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/postfix-generate-virtual-map b/scripts/postfix-generate-virtual-map new file mode 100755 index 0000000..d5c2d21 --- /dev/null +++ b/scripts/postfix-generate-virtual-map @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby +# Usage: postfix-show-virtual-map > ${file} && postmap hash:${file} + +load "#{File.dirname(__FILE__)}/common.rb" + +users = load_all_users.values.find_all{|u|u["groups"].include?("email")} + +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 |