安装svn之后,每次创建新的svn都很麻烦,所以写了这个自动创建svn的脚本
代码:
read -t 30 -p "请输入项目名:" name
echo -e "\n"
echo "项目名为:$name"
if [ -d "/www/wwwroot/svnrepos/$name" ];then
echo "Error !!! Dir $1 is exist Please change to another name"
exit 1
fi
sudo svnadmin create /www/wwwroot/svnrepos/$name
cd /www/wwwroot/svnrepos/$name/conf/
echo '开始修改conf'
sed -i '29a \[\/\]' authz
sed -i "30a $name=rw" authz
sed -i "8a $name=$name.com" passwd
sed -e '19c anon-access = read' -i svnserve.conf
sed -e '20c auth-access = write' -i svnserve.conf
sed -e '27c password-db = passwd' -i svnserve.conf
sed -e '34c authz-db = authz' -i svnserve.conf
echo "开始检出到/www/wwwroot/"$name
cd /www/wwwroot/
svn co --username $name --password $name.com svn://47.112.156.252/$name/
echo 'The SVN Server Address: svn://47.112.156.252/'$name
唯一的缺点就是,钩子要自己设置,然后手动更新一次