Skip to content

Commit

Permalink
move fstab outside of loop
Browse files Browse the repository at this point in the history
  • Loading branch information
korewaChino committed Oct 3, 2023
1 parent c64354e commit 38ac130
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,20 @@ impl PartitionLayout {

let mut fstab = String::new();

const PREPEND_COMMENT: &str = r#"
# /etc/fstab: static file system information.
# Automatically generated by Katsu Image Builder. See
# katsu::config::PartitionLayout::fstab for more information.
"#;

fstab.push_str(PREPEND_COMMENT.trim());

const LEGEND: &str =
"# <file system>\t<mount point>\t<type>\t<options>\t<dump>\t<pass>\n\n";

fstab.push_str(LEGEND.trim());

for part in &ordered.partitions {
// get devname by finding from mount, instead of index because we won't be using it as much
let mountpoint = PathBuf::from(&part.mountpoint);
Expand Down Expand Up @@ -334,19 +348,6 @@ impl PartitionLayout {
}
};

const PREPEND_COMMENT: &str = r#"
# /etc/fstab: static file system information.
# Automatically generated by Katsu Image Builder. See
# katsu::config::PartitionLayout::fstab for more information.
"#;

fstab.push_str(PREPEND_COMMENT.trim());

const LEGEND: &str = "# <file system>\t<mount point>\t<type>\t<options>\t<dump>\t<pass>\n\n";

fstab.push_str(LEGEND.trim());

let fsck = if part.filesystem == "efi" { "0" } else { "2" };

let entry = format!(
Expand Down

0 comments on commit 38ac130

Please sign in to comment.