Skip to content

Instantly share code, notes, and snippets.

@lrkwz
Created March 28, 2012 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lrkwz/2225857 to your computer and use it in GitHub Desktop.
Save lrkwz/2225857 to your computer and use it in GitHub Desktop.
Create a new svn repository
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage ./proj <project name>"
exit 2;
fi
if [ "$(whoami)" != "root" ]; then
echo "Sorry, you are not root."
exit 1
fi
SVN_HOME=/data/svn
SVN_REPO=$SVN_HOME/repos
#cd $SVN_REPO
svnadmin create $SVN_REPO/$1
chown -R apache:apache $SVN_REPO/$1/{dav,db,locks}
#cd ..
#cd $SVN_HOME/user_access
cp $SVN_HOME/user_access/moreUsers $SVN_HOME/user_access/$1_passwdfile
cp $SVN_HOME/user_access/moreGroups $SVN_HOME/user_access/$1_groupfile
chown root:apache $SVN_HOME/user_access/$1_*
chmod 640 $SVN_HOME/user_access/$1_*
# inizializzazione della struttura
cd /tmp
svn -q co file://$SVN_REPO/$1 $1_$$
cd $1_$$
for d in trunk branches tags; do
mkdir $d
svn -q add $d
done
svn -q commit -m "Structure initialization"
cd ..
rm -r /tmp/$1_$$
echo La struttura e' inizializzata con le directory standard trunk, branches e tags
# Configurazione apache
echo Ricorda di modificare /etc/httpd/vhosts.d/svn.moreinteractive.eu.conf aggiungendo
cat <<End-of-message
- snip ------------------------------------
<Location /repos/$1>
DAV svn
SVNPath $SVN_REPO/$1
# Limit write access to certain people
AuthType Basic
AuthName "Accesso a $1"
AuthUserFile $SVN_HOME/user_access/$1_passwdfile
AuthGroupFile $SVN_HOME/user_access/$1_groupfile
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require group committers moreUsers
</LimitExcept>
# Limit read access to certain people
<Limit GET PROPFIND OPTIONS REPORT>
Require group committers moreUsers
Require group readers moreUsers
</Limit>
</Location>
- snip ------------------------------------
End-of-message
echo Dopo averlo fatto esegui il comando "service httpd reload"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment