convert svnserve to systemd (#754074)

This commit is contained in:
Joe Orton 2012-02-28 13:20:29 +00:00
parent 2953a390d1
commit 72a39f6395
4 changed files with 54 additions and 13 deletions

View File

@ -23,7 +23,9 @@ Source1: subversion.conf
Source3: filter-requires.sh
Source4: http://www.xsteve.at/prg/emacs/psvn.el
Source5: psvn-init.el
Source6: svnserve.init
Source6: svnserve.service
Source7: svnserve.tmpfiles
Source8: svnserve.conf
Patch1: subversion-1.7.0-rpath.patch
Patch2: subversion-1.7.0-pie.patch
Patch3: subversion-1.7.0-kwallet.patch
@ -33,12 +35,11 @@ BuildRequires: autoconf, libtool, python, python-devel, texinfo, which
BuildRequires: db4-devel >= 4.1.25, swig >= 1.3.24, gettext
BuildRequires: apr-devel >= 1.3.0, apr-util-devel >= 1.3.0
BuildRequires: neon-devel >= 0:0.24.7-1, cyrus-sasl-devel
BuildRequires: sqlite-devel >= 3.4.0, file-devel
BuildRequires: sqlite-devel >= 3.4.0, file-devel, systemd-units
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Provides: svn = %{version}-%{release}
Requires: subversion-libs%{?_isa} = %{version}-%{release}
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig, /sbin/service
Requires(post): systemd-sysv, /sbin/chkconfig
%define __perl_requires %{SOURCE3}
@ -223,11 +224,6 @@ install -m 755 -d ${RPM_BUILD_ROOT}%{_sysconfdir}/subversion
install -m 755 -d ${RPM_BUILD_ROOT}%{_sysconfdir}/httpd/conf.d
install -m 644 $RPM_SOURCE_DIR/subversion.conf ${RPM_BUILD_ROOT}%{_sysconfdir}/httpd/conf.d
# Install SysV init script
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
install -p -m 755 $RPM_SOURCE_DIR/svnserve.init \
$RPM_BUILD_ROOT/etc/rc.d/init.d/svnserve
# Remove unpackaged files
rm -rf ${RPM_BUILD_ROOT}%{_includedir}/subversion-*/*.txt \
${RPM_BUILD_ROOT}%{python_sitearch}/*/*.{a,la}
@ -280,6 +276,18 @@ sed -i "/^dependency_libs/{
install -Dpm 644 bash_completion \
$RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d/%{name}
# Install svnserve bits
mkdir -p %{buildroot}%{_unitdir} \
%{buildroot}%{_localstatedir}/run/svnserve \
%{buildroot}%{_sysconfdir}/tmpfiles.d
install -p -m 644 $RPM_SOURCE_DIR/svnserve.service \
%{buildroot}%{_unitdir}/svnserve.service
install -p -m 644 $RPM_SOURCE_DIR/svnserve.tmpfiles \
%{buildroot}%{_sysconfdir}/tmpfiles.d/svnserve.conf
install -p -m 644 $RPM_SOURCE_DIR/svnserve.sysconf \
%{buildroot}%{_sysconfdir}/svnserve
%find_lang %{name}
%if %{make_check}
@ -303,15 +311,30 @@ make check-javahl
rm -rf ${RPM_BUILD_ROOT}
%post
# Register the snvserve service
/sbin/chkconfig --add svnserve
if [ $1 -eq 1 ] ; then
# Initial installation
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
%preun
if [ $1 = 0 ]; then
/sbin/service svnserve stop > /dev/null 2>&1
/sbin/chkconfig --del svnserve
# Package removal, not upgrade
/bin/systemctl --no-reload disable svnserve.service > /dev/null 2>&1 || :
/bin/systemctl stop svnserve.service > /dev/null 2>&1 || :
fi
%postun
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/bin/systemctl try-restart svnserve.service >/dev/null 2>&1 || :
fi
%triggerun -- subversion < 1.7.3-2
/usr/bin/systemd-sysv-convert --save svnserve >/dev/null 2>&1 ||:
/sbin/chkconfig --del svnserve >/dev/null 2>&1 || :
/bin/systemctl try-restart svnserve.service >/dev/null 2>&1 || :
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
@ -340,6 +363,7 @@ fi
%{_datadir}/emacs/site-lisp/*.el
%{_datadir}/xemacs/site-packages/lisp/*.el
%{_sysconfdir}/bash_completion.d
%config(noreplace) %{_sysconfdir}/svnserve
%dir %{_sysconfdir}/subversion
%exclude %{_mandir}/man*/*::*
@ -407,6 +431,7 @@ fi
* Tue Feb 28 2012 Joe Orton <jorton@redhat.com> - 1.7.3-2
- add upstream test suite fixes for APR hash change (r1293602, r1293811)
- use ruby vendorlib directory (#798203)
- convert svnserve to systemd (#754074)
* Mon Feb 13 2012 Joe Orton <jorton@redhat.com> - 1.7.3-1
- update to 1.7.3

11
svnserve.service Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=Subversion protocol daemon
After=syslog.target network.target
[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/svnserve
ExecStart=/usr/bin/svnserve --daemon --pid-file=/var/run/svnserve/svnserve.pid $OPTIONS
[Install]
WantedBy=multi-user.target

4
svnserve.sysconf Normal file
View File

@ -0,0 +1,4 @@
# OPTIONS is used to pass command-line arguments to svnserve.
#
# Specify the repository location in -r parameter:
OPTIONS="-r /var/svn"

1
svnserve.tmpfiles Normal file
View File

@ -0,0 +1 @@
D /var/run/svnserve 0700 root root -