今天闲来没事,就写下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 <<EOF
[/]
$name = rw
EOF
cat >/etc/httpd/conf.d/subversion.conf<<EOF
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /svn>
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
</Location>
EOF
service httpd restart
svnserve -d -r ${SVN_DIR}
echo “登录请查看http://$ip/svn/$svndir”
原文地址:https://blog.51cto.com/vaedit/2479837
时间: 2024-10-14 18:58:28