From c154a1076a6145a28133e9417d842310335d6805 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 28 Feb 2014 19:26:55 -0300 Subject: New submodule scheme --- bin/mrconfig | 29 +++++++++++++++++++++++++++++ bin/submodules | 27 +++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100755 bin/mrconfig create mode 100755 bin/submodules (limited to 'bin') diff --git a/bin/mrconfig b/bin/mrconfig new file mode 100755 index 0000000..ffb0438 --- /dev/null +++ b/bin/mrconfig @@ -0,0 +1,29 @@ +#!/bin/bash +# +# Build a mrconfig for the needed modules. +# + +# Parameters +GIT="git.sarava.org" +URL="https://$GIT/?a=project_index" +CWD="`pwd`" +WORK="`dirname $0`/.." + +# Create a new config +cd $WORK +rm -f .mrconfig +touch .mrconfig + +# Fetch repository list and updtate mrconfig +curl --stderr - $URL | grep "^puppet-" | while read module; do + folder="`echo $module | sed -e 's/^puppet-//'`" + folder="`basename $folder .git`" + + if [ "$module" != "$bootstrap" ]; + echo "Processing $folder..." + mr config puppet/modules/$folder checkout="git clone git://$GIT/$module $folder" + fi +done + +# Teardown +cd $CWD diff --git a/bin/submodules b/bin/submodules new file mode 100755 index 0000000..c33e74e --- /dev/null +++ b/bin/submodules @@ -0,0 +1,27 @@ +#!/bin/bash +# +# Setup submodules. +# + +# Parameters +DIRNAME="`dirname $0`" + +# Usage +function usage { + echo "Usage: $1 add-submodules " + exit $2 +} + +# Get module list +repos="`grep = $DIRNAME/../.mrconfig | cut -d = -f 2 | cut -d ' ' -f 4`" + +# Add submodules +for repo in $repos; do + module="`basename $repo .git | sed -e s/^puppet-//`" + if [ ! -d "modules/$module" ]; then + git submodule add $repo modules/$module + fi +done + +# Update all modules +git submodule update --init -- cgit v1.2.3