tool: only sync ESP filesystem
This commit is contained in:
parent
f13848606f
commit
3895c94eb5
|
@ -1,12 +1,13 @@
|
||||||
use std::collections::{BTreeMap, BTreeSet};
|
use std::collections::{BTreeMap, BTreeSet};
|
||||||
use std::fs;
|
use std::fs::{self, File};
|
||||||
|
use std::os::fd::AsRawFd;
|
||||||
use std::os::unix::prelude::PermissionsExt;
|
use std::os::unix::prelude::PermissionsExt;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::string::ToString;
|
use std::string::ToString;
|
||||||
|
|
||||||
use anyhow::{anyhow, Context, Result};
|
use anyhow::{anyhow, Context, Result};
|
||||||
use nix::unistd::sync;
|
use nix::unistd::syncfs;
|
||||||
use tempfile::TempDir;
|
use tempfile::TempDir;
|
||||||
|
|
||||||
use crate::esp::{EspGenerationPaths, EspPaths};
|
use crate::esp::{EspGenerationPaths, EspPaths};
|
||||||
|
@ -161,7 +162,8 @@ impl Installer {
|
||||||
// Sync files to persistent storage. This may improve the
|
// Sync files to persistent storage. This may improve the
|
||||||
// chance of a consistent boot directory in case the system
|
// chance of a consistent boot directory in case the system
|
||||||
// crashes.
|
// crashes.
|
||||||
sync();
|
let boot = File::open(&self.esp_paths.esp).context("Failed to open ESP root directory.")?;
|
||||||
|
syncfs(boot.as_raw_fd()).context("Failed to sync ESP filesystem.")?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue