diff --git a/bin/update_repos b/bin/update_repos index fe01dac..4762124 100755 --- a/bin/update_repos +++ b/bin/update_repos @@ -12,20 +12,29 @@ fi GITHUBUSER=aquatix REPOS="dotfiles ns-api" +for GROUP in $GROUPS; do + if [ ! -e $GROUP ]; then + mkdir $WORKSPACE/$GROUP + fi + for REPO in $REPOS; do - cd $WORKSPACE/github - if [ -e $REPO ]; then - cd $REPO + cd $WORKSPACE/$GROUP + REPODIR=$(basename "$REPO") + #extension="${filename##*.}" + REPODIR="${REPODIR%.*}" + if [ -e $REPODIR ]; then + cd $REPODIR #git diff --quiet || echo "[c] skipping" git diff --quiet if [ $? > 0 ]; then - echo -e "[\e[31mX\e[0m] $REPO changed - $WORKSPACE/github/$REPO" + echo -e "[\e[31mX\e[0m] $GROUP/$REPODIR changed - $WORKSPACE/$GROUP/$REPO" else - echo -e "[\e[32mU\e[0m] $REPO" + echo -e "[\e[32mU\e[0m] $GROUP/$REPODIR" #git pull fi else #git clone $REPO - echo -e "[\e[33mC\e[0m] $REPO" + echo -e "[\e[33mC\e[0m] $GROUP/$REPODIR" fi done +done