X-Git-Url: https://git.tld-linux.org/?p=packages%2Fproftpd.git;a=blobdiff_plain;f=proftpd.spec;fp=proftpd.spec;h=2b7c882fdaa36a949f9fc793b59159b32fd9d77a;hp=fcd03cacffcf2fdb8f1f6611c061c5e48ac0aa58;hb=7b21d79e3044100cf458d88f5f54c15b60b8c99d;hpb=ac9c232ffe12fb9fa6fb7b9f53a1650767bb3d2a diff --git a/proftpd.spec b/proftpd.spec index fcd03ca..2b7c882 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: 4 +Release: 5 Epoch: 2 License: GPL v2+ Group: Networking/Daemons @@ -71,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" @@ -606,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