X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=utils%2Finfra_setup%2Fvm_dev_setup%2Fsetup_env.sh;h=db280e7708a79259f9baeb30a7611df7ec17dc09;hb=2d9642a33a6a58f53aceba4ff3d6242f191f25f0;hp=1ddab5de2c6c4ccaa0fda960fee50fe9dcfdc5fd;hpb=d519fff9ff4adaece9e3cc221800169602f58fec;p=bottlenecks.git diff --git a/utils/infra_setup/vm_dev_setup/setup_env.sh b/utils/infra_setup/vm_dev_setup/setup_env.sh index 1ddab5de..db280e77 100755 --- a/utils/infra_setup/vm_dev_setup/setup_env.sh +++ b/utils/infra_setup/vm_dev_setup/setup_env.sh @@ -1,4 +1,12 @@ #!/bin/bash +############################################################################## +# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## set -x @@ -53,13 +61,13 @@ bottlenecks_prepare_env() git_checkout() { - if git cat-file -e $1^{commit} 2>/dev/null; then + if sudo git cat-file -e $1^{commit} 2>/dev/null; then # branch, tag or sha1 object - git checkout $1 + sudo git checkout $1 else # refspec / changeset - git fetch --tags --progress $2 $1 - git checkout FETCH_HEAD + sudo git fetch --tags --progress $2 $1 + sudo git checkout FETCH_HEAD fi } @@ -69,10 +77,10 @@ bottlenecks_download_repo() sudo git config --global http.sslVerify false if [ ! -d $BOTTLENECKS_REPO_DIR ]; then - git clone $BOTTLENECKS_REPO $BOTTLENECKS_REPO_DIR + sudo git clone $BOTTLENECKS_REPO $BOTTLENECKS_REPO_DIR fi cd $BOTTLENECKS_REPO_DIR - git checkout master && git pull + sudo git checkout master && sudo git pull git_checkout $BOTTLENECKS_BRANCH $BOTTLENECKS_REPO cd - }