3. FreeBSD specific setup

The FreeBSD project itself uses a slightly different setup, which also uses files from the freebsd subdirectory of the FreeBSD CVSROOT. The project uses this because of the large number of committers, which all would have to be in the same group. So, a simple wrapper was written which ensures that people have the correct credentials to commit, and then sets the group id to that of the repository.

If your repository also needs this, the steps to set this up are documented below. But first an overview of the files involved.

3.1. Files used in the FreeBSD setup

  • access - this file controls access information. You should edit this file to include all members of your project.

  • freebsd/commitmail.pl - this file is not used any more, but kept for historic reasons. You should not have to touch this file.

  • freebsd/cvswrap.c - this is the source to the CVS wrapper that you will need to install to make all access checks actually work. More information on this below. You should edit the paths in the ACCESS and REALCVS macros to match your setup.

  • freebsd/mailsend.c - this file is needed by the FreeBSD setup of the mailing lists. You should not have to touch this file.

3.2. The procedure

  1. Edit the access file to contain only your username.

  2. Edit cvswrap.c to contain the correct path for your setup. This is defined in a macro named ACCESS. You should also change the location of the real cvs binary if it is not appropriate to your situation. The stock cvswrap.c expects to be a replacement for the systemwide cvs command, which will be moved to /usr/bin/ncvs.

    My copy of cvswrap.c has this:

    #define ACCESS "/local/cvsroot/CVSROOT/access"
    #define REALCVS "/usr/bin/ncvs"
  3. Next up is installing the wrapper to ensure you become the correct group when committing. The sources for this live in cvswrap.c in your CVSROOT.

    Compile the sources that you edited to include the correct paths:

    % cc -o cvs cvswrap.c

    And then install them (you have to be root for this step):

    # mv /usr/bin/cvs /usr/bin/ncvs
    # mv cvs /usr/bin/cvs
    # chown root:ncvs /usr/bin/cvs /usr/bin/ncvs
    # chmod o-rx /usr/bin/ncvs
    # chmod u-w,g+s /usr/bin/cvs

    This installs the wrapper as the default cvs command, making sure that anyone who wants to use the repository has to have the correct access levels.

  4. You can now remove everyone from your repository group. All access control is done by your wrapper, and this wrapper will set the correct group for access.

3.3. Testing the setup

Your wrapper should now be setup. You can of course test this by making a forced commit to the access file:

% cvs commit -f -m 'Forced commit to test the new CVSROOT scripts' access

Again, if this fails, check to see whether all of the above steps have been executed correctly.

All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.