Sat, 24 Mar 2012 21:40:49 +0100
Introduce many changes to the buildconf and source code including:
(01) clean up, update, and partially update default config files,
(02) seems that Melware is unable to perform release engineering so
update chan_capi to new daily snapshot to solve echo problems,
(03) correct Asterisk inadequate hard coded gmime version check,
(04) force postgresql pthreads linkage to solve build problem,
(05) remove buggy hard coded LibXML configure definitions,
(06) remove local architecture specification to allow GCC
internal logic to determine proper CPU type instead,
(07) remove vendor sound install target causing uncontrolled
downloads and non RPM managed file installation,
(08) solve long outstanding bug in tcptls causing Asterisk
to ignore any intermediate CA certificate signatures,
(09) back out Digium engineering team's bright idea of replacing the
very portable and pervasive POSIX rand(1) with ast_random(), and
then not even implementing it causing all references to fail in
platforms not providing the very new POSIX.1-2008 mkdtemp(3)
function only distributed by BSD and some Linux,
(10) withdraw advanced linker symbol manipulations from SVR5 builds
until either Binutils supports hybrid versioned and anonymous
linker scripts or GCC stops hard coding versioned linker scripts,
(11) correct missing library linkage, some tailored to a specific OS,
(12) remove outdated logic for the no longer distributed gmime-config(1),
(13) remove local gmime buildconf hacks now that Asterisk has corrected
their own build configuration to almost portably support gmime,
(14) solve build problems relating to undetected LibXML paths,
(15) correct erroneous out of tree include definitions,
(16) improve some variable and comment naming,
(17) simplify sound language path hierarchy creation,
and correct australian english installation logic.
michael@146 | 1 | ## |
michael@146 | 2 | ## postfix.spec -- OpenPKG RPM Package Specification |
michael@178 | 3 | ## Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/> |
michael@146 | 4 | ## |
michael@146 | 5 | ## Permission to use, copy, modify, and distribute this software for |
michael@146 | 6 | ## any purpose with or without fee is hereby granted, provided that |
michael@146 | 7 | ## the above copyright notice and this permission notice appear in all |
michael@146 | 8 | ## copies. |
michael@146 | 9 | ## |
michael@146 | 10 | ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
michael@146 | 11 | ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@146 | 12 | ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
michael@146 | 13 | ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
michael@146 | 14 | ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@146 | 15 | ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@146 | 16 | ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
michael@146 | 17 | ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
michael@146 | 18 | ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
michael@146 | 19 | ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
michael@146 | 20 | ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@146 | 21 | ## SUCH DAMAGE. |
michael@146 | 22 | ## |
michael@146 | 23 | |
michael@146 | 24 | # package versions |
michael@146 | 25 | %define V_postfix 2.5.6 |
michael@146 | 26 | %define V_pflogsumm 1.1.2 |
michael@146 | 27 | %define V_whoson 2.4.0 |
michael@146 | 28 | |
michael@146 | 29 | # package information |
michael@146 | 30 | Name: postfix |
michael@146 | 31 | Summary: Mail Transfer Agent (MTA) |
michael@146 | 32 | URL: http://www.postfix.org/ |
michael@146 | 33 | Vendor: Wietse Venema |
michael@146 | 34 | Packager: OpenPKG Foundation e.V. |
michael@146 | 35 | Distribution: OpenPKG Community |
michael@146 | 36 | Class: BASE |
michael@146 | 37 | Group: Mail |
michael@146 | 38 | License: IPL |
michael@146 | 39 | Version: %{V_postfix} |
michael@178 | 40 | Release: 20090418 |
michael@146 | 41 | |
michael@146 | 42 | # package options |
michael@146 | 43 | %option with_fsl yes |
michael@146 | 44 | %option with_ssl no |
michael@146 | 45 | %option with_sasl no |
michael@146 | 46 | %option with_mysql no |
michael@146 | 47 | %option with_pgsql no |
michael@146 | 48 | %option with_ldap no |
michael@146 | 49 | %option with_whoson no |
michael@146 | 50 | %option with_fdsetsize no |
michael@146 | 51 | |
michael@146 | 52 | # list of sources |
michael@146 | 53 | Source0: ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-%{V_postfix}.tar.gz |
michael@146 | 54 | Source1: http://jimsun.linxnet.com/downloads/pflogsumm-%{V_pflogsumm}.tar.gz |
michael@146 | 55 | Source2: postfix.txt |
michael@146 | 56 | Source3: fsl.postfix |
michael@146 | 57 | Source4: rc.postfix |
michael@146 | 58 | Patch0: postfix.patch |
michael@146 | 59 | Patch1: postfix.patch.pfls |
michael@146 | 60 | Patch2: ftp://ftp.openpkg.org/sources/CPY/postfix/postfix-%{V_whoson}-whoson.patch |
michael@146 | 61 | |
michael@146 | 62 | # build information |
michael@146 | 63 | Prefix: %{l_prefix} |
michael@146 | 64 | BuildRoot: %{l_buildroot} |
michael@146 | 65 | BuildPreReq: OpenPKG, openpkg >= 20060823, perl, gcc |
michael@146 | 66 | PreReq: OpenPKG, openpkg >= 20060823, perl, procmail, perl-time |
michael@146 | 67 | BuildPreReq: make, pcre, db |
michael@146 | 68 | PreReq: make, pcre, db |
michael@146 | 69 | %if "%{with_fsl}" == "yes" |
michael@146 | 70 | BuildPreReq: fsl |
michael@146 | 71 | PreReq: fsl |
michael@146 | 72 | %endif |
michael@146 | 73 | %if "%{with_ssl}" == "yes" |
michael@146 | 74 | BuildPreReq: openssl |
michael@146 | 75 | PreReq: openssl |
michael@146 | 76 | %endif |
michael@146 | 77 | %if "%{with_sasl}" == "yes" |
michael@146 | 78 | BuildPreReq: sasl |
michael@146 | 79 | PreReq: sasl |
michael@146 | 80 | %endif |
michael@146 | 81 | %if "%{with_mysql}" == "yes" |
michael@146 | 82 | BuildPreReq: mysql |
michael@146 | 83 | PreReq: mysql |
michael@146 | 84 | %endif |
michael@146 | 85 | %if "%{with_pgsql}" == "yes" |
michael@146 | 86 | BuildPreReq: postgresql, openssl |
michael@146 | 87 | PreReq: postgresql, openssl |
michael@146 | 88 | %endif |
michael@146 | 89 | %if "%{with_ldap}" == "yes" |
michael@146 | 90 | BuildPreReq: openldap, openssl |
michael@146 | 91 | PreReq: openldap, openssl |
michael@146 | 92 | %endif |
michael@146 | 93 | %if "%{with_whoson}" == "yes" |
michael@146 | 94 | BuildPreReq: whoson |
michael@146 | 95 | PreReq: whoson |
michael@146 | 96 | %endif |
michael@146 | 97 | AutoReq: no |
michael@146 | 98 | AutoReqProv: no |
michael@146 | 99 | Provides: MTA |
michael@146 | 100 | Conflicts: exim, sendmail, ssmtp |
michael@146 | 101 | |
michael@146 | 102 | %description |
michael@146 | 103 | Postfix is a new-generation Mail Transfer Agent (MTA) able to fully |
michael@146 | 104 | replace the Sendmail MTA. It is fully standards compliant and |
michael@146 | 105 | supports SMTP, ESMTP, LMTP over IPv4/IPv6 with optional TLS/SASL. |
michael@146 | 106 | |
michael@146 | 107 | Local specifics in this OpenPKG version: |
michael@146 | 108 | o Postfix delivers locally via Procmail |
michael@146 | 109 | o Postfix logs directly to the filesystem via OSSP fsl |
michael@146 | 110 | o Berkeley-DB dictionary support |
michael@146 | 111 | o PCRE matching support |
michael@146 | 112 | o Optional STARTTLS encryption support (see package options) |
michael@146 | 113 | o Optional SASL2 authentication support (see package options) |
michael@146 | 114 | o Optional MySQL dictionary support (see package options) |
michael@146 | 115 | o Optional PostgreSQL dictionary support (see package options) |
michael@146 | 116 | o Optional OpenLDAP dictionary support (see package options) |
michael@146 | 117 | o Optional WHOSON dictionary support (see package options) |
michael@146 | 118 | |
michael@146 | 119 | %track |
michael@146 | 120 | prog postfix = { |
michael@146 | 121 | version = %{V_postfix} |
michael@146 | 122 | url = ftp://ftp.porcupine.org/mirrors/postfix-release/official/ |
michael@146 | 123 | regex = postfix-(\d+\.\d+\.\d+)\.tar\.gz |
michael@146 | 124 | } |
michael@146 | 125 | prog postfix:pflogsumm = { |
michael@146 | 126 | version = %{V_pflogsumm} |
michael@146 | 127 | url = http://jimsun.linxnet.com/postfix_contrib.html |
michael@146 | 128 | regex = pflogsumm-(__VER__)\.tar\.gz |
michael@146 | 129 | } |
michael@146 | 130 | prog postfix:whoson = { |
michael@146 | 131 | version = %{V_whoson} |
michael@146 | 132 | url = ftp://ftp.openpkg.org/sources/CPY/postfix/ |
michael@146 | 133 | regex = postfix-(__VER__)-whoson.patch |
michael@146 | 134 | } |
michael@146 | 135 | |
michael@146 | 136 | %prep |
michael@146 | 137 | # unpack distribution files |
michael@146 | 138 | %setup -q |
michael@146 | 139 | %setup -q -T -D -a 1 |
michael@146 | 140 | |
michael@146 | 141 | # apply OpenPKG patches |
michael@146 | 142 | %patch -p0 |
michael@146 | 143 | ( cd pflogsumm-%{V_pflogsumm} && %{l_patch} -p0 -b <%{PATCH1} ) || exit $? |
michael@146 | 144 | |
michael@178 | 145 | # remove OpenPKG privelege model incompatible exit conditions |
michael@178 | 146 | %{l_shtool} subst \ |
michael@178 | 147 | -e 's;msg_fatal\(.*attribute specifies mail system\);msg_info\1;g' \ |
michael@178 | 148 | src/pipe/pipe.c |
michael@178 | 149 | |
michael@146 | 150 | # apply vendor WHOSON patch |
michael@146 | 151 | %if "%{with_whoson}" == "yes" |
michael@146 | 152 | %patch -p0 -P 2 |
michael@146 | 153 | %endif |
michael@146 | 154 | |
michael@146 | 155 | %build |
michael@146 | 156 | # configure Postfix (hard-core part I) |
michael@146 | 157 | %{l_shtool} subst \ |
michael@146 | 158 | -e 's/var_config_dir, /var_command_dir, /' \ |
michael@146 | 159 | src/postfix/postfix.c |
michael@146 | 160 | %{l_shtool} subst \ |
michael@146 | 161 | -e 's;config_directory/postfix-script;command_directory/postfix-script;' \ |
michael@146 | 162 | -e 's;config_directory/post-install;command_directory/postfix-install;' \ |
michael@146 | 163 | conf/postfix-script |
michael@146 | 164 | %{l_shtool} subst \ |
michael@146 | 165 | -e 's;/usr/include;%{l_prefix}/include;g' \ |
michael@146 | 166 | makedefs |
michael@146 | 167 | |
michael@146 | 168 | # configure Postfix (regular part) |
michael@146 | 169 | unset LD_LIBRARY_PATH || true |
michael@146 | 170 | CCARGS="" |
michael@146 | 171 | CCARGS="$CCARGS %{l_cflags -O}" |
michael@146 | 172 | CCARGS="$CCARGS %{l_cppflags}" |
michael@146 | 173 | CCARGS="$CCARGS -DDEF_COMMAND_DIR=\\\"%{l_prefix}/sbin\\\"" |
michael@146 | 174 | CCARGS="$CCARGS -DDEF_SENDMAIL_PATH=\\\"%{l_prefix}/sbin/sendmail\\\"" |
michael@146 | 175 | CCARGS="$CCARGS -DDEF_CONFIG_DIR=\\\"%{l_prefix}/etc/postfix\\\"" |
michael@146 | 176 | CCARGS="$CCARGS -DDEF_DAEMON_DIR=\\\"%{l_prefix}/libexec/postfix\\\"" |
michael@146 | 177 | CCARGS="$CCARGS -DDEF_QUEUE_DIR=\\\"%{l_prefix}/var/postfix\\\"" |
michael@146 | 178 | CCARGS="$CCARGS -DDEF_DATA_DIR=\\\"%{l_prefix}/var/postfix/data\\\"" |
michael@146 | 179 | AUXLIBS="" |
michael@146 | 180 | AUXLIBS="$AUXLIBS %{l_ldflags}" |
michael@146 | 181 | CCARGS="$CCARGS -DHAS_DB" |
michael@146 | 182 | AUXLIBS="$AUXLIBS -ldb" |
michael@146 | 183 | CCARGS="$CCARGS -DHAS_PCRE" |
michael@146 | 184 | AUXLIBS="$AUXLIBS -lpcre" |
michael@146 | 185 | %if "%{with_mysql}" == "yes" |
michael@146 | 186 | CCARGS="$CCARGS -DHAS_MYSQL %{l_cppflags mysql .}" |
michael@146 | 187 | AUXLIBS="$AUXLIBS %{l_ldflags mysql .} -lmysqlclient -lz -lm" |
michael@146 | 188 | %endif |
michael@146 | 189 | %if "%{with_pgsql}" == "yes" |
michael@146 | 190 | CCARGS="$CCARGS -DHAS_PGSQL %{l_cppflags postgresql .}" |
michael@146 | 191 | AUXLIBS="$AUXLIBS -lpq -lssl -lcrypto -lcrypt" |
michael@146 | 192 | %endif |
michael@146 | 193 | %if "%{with_sasl}" == "yes" |
michael@146 | 194 | CCARGS="$CCARGS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL %{l_cppflags sasl .}" |
michael@146 | 195 | AUXLIBS="$AUXLIBS -lsasl2 -lcrypt" |
michael@146 | 196 | if [ -f /usr/lib/libdl.so -o -f /usr/lib/libdl.a ]; then |
michael@146 | 197 | AUXLIBS="$AUXLIBS -ldl" |
michael@146 | 198 | fi |
michael@146 | 199 | if [ -f /usr/lib64/libdl.so -o -f /usr/lib64/libdl.a ]; then |
michael@146 | 200 | AUXLIBS="$AUXLIBS -ldl" |
michael@146 | 201 | fi |
michael@146 | 202 | %endif |
michael@146 | 203 | %if "%{with_ssl}" == "yes" |
michael@146 | 204 | CCARGS="$CCARGS -DUSE_TLS" |
michael@146 | 205 | AUXLIBS="$AUXLIBS -lssl -lcrypto" |
michael@146 | 206 | %endif |
michael@146 | 207 | %if "%{with_ldap}" == "yes" |
michael@146 | 208 | CCARGS="$CCARGS -DHAS_LDAP" |
michael@146 | 209 | AUXLIBS="$AUXLIBS -lldap -llber -lssl -lcrypto" |
michael@146 | 210 | %endif |
michael@146 | 211 | %if "%{with_fsl}" == "yes" |
michael@146 | 212 | AUXLIBS="$AUXLIBS %{l_fsl_ldflags} %{l_fsl_libs}" |
michael@146 | 213 | CCARGS="$CCARGS -DUSE_SOFTLIMITONLY" |
michael@146 | 214 | %endif |
michael@146 | 215 | %if "%{with_fdsetsize}" != "no" |
michael@146 | 216 | %if "%{with_fdsetsize}" == "yes" |
michael@146 | 217 | CCARGS="$CCARGS -DFD_SETSIZE=1024" |
michael@146 | 218 | %else |
michael@146 | 219 | CCARGS="$CCARGS -DFD_SETSIZE=%{with_fdsetsize}" |
michael@146 | 220 | %endif |
michael@146 | 221 | %endif |
michael@146 | 222 | case "%{l_platform -t}" in |
michael@146 | 223 | *-sunos* ) AUXLIBS="$AUXLIBS -lrt" ;; |
michael@146 | 224 | esac |
michael@146 | 225 | %{l_make} %{l_mflags} -f Makefile.init makefiles \ |
michael@146 | 226 | CC="%{l_cc}" CCARGS="$CCARGS" AUXLIBS="$AUXLIBS" |
michael@146 | 227 | |
michael@146 | 228 | # configure Postfix (hard-core part II) |
michael@146 | 229 | %{l_shtool} subst \ |
michael@146 | 230 | -e 's;#define HAS_DBM;#define HAS_DBM_DISABLED;' \ |
michael@146 | 231 | -e 's;#define HAS_DB;#define HAS_DB_DISABLED;' \ |
michael@146 | 232 | src/util/sys_defs.h |
michael@146 | 233 | |
michael@146 | 234 | # build Postfix |
michael@146 | 235 | %{l_make} %{l_mflags} |
michael@146 | 236 | |
michael@146 | 237 | %install |
michael@146 | 238 | rm -rf $RPM_BUILD_ROOT |
michael@146 | 239 | |
michael@146 | 240 | # perform standard installation procedure |
michael@146 | 241 | %{l_shtool} subst -e "s;chown;true;" postfix-install |
michael@146 | 242 | sh postfix-install -non-interactive \ |
michael@146 | 243 | install_root=$RPM_BUILD_ROOT \ |
michael@146 | 244 | config_directory=%{l_prefix}/etc/postfix \ |
michael@146 | 245 | daemon_directory=%{l_prefix}/libexec/postfix \ |
michael@146 | 246 | command_directory=%{l_prefix}/sbin \ |
michael@146 | 247 | queue_directory=%{l_prefix}/var/postfix \ |
michael@146 | 248 | data_directory=%{l_prefix}/var/postfix/data \ |
michael@146 | 249 | sendmail_path=%{l_prefix}/sbin/sendmail \ |
michael@146 | 250 | newaliases_path=%{l_prefix}/sbin/newaliases \ |
michael@146 | 251 | mailq_path=%{l_prefix}/sbin/mailq \ |
michael@146 | 252 | manpage_directory=%{l_prefix}/man \ |
michael@146 | 253 | mail_user=%{l_musr} \ |
michael@146 | 254 | setgid_group=%{l_rgrp} |
michael@146 | 255 | |
michael@146 | 256 | # post-adjust binaries |
michael@146 | 257 | rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/mailq |
michael@146 | 258 | ln $RPM_BUILD_ROOT%{l_prefix}/sbin/sendmail \ |
michael@146 | 259 | $RPM_BUILD_ROOT%{l_prefix}/sbin/mailq |
michael@146 | 260 | rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/newaliases |
michael@146 | 261 | ln $RPM_BUILD_ROOT%{l_prefix}/sbin/sendmail \ |
michael@146 | 262 | $RPM_BUILD_ROOT%{l_prefix}/sbin/newaliases |
michael@146 | 263 | strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true |
michael@146 | 264 | strip $RPM_BUILD_ROOT%{l_prefix}/libexec/postfix/* >/dev/null 2>&1 || true |
michael@146 | 265 | |
michael@146 | 266 | # post-adjust configuration |
michael@146 | 267 | for cfg in \ |
michael@146 | 268 | *LICENSE makedefs.out bounce.cf.default access aliases \ |
michael@146 | 269 | canonical header_checks relocated transport virtual \ |
michael@146 | 270 | main.cf master.cf main.cf.default; do |
michael@146 | 271 | rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/$cfg |
michael@146 | 272 | done |
michael@146 | 273 | mv $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/postfix-script \ |
michael@146 | 274 | $RPM_BUILD_ROOT%{l_prefix}/sbin/postfix-script |
michael@146 | 275 | rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/postfix-script* |
michael@146 | 276 | mv $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/post-install \ |
michael@146 | 277 | $RPM_BUILD_ROOT%{l_prefix}/sbin/postfix-install |
michael@146 | 278 | |
michael@146 | 279 | # install default configuration |
michael@146 | 280 | for name in `grep "^<file" %{SOURCE postfix.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do |
michael@146 | 281 | (echo ""; cat %{SOURCE postfix.txt}; echo "") |\ |
michael@146 | 282 | sed -e "1,/^<file name=\"$name\">/d" -e "/<\/file>/,\$d" >$name |
michael@146 | 283 | %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
michael@146 | 284 | $name $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/ |
michael@146 | 285 | done |
michael@146 | 286 | |
michael@146 | 287 | # pre-create variable stuff |
michael@146 | 288 | ( cd $RPM_BUILD_ROOT%{l_prefix}/var/postfix |
michael@146 | 289 | %{l_shtool} mkdir -f -p -m 700 data |
michael@146 | 290 | %{l_shtool} mkdir -f -p -m 755 log |
michael@146 | 291 | ) || exit $? |
michael@146 | 292 | |
michael@146 | 293 | # install addons |
michael@146 | 294 | %{l_shtool} install -c -m 755 \ |
michael@146 | 295 | -e 's;/usr/sbin/sendmail;%{l_prefix}/sbin/sendmail;g' \ |
michael@146 | 296 | auxiliary/rmail/rmail $RPM_BUILD_ROOT%{l_prefix}/sbin/rmail |
michael@146 | 297 | %{l_shtool} install -c -m 755 \ |
michael@146 | 298 | -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \ |
michael@146 | 299 | -e 's;postconf -h;%{l_prefix}/sbin/postconf -h;' \ |
michael@146 | 300 | auxiliary/qshape/qshape.pl $RPM_BUILD_ROOT%{l_prefix}/sbin/qshape |
michael@146 | 301 | %{l_shtool} install -c -m 644 \ |
michael@146 | 302 | man/man1/qshape.1 $RPM_BUILD_ROOT%{l_prefix}/man/man8/qshape.8 |
michael@146 | 303 | ( cd pflogsumm-%{V_pflogsumm} |
michael@146 | 304 | %{l_shtool} install -c -m 755 \ |
michael@146 | 305 | -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \ |
michael@146 | 306 | pflogsumm.pl $RPM_BUILD_ROOT%{l_prefix}/sbin/pflogsumm |
michael@146 | 307 | %{l_shtool} install -c -m 644 \ |
michael@146 | 308 | pflogsumm.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/ |
michael@146 | 309 | ) || exit $? |
michael@146 | 310 | |
michael@146 | 311 | # install run-command script |
michael@146 | 312 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@146 | 313 | $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d |
michael@146 | 314 | %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
michael@146 | 315 | %{SOURCE rc.postfix} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
michael@146 | 316 | |
michael@146 | 317 | # adjust installation to avoid file name conflicts |
michael@146 | 318 | ( cd $RPM_BUILD_ROOT%{l_prefix}/man/man8 |
michael@146 | 319 | mv master.8 postfix_master.8 |
michael@146 | 320 | ) || exit $? |
michael@146 | 321 | |
michael@146 | 322 | # install OSSP fsl configuration |
michael@146 | 323 | %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl |
michael@146 | 324 | %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
michael@146 | 325 | %{SOURCE fsl.postfix} \ |
michael@146 | 326 | $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ |
michael@146 | 327 | |
michael@146 | 328 | # generate file list |
michael@146 | 329 | %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
michael@146 | 330 | %{l_files_std} \ |
michael@146 | 331 | '%config %{l_prefix}/etc/fsl/fsl.postfix' \ |
michael@146 | 332 | '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/postfix' \ |
michael@146 | 333 | '%config %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/postfix/*' \ |
michael@146 | 334 | '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/postfix/*' \ |
michael@146 | 335 | '%attr(2755,%{l_musr},%{l_rgrp}) %{l_prefix}/sbin/{postdrop,postqueue}' \ |
michael@146 | 336 | '%dir %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/postfix' \ |
michael@146 | 337 | '%dir %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/var/postfix' \ |
michael@146 | 338 | '%dir %attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/var/postfix/{maildrop,public}' |
michael@146 | 339 | |
michael@146 | 340 | %files -f files |
michael@146 | 341 | |
michael@146 | 342 | %clean |
michael@146 | 343 | rm -rf $RPM_BUILD_ROOT |
michael@146 | 344 | |
michael@146 | 345 | %pre |
michael@146 | 346 | # before upgrade, save status and stop service |
michael@146 | 347 | [ $1 -eq 2 ] || exit 0 |
michael@146 | 348 | eval `%{l_rc} postfix status 2>/dev/null | tee %{l_tmpfile}` |
michael@146 | 349 | %{l_rc} postfix stop 2>/dev/null |
michael@146 | 350 | exit 0 |
michael@146 | 351 | |
michael@146 | 352 | %post |
michael@146 | 353 | if [ $1 -eq 1 ]; then |
michael@146 | 354 | # after install, generate configuration |
michael@146 | 355 | ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} all; true ) >/dev/null 2>&1 |
michael@146 | 356 | fi |
michael@146 | 357 | if [ $1 -eq 2 ]; then |
michael@146 | 358 | # after upgrade, regenerate configuration |
michael@146 | 359 | ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} clean all; true ) >/dev/null 2>&1 |
michael@146 | 360 | # after upgrade, restore status |
michael@146 | 361 | eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} >/dev/null 2>&1 || true |
michael@146 | 362 | [ ".$postfix_active" = .yes ] && %{l_rc} postfix start |
michael@146 | 363 | fi |
michael@146 | 364 | exit 0 |
michael@146 | 365 | |
michael@146 | 366 | %preun |
michael@146 | 367 | # before erase, stop service and remove log files |
michael@146 | 368 | [ $1 -eq 0 ] || exit 0 |
michael@146 | 369 | %{l_rc} postfix stop 2>/dev/null |
michael@146 | 370 | rm -f $RPM_INSTALL_PREFIX/var/postfix/log/postfix.log* >/dev/null 2>&1 || true |
michael@146 | 371 | rm -f $RPM_INSTALL_PREFIX/var/postfix/log/postfix.sum* >/dev/null 2>&1 || true |
michael@146 | 372 | # remove generated configuration files |
michael@146 | 373 | ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} clean >/dev/null 2>&1; true ) || true |
michael@146 | 374 | # remove generated run-time files and directories |
michael@146 | 375 | rm -rf $RPM_INSTALL_PREFIX/etc/postfix/data/* |
michael@146 | 376 | rm -rf $RPM_INSTALL_PREFIX/var/postfix/pid/* |
michael@146 | 377 | rm -rf $RPM_INSTALL_PREFIX/var/postfix/private/* |
michael@146 | 378 | rm -rf $RPM_INSTALL_PREFIX/var/postfix/public/* |
michael@146 | 379 | find $RPM_INSTALL_PREFIX/var/postfix/active/ -type d -print |\ |
michael@146 | 380 | xargs rmdir >/dev/null 2>&1 || true |
michael@146 | 381 | find $RPM_INSTALL_PREFIX/var/postfix/incoming/ -type d -print |\ |
michael@146 | 382 | xargs rmdir >/dev/null 2>&1 || true |
michael@146 | 383 | exit 0 |
michael@146 | 384 |