您最多能選擇 25 個主題 主題必須以字母或數字為開頭,可包含連接號「-」且最長為 35 個字元。
 
 
 
 
 
 

274 行
9.5 KiB

##
## proftpd.spec -- OpenPKG RPM Specification
## Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
## Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 2000-2004 Cable & Wireless <http://www.cw.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 information
Name: proftpd
Summary: Professional FTP Daemon
URL: http://www.proftpd.net/
Vendor: The ProFTPD Project
Packager: The OpenPKG Project
Distribution: OpenPKG [BASE]
Group: FTP
License: GPL
Version: 1.2.9
Release: 20031031
# package options
%option with_ifsession no
%option with_mysql no
%option with_pam no
%option with_pgsql no
%option with_ldap no
# checking option conflicts
%if "%{with_mysql}" == "yes" && "%{with_pgsql}" == "yes"
RPM ERROR: with_mysql conflicts with with_pgsql
%endif
# list of sources
Source0: ftp://ftp.proftpd.net/distrib/source/proftpd-%{version}.tar.bz2
Source1: proftpd.conf
Source2: proftpd.msg.goaway
Source3: proftpd.msg.login
Source4: rc.proftpd
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20030806, make
PreReq: OpenPKG, openpkg >= 20030806
BuildPreReq: ncurses, getopt
PreReq: ncurses, getopt
%if "%{with_mysql}" == "yes"
BuildPreReq: mysql
PreReq: mysql
%endif
%if "%{with_pam}" == "yes"
BuildPreReq: PAM
PreReq: PAM
%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
ProFTPD grew out of the desire to have a secure and configurable
FTP server, and out of a significant admiration of the Apache web
server. There are currently a very limited number of FTP servers
running on unix (or unix-like) hosts. The most commonly used server
is probably wu-ftpd. While wu-ftpd provides excellent performance
and is generally a good product, it lacks numerous features found
in newer Win32 FTP servers, and has a poor security history. Many
people, including the developers who work on ProFTPD have spent a
great deal of time fixing bugs and hacking features into wu-ftpd.
Unfortunately, it quickly became clear that a complete redesign was
necessary in order to implement the configurability and features
desired. ProFTPD is not a hack based on any other server, it's an
independent source tree from the ground up. Click here for a small
list of some of the sites ProFTPD powers -- many of them handling
large volumes of traffic on a daily basis.
%prep
%setup -q
# utils also require link with getopt
%{l_shtool} subst \
-e 's;\(\$(BUILD_FTPCOUNT_OBJS).*\);\1 %{l_ldflags} -lgetopt;g' \
-e 's;\(\$(BUILD_FTPSHUT_OBJS).*\);\1 %{l_ldflags} -lgetopt;g' \
-e 's;\(\$(BUILD_FTPTOP_OBJS).*\);\1 %{l_ldflags} -lgetopt;g' \
-e 's;\(\$(BUILD_FTPWHO_OBJS).*\);\1 %{l_ldflags} -lgetopt;g' \
Makefile.in
%if "%{with_mysql}" == "yes"
libs=`mysql_config --libs`
# libmysqlclient may require more libraries
%{l_shtool} subst \
-e "s;\(-lmysqlclient\);$libs;g" \
contrib/mod_sql_mysql.c
%endif
# libpq also requires openssl
# postgresql also doesn't provide its own include subdirectory
%{l_shtool} subst \
-e 's;\(-lpq\);\1 -lssl -lcrypto;g' \
-e 's;^\(#include <\)pgsql/\(libpq-fe.h>.*\)$;\1postgresql/\2;' \
contrib/mod_sql_postgres.c
# libldap also requires openssl
%{l_shtool} subst \
-e 's;\(-llber\);\1 -lssl -lcrypto;g' \
contrib/mod_ldap.c
%build
# make non-standard "rundir" the same as standard "sysconfdir"
%{l_shtool} subst \
-e 's;^\(rundir=@localstatedir@\)/proftpd;\1;' \
Make.rules.in
# write shutdown message file to OpenPKG instance, not outside
%{l_shtool} subst \
-e 's;\(#define SHUTMSG_PATH.*"\)\(/etc/\)\(shutmsg\)";\1%{l_prefix}\2proftpd/\3";' \
include/default_paths.h
# configure the ProFTPd source tree
MOD="mod_ratio:mod_readme"
MOD_INC="%{l_prefix}/include"
MOD_LIB="%{l_prefix}/lib"
%if "%{with_ifsession}" == "yes"
MOD="$MOD:mod_ifsession"
%endif
%if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes"
MOD="$MOD:mod_sql"
%if "%{with_mysql}" == "yes"
MOD="$MOD:mod_sql_mysql"
MOD_INC=":%{l_prefix}/include/mysql"
%endif
%if "%{with_pgsql}" == "yes"
MOD="$MOD:mod_sql_postgres"
MOD_INC=":%{l_prefix}/include/postgresql"
%endif
%endif
%if "%{with_ldap}" == "yes"
MOD="$MOD:mod_ldap"
%endif
CC="%{l_cc}" \
CFLAGS="%{l_cflags -O}" \
%if "%{with_pam}" == "yes"
CPPFLAGS="%{l_cppflags ncurses} -I`%{l_prefix}/etc/rc --query pam_incdir`" \
LDFLAGS="%{l_ldflags} -L`%{l_prefix}/etc/rc --query pam_libdir`" \
%else
CPPFLAGS="%{l_cppflags ncurses}" \
LDFLAGS="%{l_ldflags}" \
LIBS="-lgetopt" \
%endif
./configure \
--prefix=%{l_prefix} \
--sysconfdir=%{l_prefix}/etc/proftpd \
--localstatedir=%{l_prefix}/var/proftpd \
--with-modules="$MOD" \
--with-includes="$MOD_INC" \
--with-libraries="$MOD_LIB" \
--without-getopt \
%if "%{with_pam}" == "yes"
--enable-auth-pam
%else
--disable-auth-pam
%endif
# build ProFTPd programs
%{l_make} %{l_mflags}
%install
rm -rf $RPM_BUILD_ROOT
# make sure the "install" procedure does not try
# to perform explicit ownership assignments
%{l_shtool} subst -v \
-e 's;-o $(INSTALL_USER) -g $(INSTALL_GROUP);;g' \
-e 's;chown;true;g' \
Makefile
# perform the "install" procedure while redirecting
# it to the temporarily install area
%{l_make} %{l_mflags} \
install-proftpd install-utils install-man \
prefix=$RPM_BUILD_ROOT%{l_prefix} \
bindir=$RPM_BUILD_ROOT%{l_prefix}/bin \
sbindir=$RPM_BUILD_ROOT%{l_prefix}/sbin \
sysconfdir=$RPM_BUILD_ROOT%{l_prefix}/etc/proftpd \
localstatedir=$RPM_BUILD_ROOT%{l_prefix}/var/proftpd \
rundir=$RPM_BUILD_ROOT%{l_prefix}/var/proftpd
# strip installation
rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/in.proftpd
# install more stuff manually
%{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/share/proftpd
%{l_shtool} install -c -m 644 doc/faq.html \
$RPM_BUILD_ROOT%{l_prefix}/share/proftpd/faq.html
%{l_shtool} install -c -m 644 doc/Configuration.html \
$RPM_BUILD_ROOT%{l_prefix}/share/proftpd/cfg.html
# extended installation with own stuff
l_pam="#"
%if "%{with_pam}" == "yes"
l_pam=""
%endif
%{l_shtool} install -c -m 644 %{l_value -s -a} \
-e "s;@l_pam@;${l_pam};g" \
%{SOURCE proftpd.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/proftpd/
%{l_shtool} install -c -m 644 \
%{SOURCE proftpd.msg.goaway} \
%{SOURCE proftpd.msg.login} \
$RPM_BUILD_ROOT%{l_prefix}/etc/proftpd/
%{l_shtool} install -c -m 644 \
%{SOURCE proftpd.msg.login} \
$RPM_BUILD_ROOT%{l_prefix}/share/proftpd/.msg.login
%{l_shtool} install -c -m 644 \
%{SOURCE proftpd.msg.goaway} \
$RPM_BUILD_ROOT%{l_prefix}/share/proftpd/.msg.goaway
%{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.proftpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# determine the package ingredients
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %attr(0600,%{l_susr},%{l_sgrp}) %{l_prefix}/etc/proftpd/proftpd.conf'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT
%post
%if "%{with_pam}" == "yes"
# add PAM configuration entry
if [ $1 -eq 1 ]; then
$RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=proftpd
fi
%endif
# after upgrade, restart service
[ $1 -eq 2 ] || exit 0
eval `%{l_rc} proftpd status 2>/dev/null`
[ ".$proftpd_active" = .yes ] && %{l_rc} proftpd restart
exit 0
%preun
# before erase, stop service and remove log files
[ $1 -eq 0 ] || exit 0
%{l_rc} proftpd stop 2>/dev/null
rm -f $RPM_INSTALL_PREFIX/var/proftpd/*.log* >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/proftpd/*.pid >/dev/null 2>&1 || true
%if "%{with_pam}" == "yes"
# remove PAM configuration entry
$RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=proftpd
%endif
exit 0