File proftpd.spec of Package proftpd

# spec file for package proftpd
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           proftpd
Summary:        Highly configurable GPL-licensed FTP server software
License:        GPL-2.0+
Group:          Productivity/Networking/Ftp/Servers
# Please save your time and do not update to "rc" versions.
# We only accept updates for "STABLE" Versions
Version:        1.3.4a
Release:        0
Source1:        %{name}.init
Source2:        %{name}.passwd
#PATCH-FIX-openSUSE: pam, logrotate, xinet
Patch100:       %{name}-1.3.4a-dist.patch
#PATCH-FIX-openSUSE: provide a useful default config
Patch101:       %{name}-1.3.4a-basic.conf.patch
#PATCH-FIX: provide more info on usage ;)
Patch102:       %{name}-1.3.4a-ftpasswd.patch
#PATCH-FIX: fix strip
Patch103:       %{name}-1.3.4a-strip.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  krb5-devel
BuildRequires:  libacl-devel
BuildRequires:  libattr-devel
BuildRequires:  mysql-devel
BuildRequires:  ncurses-devel
BuildRequires:  openldap2-devel
BuildRequires:  openssl-devel
BuildRequires:  pam-devel
BuildRequires:  pkg-config
BuildRequires:  postgresql-devel
BuildRequires:  sqlite3-devel
BuildRequires:  tcpd-devel
BuildRequires:  unixODBC-devel
Requires:       logrotate

ProFTPD is a highly configurable FTP daemon for Unix and Unix-like
operating systems.  See the README.ports file for more details about
the platforms on which ProFTPD in known or thought to build and run.

%package ldap
Summary:        LDAP Module for ProFTPD
Group:          Productivity/Networking/Ftp/Servers
Requires:       %{name} = %{version}

%description ldap
This is the LDAP Module for ProFTPD

%package mysql
Summary:        MySQL Module for ProFTPD
Group:          Productivity/Networking/Ftp/Servers
Requires:       %{name} = %{version}

%description mysql
This is the MySQL Module for ProFTPD

%package pgsql
Summary:        PostgreSQL Module for ProFTPD
Group:          Productivity/Networking/Ftp/Servers
Requires:       %{name} = %{version}

%description pgsql
This is the PostgreSQL Module for ProFTPD

%package radius
Summary:        Radius Module for ProFTPD
Group:          Productivity/Networking/Ftp/Servers
Requires:       %{name} = %{version}

%description radius
This is the Radius Module for ProFTPD

%package sqlite
Summary:        SQLite Module for ProFTPD
Group:          Productivity/Networking/Ftp/Servers
Requires:       %{name} = %{version}

%description sqlite
This is the SQLite Module for ProFTPD

%package devel
Summary:        Development files for ProFTPD
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}

%description devel
This package contains Development files for ProFTPD

%package doc
Summary:        Documentation for ProFTPD
Group:          Documentation/HTML
Requires:       %{name} = %{version}

%description doc
Here are Documentation for ProFTPD

%setup -q
%{__rm} README.AIX

PROFTPD_SHARED_MODS="$(for spec_mod in $(find contrib -name mod_\*.c); do echo "$(basename ${spec_mod%%.c})"; done | tr '\n' ':' | sed -e 's|:$||')"
%configure \
    --bindir=%{_sbindir} \
    --libexecdir=%{_libdir}/%{name} \
    --sysconfdir=%{_sysconfdir}/%{name} \
    --localstatedir=%{_localstatedir}/run/%{name} \
    --enable-sendfile \
    --enable-ipv6 \
    --enable-ctrls \
    --enable-facl \
    --enable-dso \
    --with-includes="%{_includedir}/mysql:%{_includedir}/pgsql" \

%{__make} %{?_smp_mflags}

%makeinstall INSTALL_USER=`id -un` INSTALL_GROUP=`id -gn`
%{__install} -D -m 0644 contrib/dist/rpm/ftp.pamd   $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/%{name}
%{__install} -D -m 0644 contrib/dist/rpm/xinetd   $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d/%{name}
%{__install} -D -m 0644 contrib/dist/rpm/%{name}.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name}
%{__install} -D -m 0755 %{S:1} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/%{name}
%{__ln_s} -f %{_sysconfdir}/init.d/%{name} $RPM_BUILD_ROOT%{_sbindir}/rc%{name}
%{__rm} -fv $RPM_BUILD_ROOT%{_libdir}/%{name}/*.{a,la}

# install ftpasswd
%{__install} -D -m 0755 contrib/ftpasswd $RPM_BUILD_ROOT%{_sbindir}/

# some needed dirs
%{__install} -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{conf.d,auth}
%{__install} -m 0644 %{S:2} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/auth/passwd
%{__install} -d -m 0750 $RPM_BUILD_ROOT/var/log/%{name}

# on `rpm -ivh` PARAM is 1
# on `rpm -Uvh` PARAM is 2
#if [ "$1" = "1" ]; then

# on `rpm -e` PARAM is 0
%stop_on_removal proftpd

# on `rpm -ivh` PARAM is 1
# on `rpm -Uvh` PARAM is 2
#if [ "$1" = "1" ]; then
#  #%{__sed} -i "s,\(.*disable.*=\ \)no,\1yes," %{_sysconfdir}/xinetd.d/%{name}
#  %{__sed} -i -e "s/@HOST@/$(hostname -s)/" %{_sysconfdir}/%{name}/%{name}.conf
%{fillup_and_insserv -f proftpd}

# on `rpm -e` PARAM is 0
if [ "$1" = "0" ]; then
%restart_on_update proftpd

%{__rm} -rf %{buildroot}

%doc contrib/README.*
#%doc contrib/xferstats.holger-preiss*
#%doc contrib/ftpasswd contrib/ftpquota
%doc sample-configurations/*.conf
%dir %attr(0755,root,root) %{_sysconfdir}/%{name}/
%dir %attr(0750,ftp,ftp) %{_sysconfdir}/%{name}/auth/
%config(noreplace) %attr(0644,root,ftp) %{_sysconfdir}/%{name}/auth/passwd
%dir %attr(0755,root,root) %{_sysconfdir}/%{name}/conf.d
%config(noreplace) %attr(0640,root,root) %{_sysconfdir}/%{name}/%{name}.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %{_sysconfdir}/pam.d/%{name}
%config(noreplace) %{_sysconfdir}/xinetd.d/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/blacklist.dat
%config(noreplace) %{_sysconfdir}/%{name}/dhparams.pem
%dir %attr(0750,ftp,ftp) %{_localstatedir}/log/%{name}
%ghost %{_localstatedir}/run/%{name}
%dir %attr(0755,root,root) %{_libdir}/%{name}/
%exclude %{_libdir}/%{name}/
%exclude %{_libdir}/%{name}/
%exclude %{_libdir}/%{name}/
%exclude %{_libdir}/%{name}/
%exclude %{_libdir}/%{name}/

%files ldap

%files mysql

%files pgsql

%files radius

%files sqlite

%files devel

%files doc
%doc doc/*.html doc/contrib doc/howto doc/modules