[vsftpd] added systemd unit file, SysV initscript moved to subpackage
Jiri Skala
jskala at fedoraproject.org
Wed Aug 3 14:02:00 UTC 2011
commit 80f6d3e480feba94fab5ba2454249640854a7504
Author: Jiri Skala <jskala at redhat.com>
Date: Wed Aug 3 16:01:45 2011 +0200
added systemd unit file, SysV initscript moved to subpackage
vsftpd-2.3.4-sd.patch | 39 +++++++++++++++++++++++++++++++++++++++
vsftpd.spec | 47 +++++++++++++++++++++++++++++++++++++----------
vsftpd at .service | 16 ++++++++++++++++
3 files changed, 92 insertions(+), 10 deletions(-)
---
diff --git a/vsftpd-2.3.4-sd.patch b/vsftpd-2.3.4-sd.patch
new file mode 100644
index 0000000..5ee2ff8
--- /dev/null
+++ b/vsftpd-2.3.4-sd.patch
@@ -0,0 +1,39 @@
+diff -up vsftpd-2.3.4/vsftpd.8.sd vsftpd-2.3.4/vsftpd.8
+--- vsftpd-2.3.4/vsftpd.8.sd 2011-08-03 11:02:30.509291451 +0200
++++ vsftpd-2.3.4/vsftpd.8 2011-08-03 15:50:00.024014865 +0200
+@@ -25,6 +25,8 @@ in
+ Direct execution of the
+ .Nm vsftpd
+ binary will then launch the FTP service ready for immediate client connections.
++.Pp
++Systemd changes the vsftpd start-up. When the SysV initscript attempts to start one instance of the vsftpd daemon for each of /etc/vsftpd/*.conf file, each configuration file requires a correct symbolic link to the vsftpd at .service file.The name of the symbolic link must contain the name of the configuration file. See systemd.unit(5) for details. Each instance of the vsftpd daemon is started separately. See systemd.unit(5).
+ .Sh OPTIONS
+ An optional
+ configuration file or files
+@@ -55,6 +57,11 @@ the "ftpd_banner" setting is set to "bla
+ setting and any identical setting that was in the config file.
+ .Sh FILES
+ .Pa /etc/vsftpd/vsftpd.conf
++.Pp
++.Pa /lib/systemd/system/vsftpd at .conf
++.Pp
++.Pa /lib/systemd/system/vsftpd at vsftpd.conf
+ .Sh SEE ALSO
+ .Xr vsftpd.conf 5
++.Xr systemd.unit 5
+ .end
+diff -up vsftpd-2.3.4/vsftpd.conf.5.sd vsftpd-2.3.4/vsftpd.conf.5
+--- vsftpd-2.3.4/vsftpd.conf.5.sd 2011-08-03 11:02:37.480372306 +0200
++++ vsftpd-2.3.4/vsftpd.conf.5 2011-08-03 15:50:29.435371891 +0200
+@@ -13,6 +13,11 @@ inetd such as
+ to launch vsftpd with different configuration files on a per virtual host
+ basis.
+
++Systemd changes the vsftpd daemon start-up. Each configuration file
++requires a correct symbolic link to the vsftpd at .service file. The name
++of the symbolic link must contain the name of the configuration file.
++See systemd.unit(5) for details.
++
+ .SH FORMAT
+ The format of vsftpd.conf is very simple. Each line is either a comment or
+ a directive. Comment lines start with a # and are ignored. A directive line
diff --git a/vsftpd.spec b/vsftpd.spec
index 86c4078..3b796b9 100644
--- a/vsftpd.spec
+++ b/vsftpd.spec
@@ -2,7 +2,7 @@
Name: vsftpd
Version: 2.3.4
-Release: 4%{?dist}
+Release: 5%{?dist}
Summary: Very Secure Ftp Daemon
Group: System Environment/Daemons
@@ -16,6 +16,7 @@ Source3: vsftpd.ftpusers
Source4: vsftpd.user_list
Source5: vsftpd.init
Source6: vsftpd_conf_migrate.sh
+Source7: vsftpd at .service
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -28,7 +29,6 @@ BuildRequires: tcp_wrappers-devel
Requires: logrotate
Requires (preun): /sbin/chkconfig
-Requires (preun): /sbin/service
Requires (post): /sbin/chkconfig
# Build patches
@@ -53,11 +53,21 @@ Patch14: vsftpd-2.2.0-wildchar.patch
Patch16: vsftpd-2.2.2-clone.patch
Patch17: vsftpd-2.2.2-v6only.patch
Patch18: vsftpd-2.3.4-tout.patch
+Patch19: vsftpd-2.3.4-sd.patch
%description
vsftpd is a Very Secure FTP daemon. It was written completely from
scratch.
+%package sysvinit
+Group: System Environment/Daemons
+Summary: SysV initscript for vsftpd daemon
+Requires: %{name} = %{version}-%{release}
+Requires(preun): /sbin/service
+Requires(postun): /sbin/service
+
+%description sysvinit
+The vsftpd-sysvinit contains SysV initscritps support.
%prep
%setup -q -n %{name}-%{version}
@@ -80,6 +90,7 @@ cp %{SOURCE1} .
%patch16 -p1 -b .clone
%patch17 -p1 -b .v6only
%patch18 -p1 -b .tout
+%patch19 -p1 -b .sd
%build
%ifarch s390x sparcv9 sparc64
@@ -96,6 +107,7 @@ mkdir -p $RPM_BUILD_ROOT%{_sbindir}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/{vsftpd,pam.d,logrotate.d,rc.d/init.d}
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man{5,8}
+mkdir -p $RPM_BUILD_ROOT/lib/systemd/system
install -m 755 vsftpd $RPM_BUILD_ROOT%{_sbindir}/vsftpd
install -m 600 vsftpd.conf $RPM_BUILD_ROOT%{_sysconfdir}/vsftpd/vsftpd.conf
install -m 644 vsftpd.conf.5 $RPM_BUILD_ROOT/%{_mandir}/man5/
@@ -106,29 +118,38 @@ install -m 600 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/vsftpd/ftpusers
install -m 600 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/vsftpd/user_list
install -m 755 %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/vsftpd
install -m 744 %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/vsftpd/vsftpd_conf_migrate.sh
+install -m 644 %{SOURCE7} $RPM_BUILD_ROOT/lib/systemd/system/
+ln -s /lib/systemd/system/vsftpd at .service $RPM_BUILD_ROOT/lib/systemd/system/vsftpd at vsftpd.service
mkdir -p $RPM_BUILD_ROOT/%{_var}/ftp/pub
-
%clean
rm -rf $RPM_BUILD_ROOT
-
%post
-/sbin/chkconfig --add vsftpd
-
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
%preun
if [ $1 = 0 ]; then
- /sbin/service vsftpd stop > /dev/null 2>&1
- /sbin/chkconfig --del vsftpd
+ /bin/systemctl disable vsftpd at vsftpd.service > /dev/null 2>&1 || :
+ /bin/systemctl stop vsftpd at vsftpd.service > /dev/null 2>&1 || :
fi
-
+
+%postun
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+
+%triggerun -- %{name} < 2.3.4-5
+ /sbin/chkconfig --del vsftpd >/dev/null 2>&1 || :
+ /bin/systemctl try-restart vsftpd at vsftpd.service >/dev/null 2>&1 || :
+
+%triggerpostun -n %{name}-sysvinit -- %{name} < 2.3.4-5
+ /sbin/chkconfig --add vsftpd >/dev/null 2>&1 || :
%files
%defattr(-,root,root,-)
+/lib/systemd/system/vsftpd at .service
+/lib/systemd/system/vsftpd at vsftpd.service
%{_sbindir}/vsftpd
-%{_sysconfdir}/rc.d/init.d/vsftpd
%dir %{_sysconfdir}/vsftpd
%{_sysconfdir}/vsftpd/vsftpd_conf_migrate.sh
%config(noreplace) %{_sysconfdir}/vsftpd/ftpusers
@@ -142,8 +163,14 @@ fi
%{_mandir}/man8/vsftpd.*
%{_var}/ftp
+%files sysvinit
+%{_sysconfdir}/rc.d/init.d/vsftpd
%changelog
+* Wed Aug 03 2011 Jiri Skala <jskala at redhat.com> - 2.3.4-5
+- fixes #719434 - Provide native systemd unit file
+- moving SysV initscript into subpackage
+
* Mon Aug 01 2011 Jiri Skala <jskala at redhat.com> - 2.3.4-4
- rebuild for libcap
diff --git a/vsftpd at .service b/vsftpd at .service
new file mode 100644
index 0000000..6324ec8
--- /dev/null
+++ b/vsftpd at .service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Vsftpd ftp daemon
+After=syslog.target network.target
+
+[Service]
+# Follow the steps below to set up an additional configuration file:
+#
+# cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd2.conf
+# ln -s /lib/systemd/system/vsftpd at .service /lib/systemd/system/vsftpd at vsftpd2.service
+#
+Type=oneshot
+ExecStart=/usr/sbin/vsftpd /etc/vsftpd/%i.conf
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
More information about the scm-commits
mailing list