blob: 79602266550820ec4e4d822dca304eb9b11bb8cd [file] [log] [blame]
garciadeblas7942e282017-07-13 15:45:28 +02001#!/bin/bash
2if [ $# -lt 1 -o $# -gt 2 ]; then
3 echo "Usage $0 <repo> [<branch>]"
4 exit 1
5fi
6
7BRANCH="master"
8if [ $# -ge 2 ]; then
9 BRANCH=$2
10fi
11
12modules="juju-charms devops descriptor-packages openvim RO SO UI osmclient"
13list=""
14for i in $modules; do
15 if [ "$1" == "$i" -o "$1" == "all" ]; then
16 list="$1"
17 break
18 fi
19done
20
21[ "$1" == "all" ] && list=$modules
22
23if [ "$1" == "juju-charms" ] && [ "$BRANCH" != "master" ]; then
24 echo "Repo $1 does not have branch $BRANCH"
25 exit 1
26fi
27
28if [ -z "$list" ]; then
29 echo "Repo must be one of these: $modules all"
30 exit 1
31fi
32
33for 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
44done
45
46exit 0
47