aboutsummaryrefslogtreecommitdiff
path: root/templates/bin/puppet-bootstrap
blob: b2b8eca7ab737fa656ecb5774aa14f616212f845 (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
#!/bin/bash

function usage {
  echo "Usage: $1 add-submodules <DIR>"
  exit $2
}

function add_submodules {
  cd $1
  git init
  git add .
  mkdir -p ./modules
  
  repos="`lynx -dump http://git.sarava.org/?a=project_index | awk '{ print $1 }' | grep ^puppet-`"
  for repo in $repos; do
    module="`basename $repo .git | sed -e s/^puppet-//`"
    if [ ! -d "modules/$module" ]; then
      git submodule add git://git.sarava.org/puppet-$module.git modules/$module
    fi
  done

  git submodule update --init
}

if [ $# -ne 2 ]; then
  usage $0 1
  exit 1
fi

case $1 in
  add-submodules) add_submodules $2;;
  help) usage $0 0 ;;
  *) usage $0 1; exit 1 ;;
esac