Ubuntu初始化svn一系列脚本

2018-05-08 18:09:42 浏览数 (1)

代码语言:javascript复制
个人ubuntu服务器初始化svn脚本,虽然很烂,但是自己用起来很方便!(为何写ubuntu呢?因为centos的svn模块和ubuntu不一样!)
#!/bin/bash
read -p 'input svn path (eg:test)> ' site
if [ ! -d "/var/www/svn/${site}" ]; then
svnadmin create "/var/www/svn/${site}"
echo "svn init success /var/www/svn/${site}"
else
echo "svn path is exist!!"
exit 0
fi
if [ ! -f "/var/www/svn/${site}/hooks/post-commit" ];then
touch "/var/www/svn/${site}/hooks/post-commit"
echo "#!/bin/bash
svn update /var/www/html/${site}">/var/www/svn/${site}/hooks/post-commit
else
echo "touch post-commit error!!!"
exit 0
fi
chmod  x /var/www/svn/${site}/hooks/post-commit
chown -R www-data:www-data /var/www/svn/${site}
if [ ! -f "/etc/apache2/svn/${site}.conf" ];then
touch "/etc/apache2/svn/${site}.conf"
echo "
DAV svn
SVNPath /var/www/svn/${site}
Authtype Basic
AuthName 'SVN'
Auth_MySQL on
Auth_MySQL_Authoritative on
Auth_MySQL_Host localhost
Auth_MySQL_DB   test
Auth_MySQL_User test
Auth_MySQL_Password test123456
Auth_MySQL_Password_Table test
Auth_MySQL_Username_Field user
Auth_MySQL_Password_Field pwd
Auth_MySQL_Empty_Passwords Off
Auth_MySQL_Encrypted_Passwords  on
Auth_MySQL_Encryption_Types PHP_MD5
AuthBasicAuthoritative Off
AuthUserFile /dev/null
Require valid-user">/etc/apache2/svn/${site}.conf
else
echo 'touch /etc/apache2/svn/${site}.conf error'
exit 0
fi
echo "cat /var/www/svn/${site}/hooks/post-commit"
echo "cat /etc/apache2/svn/${site}.conf"
echo "cd /var/www/html"
echo "svn checkout http://svn.joyousphper.com/${site}"
这个完全是我方便自己初始化svn编写的(当然里面的路径和帐号密码肯定不是我的了~^_^),不一定适合你!  

0 人点赞