项目运维 shell

/ shell / 0 条评论 / 675浏览

#!/bin/bash
baseDir=$(pwd `dirname "$0"`)
projectKey=$1
projectLowerKey=`echo $1|  tr 'A-Z' 'a-z'`
modules=${3:-"NQMDM WORKBENCH"}

######
#
# sh addProj.sh JDF 53 
# sh addProj.sh JDF 53 "NQMDM WORKBENCH"
# 53|531|532|533
# NQMDM | NQMDM WORKBENCH | WORKBENCH
#
######
if [ -e $baseDir/$projectKey ];then
   echo "项目目录已存在"
   echo $projectLowerKey
   exit 0
else
   mkdir $baseDir/$projectKey
fi

#库
cd ./$projectKey
for mod in $modules
do
    dirlower=`echo $mod|  tr 'A-Z' 'a-z'`
    git clone http://192.168.22.67:7990/scm/$projectLowerKey/$dirlower.git $mod
done

#编译脚本
if [[ $modules =~ "NativeConsole" ]];then
   cp ../NativeConsole$2/{build_all.sh,NativeConsole_version} .
else
   cp ../WORKBENCH$2/{build_all.sh,WORKBENCH_version} .
fi