1%define cvsd_homedir /var/lib/cvsd
2
3Name: @PACKAGE@
4Summary: Chroot wrapper to run 'cvs pserver' more securely
5Version: @VERSION@
6Release: 1
7URL: http://arthurdejong.org/cvsd/
8Source: http://arthurdejong.org/cvsd/cvsd-%{version}.tar.gz
9License: GPL
10Group: Network/Daemons
11Requires: cvs
12BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
13
14%description
15cvsd is a wrapper program for cvs in pserver mode. it will run 'cvs pserver'
16under a special uid/gid in a chroot jail. cvsd is run as a daemon and is
17controlled through a configuration file. It is relatively easy to configure
18and provides tools for setting up a rootjail.
19
20This server can be useful if you want to run a public cvs pserver. You
21should however be aware of the security limitations of running a cvs
22pserver. If you want any kind of authentication you should really consider
23using secure shell as a secure authentication mechanism and transport.
24Passwords used with cvs pserver are transmitted in plaintext.
25
26%prep
27%setup -q
28
29%build
30./configure --prefix=%{_prefix} --mandir=%{_mandir} --sysconfdir=%{_sysconfdir}
31make
32
33%install
34[ "$RPM_BUILD_ROOT" = "/" ] || rm -rf $RPM_BUILD_ROOT
35make DESTDIR=$RPM_BUILD_ROOT install-strip
36rm $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/cvsd
37rmdir $RPM_BUILD_ROOT%{_sysconfdir}/init.d/
38install -d $RPM_BUILD_ROOT%{_initrddir}
39install -m755 cvsd.init.redhat71 $RPM_BUILD_ROOT%{_initrddir}/cvsd
40[ -x /usr/lib/rpm/brp-compress ] && /usr/lib/rpm/brp-compress
41
42%clean
43[ "$RPM_BUILD_ROOT" = "/" ] || rm -rf $RPM_BUILD_ROOT
44
45%files
46%doc README TODO AUTHORS ChangeLog NEWS FAQ COPYING
47%defattr(644,root,root,755)
48
49%config(noreplace) %{_sysconfdir}/cvsd/cvsd.conf
50%{_mandir}/*/*
51%attr(755,root,root)    %{_sbindir}/*
52%attr(755,root,root)    %{_initrddir}/cvsd
53
54%pre
55getent group cvsd > /dev/null || \
56  groupadd cvsd
57getent passwd cvsd > /dev/null || \
58  useradd -r -M -d %{cvsd_homedir} -s /bin/false \
59  -c "cvs pserver daemon" -g cvsd cvsd
60[ -e %{cvsd_homedir} ] || \
61  mkdir -m755 %{cvsd_homedir}
62
63%post
64cvsd-buildroot %{cvsd_homedir}
65/sbin/chkconfig --add cvsd
66
67%postun
68if [ "$1" = 0 ]; then
69  userdel -r cvsd 2>/dev/null || :
70  groupdel cvsd 2>/dev/null || :
71  rmdir %{cvsd_homedir} 2>/dev/null || :
72fi
73