diff --git a/build_image b/build_image index d7f09fef37..c9d80c9e6c 100755 --- a/build_image +++ b/build_image @@ -32,6 +32,8 @@ DEFINE_string base_pkg "coreos-base/coreos" \ "The base portage package to base the build off of (only applies to prod images)" DEFINE_string base_dev_pkg "coreos-base/coreos-dev" \ "The base portage package to base the build off of (only applies to dev images)" +DEFINE_string torcx_store "${DEFAULT_BUILD_ROOT}/torcx/${DEFAULT_BOARD}/latest" \ + "Directory of torcx images to copy into the vendor store (or blank for none)" DEFINE_string output_root "${DEFAULT_BUILD_ROOT}/images" \ "Directory in which to place image result directories (named by version)" DEFINE_string disk_layout "" \ @@ -86,6 +88,11 @@ switch_to_strict_mode check_gsutil_opts +# Patch around default values not being able to depend on other flags. +if [ "x${FLAGS_torcx_store}" = "x${DEFAULT_BUILD_ROOT}/torcx/${DEFAULT_BOARD}/latest" ]; then + FLAGS_torcx_store="${DEFAULT_BUILD_ROOT}/torcx/${FLAGS_board}/latest" +fi + # If downloading packages is enabled ensure the board is configured properly. if [[ ${FLAGS_getbinpkg} -eq ${FLAGS_TRUE} ]]; then "${SRC_ROOT}/scripts/setup_board" --board="${FLAGS_board}" \ diff --git a/build_library/build_image_util.sh b/build_library/build_image_util.sh index 1e19fcb792..def5ab03c8 100755 --- a/build_library/build_image_util.sh +++ b/build_library/build_image_util.sh @@ -424,6 +424,12 @@ finish_image() { local install_grub=0 local disk_img="${BUILD_DIR}/${image_name}" + # Copy in a vendor torcx store if requested. + if [ -n "${FLAGS_torcx_store}" ]; then + sudo cp -dt "${root_fs_dir}"/usr/share/torcx/store \ + "${FLAGS_torcx_store}"/*.torcx.tgz + fi + # Only enable rootfs verification on prod builds. local disable_read_write="${FLAGS_FALSE}" if [[ "${IMAGE_BUILD_TYPE}" == "prod" ]]; then