ports/122972: svnserve requires user svn, should be automatically created and rc script's default path differs from Makefile's

Chris St Denis chris at smartt.com
Mon Apr 21 19:40:01 UTC 2008


>Number:         122972
>Category:       ports
>Synopsis:       svnserve requires user svn, should be automatically created and rc script's default path differs from Makefile's
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 21 19:40:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Chris St Denis
>Release:        n/a
>Organization:
>Environment:
n/a
>Description:
To use svnserve daemon a user and group must be created. The group can be auto created with WITH_REPOSITORY_CREATION however no user is created. I have attached a patch that also creates the user in the same way the group is already created.

Also, the svnserve daemon's rc script defaults the path to %%PREFIX%%/repositories where as the Makefile (for the purposes of WITH_REPOSITORY_CREATION) defaults to /home/svn/repos. One of these should be changed. The second attached patch changes the RC script to /home/svn/repos
>How-To-Repeat:

>Fix:
Patch for makefile (not heavily tested)
-------------------
drs# diff -u Makefile.old Makefile
--- Makefile.old        Mon Apr 21 12:16:50 2008
+++ Makefile    Mon Apr 21 12:20:46 2008db/$$i; \
+           *) ${CHOWN} -R ${SVNUSER}:${SVNGROUP} $
@@ -159,10 +159,12 @@
 CONFIGURE_ARGS+=       --with-apxs=${APXS}
 PLIST_SUB+=    MOD_DAV_SVN=""
 SVNGROUP?=     www
+SVNUSER?=      www
 .else
 PLIST_SUB+=    MOD_DAV_SVN="@comment "
 PKGDEINSTALL=  NONEXISTENT
 SVNGROUP?=     svn
+SVNUSER?=      svn
 .endif

 .if defined(WITH_APACHE2_APR)
@@ -300,10 +302,10 @@
 .endif
        @${ECHO_MSG} ""
 .if defined(WITH_REPOSITORY_CREATION)
-       @${ECHO_MSG} "I will create (or use, if it exists) \"${SVNGROUP}\" group."
+       @${ECHO_MSG} "I will create (or use, if it exists) \"${SVNUSER}\" user and \"${SVNGROUP}\" group."
        @${ECHO_MSG} "Make sure that all committers are its members."
        @${ECHO_MSG} ""
-       @${ECHO_MSG} "Repository will be created at '${SVNREPOS}' with group '${SVNGROUP}'."
+       @${ECHO_MSG} "Repository will be created at '${SVNREPOS}' with user \"${SVNUSER}\" and group '${SVNGROUP}'."
        @${ECHO_MSG} "Type of repository will be '${SVNFSTYPE}'."
        @${ECHO_MSG} "You could change these settings by defining SVNREPOS, SVNGROUP and SVNFSTYPE."
 .else
@@ -449,17 +451,29 @@
                ${FALSE}; \
            fi; \
        fi
+        @if /usr/sbin/pw usershow "${SVNUSER}" >/dev/null 2>&1; then \
+            ${ECHO_MSG} "You already have a user \"${SVNUSER}\", so I will use it."; \
+        else \
+            if /usr/sbin/pw useradd ${SVNUSER} -h -; \
+            then \
+                ${ECHO_MSG} "Added user \"${SVNUSER}\"."; \
+            else \
+                ${ECHO_MSG} "Adding user \"${SVNUSER}\" failed..."; \
+                ${ECHO_MSG} "Please create it, and try again."; \
+                ${FALSE}; \
+            fi; \
+
 .endif
        @${MKDIR} ${SVNREPOS}
        @${PREFIX}/bin/svnadmin create --fs-type ${SVNFSTYPE} ${SVNREPOS}
 .if defined(WITH_SVNSERVE_WRAPPER)
-       @${CHGRP} ${SVNGROUP} ${SVNGRPFILES}
+       @${CHOWN} ${SVNUSER}:${SVNGROUP} ${SVNGRPFILES}
        @${CHMOD} g+w ${SVNGRPFILES}
        @for i in ${SVNREPOS}/db/* ; do \
            i=$${i##*/}; \
            case $$i in \
            DB_CONFIG|fs-type|uuid) ;; \
-           *) ${CHGRP} -R ${SVNGROUP} ${SVNREPOS}/{SVNREPOS}/db/$$i; \
               ${CHMOD} -R g+w ${SVNREPOS}/db/$$i; \
               ;; \
            esac; \

Second patch
------------
drs# diff -u svnserve.in.old svnserve.in
--- svnserve.in.old     Mon Apr 21 12:30:42 2008
+++ svnserve.in Mon Apr 21 12:30:51 2008
@@ -22,7 +22,7 @@
 # Set some defaults
 svnserve_enable=${svnserve_enable:-"NO"}
 svnserve_flags=${svnserve_flags:-"-d --listen-port=3690"}
-svnserve_data=${svnserve_data:-"%%PREFIX%%/repositories"}
+svnserve_data=${svnserve_data:-"/home/svn/repos"}
 svnserve_user=${svnserve_user:-"svn"}
 svnserve_group=${svnserve_group:-"svn"}


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list