| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316 |
- ##
- ## dbmail.spec -- OpenPKG RPM Package Specification
- ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
- ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
- ##
- ## Permission to use, copy, modify, and distribute this software for
- ## any purpose with or without fee is hereby granted, provided that
- ## the above copyright notice and this permission notice appear in all
- ## copies.
- ##
- ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
- ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- ## SUCH DAMAGE.
- ##
- # package component versions
- %define V_major 2.2
- %define V_minor 6
- %define V_micro rc2
- # package information
- Name: dbmail
- Summary: Fast Scalable RDBMS Mail Server
- URL: http://www.dbmail.org/
- Vendor: IC&S
- Packager: OpenPKG Foundation e.V.
- Distribution: OpenPKG Community
- Class: EVAL
- Group: Mail
- License: GPL
- Version: %{V_major}.%{V_minor}%{V_micro}
- Release: 20070905
- # package options
- %option with_fsl yes
- %option with_sieve yes
- %option with_sqlite yes
- %option with_mysql no
- %option with_pgsql no
- %option with_ldap no
- # checking for option conflicts
- %if "%{with_sqlite}" == "no" && "%{with_mysql}" == "no" && "%{with_pgsql}" == "no"
- %{error:one of the build-time options 'with_sqlite', 'with_mysql' or 'with_pgsql' have to be enabled}
- %endif
- # list of sources
- Source0: http://www.dbmail.org/download/%{V_major}/dbmail-%{V_major}.%{V_minor}-%{V_micro}.tar.gz
- Source1: fsl.dbmail
- Source2: rc.dbmail
- Source3: dbmail-setup.sh
- Patch0: dbmail.patch
- # build information
- Prefix: %{l_prefix}
- BuildRoot: %{l_buildroot}
- BuildPreReq: OpenPKG, openpkg >= 20060823, make, gcc, pkgconfig
- PreReq: OpenPKG, openpkg >= 20060823, MTA
- BuildPreReq: libiconv, gettext, gc, glib2, gmime
- PreReq: libiconv, gettext, gc, glib2, gmime
- %if "%{with_fsl}" == "yes"
- BuildPreReq: fsl >= 1.6.0
- PreReq: fsl >= 1.6.0
- %endif
- %if "%{with_sieve}" == "yes"
- BuildPreReq: libsieve >= 2.2
- PreReq: libsieve >= 2.2
- %endif
- %if "%{with_sqlite}" == "yes"
- BuildPreReq: sqlite >= 3.4.1
- PreReq: sqlite >= 3.4.1
- %endif
- %if "%{with_mysql}" == "yes"
- BuildPreReq: mysql, mysql::with_innobase = yes, zlib
- PreReq: mysql, mysql::with_innobase = yes, zlib
- %endif
- %if "%{with_pgsql}" == "yes"
- BuildPreReq: postgresql, openssl
- PreReq: postgresql, openssl
- %endif
- %if "%{with_ldap}" == "yes"
- BuildPreReq: openldap, openssl
- PreReq: openldap, openssl
- %endif
- AutoReq: no
- AutoReqProv: no
- %description
- DBMail is a collection of programs that enables Email to be
- stored in and retrieved from a RDBMS. Currently SQLite, MySQL
- and PostgreSQL can be used as RDBMS. Advantages of DBMail are
- in the areas of scalability, manageability, speed, security and
- flexibility.
- %track
- prog dbmail = {
- version = %{version}
- url = http://www.dbmail.org/index.php?page=download
- regex = dbmail-(\d+\.[02468](?:\.\d+)+)\.tar\.gz
- }
- %prep
- %setup -q -n dbmail-%{V_major}.%{V_minor}-%{V_micro}
- %patch -p0
- %build
- export CC="%{l_cc}"
- export CFLAGS="%{l_cflags -O}"
- export CPPFLAGS="%{l_cppflags}"
- export LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}"
- export LIBS="%{l_fsl_libs}"
- %if "%{with_pgsql}" == "yes"
- LIBS="$LIBS -lssl -lcrypto"
- %endif
- %if "%{with_ldap}" == "yes"
- LIBS="$LIBS -llber -lssl -lcrypto"
- %endif
- ./configure \
- --prefix=%{l_prefix} \
- --mandir=%{l_prefix}/man \
- --sysconfdir=%{l_prefix}/etc/dbmail \
- --localstatedir=%{l_prefix}/var/dbmail/run \
- --with-logdir=%{l_prefix}/var/dbmail/log \
- --with-gc=%{l_prefix} \
- %if "%{with_sieve}" == "yes"
- --with-sieve=%{l_prefix}/include \
- %endif
- %if "%{with_sqlite}" == "yes"
- --with-sqlite \
- %else
- --without-sqlite \
- %endif
- %if "%{with_mysql}" == "yes"
- --with-mysql \
- %else
- --without-mysql \
- %endif
- %if "%{with_pgsql}" == "yes"
- --with-pgsql \
- %else
- --without-pgsql \
- %endif
- %if "%{with_ldap}" == "yes"
- --with-auth-ldap=%{l_prefix}/include \
- %else
- --without-auth-ldap \
- %endif
- --disable-shared \
- --enable-static
- %{l_make} %{l_mflags -O}
- %install
- rm -rf $RPM_BUILD_ROOT
- # install DBMail
- %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
- # create additional directories
- %{l_shtool} mkdir -f -p -m 755 \
- $RPM_BUILD_ROOT%{l_prefix}/etc/dbmail \
- $RPM_BUILD_ROOT%{l_prefix}/var/dbmail/db \
- $RPM_BUILD_ROOT%{l_prefix}/var/dbmail/log \
- $RPM_BUILD_ROOT%{l_prefix}/var/dbmail/run
- # strip down installation
- strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
- rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/dbmail >/dev/null 2>&1 || true
- # install run-command script
- %{l_shtool} mkdir -f -p -m 755 \
- $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
- %{l_shtool} install -c -m 755 %{l_value -s -a} \
- %{SOURCE rc.dbmail} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
- # install OSSP fsl configuration
- %{l_shtool} mkdir -f -p -m 755 \
- $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
- %{l_shtool} install -c -m 644 %{l_value -s -a} \
- %{SOURCE fsl.dbmail} \
- $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
- # install database setup stuff
- %if "%{with_sqlite}" == "yes"
- db_type='sqlite'
- db_script='sql/sqlite/create_tables.sqlite'
- %endif
- %if "%{with_mysql}" == "yes"
- db_type='mysql'
- db_script='sql/mysql/create_tables.mysql'
- %endif
- %if "%{with_pgsql}" == "yes"
- db_type='pgsql'
- db_script='sql/postgresql/create_tables.pgsql'
- %endif
- %{l_shtool} mkdir -f -p -m 755 \
- $RPM_BUILD_ROOT%{l_prefix}/share/dbmail
- %{l_shtool} install -c -m 644 \
- $db_script $RPM_BUILD_ROOT%{l_prefix}/share/dbmail/dbmail-setup.sql
- %{l_shtool} install -c -m 755 %{l_value -s -a} \
- -e "s;@l_bash@;%{l_bash};g" \
- -e "s;@db_type@;$db_type;g" \
- %{SOURCE dbmail-setup.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/dbmail-setup
- # install default configuration file
- %{l_shtool} install%{l_nil} -c -m 600 %{l_value -s -a} \
- -e 's;[ ]*$;;' \
- -e "s;^\\(driver[^=]*=\\).*$;\\1 $db_type;" \
- %if "%{with_ldap}" == "yes"
- -e 's;^\(authdriver[^=]*=\).*$;\1 ldap;' \
- %else
- -e 's;^\(authdriver[^=]*=\).*$;\1 sql;' \
- %endif
- %if "%{with_sqlite}" == "yes"
- -e 's;^\(user[^=]*=\).*$;\1 %{l_rusr};' \
- -e 's;^\(pass[^=]*=\).*$;\1 %{l_rgrp};' \
- -e 's;^\(db[^=]*=\).*$;\1 %{l_prefix}/var/dbmail/db/dbmail.db;' \
- %else
- -e 's;^\(user[^=]*=\).*$;\1 dbmail;' \
- -e 's;^\(pass[^=]*=\).*$;\1 dbmail;' \
- -e 's;^\(db[^=]*=\).*$;\1 dbmail;' \
- %endif
- -e 's;^\(sendmail[^=]*=\).*$;\1 %{l_prefix}/sbin/sendmail;' \
- -e 's;^\(EFFECTIVE_USER[^=]*=\).*$;\1 %{l_rusr};' \
- -e 's;^\(EFFECTIVE_GROUP[^=]*=\).*$;\1 %{l_rgrp};' \
- -e 's;^\(BINDIP[^=]*=\).*$;\1 127.0.0.1;' \
- -e 's;^\(RESOLVE_IP[^=]*=\).*$;\1 no;' \
- -e 's;^\(logfile[^=]*=\).*$;\1 %{l_prefix}/var/dbmail/log/dbmail-output.log;' \
- -e 's;^\(errorlog[^=]*=\).*$;\1 %{l_prefix}/var/dbmail/log/dbmail-output.log;' \
- -e 's;^\(pid_directory[^=]*=\).*$;\1 %{l_prefix}/var/dbmail/run;' \
- -e 's;^\(state_directory[^=]*=\).*$;\1 %{l_prefix}/var/dbmail/run;' \
- -e 's;dc=mydomain;dc=example;g' \
- dbmail.conf $RPM_BUILD_ROOT%{l_prefix}/etc/dbmail/
- # install additional setup documentation
- %{l_shtool} install%{l_nil} -c -m 644 \
- %if "%{with_sieve}" == "yes"
- README.sieve \
- %endif
- README.{aliases,exim,postfix,sieve,smtp,usermap} \
- $RPM_BUILD_ROOT%{l_prefix}/share/dbmail/
- # determine installation files
- %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
- '%config %attr(0640,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/dbmail/*' \
- '%config %{l_prefix}/etc/fsl/fsl.dbmail' \
- '%doc %{l_prefix}/share/dbmail/README.*' \
- '%dir %attr(0770,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/dbmail/*'
- %files -f files
- %clean
- rm -rf $RPM_BUILD_ROOT
- %post
- if [ $1 -eq 1 ]; then
- %if "%{with_sqlite}" == "yes"
- ( echo "Establishing initial DBMail SQLite database"
- ) | %{l_rpmtool} msg -b -t notice
- $RPM_INSTALL_PREFIX/sbin/dbmail-setup install
- %endif
- # display final hints on initial installation
- ( echo "First, please adjust the configuration file"
- echo " $RPM_INSTALL_PREFIX/etc/dbmail/dbmail.conf"
- echo "especially in terms of database configuration because"
- echo "those settings are relevant to the dbmail-setup utility."
- echo "To complete this installation of DBMail,"
- %if "%{with_sqlite}" != "yes"
- %if "%{with_mysql}" == "yes"
- echo "after starting your MySQL RDBMS with"
- echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc mysql start"
- %endif
- %if "%{with_pgsql}" == "yes"
- echo "after starting your PostgreSQL RDBMS with"
- echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc postgresql start"
- %endif
- echo "please establish the initial DBMail database with:"
- echo " \$ $RPM_INSTALL_PREFIX/sbin/dbmail-setup install"
- %endif
- echo "Then hook DBMail into your particular MTA manually."
- echo "For instance for the Postfix MTA this is achieved via:"
- echo " # transport:"
- echo " <domain> lmtp:127.0.0.1:24"
- echo "Finally, add each of your users to DBMail with:"
- echo " \$ $RPM_INSTALL_PREFIX/sbin/dbmail-users \\%{l_nil}"
- echo " -a <username> -w <password> -s <user>@<domain>"
- ) | %{l_rpmtool} msg -b -t notice
- elif [ $1 -eq 2 ]; then
- # after upgrade, restart service
- [ $1 -eq 2 ] || exit 0
- eval `%{l_rc} dbmail status 2>/dev/null`
- [ ".$dbmail_active" = .yes ] && %{l_rc} dbmail restart
- fi
- exit 0
- %preun
- if [ $1 -eq 0 ]; then
- # before erase, stop service and remove log files
- [ $1 -eq 0 ] || exit 0
- %{l_rc} dbmail stop 2>/dev/null
- $RPM_INSTALL_PREFIX/sbin/dbmail-setup uninstall >/dev/null 2>&1 || true
- rm -f $RPM_INSTALL_PREFIX/var/dbmail/db/* >/dev/null 2>&1 || true
- rm -f $RPM_INSTALL_PREFIX/var/dbmail/run/* >/dev/null 2>&1 || true
- rm -f $RPM_INSTALL_PREFIX/var/dbmail/log/* >/dev/null 2>&1 || true
- fi
- exit 0
|