在Linux中用Shell脚本完成SVN版本库的建立

2022-12-23 19:06:14 浏览数 (1)

每次建立一个新的SVN版本库总感觉很繁琐,所以写了段脚本来把这个过程自动化,详细代码如下:

代码语言:javascript复制
#!/bin/bash
# by www.sunbloger.com

echo -n "Enter SVN name :"
read svn_name
/usr/bin/svnadmin create /svnroot/$svn_name
if [ $? -eq 0 ]; then
    
    # svnserve.conf
    sed -i 's/# anon-access = read/anon-access = none/g' /svnroot/$svn_name/conf/svnserve.conf
    sed -i 's/# auth-access = write/auth-access = write/g' /svnroot/$svn_name/conf/svnserve.conf
    sed -i 's/# password-db = passwd/password-db = /svnroot/conf/passwd/g' /svnroot/$svn_name/conf/svnserve.conf
    sed -i 's/# authz-db = authz/authz-db = authz/g' /svnroot/$svn_name/conf/svnserve.conf
    
    # authz
    cat > /svnroot/$svn_name/conf/authz<<EOF
[groups]
developer = jason
[/]
@developer = rw
EOF

fi

阳光部落原创,更多内容请访问http://www.sunbloger.com/

0 人点赞