Linux下多版本库svn独立服务器搭建
jopen
11年前
1、安装subversion
根据你的linux系统使用系统命令咯:
sudo apt-get install subversion sudo yum -y install subversion
2、到某个目录下新建一个所有版本库的根目录
cd /home/jingxing05 mkdir svnrepos cd svnrepos
3、创建多个库
svnadmin create repo1 svnadmin create repo2 svnadmin create repo___base
4、配置密码和权限
cd repo___base echo "jingxing05=1234567890" >> conf/passwd echo "[repo___base:/]" >> conf/authz echo "jingxing05=rw" >> conf/authz vi conf/svnserve.conf anon-access = none auth-access = write password-db = passwd authz-db = authz realm= Svn Repo Base :wq
其余两个库依法炮制
5、一个脚本来复制生成库
#!/bin/sh if [ $# -lt 2 ]; then cat<<TIP two arguments: username and password usage: ./svn_repo.sh username password TIP exit 1 fi username=$1 upaswd=$2 svnbase='/home/jingxing05/svnrepos' idespace='/home/jingxing05/idecloud9workspace/all' #1 copy a repo_tpl if [ -d "${svnbase}/${username}" ] ; then echo 'WARN: ready exist,check it.' exit 1 fi cp -fR ${svnbase}/repo___tpl ${svnbase}/${username} if [ $? -eq 0 ] ; then #add user password echo "${username}=${upaswd}" >> ${svnbase}/${username}/conf/passwd echo "[${username}:/]" >> ${svnbase}/${username}/conf/authz echo "${username}=rw" >> ${svnbase}/${username}/conf/authz echo 'repo is freshly ready' fi # killall svnserve # svnserve -d -r ${svnbase} --listen-host 192.168.1.100 # check if repo dir is ok, and also checkout a dir for cloud9 ide's workspace if [ -d "${idespace}/${username}" ] ; then cd ${idespace}/${username} svn update --username ${username} --password ${upaswd} else cd ${idespace} svn co svn://192.168.1.100/${username}@ --username ${username} --password ${upaswd} fi if [ $? -ne 0 ] ; then echo 'failed' rm -rf ${idespace}/${username} rm -rf ${svnbase}/${username} exit 1 fi echo 'success' exit 0
shell中的指令执行 成功大多返回 0 失败或有错误返回大于0 的值
但也有很多例外,所以有很多地方请用 if [ ] 进行测试 类似 assert 成功时才进行下一步操作
来自:http://my.oschina.net/jingxing05/blog/183131