aboutsummaryrefslogtreecommitdiff
path: root/puppet/bin/syncmodules
blob: 1585aa477a0c07a5cae170366e390b15bcb98428 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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