| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS 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 # Script to sync your checkout, build a Chromium OS image, and test it all | 7 # Script to sync your checkout, build a Chromium OS image, and test it all |
| 8 # with one command. Can also check out a new Chromium OS checkout and | 8 # with one command. Can also check out a new Chromium OS checkout and |
| 9 # perform a subset of the above operations. | 9 # perform a subset of the above operations. |
| 10 # | 10 # |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 # Load common constants. This should be the first executable line. | 44 # Load common constants. This should be the first executable line. |
| 45 # The path to common.sh should be relative to your script's location. | 45 # The path to common.sh should be relative to your script's location. |
| 46 . "$(dirname "$0")/common.sh" | 46 . "$(dirname "$0")/common.sh" |
| 47 | 47 |
| 48 | 48 |
| 49 DEFINE_string top "" \ | 49 DEFINE_string top "" \ |
| 50 "Root directory of your checkout (defaults to determining from your cwd)" | 50 "Root directory of your checkout (defaults to determining from your cwd)" |
| 51 DEFINE_string repo "${CHROMIUMOS_REPO}" "gclient repo for chromiumos" | 51 DEFINE_string repo "${CHROMIUMOS_REPO}" "gclient repo for chromiumos" |
| 52 DEFINE_boolean sync ${FLAGS_TRUE} "Sync the checkout" | 52 DEFINE_boolean sync ${FLAGS_TRUE} "Sync the checkout" |
| 53 DEFINE_boolean force_make_local_repo ${FLAGS_FALSE} \ | |
| 54 "Run make_local_repo indep of sync" | |
| 55 DEFINE_boolean force_make_chroot ${FLAGS_FALSE} "Run make_chroot indep of sync" | 53 DEFINE_boolean force_make_chroot ${FLAGS_FALSE} "Run make_chroot indep of sync" |
| 56 DEFINE_boolean build ${FLAGS_TRUE} \ | 54 DEFINE_boolean build ${FLAGS_TRUE} \ |
| 57 "Build all code (but not necessarily master image)" | 55 "Build all code (but not necessarily master image)" |
| 58 DEFINE_boolean master ${FLAGS_TRUE} "Master an image from built code" | 56 DEFINE_boolean master ${FLAGS_TRUE} "Master an image from built code" |
| 59 DEFINE_string grab_buildbot "" \ | 57 DEFINE_string grab_buildbot "" \ |
| 60 "Instead of building, grab this full image.zip URI generated by the \ | 58 "Instead of building, grab this full image.zip URI generated by the \ |
| 61 buildbot" | 59 buildbot" |
| 62 DEFINE_string chronos_passwd "${CHRONOS_PASSWD}" \ | 60 DEFINE_string chronos_passwd "${CHRONOS_PASSWD}" \ |
| 63 "Use this as the chronos user passwd (defaults to \$CHRONOS_PASSWD)" | 61 "Use this as the chronos user passwd (defaults to \$CHRONOS_PASSWD)" |
| 64 DEFINE_boolean mod_image_for_test ${FLAGS_FALSE} "Modify the image for testing" | 62 DEFINE_boolean mod_image_for_test ${FLAGS_FALSE} "Modify the image for testing" |
| 65 DEFINE_boolean build_autotest ${FLAGS_FALSE} "Build autotest" | 63 DEFINE_boolean build_autotest ${FLAGS_FALSE} "Build autotest" |
| 66 DEFINE_boolean image_to_live ${FLAGS_FALSE} \ | 64 DEFINE_boolean image_to_live ${FLAGS_FALSE} \ |
| 67 "Put the resulting image on live instance (requires --remote)" | 65 "Put the resulting image on live instance (requires --remote)" |
| 68 DEFINE_string remote "" \ | 66 DEFINE_string remote "" \ |
| 69 "Use this hostname/IP for live updating and running tests" | 67 "Use this hostname/IP for live updating and running tests" |
| 70 DEFINE_string image_to_usb "" \ | 68 DEFINE_string image_to_usb "" \ |
| 71 "Treat this device as USB and put the image on it after build" | 69 "Treat this device as USB and put the image on it after build" |
| 72 DEFINE_string test "" \ | 70 DEFINE_string test "" \ |
| 73 "Test the built image with the given params to run_remote_tests" | 71 "Test the built image with the given params to run_remote_tests" |
| 74 DEFINE_string buildbot_uri "${BUILDBOT_URI}" \ | 72 DEFINE_string buildbot_uri "${BUILDBOT_URI}" \ |
| 75 "Base URI to buildbot build location which contains LATEST file" | 73 "Base URI to buildbot build location which contains LATEST file" |
| 76 DEFINE_boolean unittest ${FLAGS_TRUE} "Run unit tests" | 74 DEFINE_boolean unittest ${FLAGS_TRUE} "Run unit tests" |
| 77 DEFINE_boolean interactive ${FLAGS_FALSE} \ | 75 DEFINE_boolean interactive ${FLAGS_FALSE} \ |
| 78 "Tell user what we plan to do and wait for input to proceed" i | 76 "Tell user what we plan to do and wait for input to proceed" i |
| 79 | 77 DEFINE_boolean portage ${FLAGS_TRUE} "Use portage-based build" |
| 78 DEFINE_string board "x86-generic" "Board setting (portage)" |
| 79 DEFINE_string toolchain "i686-pc-linux-gnu" "Toolchain setting (portage)" |
| 80 # You can set build_jobs > 1 but then your build may break and you may need |
| 81 # to retry. Setting it to 1 is best for non-interactive sessions. |
| 82 DEFINE_integer build_jobs 1 "Concurrent build jobs (portage)" |
| 80 | 83 |
| 81 # Returns a heuristic indicating if we believe this to be a google internal | 84 # Returns a heuristic indicating if we believe this to be a google internal |
| 82 # development environment. | 85 # development environment. |
| 83 # Returns: | 86 # Returns: |
| 84 # 0 if so, 1 otherwise | 87 # 0 if so, 1 otherwise |
| 85 function is_google_environment() { | 88 function is_google_environment() { |
| 86 hostname | egrep -q .google.com\$ | 89 hostname | egrep -q .google.com\$ |
| 87 return $? | 90 return $? |
| 88 } | 91 } |
| 89 | 92 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 if [[ ${FLAGS_mod_image_for_test} -eq ${FLAGS_TRUE} ]]; then | 165 if [[ ${FLAGS_mod_image_for_test} -eq ${FLAGS_TRUE} ]]; then |
| 163 # Override any specified chronos password with the test one | 166 # Override any specified chronos password with the test one |
| 164 local test_file=$(dirname $0)"/mod_for_test_scripts/test_account.passwd" | 167 local test_file=$(dirname $0)"/mod_for_test_scripts/test_account.passwd" |
| 165 FLAGS_chronos_passwd=$(head -1 "${test_file}") | 168 FLAGS_chronos_passwd=$(head -1 "${test_file}") |
| 166 # Default to building autotests whenever we mod image for test. | 169 # Default to building autotests whenever we mod image for test. |
| 167 # TODO(kmixter): Make this more efficient by either doing incremental | 170 # TODO(kmixter): Make this more efficient by either doing incremental |
| 168 # building, or only building if the tests we're running needs to be. | 171 # building, or only building if the tests we're running needs to be. |
| 169 FLAGS_build_autotest=${FLAGS_TRUE} | 172 FLAGS_build_autotest=${FLAGS_TRUE} |
| 170 fi | 173 fi |
| 171 | 174 |
| 175 if [[ -e "${FLAGS_top}/src/scripts/new_make_env.sh" ]]; then |
| 176 if [[ ${FLAGS_portage} -ne ${FLAGS_TRUE} ]]; then |
| 177 echo "WARNING: It looks like you wanted to pass --portage to " |
| 178 echo "build with the portage method" |
| 179 fi |
| 180 fi |
| 181 |
| 172 if [[ -n "${FLAGS_image_to_usb}" ]]; then | 182 if [[ -n "${FLAGS_image_to_usb}" ]]; then |
| 173 local device=${FLAGS_image_to_usb#/dev/} | 183 local device=${FLAGS_image_to_usb#/dev/} |
| 174 if [[ -z "${device}" ]]; then | 184 if [[ -z "${device}" ]]; then |
| 175 echo "Expected --image_to_usb option of /dev/* format" | 185 echo "Expected --image_to_usb option of /dev/* format" |
| 176 exit 1 | 186 exit 1 |
| 177 fi | 187 fi |
| 178 local is_removable=$(cat /sys/block/${device}/removable) | 188 local is_removable=$(cat /sys/block/${device}/removable) |
| 179 if [[ "${is_removable}" != "1" ]]; then | 189 if [[ "${is_removable}" != "1" ]]; then |
| 180 echo "Could not verify that ${device} for image_to_usb is removable" | 190 echo "Could not verify that ${device} for image_to_usb is removable" |
| 181 exit 1 | 191 exit 1 |
| 182 fi | 192 fi |
| 183 fi | 193 fi |
| 184 } | 194 } |
| 185 | 195 |
| 186 | 196 |
| 187 # Prints a description of what we are doing or did | 197 # Prints a description of what we are doing or did |
| 188 function describe_steps() { | 198 function describe_steps() { |
| 189 if [[ ${FLAGS_sync} -eq ${FLAGS_true} ]]; then | 199 if [[ ${FLAGS_sync} -eq ${FLAGS_TRUE} ]]; then |
| 190 echo " * Sync client (gclient sync)" | 200 echo " * Sync client (gclient sync)" |
| 191 if is_google_environment; then | 201 if is_google_environment; then |
| 192 echo " * Create proper src/scripts/.chromeos_dev" | 202 echo " * Create proper src/scripts/.chromeos_dev" |
| 193 fi | 203 fi |
| 194 fi | 204 fi |
| 195 if [[ ${FLAGS_force_make_local_repo} -eq ${FLAGS_true} ]]; then | 205 if [[ ${FLAGS_force_make_chroot} -eq ${FLAGS_TRUE} ]]; then |
| 196 echo " * (Re-)create local package repository (make_local_repo.sh)" | |
| 197 fi | |
| 198 if [[ ${FLAGS_force_make_chroot} -eq ${FLAGS_true} ]]; then | |
| 199 echo " * (Re-)create development chroot (make_chroot.sh)" | 206 echo " * (Re-)create development chroot (make_chroot.sh)" |
| 200 fi | 207 fi |
| 201 local set_passwd=${FLAGS_FALSE} | 208 local set_passwd=${FLAGS_FALSE} |
| 202 if [[ ${FLAGS_build} -eq ${FLAGS_true} ]]; then | 209 if [[ ${FLAGS_build} -eq ${FLAGS_TRUE} ]]; then |
| 203 echo " * Build image (build_platform_packages.sh, build_kernel.sh)" | 210 echo " * Build image (build_platform_packages.sh, build_kernel.sh)" |
| 204 set_passwd=${FLAGS_TRUE} | 211 set_passwd=${FLAGS_TRUE} |
| 205 fi | 212 fi |
| 206 if [[ ${FLAGS_master} -eq ${FLAGS_true} ]]; then | 213 if [[ ${FLAGS_master} -eq ${FLAGS_TRUE} ]]; then |
| 207 echo " * Master image (build_image.sh)" | 214 echo " * Master image (build_image.sh)" |
| 208 fi | 215 fi |
| 209 if [[ -n "${FLAGS_grab_buildbot}" ]]; then | 216 if [[ -n "${FLAGS_grab_buildbot}" ]]; then |
| 210 if [[ "${FLAGS_grab_buildbot}" == "LATEST" ]]; then | 217 if [[ "${FLAGS_grab_buildbot}" == "LATEST" ]]; then |
| 211 echo " * Grab latest buildbot image under ${FLAGS_buildbot_uri}" | 218 echo " * Grab latest buildbot image under ${FLAGS_buildbot_uri}" |
| 212 else | 219 else |
| 213 echo " * Grab buildbot image zip at URI ${FLAGS_grab_buildbot}" | 220 echo " * Grab buildbot image zip at URI ${FLAGS_grab_buildbot}" |
| 214 fi | 221 fi |
| 215 fi | 222 fi |
| 216 if [[ ${FLAGS_mod_image_for_test} -eq ${FLAGS_TRUE} ]]; then | 223 if [[ ${FLAGS_mod_image_for_test} -eq ${FLAGS_TRUE} ]]; then |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 function run_phase() { | 315 function run_phase() { |
| 309 local desc="$1" | 316 local desc="$1" |
| 310 shift | 317 shift |
| 311 describe_phase "${desc}" | 318 describe_phase "${desc}" |
| 312 echo "+ $@" | 319 echo "+ $@" |
| 313 "$@" | 320 "$@" |
| 314 sudo -v | 321 sudo -v |
| 315 } | 322 } |
| 316 | 323 |
| 317 | 324 |
| 325 # Runs a phase, similar to run_phase, but runs within the chroot. |
| 326 # Arguments: |
| 327 # $1 - phase description |
| 328 # $2.. - command/params to run in chroot |
| 329 function run_phase_in_chroot() { |
| 330 local desc="$1" |
| 331 shift |
| 332 run_phase "${desc}" ./enter_chroot.sh -- "$@" |
| 333 } |
| 334 |
| 335 |
| 336 # Record start time. |
| 337 function set_start_time() { |
| 338 START_TIME=$(date '+%s') |
| 339 } |
| 340 |
| 341 |
| 342 # Display duration |
| 343 function show_duration() { |
| 344 local current_time=$(date '+%s') |
| 345 local duration=$((${current_time} - ${START_TIME})) |
| 346 local minutes_duration=$((${duration} / 60)) |
| 347 local seconds_duration=$((${duration} % 60)) |
| 348 printf "Total time: %d:%02ds\n" "${minutes_duration}" "${seconds_duration}" |
| 349 } |
| 350 |
| 351 |
| 318 # Runs gclient sync, setting up .chromeos_dev and preparing for | 352 # Runs gclient sync, setting up .chromeos_dev and preparing for |
| 319 # local repo setup | 353 # local repo setup |
| 320 function sync() { | 354 function sync() { |
| 321 # cd to the directory below | 355 # cd to the directory below |
| 322 chdir_relative .. | 356 chdir_relative .. |
| 323 run_phase "Synchronizing client" gclient sync | 357 run_phase "Synchronizing client" gclient sync |
| 324 chdir_relative . | 358 chdir_relative . |
| 325 git cl config "file://$(pwd)/codereview.settings" | 359 git cl config "file://$(pwd)/codereview.settings" |
| 326 if is_google_environment; then | 360 if is_google_environment; then |
| 327 local base_dir=$(dirname $(dirname "${FLAGS_top}")) | 361 local base_dir=$(dirname $(dirname "${FLAGS_top}")) |
| 328 echo <<EOF > src/scripts/.chromeos_dev | 362 echo <<EOF > src/scripts/.chromeos_dev |
| 329 # Use internal chromeos-deb repository | 363 # Use internal chromeos-deb repository |
| 330 CHROMEOS_EXT_MIRROR="http://chromeos-deb/ubuntu" | 364 CHROMEOS_EXT_MIRROR="http://chromeos-deb/ubuntu" |
| 331 CHROMEOS_EXT_SUITE="karmic" | 365 CHROMEOS_EXT_SUITE="karmic" |
| 332 | 366 |
| 333 # Assume Chrome is checked out nearby | 367 # Assume Chrome is checked out nearby |
| 334 CHROMEOS_CHROME_DIR="${base_dir}/chrome" | 368 CHROMEOS_CHROME_DIR="${base_dir}/chrome" |
| 335 EOF | 369 EOF |
| 336 fi | 370 fi |
| 371 if [[ ${FLAGS_portage} -eq ${FLAGS_TRUE} ]]; then |
| 372 chdir_relative src/third_party |
| 373 chromiumos-overlay/chromeos/scripts/setup_source_tree.sh |
| 374 fi |
| 337 } | 375 } |
| 338 | 376 |
| 339 | 377 |
| 340 function check_rootfs_validity() { | 378 function check_rootfs_validity() { |
| 341 echo "Checking rootfs validity" | 379 echo "Checking rootfs validity" |
| 342 local device=$(sudo losetup -f) | 380 local device=$(sudo losetup -f) |
| 343 local invalid=0 | 381 local invalid=0 |
| 344 sudo losetup "${device}" rootfs.image | 382 sudo losetup "${device}" rootfs.image |
| 345 sudo mount "${device}" rootfs | 383 sudo mount "${device}" rootfs |
| 346 if [[ ! -e rootfs/boot/vmlinuz ]]; then | 384 if [[ ! -e rootfs/boot/vmlinuz ]]; then |
| (...skipping 30 matching lines...) Expand all Loading... |
| 377 local image_dir="${FLAGS_top}/src/build/images/${image_basename}" | 415 local image_dir="${FLAGS_top}/src/build/images/${image_basename}" |
| 378 echo "Copying in build image to ${image_dir}" | 416 echo "Copying in build image to ${image_dir}" |
| 379 rm -rf "${image_dir}" | 417 rm -rf "${image_dir}" |
| 380 mkdir -p "${image_dir}" | 418 mkdir -p "${image_dir}" |
| 381 # Note that if mbr.image does not exist, this image was not successful. | 419 # Note that if mbr.image does not exist, this image was not successful. |
| 382 mv mbr.image rootfs.image "${image_dir}" | 420 mv mbr.image rootfs.image "${image_dir}" |
| 383 chdir_relative . | 421 chdir_relative . |
| 384 run_phase "Removing downloaded image" rm -rf "${dl_dir}" | 422 run_phase "Removing downloaded image" rm -rf "${dl_dir}" |
| 385 } | 423 } |
| 386 | 424 |
| 387 | |
| 388 function main() { | 425 function main() { |
| 389 assert_outside_chroot | 426 assert_outside_chroot |
| 390 assert_not_root_user | 427 assert_not_root_user |
| 391 | 428 |
| 392 # Parse command line | 429 # Parse command line |
| 393 FLAGS "$@" || exit 1 | 430 FLAGS "$@" || exit 1 |
| 394 eval set -- "${FLAGS_ARGV}" | 431 eval set -- "${FLAGS_ARGV}" |
| 395 | 432 |
| 396 # Die on any errors. | 433 # Die on any errors. |
| 397 set -e | 434 set -e |
| 398 | 435 |
| 399 validate_and_set_param_defaults | 436 validate_and_set_param_defaults |
| 400 | 437 |
| 401 # Cache up sudo status | 438 # Cache up sudo status |
| 402 sudo -v | 439 sudo -v |
| 403 | 440 |
| 404 if [[ ${FLAGS_interactive} -eq ${FLAGS_TRUE} ]]; then | 441 if [[ ${FLAGS_interactive} -eq ${FLAGS_TRUE} ]]; then |
| 405 interactive | 442 interactive |
| 406 fi | 443 fi |
| 407 | 444 |
| 445 set_start_time |
| 446 |
| 408 if [[ ! -e "${FLAGS_top}" ]]; then | 447 if [[ ! -e "${FLAGS_top}" ]]; then |
| 409 config_new_checkout | 448 config_new_checkout |
| 410 fi | 449 fi |
| 411 | 450 |
| 412 if [[ ${FLAGS_sync} -eq ${FLAGS_TRUE} ]]; then | 451 if [[ ${FLAGS_sync} -eq ${FLAGS_TRUE} ]]; then |
| 413 sync | 452 sync |
| 414 # The package repository is now potentially out of date, so | 453 # The package repository is now potentially out of date, so |
| 415 # reflect that. | 454 # reflect that. |
| 416 run_phase "Removing existing package repo" sudo rm -rf repo | 455 run_phase "Removing existing package repo" sudo rm -rf repo |
| 417 FLAGS_force_make_local_repo=${FLAGS_TRUE} | |
| 418 FLAGS_force_make_chroot=${FLAGS_TRUE} | 456 FLAGS_force_make_chroot=${FLAGS_TRUE} |
| 419 fi | 457 fi |
| 420 | 458 |
| 421 if [[ -n "${FLAGS_grab_buildbot}" ]]; then | 459 if [[ -n "${FLAGS_grab_buildbot}" ]]; then |
| 422 grab_buildbot | 460 grab_buildbot |
| 423 fi | 461 fi |
| 424 | 462 |
| 425 if [[ ${FLAGS_force_make_local_repo} -eq ${FLAGS_TRUE} ]]; then | |
| 426 chdir_relative src/scripts | |
| 427 run_phase "Refetching local repo" ./make_local_repo.sh | |
| 428 fi | |
| 429 | |
| 430 if [[ ${FLAGS_force_make_chroot} -eq ${FLAGS_TRUE} ]]; then | 463 if [[ ${FLAGS_force_make_chroot} -eq ${FLAGS_TRUE} ]]; then |
| 431 chdir_relative src/scripts | 464 chdir_relative src/scripts |
| 432 run_phase "Replacing chroot" ./make_chroot.sh --replace | 465 if [[ ${FLAGS_portage} -eq ${FLAGS_TRUE} ]]; then |
| 466 run_phase "Replacing chroot" ./new_make_env.sh --replace |
| 467 else |
| 468 run_phase "Replacing chroot" ./make_chroot.sh --replace |
| 469 fi |
| 433 fi | 470 fi |
| 434 | 471 |
| 435 if [[ ${FLAGS_build} -eq ${FLAGS_TRUE} ]]; then | 472 if [[ ${FLAGS_build} -eq ${FLAGS_TRUE} ]]; then |
| 436 chdir_relative src/scripts | 473 chdir_relative src/scripts |
| 437 run_phase "Building platform packages and kernel" ./enter_chroot.sh \ | 474 if [[ ${FLAGS_portage} -eq ${FLAGS_TRUE} ]]; then |
| 438 "./build_platform_packages.sh && ./build_kernel.sh" | 475 # Only setup board target if the directory does not exist |
| 476 if [[ ! -d "${DEFAULT_CHROOT_DIR}/build/${FLAGS_board}" ]]; then |
| 477 run_phase_in_chroot "Setting up board target" \ |
| 478 ./setup_board "--board=${FLAGS_board}" \ |
| 479 "--toolchain=${FLAGS_toolchain}" |
| 480 fi |
| 481 run_phase_in_chroot "Building packages" \ |
| 482 ./new_build_pkgs.sh "--board=${FLAGS_board}" \ |
| 483 "--jobs=${FLAGS_build_jobs}" |
| 484 else |
| 485 run_phase_in_chroot "Building platform packages and kernel" \ |
| 486 "./build_platform_packages.sh && ./build_kernel.sh" |
| 487 fi |
| 439 | 488 |
| 440 if [[ ${FLAGS_build} -eq ${FLAGS_TRUE} ]]; then | 489 # TODO(kmixter): Enable this once build_tests works, but even |
| 441 run_phase "Building and running unit tests" ./enter_chroot.sh \ | 490 # then only do it when not cross compiling. |
| 491 if [[ ${FLAGS_portage} -eq ${FLAGS_FALSE} ]]; then |
| 492 run_phase_in_chroot "Building and running unit tests" \ |
| 442 "./build_tests.sh && ./run_tests.sh" | 493 "./build_tests.sh && ./run_tests.sh" |
| 443 fi | 494 fi |
| 444 fi | 495 fi |
| 445 | 496 |
| 446 if [[ ${FLAGS_master} -eq ${FLAGS_TRUE} ]]; then | 497 if [[ ${FLAGS_master} -eq ${FLAGS_TRUE} ]]; then |
| 447 chdir_relative src/scripts | 498 chdir_relative src/scripts |
| 448 if [[ -n "${FLAGS_chronos_passwd}" ]]; then | 499 if [[ -n "${FLAGS_chronos_passwd}" ]]; then |
| 449 describe_phase "Setting default chronos password" | 500 run_phase_in_chroot "Setting default chronos password" \ |
| 450 ./enter_chroot.sh "echo '${FLAGS_chronos_passwd}' | \ | 501 ./enter_chroot.sh "echo '${FLAGS_chronos_passwd}' | \ |
| 451 ./set_shared_user_password.sh" | 502 ~/trunk/src/scripts/set_shared_user_password.sh" |
| 452 fi | 503 fi |
| 453 run_phase "Mastering image" ./enter_chroot.sh "./build_image.sh --replace" | 504 if [[ ${FLAGS_portage} -eq ${FLAGS_TRUE} ]]; then |
| 505 run_phase_in_chroot "Mastering image" ./new_build_image.sh \ |
| 506 "--board=${FLAGS_board}" --replace |
| 507 else |
| 508 run_phase_in_chroot "Mastering image" ./build_image.sh --replace |
| 509 fi |
| 510 fi |
| 511 |
| 512 local board_param="" |
| 513 if [[ ${FLAGS_portage} -eq ${FLAGS_TRUE} ]]; then |
| 514 board_param="--board=${FLAGS_board}" |
| 454 fi | 515 fi |
| 455 | 516 |
| 456 if [[ ${FLAGS_mod_image_for_test} -eq ${FLAGS_TRUE} ]]; then | 517 if [[ ${FLAGS_mod_image_for_test} -eq ${FLAGS_TRUE} ]]; then |
| 457 chdir_relative src/scripts | 518 chdir_relative src/scripts |
| 458 run_phase "Modifying image for test" ./enter_chroot.sh \ | 519 run_phase_in_chroot "Modifying image for test" \ |
| 459 "./mod_image_for_test.sh" | 520 "./mod_image_for_test.sh" ${board_param} |
| 460 fi | 521 fi |
| 461 | 522 |
| 462 if [[ -n "${FLAGS_image_to_usb}" ]]; then | 523 if [[ -n "${FLAGS_image_to_usb}" ]]; then |
| 463 chdir_relative src/scripts | 524 chdir_relative src/scripts |
| 464 run_phase "Installing image to USB" \ | 525 run_phase "Installing image to USB" \ |
| 465 ./image_to_usb.sh --yes "--to=${FLAGS_image_to_usb}" | 526 ./image_to_usb.sh --yes "--to=${FLAGS_image_to_usb}" ${board_param} |
| 466 fi | 527 fi |
| 467 | 528 |
| 468 if [[ ${FLAGS_image_to_live} -eq ${FLAGS_TRUE} ]]; then | 529 if [[ ${FLAGS_image_to_live} -eq ${FLAGS_TRUE} ]]; then |
| 469 chdir_relative src/scripts | 530 chdir_relative src/scripts |
| 470 run_phase "Re-imaging live Chromium OS machine ${FLAGS_remote}" \ | 531 run_phase "Re-imaging live Chromium OS machine ${FLAGS_remote}" \ |
| 471 ./image_to_live.sh "--remote=${FLAGS_remote}" --update_known_hosts | 532 ./image_to_live.sh "--remote=${FLAGS_remote}" --update_known_hosts |
| 472 fi | 533 fi |
| 473 | 534 |
| 474 if [[ ${FLAGS_build_autotest} -eq ${FLAGS_TRUE} ]]; then | 535 if [[ ${FLAGS_build_autotest} -eq ${FLAGS_TRUE} ]]; then |
| 475 chdir_relative src/scripts | 536 chdir_relative src/scripts |
| 476 run_phase "Building autotest" ./enter_chroot.sh "./build_autotest.sh" | 537 run_phase_in_chroot "Building autotest" "./build_autotest.sh" ${board_param} |
| 477 fi | 538 fi |
| 478 | 539 |
| 479 if [[ -n "${FLAGS_test}" ]]; then | 540 if [[ -n "${FLAGS_test}" ]]; then |
| 480 chdir_relative src/scripts | 541 chdir_relative src/scripts |
| 481 # We purposefully do not quote FLAGS_test below as we expect it may | 542 # We purposefully do not quote FLAGS_test below as we expect it may |
| 482 # have multiple parameters | 543 # have multiple parameters |
| 483 run_phase "Running tests on Chromium OS machine ${FLAGS_remote}" \ | 544 run_phase "Running tests on Chromium OS machine ${FLAGS_remote}" \ |
| 484 ./run_remote_tests.sh --remote="${FLAGS_remote}" ${FLAGS_test} | 545 ./run_remote_tests.sh "--remote=${FLAGS_remote}" ${FLAGS_test} \ |
| 546 ${board_param} |
| 485 fi | 547 fi |
| 486 | 548 |
| 487 echo "Successfully used ${FLAGS_top} to:" | 549 echo "Successfully used ${FLAGS_top} to:" |
| 488 describe_steps | 550 describe_steps |
| 551 show_duration |
| 489 } | 552 } |
| 490 | 553 |
| 491 | 554 |
| 492 main $@ | 555 main $@ |
| OLD | NEW |