cipd_bin_setup.sh 922 B

1234567891011121314151617181920212223242526272829303132
  1. # Copyright 2017 The Chromium Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. function cipd_bin_setup {
  5. local MYPATH="${DEPOT_TOOLS_DIR:-$(dirname "${BASH_SOURCE[0]}")}"
  6. local ENSURE="$MYPATH/cipd_manifest.txt"
  7. local ROOT="$MYPATH/.cipd_bin"
  8. UNAME="${DEPOT_TOOLS_UNAME_S:-$(uname -s | tr '[:upper:]' '[:lower:]')}"
  9. case $UNAME in
  10. cygwin*)
  11. ENSURE="$(cygpath -w $ENSURE)"
  12. ROOT="$(cygpath -w $ROOT)"
  13. ;;
  14. esac
  15. # value in .cipd_client_root file overrides the default root.
  16. CIPD_ROOT_OVERRIDE_FILE="${MYPATH}/.cipd_client_root"
  17. if [ -f "${CIPD_ROOT_OVERRIDE_FILE}" ]; then
  18. ROOT=$(<"${CIPD_ROOT_OVERRIDE_FILE}")
  19. fi
  20. (
  21. source "$MYPATH/cipd" ensure \
  22. -log-level warning \
  23. -ensure-file "$ENSURE" \
  24. -root "$ROOT"
  25. )
  26. echo $ROOT
  27. }