Created
April 5, 2013 17:17
-
-
Save ionelmc/5321008 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -eEx | |
if [ -z "$1" ] || [ -z "$2" ]; then | |
echo "Usage: $0 local-alias http://host/path/to/svn/project" | |
exit 1 | |
fi | |
SVN_ALIAS=$1 | |
SVN_PATH=/var/www/svn/$1 | |
SVN_URL=$2 | |
if ! dpkg-query -s python-software-properties > /dev/null; then | |
sudo apt-get install python-software-properties | |
fi | |
#if ! dpkg-query -s subversion | grep "Version: 1.7"; then | |
# cat <<EOF | sudo tee /etc/apt/sources.list.d/wandisco-svn17.list | |
# deb http://opensource.wandisco.com/ubuntu precise svn17 | |
#EOF | |
# sudo wget -q http://opensource.wandisco.com/wandisco-debian.gpg -O- | sudo apt-key add - | |
# sudo apt-get update | |
# sudo apt-get install subversion libapache2-svn python-subversion | |
# | |
# # it was a silly idea to upgrade to 1.7 .... | |
# sudo ln -sf /usr/lib/libsvn_client-1.so.0.0.0 /usr/lib/libsvn_client-1.so.1 | |
# sudo ln -sf /usr/lib/libsvn_diff-1.so.0.0.0 /usr/lib/libsvn_diff-1.so.1 | |
# sudo ln -sf /usr/lib/libsvn_repos-1.so.0.0.0 /usr/lib/libsvn_repos-1.so.1 | |
#fi | |
if ! dpkg-query -s libapache2-svn > /dev/null; then | |
sudo apt-get install libapache2-svn | |
fi | |
cat <<EOF | sudo tee /etc/apache2/conf.d/$1.conf | |
SSLProxyEngine on | |
SSLProxyVerify none | |
DumpIOInput on | |
DumpIOOutput on | |
DumpIOLogLevel warn | |
<Location /$1> | |
DAV svn | |
SVNPath $SVN_PATH | |
SVNMasterURI $SVN_URL | |
Order allow,deny | |
Allow from all | |
#Allow from 127.0.0.1 | |
</Location> | |
EOF | |
sudo rm -rf $SVN_PATH | |
sudo mkdir -p $SVN_PATH | |
sudo svnadmin create $SVN_PATH | |
cat <<EOF | sudo tee $SVN_PATH/hooks/pre-revprop-change | |
#!/bin/bash | |
exit 0 | |
EOF | |
sudo chmod +x $SVN_PATH/hooks/pre-revprop-change | |
#cat <<EOF | sudo tee $SVN_PATH/hooks/start-commit | |
##!/bin/bash | |
#svnsync sync file://$SVN_PATH | |
#EOF | |
#sudo chmod +x $SVN_PATH/hooks/start-commit | |
sudo a2enmod proxy | |
sudo a2enmod proxy_http | |
sudo a2enmod ssl | |
sudo a2enmod dump_io | |
sudo chown -R www-data /var/www/svn | |
sudo service apache2 restart | |
read -p "Username for $SVN_URL:" SVN_USERNAME | |
read -s -p "Password for $SVN_URL:" SVN_PASSWORD | |
sudo -u www-data svnsync init file://$SVN_PATH $SVN_URL --source-username=$SVN_USERNAME --source-password=$SVN_PASSWORD | |
#if resuming: sudo -u www-data svn pdel --revprop -r 0 svn:sync-lock file://$SVN_PATH | |
sudo -u www-data svnsync sync file://$SVN_PATH --source-username=$SVN_USERNAME --source-password=$SVN_PASSWORD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment