diff --git a/download_toolchain.sh b/download_toolchain.sh index 1556c56410bbef3a25258db97c5e3a2f5dbd2bdd..85488825c22fe409c882bdb935fd621eb1e83fd5 100755 --- a/download_toolchain.sh +++ b/download_toolchain.sh @@ -65,7 +65,7 @@ function SHELL_FUNCTION_PASER(){ fi done } -function SHELL_FUNCTION_KERNAL(){ +function SHELL_FUNCTION_KERNAL_WGET(){ #echo "git_repository (git) : ${git_repository_git}" echo "git_repository (https) : ${git_repository_https}" @@ -115,6 +115,54 @@ function SHELL_FUNCTION_KERNAL(){ return } +function SHELL_FUNCTION_KERNAL_GIT_CLONE(){ + #echo "git_repository (git) : ${git_repository_git}" + echo "git_repository (https) : ${git_repository_https}" + + git init 1>log.txt 2>&1 + + git remote add origin ${git_repository_address} 1>log.txt 2>&1 + + git remote show origin > git_remote.log.txt + + cat git_remote.log.txt | grep "gcc" | sed -e 's/^[ ]*//g' | cut -d ' ' -f 1 > git_branch.log.txt + + if [ ${SHELL_OPTIONS_LIST} ]; then + echo "[git branch list]" + cat -n git_branch.log.txt + return + fi + + 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 "git_cmd : git clone ${git_repository_https} --depth 2 -b ${git_branch}" + + git clone ${git_repository_https} --quiet --depth 1 -b ${git_branch} + mv ${git_project} toolchain-${git_branch} + + git clone ${git_repository_https} --quiet --depth 1 -b ${git_branch_common} + mv ${git_project} toolchain-${git_branch_common} + + rm -rf ../${git_branch} + mkdir -p ../${git_branch} + mv toolchain-${git_branch}/* ../${git_branch}/ + mv toolchain-${git_branch_common}/* ../${git_branch}/ + + return +} SHELL_FUNCTION_PASER $* if [ ${SHELL_OPTIONS_HELP} ]; then @@ -123,7 +171,7 @@ else TEMP_DIR=TEMP_$(date "+%Y.%m.%d.%H.%M.%S") mkdir -p ${TEMP_DIR} cd ${TEMP_DIR} - SHELL_FUNCTION_KERNAL $* + SHELL_FUNCTION_KERNAL_GIT_CLONE $* cd .. rm -rf ./${TEMP_DIR} fi \ No newline at end of file