]> gitweb.fluxo.info Git - puppet-bootstrap.git/commitdiff
Module symlink support
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 30 May 2014 01:55:19 +0000 (22:55 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 30 May 2014 01:55:19 +0000 (22:55 -0300)
Makefile
README.md
bin/symlinks [new file with mode: 0755]

index ce970360da6aa8d669acafb2655e03036836c4bf..220927120d52b422c309c43b8f0da644eb021880 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -32,6 +32,9 @@ submodules:
 subtrees:
        bin/subtrees
 
+symlinks:
+       bin/symlinks $(MODULES)
+
 remote:
        git remote add bootstrap $(REPO)
 
index 1f1702a726965c835315141f283e080aa855b4b2..67dad5fd0b5ed9ef1affb3bb879a8448d05f6908 100644 (file)
--- 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 (executable)
index 0000000..0a221c4
--- /dev/null
@@ -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