mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-07 13:06:59 +02:00
fix(build_library): Skip modifying non-existent partitions.
To make it possible to plop a CoreOS install into a simple single-filesystem image for use as a container some things like configuring bootloaders need to be skipped.
This commit is contained in:
parent
ee6b9ee1f9
commit
54f774d931
@ -151,17 +151,22 @@ finish_image() {
|
||||
--group="${update_group}" \
|
||||
--board="${BOARD}"
|
||||
|
||||
${BUILD_LIBRARY_DIR}/configure_bootloaders.sh \
|
||||
--arch=${ARCH} \
|
||||
--disk_layout="${disk_layout}" \
|
||||
--boot_dir="${root_fs_dir}"/usr/boot \
|
||||
--esp_dir="${root_fs_dir}"/boot/efi \
|
||||
--boot_args="${FLAGS_boot_args}"
|
||||
# Only configure bootloaders if there is a boot partition
|
||||
if mountpoint -q "${root_fs_dir}"/boot/efi; then
|
||||
${BUILD_LIBRARY_DIR}/configure_bootloaders.sh \
|
||||
--arch=${ARCH} \
|
||||
--disk_layout="${disk_layout}" \
|
||||
--boot_dir="${root_fs_dir}"/usr/boot \
|
||||
--esp_dir="${root_fs_dir}"/boot/efi \
|
||||
--boot_args="${FLAGS_boot_args}"
|
||||
fi
|
||||
|
||||
# Zero all fs free space to make it more compressible so auto-update
|
||||
# payloads become smaller, not fatal since it won't work on linux < 3.2
|
||||
sudo fstrim "${root_fs_dir}" || true
|
||||
sudo fstrim "${root_fs_dir}/usr" || true
|
||||
if mountpoint -q "${root_fs_dir}/usr"; then
|
||||
sudo fstrim "${root_fs_dir}/usr" || true
|
||||
fi
|
||||
|
||||
cleanup_mounts "${root_fs_dir}"
|
||||
trap - EXIT
|
||||
|
@ -63,10 +63,16 @@ EOF
|
||||
sudo rm ${root_fs_dir}/etc/xinetd.d/rsyncd
|
||||
sudo rmdir ${root_fs_dir}/etc/xinetd.d
|
||||
|
||||
# Only try to disable rw on /usr if there is a /usr partition
|
||||
local disable_read_write=${FLAGS_enable_rootfs_verification}
|
||||
if ! mountpoint -q "${root_fs_dir}/usr"; then
|
||||
disable_read_write=${FLAGS_FALSE}
|
||||
fi
|
||||
|
||||
finish_image "${disk_layout}" "${root_fs_dir}" "${update_group}"
|
||||
|
||||
# Make the filesystem un-mountable as read-write.
|
||||
if [ ${FLAGS_enable_rootfs_verification} -eq ${FLAGS_TRUE} ]; then
|
||||
if [[ ${disable_read_write} -eq ${FLAGS_TRUE} ]]; then
|
||||
"${BUILD_LIBRARY_DIR}/disk_util" --disk_layout="${disk_layout}" \
|
||||
tune --disable2fs_rw "${BUILD_DIR}/${image_name}" "USR-A"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user