Skip to content

Commit e82f97f

Browse files
committed
install: Print more information when making filesystems
- Label is mandatory so change the API to always take it - Print the label we're using as a description of the fs - Also print the fs type as it's notable info Signed-off-by: Colin Walters <[email protected]>
1 parent 7af0aec commit e82f97f

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lib/src/install/baseline.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,14 @@ fn sgdisk_partition(
119119
fn mkfs<'a>(
120120
dev: &str,
121121
fs: Filesystem,
122-
label: Option<&'_ str>,
122+
label: &str,
123123
opts: impl IntoIterator<Item = &'a str>,
124124
) -> Result<uuid::Uuid> {
125125
let u = uuid::Uuid::new_v4();
126-
let mut t = Task::new("Creating filesystem", format!("mkfs.{fs}"));
126+
let mut t = Task::new(
127+
&format!("Creating {label} filesystem ({fs})"),
128+
format!("mkfs.{fs}"),
129+
);
127130
match fs {
128131
Filesystem::Xfs => {
129132
t.cmd.arg("-m");
@@ -135,9 +138,7 @@ fn mkfs<'a>(
135138
}
136139
};
137140
// Today all the above mkfs commands take -L
138-
if let Some(label) = label {
139-
t.cmd.args(["-L", label]);
140-
}
141+
t.cmd.args(["-L", label]);
141142
t.cmd.args(opts);
142143
t.cmd.arg(dev);
143144
// All the mkfs commands are unnecessarily noisy by default
@@ -366,10 +367,10 @@ pub(crate) fn install_create_rootfs(
366367

367368
// Initialize the /boot filesystem
368369
let bootdev = &findpart(BOOTPN)?;
369-
let boot_uuid = mkfs(bootdev, bootfs_type, Some("boot"), []).context("Initializing /boot")?;
370+
let boot_uuid = mkfs(bootdev, bootfs_type, "boot", []).context("Initializing /boot")?;
370371

371372
// Initialize rootfs
372-
let root_uuid = mkfs(&rootdev, root_filesystem, Some("root"), [])?;
373+
let root_uuid = mkfs(&rootdev, root_filesystem, "root", [])?;
373374
let rootarg = format!("root=UUID={root_uuid}");
374375
let bootsrc = format!("UUID={boot_uuid}");
375376
let bootarg = format!("boot={bootsrc}");

0 commit comments

Comments
 (0)