|
@@ -8,7 +8,7 @@
|
8
|
8
|
include $(TOPDIR)/rules.mk
|
9
|
9
|
|
10
|
10
|
PKG_NAME:=postfix
|
11
|
|
-PKG_RELEASE:=1
|
|
11
|
+PKG_RELEASE:=2
|
12
|
12
|
PKG_SOURCE_URL:=ftp://ftp.porcupine.org/mirrors/postfix-release/official/
|
13
|
13
|
PKG_VERSION:=2.11.3
|
14
|
14
|
PKG_MD5SUM:=c3f0f51d8865559b40e9350eb3816011
|
|
@@ -16,7 +16,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
16
|
16
|
PKG_MAINTAINER:=Denis Shulyaka <Shulyaka@gmail.com>
|
17
|
17
|
PKG_LICENSE:=IPL-1.0
|
18
|
18
|
PKG_LICENSE_FILE:=LICENSE
|
19
|
|
-PKG_BUILD_DEPENDS:=+tinycdb
|
|
19
|
+PKG_BUILD_DEPENDS:=+POSTFIX_CDB:tinycdb
|
20
|
20
|
|
21
|
21
|
include $(INCLUDE_DIR)/package.mk
|
22
|
22
|
|
|
@@ -25,7 +25,7 @@ define Package/postfix
|
25
|
25
|
CATEGORY:=Mail
|
26
|
26
|
TITLE:=Postfix Mail Transmit Agent
|
27
|
27
|
URL:=http://www.postfix.org/
|
28
|
|
- DEPENDS:=+POSTFIX_TLS:libopenssl +POSTFIX_SASL:libsasl2 +POSTFIX_LDAP:libopenldap +libpcre
|
|
28
|
+ DEPENDS:=+POSTFIX_TLS:libopenssl +POSTFIX_SASL:libsasl2 +POSTFIX_LDAP:libopenldap +POSTFIX_DB:libdb47 +libpcre
|
29
|
29
|
endef
|
30
|
30
|
|
31
|
31
|
define Package/postfix/description
|
|
@@ -49,17 +49,22 @@ define Package/postfix/config
|
49
|
49
|
default y
|
50
|
50
|
help
|
51
|
51
|
Implements LDAP support in postfix (using OpenLDAP).
|
|
52
|
+ config POSTFIX_DB
|
|
53
|
+ bool "BerkeleyDB support"
|
|
54
|
+ default n
|
|
55
|
+ help
|
|
56
|
+ Implements support for btree files using Berkeley DB. Note that hash files support is not compiled into Berkeley DB OpenWRT distribution
|
|
57
|
+ config POSTFIX_CDB
|
|
58
|
+ bool "CDB support"
|
|
59
|
+ default y
|
|
60
|
+ help
|
|
61
|
+ Implements support for cdb files using tinycdb
|
52
|
62
|
endmenu
|
53
|
63
|
endef
|
54
|
64
|
|
55
|
|
-define Package/postfix/conffiles
|
56
|
|
-/etc/postfix/main.cf
|
57
|
|
-/etc/postfix/master.cf
|
58
|
|
-/etc/postfix/aliases
|
59
|
|
-endef
|
60
|
|
-
|
61
|
|
-CCARGS=-DHAS_CDB -DNO_DB -DNO_EPOLL -DNO_SIGSETJMP -DNO_NIS -DDEF_DB_TYPE=\"cdb\"
|
62
|
|
-AUXLIBS=-L$(STAGING_DIR)/usr/lib -lcdb
|
|
65
|
+CCARGS=-DNO_EPOLL -DNO_SIGSETJMP -DNO_NIS
|
|
66
|
+AUXLIBS=-L$(STAGING_DIR)/usr/lib
|
|
67
|
+default_database_type=cdb
|
63
|
68
|
|
64
|
69
|
ifdef CONFIG_POSTFIX_TLS
|
65
|
70
|
CCARGS+=-DUSE_TLS
|
|
@@ -76,6 +81,23 @@ ifdef CONFIG_POSTFIX_LDAP
|
76
|
81
|
AUXLIBS+=-lldap -llber
|
77
|
82
|
endif
|
78
|
83
|
|
|
84
|
+ifdef CONFIG_POSTFIX_CDB
|
|
85
|
+ CCARGS+=-DHAS_CDB
|
|
86
|
+ AUXLIBS+=-lcdb
|
|
87
|
+endif
|
|
88
|
+
|
|
89
|
+ifdef CONFIG_POSTFIX_DB
|
|
90
|
+ AUXLIBS+=-ldb
|
|
91
|
+ CCARGS+=-DHAS_DB
|
|
92
|
+ ifndef CONFIG_POSTFIX_CDB
|
|
93
|
+ default_database_type=btree
|
|
94
|
+ endif
|
|
95
|
+else
|
|
96
|
+ CCARGS+=-DNO_DB
|
|
97
|
+endif
|
|
98
|
+
|
|
99
|
+CCARGS+=-DDEF_DB_TYPE=\"$(default_database_type)\"
|
|
100
|
+
|
79
|
101
|
config_directory=/etc/postfix
|
80
|
102
|
sample_directory=/etc/postfix
|
81
|
103
|
command_directory=/usr/sbin
|
|
@@ -93,7 +115,18 @@ mailq_path=/usr/bin/mailq
|
93
|
115
|
ln_suffix=.postfix
|
94
|
116
|
ln_old_suffix=.old
|
95
|
117
|
|
|
118
|
+define Package/postfix/conffiles
|
|
119
|
+$(config_directory)/main.cf
|
|
120
|
+$(config_directory)/master.cf
|
|
121
|
+$(config_directory)/aliases
|
|
122
|
+endef
|
|
123
|
+
|
96
|
124
|
define Build/Configure
|
|
125
|
+ if [ "$(CONFIG_POSTFIX_DB)" = "" -a "$(CONFIG_POSTFIX_CDB)" = "" ]; then\
|
|
126
|
+ echo "Build error: You must select at least one of the DB types";\
|
|
127
|
+ exit 1;\
|
|
128
|
+ fi
|
|
129
|
+
|
97
|
130
|
cd $(PKG_BUILD_DIR); $(MAKE) makefiles CCARGS='$(CCARGS)' $(TARGET_CONFIGURE_OPTS) AUXLIBS="$(AUXLIBS)"
|
98
|
131
|
endef
|
99
|
132
|
|
|
@@ -101,6 +134,9 @@ define Build/Compile
|
101
|
134
|
# Currently postfix has a bug with Makefiles that CCARGS are not passed to the compiler, so we are copying them to CC
|
102
|
135
|
cd $(PKG_BUILD_DIR); $(MAKE) $(TARGET_CONFIGURE_OPTS) CC='$(TARGET_CC) $(CCARGS)'
|
103
|
136
|
cp ./files/main.cf.default $(PKG_BUILD_DIR)/conf/main.cf.default
|
|
137
|
+ echo "default_database_type = $(default_database_type)" >> $(PKG_BUILD_DIR)/conf/main.cf.default
|
|
138
|
+ echo "alias_database = $(default_database_type):$(config_directory)/aliases" >> $(PKG_BUILD_DIR)/conf/main.cf.default
|
|
139
|
+ echo "alias_maps = $(default_database_type):$(config_directory)/aliases" >> $(PKG_BUILD_DIR)/conf/main.cf.default
|
104
|
140
|
echo "sendmail_path = $(sendmail_path)$(ln_suffix)" >> $(PKG_BUILD_DIR)/conf/main.cf.default
|
105
|
141
|
echo "newaliases_path = $(newaliases_path)$(ln_suffix)" >> $(PKG_BUILD_DIR)/conf/main.cf.default
|
106
|
142
|
echo "mailq_path = $(mailq_path)$(ln_suffix)" >> $(PKG_BUILD_DIR)/conf/main.cf.default
|
|
@@ -156,24 +192,24 @@ if [ -z "$${IPKG_INSTROOT}" ]; then
|
156
|
192
|
echo "mydomain = $$(uci get system.@system[0].hostname|sed -e "s/[^\.]*\.\(.*\)/\1/")" >> $(config_directory)/main.cf.default
|
157
|
193
|
for net in $$(uci show network|grep ipaddr|sed -e "s/network\.\([^\.]*\).*/\1/"); do eval "$$(ipcalc.sh $$(uci get network.$$net.ipaddr) $$(uci get network.$$net.netmask))"; echo "$$IP/$$PREFIX"; done | xargs echo "mynetworks =" >> $(config_directory)/main.cf.default
|
158
|
194
|
|
159
|
|
- grep -qc "^sendmail_path" /etc/postfix/main.cf >/dev/null || postconf -e "$$(grep "^sendmail_path =" /etc/postfix/main.cf.default)"
|
160
|
|
- grep -qc "^newaliases_path" /etc/postfix/main.cf >/dev/null || postconf -e "$$(grep "^newaliases_path =" /etc/postfix/main.cf.default)"
|
161
|
|
- grep -qc "^mailq_path" /etc/postfix/main.cf >/dev/null || postconf -e "$$(grep "^mailq_path =" /etc/postfix/main.cf.default)"
|
162
|
|
- grep -qc "^html_directory" /etc/postfix/main.cf >/dev/null || postconf -e "$$(grep "^html_directory =" /etc/postfix/main.cf.default)"
|
163
|
|
- grep -qc "^manpage_directory" /etc/postfix/main.cf >/dev/null || postconf -e "$$(grep "^manpage_directory =" /etc/postfix/main.cf.default)"
|
164
|
|
- grep -qc "^sample_directory" /etc/postfix/main.cf >/dev/null || postconf -e "$$(grep "^sample_directory =" /etc/postfix/main.cf.default)"
|
165
|
|
- grep -qc "^readme_directory" /etc/postfix/main.cf >/dev/null || postconf -e "$$(grep "^readme_directory =" /etc/postfix/main.cf.default)"
|
166
|
|
- grep -qc "^command_directory" /etc/postfix/main.cf >/dev/null || postconf -e "$$(grep "^command_directory =" /etc/postfix/main.cf.default)"
|
167
|
|
- grep -qc "^daemon_directory" /etc/postfix/main.cf >/dev/null || postconf -e "$$(grep "^daemon_directory =" /etc/postfix/main.cf.default)"
|
168
|
|
- grep -qc "^data_directory" /etc/postfix/main.cf >/dev/null || postconf -e "$$(grep "^data_directory =" /etc/postfix/main.cf.default)"
|
169
|
|
- grep -qc "^queue_directory" /etc/postfix/main.cf >/dev/null || postconf -e "$$(grep "^queue_directory =" /etc/postfix/main.cf.default)"
|
170
|
|
- grep -qc "^config_directory" /etc/postfix/main.cf >/dev/null || postconf -e "$$(grep "^config_directory =" /etc/postfix/main.cf.default)"
|
171
|
|
- grep -qc "^mail_spool_directory" /etc/postfix/main.cf >/dev/null || postconf -e "$$(grep "^mail_spool_directory =" /etc/postfix/main.cf.default)"
|
172
|
|
- grep -qc "^mail_owner" /etc/postfix/main.cf >/dev/null || postconf -e "$$(grep "^mail_owner =" /etc/postfix/main.cf.default)"
|
173
|
|
- grep -qc "^setgid_group" /etc/postfix/main.cf >/dev/null || postconf -e "$$(grep "^setgid_group =" /etc/postfix/main.cf.default)"
|
174
|
|
- grep -qc "^myhostname" /etc/postfix/main.cf >/dev/null || postconf -e "$$(grep "^myhostname =" /etc/postfix/main.cf.default)"
|
175
|
|
- grep -qc "^mydomain" /etc/postfix/main.cf >/dev/null || postconf -e "$$(grep "^mydomain =" /etc/postfix/main.cf.default)"
|
176
|
|
- grep -qc "^mynetworks" /etc/postfix/main.cf >/dev/null || postconf -e "$$(grep "^mynetworks =" /etc/postfix/main.cf.default)"
|
|
195
|
+ grep -qc "^sendmail_path" $(config_directory)/main.cf >/dev/null || postconf -e "$$(grep "^sendmail_path =" $(config_directory)/main.cf.default)"
|
|
196
|
+ grep -qc "^newaliases_path" $(config_directory)/main.cf >/dev/null || postconf -e "$$(grep "^newaliases_path =" $(config_directory)/main.cf.default)"
|
|
197
|
+ grep -qc "^mailq_path" $(config_directory)/main.cf >/dev/null || postconf -e "$$(grep "^mailq_path =" $(config_directory)/main.cf.default)"
|
|
198
|
+ grep -qc "^html_directory" $(config_directory)/main.cf >/dev/null || postconf -e "$$(grep "^html_directory =" $(config_directory)/main.cf.default)"
|
|
199
|
+ grep -qc "^manpage_directory" $(config_directory)/main.cf >/dev/null || postconf -e "$$(grep "^manpage_directory =" $(config_directory)/main.cf.default)"
|
|
200
|
+ grep -qc "^sample_directory" $(config_directory)/main.cf >/dev/null || postconf -e "$$(grep "^sample_directory =" $(config_directory)/main.cf.default)"
|
|
201
|
+ grep -qc "^readme_directory" $(config_directory)/main.cf >/dev/null || postconf -e "$$(grep "^readme_directory =" $(config_directory)/main.cf.default)"
|
|
202
|
+ grep -qc "^command_directory" $(config_directory)/main.cf >/dev/null || postconf -e "$$(grep "^command_directory =" $(config_directory)/main.cf.default)"
|
|
203
|
+ grep -qc "^daemon_directory" $(config_directory)/main.cf >/dev/null || postconf -e "$$(grep "^daemon_directory =" $(config_directory)/main.cf.default)"
|
|
204
|
+ grep -qc "^data_directory" $(config_directory)/main.cf >/dev/null || postconf -e "$$(grep "^data_directory =" $(config_directory)/main.cf.default)"
|
|
205
|
+ grep -qc "^queue_directory" $(config_directory)/main.cf >/dev/null || postconf -e "$$(grep "^queue_directory =" $(config_directory)/main.cf.default)"
|
|
206
|
+ grep -qc "^config_directory" $(config_directory)/main.cf >/dev/null || postconf -e "$$(grep "^config_directory =" $(config_directory)/main.cf.default)"
|
|
207
|
+ grep -qc "^mail_spool_directory" $(config_directory)/main.cf >/dev/null || postconf -e "$$(grep "^mail_spool_directory =" $(config_directory)/main.cf.default)"
|
|
208
|
+ grep -qc "^mail_owner" $(config_directory)/main.cf >/dev/null || postconf -e "$$(grep "^mail_owner =" $(config_directory)/main.cf.default)"
|
|
209
|
+ grep -qc "^setgid_group" $(config_directory)/main.cf >/dev/null || postconf -e "$$(grep "^setgid_group =" $(config_directory)/main.cf.default)"
|
|
210
|
+ grep -qc "^myhostname" $(config_directory)/main.cf >/dev/null || postconf -e "$$(grep "^myhostname =" $(config_directory)/main.cf.default)"
|
|
211
|
+ grep -qc "^mydomain" $(config_directory)/main.cf >/dev/null || postconf -e "$$(grep "^mydomain =" $(config_directory)/main.cf.default)"
|
|
212
|
+ grep -qc "^mynetworks" $(config_directory)/main.cf >/dev/null || postconf -e "$$(grep "^mynetworks =" $(config_directory)/main.cf.default)"
|
177
|
213
|
|
178
|
214
|
EXTRA_COMMANDS=create_users /etc/init.d/postfix create_users
|
179
|
215
|
|
|
@@ -181,15 +217,10 @@ if [ -z "$${IPKG_INSTROOT}" ]; then
|
181
|
217
|
postfix post-install upgrade-source
|
182
|
218
|
postfix upgrade-configuration
|
183
|
219
|
newaliases
|
184
|
|
- if [ `ps | grep "postfix/master" | grep -cv grep` -gt 0 ]
|
185
|
|
- then
|
186
|
|
- postfix reload
|
187
|
|
- fi
|
188
|
|
- if [ `grep -c aliases /etc/sysupgrade.conf` -eq 0 ]
|
189
|
|
- then
|
190
|
|
- echo "$(config_directory)/main.cf" >> /etc/sysupgrade.conf
|
191
|
|
- echo "$(config_directory)/aliases" >> /etc/sysupgrade.conf
|
192
|
|
- fi
|
|
220
|
+ ps | grep "postfix/master" | grep -cvq grep >/dev/null && postfix reload
|
|
221
|
+ grep -qc main\.cf /etc/sysupgrade.conf >/dev/null || echo "$(config_directory)/main.cf" >> /etc/sysupgrade.conf
|
|
222
|
+ grep -qc master\.cf /etc/sysupgrade.conf >/dev/null || echo "$(config_directory)/master.cf" >> /etc/sysupgrade.conf
|
|
223
|
+ grep -qc aliases /etc/sysupgrade.conf >/dev/null || echo "$(config_directory)/aliases" >> /etc/sysupgrade.conf
|
193
|
224
|
|
194
|
225
|
fi
|
195
|
226
|
endef
|
|
@@ -199,11 +230,7 @@ define Package/postfix/prerm
|
199
|
230
|
# check if we are on real system
|
200
|
231
|
if [ -z "$${IPKG_INSTROOT}" ]; then
|
201
|
232
|
|
202
|
|
- if [ `ps | grep "postfix/master" | grep -cv grep` -gt 0 ]
|
203
|
|
- then
|
204
|
|
- postfix stop
|
205
|
|
- fi
|
206
|
|
-
|
|
233
|
+ ps | grep "postfix/master" | grep -cvq grep >/dev/null && postfix stop
|
207
|
234
|
/etc/init.d/postfix disable
|
208
|
235
|
|
209
|
236
|
fi
|
|
@@ -213,7 +240,7 @@ define Package/postfix/postrm
|
213
|
240
|
#!/bin/sh
|
214
|
241
|
# check if we are on real system
|
215
|
242
|
if [ -z "$${IPKG_INSTROOT}" ]; then
|
216
|
|
- rm -f $(config_directory)/aliases.cdb $(data_directory)/master.lock
|
|
243
|
+ rm -f $(config_directory)/aliases.cdb $(config_directory)/aliases.db $(data_directory)/master.lock
|
217
|
244
|
|
218
|
245
|
rm -f "$(sendmail_path)" "$(newaliases_path)" "$(mailq_path)"
|
219
|
246
|
|