提交 ed7f9f72 编写于 作者: W wenliang

q

上级 1e9d5660
#!/bin/bash
echo "[Git Branch Auto Download]"
# git_repository format : git@${git_address}:${git_group}/${git_project}.git
git_repository=git@codechina.csdn.net:codefast/toolchain.git
git_address=codechina.csdn.net
git_group=codefast
git_project=toolchain
git_branch_common=script
TEMP_DIR=TEMP_$(date "+%Y.%m.%d.%H.%M.%S")
mkdir -p ${TEMP_DIR}
cd ${TEMP_DIR}
echo "git_repository : git@${git_address}:${git_group}/${git_project}.git"
git init 1>log.txt 2>&1
git remote add origin git@${git_address}:${git_group}/${git_project}.git 1>log.txt 2>&1
git remote show origin > git_remote.log.txt
cat git_remote.log.txt | grep "gcc" > git_branch.log.txt
for argv in $*; do
cat git_branch.log.txt | grep "${argv} " > git_branch.log.txt.next
if [[ ! -s git_branch.log.txt.next ]] ; then
cat git_branch.log.txt | grep "${argv}" > git_branch.log.txt.next
fi
mv git_branch.log.txt.next git_branch.log.txt
done
git_branch=$(cat git_branch.log.txt | head -n 1)
git_branch=`echo ${git_branch}`
git_branch=${git_branch%% *}
echo "git_branch : ${git_branch}"
echo "wget_cmd : wget https://${git_address}/${git_group}/${git_project}/-/archive/${git_branch}/${git_project}-${git_branch}.tar.gz"
rm ${git_project}-${git_branch}.tar.gz 1>log.txt 2>&1
wget https://${git_address}/${git_group}/${git_project}/-/archive/${git_branch}/${git_project}-${git_branch}.tar.gz -q --show-progress
tar zxf ${git_project}-${git_branch}.tar.gz
wget https://${git_address}/${git_group}/${git_project}/-/archive/${git_branch_common}/${git_project}-${git_branch_common}.tar.gz -q --show-progress
tar zxf ${git_project}-${git_branch_common}.tar.gz
rm toolchain-${git_branch_common}/README.md
rm -rf ../${git_branch}
mkdir -p ../${git_branch}
mv toolchain-${git_branch}/* ../${git_branch}/
mv toolchain-${git_branch_common}/* ../${git_branch}/
cd ..
rm -rf ./${TEMP_DIR}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册