#!/bin/sh downloadrepos() { github_repo="$1"; shift branch="$1"; shift wget --quiet --output-document - \ $github_repo/archive/${branch}.tar.gz | tar xz } downloadgithubrepos() { owner_and_repo_name="$1"; shift repo_owner="`echo "$owner_and_repo_name" | sed "s@/.*\\$@@g"`" repo_name="`echo "$owner_and_repo_name" | sed "s@^.*/@@g"`" repo_branch="$1"; shift set -x # clean up other previously downloaded branches of the same repo as well rm -rf ${repo_name}-* ls | grep $repo_name downloadrepos https://github.com/$repo_owner/$repo_name "$repo_branch" ls | grep $repo_name set +x } . ./default_build_params if [ -z "$1" ]; then downloadgithubrepos $PAVICS_SDI_REPO $PAVICS_SDI_BRANCH downloadgithubrepos $FINCH_REPO $FINCH_BRANCH downloadgithubrepos $PAVICS_LANDING_REPO $PAVICS_LANDING_BRANCH downloadgithubrepos $RAVEN_REPO $RAVEN_BRANCH downloadgithubrepos $RAVENPY_REPO $RAVENPY_BRANCH downloadgithubrepos $ESGF_COMPUTE_API_REPO $ESGF_COMPUTE_API_BRANCH else set -x downloadrepos "$@" fi