Lines 9-25
BATCH=${BATCH:=no}
Link Here
|
9 |
POSTFIX_DEFAULT_MTA=${POSTFIX_DEFAULT_MTA:=no} |
9 |
POSTFIX_DEFAULT_MTA=${POSTFIX_DEFAULT_MTA:=no} |
10 |
|
10 |
|
11 |
# fixed vars |
11 |
# fixed vars |
12 |
PREFIX="%%PREFIX%%" |
12 |
MC_TEMPLATE="${PKG_ROOTDIR}${PKG_PREFIX}/share/postfix/mailer.conf.postfix" |
13 |
ETCDIR="%%ETCDIR%%" |
|
|
14 |
DAEMONDIR="%%DAEMONDIR%%" |
15 |
META_DIRECTORY="%%META_DIRECTORY%%" |
16 |
READMEDIR="%%READMEDIR%%" |
17 |
MC_TEMPLATE="%%DATADIR%%/mailer.conf.postfix" |
18 |
|
13 |
|
19 |
# FreeBSD <= 10.3 |
14 |
# FreeBSD <= 10.3 |
20 |
MC_BASE="/etc/mail/mailer.conf" |
15 |
MC_BASE="${PKG_ROOTDIR}etc/mail/mailer.conf" |
21 |
# FreeBSD >= 10.3 (and current) |
16 |
# FreeBSD >= 10.3 (and current) |
22 |
MC_LOCALBASE="%%LOCALBASE%%/etc/mail/mailer.conf" |
17 |
MC_LOCALBASE="${PKG_ROOTDIR}%%LOCALBASE%%/etc/mail/mailer.conf" |
23 |
USE_LOCALBASE_MAILER_CONF="%%USE_LOCALBASE_MAILER_CONF%%" |
18 |
USE_LOCALBASE_MAILER_CONF="%%USE_LOCALBASE_MAILER_CONF%%" |
24 |
|
19 |
|
25 |
if [ "${POSTFIX_DEFAULT_MTA}" = "no" ]; then |
20 |
if [ "${POSTFIX_DEFAULT_MTA}" = "no" ]; then |
Lines 54-60
show_not_activated_msg() {
Link Here
|
54 |
echo "To finish installation run the following commands:" |
49 |
echo "To finish installation run the following commands:" |
55 |
echo |
50 |
echo |
56 |
if [ "${USE_LOCALBASE_MAILER_CONF}" = "yes" ]; then |
51 |
if [ "${USE_LOCALBASE_MAILER_CONF}" = "yes" ]; then |
57 |
echo " mkdir -p %%LOCALBASE%%/etc/mail" |
52 |
echo " mkdir -p ${PKG_ROOTDIR}%%LOCALBASE%%/etc/mail" |
58 |
else |
53 |
else |
59 |
echo " mv -f ${mailerconf} ${mailerconf}.old" |
54 |
echo " mv -f ${mailerconf} ${mailerconf}.old" |
60 |
fi |
55 |
fi |
Lines 86-121
install_mailer_conf() {
Link Here
|
86 |
mailerconf=$1 |
81 |
mailerconf=$1 |
87 |
echo "Activate Postfix in ${mailerconf}" |
82 |
echo "Activate Postfix in ${mailerconf}" |
88 |
if [ "${USE_LOCALBASE_MAILER_CONF}" = "yes" ]; then |
83 |
if [ "${USE_LOCALBASE_MAILER_CONF}" = "yes" ]; then |
89 |
[ -d %%LOCALBASE%%/etc/mail ] || mkdir -p %%LOCALBASE%%/etc/mail |
84 |
[ -d "${PKG_ROOTDIR}%%LOCALBASE%%/etc/mail" ] || \ |
|
|
85 |
mkdir -p "${PKG_ROOTDIR}/%LOCALBASE%%/etc/mail" |
90 |
fi |
86 |
fi |
91 |
[ -f ${mailerconf} ] && mv -f ${mailerconf} ${mailerconf}.old |
87 |
[ -f ${mailerconf} ] && mv -f ${mailerconf} ${mailerconf}.old |
92 |
install -m 644 ${MC_TEMPLATE} ${mailerconf} |
88 |
install -m 644 ${MC_TEMPLATE} ${mailerconf} |
93 |
} |
89 |
} |
94 |
|
90 |
|
95 |
# ============================================================================== |
91 |
show_needs_reload_msg(){ |
96 |
# Run postfix reload |
92 |
echo "===============================================================" |
97 |
# This is a candidate for a dedicated pkg-post-upgrade script, but it seems |
93 |
echo "Postfix installation changed, please run 'postfix reload'" |
98 |
# this not fully implemented in pkg :(see upstream PR 941) |
94 |
echo "===============================================================" |
99 |
# ============================================================================== |
|
|
100 |
try_reload(){ |
101 |
${PREFIX}/sbin/postfix status 2>/dev/null |
102 |
if [ $? -eq 0 ]; then |
103 |
${PREFIX}/sbin/postfix reload |
104 |
else |
105 |
echo "postfix not running" |
106 |
fi |
107 |
} |
95 |
} |
108 |
|
96 |
|
109 |
# ============================================================================== |
97 |
# ============================================================================== |
110 |
# Run postfix post-install to fix permissions and new config values |
98 |
# Fix permissions and new config values after installation |
111 |
# ============================================================================== |
99 |
# ============================================================================== |
112 |
if [ "$2" = "POST-INSTALL" ]; then |
100 |
if [ "$2" = "POST-INSTALL" ]; then |
113 |
/bin/sh ${DAEMONDIR}/post-install tempdir=/tmp \ |
101 |
chroot "${PKG_ROOTDIR}" \ |
114 |
daemon_directory=${DAEMONDIR} \ |
102 |
"${PKG_PREFIX}"/sbin/postfix set-permissions upgrade-configuration |
115 |
meta_directory=${META_DIRECTORY} \ |
|
|
116 |
html_directory=${READMEDIR} \ |
117 |
readme_directory=${READMEDIR} \ |
118 |
upgrade-package |
119 |
fi |
103 |
fi |
120 |
|
104 |
|
121 |
# ============================================================================== |
105 |
# ============================================================================== |
Lines 130-136
if [ -f "${MC_BASE}" ]; then
Link Here
|
130 |
if [ $? -eq 0 ]; then |
114 |
if [ $? -eq 0 ]; then |
131 |
show_activated_msg ${MC_BASE} |
115 |
show_activated_msg ${MC_BASE} |
132 |
cmp_mailer ${MC_LOCALBASE} || install_mailer_conf ${MC_LOCALBASE} |
116 |
cmp_mailer ${MC_LOCALBASE} || install_mailer_conf ${MC_LOCALBASE} |
133 |
try_reload |
117 |
show_needs_reload_msg |
134 |
else |
118 |
else |
135 |
cmp_mailer ${MC_LOCALBASE} || install_choice ${MC_LOCALBASE} |
119 |
cmp_mailer ${MC_LOCALBASE} || install_choice ${MC_LOCALBASE} |
136 |
fi |
120 |
fi |
Lines 140-146
if [ -f "${MC_BASE}" ]; then
Link Here
|
140 |
install_choice ${MC_BASE} |
124 |
install_choice ${MC_BASE} |
141 |
else |
125 |
else |
142 |
show_activated_msg ${MC_BASE} |
126 |
show_activated_msg ${MC_BASE} |
143 |
try_reload |
127 |
show_needs_reload_msg |
144 |
fi |
128 |
fi |
145 |
fi |
129 |
fi |
146 |
|
130 |
|
Lines 151-154
else
Link Here
|
151 |
show_not_activated_msg ${MC_BASE} |
135 |
show_not_activated_msg ${MC_BASE} |
152 |
fi |
136 |
fi |
153 |
fi # -f "${MC_BASE}" |
137 |
fi # -f "${MC_BASE}" |
154 |
fi # "$2" = "POST-INSTALL" -a -z "${PACKAGE_BUILDING}" |
138 |
fi # "$2" = "POST-INSTALL" -a -z "${PACKAGE_BUILDING}" |