Skip to content

Commit

Permalink
installer: Fix issue #5, improving fstab output
Browse files Browse the repository at this point in the history
We know all of our *supported* partitions are on GPT disks so we can safely assert
PARTUUID entries in the fstab. We also add a comment for the administrator to let
them know what block device (path) was used at the time of installation, ie what
maps to the PARTUUID.

Signed-off-by: Ikey Doherty <[email protected]>
  • Loading branch information
ikeycode committed Jul 10, 2024
1 parent a44f1fe commit b337bbd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
8 changes: 7 additions & 1 deletion crates/installer/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,13 @@ impl Installer {
s.push(Step::set_machine_id());

// Write the fstab
let fstab = EmitFstab::default().with_entries([FstabEntry::try_from(root_partition)?]);
let fstab = EmitFstab::default().with_entries([
FstabEntry::Comment(format!(
"{} at time of installation",
root_partition.partition.path.display()
)),
FstabEntry::try_from(root_partition)?,
]);
s.push(Step::emit_fstab(fstab));

// Get the sync call in for unmounts
Expand Down
11 changes: 6 additions & 5 deletions crates/installer/src/steps/postinstall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ impl Default for EmitFstab {
// template header
FstabEntry::Comment("/etc/fstab: static filesystem information.".to_string()),
FstabEntry::Comment(String::new()),
FstabEntry::Comment("<fs> <mountpoint> <type> <opts> <dump/pass>".to_string()),
FstabEntry::Comment("<fs> <mountpoint> <type> <opts> <dump> <pass>".to_string()),
FstabEntry::Comment(String::new()),
FstabEntry::Comment("/dev/ROOT / ext3 noatime 0 1".to_string()),
FstabEntry::Comment("/dev/SWAP none swap sw 0 0".to_string()),
FstabEntry::Comment("/dev/fd0 /mnt/floppy auto noauto 0 0".to_string()),
FstabEntry::Comment("/dev/ROOT / ext3 noatime 0 1".to_string()),
FstabEntry::Comment("/dev/SWAP none swap sw 0 0".to_string()),
FstabEntry::Comment("/dev/fd0 /mnt/floppy auto noauto 0 0".to_string()),
// proc
FstabEntry::Device {
fs: "none".into(),
Expand Down Expand Up @@ -169,7 +169,8 @@ impl TryFrom<&SystemPartition> for FstabEntry {
fn try_from(value: &SystemPartition) -> Result<Self, Error> {
// Honestly, this is a bit ext4 centric, no ssd care given
let s = Self::Device {
fs: format!("UUID={}", &value.partition.uuid),
// NOTE: This is always PartUUID for us, we only do GPT.
fs: format!("PARTUUID={}", &value.partition.uuid),
mountpoint: value.mountpoint.clone().ok_or_else(|| Error::NoMountpoint)?,
kind: value
.partition
Expand Down

0 comments on commit b337bbd

Please sign in to comment.