mirror of
https://github.com/philmmanjaro/alma.git
synced 2025-07-26 23:19:29 +02:00
Filter out local swap files from fstab (fix #17)
This commit is contained in:
parent
c65004d570
commit
7b81e6b3cf
17
src/main.rs
17
src/main.rs
@ -81,6 +81,14 @@ struct ChrootCommand {
|
|||||||
block_device: PathBuf,
|
block_device: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn fix_fstab(fstab: String) -> String {
|
||||||
|
fstab
|
||||||
|
.lines()
|
||||||
|
.filter(|line| !line.contains("swap") && !line.starts_with('#'))
|
||||||
|
.collect::<Vec<&str>>()
|
||||||
|
.join("\n")
|
||||||
|
}
|
||||||
|
|
||||||
fn create(command: CreateCommand) -> Result<(), Error> {
|
fn create(command: CreateCommand) -> Result<(), Error> {
|
||||||
let sgdisk = Tool::find("sgdisk")?;
|
let sgdisk = Tool::find("sgdisk")?;
|
||||||
let pacstrap = Tool::find("pacstrap")?;
|
let pacstrap = Tool::find("pacstrap")?;
|
||||||
@ -147,12 +155,13 @@ fn create(command: CreateCommand) -> Result<(), Error> {
|
|||||||
]).args(&command.extra_packages)
|
]).args(&command.extra_packages)
|
||||||
.run(ErrorKind::Pacstrap)?;
|
.run(ErrorKind::Pacstrap)?;
|
||||||
|
|
||||||
let fstab = genfstab
|
let fstab = fix_fstab(
|
||||||
|
genfstab
|
||||||
.execute()
|
.execute()
|
||||||
.arg("-U")
|
.arg("-U")
|
||||||
.arg(mount_point.path())
|
.arg(mount_point.path())
|
||||||
.run_text_output(ErrorKind::Fstab)?
|
.run_text_output(ErrorKind::Fstab)?,
|
||||||
.replace("relatime", "noatime");
|
);
|
||||||
debug!("fstab:\n{}", fstab);
|
debug!("fstab:\n{}", fstab);
|
||||||
fs::write(mount_point.path().join("etc/fstab"), fstab).context(ErrorKind::Fstab)?;
|
fs::write(mount_point.path().join("etc/fstab"), fstab).context(ErrorKind::Fstab)?;
|
||||||
|
|
||||||
@ -257,7 +266,7 @@ fn main() {
|
|||||||
Err(error) => {
|
Err(error) => {
|
||||||
error!("{}", error);
|
error!("{}", error);
|
||||||
if let Some(cause) = error.cause() {
|
if let Some(cause) = error.cause() {
|
||||||
error!(" {}", cause);
|
error!("Caused by: {}", cause);
|
||||||
}
|
}
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ impl<'a> MountStack<'a> {
|
|||||||
Some(source),
|
Some(source),
|
||||||
target.as_ref(),
|
target.as_ref(),
|
||||||
Some(filesystem.to_type()),
|
Some(filesystem.to_type()),
|
||||||
MsFlags::empty(),
|
MsFlags::MS_NOATIME,
|
||||||
options,
|
options,
|
||||||
)?;
|
)?;
|
||||||
self.targets.push(target);
|
self.targets.push(target);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user