diff --git a/src/main.rs b/src/main.rs index 669741d..cbf53a8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -81,6 +81,14 @@ struct ChrootCommand { block_device: PathBuf, } +fn fix_fstab(fstab: String) -> String { + fstab + .lines() + .filter(|line| !line.contains("swap") && !line.starts_with('#')) + .collect::>() + .join("\n") +} + fn create(command: CreateCommand) -> Result<(), Error> { let sgdisk = Tool::find("sgdisk")?; let pacstrap = Tool::find("pacstrap")?; @@ -147,12 +155,13 @@ fn create(command: CreateCommand) -> Result<(), Error> { ]).args(&command.extra_packages) .run(ErrorKind::Pacstrap)?; - let fstab = genfstab - .execute() - .arg("-U") - .arg(mount_point.path()) - .run_text_output(ErrorKind::Fstab)? - .replace("relatime", "noatime"); + let fstab = fix_fstab( + genfstab + .execute() + .arg("-U") + .arg(mount_point.path()) + .run_text_output(ErrorKind::Fstab)?, + ); debug!("fstab:\n{}", fstab); fs::write(mount_point.path().join("etc/fstab"), fstab).context(ErrorKind::Fstab)?; @@ -257,7 +266,7 @@ fn main() { Err(error) => { error!("{}", error); if let Some(cause) = error.cause() { - error!(" {}", cause); + error!("Caused by: {}", cause); } exit(1); } diff --git a/src/mountstack.rs b/src/mountstack.rs index b39bbba..9fee2c3 100644 --- a/src/mountstack.rs +++ b/src/mountstack.rs @@ -47,7 +47,7 @@ impl<'a> MountStack<'a> { Some(source), target.as_ref(), Some(filesystem.to_type()), - MsFlags::empty(), + MsFlags::MS_NOATIME, options, )?; self.targets.push(target);