#!/bin/bash
#installing subversion (from http://www.hostmonsterforum.com/showthread.php?t=1294)
#from root ssh login:

#latest versions from http://subversion.tigris.org/
wget http://subversion.tigris.org/downloads/subversion-1.5.4.tar.bz2
tar xvjf subversion-1.5.4.tar.bz2
cd subversion-1.5.4
# latest versions from http://apr.apache.org/download.cgi
wget http://www.urlstructure.com/apache/apr/apr-1.3.3.tar.bz2
tar xvjf apr-1.3.3.tar.bz2 
mv apr-1.3.3 apr
cd apr
./buildconf
./configure --prefix=$HOME/bin
make
make install
cd ..
wget http://www.urlstructure.com/apache/apr/apr-util-1.3.4.tar.bz2
tar xvjf apr-util-1.3.4.tar.bz2
mv apr-util-1.3.4 apr-util
cd apr-util
./buildconf
./configure --with-apr=$HOME/bin/bin/apr-1-config --prefix=$HOME/bin
make
make install
cd ..
./configure --disable-shared --prefix=$HOME/bin
make
make install
# great that's built and installed subversion locally
# now set up so we can *run* it from a ssh session
# so add the path in the .bashrc file (not profile)
# note you can just edit the file if you like!
cd ~
echo "PATH=\$PATH:\$HOME/bin/bin/" >> .bashrc
echo "export PATH" >> .bashrc
source .bashrc

# now we need an svn repository
mkdir svnrepos
svnadmin create svnrepos --fs-type fsfs

# OK, at this point we're up and running with svn which will work
# for the local user on ssh.
# however we want to be able to have multiple users right?
# ok... so how to do that?
# info comes from this post: http://forums.site5.com/showthread.php?t=11008
# i'm super lazy so going to create a script to do this
# download my script and then run it!
wget www.sharpstep.com/Articles/HostMonster-svn/create_svn_user.sh
chmod a+x create_svn_user.sh
# now to create an svn user simply type ./create_svn_user.sh

#finally we should cleanup
rm -rf subversion-1.5.4
rm subversion-1.5.4.tar.bz2


