Skip to content

Commit 356943a

Browse files
authored
Merge pull request #718 from sacsant/xfs-fix
install: Force mkfs.xfs to overwrite
2 parents 60543cf + 754eae3 commit 356943a

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

lib/src/install/baseline.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ fn mkfs<'a>(
124124
dev: &str,
125125
fs: Filesystem,
126126
label: &str,
127+
wipe: bool,
127128
opts: impl IntoIterator<Item = &'a str>,
128129
) -> Result<uuid::Uuid> {
129130
let devinfo = crate::blockdev::list_dev(dev.into())?;
@@ -135,6 +136,9 @@ fn mkfs<'a>(
135136
);
136137
match fs {
137138
Filesystem::Xfs => {
139+
if wipe {
140+
t.cmd.arg("-f");
141+
}
138142
t.cmd.arg("-m");
139143
t.cmd.arg(format!("uuid={u}"));
140144
}
@@ -381,15 +385,21 @@ pub(crate) fn install_create_rootfs(
381385
};
382386
let boot_uuid = if let Some(bootdev) = bootdev {
383387
Some(
384-
mkfs(bootdev.node.as_str(), root_filesystem, "boot", [])
385-
.context("Initializing /boot")?,
388+
mkfs(
389+
bootdev.node.as_str(),
390+
root_filesystem,
391+
"boot",
392+
opts.wipe,
393+
[],
394+
)
395+
.context("Initializing /boot")?,
386396
)
387397
} else {
388398
None
389399
};
390400

391401
// Initialize rootfs
392-
let root_uuid = mkfs(&rootdev, root_filesystem, "root", [])?;
402+
let root_uuid = mkfs(&rootdev, root_filesystem, "root", opts.wipe, [])?;
393403
let rootarg = format!("root=UUID={root_uuid}");
394404
let bootsrc = boot_uuid.as_ref().map(|uuid| format!("UUID={uuid}"));
395405
let bootarg = bootsrc.as_deref().map(|bootsrc| format!("boot={bootsrc}"));

0 commit comments

Comments
 (0)