Tips August 2, 2005 at 7:14 pm

CVS pserver launchd item for OS X 10.4

Inspired by the recent excellent launchd overview on afp548, I needed to set up a CVS pserver on our new Tiger Xserve box, migrating from an old Linux server.Here’s a recipe that seems to work.

You’ll need to create a launchd control file, call it cvspserver.plist, and put it in /Library/LaunchDaemons (where local launch control files are supposed to live):

<code>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
        &lt;key&gt;Label&lt;/key&gt;
        &lt;string&gt;com.apple.cvspserver&lt;/string&gt;
        &lt;key&gt;UserName&lt;/key&gt;
        &lt;string&gt;cvs&lt;/string&gt;
        &lt;key&gt;Program&lt;/key&gt;
        &lt;string&gt;/usr/bin/cvs&lt;/string&gt;
        &lt;key&gt;ProgramArguments&lt;/key&gt;
        &lt;array&gt;
                &lt;string&gt;cvs&lt;/string&gt;
                &lt;string&gt;-f&lt;/string&gt;
                &lt;string&gt;--allow-root=/Users/cvs&lt;/string&gt;
                &lt;string&gt;pserver&lt;/string&gt;
        &lt;/array&gt;
        &lt;key&gt;Sockets&lt;/key&gt;
        &lt;dict&gt;
                &lt;key&gt;Listeners&lt;/key&gt;
                &lt;dict&gt;
                        &lt;key&gt;SockPassive&lt;/key&gt;
                        &lt;true/&gt;
                        &lt;key&gt;SockServiceName&lt;/key&gt;
                        &lt;string&gt;cvspserver&lt;/string&gt;
                        &lt;key&gt;SockType&lt;/key&gt;
                        &lt;string&gt;SOCK_STREAM&lt;/string&gt;
                &lt;/dict&gt;
        &lt;/dict&gt;
        &lt;key&gt;inetdCompatibility&lt;/key&gt;
        &lt;dict&gt;
                &lt;key&gt;Wait&lt;/key&gt;
                &lt;false/&gt;
        &lt;/dict&gt;
&lt;/dict&gt;
&lt;/plist&gt;
</code>

You’ll have to change the --allow-root=/Users/cvs CVS root specification above to match your actual root, but otherwise the above should work.

Next, it doesn’t appear that cvs under Tiger can access the standard user/password database, so you’ll have to create a password file in your $CVSHOME/CVSROOT directory:

<code>
&#36; cd ~cvs/CVSROOT
&#36; sudo htpasswd -c passwd user1
&#36; sudo htpasswd passwd user2 # etc.
</code>

Then, you’ll need a

<code>
# launchctl load /Library/LaunchDaemons/cvspserver.list
</code>

and you should be in business.
(At the next reboot, cvspserver.plist should be picked up by launchd.)

No Comments

  • Start with this article.

    –Chris Ryland, Em Software

  • I need to make a correction: for this to work with a CVSROOT/passwd
    scheme (where the server has to setuid to the accessing user), the
    UserName value should be root, not cvs, as in:

    
    <key>UserName</key>
            <string>root</string>
    

    –Chris Ryland, Em Software

Leave a reply

You must be logged in to post a comment.