diff --git a/proftpd.service b/proftpd.service new file mode 100644 index 0000000..627598d --- /dev/null +++ b/proftpd.service @@ -0,0 +1,10 @@ +[Unit] +Description=ProFTPd FTP Server +After=syslog.target network.target + +[Service] +EnvironmentFile=-/etc/sysconfig/proftpd +ExecStart=/usr/sbin/proftpd $PROFTPD_OPTIONS + +[Install] +WantedBy=multi-user.target diff --git a/proftpd.spec b/proftpd.spec index 1780498..f1e6ca0 100644 --- a/proftpd.spec +++ b/proftpd.spec @@ -22,7 +22,7 @@ %endif %global prever rc2 -%global rpmrel 10 +%global rpmrel 11 Summary: Flexible, stable and highly-configurable FTP server Name: proftpd @@ -33,7 +33,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.init +Source2: proftpd.service Source3: proftpd-xinetd Source4: proftpd.logrotate Source5: proftpd-welcome.msg @@ -62,10 +62,11 @@ 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(post): /sbin/chkconfig -Requires(preun): /sbin/service, /sbin/chkconfig, coreutils, findutils -Requires(postun): /sbin/service +BuildRequires: systemd-units +Requires(post): systemd-sysv +Requires(post): systemd-units +Requires(preun): systemd-units, coreutils, findutils +Requires(postun): systemd-units # Need systemd-units for ownership of /etc/tmpfiles.d directory %if 0%{?fedora} > 14 Requires: systemd-units @@ -254,14 +255,13 @@ 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" \ 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}%{_sysconfdir}/rc.d/init.d/proftpd +install -D -p -m 755 %{SOURCE2} %{buildroot}%{_unitdir}/proftpd.service 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 @@ -298,12 +298,9 @@ if ! make -C tests api-tests; then fi %endif -%clean -rm -rf %{buildroot} - %post if [ $1 -eq 1 ]; then - /sbin/chkconfig --add proftpd + /bin/systemctl daemon-reload >/dev/null 2>&1 || : IFS=":"; cat /etc/passwd | \ while { read username nu nu gid nu nu nu nu; }; do \ if [ $gid -lt 100 -a "$username" != "ftp" ]; then @@ -314,20 +311,32 @@ fi %preun if [ $1 -eq 0 ]; then - /sbin/service proftpd stop &>/dev/null || : - /sbin/chkconfig --del proftpd || : + /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 | xargs rm -rf &>/dev/null || : fi %postun -if [ $1 -ge 1 ]; then - /sbin/service proftpd condrestart &>/dev/null || : +/bin/systemctl daemon-reload >/dev/null 2>&1 || : +if [ $1 -ge 1 ] ; then + # Package upgrade, not uninstall + /bin/systemctl try-restart proftpd.service >/dev/null 2>&1 || : 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 @@ -345,7 +354,7 @@ fi %config(noreplace) %{_sysconfdir}/proftpd.conf %config(noreplace) %{_sysconfdir}/sysconfig/proftpd %config(noreplace) %{_sysconfdir}/xinetd.d/xproftpd -%{_sysconfdir}/rc.d/init.d/proftpd +%{_unitdir}/proftpd.service %if 0%{?fedora} > 14 %{_sysconfdir}/tmpfiles.d/proftpd.conf %endif @@ -412,20 +421,20 @@ 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 +* Mon Sep 12 2011 Tom Callaway 1.3.4-0.11.rc2 +- convert to systemd + * Fri Jun 3 2011 Paul Howarth 1.3.4-0.10.rc2 - Rebuild for new libmemcached in Rawhide