| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | CI_QUIET=1 |
| 4 | |
| 5 | set +x |
| 6 | |
| 7 | ci_dir="$(dirname "$0")" |
| 8 | . "${ci_dir}/scripts/ci-common.sh" |
| 9 | |
| 10 | # [git_update <project>] will update the git repository associated to <project> |
| 11 | git_update() |
| 12 | { |
| 13 | local project=$1 |
| 14 | local dest="${CI_BUILD_DIR}/$project" |
| 15 | |
| 16 | echo "Updating $project..." |
| 17 | |
| 18 | if [ ! -d "$dest" ]; then |
| 19 | echo "Warning: update of $project skipped because $dest does not exist." |
| 20 | else |
| 21 | pushd "$dest" > /dev/null |
| 22 | git remote update > /dev/null |
| 23 | popd > /dev/null |
| 24 | fi |
| 25 | } |
| 26 | |
| 27 | git_update_all() { |
| 28 | for project in "${projects[@]}"; do |
| 29 | if [ -d "${CI_BUILD_DIR}/$project" ]; then |
| 30 | git_update $project |
| 31 | fi |
| 32 | done |
| 33 | } |
| 34 | |
| 35 | if [ -n "$1" ]; then |
| 36 | git_update "$1" |
| 37 | else |
| 38 | git_update_all |
| 39 | fi |