]> git.wh0rd.org Git - home.git/commitdiff
allow running in other repo dirs
authorMike Frysinger <vapier@gentoo.org>
Mon, 12 Mar 2012 20:05:35 +0000 (16:05 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sat, 28 Apr 2012 19:36:44 +0000 (15:36 -0400)
.bin/cros-repo

index d6c6de1bea169a09d59169eb2cd3b224a1d09561..6f51357dca675a3a7fbd499479220d630a2a0e79 100755 (executable)
@@ -1,9 +1,8 @@
 #!/bin/sh
-cd ~/chromiumos
 
 usage() {
        cat <<-EOF
-       Usage: repo-cros <command> [command opts]
+       Usage: repo-cros [dir] <command> [command opts]
 
        Commands:
           int            switch to internal tree
@@ -14,14 +13,26 @@ usage() {
 }
 [[ $# -eq 0 ]] && usage
 
-vexec() { echo "$@"; exec "$@"; }
+vexec() {
+       cd ${DIR:-~/chromiumos}
+       printf '%s\n%s\n' "${PWD}" "$*"
+       exec "$@"
+}
 
+DIR=
 while [[ $# -gt 0 ]] ; do
        case $1 in
        int) vexec repo init -u ssh://gerrit-int.chromium.org:29419/chromeos/manifest-internal.git --repo-url='http://git.chromium.org/external/repo.git' ;;
        ext) vexec repo init -u http://git.chromium.org/chromiumos/manifest.git --repo-url http://git.chromium.org/external/repo.git ;;
        -b)  vexec repo init -b $2 ;;
-       *) usage ;;
+       *)
+               if [[ -z ${DIR} ]] ; then
+                       DIR=$1
+               else
+                       usage
+               fi
+               ;;
        esac
+       shift
 done
 exit 0