| #!/bin/bash |
| # Copyright 2017 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| SCRIPT_ROOT=$(dirname "$(readlink -f "$0")") |
| . "${SCRIPT_ROOT}/build_library/build_common.sh" || exit 1 |
| . "${SCRIPT_ROOT}/build_library/filesystem_util.sh" || exit 1 |
| |
| TERMINA_BUILD_IMAGE_PY="${SCRIPT_ROOT}/../platform/container-guest-tools/termina/termina_build_image.py" |
| TERMINA_BUILD_IMAGE_PY="$(readlink -f "${TERMINA_BUILD_IMAGE_PY}")" |
| |
| assert_inside_chroot "$@" |
| |
| DEFINE_string arch "amd64" \ |
| "Architecture of the VM image" |
| DEFINE_string filesystem "ext4" \ |
| "Filesystem for the rootfs image" |
| DEFINE_string image "" \ |
| "Chromium OS disk image to build the Termina image from" |
| DEFINE_string output "" \ |
| "Output directory" |
| |
| FLAGS_HELP="USAGE: ${SCRIPT_NAME} [flags] |
| |
| To build a tatl test image, try: |
| $ ./build_image --board=tatl test |
| $ ${SCRIPT_NAME} --image=../build/images/tatl/latest/chromiumos_test_image.bin --output=tatl |
| " |
| FLAGS "$@" || exit 1 |
| eval set -- "${FLAGS_ARGV}" |
| switch_to_strict_mode |
| |
| main() { |
| warn "termina_build_image is deprecated. Please use termina_build_image.py." |
| |
| if [[ -z "${FLAGS_image}" ]]; then |
| die_notrace "Please provide an image using --image" |
| elif [[ ! -f "${FLAGS_image}" ]]; then |
| die_notrace "'${FLAGS_image}' does not exist" |
| fi |
| |
| if [[ "${FLAGS_arch}" != "amd64" && "${FLAGS_arch}" != "arm" ]]; then |
| die_notrace "Architecture '${FLAGS_arch}' is not valid. Options are 'amd64' and 'arm'" |
| fi |
| |
| if [[ "${FLAGS_filesystem}" != "ext4" ]]; then |
| die_notrace "Filesystem '${FLAGS_filesystem}' is not valid. 'ext4' is valid." |
| fi |
| |
| info "Equivalent termina_build_image.py command:" |
| info "${TERMINA_BUILD_IMAGE_PY} ${FLAGS_image} ${FLAGS_output}" |
| |
| sudo "${TERMINA_BUILD_IMAGE_PY}" "${FLAGS_image}" "${FLAGS_output}" |
| |
| info "Done! The resulting image is in '${FLAGS_output}'" |
| } |
| |
| main "$@" |