From cc126d77b46e2faa8d00eba02f6b8c06693c2fb7 Mon Sep 17 00:00:00 2001 From: Jan De Landtsheer Date: Fri, 10 Oct 2025 10:11:58 +0200 Subject: [PATCH] mount: mount ESP at /boot alongside data runtimes Add /boot root mount planning for VFAT ESP outputs, reuse the idempotent mount logic to skip duplicates, and ensure /etc/fstab includes both /var/mounts/{UUID} and the ESP when enabled. --- src/mount/ops.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/mount/ops.rs b/src/mount/ops.rs index 1ae2f68..a870136 100644 --- a/src/mount/ops.rs +++ b/src/mount/ops.rs @@ -48,6 +48,7 @@ use std::path::Path; use tracing::info; const ROOT_BASE: &str = "/var/mounts"; +const BOOT_TARGET: &str = "/boot"; const TARGET_SYSTEM: &str = "/var/cache/system"; const TARGET_ETC: &str = "/var/cache/etc"; const TARGET_MODULES: &str = "/var/cache/modules"; @@ -204,6 +205,16 @@ pub fn plan_mounts(fs_results: &[FsResult], _cfg: &Config) -> Result // Determine primary UUID let primary_uuid = Some(data[0].uuid.clone()); + // Optional ESP (VFAT) mount at /boot + if let Some(esp) = fs_results.iter().find(|r| matches!(r.kind, FsKind::Vfat)) { + root_mounts.push(PlannedMount { + uuid: esp.uuid.clone(), + target: BOOT_TARGET.to_string(), + fstype: fstype_str(esp.kind).to_string(), + options: "rw".to_string(), + }); + } + // Subvol mounts only from primary FS let primary = data[0]; let mut subvol_mounts: Vec = Vec::new(); @@ -452,7 +463,7 @@ pub fn maybe_write_fstab(mounts: &[MountResult], cfg: &Config) -> Result<()> { // Partition mount results into runtime root mounts and final subvolume targets. let mut root_entries: Vec<&MountResult> = mounts .iter() - .filter(|m| m.target.starts_with(ROOT_BASE)) + .filter(|m| m.target.starts_with(ROOT_BASE) || m.target == BOOT_TARGET) .collect(); let wanted = [TARGET_ETC, TARGET_MODULES, TARGET_SYSTEM, TARGET_VM_META]; let mut subvol_entries: Vec<&MountResult> = mounts