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.
This commit is contained in:
Krzesimir Nowak 2023-04-04 11:10:38 +02:00
parent 84166fcc00
commit 33d2af5600
3 changed files with 19 additions and 10 deletions

View File

@ -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

View File

@ -53,7 +53,7 @@
"blocks":"262144",
"fs_type":"btrfs",
"fs_compression":"zlib",
"mount":"/usr/share/oem"
"mount":"/oem"
},
"7":{
"label":"OEM-CONFIG",

View File

@ -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