X-Git-Url: https://git.tld-linux.org/?p=packages%2Fproftpd.git;a=blobdiff_plain;f=proftpd.spec;h=90d1feb3e1b3a81b22b238befda21cb11a414bd6;hp=e912b27d8ccd7d246e409ee6e0e089e235506b0c;hb=9cbe6e31af2a683cbd8eed7534a5f8bf8f3c2906;hpb=9494406f8c6b7947671f0be44998d28c0dbb047e diff --git a/proftpd.spec b/proftpd.spec index e912b27..90d1feb 100644 --- a/proftpd.spec +++ b/proftpd.spec @@ -24,7 +24,7 @@ Summary(pt_BR.UTF-8): Servidor FTP profissional, com sintaxe de configuração s Summary(zh_CN.UTF-8): 易于管理的,安全的 FTP 服务器 Name: proftpd Version: 1.3.6 -Release: 2 +Release: 6 Epoch: 2 License: GPL v2+ Group: Networking/Daemons @@ -44,6 +44,9 @@ Source9: %{name}-mod_pam.conf Source10: %{name}-mod_tls.conf Source11: %{name}-anonftp.conf Source12: %{name}-mod_clamav.conf +Source13: %{name}.logrotate +Source14: %{name}-server.crt +Source15: %{name}-server.key Patch0: %{name}-paths.patch Patch1: %{name}-noautopriv.patch URL: http://www.proftpd.org/ @@ -68,10 +71,59 @@ BuildRequires: postgresql-devel BuildRequires: rpmbuild(macros) >= 1.268 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) -%define _sysconfdir /etc/ftpd +%define _sysconfdir /etc/proftpd %define _localstatedir /var/run %define _libexecdir %{_prefix}/%{_lib}/%{name} +# macro called at module post scriptlet +%define module_post \ +if [ "$1" = "1" ]; then \ + if grep -iEqs "^ServerType[[:space:]]+inetd" %{_sysconfdir}/proftpd.conf; then \ + %service -q rc-inetd reload \ + elif grep -iEqs "^ServerType[[:space:]]+standalone" %{_sysconfdir}/proftpd.conf; then \ + %service -q proftpd restart \ + fi \ +fi + +# macro called at module postun scriptlet +%define module_postun \ +if [ "$1" = "0" ]; then \ + if grep -iEqs "^ServerType[[:space:]]+inetd" %{_sysconfdir}/proftpd.conf; then \ + %service -q rc-inetd reload \ + elif grep -iEqs "^ServerType[[:space:]]+standalone" %{_sysconfdir}/proftpd.conf; then \ + %service -q proftpd restart \ + fi \ +fi + +%define module_triggerun \ +if [ $1 -le 1 ]; then \ + exit 0 \ +fi \ +[ -d /etc/proftpd/conf.d ] || mkdir -p /etc/proftpd 2>/dev/null || : \ +%if "%1" == "mod_tls" \ +for f in /etc/ftpd/{conf.d/mod_tls.conf,server.crt,server.key}; do \ + f=${f##*/} \ + [ -f "/etc/ftpd/$f" ] && mv "/etc/ftpd/$f" /etc/proftpd 2>/dev/null || : \ + [ -f "/etc/ftpd/conf.d/$f" ] && mv "/etc/ftpd/conf.d/$f" /etc/proftpd/conf.d 2>/dev/null || : \ +done \ +%else \ +[ -f /etc/ftpd/conf.d/%1.conf ] && mv /etc/ftpd/conf.d/%1.conf /etc/proftpd/conf.d 2>/dev/null || : \ +%endif \ +sed -i -e 's|/etc/ftpd|/etc/proftpd|g' /etc/ftpd/conf.d/%1.conf 2>/dev/null \ +[ -n "$(find /etc/ftpd/conf.d -type d -empty 2>/dev/null)" ] && rmdir /etc/ftpd/conf.d 2>/dev/null || : \ +[ -n "$(find /etc/ftpd -type d -empty 2>/dev/null)" ] && rmdir /etc/ftpd 2>/dev/null || : + +# it's sooo annoying to write them +%define module_scripts() \ +%post %1 \ +%module_post \ +\ +%postun %1 \ +%module_postun \ +\ +%triggerun %1 -- proftpd-%1 \ +%module_triggerun + %description ProFTPD is a highly configurable FTP daemon for Unix and Unix-like operating systems. ProFTPD is designed to be somewhat of a "drop-in" @@ -497,8 +549,8 @@ MODARG=$(echo $MODULES | tr ' ' '\n' | sort -u | xargs | tr ' ' ':') %install rm -rf $RPM_BUILD_ROOT -install -d $RPM_BUILD_ROOT/etc/{pam.d,security,sysconfig/rc-inetd,rc.d/init.d} \ - $RPM_BUILD_ROOT/var/{lib/ftp/pub/Incoming,log,run/proftpd} \ +install -d $RPM_BUILD_ROOT/etc/{logrotate.d,pam.d,security,sysconfig/rc-inetd,rc.d/init.d} \ + $RPM_BUILD_ROOT/var/{lib/ftp/pub/Incoming,log/{archive,}/proftpd,run/proftpd} \ $RPM_BUILD_ROOT%{_sysconfdir}/conf.d \ $RPM_BUILD_ROOT%{_includedir}/%{name} @@ -510,7 +562,7 @@ install -d $RPM_BUILD_ROOT/etc/{pam.d,security,sysconfig/rc-inetd,rc.d/init.d} \ rm $RPM_BUILD_ROOT%{_sbindir}/in.proftpd install %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir} -install %{SOURCE9} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/mod_auth_pam.conf +cp -a %{SOURCE9} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/mod_auth_pam.conf MODULES=" mod_auth_file mod_ident @@ -529,13 +581,18 @@ mod_wrap for module in $MODULES; do echo "LoadModule $module.c" > $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/$module.conf done -install %{SOURCE10} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/mod_tls.conf -install %{SOURCE11} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/anonftp.conf -install %{SOURCE12} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/mod_clamav.conf +cp -a %{SOURCE10} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/mod_tls.conf +cp -a %{SOURCE11} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/anonftp.conf +cp -a %{SOURCE12} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/mod_clamav.conf + +cp -a %{SOURCE14} $RPM_BUILD_ROOT%{_sysconfdir}/server.crt +cp -a %{SOURCE15} $RPM_BUILD_ROOT%{_sysconfdir}/server.key -%{?with_pam:install %{SOURCE3} $RPM_BUILD_ROOT/etc/pam.d/ftp} -install %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/rc-inetd/ftpd -install %{SOURCE5} $RPM_BUILD_ROOT/etc/sysconfig/proftpd +cp -a %{SOURCE13} $RPM_BUILD_ROOT/etc/logrotate.d/proftpd + +%{?with_pam:cp -a %{SOURCE3} $RPM_BUILD_ROOT/etc/pam.d/ftp} +cp -a %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/rc-inetd/ftpd +cp -a %{SOURCE5} $RPM_BUILD_ROOT/etc/sysconfig/proftpd install %{SOURCE6} $RPM_BUILD_ROOT/etc/rc.d/init.d/proftpd install contrib/xferstats.holger-preiss $RPM_BUILD_ROOT%{_bindir}/xferstat @@ -598,33 +655,34 @@ if [ "$2" != 1 ]; then %service -q proftpd restart fi -# macro called at module post scriptlet -%define module_post \ -if [ "$1" = "1" ]; then \ - if grep -iEqs "^ServerType[[:space:]]+inetd" %{_sysconfdir}/proftpd.conf; then \ - %service -q rc-inetd reload \ - elif grep -iEqs "^ServerType[[:space:]]+standalone" %{_sysconfdir}/proftpd.conf; then \ - %service -q proftpd restart \ - fi \ +%triggerun common -- proftpd-common < 2:1.3.6-5 +if [ $1 -le 1 ]; then + exit 0 fi - -# macro called at module postun scriptlet -%define module_postun \ -if [ "$1" = "0" ]; then \ - if grep -iEqs "^ServerType[[:space:]]+inetd" %{_sysconfdir}/proftpd.conf; then \ - %service -q rc-inetd reload \ - elif grep -iEqs "^ServerType[[:space:]]+standalone" %{_sysconfdir}/proftpd.conf; then \ - %service -q proftpd restart \ - fi \ +[ -d /etc/proftpd/conf.d ] || mkdir -p /etc/proftpd/conf.d 2>/dev/null || : +for f in /etc/ftpd/{conf.d/mod_{auth_file,clamav,ident}.conf,ftpusers,ftpusers.default,proftpd.conf}; do + f=${f##*/} + [ -f "/etc/ftpd/$f" ] && mv "/etc/ftpd/$f" /etc/proftpd 2>/dev/null || : + [ -f "/etc/ftpd/conf.d/$f" ] && mv "/etc/ftpd/conf.d/$f" /etc/proftpd/conf.d 2>/dev/null || : +done +find /etc/proftpd -type f 2>/dev/null | xargs sed -i -e 's|/etc/ftpd|/etc/proftpd|g' 2>/dev/null +[ -n "$(find /etc/ftpd/conf.d -type d -empty 2>/dev/null)" ] && rmdir /etc/ftpd 2>/dev/null || : +[ -n "$(find /etc/ftpd -type d -empty 2>/dev/null)" ] && rmdir /etc/ftpd 2>/dev/null || : + +%triggerpostun common -- proftpd-common < 2:1.3.6-5 +echo +echo "Warning! Configuration has been migrated to /etc/proftpd." +echo + +%triggerun anonftp -- proftpd-anonftp < 2:1.3.6-5 +if [ $1 -le 1 ]; then + exit 0 fi - -# it's sooo annoying to write them -%define module_scripts() \ -%post %1 \ -%module_post \ -\ -%postun %1 \ -%module_postun +[ -d /etc/proftpd/conf.d ] || mkdir -p /etc/proftpd 2>/dev/null || : +[ -f /etc/ftpd/conf.d/anonftp.conf ] && mv /etc/ftpd/conf.d/anonftp.conf /etc/proftpd/conf.d 2>/dev/null || : +sed -i -e 's|/etc/ftpd|/etc/proftpd|g' /etc/ftpd/conf.d/anonftp.conf 2>/dev/null +[ -n "$(find /etc/ftpd/conf.d -type d -empty 2>/dev/null)" ] && rmdir /etc/ftpd 2>/dev/null || : +[ -n "$(find /etc/ftpd -type d -empty 2>/dev/null)" ] && rmdir /etc/ftpd 2>/dev/null || : %module_scripts mod_auth_pam %module_scripts mod_ldap @@ -647,6 +705,7 @@ fi %doc README.md README.capabilities README.classes README.controls README.IPv6 %doc README.modules %doc doc/*.html doc/contrib doc/howto doc/modules +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/proftpd %dir %attr(750,root,ftp) %dir %{_sysconfdir} %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*.conf %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %ghost %{_sysconfdir}/ftpusers @@ -655,7 +714,8 @@ fi %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/mod_auth_file.conf %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/mod_ident.conf %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/mod_clamav.conf -#%attr(640,root,root) %ghost /var/log/* +%attr(750,root,root) %dir /var/log/proftpd +%attr(750,root,root) %dir /var/log/archive/proftpd %attr(755,root,root) %{_bindir}/* %attr(755,root,root) %{_sbindir}/* %dir %{_libexecdir} @@ -777,6 +837,8 @@ fi %files mod_tls %defattr(644,root,root,755) %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/mod_tls.conf +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/server.crt +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/server.key %attr(755,root,root) %{_libexecdir}/mod_tls.so %files mod_wrap