Patch for password-based svn+https

Robin Lee Powell rlpowell at digitalkingdom.org
Thu Feb 12 01:56:48 CET 2009


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

sf-liarg1:/# diff -C3 /tmp/get-config-dir-svn /usr/lib/fai/get-config-dir-svn
*** /tmp/get-config-dir-svn     Thu Feb 12 00:30:51 2009
--- /usr/lib/fai/get-config-dir-svn     Thu Feb 12 00:46:55 2009
***************
*** 11,17 ****

  # matched string: "svn://user@host/svnpath"
  protocol=$(expr match "$FAI_CONFIG_SRC" '\([^:]*\)://')
! username=$(expr match "$FAI_CONFIG_SRC" '[^:]*://\([^@]*\)@')
  svnpath=$(expr match "$FAI_CONFIG_SRC" '[^:]*://[^@]\+@\([^[:space:]]\+\)')

  case $protocol in
--- 11,20 ----

  # matched string: "svn://user@host/svnpath"
  protocol=$(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,45 ****
                ;;
  esac

! [ -n "$username" ] && user="--username $username"
! [ -z "$username" ] && svnurl=$FAI_CONFIG_SRC

  if [ -d "$FAI/.svn" ] ; then
     echo "Updating SVN in $FAI"
--- 41,53 ----
                ;;
  esac

! 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,53 ****
     task_error 701
  else
     echo "Checking out SVN"
!    svn co $user $svnurl $FAI | grep -v 'Checked out revision' > $LOGDIR/getconf.log
     task_error 702
  fi
--- 56,61 ----
     task_error 701
  else
     echo "Checking out SVN"
!    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