Patch for password-based svn+https
Robin Lee Powell
rlpowell at digitalkingdom.org
Thu Feb 12 20:33:32 CET 2009
On Thu, Feb 12, 2009 at 10:47:52AM +0100, Michael Tautschnig wrote:
> >
> > svn+https: for FAI_CONFIG_SRC doesn't work with a user:pass at host
> > type URI. Here's a patch; diff done from inside the
> > live/filesystem.dir
> >
>
> [...] (broken patch)
>
> - Please always use diff -u (unified diff)
Here you go. I have no idea how it interacts with the other patch
you showed me; I can go combine them if it's important to you,
although I can't test it since we don't allow anonymous svn around
here.
--- /srv/fai/nfsroot/live/filesystem.dir/usr/lib/fai/get-config-dir-svn 2009-01-12 04:13:18.000000000 -0800
+++ /srv/fai/broken/get-config-dir-svn 2009-02-11 18:05:40.000000000 -0800
@@ -11,7 +11,10 @@
# matched string: "svn://user@host/svnpath"
protocol=$(expr match "$FAI_CONFIG_SRC" '\([^:]*\)://')
-username=$(expr match "$FAI_CONFIG_SRC" '[^:]*://\([^@]*\)@')
+# username may or may not be followed by a password
+username=$(expr match "$FAI_CONFIG_SRC" '[^:]*://\([^@:]*\)[^@]*@')
+# password definitely is preceded by a username
+password=$(expr match "$FAI_CONFIG_SRC" '[^:]*://[^@:]*:\([^@]*\)@')
svnpath=$(expr match "$FAI_CONFIG_SRC" '[^:]*://[^@]\+@\([^[:space:]]\+\)')
case $protocol in
@@ -38,8 +41,13 @@
;;
esac
-[ -n "$username" ] && user="--username $username"
-[ -z "$username" ] && svnurl=$FAI_CONFIG_SRC
+if [ -n "$username" ]
+then
+ user="--username $username"
+ [ -n "$password" ] && pass="--password $password"
+else
+ svnurl=$FAI_CONFIG_SRC
+fi
if [ -d "$FAI/.svn" ] ; then
echo "Updating SVN in $FAI"
@@ -48,6 +56,6 @@
task_error 701
else
echo "Checking out SVN"
- svn co $user $svnurl $FAI | grep -v 'Checked out revision' > $LOGDIR/getconf.log
+ svn co $user $pass $svnurl $FAI | grep -v 'Checked out revision' > $LOGDIR/getconf.log
task_error 702
fi
More information about the linux-fai
mailing list