aboutsummaryrefslogtreecommitdiff
path: root/bin/submodules
diff options
context:
space:
mode:
Diffstat (limited to 'bin/submodules')
-rwxr-xr-xbin/submodules13
1 files changed, 10 insertions, 3 deletions
diff --git a/bin/submodules b/bin/submodules
index 3abc46d..960d290 100755
--- a/bin/submodules
+++ b/bin/submodules
@@ -12,18 +12,25 @@ function usage {
exit $2
}
+# Set puppet folder
+if [ -d "puppet" ]; then
+ PUPPET_FOLDER="puppet"
+else
+ PUPPET_FOLDER="."
+fi
+
# 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
+ if [ ! -d "$PUPPET_FOLDER/modules/$module" ]; then
echo "Processing puppet module $module..."
- git submodule add -f $repo modules/$module
+ git submodule add -f $repo $PUPPET_FOLDER/modules/$module
elif [ -e "modules/$module/.git" ]; then
# The puppet module exists and is a git submodule, so update it
- ( cd module/$module && git pull origin master )
+ ( cd $PUPPET_FOLDER/modules/$module && git pull origin master )
fi
done