Subversion on QNAP TS-239 Pro II

Based on the guide on the QNap wiki. This guide specifically shows how to install a subversion server on port 4000 for multiple repositories on the QNAP TS-239 Pro II.

  • Install svnserve:

    # ipkg update
    # ipkg install svn
  • Create a directory for the repositories:

    # mkdir /share/HDA_DATA/subversion
  • To create a new repository for a project, do the following:

    # svnadmin create /share/HDA_DATA/subversion/repos1

    NB: To delete a repository, just delete the directory itself.
  • Access to the repositories is set up in the repos1/conf/svnserve.conf, repos1/conf/passwd and repos1/conf/authz files. The following is a basic configuration.

svnserve.conf:
[general]
anon-access = read
auth-access = write
password-db = passwd

passwd:

[users]
svnuser= svnusersecret

authz:

[repository:/share/HDA_DATA/subversion/repos1]
svnuser = rw

  • To start the svnserve daemon on startup, we must add a command to autorun.sh.
    This file is located on the configuration ram block, sdx6, which must first be mounted. This is done in the following way on the TS-239 Pro II (for other models, see Running Your Own Application at Startup)

    # mount -t ext2 /dev/sdx6 /tmp/config

    Open autorun.sh in an editor:

    # nano /tmp/config/autorun.sh

    Add the following line, which will make sure svnserve is executed only when opt/bin has been loaded:

    (while test ! -x "/opt/bin/svnserve"; do sleep 5; done; /opt/bin/svnserve -d --listen-port=4000)&

    Finally, make sure autorun.sh is executable and unmount sdx6:

    # chmod +x /tmp/config/autorun.sh
    # umount /tmp/config
  • You can test the subversion server by doing a checkout using your favourite subversion client (e.g. TortoiseSVN). The url to check out will be something like this:
    svn://nas:4000/share/HDA_DATA/subversion/repos1

UPDATE 10/6 2019

After a QNap update, the Subversion server would no longer start. It appears that the “opt” dir symlink no longer points to the right place. The following fixed it.

In the autorun.sh file, just add the following instead of the above:

export LD_LIBRARY_PATH=/share/HDA_DATA/.qpkg/Optware/lib

(while test ! -x "/share/HDA_DATA/.qpkg/Optware/bin/svnserve"; do sleep 5; done; /share/HDA_DATA/.qpkg/Optware/bin/svnserve -d --listen-port=4000)&