Using the base Subversion server

As of FreeBSD 10.0, a "light" version of Subversion has been integrated into the base system. It includes most of the svn tools, though the filenames have been changed (e.g. "svnlite" instead of "svn", "svnliteserve" instead of "svnserve" etc.) Most people probably would use this for the client, but it turns out the server binary is included as well... for most uses, you don't need the devel/subversion port any more.

Here is how you can do this yourself:

1. As root create the file /etc/rc.d/svnliteserve with these contents:
Code:
#!/bin/sh
#
# svnliteserve.sh for rc.d usage (c) 2016 Greg Kennedy.
# $Id$

# PROVIDE: svnliteserve
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable SVNServe:
#
#  svnliteserve_enable="YES"
#  # optional
#  svnliteserve_flags="-d --listen-port=3690 --listen-host 0.0.0.0"
#  svnliteserve_data="/usr/local/repositories"
#  svnliteserve_user="svn"
#  svnliteserve_group="svn"
#
# Note:
# svnliteserve bind per default at the ipv6 address!
# If you want svnliteserve binding at ipv4 address, you have
# to use option 'svnliteserve_flags' with --listen-host parameter

. /etc/rc.subr

# Set some defaults
svnliteserve_enable=${svnliteserve_enable:-"NO"}
svnliteserve_flags=${svnliteserve_flags:-"-d --listen-port=3690 --listen-host 0.0.0.0"}
svnliteserve_data=${svnliteserve_data:-"/home/svn/repos"}
svnliteserve_user=${svnliteserve_user:-"svn"}
svnliteserve_group=${svnliteserve_group:-"svn"}

name=svnliteserve
rcvar=svnliteserve_enable
load_rc_config $name
command=/usr/bin/svnliteserve
command_args="-r ${svnliteserve_data}"

run_rc_command "$1"

2. Ensure file is owned by root:wheel and chmod 555 (read-execute for all)

3. Edit /etc/rc.conf and add some lines:
Code:
# Enable built-in subversion server
svnliteserve_enable="YES"
# Flags to svnliteserve
#svnliteserve_flags="-d --listen-port=3690 --listen-host 0.0.0.0"
# Location of subversion repository on disk
#svnliteserve_data="/home/svn/repos"
# User to run svnserve as
#svnliteserve_user="svn"
# Group to run svnserve as
#svnliteserve_user="svn"

4. Start it up!
/etc/rc.d/svnliteserve start

---

Notes:
* You may need to add the svn user and group, if you haven't already (the port may add them for you)
* Setting up a repository and other info is beyond the scope of this post... but should be just like the port.
 
Back
Top