Skip to content
This repository was archived by the owner on Jan 8, 2020. It is now read-only.

Commit 3f44d32

Browse files
committed
可自定义 checkout 目录
1 parent 3b9cf40 commit 3f44d32

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

svn.sh

+24-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ echo "================================================================";
1717

1818
project='';
1919
projectPath='';
20+
webPath='';
2021
username='';
2122
password=`cat /dev/urandom | head -1 | md5sum | head -c 12`;
2223
ipAddress=`ip addr | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | egrep -v "^192\.168|^172\.1[6-9]\.|^172\.2[0-9]\.|^172\.3[0-2]\.|^10\.|^127\.|^255\." | head -n 1`;
@@ -57,17 +58,35 @@ function InputName()
5758
fi;
5859
fi;
5960
projectPath="/var/svn/repos/${project}";
61+
webPath="/home/wwwroot/${project}";
6062
username="user-${project}";
61-
[ -d "${projectPath}" ] && echo "[Error] ${project} is exist!" && InputName;
63+
[ -d "${projectPath}" ] && echo "[Error] ${project} is exist!" && project='' && InputName;
6264
mkdir -p ${projectPath};
6365
}
6466

67+
## 输入 WEB 目录
68+
function InputWebPath()
69+
{
70+
if [ "$webPath" == '' ]; then
71+
read -p '[Notice] Please input web directory:' webPath;
72+
[ "$webPath" == '' ] && InputWebPath;
73+
else
74+
echo '[OK] Your web directory is:' && echo $webPath;
75+
read -p '[Notice] This is your web directory? : (y/n)' confirmDM;
76+
if [ "$confirmDM" == 'n' ]; then
77+
webPath='';
78+
InputWebPath;
79+
elif [ "$confirmDM" != 'y' ]; then
80+
InputWebPath;
81+
fi;
82+
fi;
83+
[ -d "${webPath}/.svn/" ] && echo "[Error] ${webPath} is exist!" && webPath='' && InputWebPath;
84+
}
6585

6686
## 安装 SVN
6787
function InstallSVN()
6888
{
69-
70-
yum install subversion -y;
89+
[ $(rpm -qa subversion | wc -l) == "0" ] && yum install subversion -y;
7190

7291
svnadmin create ${projectPath};
7392

@@ -95,7 +114,7 @@ export LANG=en_US.UTF-8
95114
96115
REPOS="\$1"
97116
REV="\$2"
98-
WEB_PATH=/home/wwwroot/${project}
117+
WEB_PATH=${webPath}
99118
LOG_PATH=/tmp/svn_commit.log
100119
SVN_PATH=/usr/bin/svn
101120
SVN_REPOS=svn://localhost/repos/${project}
@@ -134,5 +153,6 @@ function InstallCompleted()
134153

135154
InputIP;
136155
InputName;
156+
InputWebPath;
137157
InstallSVN;
138158
InstallCompleted;

0 commit comments

Comments
 (0)