Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
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@495 | 25 | %define V_postfix 2.9.4 |
michael@495 | 26 | %define V_pflogsumm 1.1.5 |
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@495 | 40 | Release: 20120800 |
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@495 | 46 | %option with_sqlite no |
michael@146 | 47 | %option with_mysql no |
michael@146 | 48 | %option with_pgsql no |
michael@146 | 49 | %option with_ldap no |
michael@146 | 50 | %option with_whoson no |
michael@676 | 51 | %option with_spfsrs no |
michael@146 | 52 | %option with_fdsetsize no |
michael@146 | 53 | |
michael@146 | 54 | # list of sources |
michael@146 | 55 | Source0: ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-%{V_postfix}.tar.gz |
michael@146 | 56 | Source1: http://jimsun.linxnet.com/downloads/pflogsumm-%{V_pflogsumm}.tar.gz |
michael@146 | 57 | Source2: postfix.txt |
michael@146 | 58 | Source3: fsl.postfix |
michael@146 | 59 | Source4: rc.postfix |
michael@146 | 60 | Patch0: postfix.patch |
michael@146 | 61 | Patch1: postfix.patch.pfls |
michael@495 | 62 | Patch2: http://download.openpkg.org/components/versioned/postfix/postfix-%{V_whoson}-whoson.patch |
michael@676 | 63 | Patch3: postfix-srs.patch |
michael@146 | 64 | |
michael@146 | 65 | # build information |
michael@671 | 66 | BuildPreReq: OpenPKG, openpkg >= 20100101, perl, gcc |
michael@671 | 67 | PreReq: OpenPKG, openpkg >= 20100101, perl, procmail, perl-time |
michael@146 | 68 | BuildPreReq: make, pcre, db |
michael@146 | 69 | PreReq: make, pcre, db |
michael@146 | 70 | %if "%{with_fsl}" == "yes" |
michael@146 | 71 | BuildPreReq: fsl |
michael@146 | 72 | PreReq: fsl |
michael@146 | 73 | %endif |
michael@146 | 74 | %if "%{with_ssl}" == "yes" |
michael@146 | 75 | BuildPreReq: openssl |
michael@146 | 76 | PreReq: openssl |
michael@146 | 77 | %endif |
michael@146 | 78 | %if "%{with_sasl}" == "yes" |
michael@146 | 79 | BuildPreReq: sasl |
michael@146 | 80 | PreReq: sasl |
michael@146 | 81 | %endif |
michael@495 | 82 | %if "%{with_sqlite}" == "yes" |
michael@495 | 83 | BuildPreReq: sqlite |
michael@495 | 84 | PreReq: sqlite |
michael@495 | 85 | %endif |
michael@146 | 86 | %if "%{with_mysql}" == "yes" |
michael@146 | 87 | BuildPreReq: mysql |
michael@146 | 88 | PreReq: mysql |
michael@146 | 89 | %endif |
michael@146 | 90 | %if "%{with_pgsql}" == "yes" |
michael@146 | 91 | BuildPreReq: postgresql, openssl |
michael@146 | 92 | PreReq: postgresql, openssl |
michael@146 | 93 | %endif |
michael@146 | 94 | %if "%{with_ldap}" == "yes" |
michael@146 | 95 | BuildPreReq: openldap, openssl |
michael@146 | 96 | PreReq: openldap, openssl |
michael@146 | 97 | %endif |
michael@146 | 98 | %if "%{with_whoson}" == "yes" |
michael@146 | 99 | BuildPreReq: whoson |
michael@146 | 100 | PreReq: whoson |
michael@146 | 101 | %endif |
michael@676 | 102 | %if "%{with_spfsrs}" == "yes" |
michael@676 | 103 | BuildPreReq: libsrs2 |
michael@676 | 104 | PreReq: libsrs2 |
michael@676 | 105 | %endif |
michael@146 | 106 | Provides: MTA |
michael@146 | 107 | Conflicts: exim, sendmail, ssmtp |
michael@146 | 108 | |
michael@146 | 109 | %description |
michael@146 | 110 | Postfix is a new-generation Mail Transfer Agent (MTA) able to fully |
michael@146 | 111 | replace the Sendmail MTA. It is fully standards compliant and |
michael@146 | 112 | supports SMTP, ESMTP, LMTP over IPv4/IPv6 with optional TLS/SASL. |
michael@146 | 113 | |
michael@146 | 114 | Local specifics in this OpenPKG version: |
michael@146 | 115 | o Postfix delivers locally via Procmail |
michael@146 | 116 | o Postfix logs directly to the filesystem via OSSP fsl |
michael@146 | 117 | o Berkeley-DB dictionary support |
michael@146 | 118 | o PCRE matching support |
michael@146 | 119 | o Optional STARTTLS encryption support (see package options) |
michael@146 | 120 | o Optional SASL2 authentication support (see package options) |
michael@495 | 121 | o Optional SQLite dictionary support (see package options) |
michael@146 | 122 | o Optional MySQL dictionary support (see package options) |
michael@146 | 123 | o Optional PostgreSQL dictionary support (see package options) |
michael@146 | 124 | o Optional OpenLDAP dictionary support (see package options) |
michael@146 | 125 | o Optional WHOSON dictionary support (see package options) |
michael@676 | 126 | o Optional SPF SRS protection support (see package options) |
michael@146 | 127 | |
michael@146 | 128 | %track |
michael@146 | 129 | prog postfix = { |
michael@146 | 130 | version = %{V_postfix} |
michael@146 | 131 | url = ftp://ftp.porcupine.org/mirrors/postfix-release/official/ |
michael@146 | 132 | regex = postfix-(\d+\.\d+\.\d+)\.tar\.gz |
michael@146 | 133 | } |
michael@146 | 134 | prog postfix:pflogsumm = { |
michael@146 | 135 | version = %{V_pflogsumm} |
michael@146 | 136 | url = http://jimsun.linxnet.com/postfix_contrib.html |
michael@146 | 137 | regex = pflogsumm-(__VER__)\.tar\.gz |
michael@146 | 138 | } |
michael@146 | 139 | prog postfix:whoson = { |
michael@146 | 140 | version = %{V_whoson} |
michael@495 | 141 | url = http://download.openpkg.org/components/versioned/postfix/ |
michael@146 | 142 | regex = postfix-(__VER__)-whoson.patch |
michael@146 | 143 | } |
michael@676 | 144 | prog postfix:spfsrs = { |
michael@676 | 145 | version = %{V_spfsrs} |
michael@676 | 146 | url = http://www.codefrickler.de/srs/ |
michael@676 | 147 | regex = postfix-srs-(__VER__).patch |
michael@676 | 148 | } |
michael@146 | 149 | |
michael@146 | 150 | %prep |
michael@146 | 151 | # unpack distribution files |
michael@146 | 152 | %setup -q |
michael@146 | 153 | %setup -q -T -D -a 1 |
michael@146 | 154 | |
michael@146 | 155 | # apply OpenPKG patches |
michael@146 | 156 | %patch -p0 |
michael@146 | 157 | ( cd pflogsumm-%{V_pflogsumm} && %{l_patch} -p0 -b <%{PATCH1} ) || exit $? |
michael@146 | 158 | |
michael@495 | 159 | # apply vendor WHOSON patch |
michael@495 | 160 | %if "%{with_whoson}" == "yes" |
michael@495 | 161 | %patch -p0 -P 2 |
michael@495 | 162 | %endif |
michael@495 | 163 | |
michael@676 | 164 | # apply vendor SPF SRS patch |
michael@676 | 165 | %if "%{with_spfsrs}" == "yes" |
michael@676 | 166 | %patch -p0 -P 3 |
michael@676 | 167 | %endif |
michael@676 | 168 | |
michael@178 | 169 | # remove OpenPKG privelege model incompatible exit conditions |
michael@178 | 170 | %{l_shtool} subst \ |
michael@178 | 171 | -e 's;msg_fatal\(.*attribute specifies mail system\);msg_info\1;g' \ |
michael@178 | 172 | src/pipe/pipe.c |
michael@178 | 173 | |
michael@495 | 174 | # platform specific corrections |
michael@495 | 175 | case "%{l_platform -t}" in |
michael@495 | 176 | *-sunos5.11 ) |
michael@495 | 177 | %{l_shtool} subst \ |
michael@495 | 178 | -e 's;#define HAS_NISPLUS;#undef HAS_NISPLUS;' \ |
michael@495 | 179 | src/util/sys_defs.h |
michael@495 | 180 | ;; |
michael@495 | 181 | esac |
michael@146 | 182 | |
michael@146 | 183 | %build |
michael@146 | 184 | # configure Postfix (hard-core part I) |
michael@146 | 185 | %{l_shtool} subst \ |
michael@146 | 186 | -e 's/var_config_dir, /var_command_dir, /' \ |
michael@146 | 187 | src/postfix/postfix.c |
michael@146 | 188 | %{l_shtool} subst \ |
michael@146 | 189 | -e 's;config_directory/postfix-script;command_directory/postfix-script;' \ |
michael@146 | 190 | -e 's;config_directory/post-install;command_directory/postfix-install;' \ |
michael@146 | 191 | conf/postfix-script |
michael@146 | 192 | %{l_shtool} subst \ |
michael@146 | 193 | -e 's;/usr/include;%{l_prefix}/include;g' \ |
michael@146 | 194 | makedefs |
michael@146 | 195 | |
michael@146 | 196 | # configure Postfix (regular part) |
michael@672 | 197 | rflags=`echo $LD_LIBRARY_PATH | %{l_shtool} subst -e 's;\(.\);-R\1;'` |
michael@672 | 198 | rflags=`echo $rflags | %{l_shtool} subst -e 's/:/ -R/g'` |
michael@146 | 199 | unset LD_LIBRARY_PATH || true |
michael@146 | 200 | CCARGS="" |
michael@146 | 201 | CCARGS="$CCARGS %{l_cflags -O}" |
michael@146 | 202 | CCARGS="$CCARGS %{l_cppflags}" |
michael@146 | 203 | CCARGS="$CCARGS -DDEF_COMMAND_DIR=\\\"%{l_prefix}/sbin\\\"" |
michael@146 | 204 | CCARGS="$CCARGS -DDEF_SENDMAIL_PATH=\\\"%{l_prefix}/sbin/sendmail\\\"" |
michael@146 | 205 | CCARGS="$CCARGS -DDEF_CONFIG_DIR=\\\"%{l_prefix}/etc/postfix\\\"" |
michael@146 | 206 | CCARGS="$CCARGS -DDEF_DAEMON_DIR=\\\"%{l_prefix}/libexec/postfix\\\"" |
michael@146 | 207 | CCARGS="$CCARGS -DDEF_QUEUE_DIR=\\\"%{l_prefix}/var/postfix\\\"" |
michael@146 | 208 | CCARGS="$CCARGS -DDEF_DATA_DIR=\\\"%{l_prefix}/var/postfix/data\\\"" |
michael@146 | 209 | AUXLIBS="" |
michael@672 | 210 | AUXLIBS="$AUXLIBS $rflags %{l_ldflags}" |
michael@146 | 211 | CCARGS="$CCARGS -DHAS_DB" |
michael@146 | 212 | AUXLIBS="$AUXLIBS -ldb" |
michael@146 | 213 | CCARGS="$CCARGS -DHAS_PCRE" |
michael@146 | 214 | AUXLIBS="$AUXLIBS -lpcre" |
michael@495 | 215 | %if "%{with_sqlite}" == "yes" |
michael@495 | 216 | CCARGS="$CCARGS -DHAS_SQLITE" |
michael@495 | 217 | AUXLIBS="$AUXLIBS -lsqlite3" |
michael@495 | 218 | %endif |
michael@146 | 219 | %if "%{with_mysql}" == "yes" |
michael@146 | 220 | CCARGS="$CCARGS -DHAS_MYSQL %{l_cppflags mysql .}" |
michael@146 | 221 | AUXLIBS="$AUXLIBS %{l_ldflags mysql .} -lmysqlclient -lz -lm" |
michael@146 | 222 | %endif |
michael@146 | 223 | %if "%{with_pgsql}" == "yes" |
michael@146 | 224 | CCARGS="$CCARGS -DHAS_PGSQL %{l_cppflags postgresql .}" |
michael@146 | 225 | AUXLIBS="$AUXLIBS -lpq -lssl -lcrypto -lcrypt" |
michael@146 | 226 | %endif |
michael@146 | 227 | %if "%{with_sasl}" == "yes" |
michael@146 | 228 | CCARGS="$CCARGS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL %{l_cppflags sasl .}" |
michael@146 | 229 | AUXLIBS="$AUXLIBS -lsasl2 -lcrypt" |
michael@146 | 230 | if [ -f /usr/lib/libdl.so -o -f /usr/lib/libdl.a ]; then |
michael@146 | 231 | AUXLIBS="$AUXLIBS -ldl" |
michael@146 | 232 | fi |
michael@146 | 233 | if [ -f /usr/lib64/libdl.so -o -f /usr/lib64/libdl.a ]; then |
michael@146 | 234 | AUXLIBS="$AUXLIBS -ldl" |
michael@146 | 235 | fi |
michael@146 | 236 | %endif |
michael@146 | 237 | %if "%{with_ssl}" == "yes" |
michael@146 | 238 | CCARGS="$CCARGS -DUSE_TLS" |
michael@146 | 239 | AUXLIBS="$AUXLIBS -lssl -lcrypto" |
michael@146 | 240 | %endif |
michael@146 | 241 | %if "%{with_ldap}" == "yes" |
michael@146 | 242 | CCARGS="$CCARGS -DHAS_LDAP" |
michael@146 | 243 | AUXLIBS="$AUXLIBS -lldap -llber -lssl -lcrypto" |
michael@146 | 244 | %endif |
michael@146 | 245 | %if "%{with_fsl}" == "yes" |
michael@146 | 246 | AUXLIBS="$AUXLIBS %{l_fsl_ldflags} %{l_fsl_libs}" |
michael@146 | 247 | CCARGS="$CCARGS -DUSE_SOFTLIMITONLY" |
michael@146 | 248 | %endif |
michael@676 | 249 | %if "%{with_spfsrs}" == "yes" |
michael@676 | 250 | CCARGS="$CCARGS -DHAS_SRS" |
michael@676 | 251 | AUXLIBS="$AUXLIBS -lsrs2" |
michael@676 | 252 | %endif |
michael@146 | 253 | %if "%{with_fdsetsize}" != "no" |
michael@146 | 254 | %if "%{with_fdsetsize}" == "yes" |
michael@146 | 255 | CCARGS="$CCARGS -DFD_SETSIZE=1024" |
michael@146 | 256 | %else |
michael@146 | 257 | CCARGS="$CCARGS -DFD_SETSIZE=%{with_fdsetsize}" |
michael@146 | 258 | %endif |
michael@146 | 259 | %endif |
michael@146 | 260 | case "%{l_platform -t}" in |
michael@146 | 261 | *-sunos* ) AUXLIBS="$AUXLIBS -lrt" ;; |
michael@146 | 262 | esac |
michael@146 | 263 | %{l_make} %{l_mflags} -f Makefile.init makefiles \ |
michael@146 | 264 | CC="%{l_cc}" CCARGS="$CCARGS" AUXLIBS="$AUXLIBS" |
michael@146 | 265 | |
michael@146 | 266 | # configure Postfix (hard-core part II) |
michael@146 | 267 | %{l_shtool} subst \ |
michael@146 | 268 | -e 's;#define HAS_DBM;#define HAS_DBM_DISABLED;' \ |
michael@146 | 269 | -e 's;#define HAS_DB;#define HAS_DB_DISABLED;' \ |
michael@146 | 270 | src/util/sys_defs.h |
michael@146 | 271 | |
michael@146 | 272 | # build Postfix |
michael@495 | 273 | %{l_make} %{l_mflags -O} |
michael@146 | 274 | |
michael@146 | 275 | %install |
michael@146 | 276 | |
michael@146 | 277 | # perform standard installation procedure |
michael@146 | 278 | %{l_shtool} subst -e "s;chown;true;" postfix-install |
michael@146 | 279 | sh postfix-install -non-interactive \ |
michael@146 | 280 | install_root=$RPM_BUILD_ROOT \ |
michael@146 | 281 | config_directory=%{l_prefix}/etc/postfix \ |
michael@146 | 282 | daemon_directory=%{l_prefix}/libexec/postfix \ |
michael@146 | 283 | command_directory=%{l_prefix}/sbin \ |
michael@146 | 284 | queue_directory=%{l_prefix}/var/postfix \ |
michael@146 | 285 | data_directory=%{l_prefix}/var/postfix/data \ |
michael@146 | 286 | sendmail_path=%{l_prefix}/sbin/sendmail \ |
michael@146 | 287 | newaliases_path=%{l_prefix}/sbin/newaliases \ |
michael@146 | 288 | mailq_path=%{l_prefix}/sbin/mailq \ |
michael@146 | 289 | manpage_directory=%{l_prefix}/man \ |
michael@146 | 290 | mail_user=%{l_musr} \ |
michael@146 | 291 | setgid_group=%{l_rgrp} |
michael@146 | 292 | |
michael@146 | 293 | # post-adjust binaries |
michael@146 | 294 | rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/mailq |
michael@146 | 295 | ln $RPM_BUILD_ROOT%{l_prefix}/sbin/sendmail \ |
michael@146 | 296 | $RPM_BUILD_ROOT%{l_prefix}/sbin/mailq |
michael@146 | 297 | rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/newaliases |
michael@146 | 298 | ln $RPM_BUILD_ROOT%{l_prefix}/sbin/sendmail \ |
michael@146 | 299 | $RPM_BUILD_ROOT%{l_prefix}/sbin/newaliases |
michael@146 | 300 | strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true |
michael@146 | 301 | strip $RPM_BUILD_ROOT%{l_prefix}/libexec/postfix/* >/dev/null 2>&1 || true |
michael@146 | 302 | |
michael@146 | 303 | # post-adjust configuration |
michael@146 | 304 | for cfg in \ |
michael@146 | 305 | *LICENSE makedefs.out bounce.cf.default access aliases \ |
michael@146 | 306 | canonical header_checks relocated transport virtual \ |
michael@146 | 307 | main.cf master.cf main.cf.default; do |
michael@146 | 308 | rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/$cfg |
michael@146 | 309 | done |
michael@146 | 310 | |
michael@146 | 311 | # install default configuration |
michael@146 | 312 | for name in `grep "^<file" %{SOURCE postfix.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do |
michael@146 | 313 | (echo ""; cat %{SOURCE postfix.txt}; echo "") |\ |
michael@146 | 314 | sed -e "1,/^<file name=\"$name\">/d" -e "/<\/file>/,\$d" >$name |
michael@146 | 315 | %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
michael@146 | 316 | $name $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/ |
michael@146 | 317 | done |
michael@146 | 318 | |
michael@146 | 319 | # pre-create variable stuff |
michael@146 | 320 | ( cd $RPM_BUILD_ROOT%{l_prefix}/var/postfix |
michael@146 | 321 | %{l_shtool} mkdir -f -p -m 700 data |
michael@146 | 322 | %{l_shtool} mkdir -f -p -m 755 log |
michael@146 | 323 | ) || exit $? |
michael@146 | 324 | |
michael@146 | 325 | # install addons |
michael@146 | 326 | %{l_shtool} install -c -m 755 \ |
michael@146 | 327 | -e 's;/usr/sbin/sendmail;%{l_prefix}/sbin/sendmail;g' \ |
michael@146 | 328 | auxiliary/rmail/rmail $RPM_BUILD_ROOT%{l_prefix}/sbin/rmail |
michael@146 | 329 | %{l_shtool} install -c -m 755 \ |
michael@146 | 330 | -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \ |
michael@146 | 331 | -e 's;postconf -h;%{l_prefix}/sbin/postconf -h;' \ |
michael@146 | 332 | auxiliary/qshape/qshape.pl $RPM_BUILD_ROOT%{l_prefix}/sbin/qshape |
michael@146 | 333 | %{l_shtool} install -c -m 644 \ |
michael@146 | 334 | man/man1/qshape.1 $RPM_BUILD_ROOT%{l_prefix}/man/man8/qshape.8 |
michael@146 | 335 | ( cd pflogsumm-%{V_pflogsumm} |
michael@146 | 336 | %{l_shtool} install -c -m 755 \ |
michael@146 | 337 | -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \ |
michael@146 | 338 | pflogsumm.pl $RPM_BUILD_ROOT%{l_prefix}/sbin/pflogsumm |
michael@146 | 339 | %{l_shtool} install -c -m 644 \ |
michael@146 | 340 | pflogsumm.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/ |
michael@146 | 341 | ) || exit $? |
michael@146 | 342 | |
michael@146 | 343 | # install run-command script |
michael@146 | 344 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@146 | 345 | $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d |
michael@146 | 346 | %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
michael@146 | 347 | %{SOURCE rc.postfix} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
michael@146 | 348 | |
michael@146 | 349 | # adjust installation to avoid file name conflicts |
michael@146 | 350 | ( cd $RPM_BUILD_ROOT%{l_prefix}/man/man8 |
michael@146 | 351 | mv master.8 postfix_master.8 |
michael@146 | 352 | ) || exit $? |
michael@146 | 353 | |
michael@146 | 354 | # install OSSP fsl configuration |
michael@146 | 355 | %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl |
michael@146 | 356 | %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
michael@146 | 357 | %{SOURCE fsl.postfix} \ |
michael@146 | 358 | $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ |
michael@146 | 359 | |
michael@146 | 360 | # generate file list |
michael@146 | 361 | %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
michael@146 | 362 | %{l_files_std} \ |
michael@146 | 363 | '%config %{l_prefix}/etc/fsl/fsl.postfix' \ |
michael@146 | 364 | '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/postfix' \ |
michael@146 | 365 | '%config %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/postfix/*' \ |
michael@146 | 366 | '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/postfix/*' \ |
michael@146 | 367 | '%attr(2755,%{l_musr},%{l_rgrp}) %{l_prefix}/sbin/{postdrop,postqueue}' \ |
michael@146 | 368 | '%dir %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/postfix' \ |
michael@146 | 369 | '%dir %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/var/postfix' \ |
michael@495 | 370 | '%dir %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/var/postfix/pid' \ |
michael@146 | 371 | '%dir %attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/var/postfix/{maildrop,public}' |
michael@146 | 372 | |
michael@146 | 373 | %files -f files |
michael@146 | 374 | |
michael@146 | 375 | %clean |
michael@146 | 376 | |
michael@146 | 377 | %pre |
michael@146 | 378 | # before upgrade, save status and stop service |
michael@146 | 379 | [ $1 -eq 2 ] || exit 0 |
michael@146 | 380 | eval `%{l_rc} postfix status 2>/dev/null | tee %{l_tmpfile}` |
michael@146 | 381 | %{l_rc} postfix stop 2>/dev/null |
michael@146 | 382 | exit 0 |
michael@146 | 383 | |
michael@146 | 384 | %post |
michael@146 | 385 | if [ $1 -eq 1 ]; then |
michael@146 | 386 | # after install, generate configuration |
michael@146 | 387 | ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} all; true ) >/dev/null 2>&1 |
michael@146 | 388 | fi |
michael@146 | 389 | if [ $1 -eq 2 ]; then |
michael@146 | 390 | # after upgrade, regenerate configuration |
michael@146 | 391 | ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} clean all; true ) >/dev/null 2>&1 |
michael@146 | 392 | # after upgrade, restore status |
michael@146 | 393 | eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} >/dev/null 2>&1 || true |
michael@146 | 394 | [ ".$postfix_active" = .yes ] && %{l_rc} postfix start |
michael@146 | 395 | fi |
michael@146 | 396 | exit 0 |
michael@146 | 397 | |
michael@146 | 398 | %preun |
michael@146 | 399 | # before erase, stop service and remove log files |
michael@146 | 400 | [ $1 -eq 0 ] || exit 0 |
michael@146 | 401 | %{l_rc} postfix stop 2>/dev/null |
michael@146 | 402 | rm -f $RPM_INSTALL_PREFIX/var/postfix/log/postfix.log* >/dev/null 2>&1 || true |
michael@146 | 403 | rm -f $RPM_INSTALL_PREFIX/var/postfix/log/postfix.sum* >/dev/null 2>&1 || true |
michael@146 | 404 | # remove generated configuration files |
michael@146 | 405 | ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} clean >/dev/null 2>&1; true ) || true |
michael@495 | 406 | # remove generated runtime files and directories |
michael@495 | 407 | rm -rf $RPM_INSTALL_PREFIX/var/postfix/data/* |
michael@146 | 408 | rm -rf $RPM_INSTALL_PREFIX/var/postfix/pid/* |
michael@146 | 409 | rm -rf $RPM_INSTALL_PREFIX/var/postfix/private/* |
michael@146 | 410 | rm -rf $RPM_INSTALL_PREFIX/var/postfix/public/* |
michael@146 | 411 | find $RPM_INSTALL_PREFIX/var/postfix/active/ -type d -print |\ |
michael@146 | 412 | xargs rmdir >/dev/null 2>&1 || true |
michael@146 | 413 | find $RPM_INSTALL_PREFIX/var/postfix/incoming/ -type d -print |\ |
michael@146 | 414 | xargs rmdir >/dev/null 2>&1 || true |
michael@146 | 415 | exit 0 |
michael@146 | 416 |