mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-23 22:51:03 +02:00
fix(build_image): Only use 'alpha' group in official builds.
This commit is contained in:
parent
4a0e4de834
commit
add4519021
21
build_image
21
build_image
@ -17,6 +17,11 @@ restart_in_chroot_if_needed "$@"
|
|||||||
|
|
||||||
assert_not_root_user
|
assert_not_root_user
|
||||||
|
|
||||||
|
DEFAULT_GROUP=developer
|
||||||
|
if [[ ${COREOS_OFFICIAL:-0} -eq 1 ]]; then
|
||||||
|
DEFAULT_GROUP=alpha
|
||||||
|
fi
|
||||||
|
|
||||||
# Developer-visible flags.
|
# Developer-visible flags.
|
||||||
DEFINE_string board "${DEFAULT_BOARD}" \
|
DEFINE_string board "${DEFAULT_BOARD}" \
|
||||||
"The board to build an image for."
|
"The board to build an image for."
|
||||||
@ -28,8 +33,8 @@ DEFINE_string output_root "${DEFAULT_BUILD_ROOT}/images" \
|
|||||||
"Directory in which to place image result directories (named by version)"
|
"Directory in which to place image result directories (named by version)"
|
||||||
DEFINE_string disk_layout "base" \
|
DEFINE_string disk_layout "base" \
|
||||||
"The disk layout type to use for this image."
|
"The disk layout type to use for this image."
|
||||||
DEFINE_string prod_group "" \
|
DEFINE_string group "${DEFAULT_GROUP}" \
|
||||||
"The update group for production images."
|
"The update group."
|
||||||
|
|
||||||
# include upload options
|
# include upload options
|
||||||
. "${BUILD_LIBRARY_DIR}/release_util.sh" || exit 1
|
. "${BUILD_LIBRARY_DIR}/release_util.sh" || exit 1
|
||||||
@ -129,16 +134,13 @@ mkdir -p "${BUILD_DIR}"
|
|||||||
DISK_LAYOUT_SUFFIX=$(portageq-$BOARD envvar COREOS_DISK_LAYOUT_SUFFIX)
|
DISK_LAYOUT_SUFFIX=$(portageq-$BOARD envvar COREOS_DISK_LAYOUT_SUFFIX)
|
||||||
DISK_LAYOUT="${FLAGS_disk_layout:-base}${DISK_LAYOUT_SUFFIX}"
|
DISK_LAYOUT="${FLAGS_disk_layout:-base}${DISK_LAYOUT_SUFFIX}"
|
||||||
|
|
||||||
if [[ -z "${FLAGS_prod_group}" ]]; then
|
# Temporary hack until generic images are completely deleted
|
||||||
if [[ "$BOARD" == "amd64-generic" ]]; then
|
if [[ "${FLAGS_group}" == "alpha" && "$BOARD" == "amd64-generic" ]]; then
|
||||||
FLAGS_prod_group="dev-channel"
|
FLAGS_group="dev-channel"
|
||||||
else
|
|
||||||
FLAGS_prod_group="alpha"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create the base image.
|
# Create the base image.
|
||||||
create_base_image ${PRISTINE_IMAGE_NAME} ${DISK_LAYOUT}
|
create_base_image "${PRISTINE_IMAGE_NAME}" "${DISK_LAYOUT}" "${FLAGS_group}"
|
||||||
if should_build_image ${PRISTINE_IMAGE_NAME}; then
|
if should_build_image ${PRISTINE_IMAGE_NAME}; then
|
||||||
upload_image "${BUILD_DIR}/${PRISTINE_IMAGE_NAME}"
|
upload_image "${BUILD_DIR}/${PRISTINE_IMAGE_NAME}"
|
||||||
fi
|
fi
|
||||||
@ -164,7 +166,6 @@ if should_build_image ${COREOS_PRODUCTION_IMAGE_NAME}; then
|
|||||||
copy_image ${CHROMEOS_BASE_IMAGE_NAME} ${COREOS_PRODUCTION_IMAGE_NAME}
|
copy_image ${CHROMEOS_BASE_IMAGE_NAME} ${COREOS_PRODUCTION_IMAGE_NAME}
|
||||||
|
|
||||||
setup_prod_image ${COREOS_PRODUCTION_IMAGE_NAME} ${DISK_LAYOUT} \
|
setup_prod_image ${COREOS_PRODUCTION_IMAGE_NAME} ${DISK_LAYOUT} \
|
||||||
"${FLAGS_prod_group}" \
|
|
||||||
${SRC_ROOT}/third_party/coreos-overlay/coreos-base/coreos-au-key/files/update-payload-key.pub.pem
|
${SRC_ROOT}/third_party/coreos-overlay/coreos-base/coreos-au-key/files/update-payload-key.pub.pem
|
||||||
|
|
||||||
upload_image "${BUILD_DIR}/${COREOS_PRODUCTION_IMAGE_NAME}"
|
upload_image "${BUILD_DIR}/${COREOS_PRODUCTION_IMAGE_NAME}"
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
create_base_image() {
|
create_base_image() {
|
||||||
local image_name=$1
|
local image_name=$1
|
||||||
local disk_layout=$2
|
local disk_layout=$2
|
||||||
|
local update_group="$3"
|
||||||
|
|
||||||
local disk_img="${BUILD_DIR}/${image_name}"
|
local disk_img="${BUILD_DIR}/${image_name}"
|
||||||
local root_fs_dir="${BUILD_DIR}/rootfs"
|
local root_fs_dir="${BUILD_DIR}/rootfs"
|
||||||
@ -51,8 +52,9 @@ create_base_image() {
|
|||||||
|
|
||||||
# Set /etc/lsb-release on the image.
|
# Set /etc/lsb-release on the image.
|
||||||
"${BUILD_LIBRARY_DIR}/set_lsb_release" \
|
"${BUILD_LIBRARY_DIR}/set_lsb_release" \
|
||||||
--root="${root_fs_dir}" \
|
--root="${root_fs_dir}" \
|
||||||
--board="${BOARD}"
|
--group="${update_group}" \
|
||||||
|
--board="${BOARD}"
|
||||||
|
|
||||||
local boot_dir="/boot"
|
local boot_dir="/boot"
|
||||||
if [[ "${disk_layout}" == *-usr ]]; then
|
if [[ "${disk_layout}" == *-usr ]]; then
|
||||||
|
@ -84,7 +84,6 @@ install_dev_packages() {
|
|||||||
sudo mkdir -p "${root_fs_dir}/etc/coreos"
|
sudo mkdir -p "${root_fs_dir}/etc/coreos"
|
||||||
sudo_clobber "${root_fs_dir}/etc/coreos/update.conf" <<EOF
|
sudo_clobber "${root_fs_dir}/etc/coreos/update.conf" <<EOF
|
||||||
SERVER=${auserver}
|
SERVER=${auserver}
|
||||||
GROUP=developer-build
|
|
||||||
|
|
||||||
# For gmerge
|
# For gmerge
|
||||||
DEVSERVER=${devserver}
|
DEVSERVER=${devserver}
|
||||||
|
@ -6,8 +6,7 @@
|
|||||||
setup_prod_image() {
|
setup_prod_image() {
|
||||||
local image_name="$1"
|
local image_name="$1"
|
||||||
local disk_layout="$2"
|
local disk_layout="$2"
|
||||||
local update_group="$3"
|
local au_key="$3"
|
||||||
local au_key="$4"
|
|
||||||
|
|
||||||
info "Configuring production image ${image_name}"
|
info "Configuring production image ${image_name}"
|
||||||
local root_fs_dir="${BUILD_DIR}/rootfs"
|
local root_fs_dir="${BUILD_DIR}/rootfs"
|
||||||
@ -20,12 +19,6 @@ setup_prod_image() {
|
|||||||
mount "${BUILD_DIR}/${image_name}" "${root_fs_dir}"
|
mount "${BUILD_DIR}/${image_name}" "${root_fs_dir}"
|
||||||
trap "cleanup_mounts '${root_fs_dir}' && delete_prompt" EXIT
|
trap "cleanup_mounts '${root_fs_dir}' && delete_prompt" EXIT
|
||||||
|
|
||||||
# Replace /etc/lsb-release on the image.
|
|
||||||
"${BUILD_LIBRARY_DIR}/set_lsb_release" \
|
|
||||||
--group="${update_group}" \
|
|
||||||
--root="${root_fs_dir}" \
|
|
||||||
--board="${BOARD}"
|
|
||||||
|
|
||||||
# Install an auto update key on the root before sealing it off
|
# Install an auto update key on the root before sealing it off
|
||||||
local key_location=${root_fs_dir}"/usr/share/update_engine/"
|
local key_location=${root_fs_dir}"/usr/share/update_engine/"
|
||||||
sudo mkdir -p "${key_location}"
|
sudo mkdir -p "${key_location}"
|
||||||
|
@ -10,11 +10,6 @@
|
|||||||
SCRIPT_ROOT=$(readlink -f $(dirname "$0")/..)
|
SCRIPT_ROOT=$(readlink -f $(dirname "$0")/..)
|
||||||
. "${SCRIPT_ROOT}/common.sh" || exit 1
|
. "${SCRIPT_ROOT}/common.sh" || exit 1
|
||||||
|
|
||||||
PRODUCTION_DEFAULT=
|
|
||||||
if [[ "${COREOS_OFFICIAL:-0}" -eq 1 ]]; then
|
|
||||||
PRODUCTION_DEFAULT="alpha"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Flags
|
# Flags
|
||||||
DEFINE_string board "" "The board to build an image for."
|
DEFINE_string board "" "The board to build an image for."
|
||||||
DEFINE_string root "" "The root file system to write /etc/lsb-release to."
|
DEFINE_string root "" "The root file system to write /etc/lsb-release to."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user