diff --git a/Bot-Utils b/Bot-Utils index 1a33d2e..0231d80 160000 --- a/Bot-Utils +++ b/Bot-Utils @@ -1 +1 @@ -Subproject commit 1a33d2ef0aac95249c70f508c0957f3cdd34a238 +Subproject commit 0231d800ef46b13fd9b3466e3ef5e79689b24c0a diff --git a/Utils b/Utils index b4e1797..a5249f8 160000 --- a/Utils +++ b/Utils @@ -1 +1 @@ -Subproject commit b4e17972b9e8980bd41a45504ae8e37bc42b60c4 +Subproject commit a5249f8faccf854ff1b5979f3f0a0ebb36c3e7c0 diff --git a/update.sh b/update.sh index 69da820..79eb7d3 100644 --- a/update.sh +++ b/update.sh @@ -1,19 +1,38 @@ +#!/bin/bash + function look_for_update() { - if [[ $1 == ./.* ]] || [[ $1 == "." ]]; then - return - fi - printf -v quotedFile '%q' "$1" - if [[ -f $quotedFile/update.sh ]]; then - echo "Switch to subdir $1 and run update.sh" - cd "$1" - bash -c ./update.sh - else - echo "Pull $quotedFile" - cd "$1" - git pull + if [[ $1 == ./.git ]] || [[ $1 == "." ]]; then + echo "Ignore $1" + return + fi + WithoutPrefix=$(echo -n $1 | cut -c 2-) + if grep -qx "$WithoutPrefix" .gitignore; then + echo "Ignore $1, because it's in .gitignore" + return + fi + printf -v FolderNameEscaped '%q' "$1" + if [[ -f $1/update.sh ]]; then + echo "Switch to subdir $1 and run update.sh" + cd "$1" + bash -c "./update.sh nobreak" + else + if [[ -f $1/.git ]] + then + echo "Pull $1" + cd "$1" + git pull + else + echo "Checkout master for $1" + git submodule update --init -- "$1" + cd "$1" + git checkout master + fi fi } export -f look_for_update find . -maxdepth 1 -type d -exec bash -c 'look_for_update "$0"' {} \; -read -p "Press return" \ No newline at end of file + +if [ -z $1 ]; then + read -p "Press return" +fi \ No newline at end of file