From 33d2af560067286424e7f0e1ee3e929a18108ec5 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Tue, 4 Apr 2023 11:10:38 +0200 Subject: [PATCH] build_library: Adapt to /oem being the new OEM partition mountpoint This requires us to add another directory to keep when removing a regenerable state from rootfs. Other changes were straightforward find and replace. --- build_library/build_image_util.sh | 19 ++++++++++++++----- build_library/disk_layout.json | 2 +- build_library/vm_image_util.sh | 8 ++++---- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/build_library/build_image_util.sh b/build_library/build_image_util.sh index dad7554f78..214c0f46fc 100755 --- a/build_library/build_image_util.sh +++ b/build_library/build_image_util.sh @@ -855,12 +855,21 @@ EOF # container. if [[ -n "${image_kernel}" ]]; then local folder - # Everything except /boot and /usr because they are mountpoints and /lost+found because e2fsck expects it for folder in "${root_fs_dir}/"*; do - if [ "${folder}" = "${root_fs_dir}/boot" ] || [ "${folder}" = "${root_fs_dir}/usr" ] || [ "${folder}" = "${root_fs_dir}/lost+found" ]; then - continue - fi - sudo rm --one-file-system -rf "${folder}" + case "${folder#"${root_fs_dir}"}" in + /boot|/usr|/oem) + # Keep those because they are mountpoints, so not really + # parts of the rootfs state. + : + ;; + /lost+found) + # Keep lost+found because e2fsck expects it. + : + ;; + *) + sudo rm --one-file-system -rf "${folder}" + ;; + esac done else # For the developer container we still need to remove the resolv.conf symlink to /run diff --git a/build_library/disk_layout.json b/build_library/disk_layout.json index 5db159b6f8..896a0b2391 100644 --- a/build_library/disk_layout.json +++ b/build_library/disk_layout.json @@ -53,7 +53,7 @@ "blocks":"262144", "fs_type":"btrfs", "fs_compression":"zlib", - "mount":"/usr/share/oem" + "mount":"/oem" }, "7":{ "label":"OEM-CONFIG", diff --git a/build_library/vm_image_util.sh b/build_library/vm_image_util.sh index 55ba775fe5..9738565aa5 100644 --- a/build_library/vm_image_util.sh +++ b/build_library/vm_image_util.sh @@ -483,7 +483,7 @@ install_oem_package() { --root="${oem_tmp}" --sysroot="${oem_tmp}" \ --root-deps=rdeps --usepkgonly ${getbinpkg} \ --verbose --jobs=2 "${oem_pkg}" - sudo rsync -a "${oem_tmp}/usr/share/oem/" "${VM_TMP_ROOT}/usr/share/oem/" + sudo rsync -a "${oem_tmp}/oem/" "${VM_TMP_ROOT}/oem/" sudo rm -rf "${oem_tmp}" } @@ -511,7 +511,7 @@ install_oem_aci() { info "Installing ${oem_aci} OEM ACI" sudo install -Dpm 0644 \ "${aci_path}" \ - "${VM_TMP_ROOT}/usr/share/oem/flatcar-oem-${oem_aci}.aci" || + "${VM_TMP_ROOT}/oem/flatcar-oem-${oem_aci}.aci" || die "Could not install ${oem_aci} OEM ACI" # Remove aci_dir if building ACI and installing it succeeded rm -rf "${aci_dir}" @@ -529,8 +529,8 @@ run_fs_hook() { _run_box_fs_hook() { # Copy basic Vagrant configs from OEM mkdir -p "${VM_TMP_DIR}/box" - cp -R "${VM_TMP_ROOT}/usr/share/oem/box/." "${VM_TMP_DIR}/box" - sudo rm -fr "${VM_TMP_ROOT}/usr/share/oem/box" + cp -R "${VM_TMP_ROOT}/oem/box/." "${VM_TMP_DIR}/box" + sudo rm -fr "${VM_TMP_ROOT}/oem/box" } # Write the vm disk image to the target directory in the proper format