From cbc1885cf22182952d0a1b31779c89cff26decd4 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 24 Jun 2016 15:12:17 -0300 Subject: Support networks both with and without superprojects --- share/hydra/init | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'share/hydra/init') diff --git a/share/hydra/init b/share/hydra/init index 4a6d0c1..a69e885 100755 --- a/share/hydra/init +++ b/share/hydra/init @@ -38,20 +38,29 @@ fi # Clone configuration repository or setup a new hydra if [ ! -z "$REMOTE" ]; then - git clone $REMOTE $BASEDIR + mkdir -p $BASEDIR + + # Try to clone the superproject first + git clone $REMOTE $BASEDIR 2> /dev/null ( cd $BASEDIR # Initialize only the required repositories for repo in $BASEREPOS; do - git submodule update --init $repo + if [ -e '.gitmodules' ] && grep -q \"config\" .gitmodules; then + git submodule update --init $repo + else + git clone ${REMOTE}$repo `basename $repo .git` + fi done ) else # Create the superproject mkdir -p $BASEDIR - hydra_git_init $BASEDIR + + # Optional: version control in the superproject + #hydra_git_init $BASEDIR # Create config repository if [ ! -d "$BASEDIR/config" ]; then -- cgit v1.2.3