MCPcopy Create free account
hub / github.com/bootc-dev/bootc / read_boot_fstab_entry

Function read_boot_fstab_entry

crates/lib/src/install.rs:2782–2809  ·  view source on GitHub ↗

Read the /boot entry from /etc/fstab, if it exists

(root: &Dir)

Source from the content-addressed store, hash-verified

2780
2781/// Read the /boot entry from /etc/fstab, if it exists
2782fn read_boot_fstab_entry(root: &Dir) -> Result<Option<MountSpec>> {
2783 let fstab_path = "etc/fstab";
2784 let fstab = match root.open_optional(fstab_path)? {
2785 Some(f) => f,
2786 None => return Ok(None),
2787 };
2788
2789 let reader = std::io::BufReader::new(fstab);
2790 for line in std::io::BufRead::lines(reader) {
2791 let line = line?;
2792 let line = line.trim();
2793
2794 // Skip empty lines and comments
2795 if line.is_empty() || line.starts_with('#') {
2796 continue;
2797 }
2798
2799 // Parse the mount spec
2800 let spec = MountSpec::from_str(line)?;
2801
2802 // Check if this is a /boot entry
2803 if spec.target == "/boot" {
2804 return Ok(Some(spec));
2805 }
2806 }
2807
2808 Ok(None)
2809}
2810
2811pub(crate) async fn install_reset(opts: InstallResetOpts) -> Result<()> {
2812 let rootfs = &Dir::open_ambient_dir("/", cap_std::ambient_authority())?;

Callers 3

install_to_filesystemFunction · 0.85
install_resetFunction · 0.85

Calls 1

is_emptyMethod · 0.45

Tested by 1