You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Matthew Beals <mj...@mtu.edu> on 2011/09/10 03:13:01 UTC
customizing svnserve for svn+ssh
I have two sets of repos setup... common repos and user repos. On the machine acting as the svn host, I have the common repos stored in /repos while the user repos are in /home/<username>/.repos/
I'm attempting to simplify svn+ssh access such that:
svn+ssh://<server>/Code/some_project_repo serves up /repos/Code/some_project_repo
svn+ssh://<server>/<username>/some_project_repo serves up /home/<username>/.repos/some_project_repo
I took the example of writing a shell script in /usr/local/bin that sets the umask and calls svnserve and modified it to include this path tinkering. Here is that script:
##############################################
#!/bin/bash
umask 002
PATH="$@"
ROOT="/repos"
USER=`echo $PATH | /bin/sed "s/^\/\([a-z]*\)\/.*/\1/"`
PATTERN="^$USER:"
if `/usr/bin/ypcat passwd | /bin/egrep -q $PATTERN` ; then
ROOT="/home/$USER/.repos"
PATTERN="s/\/$USER//"
PATH=`echo $PATH | /bin/sed $PATTERN`
fi
exec /usr/bin/svnserve "$PATH" -r "$ROOT"
#################################################################
It just compares the first directory passed in against the users in the NIS domain and if it finds a match, builds a new Path and root path to the repos. It works just fine on the command line when I pass it paths and echo back out the parts, but when I attempt to actually run it (by accessing a repo with svn+ssh), $PATH does not get set to the path being passed in... it is just set to '-t'. However, when I try to access a common repo (where PATH is left unadulterated), it serves up the repo just fine. Is the path being passed encoded somehow? Is there are way to access it?
thanks,
Matt
----------------------------------------
Matthew Beals
Michigan Technological University
Department of Atmospheric Sciences
1400 Townsend Drive
B019a Fisher Hall
Houghton, MI 49931
mjbeals@mtu.edu
Re: customizing svnserve for svn+ssh
Posted by Matthew Beals <mj...@mtu.edu>.
My user base isn't exactly made up of power users... they already balked a little when I showed them how to configure tortoise and putty. I can only imagine handing them more customization.
I think I'll try the symlink option, but set it up with automount
thanks,
Matt
----------------------------------------
Matthew Beals
Michigan Technological University
Department of Atmospheric Sciences
1400 Townsend Drive
B019a Fisher Hall
Houghton, MI 49931
mjbeals@mtu.edu
----- Original Message -----
From: "Daniel Shahaf" <d....@daniel.shahaf.name>
To: "bealsm82@gmail.com" <mj...@mtu.edu>
Cc: "svn" <us...@subversion.apache.org>
Sent: Saturday, September 10, 2011 8:42:13 AM GMT -05:00 US/Canada Eastern
Subject: Re: customizing svnserve for svn+ssh
Stefan Sperling wrote on Sat, Sep 10, 2011 at 14:37:58 +0200:
> On Sat, Sep 10, 2011 at 08:24:24AM -0400, bealsm82@gmail.com wrote:
> > Sorry, I should have been more verbose with the description of my shell script.
> >
> > So am I to take it that intercepting and altering the path isn't possible in a simple wrapper script?
>
> One way of shortening the repository path in an svn+ssh URL is placing
> symlinks into the root filesystem of the svn server.
>
> You could create symlinks like this:
>
> /Code -> /repos/Code
> /<username> -> /home/<username>/.repos
Another option is to have the client issue a different command
depending on which of the two it wants. That does involve client-side
setup --- either in ~/.subversion/config[tunnels] or in
~/.ssh/config[Host, IdentityFile, ...].
Re: customizing svnserve for svn+ssh
Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Stefan Sperling wrote on Sat, Sep 10, 2011 at 14:37:58 +0200:
> On Sat, Sep 10, 2011 at 08:24:24AM -0400, bealsm82@gmail.com wrote:
> > Sorry, I should have been more verbose with the description of my shell script.
> >
> > So am I to take it that intercepting and altering the path isn't possible in a simple wrapper script?
>
> One way of shortening the repository path in an svn+ssh URL is placing
> symlinks into the root filesystem of the svn server.
>
> You could create symlinks like this:
>
> /Code -> /repos/Code
> /<username> -> /home/<username>/.repos
Another option is to have the client issue a different command
depending on which of the two it wants. That does involve client-side
setup --- either in ~/.subversion/config[tunnels] or in
~/.ssh/config[Host, IdentityFile, ...].
Re: customizing svnserve for svn+ssh
Posted by Stefan Sperling <st...@elego.de>.
On Sat, Sep 10, 2011 at 08:24:24AM -0400, bealsm82@gmail.com wrote:
> Sorry, I should have been more verbose with the description of my shell script.
>
> So am I to take it that intercepting and altering the path isn't possible in a simple wrapper script?
One way of shortening the repository path in an svn+ssh URL is placing
symlinks into the root filesystem of the svn server.
You could create symlinks like this:
/Code -> /repos/Code
/<username> -> /home/<username>/.repos
Re: customizing svnserve for svn+ssh
Posted by "bealsm82@gmail.com" <mj...@mtu.edu>.
Sorry, I should have been more verbose with the description of my shell script.
So am I to take it that intercepting and altering the path isn't possible in a simple wrapper script?
Thanks,
Matt
Daniel Shahaf <d....@daniel.shahaf.name> wrote:
svn+ssh://host/some/path/here runs 'ssh host svnserve -t' and the path
is passed within the ra_svn protocol. Next time please don't make me
have to reverse engineer a shell script in order to answer such a simple
question :)
Matthew Beals wrote on Fri, Sep 09, 2011 at 21:13:01 -0400:
> I have two sets of repos setup... common repos and user repos. On the machine acting as the svn host, I have the common repos stored in /repos while the user repos are in /home/<username>/.repos/
>
> I'm attempting to simplify svn+ssh access such that:
>
> svn+ssh://<server>/Code/some_project_repo serves up /repos/Code/some_project_repo
> svn+ssh://<server>/<username>/some_project_repo serves up /home/<username>/.repos/some_project_repo
>
> I took the example of writing a shell script in /usr/local/bin that sets the umask and calls svnserve and modified it to include this path tinkering. Here is that script:
>
> ##############################################
> #!/bin/bash
>
> umask 002
>
> PATH="$@"
> ROOT="/repos"
> USER=`echo $PATH | /bin/sed "s/^\/\([a-z]*\)\/.*/\1/"`
> PATTERN="^$USER:"
>
> if `/usr/bin/ypcat passwd | /bin/egrep -q $PATTERN` ; then
> ROOT="/home/$USER/.repos"
> PATTERN="s/\/$USER//"
> PATH=`echo $PATH | /bin/sed $PATTERN`
> fi
>
> exec /usr/bin/svnserve "$PATH" -r "$ROOT"
> #################################################################
>
> It just compares the first directory passed in against the users in the NIS domain and if it finds a match, builds a new Path and root path to the repos. It works just fine on the command line when I pass it paths and echo back out the parts, but when I attempt to actually run it (by accessing a repo with svn+ssh), $PATH does not get set to the path being passed in... it is just set to '-t'. However, when I try to access a common repo (where PATH is left unadulterated), it serves up the repo just fine. Is the path being passed encoded somehow? Is there are way to access it?
>
> thanks,
> Matt
>
>_____________________________________________
> Matthew Beals
> Michigan Technological University
> Department of Atmospheric Sciences
> 1400 Townsend Drive
> B019a Fisher Hall
> Houghton, MI 49931
> mjbeals@mtu.edu
Re: customizing svnserve for svn+ssh
Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
svn+ssh://host/some/path/here runs 'ssh host svnserve -t' and the path
is passed within the ra_svn protocol. Next time please don't make me
have to reverse engineer a shell script in order to answer such a simple
question :)
Matthew Beals wrote on Fri, Sep 09, 2011 at 21:13:01 -0400:
> I have two sets of repos setup... common repos and user repos. On the machine acting as the svn host, I have the common repos stored in /repos while the user repos are in /home/<username>/.repos/
>
> I'm attempting to simplify svn+ssh access such that:
>
> svn+ssh://<server>/Code/some_project_repo serves up /repos/Code/some_project_repo
> svn+ssh://<server>/<username>/some_project_repo serves up /home/<username>/.repos/some_project_repo
>
> I took the example of writing a shell script in /usr/local/bin that sets the umask and calls svnserve and modified it to include this path tinkering. Here is that script:
>
> ##############################################
> #!/bin/bash
>
> umask 002
>
> PATH="$@"
> ROOT="/repos"
> USER=`echo $PATH | /bin/sed "s/^\/\([a-z]*\)\/.*/\1/"`
> PATTERN="^$USER:"
>
> if `/usr/bin/ypcat passwd | /bin/egrep -q $PATTERN` ; then
> ROOT="/home/$USER/.repos"
> PATTERN="s/\/$USER//"
> PATH=`echo $PATH | /bin/sed $PATTERN`
> fi
>
> exec /usr/bin/svnserve "$PATH" -r "$ROOT"
> #################################################################
>
> It just compares the first directory passed in against the users in the NIS domain and if it finds a match, builds a new Path and root path to the repos. It works just fine on the command line when I pass it paths and echo back out the parts, but when I attempt to actually run it (by accessing a repo with svn+ssh), $PATH does not get set to the path being passed in... it is just set to '-t'. However, when I try to access a common repo (where PATH is left unadulterated), it serves up the repo just fine. Is the path being passed encoded somehow? Is there are way to access it?
>
> thanks,
> Matt
>
> ----------------------------------------
> Matthew Beals
> Michigan Technological University
> Department of Atmospheric Sciences
> 1400 Townsend Drive
> B019a Fisher Hall
> Houghton, MI 49931
> mjbeals@mtu.edu