[proftpd: 3/4] Restore back-compatibility with older releases and EPEL
Paul Howarth
pghmcfc at fedoraproject.org
Wed Sep 28 18:27:20 UTC 2011
commit 660e337f54ce3fcddabe5637534ddabf97e3e9cd
Author: Paul Howarth <paul at city-fan.org>
Date: Wed Sep 28 18:56:58 2011 +0100
Restore back-compatibility with older releases and EPEL
- Restore back-compatibility with older releases and EPEL
- Use /run rather than /var/run if using systemd init
- Avoid the use of triggers in SysV-to-systemd migration
proftpd-tmpfs.conf | 2 +-
proftpd.spec | 144 +++++++++++++++++++++++++++++++++++++++-------------
2 files changed, 110 insertions(+), 36 deletions(-)
---
diff --git a/proftpd-tmpfs.conf b/proftpd-tmpfs.conf
index df49dff..a665223 100644
--- a/proftpd-tmpfs.conf
+++ b/proftpd-tmpfs.conf
@@ -1 +1 @@
-d /var/run/proftpd
+d @RUNDIR@/proftpd
diff --git a/proftpd.spec b/proftpd.spec
index 921fef6..eb26efe 100644
--- a/proftpd.spec
+++ b/proftpd.spec
@@ -3,6 +3,25 @@
# --with integrationtests enable integration tests (not fully maintained, may fail)
#
+# This package uses systemd init from Fedora 16, but can use it for
+# Fedora 15 if built using --with systemd
+%if 0%{?fedora} > 15 || 0%{?rhel} > 6
+%global _with_systemd --with-systemd
+%endif
+%global use_systemd %{!?_with_systemd:0}%{?_with_systemd:1}
+
+# With systemd, the runtime directory is /run rather than /var/run
+%if %{use_systemd}
+%global rundir /run
+%else
+%global rundir %{_localstatedir}/run
+%endif
+
+# rundir (/var/run or /run) is on tmpfs from Fedora 15, RHEL 7
+%if 0%{?fedora} > 14 || 0%{?rhel} > 6
+%global rundir_tmpfs 1
+%endif
+
# Use certs in %%{_sysconfdir}/pki/tls/certs if available (FC4, RHEL5 onwards)
%global use_pki %(if [ -d %{_sysconfdir}/pki/tls/certs ]; then echo 1; else echo 0; fi)
%if %{use_pki}
@@ -22,7 +41,7 @@
%endif
%global prever rc2
-%global rpmrel 12
+%global rpmrel 13
Summary: Flexible, stable and highly-configurable FTP server
Name: proftpd
@@ -33,7 +52,7 @@ Group: System Environment/Daemons
URL: http://www.proftpd.org/
Source0: ftp://ftp.proftpd.org/distrib/source/proftpd-%{version}%{?prever}.tar.bz2
Source1: proftpd.conf
-Source2: proftpd.service
+Source2: proftpd.init
Source3: proftpd-xinetd
Source4: proftpd.logrotate
Source5: proftpd-welcome.msg
@@ -50,6 +69,7 @@ Source12: proftpd-tmpfs.conf
# (they are disabled by default); it is not included as part of the built package and should therefore
# not fall foul of the rules against library bundling
Source13: http://search.cpan.org/CPAN/authors/id/C/CL/CLEMBURG/Test-Unit-0.14.tar.gz
+Source14: proftpd.service
Patch0: proftpd-1.3.2rc3-nostrip.patch
Patch1: proftpd-1.3.4rc2-apitests.patch
Patch2: proftpd.conf-no-memcached.patch
@@ -62,13 +82,21 @@ Patch9: proftpd-1.3.4rc2-bug3645.patch
Patch10: proftpd-1.3.4rc2-bug3649.patch
Patch11: proftpd-1.3.4rc2-bug3652.patch
Patch12: proftpd-1.3.4rc2-bug3653.patch
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+Requires(preun): coreutils, findutils
+%if %{use_systemd}
BuildRequires: systemd-units
-Requires(post): systemd-sysv
+Requires(pre): systemd-sysv, /sbin/chkconfig
Requires(post): systemd-units
-Requires(preun): systemd-units, coreutils, findutils
+Requires(preun): systemd-units
Requires(postun): systemd-units
+%else
+Requires(post): /sbin/chkconfig
+Requires(preun): /sbin/service, /sbin/chkconfig
+Requires(postun): /sbin/service
+%endif
# Need systemd-units for ownership of /etc/tmpfiles.d directory
-%if 0%{?fedora} > 14
+%if 0%{?rundir_tmpfs:1}
Requires: systemd-units
%endif
BuildRequires: pam-devel, ncurses-devel, pkgconfig, gettext, zlib-devel
@@ -221,6 +249,10 @@ for f in ChangeLog; do
mv -f ${f}.utf-8 ${f}
done
+# Copy in the tmpfiles config and insert the appropriate run directory
+cp -p %{SOURCE12} .
+sed -i -e 's|@RUNDIR@|%{rundir}|' proftpd-tmpfs.conf
+
# Remove bogus exec permissions from source files
chmod -c -x include/tpl.h lib/tpl.c
@@ -236,7 +268,7 @@ SMOD6=mod_sftp:mod_sftp_pam:mod_sftp_sql:mod_tls_shmcache%{?have_libmemcached::m
%configure \
--libexecdir="%{_libexecdir}/proftpd" \
- --localstatedir="%{_localstatedir}/run/proftpd" \
+ --localstatedir="%{rundir}/proftpd" \
--enable-ctrls \
--enable-dso \
--enable-facl \
@@ -255,13 +287,18 @@ SMOD6=mod_sftp:mod_sftp_pam:mod_sftp_sql:mod_tls_shmcache%{?have_libmemcached::m
make %{?_smp_mflags}
%install
+rm -rf %{buildroot}
make install DESTDIR=%{buildroot} \
- rundir="%{_localstatedir}/run/proftpd" \
+ rundir="%{rundir}/proftpd" \
INSTALL_USER=`id -un` \
INSTALL_GROUP=`id -gn`
install -D -p -m 640 proftpd.conf %{buildroot}%{_sysconfdir}/proftpd.conf
install -D -p -m 644 proftpd.pam %{buildroot}%{_sysconfdir}/pam.d/proftpd
-install -D -p -m 755 %{SOURCE2} %{buildroot}%{_unitdir}/proftpd.service
+%if %{use_systemd}
+install -D -p -m 755 %{SOURCE14} %{buildroot}%{_unitdir}/proftpd.service
+%else
+install -D -p -m 755 %{SOURCE2} %{buildroot}%{_sysconfdir}/rc.d/init.d/proftpd
+%endif
install -D -p -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/xinetd.d/xproftpd
install -D -p -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/proftpd
install -D -p -m 644 %{SOURCE5} %{buildroot}%{_localstatedir}/ftp/welcome.msg
@@ -269,11 +306,10 @@ install -D -p -m 644 %{SOURCE9} %{buildroot}%{_sysconfdir}/sysconfig/proftpd
mkdir -p %{buildroot}%{_localstatedir}/{ftp/{pub,uploads},log/proftpd}
touch %{buildroot}%{_sysconfdir}/ftpusers
-# Make sure /var/run/proftpd exists at boot time for systems
-# with /var/run on tmpfs (#656675)
-%if 0%{?fedora} > 14
+# Make sure %%{rundir}/proftpd exists at boot time for systems where it's on tmpfs (#656675)
+%if 0%{?rundir_tmpfs:1}
install -d -m 755 %{buildroot}%{_sysconfdir}/tmpfiles.d
-install -p -m 644 %{SOURCE12} %{buildroot}%{_sysconfdir}/tmpfiles.d/proftpd.conf
+install -p -m 644 proftpd-tmpfs.conf %{buildroot}%{_sysconfdir}/tmpfiles.d/proftpd.conf
%endif
# Find translations
@@ -298,9 +334,27 @@ if ! make -C tests api-tests; then
fi
%endif
+%clean
+rm -rf %{buildroot}
+
+%if %{use_systemd}
+%pre
+# SysV-to-systemd migration
+if [ $1 -gt 1 -a ! -e %{_unitdir}/proftpd.service -a -e %{_sysconfdir}/rc.d/init.d/proftpd ]; then
+ /usr/bin/systemd-sysv-convert --save proftpd &>/dev/null
+ /sbin/chkconfig --del proftpd &>/dev/null || :
+fi
+%endif
+
%post
+%if %{use_systemd}
+/bin/systemctl daemon-reload &>/dev/null || :
+%endif
if [ $1 -eq 1 ]; then
- /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+ # Initial installation
+%if ! %{use_systemd}
+ /sbin/chkconfig --add proftpd || :
+%endif
IFS=":"; cat /etc/passwd | \
while { read username nu nu gid nu nu nu nu; }; do \
if [ $gid -lt 100 -a "$username" != "ftp" ]; then
@@ -311,32 +365,40 @@ fi
%preun
if [ $1 -eq 0 ]; then
- /bin/systemctl --no-reload disable proftpd.service > /dev/null 2>&1 || :
- /bin/systemctl stop proftpd.service > /dev/null 2>&1 || :
- /sbin/service xinetd reload &>/dev/null || :
- find %{_localstatedir}/run/proftpd -depth -mindepth 1 |
+ # Package removal, not upgrade
+%if %{use_systemd}
+ /bin/systemctl --no-reload disable proftpd.service &>/dev/null || :
+ /bin/systemctl stop proftpd.service &>/dev/null || :
+%else
+ /sbin/service proftpd stop &>/dev/null || :
+ /sbin/chkconfig --del proftpd || :
+%endif
+ find %{rundir}/proftpd -depth -mindepth 1 |
xargs rm -rf &>/dev/null || :
fi
%postun
-/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-if [ $1 -ge 1 ] ; then
+%if %{use_systemd}
+/bin/systemctl daemon-reload &>/dev/null || :
+%endif
+if [ $1 -ge 1 ]; then
# Package upgrade, not uninstall
- /bin/systemctl try-restart proftpd.service >/dev/null 2>&1 || :
+%if %{use_systemd}
+ /bin/systemctl try-restart proftpd.service &>/dev/null || :
+%else
+ /sbin/service proftpd condrestart &>/dev/null || :
+%endif
+else
+ # Package removal, not upgrade
+%if %{use_systemd}
+ /bin/systemctl reload xinetd.service &>/dev/null || :
+%else
+ /sbin/service xinetd reload &>/dev/null || :
+%endif
fi
-%triggerun -- proftpd < 1.3.4-0.11.rc2
-# Save the current service runlevel info
-# User must manually run systemd-sysv-convert --apply proftpd
-# to migrate them to systemd targets
-/usr/bin/systemd-sysv-convert --save proftpd >/dev/null 2>&1 ||:
-
-# Run these because the SysV package being removed won't do them
-/sbin/chkconfig --del proftpd >/dev/null 2>&1 || :
-/bin/systemctl try-restart proftpd.service >/dev/null 2>&1 || :
-
-
%files -f proftpd.lang
+%defattr(-,root,root,-)
%doc COPYING CREDITS ChangeLog NEWS README
%doc README.DSO README.modules README.IPv6 README.PAM
%doc README.capabilities README.classes README.controls README.facl
@@ -344,7 +406,7 @@ fi
%doc doc/* sample-configurations/ contrib/xferstats.holger-preiss
%dir %{_localstatedir}/ftp/
%dir %{_localstatedir}/ftp/pub/
-%dir %{_localstatedir}/run/proftpd/
+%dir %{rundir}/proftpd/
%config(noreplace) %{_localstatedir}/ftp/welcome.msg
%config(noreplace) %{_sysconfdir}/blacklist.dat
%config(noreplace) %{_sysconfdir}/dhparams.pem
@@ -354,8 +416,12 @@ fi
%config(noreplace) %{_sysconfdir}/proftpd.conf
%config(noreplace) %{_sysconfdir}/sysconfig/proftpd
%config(noreplace) %{_sysconfdir}/xinetd.d/xproftpd
+%if %{use_systemd}
%{_unitdir}/proftpd.service
-%if 0%{?fedora} > 14
+%else
+%{_sysconfdir}/rc.d/init.d/proftpd
+%endif
+%if 0%{?rundir_tmpfs:1}
%{_sysconfdir}/tmpfiles.d/proftpd.conf
%endif
%{_bindir}/ftpasswd
@@ -421,22 +487,30 @@ fi
%attr(750, root, root) %dir %{_localstatedir}/log/proftpd/
%files ldap
+%defattr(-,root,root,-)
%doc README.LDAP 70proftpd-quota.ldif proftpd-quota.schema
%{_libexecdir}/proftpd/mod_ldap.so
%{_libexecdir}/proftpd/mod_quotatab_ldap.so
%files mysql
+%defattr(-,root,root,-)
%{_libexecdir}/proftpd/mod_sql_mysql.so
%files postgresql
+%defattr(-,root,root,-)
%{_libexecdir}/proftpd/mod_sql_postgres.so
%changelog
+* Tue Sep 27 2011 Paul Howarth <paul at city-fan.org> 1.3.4-0.13.rc2
+- Restore back-compatibility with older releases and EPEL, broken by -11 update
+- Use /run rather than /var/run if using systemd init
+- Avoid the use of triggers in SysV-to-systemd migration
+
* Sat Sep 17 2011 Remi Collet <remi at fedoraproject.org> 1.3.4-0.12.rc2
-- rebuild against libmemcached.so.8
+- Rebuild against libmemcached.so.8
* Mon Sep 12 2011 Tom Callaway <spot at fedoraproject.org> 1.3.4-0.11.rc2
-- convert to systemd
+- Convert to systemd
* Fri Jun 3 2011 Paul Howarth <paul at city-fan.org> 1.3.4-0.10.rc2
- Rebuild for new libmemcached in Rawhide
More information about the scm-commits
mailing list