# TODO:
# - cvsadmin uid,gid
# - check permissions
-# - missing files
-# - rc-inetd file(?) / init script(?)
Summary: cvsd, a chroot/suid wrapper for running a cvs pserver
-Summary(pl): cvsd - nak³adka na cvs pserver korzystaj±ca z chroot/suid
+Summary(pl.UTF-8): cvsd - nakładka na cvs pserver korzystająca z chroot/suid
Name: cvsd
-Version: 1.0.6
+Version: 1.0.9
Release: 0.1
License: GPL
Group: Development/Version Control
-Source0: http://tiefighter.et.tudelft.nl/~arthur/cvsd/%{name}-%{version}.tar.gz
-# Source0-md5: 8432a3d6d2103236b77e4a27dba858cd
+Source0: http://ch.tudelft.nl/~arthur/cvsd/%{name}-%{version}.tar.gz
+# Source0-md5: ee67d1a5366f804580c08ca1d48b85fd
+Source1: %{name}.init
#Source1: %{name}.conf
#Source2: %{name}-passwd
-URL: http://tiefighter.et.tudelft.nl/~arthur/cvsd/
-BuildRequires: rpmbuild(macros) >= 1.159
-Requires(pre): /usr/bin/getgid
+URL: http://ch.tudelft.nl/~arthur/cvsd/
+BuildRequires: rpmbuild(macros) >= 1.268
+Requires(post,preun): /sbin/chkconfig
+Requires(postun): /usr/sbin/groupdel
+Requires(postun): /usr/sbin/userdel
Requires(pre): /bin/id
+Requires(pre): /usr/bin/getgid
+Requires(pre): /usr/bin/ldd
Requires(pre): /usr/sbin/groupadd
Requires(pre): /usr/sbin/groupmod
-Requires(pre): cvs
-Requires(pre): /usr/bin/ldd
+Requires(pre): cvs-client
Requires(pre): fileutils
Requires(pre): textutils
-Requires(postun): /usr/sbin/userdel
-Requires(postun): /usr/sbin/groupdel
-Requires: cvs
+Requires: cvs-client
+Requires: rc-scripts
Provides: group(cvsadmin)
Provides: user(cvsowner)
+Obsoletes: cvs-nserver-pserver
+Obsoletes: cvs-pserver
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-%define homedir /home/cvsowner
+%define homedir /var/lib/cvsowner
%define rootdir %{homedir}/cvsd-root
%description
cvsd is a chroot/suid wrapper for running a cvs pserver more securely.
cvs is a version control system for managing projects.
-%description -l pl
-cvsd jest nak³adk± s³u¿±c± do bezpieczniejszego uruchamiania programu
-cvs pserver, korzystaj±c± z chroot/suid. cvs jest systemem kontroli
-wersji zasobów s³u¿±cym do zarz±dzania projektami.
+%description -l pl.UTF-8
+cvsd jest nakładką służącą do bezpieczniejszego uruchamiania programu
+cvs pserver, korzystającą z chroot/suid. cvs jest systemem kontroli
+wersji zasobów służącym do zarządzania projektami.
%prep
%setup -q
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT%{rootdir}/{etc,bin,lib,tmp,dev,cvsroot}
+install -d $RPM_BUILD_ROOT%{rootdir}/{etc,bin,lib,tmp,dev,cvsroot} \
+ $RPM_BUILD_ROOT/etc/rc.d/init.d
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT
-#install %{SOURCE2} $RPM_BUILD_ROOT%{rootdir}/etc/passwd
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+#install %{SOURCE2} $RPM_BUILD_ROOT%{rootdir}%{_sysconfdir}/passwd
%clean
rm -rf $RPM_BUILD_ROOT
%pre
-if [ -n "`/usr/bin/getgid cvsadmin`" ]; then
- if [ "`/usr/bin/getgid cvsadmin`" != "53" ]; then # 2401
- echo "Error: group cvsadmin doesn't have gid=53. Correct this before installing cvsd." 1>&2
- exit 1
- fi
-else
- /usr/sbin/groupadd -g 53 cvsadmin
-fi
-if [ -n "`/bin/id -u cvsowner 2>/dev/null`" ]; then
- if [ "`/bin/id -u cvsowner`" != "128" ]; then
- echo "Error: user cvsowner doesn't have uid=128. Correct this before installing cvsd." 1>&2
- exit 1
- fi
-else
- /usr/sbin/useradd -u 128 -g 53 -c "CVS UID" -d %{homedir} cvsowner
-fi
+%groupadd -g 53 cvsadmin
+%useradd -u 128 -g 53 -c "CVS UID" -d %{homedir} cvsowner
+
if [ ! -f %{rootdir}/bin/cvs ] ; then
echo "Setting up %{rootdir}..."
cd /lib
%{rootdir}/lib
install -m755 /usr/bin/cvs %{rootdir}/bin
fi
-# TODO: rc-inetd file
-#if ! grep -q cvspserver /etc/inetd.conf ; then
-# echo "no existing cvspserver line in /etc/inetd.conf, adding..."
-# echo -e "cvspserver\tstream\ttcp\tnowait\troot\t/usr/sbin/cvsd\tcvsd" >> /etc/inetd.conf
-#fi
-echo "Now check out /etc/cvsd.conf, restart inetd (killall -HUP inetd), and "
-echo "initialise the repository using: "
-echo "\"cvs -d :pserver:cvsadmin@localhost:/cvsroot init\" "
-echo "Also edit/modify/whatever the /home/cvsowner/cvsd-root/etc/passwd file."
-echo "Default user/passwds are cvs/cvs (for ro anon), user/pass. Change these!"
+
+%post
+/sbin/chkconfig --add cvsd
+%service cvsd restart "cvsd"
+
+if [ "$1" = 1 ]; then
+%banner -e %{name} <<EOF
+Now check out %{_sysconfdir}/cvsd.conf and initialise the repository using:
+cvs -d :pserver:cvsadmin@localhost:/cvsroot init
+
+Also edit/modify/whatever the /home/cvsowner/cvsd-root%{_sysconfdir}/passwd file.
+Default user/passwds are cvs/cvs (for ro anon), user/pass. Change these!
+EOF
+fi
+
+%preun
+if [ "$1" = "0" ]; then
+ %service cvsd stop
+ /sbin/chkconfig --del cvsd
+fi
%postun
if [ "$1" = "0" ]; then
%attr(755,root,root) %{_sbindir}/cvsd-buildroot
%attr(755,root,root) %{_sbindir}/cvsd-passwd
%dir %{_sysconfdir}/cvsd
-%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/cvsd/cvsd.conf
-#%attr(754,root,root) /etc/rc.d/init.d/cvsd
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/cvsd/cvsd.conf
+%attr(754,root,root) /etc/rc.d/init.d/cvsd
%{_mandir}/man[58]/*
%dir %{homedir}
%dir %{rootdir}
%dev(c,1,3) %{rootdir}/dev/null
%dir %{rootdir}/lib
%dir %{rootdir}/tmp
-#%config(noreplace) %verify(not size mtime md5) %{rootdir}/etc/passwd
+#%config(noreplace) %verify(not size mtime md5) %{rootdir}%{_sysconfdir}/passwd