2014-09-30 21:08:26 +00:00
#
# Copyright (C) 2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
i n c l u d e $( TOPDIR ) / r u l e s . m k
PKG_NAME := postfix
2014-11-01 10:20:17 +00:00
PKG_RELEASE := 2
2014-09-30 21:08:26 +00:00
PKG_SOURCE_URL := ftp://ftp.porcupine.org/mirrors/postfix-release/official/
2014-10-25 17:17:54 +00:00
PKG_VERSION := 2.11.3
PKG_MD5SUM := c3f0f51d8865559b40e9350eb3816011
2014-09-30 21:08:26 +00:00
PKG_SOURCE := $( PKG_NAME) -$( PKG_VERSION) .tar.gz
PKG_MAINTAINER := Denis Shulyaka <Shulyaka@gmail.com>
PKG_LICENSE := IPL-1.0
2014-11-25 07:42:42 +00:00
PKG_LICENSE_FILES := LICENSE
2014-11-01 10:20:17 +00:00
PKG_BUILD_DEPENDS := +POSTFIX_CDB:tinycdb
2014-09-30 21:08:26 +00:00
i n c l u d e $( INCLUDE_DIR ) / p a c k a g e . m k
d e f i n e P a c k a g e / p o s t f i x
SECTION:= mail
CATEGORY:= Mail
TITLE:= Postfix Mail Transmit Agent
URL:= http://www.postfix.org/
2014-11-01 10:20:17 +00:00
DEPENDS:= +POSTFIX_TLS:libopenssl +POSTFIX_SASL:libsasl2 +POSTFIX_LDAP:libopenldap +POSTFIX_DB:libdb47 +libpcre
2014-09-30 21:08:26 +00:00
e n d e f
d e f i n e P a c k a g e / p o s t f i x / d e s c r i p t i o n
Postfix is Wietse Venema' s mailer that started life as an alternative to the widely-used Sendmail program. Postfix attempts to be fast, easy to administer, and secure, while at the same time being sendmail compatible enough to not upset existing users. Thus, the outside has a sendmail-ish flavor, but the inside is completely different.
e n d e f
d e f i n e P a c k a g e / p o s t f i x / c o n f i g
menu "Select postfix build options"
config POSTFIX_TLS
bool "TLS support"
default y
help
Implements TLS support in postfix ( using OpenSSL) .
config POSTFIX_SASL
bool "SASL support"
default y
help
Implements SASL support in postfix ( using Cyrus SASL) .
config POSTFIX_LDAP
bool "LDAP support"
default y
help
Implements LDAP support in postfix ( using OpenLDAP) .
2014-11-01 10:20:17 +00:00
config POSTFIX_DB
bool "BerkeleyDB support"
default n
help
Implements support for btree files using Berkeley DB. Note that hash files support is not compiled into Berkeley DB OpenWRT distribution
config POSTFIX_CDB
bool "CDB support"
default y
help
Implements support for cdb files using tinycdb
2014-09-30 21:08:26 +00:00
endmenu
e n d e f
2014-11-01 10:20:17 +00:00
CCARGS = -DNO_EPOLL -DNO_SIGSETJMP -DNO_NIS
AUXLIBS = -L$( STAGING_DIR) /usr/lib
default_database_type = cdb
2014-09-30 21:08:26 +00:00
i f d e f C O N F I G _ P O S T F I X _ T L S
CCARGS += -DUSE_TLS
AUXLIBS += -lssl -lcrypto
e n d i f
i f d e f C O N F I G _ P O S T F I X _ S A S L
CCARGS += -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I$( STAGING_DIR) /usr/include/sasl
AUXLIBS += -lsasl2
e n d i f
i f d e f C O N F I G _ P O S T F I X _ L D A P
CCARGS += -DHAS_LDAP
AUXLIBS += -lldap -llber
e n d i f
2014-11-01 10:20:17 +00:00
i f d e f C O N F I G _ P O S T F I X _ C D B
CCARGS += -DHAS_CDB
AUXLIBS += -lcdb
e n d i f
i f d e f C O N F I G _ P O S T F I X _ D B
AUXLIBS += -ldb
CCARGS += -DHAS_DB
ifndef CONFIG_POSTFIX_CDB
default_database_type = btree
endif
e l s e
CCARGS += -DNO_DB
e n d i f
CCARGS += -DDEF_DB_TYPE= \" $( default_database_type) \"
2014-11-06 12:20:23 +00:00
config_directory = /etc/postfix# also add this to postfix init file
2014-09-30 21:08:26 +00:00
sample_directory = /etc/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /usr/var/lib/postfix
queue_directory = /usr/var/spool/postfix
mail_spool_directory = /usr/var/mail
html_directory = no
manpage_directory = no
readme_directory = no
sendmail_path = /usr/sbin/sendmail
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
ln_suffix = .postfix
ln_old_suffix = .old
2014-11-01 10:20:17 +00:00
d e f i n e P a c k a g e / p o s t f i x / c o n f f i l e s
$( config_directory ) / m a i n . c f
$( config_directory ) / m a s t e r . c f
$( config_directory ) / a l i a s e s
e n d e f
2014-09-30 21:08:26 +00:00
d e f i n e B u i l d / C o n f i g u r e
2014-11-01 10:20:17 +00:00
if [ " $( CONFIG_POSTFIX_DB) " = "" -a " $( CONFIG_POSTFIX_CDB) " = "" ] ; then \
echo "Build error: You must select at least one of the DB types" ; \
exit 1; \
fi
2014-09-30 21:08:26 +00:00
cd $( PKG_BUILD_DIR) ; $( MAKE) makefiles CCARGS = '$(CCARGS)' $( TARGET_CONFIGURE_OPTS) AUXLIBS = " $( AUXLIBS) "
e n d e f
d e f i n e B u i l d / C o m p i l e
# Currently postfix has a bug with Makefiles that CCARGS are not passed to the compiler, so we are copying them to CC
cd $( PKG_BUILD_DIR) ; $( MAKE) $( TARGET_CONFIGURE_OPTS) CC = '$(TARGET_CC) $(CCARGS)'
2014-10-25 17:17:54 +00:00
cp ./files/main.cf.default $( PKG_BUILD_DIR) /conf/main.cf.default
2014-11-01 10:20:17 +00:00
echo " default_database_type = $( default_database_type) " >> $( PKG_BUILD_DIR) /conf/main.cf.default
echo " alias_database = $( default_database_type) : $( config_directory) /aliases " >> $( PKG_BUILD_DIR) /conf/main.cf.default
echo " alias_maps = $( default_database_type) : $( config_directory) /aliases " >> $( PKG_BUILD_DIR) /conf/main.cf.default
2014-09-30 21:08:26 +00:00
echo " sendmail_path = $( sendmail_path) $( ln_suffix) " >> $( PKG_BUILD_DIR) /conf/main.cf.default
echo " newaliases_path = $( newaliases_path) $( ln_suffix) " >> $( PKG_BUILD_DIR) /conf/main.cf.default
echo " mailq_path = $( mailq_path) $( ln_suffix) " >> $( PKG_BUILD_DIR) /conf/main.cf.default
echo " html_directory = $( html_directory) " >> $( PKG_BUILD_DIR) /conf/main.cf.default
echo " manpage_directory = $( manpage_directory) " >> $( PKG_BUILD_DIR) /conf/main.cf.default
echo " sample_directory = $( sample_directory) " >> $( PKG_BUILD_DIR) /conf/main.cf.default
echo " readme_directory = $( readme_directory) " >> $( PKG_BUILD_DIR) /conf/main.cf.default
echo " command_directory = $( command_directory) " >> $( PKG_BUILD_DIR) /conf/main.cf.default
echo " daemon_directory = $( daemon_directory) " >> $( PKG_BUILD_DIR) /conf/main.cf.default
echo " data_directory = $( data_directory) " >> $( PKG_BUILD_DIR) /conf/main.cf.default
echo " queue_directory = $( queue_directory) " >> $( PKG_BUILD_DIR) /conf/main.cf.default
echo " config_directory = $( config_directory) " >> $( PKG_BUILD_DIR) /conf/main.cf.default
echo " mail_spool_directory = $( mail_spool_directory) " >> $( PKG_BUILD_DIR) /conf/main.cf.default
e n d e f
d e f i n e P a c k a g e / p o s t f i x / i n s t a l l
cd $( PKG_BUILD_DIR) ; $( MAKE) install_root = $( 1) command_directory = $( command_directory) daemon_directory = $( daemon_directory) data_directory = $( data_directory) html_directory = $( html_directory) mail_owner = postfix mailq_path = $( mailq_path) $( ln_suffix) manpage_directory = $( manpage_directory) newaliases_path = $( newaliases_path) $( ln_suffix) queue_directory = $( queue_directory) readme_directory = $( readme_directory) sendmail_path = $( sendmail_path) $( ln_suffix) setgid_group = postdrop sample_directory = $( sample_directory) config_directory = $( config_directory) non-interactive-package
$( INSTALL_DIR) $( 1) $( mail_spool_directory)
$( INSTALL_DIR) $( 1) /etc/init.d/
2014-10-25 17:17:54 +00:00
$( INSTALL_BIN) ./files/postfix.init $( 1) /etc/init.d/postfix
2014-09-30 21:08:26 +00:00
e n d e f
d e f i n e P a c k a g e / p o s t f i x / p o s t i n s t
#!/bin/sh
2014-11-06 12:20:23 +00:00
if [ -f " $$ {IPKG_INSTROOT} $( sendmail_path) " -a " $$ (readlink " $$ { IPKG_INSTROOT} $( sendmail_path) ")" != " $( sendmail_path) $( ln_suffix) " ] ; then
mv " $$ {IPKG_INSTROOT} $( sendmail_path) " " $$ {IPKG_INSTROOT} $( sendmail_path) $( ln_old_suffix) "
echo " Warning: $$ {IPKG_INSTROOT} $( sendmail_path) saved as $$ {IPKG_INSTROOT} $( sendmail_path) $( ln_old_suffix) "
2014-09-30 21:08:26 +00:00
fi
2014-11-06 12:20:23 +00:00
if [ ! -f " $$ {IPKG_INSTROOT} $( sendmail_path) " ] ; then
ln -s " $$ {IPKG_INSTROOT} $( sendmail_path) $( ln_suffix) " " $( sendmail_path) "
2014-09-30 21:08:26 +00:00
fi
2014-11-06 12:20:23 +00:00
if [ -f " $$ {IPKG_INSTROOT} $( newaliases_path) " -a " $$ (readlink " $$ { IPKG_INSTROOT} $( newaliases_path) ")" != " $( newaliases_path) $( ln_suffix) " ] ; then
mv " $$ {IPKG_INSTROOT} $( newaliases_path) " " $$ {IPKG_INSTROOT} $( newaliases_path) $( ln_old_suffix) "
echo " Warning: $$ {IPKG_INSTROOT} $( newaliases_path) saved as $$ {IPKG_INSTROOT} $( newaliases_path) $( ln_old_suffix) "
2014-09-30 21:08:26 +00:00
fi
2014-11-06 12:20:23 +00:00
if [ ! -f " $$ {IPKG_INSTROOT} $( newaliases_path) " ] ; then
ln -s " $$ {IPKG_INSTROOT} $( newaliases_path) $( ln_suffix) " " $( newaliases_path) "
2014-09-30 21:08:26 +00:00
fi
2014-11-06 12:20:23 +00:00
if [ -f " $$ {IPKG_INSTROOT} $( mailq_path) " -a " $$ (readlink " $$ { IPKG_INSTROOT} $( mailq_path) ")" != " $( mailq_path) $( ln_suffix) " ] ; then
mv " $$ {IPKG_INSTROOT} $( mailq_path) " " $$ {IPKG_INSTROOT} $( mailq_path) $( ln_old_suffix) "
echo " Warning: $$ {IPKG_INSTROOT} $( mailq_path) saved as $$ {IPKG_INSTROOT} $( mailq_path) $( ln_old_suffix) "
2014-09-30 21:08:26 +00:00
fi
if [ ! -f " $( mailq_path) " ] ; then
2014-11-06 12:20:23 +00:00
ln -s " $$ {IPKG_INSTROOT} $( mailq_path) $( ln_suffix) " " $( mailq_path) "
fi
grep -qc main\. cf " $$ {IPKG_INSTROOT} " /etc/sysupgrade.conf >/dev/null || echo " $( config_directory) /main.cf " >> " $$ {IPKG_INSTROOT} " /etc/sysupgrade.conf
grep -qc master\. cf " $$ {IPKG_INSTROOT} " /etc/sysupgrade.conf >/dev/null || echo " $( config_directory) /master.cf " >> " $$ {IPKG_INSTROOT} " /etc/sysupgrade.conf
grep -qc aliases " $$ {IPKG_INSTROOT} " /etc/sysupgrade.conf >/dev/null || echo " $( config_directory) /aliases " >> " $$ {IPKG_INSTROOT} " /etc/sysupgrade.conf
touch " $$ {IPKG_INSTROOT} $( config_directory) " /opkg_postinst
if [ -z " $$ {IPKG_INSTROOT} " ] ; then
ps | grep "postfix/master" | grep -cvq grep >/dev/null && /etc/init.d/postfix reload
2014-09-30 21:08:26 +00:00
fi
e n d e f
d e f i n e P a c k a g e / p o s t f i x / p r e r m
#!/bin/sh
2014-11-01 10:20:17 +00:00
ps | grep "postfix/master" | grep -cvq grep >/dev/null && postfix stop
2014-09-30 21:08:26 +00:00
/etc/init.d/postfix disable
e n d e f
d e f i n e P a c k a g e / p o s t f i x / p o s t r m
#!/bin/sh
2014-11-06 12:20:23 +00:00
rm -f $$ { IPKG_INSTROOT} $( config_directory) /aliases.cdb $$ { IPKG_INSTROOT} $( config_directory) /aliases.db $$ { IPKG_INSTROOT} $( data_directory) /master.lock
2014-09-30 21:08:26 +00:00
2014-11-06 12:20:23 +00:00
rm -f " $$ {IPKG_INSTROOT} $( sendmail_path) " " $$ {IPKG_INSTROOT} $( newaliases_path) " " $$ {IPKG_INSTROOT} $( mailq_path) "
2014-09-30 21:08:26 +00:00
2014-11-06 12:20:23 +00:00
if [ -f " $$ {IPKG_INSTROOT} $( sendmail_path) $( ln_old_suffix) " ] ; then
mv " $$ {IPKG_INSTROOT} $( sendmail_path) $( ln_old_suffix) " " $$ {IPKG_INSTROOT} $( sendmail_path) "
echo " Warning: $$ {IPKG_INSTROOT} $( sendmail_path) restored from $$ {IPKG_INSTROOT} $( sendmail_path) $( ln_old_suffix) "
2014-09-30 21:08:26 +00:00
fi
2014-11-06 12:20:23 +00:00
if [ -f " $$ {IPKG_INSTROOT} $( newaliases_path) $( ln_old_suffix) " ] ; then
mv " $$ {IPKG_INSTROOT} $( newaliases_path) $( ln_old_suffix) " " $$ {IPKG_INSTROOT} $( newaliases_path) "
echo " Warning: $$ {IPKG_INSTROOT} $( newaliases_path) restored from $$ {IPKG_INSTROOT} $( newaliases_path) $( ln_old_suffix) "
2014-09-30 21:08:26 +00:00
fi
2014-11-06 12:20:23 +00:00
if [ -f " $$ {IPKG_INSTROOT} $( mailq_path) $( ln_old_suffix) " ] ; then
mv " $$ {IPKG_INSTROOT} $( mailq_path) $( ln_old_suffix) " " $$ {IPKG_INSTROOT} $( mailq_path) "
echo " Warning: $$ {IPKG_INSTROOT} $( mailq_path) restored from $$ {IPKG_INSTROOT} $( mailq_path) $( ln_old_suffix) "
2014-09-30 21:08:26 +00:00
fi
e n d e f
$( eval $ ( call BuildPackage ,postfix ) )