# 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
Name: cvsd
-Version: 0.9.19
-Release: 0.1
+Version: 1.0.7
+Release: 0.3
License: GPL
Group: Development/Version Control
-Source0: http://tiefighter.et.tudelft.nl/~arthur/cvsd/%{name}-%{version}.tar.gz
-# Source0-md5: 2757c59517e59771bd9d249aea760b41
+Source0: http://tiefighter.et.tudelft.nl/~arthur/%{name}/%{name}-%{version}.tar.gz
+# Source0-md5: 3403fe3025d6578dffa2abf8a640d846
+Source1: %{name}.init
#Source1: %{name}.conf
#Source2: %{name}-passwd
URL: http://tiefighter.et.tudelft.nl/~arthur/cvsd/
+BuildRequires: rpmbuild(macros) >= 1.159
+PreReq: rc-scripts
+Requires(post,preun): /sbin/chkconfig
Requires(pre): /usr/bin/getgid
Requires(pre): /bin/id
Requires(pre): /usr/sbin/groupadd
-Requires(pre): /usr/sbin/useradd
+Requires(pre): /usr/sbin/groupmod
Requires(pre): cvs
Requires(pre): /usr/bin/ldd
Requires(pre): fileutils
Requires(postun): /usr/sbin/userdel
Requires(postun): /usr/sbin/groupdel
Requires: cvs
+Obsoletes: cvs-pserver
+Obsoletes: cvs-nserver-pserver
+Provides: group(cvsadmin)
+Provides: user(cvsowner)
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-%define homedir /home/cvsowner
+%define homedir /var/lib/cvsowner
%define rootdir %{homedir}/cvsd-root
-# TODO: change
-%define cgid 2401
-%define cuid 2401
%description
cvsd is a chroot/suid wrapper for running a cvs pserver more securely.
%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 %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
#install %{SOURCE2} $RPM_BUILD_ROOT%{rootdir}/etc/passwd
%clean
%pre
if [ -n "`/usr/bin/getgid cvsadmin`" ]; then
- if [ "`/usr/bin/getgid cvsadmin`" != "%{cgid}" ]; then
- echo "Error: group cvsadmin doesn't have gid=%{cgid}. Correct this before installing cvsd." 1>&2
+ 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 %{cgid} cvsadmin
+ /usr/sbin/groupadd -g 53 cvsadmin
fi
if [ -n "`/bin/id -u cvsowner 2>/dev/null`" ]; then
- if [ "`/bin/id -u cvsowner`" != "%{cuid}" ]; then
- echo "Error: user cvsowner doesn't have uid=%{cuid}. Correct this before installing cvsd." 1>&2
+ 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 %{cuid} -g %{cgid} -c "CVS UID" -d %{homedir} cvsowner
+ /usr/sbin/useradd -u 128 -g 53 -c "CVS UID" -d %{homedir} cvsowner
fi
if [ ! -f %{rootdir}/bin/cvs ] ; then
echo "Setting up %{rootdir}..."
%{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: "
+
+%post
+/sbin/chkconfig --add cvsd
+if [ -f /var/lock/subsys/cvsd ]; then
+ /etc/rc.d/init.d/cvsd restart 1>&2
+else
+ echo "Type \"/etc/rc.d/init.d/cvsd start\" to start cvsd." 1>&2
+fi
+
+echo "Now check out /etc/cvsd.conf and 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!"
+%preun
+if [ "$1" = "0" ]; then
+ if [ -f /var/lock/subsys/cvsd ]; then
+ /etc/rc.d/init.d/cvsd stop 1>&2
+ fi
+ /sbin/chkconfig --del cvsd
+fi
+
%postun
if [ "$1" = "0" ]; then
- /usr/sbin/userdel cvsowner
- /usr/sbin/groupdel cvsadmin
+ %userremove cvsowner
+ %groupremove cvsadmin
fi
%files
%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
+%attr(754,root,root) /etc/rc.d/init.d/cvsd
%{_mandir}/man[58]/*
%dir %{homedir}
%dir %{rootdir}