summaryrefslogtreecommitdiff
path: root/localmaildomainupdate
blob: dbe7bff4a0f555ea524477fcd9d5e09a739d4234 (plain)
  1. #!/bin/sh
  2. #
  3. # /usr/local/sbin/localmaildomainupdate
  4. # Copyright 2004-2006 Jonas Smedegaard <dr@jones.dk>
  5. #
  6. # $Id: localmaildomainupdate,v 1.4 2006-10-30 12:34:31 jonas Exp $
  7. #
  8. # Update an (already prepared!) mailuser file
  9. #
  10. # (wrapper script for localmkpostfixvirtual)
  11. #
  12. set -e
  13. if [ $# -ge 1 ]; then
  14. maildomain="$1"
  15. virtualfile="virtual-$1"
  16. shift
  17. else
  18. maildomain=""
  19. virtualfile="virtual"
  20. fi
  21. (
  22. cd /etc/postfix
  23. localmkpostfixvirtual $maildomain > $virtualfile.new
  24. if [ -f /etc/postfix/$virtualfile.addon ]; then
  25. cat /etc/postfix/$virtualfile.addon >> $virtualfile.new
  26. fi
  27. diff $@ $virtualfile $virtualfile.new || if [ $? -eq 1 ]; then /bin/true; fi
  28. echo -n "Above is the intended changes. OK to update (y/N)? "
  29. read do_update
  30. case $do_update in
  31. y|Y)
  32. mv $virtualfile.new $virtualfile
  33. postmap $virtualfile
  34. ;;
  35. esac
  36. )