aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-05-29 22:55:19 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-05-29 22:55:19 -0300
commitc47363ad53fbe2795e4533a29478210923b6ec54 (patch)
tree18aeff66c4012a857f1589b5860a022a7e38d708
parentd0fe80d76297c7250e90ae0fdacf0cc5c27a3fce (diff)
downloadpuppet-bootstrap-c47363ad53fbe2795e4533a29478210923b6ec54.tar.gz
puppet-bootstrap-c47363ad53fbe2795e4533a29478210923b6ec54.tar.bz2
Module symlink support
-rw-r--r--Makefile3
-rw-r--r--README.md8
-rwxr-xr-xbin/symlinks24
3 files changed, 35 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index ce97036..2209271 100644
--- a/Makefile
+++ b/Makefile
@@ -32,6 +32,9 @@ submodules:
subtrees:
bin/subtrees
+symlinks:
+ bin/symlinks $(MODULES)
+
remote:
git remote add bootstrap $(REPO)
diff --git a/README.md b/README.md
index 1f1702a..67dad5f 100644
--- a/README.md
+++ b/README.md
@@ -28,3 +28,11 @@ This will be a `Vagrant` example:
ln -s puppet/Vagrantfile # or copy if you want to customize
( cd puppet && make modules ) # need the mr binary to download the submodules
vagrant up web # with no arguments, all defined VMs are started
+
+Using subtrees or symlinks for modules
+--------------------------------------
+
+You might use `make subtrees` instead of `make submodules`. Also, if you already have
+all the modules in a different subtree, use
+
+ make symlinks MODULES=/path/to/puppet/modules
diff --git a/bin/symlinks b/bin/symlinks
new file mode 100755
index 0000000..0a221c4
--- /dev/null
+++ b/bin/symlinks
@@ -0,0 +1,24 @@
+#!/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
+
+# Add module symlinks using absolute folders
+for module in `ls $MODULES`; do
+ if [ "$module" != "bootstrap" ]; then
+ path="`cd $MODULES/$module && pwd`"
+ ( cd modules &> /dev/null && ln -sf $path )
+ fi
+done