mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-22 22:21:10 +02:00
fix(build_library): remove references to chromeos-common.sh
Nothing from chromeos-common.sh is needed for image building now. Also kill off build_common.sh which was just a weird way of sourcing common.sh. The two piddly functions it provided fit better in build_image_util.sh
This commit is contained in:
parent
19ecd4572f
commit
e84f922ba5
@ -10,7 +10,7 @@
|
|||||||
# build the Chrome OS image using only pre-built binary packages.
|
# build the Chrome OS image using only pre-built binary packages.
|
||||||
|
|
||||||
SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
|
SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
|
||||||
. "${SCRIPT_ROOT}/build_library/build_common.sh" || exit 1
|
. "${SCRIPT_ROOT}/common.sh" || exit 1
|
||||||
|
|
||||||
# Developer-visible flags.
|
# Developer-visible flags.
|
||||||
DEFINE_string board "${DEFAULT_BOARD}" \
|
DEFINE_string board "${DEFAULT_BOARD}" \
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
# Copyright (c) 2011 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.
|
|
||||||
|
|
||||||
# Common library file to be sourced by build_image,
|
|
||||||
# mod_image_for_test.sh, and mod_image_for_recovery.sh. This
|
|
||||||
# file ensures that library source files needed by all the scripts
|
|
||||||
# are included once, and also takes care of certain bookeeping tasks
|
|
||||||
# common to all the scripts.
|
|
||||||
|
|
||||||
# SCRIPT_ROOT must be set prior to sourcing this file
|
|
||||||
. "${SCRIPT_ROOT}/common.sh" || exit 1
|
|
||||||
|
|
||||||
# All scripts using this file must be run inside the chroot.
|
|
||||||
restart_in_chroot_if_needed "$@"
|
|
||||||
|
|
||||||
INSTALLER_ROOT=/usr/lib/installer
|
|
||||||
. "${INSTALLER_ROOT}/chromeos-common.sh" || exit 1
|
|
||||||
|
|
||||||
locate_gpt
|
|
||||||
|
|
||||||
should_build_image() {
|
|
||||||
# Fast pass back if we should build all incremental images.
|
|
||||||
local image_name
|
|
||||||
local image_to_build
|
|
||||||
|
|
||||||
for image_name in "$@"; do
|
|
||||||
for image_to_build in ${IMAGES_TO_BUILD}; do
|
|
||||||
[ "${image_to_build}" = "${image_name}" ] && return 0
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Utility function for creating a copy of an image prior to
|
|
||||||
# modification from the BUILD_DIR:
|
|
||||||
# $1: source filename
|
|
||||||
# $2: destination filename
|
|
||||||
copy_image() {
|
|
||||||
local src="${BUILD_DIR}/$1"
|
|
||||||
local dst="${BUILD_DIR}/$2"
|
|
||||||
if should_build_image $1; then
|
|
||||||
echo "Creating $2 from $1..."
|
|
||||||
cp --sparse=always "${src}" "${dst}" || die "Cannot copy $1 to $2"
|
|
||||||
else
|
|
||||||
mv "${src}" "${dst}" || die "Cannot move $1 to $2"
|
|
||||||
fi
|
|
||||||
}
|
|
@ -55,6 +55,35 @@ parse_build_image_args() {
|
|||||||
get_images_to_build ${FLAGS_ARGV}
|
get_images_to_build ${FLAGS_ARGV}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
should_build_image() {
|
||||||
|
# Fast pass back if we should build all incremental images.
|
||||||
|
local image_name
|
||||||
|
local image_to_build
|
||||||
|
|
||||||
|
for image_name in "$@"; do
|
||||||
|
for image_to_build in ${IMAGES_TO_BUILD}; do
|
||||||
|
[ "${image_to_build}" = "${image_name}" ] && return 0
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Utility function for creating a copy of an image prior to
|
||||||
|
# modification from the BUILD_DIR:
|
||||||
|
# $1: source filename
|
||||||
|
# $2: destination filename
|
||||||
|
copy_image() {
|
||||||
|
local src="${BUILD_DIR}/$1"
|
||||||
|
local dst="${BUILD_DIR}/$2"
|
||||||
|
if should_build_image $1; then
|
||||||
|
echo "Creating $2 from $1..."
|
||||||
|
cp --sparse=always "${src}" "${dst}" || die "Cannot copy $1 to $2"
|
||||||
|
else
|
||||||
|
mv "${src}" "${dst}" || die "Cannot move $1 to $2"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
check_blacklist() {
|
check_blacklist() {
|
||||||
info "Verifying that the base image does not contain a blacklisted package."
|
info "Verifying that the base image does not contain a blacklisted package."
|
||||||
info "Generating list of packages for ${BASE_PACKAGE}."
|
info "Generating list of packages for ${BASE_PACKAGE}."
|
||||||
|
@ -13,15 +13,8 @@
|
|||||||
SCRIPT_ROOT=$(dirname "$(readlink -f "$0")")
|
SCRIPT_ROOT=$(dirname "$(readlink -f "$0")")
|
||||||
. "${SCRIPT_ROOT}/common.sh" || exit 1
|
. "${SCRIPT_ROOT}/common.sh" || exit 1
|
||||||
. "${BUILD_LIBRARY_DIR}/toolchain_util.sh" || exit 1
|
. "${BUILD_LIBRARY_DIR}/toolchain_util.sh" || exit 1
|
||||||
. "${BUILD_LIBRARY_DIR}/build_common.sh" || exit 1
|
|
||||||
. "${BUILD_LIBRARY_DIR}/build_image_util.sh" || exit 1
|
. "${BUILD_LIBRARY_DIR}/build_image_util.sh" || exit 1
|
||||||
. "${BUILD_LIBRARY_DIR}/vm_image_util.sh" || exit 1
|
. "${BUILD_LIBRARY_DIR}/vm_image_util.sh" || exit 1
|
||||||
|
|
||||||
# Need to be inside the chroot to load chromeos-common.sh
|
|
||||||
assert_inside_chroot
|
|
||||||
|
|
||||||
# Load functions and constants for chromeos-install
|
|
||||||
. /usr/lib/installer/chromeos-common.sh || exit 1
|
|
||||||
. "${SCRIPT_ROOT}/lib/cros_vm_constants.sh" || exit 1
|
. "${SCRIPT_ROOT}/lib/cros_vm_constants.sh" || exit 1
|
||||||
|
|
||||||
# Flags
|
# Flags
|
||||||
@ -96,9 +89,6 @@ else
|
|||||||
set_vm_paths "${FLAGS_from}" "${FLAGS_to}" "${CHROMEOS_IMAGE_NAME}"
|
set_vm_paths "${FLAGS_from}" "${FLAGS_to}" "${CHROMEOS_IMAGE_NAME}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
locate_gpt
|
|
||||||
legacy_offset_size_export ${VM_SRC_IMG}
|
|
||||||
|
|
||||||
# Make sure things are cleaned up on failure
|
# Make sure things are cleaned up on failure
|
||||||
trap vm_cleanup EXIT
|
trap vm_cleanup EXIT
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user