#!/usr/bin/env bash # Stop in case of error set -e ########################### # Helpers functions ########################### # Print script help print_usage() { echo "Usage: $0 " echo echo " github_username: username on GitHub for which the EasyBuild repositories should be cloned" echo " Use 'easybuilders' if you don't want to use a fork" echo echo " install_dir: directory where all the EasyBuild files will be installed" echo } # Clone one branch github_clone_branch() { REPO="$1" BRANCH="$2" cd "${INSTALL_DIR}" echo "=== Cloning ${GITHUB_USERNAME}/${REPO} ..." git clone --branch "${BRANCH}" "git@github.com:${GITHUB_USERNAME}/${REPO}.git" if [[ $GITHUB_USERNAME != "easybuilders" ]]; then echo "=== Adding and fetching EasyBuilders GitHub repository @ easybuilders/${REPO} ..." cd "${REPO}" git remote add "github_easybuilders" "git@github.com:easybuilders/${REPO}.git" git fetch github_easybuilders git branch --set-upstream-to "github_easybuilders/${BRANCH}" "${BRANCH}" fi } # Print the content of the module print_devel_module() { cat < "${EB_DEVEL_MODULE}" echo echo "=== Run 'module use ${MODULES_INSTALL_DIR}' and 'module load ${EB_DEVEL_MODULE_NAME}' to use your development version of EasyBuild." echo "=== (you can append ${MODULES_INSTALL_DIR} to your MODULEPATH to make this module always available for loading)" echo echo "=== To update each repository, run 'git pull origin' in each subdirectory of ${INSTALL_DIR}" echo "=== Or run $(dirname "$0")/update-EasyBuild-develop.sh '${INSTALL_DIR}'" echo exit 0