#!/bin/sh -e

# vim:syntax=sh

# $Id: postfix2dlf.in,v 1.34 2002/04/13 22:55:59 vanbaal Exp $

#
# Copyright (C) 2002 Stichting LogReport Foundation LogReport@LogReport.org
# 
#     This program is free software; you can redistribute it and/or modify
#     it under the terms of the GNU General Public License as published by
#     the Free Software Foundation; either version 2 of the License, or
#     (at your option) any later version.
# 
#     This program is distributed in the hope that it will be useful,
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#     GNU General Public License for more details.
# 
#     You should have received a copy of the GNU General Public License
#     along with this program (see COPYING); if not, check with
#     http://www.gnu.org/copyleft/gpl.html or write to the Free Software 
#     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
#

PROGRAM=postfix2dlf

tag="$LR_SUPERSERVICE $LR_SERVICE $LR_ID $PROGRAM"

echo >&2 "$tag info started"

dumpfile=$TMPDIR/$PROGRAM.$LR_SERVICE.$LR_ID.db
prefile=$TMPDIR/$PROGRAM.$LR_SERVICE.$LR_ID.pre

# we cannot use a pipe here, since dumpfile needs to be fully created before
# postfix2dlf_main can start rolling

echo >&2 "$tag info gonna run postfix2dlf_pre $dumpfile > $prefile"
postfix2dlf_pre $dumpfile > $prefile
echo >&2 "$tag info gonna run postfix2dlf_main $dumpfile < $prefile"
postfix2dlf_main $dumpfile < $prefile

if test -n "$LR_KEEP"
then
    echo >&2 "$tag notice keeping temporary files $prefile and $dumpfile on your request. remove manually"
else
    rm $prefile $dumpfile
fi

echo >&2 "$tag info stopped"


