Read the /boot entry from /etc/fstab, if it exists
(root: &Dir)
| 2780 | |
| 2781 | /// Read the /boot entry from /etc/fstab, if it exists |
| 2782 | fn 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 | |
| 2811 | pub(crate) async fn install_reset(opts: InstallResetOpts) -> Result<()> { |
| 2812 | let rootfs = &Dir::open_ambient_dir("/", cap_std::ambient_authority())?; |