PREIN
/bin/sh
if [ -n "`getgid cvs`" ]; then
if [ "`getgid cvs`" != "52" ]; then
echo "Error: group cvs doesn't have gid=52. Correct this before installing cvs-nserver." 1>&2
exit 1
fi
else
echo "Adding group cvs GID=52."
/usr/sbin/groupadd -g 52 -r -f cvs
fi
if [ -n "`getgid cvsadmin`" ]; then
if [ "`getgid cvsadmin`" != "53" ]; then
echo "Error: group cvsadmin doesn't have gid=53. Correct this before installing cvs-nserver." 1>&2
exit 1
fi
else
echo "Adding group cvsadmin GID=53."
/usr/sbin/groupadd -g 53 -r -f cvsadmin
fi
if [ -n "`id -u cvs 2>/dev/null`" ]; then
if [ "`id -u cvs`" != "52" ]; then
echo "Error: user cvs doesn't have uid=52. Correct this before installing cvs-nserver." 1>&2
exit 1
fi
else
echo "Adding user cvs UID=52."
/usr/sbin/useradd -u 52 -r -d /home/cvsroot -s /bin/false -c "CVS user" -g cvs cvs 1>&2
fi
if [ -n "`id -u cvsadmin 2>/dev/null`" ]; then
if [ "`id -u cvsadmin`" != "53" ]; then
echo "Error: user cvsadmin doesn't have uid=53. Correct this before installing cvs-nserver." 1>&2
exit 1
fi
else
echo "Adding user cvsadmin UID=53."
/usr/sbin/useradd -u 53 -r -d /home/cvsroot -s /bin/false -c "CVS user" -g cvsadmin -G cvs cvsadmin 1>&2
fi
if [ "$1" = 1 ]; then
echo "Initializing repository..."
/usr/bin/cvs -d :local:/home/cvsroot init
chown -R cvsadmin.cvsadmin /home/cvsroot/CVSROOT
fi
POSTUN
/bin/sh
if [ "$1" = "0" ]; then
echo "Removing user cvs."
/usr/sbin/userdel cvs
echo "Removing user cvsadmin."
/usr/sbin/userdel cvsadmin
echo "Removing group cvs."
/usr/sbin/groupdel cvs
echo "Removing group cvsadmin."
/usr/sbin/groupdel cvsadmin
fi