| OLD | NEW |
| 1 #!/bin/bash -p | 1 #!/bin/bash -p |
| 2 | 2 |
| 3 # Copyright (c) 2010 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. |
| 11 # | 11 # |
| 12 # dirpatcher performs the inverse operation to dirdiffer. For more details, | 12 # dirpatcher performs the inverse operation to dirdiffer. For more details, |
| 13 # consult dirdiffer.sh. | 13 # consult dirdiffer.sh. |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 else | 276 else |
| 277 patch_file "${old_file}" "${patch_file}" "${new_file}" | 277 patch_file "${old_file}" "${patch_file}" "${new_file}" |
| 278 fi | 278 fi |
| 279 done | 279 done |
| 280 | 280 |
| 281 copy_mode_and_time "${patch_dir}" "${new_dir}" | 281 copy_mode_and_time "${patch_dir}" "${new_dir}" |
| 282 } | 282 } |
| 283 | 283 |
| 284 # shell_safe_path ensures that |path| is safe to pass to tools as a | 284 # shell_safe_path ensures that |path| is safe to pass to tools as a |
| 285 # command-line argument. If the first character in |path| is "-", "./" is | 285 # command-line argument. If the first character in |path| is "-", "./" is |
| 286 # prepended to it. The possibily-modified |path| is output. | 286 # prepended to it. The possibly-modified |path| is output. |
| 287 shell_safe_path() { | 287 shell_safe_path() { |
| 288 local path="${1}" | 288 local path="${1}" |
| 289 if [[ "${path:0:1}" = "-" ]]; then | 289 if [[ "${path:0:1}" = "-" ]]; then |
| 290 echo "./${path}" | 290 echo "./${path}" |
| 291 else | 291 else |
| 292 echo "${path}" | 292 echo "${path}" |
| 293 fi | 293 fi |
| 294 } | 294 } |
| 295 | 295 |
| 296 dirs_contained() { | 296 dirs_contained() { |
| (...skipping 62 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 |