Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
checkout_shallow_copy_lofar_repos.sh 1.34 KiB
#! /usr/bin/env bash

# Clean out local dirs and then clone a shallow copy
# of LOFAR2.0 repos.

# 2020-10-13, thomas
# Currently correct.
astron_gitlab=https://git.astron.nl/
repo_dir=lofar2.0/
branch=master

for repo in lmc-base-classes ska-logging ska-docker opcua tango pypcc; do
    cd ${repo}
    # This will return 2 if the repo is clean.
    clean="$(git status -u | wc -l)"
    cd -
    if [ "${clean}" = "2" ]; then
        # The repo is clean, no new files, no modifications.
        rm -rf ${repo}
        git clone --depth 1 --branch ${branch} ${astron_gitlab}${repo_dir}${repo}.git
    else
        echo -e "*********\n\tThe repository ${repo} contains modifications.\n\tRestore the original content first before continuing.\nAborting now.\n"
        exit -1
    fi
done

# 2020-10-13, thomas
# I need to move this repo to lofar2.0.
repo=crossecho
repo_dir=jurges
rm -rf crossecho && git clone --depth 1 --branch add_simulation_mode_plus_patches ${astron_gitlab}${repo_dir}/${repo}.git

if [ ! -s ska_logging -o $(readlink ska_logging) != ska-logging ]; then
    echo "Creating symlink ska-logging -> ska_logging"
    rm -f ska_logging
    ln -s ska-logging ska_logging
fi

if [ ! -s skabase -o $(readlink skabase) != lmc-base-classes ]; then
    echo "Creating symlink lmc-base-classes -> skabase"
    rm -f skabase
    ln -s lmc-base-classes skabase
fi