Skip to content

Commit

Permalink
Merge pull request #718 from sacsant/xfs-fix
Browse files Browse the repository at this point in the history
install: Force mkfs.xfs to overwrite
  • Loading branch information
cgwalters authored Jul 23, 2024
2 parents 60543cf + 754eae3 commit 356943a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/src/install/baseline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ fn mkfs<'a>(
dev: &str,
fs: Filesystem,
label: &str,
wipe: bool,
opts: impl IntoIterator<Item = &'a str>,
) -> Result<uuid::Uuid> {
let devinfo = crate::blockdev::list_dev(dev.into())?;
Expand All @@ -135,6 +136,9 @@ fn mkfs<'a>(
);
match fs {
Filesystem::Xfs => {
if wipe {
t.cmd.arg("-f");
}
t.cmd.arg("-m");
t.cmd.arg(format!("uuid={u}"));
}
Expand Down Expand Up @@ -381,15 +385,21 @@ pub(crate) fn install_create_rootfs(
};
let boot_uuid = if let Some(bootdev) = bootdev {
Some(
mkfs(bootdev.node.as_str(), root_filesystem, "boot", [])
.context("Initializing /boot")?,
mkfs(
bootdev.node.as_str(),
root_filesystem,
"boot",
opts.wipe,
[],
)
.context("Initializing /boot")?,
)
} else {
None
};

// Initialize rootfs
let root_uuid = mkfs(&rootdev, root_filesystem, "root", [])?;
let root_uuid = mkfs(&rootdev, root_filesystem, "root", opts.wipe, [])?;
let rootarg = format!("root=UUID={root_uuid}");
let bootsrc = boot_uuid.as_ref().map(|uuid| format!("UUID={uuid}"));
let bootarg = bootsrc.as_deref().map(|bootsrc| format!("boot={bootsrc}"));
Expand Down

0 comments on commit 356943a

Please sign in to comment.