From 0ec871b2036c8446245cc2c7ad8ee3d01154c8ee Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Thu, 22 May 2014 22:24:22 -0700 Subject: [PATCH] fix(build_image_util): Reorder when set_lsb_release is called dev_image_util needs to be able to append to update.conf so move set_lsb_release to start_image instead of finish_image. --- build_library/build_image_util.sh | 14 +++++++------- build_library/dev_image_util.sh | 8 ++------ build_library/prod_image_util.sh | 4 ++-- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/build_library/build_image_util.sh b/build_library/build_image_util.sh index 8e19a37b08..a2e3ec8008 100755 --- a/build_library/build_image_util.sh +++ b/build_library/build_image_util.sh @@ -121,6 +121,7 @@ start_image() { local image_name="$1" local disk_layout="$2" local root_fs_dir="$3" + local update_group="$4" local disk_img="${BUILD_DIR}/${image_name}" @@ -140,12 +141,17 @@ start_image() { # FIXME(marineam): Work around glibc setting EROOT=$ROOT # https://bugs.gentoo.org/show_bug.cgi?id=473728#c12 sudo mkdir -p "${root_fs_dir}/etc/ld.so.conf.d" + + # Set /etc/lsb-release on the image. + "${BUILD_LIBRARY_DIR}/set_lsb_release" \ + --root="${root_fs_dir}" \ + --group="${update_group}" \ + --board="${BOARD}" } finish_image() { local disk_layout="$1" local root_fs_dir="$2" - local update_group="$3" # Record directories installed to the state partition. # Explicitly ignore entries covered by existing configs. @@ -158,12 +164,6 @@ finish_image() { --output="${root_fs_dir}/usr/lib/tmpfiles.d/base_image_etc.conf" \ ${tmp_ignore} "${root_fs_dir}/etc" - # Set /etc/lsb-release on the image. - "${BUILD_LIBRARY_DIR}/set_lsb_release" \ - --root="${root_fs_dir}" \ - --group="${update_group}" \ - --board="${BOARD}" - # Only configure bootloaders if there is a boot partition if mountpoint -q "${root_fs_dir}"/boot/efi; then ${BUILD_LIBRARY_DIR}/configure_bootloaders.sh \ diff --git a/build_library/dev_image_util.sh b/build_library/dev_image_util.sh index ec8bddc794..4b036979cb 100755 --- a/build_library/dev_image_util.sh +++ b/build_library/dev_image_util.sh @@ -67,14 +67,10 @@ create_dev_image() { info "Building developer image ${image_name}" local root_fs_dir="${BUILD_DIR}/rootfs" - start_image "${image_name}" "${disk_layout}" "${root_fs_dir}" + start_image "${image_name}" "${disk_layout}" "${root_fs_dir}" "${update_group}" emerge_to_image "${root_fs_dir}" coreos-base/coreos-dev - "${BUILD_LIBRARY_DIR}/set_lsb_release" \ - --root="${root_fs_dir}" \ - --board="${BOARD}" - # Setup portage for emerge and gmerge configure_dev_portage "${root_fs_dir}" "${devserver}" @@ -96,5 +92,5 @@ EOF # The remount services are provided by coreos-base/coreos-init systemd_enable "${root_fs_dir}" "local-fs.target" "remount-usr.service" - finish_image "${disk_layout}" "${root_fs_dir}" "${update_group}" + finish_image "${disk_layout}" "${root_fs_dir}" } diff --git a/build_library/prod_image_util.sh b/build_library/prod_image_util.sh index fb416bc3b4..4fd934bb4a 100755 --- a/build_library/prod_image_util.sh +++ b/build_library/prod_image_util.sh @@ -33,7 +33,7 @@ create_prod_image() { info "Building production image ${image_name}" local root_fs_dir="${BUILD_DIR}/rootfs" - start_image "${image_name}" "${disk_layout}" "${root_fs_dir}" + start_image "${image_name}" "${disk_layout}" "${root_fs_dir}" "${update_group}" # Install minimal GCC (libs only) and then everything else emerge_prod_gcc "${root_fs_dir}" @@ -69,7 +69,7 @@ EOF disable_read_write=${FLAGS_FALSE} fi - finish_image "${disk_layout}" "${root_fs_dir}" "${update_group}" + finish_image "${disk_layout}" "${root_fs_dir}" # Make the filesystem un-mountable as read-write. if [[ ${disable_read_write} -eq ${FLAGS_TRUE} ]]; then