今天闲来没事,就写下svn部署脚本:

#!/bin/bash
#date:2017/11/20
#author:Vaedit
read -p "请输入svn根目录名:" svndir
read -p "请输入用户名:" name
read -p "请输入密码:" password
ip=`ip addr|grep inet|grep -v inet6|grep -v 127.0.0.1|awk '{print $2}'|grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+'`
SVN_DIR='/var/www/'
yum install httpd subversion mod_dav_svn httpd-devel -y
mkdir ${SVN_DIR} -p
svnadmin create ${SVN_DIR}${svndir}
cd ${SVN_DIR}${svndir}/conf
rm -rf passwd
htpasswd -bc passwd $name $password
cat >> authz </etc/httpd/conf.d/subversion.conf<
   DAV svn
   SVNParentPath ${SVN_DIR}
      AuthType Basic
      AuthName "Authorization Realm"
      AuthUserFile ${SVN_DIR}${svndir}/conf/passwd
      AuthzSVNAccessFile ${SVN_DIR}${svndir}/conf/authz
      Require valid-user

EOF
service httpd restart
svnserve -d -r ${SVN_DIR}
echo “登录请查看http://$ip/svn/$svndir”