OLD | NEW |
---|---|
1 #!/bin/bash -p | 1 #!/bin/bash -p |
2 | 2 |
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # usage: dirpatcher.sh old_dir patch_dir new_dir | 7 # usage: dirpatcher.sh old_dir patch_dir new_dir |
8 # | 8 # |
9 # dirpatcher creates new_dir from patch_dir by decompressing and copying | 9 # dirpatcher creates new_dir from patch_dir by decompressing and copying |
10 # files, and using goobspatch to apply binary diffs to files in old_dir. | 10 # files, and using goobspatch to apply binary diffs to files in old_dir. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 # unset, only unexported. | 42 # unset, only unexported. |
43 export PATH="/usr/bin:/bin:/usr/sbin:/sbin" | 43 export PATH="/usr/bin:/bin:/usr/sbin:/sbin" |
44 unset BASH_ENV CDPATH ENV GLOBIGNORE IFS POSIXLY_CORRECT | 44 unset BASH_ENV CDPATH ENV GLOBIGNORE IFS POSIXLY_CORRECT |
45 export -n SHELLOPTS | 45 export -n SHELLOPTS |
46 | 46 |
47 shopt -s dotglob nullglob | 47 shopt -s dotglob nullglob |
48 | 48 |
49 # find_tool looks for an executable file named |tool_name|: | 49 # find_tool looks for an executable file named |tool_name|: |
50 # - in the same directory as this script, | 50 # - in the same directory as this script, |
51 # - if this script is located in a Chromium source tree, at the expected | 51 # - if this script is located in a Chromium source tree, at the expected |
52 # Release output location in the Mac xcodebuild directory, | 52 # Release output location in the Mac out directory, |
53 # - as above, but in the Debug output location | 53 # - as above, but in the Debug output location |
54 # If found in any of the above locations, the script's path is output. | 54 # If found in any of the above locations, the script's path is output. |
55 # Otherwise, this function outputs |tool_name| as a fallback, allowing it to | 55 # Otherwise, this function outputs |tool_name| as a fallback, allowing it to |
56 # be found (or not) by an ordinary ${PATH} search. | 56 # be found (or not) by an ordinary ${PATH} search. |
57 find_tool() { | 57 find_tool() { |
58 local tool_name="${1}" | 58 local tool_name="${1}" |
59 | 59 |
60 local script_dir | 60 local script_dir |
61 script_dir="$(dirname "${0}")" | 61 script_dir="$(dirname "${0}")" |
62 | 62 |
63 local tool="${script_dir}/${tool_name}" | 63 local tool="${script_dir}/${tool_name}" |
64 if [[ -f "${tool}" ]] && [[ -x "${tool}" ]]; then | 64 if [[ -f "${tool}" ]] && [[ -x "${tool}" ]]; then |
65 echo "${tool}" | 65 echo "${tool}" |
66 return | 66 return |
67 fi | 67 fi |
68 | 68 |
69 local script_dir_phys | 69 local script_dir_phys |
70 script_dir_phys="$(cd "${script_dir}" && pwd -P)" | 70 script_dir_phys="$(cd "${script_dir}" && pwd -P)" |
71 if [[ "${script_dir_phys}" =~ ^(.*)/src/chrome/installer/mac$ ]]; then | 71 if [[ "${script_dir_phys}" =~ ^(.*)/src/chrome/installer/mac$ ]]; then |
72 tool="${BASH_REMATCH[1]}/src/xcodebuild/Release/${tool_name}" | 72 tool="${BASH_REMATCH[1]}/src/out/Release/${tool_name}" |
Mark Mentovai
2013/10/25 12:58:19
Same here.
| |
73 if [[ -f "${tool}" ]] && [[ -x "${tool}" ]]; then | 73 if [[ -f "${tool}" ]] && [[ -x "${tool}" ]]; then |
74 echo "${tool}" | 74 echo "${tool}" |
75 return | 75 return |
76 fi | 76 fi |
77 | 77 |
78 tool="${BASH_REMATCH[1]}/src/xcodebuild/Debug/${tool_name}" | 78 tool="${BASH_REMATCH[1]}/src/out/Debug/${tool_name}" |
79 if [[ -f "${tool}" ]] && [[ -x "${tool}" ]]; then | 79 if [[ -f "${tool}" ]] && [[ -x "${tool}" ]]; then |
80 echo "${tool}" | 80 echo "${tool}" |
81 return | 81 return |
82 fi | 82 fi |
83 fi | 83 fi |
84 | 84 |
85 echo "${tool_name}" | 85 echo "${tool_name}" |
86 } | 86 } |
87 | 87 |
88 ME="$(basename "${0}")" | 88 ME="$(basename "${0}")" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
359 trap - EXIT | 359 trap - EXIT |
360 } | 360 } |
361 | 361 |
362 if [[ ${#} -ne 3 ]]; then | 362 if [[ ${#} -ne 3 ]]; then |
363 usage | 363 usage |
364 exit 2 | 364 exit 2 |
365 fi | 365 fi |
366 | 366 |
367 main "${@}" | 367 main "${@}" |
368 exit ${?} | 368 exit ${?} |
OLD | NEW |