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 # Simple wrapper scipt to start a vm using the vm lib. | 7 # Simple wrapper scipt to start a vm using the vm lib. |
8 | 8 |
9 . "$(dirname $0)/../common.sh" | 9 . "$(dirname $0)/../common.sh" |
10 . "$(dirname $0)/../lib/cros_vm_lib.sh" | 10 . "$(dirname $0)/../lib/cros_vm_lib.sh" |
11 . "$(dirname "$0")/../lib/cros_vm_constants.sh" | 11 . "$(dirname "$0")/../lib/cros_vm_constants.sh" |
12 | 12 |
| 13 get_default_board |
| 14 |
| 15 DEFINE_string board "${DEFAULT_BOARD}" \ |
| 16 "Board for VM image (unnecessary if path given)" |
13 DEFINE_string image_path "" "Full path of the VM image" | 17 DEFINE_string image_path "" "Full path of the VM image" |
14 | 18 |
15 set -e | 19 set -e |
16 | 20 |
17 # Parse command line. | 21 # Parse command line. |
18 FLAGS "$@" || exit 1 | 22 FLAGS "$@" || exit 1 |
19 eval set -- "${FLAGS_ARGV}" | 23 eval set -- "${FLAGS_ARGV}" |
20 | 24 |
21 # Use latest if not specified. | 25 # Use latest if not specified. |
22 if [ -z "${FLAGS_image_path}" ]; then | 26 if [ -z "${FLAGS_image_path}" ]; then |
23 LATEST_IMAGE="$(${SCRIPTS_DIR}/get_latest_image.sh)/${DEFAULT_QEMU_IMAGE}" | 27 LATEST_IMAGE="$(${SCRIPTS_DIR}/get_latest_image.sh \ |
| 28 --board=${FLAGS_board})/${DEFAULT_QEMU_IMAGE}" |
24 info "Using latest vm image ${LATEST_IMAGE}" | 29 info "Using latest vm image ${LATEST_IMAGE}" |
25 FLAGS_image_path=${LATEST_IMAGE} | 30 FLAGS_image_path=${LATEST_IMAGE} |
26 fi | 31 fi |
27 | 32 |
28 [ -e "${FLAGS_image_path}" ] || die "Image ${FLAGS_image_path} does not exist." | 33 [ -e "${FLAGS_image_path}" ] || die "Image ${FLAGS_image_path} does not exist." |
29 | 34 |
30 start_kvm "${FLAGS_image_path}" | 35 start_kvm "${FLAGS_image_path}" |
31 | 36 |
32 echo "ssh root@${HOSTNAME} -p ${FLAGS_ssh_port} -o StrictHostKeyChecking=no" | 37 echo "ssh root@${HOSTNAME} -p ${FLAGS_ssh_port} -o StrictHostKeyChecking=no" |
OLD | NEW |