# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# 
# T2 SDE: package/.../vmailmgr/vmailmgr.conf
# Copyright (C) 2004 - 2006 The T2 SDE Project
# 
# More information can be found in the files COPYING and README.
# 
# 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; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- T2-COPYRIGHT-NOTE-END ---
if [ "$prefix_auto" = 1 ]; then
	prefix="opt/vmailmgr"
	set_confopt
fi

# fix sysconfidir
# 
hook_add preconf 3 'sed -i -e "s,/etc/vmailmgr,$sysconfdir,g" lib/config/configrc.h'

# i patch .am files :(
#
autogen=1
hook_add preconf 5 'cp -v $root/usr/share/automake-1.7/depcomp .'

# rename types.py to something not reserved
#
hook_add preconf 5 'mv -v python/types.py python/vmmtypes.py'

# filepipe
#
pkg_vmailmgr_filepipe() {
	mkdir -p filepipe
	bunzip2 -c `match_source_file -p filepipe` > filepipe/filepipe.c
	gcc -o filepipe/filepipe filepipe/filepipe.c
}
hook_add inmake 5 'pkg_vmailmgr_filepipe'
hook_add postmake 5 'cp -v filepipe/filepipe $root/usr/bin/'

# procmailrc sample
pkg_vmailmgr_procmailsample() {
	echo "$docdir/vmailmgr.procmailrc"
	sed -e "s,@BINDIR@,$bindir,g" \
	    -e "s,@QMAILBINDIR@,/var/qmail/bin,g" \
	    $confdir/vmailmgr.procmailrc > $docdir/vmailmgr.procmailrc

	# i'll set separators here too :)
	echo -n @ > $sysconfdir/separators
}
hook_add postdoc 5 'pkg_vmailmgr_procmailsample'