Thursday, July 12, 2012

POB recipe to install SVN credentials in a remote Server

If you are keeping configuration files in SVN you will need to retrieve them from your servers while managing or configuring them. After all you should automate everything but also keep track of your changes. Remember The palest ink is better than the best memory.

You do not want to be running svn passing credentials every time you need to pull a configuration file (or even a script if you practice bootstrapping ;-) so here is a POB recipe to remotely install credentials for SVN in a remote server:
#!/bin/bash -e


USAGE="Usage: `basename $0` <svnrepo>"

if [ $# -ne "1" ] 
 echo $USAGE
  exit 1 

echo -n "SVN User: "
read svnuser
echo -n "SVN Password: "
read -s svnpassword

apt-get -q -y install subversion || svn --version
sed -i 's/# store-passwords = no/store-passwords = yes/g' .subversion/servers
sed -i 's/# store-plaintext-passwords = no/store-plaintext-passwords = yes/g' .subversion/servers
echo $svnpassword | svn info $svnrepo --username $svnuser
Now you can run POB recipes that use svn repo remotely without the need to supply credentials.

No comments: