Add integration between pol and mysql charms
[osm/devops.git] / tools / update.sh
1 #!/bin/bash
2 if [ $# -lt 1 -o $# -gt 2 ]; then
3 echo "Usage $0 <repo> [<branch>]"
4 exit 1
5 fi
6
7 BRANCH="master"
8 if [ $# -ge 2 ]; then
9 BRANCH=$2
10 fi
11
12 modules="juju-charms devops descriptor-packages openvim RO SO UI osmclient IM N2VC MON vim-emu"
13 list=""
14 for i in $modules; do
15 if [ "$1" == "$i" -o "$1" == "all" ]; then
16 list="$1"
17 break
18 fi
19 done
20
21 [ "$1" == "all" ] && list=$modules
22
23 if [ "$1" == "juju-charms" ] && [ "$BRANCH" != "master" ]; then
24 echo "Repo $1 does not have branch $BRANCH"
25 exit 1
26 fi
27
28 if [ -z "$list" ]; then
29 echo "Repo must be one of these: $modules all"
30 exit 1
31 fi
32
33 for i in $list; do
34 echo
35 echo $i
36 git -C $i fetch
37 if [ "$i" == "juju-charms" ] && [ "$1" == "all" ] ; then
38 #This is to allow "./update.sh all v2.0", and still update "juju-charms" with master
39 git -C $i checkout master
40 else
41 git -C $i checkout $BRANCH
42 fi
43 git -C $i pull --rebase
44 done
45
46 exit 0
47