| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 # Common constants for build scripts | 5 # Common constants for build scripts |
| 6 # This must evaluate properly for both /bin/bash and /bin/sh | 6 # This must evaluate properly for both /bin/bash and /bin/sh |
| 7 | 7 |
| 8 # All scripts should die on error unless commands are specifically excepted | 8 # All scripts should die on error unless commands are specifically excepted |
| 9 # by prefixing with '!' or surrounded by 'set +e' / 'set -e'. | 9 # by prefixing with '!' or surrounded by 'set +e' / 'set -e'. |
| 10 # TODO: Re-enable this once shflags is less prone to dying. | 10 # TODO: Re-enable this once shflags is less prone to dying. |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 | 422 |
| 423 # Setup var symlink. | 423 # Setup var symlink. |
| 424 if [ -h "${dev_image_root}/var" ]; then | 424 if [ -h "${dev_image_root}/var" ]; then |
| 425 sudo unlink "${dev_image_root}/var" | 425 sudo unlink "${dev_image_root}/var" |
| 426 elif [ -e "${dev_image_root}/var" ]; then | 426 elif [ -e "${dev_image_root}/var" ]; then |
| 427 die "${dev_image_root}/var should be a symlink if it exists" | 427 die "${dev_image_root}/var should be a symlink if it exists" |
| 428 fi | 428 fi |
| 429 | 429 |
| 430 sudo ln -s "${var_target}" "${dev_image_root}/var" | 430 sudo ln -s "${var_target}" "${dev_image_root}/var" |
| 431 } | 431 } |
| 432 |
| 433 # Get current timestamp. Assumes common.sh runs at startup. |
| 434 start_time=$(date +%s) |
| 435 |
| 436 # Print time elsapsed since start_time. |
| 437 print_time_elapsed() { |
| 438 end_time=$(date +%s) |
| 439 elapsed_seconds="$(( $end_time - $start_time ))" |
| 440 minutes="$(( $elapsed_seconds / 60 ))" |
| 441 seconds="$(( $elapsed_seconds % 60 ))" |
| 442 echo "Elapsed time: ${minutes}:${seconds}" |
| 443 } |
| OLD | NEW |