]> git.wh0rd.org Git - home.git/blob - .bin/cros-repo
allow running in other repo dirs
[home.git] / .bin / cros-repo
1 #!/bin/sh
2
3 usage() {
4         cat <<-EOF
5         Usage: repo-cros [dir] <command> [command opts]
6
7         Commands:
8            int            switch to internal tree
9            ext            switch to external tree
10            -b <branch>    switch branches
11         EOF
12         exit ${1:-1}
13 }
14 [[ $# -eq 0 ]] && usage
15
16 vexec() {
17         cd ${DIR:-~/chromiumos}
18         printf '%s\n%s\n' "${PWD}" "$*"
19         exec "$@"
20 }
21
22 DIR=
23 while [[ $# -gt 0 ]] ; do
24         case $1 in
25         int) vexec repo init -u ssh://gerrit-int.chromium.org:29419/chromeos/manifest-internal.git --repo-url='http://git.chromium.org/external/repo.git' ;;
26         ext) vexec repo init -u http://git.chromium.org/chromiumos/manifest.git --repo-url http://git.chromium.org/external/repo.git ;;
27         -b)  vexec repo init -b $2 ;;
28         *)
29                 if [[ -z ${DIR} ]] ; then
30                         DIR=$1
31                 else
32                         usage
33                 fi
34                 ;;
35         esac
36         shift
37 done
38 exit 0