aboutsummaryrefslogtreecommitdiff
path: root/puppet/bin/syncmodules
diff options
context:
space:
mode:
Diffstat (limited to 'puppet/bin/syncmodules')
-rwxr-xr-xpuppet/bin/syncmodules37
1 files changed, 37 insertions, 0 deletions
diff --git a/puppet/bin/syncmodules b/puppet/bin/syncmodules
new file mode 100755
index 0000000..1585aa4
--- /dev/null
+++ b/puppet/bin/syncmodules
@@ -0,0 +1,37 @@
+#!/bin/bash
+#
+# Setup symlinks.
+#
+
+# Parameters
+BASENAME="`basename $0`"
+MODULES="$1"
+
+# Check parameters
+if [ -z "$MODULES" ]; then
+ echo "Usage: $BASENAME <submodules-folder>"
+ exit 1
+elif [ ! -e "$MODULES" ]; then
+ echo "Not found: $MODULES"
+fi
+
+# Set puppet folder
+if [ -d "puppet" ]; then
+ PUPPET_FOLDER="puppet"
+else
+ PUPPET_FOLDER="."
+fi
+
+# Add module symlinks using absolute folders
+for module in `ls $MODULES`; do
+ if [ "$module" == "bootstrap" ]; then
+ continue
+ fi
+
+ if echo "$module" | grep -q "^site_"; then
+ continue
+ fi
+
+ path="`cd $MODULES/$module && pwd`"
+ ( cd $PUPPET_FOLDER/modules &> /dev/null && rsync -av --delete $path/ $module/ )
+done