1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
echo -n '请输入仓库文件夹名称(默认test_svnserver):'
read svnserver_name
echo -n '请输入仓库名称(默认test_repository):'
read repository_name
if [ ! -n "$svnserver_name" ]; then svnserver_name="test_svnserver" fi if [ ! -n "$repository_name" ]; then repository_name="test_repository" fi
mkdir $HOME/$svnserver_name cd $HOME/$svnserver_name svnadmin create $repository_name
echo -e "\033[0;32;1mcreate repository success please wait seconds\033[0m"
sleep 2s
filepath="$HOME/$svnserver_name/$repository_name/conf/svnserve.conf"
sed -i "" "s/# anon-access = read/anon-access = none/g" $filepath sed -i "" "s/# auth-access = write/auth-access = write/g" $filepath sed -i "" "s/# password-db = passwd/password-db = passwd/g" $filepath sed -i "" "s/# authz-db = authz/authz-db = authz/g" $filepath
filepath="$HOME/$svnserver_name/$repository_name/conf/passwd" sed -i "" "s/root = 123//g" $filepath echo "root = 123" >> $filepath
filepath="$HOME/$svnserver_name/$repository_name/conf/authz"
sed -i "" "s/^\\[groups\\]/\\[groups\\]\\`echo -e '\r\n'`mygroup = root/g" $filepath
sed -i "" "s/\\[\/\\]//g" $filepath sed -i "" "s/@mygroup = rw//g" $filepath sed -i "" "s/^* =//g" $filepath echo "[/]" >> $filepath echo "@mygroup = rw" >> $filepath echo "* = " >> $filepath
ps -ef | grep svnserve | awk -F " " '{if($3==1)print $2}' | xargs kill -9
svnserve -d -r $HOME/$svnserver_name/$repository_name
mkdir $HOME/svn_test_folder echo "Hello SVN" >> $HOME/svn_test_folder/hellosvn.txt
cd $HOME/svn_test_folder
svn import . svn://localhost/$repository_name/svn_test_folder --username=root --password=123 -m "初始化导入"
echo -e "服务器地址:\033[0;32;1msvn://root@127.0.0.1/$repository_name\033[0m"
echo -e "\033[0;33;1mroot用户默认密码123\033[0m" echo -e "\033[0;33;1m$HOME/$svnserver_name/$repository_name/conf 目录下添加用户修改密码就行\033[0m"
|