|
@@ -98,7 +98,7 @@ endif
|
98
|
98
|
|
99
|
99
|
CCARGS+=-DDEF_DB_TYPE=\"$(default_database_type)\"
|
100
|
100
|
|
101
|
|
-config_directory=/etc/postfix
|
|
101
|
+config_directory=/etc/postfix# also add this to postfix init file
|
102
|
102
|
sample_directory=/etc/postfix
|
103
|
103
|
command_directory=/usr/sbin
|
104
|
104
|
daemon_directory=/usr/libexec/postfix
|
|
@@ -161,103 +161,67 @@ endef
|
161
|
161
|
|
162
|
162
|
define Package/postfix/postinst
|
163
|
163
|
#!/bin/sh
|
164
|
|
-# check if we are on real system
|
165
|
|
-if [ -z "$${IPKG_INSTROOT}" ]; then
|
166
|
164
|
|
167
|
|
- if [ -f "$(sendmail_path)" -a "$$(readlink "$(sendmail_path)")" != "$(sendmail_path)$(ln_suffix)" ]; then
|
168
|
|
- mv "$(sendmail_path)" "$(sendmail_path)$(ln_old_suffix)"
|
169
|
|
- echo "Warning: $(sendmail_path) saved as $(sendmail_path)$(ln_old_suffix)"
|
|
165
|
+ if [ -f "$${IPKG_INSTROOT}$(sendmail_path)" -a "$$(readlink "$${IPKG_INSTROOT}$(sendmail_path)")" != "$(sendmail_path)$(ln_suffix)" ]; then
|
|
166
|
+ mv "$${IPKG_INSTROOT}$(sendmail_path)" "$${IPKG_INSTROOT}$(sendmail_path)$(ln_old_suffix)"
|
|
167
|
+ echo "Warning: $${IPKG_INSTROOT}$(sendmail_path) saved as $${IPKG_INSTROOT}$(sendmail_path)$(ln_old_suffix)"
|
170
|
168
|
fi
|
171
|
|
- if [ ! -f "$(sendmail_path)" ]; then
|
172
|
|
- ln -s "$(sendmail_path)$(ln_suffix)" "$(sendmail_path)"
|
|
169
|
+ if [ ! -f "$${IPKG_INSTROOT}$(sendmail_path)" ]; then
|
|
170
|
+ ln -s "$${IPKG_INSTROOT}$(sendmail_path)$(ln_suffix)" "$(sendmail_path)"
|
173
|
171
|
fi
|
174
|
172
|
|
175
|
|
- if [ -f "$(newaliases_path)" -a "$$(readlink "$(newaliases_path)")" != "$(newaliases_path)$(ln_suffix)" ]; then
|
176
|
|
- mv "$(newaliases_path)" "$(newaliases_path)$(ln_old_suffix)"
|
177
|
|
- echo "Warning: $(newaliases_path) saved as $(newaliases_path)$(ln_old_suffix)"
|
|
173
|
+ if [ -f "$${IPKG_INSTROOT}$(newaliases_path)" -a "$$(readlink "$${IPKG_INSTROOT}$(newaliases_path)")" != "$(newaliases_path)$(ln_suffix)" ]; then
|
|
174
|
+ mv "$${IPKG_INSTROOT}$(newaliases_path)" "$${IPKG_INSTROOT}$(newaliases_path)$(ln_old_suffix)"
|
|
175
|
+ echo "Warning: $${IPKG_INSTROOT}$(newaliases_path) saved as $${IPKG_INSTROOT}$(newaliases_path)$(ln_old_suffix)"
|
178
|
176
|
fi
|
179
|
|
- if [ ! -f "$(newaliases_path)" ]; then
|
180
|
|
- ln -s "$(newaliases_path)$(ln_suffix)" "$(newaliases_path)"
|
|
177
|
+ if [ ! -f "$${IPKG_INSTROOT}$(newaliases_path)" ]; then
|
|
178
|
+ ln -s "$${IPKG_INSTROOT}$(newaliases_path)$(ln_suffix)" "$(newaliases_path)"
|
181
|
179
|
fi
|
182
|
180
|
|
183
|
|
- if [ -f "$(mailq_path)" -a "$$(readlink "$(mailq_path)")" != "$(mailq_path)$(ln_suffix)" ]; then
|
184
|
|
- mv "$(mailq_path)" "$(mailq_path)$(ln_old_suffix)"
|
185
|
|
- echo "Warning: $(mailq_path) saved as $(mailq_path)$(ln_old_suffix)"
|
|
181
|
+ if [ -f "$${IPKG_INSTROOT}$(mailq_path)" -a "$$(readlink "$${IPKG_INSTROOT}$(mailq_path)")" != "$(mailq_path)$(ln_suffix)" ]; then
|
|
182
|
+ mv "$${IPKG_INSTROOT}$(mailq_path)" "$${IPKG_INSTROOT}$(mailq_path)$(ln_old_suffix)"
|
|
183
|
+ echo "Warning: $${IPKG_INSTROOT}$(mailq_path) saved as $${IPKG_INSTROOT}$(mailq_path)$(ln_old_suffix)"
|
186
|
184
|
fi
|
187
|
185
|
if [ ! -f "$(mailq_path)" ]; then
|
188
|
|
- ln -s "$(mailq_path)$(ln_suffix)" "$(mailq_path)"
|
|
186
|
+ ln -s "$${IPKG_INSTROOT}$(mailq_path)$(ln_suffix)" "$(mailq_path)"
|
|
187
|
+ fi
|
|
188
|
+
|
|
189
|
+ grep -qc main\.cf "$${IPKG_INSTROOT}"/etc/sysupgrade.conf >/dev/null || echo "$(config_directory)/main.cf" >> "$${IPKG_INSTROOT}"/etc/sysupgrade.conf
|
|
190
|
+ grep -qc master\.cf "$${IPKG_INSTROOT}"/etc/sysupgrade.conf >/dev/null || echo "$(config_directory)/master.cf" >> "$${IPKG_INSTROOT}"/etc/sysupgrade.conf
|
|
191
|
+ grep -qc aliases "$${IPKG_INSTROOT}"/etc/sysupgrade.conf >/dev/null || echo "$(config_directory)/aliases" >> "$${IPKG_INSTROOT}"/etc/sysupgrade.conf
|
|
192
|
+
|
|
193
|
+ touch "$${IPKG_INSTROOT}$(config_directory)"/opkg_postinst
|
|
194
|
+
|
|
195
|
+ if [ -z "$${IPKG_INSTROOT}" ]; then
|
|
196
|
+ ps | grep "postfix/master" | grep -cvq grep >/dev/null && /etc/init.d/postfix reload
|
189
|
197
|
fi
|
190
|
198
|
|
191
|
|
- echo "myhostname = $$(uci get system.@system[0].hostname)" >> $(config_directory)/main.cf.default
|
192
|
|
- echo "mydomain = $$(uci get system.@system[0].hostname|sed -e "s/[^\.]*\.\(.*\)/\1/")" >> $(config_directory)/main.cf.default
|
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
|
194
|
|
-
|
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)"
|
213
|
|
-
|
214
|
|
- EXTRA_COMMANDS=create_users /etc/init.d/postfix create_users
|
215
|
|
-
|
216
|
|
- postfix set-permissions
|
217
|
|
- postfix post-install upgrade-source
|
218
|
|
- postfix upgrade-configuration
|
219
|
|
- newaliases
|
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
|
224
|
|
-
|
225
|
|
-fi
|
226
|
199
|
endef
|
227
|
200
|
|
228
|
201
|
define Package/postfix/prerm
|
229
|
202
|
#!/bin/sh
|
230
|
|
-# check if we are on real system
|
231
|
|
-if [ -z "$${IPKG_INSTROOT}" ]; then
|
232
|
|
-
|
233
|
203
|
ps | grep "postfix/master" | grep -cvq grep >/dev/null && postfix stop
|
234
|
204
|
/etc/init.d/postfix disable
|
235
|
|
-
|
236
|
|
-fi
|
237
|
205
|
endef
|
238
|
206
|
|
239
|
207
|
define Package/postfix/postrm
|
240
|
208
|
#!/bin/sh
|
241
|
|
-# check if we are on real system
|
242
|
|
-if [ -z "$${IPKG_INSTROOT}" ]; then
|
243
|
|
- rm -f $(config_directory)/aliases.cdb $(config_directory)/aliases.db $(data_directory)/master.lock
|
|
209
|
+ rm -f $${IPKG_INSTROOT}$(config_directory)/aliases.cdb $${IPKG_INSTROOT}$(config_directory)/aliases.db $${IPKG_INSTROOT}$(data_directory)/master.lock
|
244
|
210
|
|
245
|
|
- rm -f "$(sendmail_path)" "$(newaliases_path)" "$(mailq_path)"
|
|
211
|
+ rm -f "$${IPKG_INSTROOT}$(sendmail_path)" "$${IPKG_INSTROOT}$(newaliases_path)" "$${IPKG_INSTROOT}$(mailq_path)"
|
246
|
212
|
|
247
|
|
- if [ -f "$(sendmail_path)$(ln_old_suffix)" ]; then
|
248
|
|
- mv "$(sendmail_path)$(ln_old_suffix)" "$(sendmail_path)"
|
249
|
|
- echo "Warning: $(sendmail_path) restored from $(sendmail_path)$(ln_old_suffix)"
|
|
213
|
+ if [ -f "$${IPKG_INSTROOT}$(sendmail_path)$(ln_old_suffix)" ]; then
|
|
214
|
+ mv "$${IPKG_INSTROOT}$(sendmail_path)$(ln_old_suffix)" "$${IPKG_INSTROOT}$(sendmail_path)"
|
|
215
|
+ echo "Warning: $${IPKG_INSTROOT}$(sendmail_path) restored from $${IPKG_INSTROOT}$(sendmail_path)$(ln_old_suffix)"
|
250
|
216
|
fi
|
251
|
|
- if [ -f "$(newaliases_path)$(ln_old_suffix)" ]; then
|
252
|
|
- mv "$(newaliases_path)$(ln_old_suffix)" "$(newaliases_path)"
|
253
|
|
- echo "Warning: $(newaliases_path) restored from $(newaliases_path)$(ln_old_suffix)"
|
|
217
|
+ if [ -f "$${IPKG_INSTROOT}$(newaliases_path)$(ln_old_suffix)" ]; then
|
|
218
|
+ mv "$${IPKG_INSTROOT}$(newaliases_path)$(ln_old_suffix)" "$${IPKG_INSTROOT}$(newaliases_path)"
|
|
219
|
+ echo "Warning: $${IPKG_INSTROOT}$(newaliases_path) restored from $${IPKG_INSTROOT}$(newaliases_path)$(ln_old_suffix)"
|
254
|
220
|
fi
|
255
|
|
- if [ -f "$(mailq_path)$(ln_old_suffix)" ]; then
|
256
|
|
- mv "$(mailq_path)$(ln_old_suffix)" "$(mailq_path)"
|
257
|
|
- echo "Warning: $(mailq_path) restored from $(mailq_path)$(ln_old_suffix)"
|
|
221
|
+ if [ -f "$${IPKG_INSTROOT}$(mailq_path)$(ln_old_suffix)" ]; then
|
|
222
|
+ mv "$${IPKG_INSTROOT}$(mailq_path)$(ln_old_suffix)" "$${IPKG_INSTROOT}$(mailq_path)"
|
|
223
|
+ echo "Warning: $${IPKG_INSTROOT}$(mailq_path) restored from $${IPKG_INSTROOT}$(mailq_path)$(ln_old_suffix)"
|
258
|
224
|
fi
|
259
|
|
-
|
260
|
|
-fi
|
261
|
225
|
endef
|
262
|
226
|
|
263
|
227
|
$(eval $(call BuildPackage,postfix))
|