summaryrefslogtreecommitdiff
path: root/scripts/postfix-generate-virtual-map
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-06-15 16:53:59 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-06-15 16:53:59 -0400
commitc10faa5b2b617d5d62407567cd8d495d7ddddeb6 (patch)
tree6181f3a1e71403cc1e54c32ca244c819040c9562 /scripts/postfix-generate-virtual-map
parent1a435c0f4b41904025d0f263734cb9aea6a03b13 (diff)
git mv bin scripts
Diffstat (limited to 'scripts/postfix-generate-virtual-map')
-rwxr-xr-xscripts/postfix-generate-virtual-map18
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