#!/bin/sh # # /usr/local/sbin/localmaildomainupdate # Copyright 2004-2006 Jonas Smedegaard # # $Id: localmaildomainupdate,v 1.4 2006-10-30 12:34:31 jonas Exp $ # # Update an (already prepared!) mailuser file # # (wrapper script for localmkpostfixvirtual) # set -e if [ $# -ge 1 ]; then maildomain="$1" virtualfile="virtual-$1" shift else maildomain="" virtualfile="virtual" fi ( cd /etc/postfix localmkpostfixvirtual $maildomain > $virtualfile.new if [ -f /etc/postfix/$virtualfile.addon ]; then cat /etc/postfix/$virtualfile.addon >> $virtualfile.new fi diff $@ $virtualfile $virtualfile.new || if [ $? -eq 1 ]; then /bin/true; fi echo -n "Above is the intended changes. OK to update (y/N)? " read do_update case $do_update in y|Y) mv $virtualfile.new $virtualfile postmap $virtualfile ;; esac )