diff --git a/func.sh b/func.sh index 3946bb5..c034e53 100644 --- a/func.sh +++ b/func.sh @@ -6,10 +6,20 @@ function sub_akt() { new_sub_url="$2" pro_be_cut=${new_sub_url##*/} sub_name=${pro_be_cut::-4} - echo "git checkout $1" - echo "git submodule set-url $sub_name $new_sub_url" - echo "git submodule update --init --recursive --remote $sub_name" - echo "git add .gitmodules" - echo "git commit -m 'Submodul aktualisiert'" - echo "git push" + old_sub_path="" + #echo "git checkout $1" + i=0 + for path_check in $(git config --file=.gitmodules --get-regexp path|awk '{print $2}'); do + new_sub_path="$3" + if [ $path_check = $new_sub_path ]; then + echo "$path_check = $new_sub_path" + #echo "git submodule set-url $sub_name $new_sub_url" + #echo "git submodule update --init --recursive --remote $sub_name" + #echo "git add .gitmodules" + #echo "git commit -m 'Submodul aktualisiert'" + #echo "git push" + else + echo "keine übereinstimmung" + fi + done } \ No newline at end of file diff --git a/main.sh b/main.sh index 6d56eed..c0d2b16 100755 --- a/main.sh +++ b/main.sh @@ -13,7 +13,7 @@ if [ ! -d $clone_work_dir ] else echo "ERROR - $(date '+%Y-%m-%d %H:%M:%S') - $clone_work_dir konnte NICHT angelgt werden ERROR "; fi fi -while IFS="," read -r git_url new_sub_url +while IFS="," read -r git_url new_sub_url new_sub_path do pro_be_cut=${git_url##*/} project_name=${pro_be_cut::-4} @@ -30,8 +30,8 @@ do for branch in $(git for-each-ref --format='%(refname)' refs/heads/) do git_pro_branch="${branch/'refs/heads/'/''}" - echo "$project_name as $git_pro_branch" - sub_akt $git_pro_branch $new_sub_url + #echo "$project_name as $git_pro_branch" + sub_akt $git_pro_branch $new_sub_url $new_sub_path if [ $? -eq 0 ]; then echo "INFO - $(date '+%Y-%m-%d %H:%M:%S') - konnte $new_sub_url auf $git_pro_branch aktualisieren" >> $logfile else echo "ERROR - $(date '+%Y-%m-%d %H:%M:%S') - konnte NICHT $new_sub_url auf $git_pro_branch aktualisieren "; fi diff --git a/project.csv b/project.csv index 132e6a2..380bc64 100644 --- a/project.csv +++ b/project.csv @@ -1,3 +1,4 @@ -git_url,new_sub_url, -https://gitea.schlaubistechtalk.de/t4m/docker_gitlab.git, https://gitea.schlaubistechtalk.de/t4m/win_ps_hidden_files.git, -https://gitea.schlaubistechtalk.de/t4m/win_ps_hidden_files.git,https://gitea.schlaubistechtalk.de/t4m/docker_gitlab.git, +git_url,new_sub_url,new_sub_path, +https://gitea.schlaubistechtalk.de/t4m/docker_gitlab.git, https://gitea.schlaubistechtalk.de/t4m/win_ps_hidden_files.git,test_folder, +https://gitea.schlaubistechtalk.de/t4m/win_ps_hidden_files.git,https://gitea.schlaubistechtalk.de/t4m/docker_gitlab.git,test_folder, +ssh://git@gitea.schlaubistechtalk.de:2222/JonnyBravo/test_module.git,https://gitea.schlaubistechtalk.de/t4m/win_ps_hidden_files.git,test_folder,