Skip to content

Commit e2dc1ca

Browse files
committed
install: Make /tmp mount idempotent
Just so that the output of `findmnt` looks cleaner. Signed-off-by: Colin Walters <[email protected]>
1 parent d832d4e commit e2dc1ca

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/src/install.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -642,10 +642,12 @@ pub(crate) async fn install(opts: InstallOpts) -> Result<()> {
642642

643643
// Let's ensure we have a tmpfs on /tmp, because we need that to write the SELinux label
644644
// (it won't work on the default overlayfs)
645-
Task::new("Creating tmpfs on /tmp", "mount")
646-
.quiet()
647-
.args(["-t", "tmpfs", "tmpfs", "/tmp"])
648-
.run()?;
645+
if nix::sys::statfs::statfs("/tmp")?.filesystem_type() != nix::sys::statfs::TMPFS_MAGIC {
646+
Task::new("Creating tmpfs on /tmp", "mount")
647+
.quiet()
648+
.args(["-t", "tmpfs", "tmpfs", "/tmp"])
649+
.run()?;
650+
}
649651

650652
// Now, deal with SELinux state.
651653
let srcdata = gather_source_data()?;

0 commit comments

Comments
 (0)