Skip to content

Commit 7af0aec

Browse files
committed
install: Explicitly print which block setup we're using
This is an important thing. Signed-off-by: Colin Walters <[email protected]>
1 parent 1bafdba commit 7af0aec

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

lib/src/install/baseline.rs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ pub(crate) enum BlockSetup {
5757
Tpm2Luks,
5858
}
5959

60+
impl Display for BlockSetup {
61+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
62+
self.to_possible_value().unwrap().get_name().fmt(f)
63+
}
64+
}
65+
6066
impl Default for BlockSetup {
6167
fn default() -> Self {
6268
Self::Direct
@@ -196,6 +202,20 @@ pub(crate) fn install_create_rootfs(
196202
.context("Absolute device path in /dev/ required")?;
197203
let device = devdir.join(reldevice);
198204

205+
// Use the install configuration to find the block setup, if we have one
206+
let block_setup = if let Some(config) = state.install_config.as_ref() {
207+
config.get_block_setup(opts.block_setup.as_ref().copied())?
208+
} else if opts.filesystem.is_some() {
209+
// Otherwise, if a filesystem is specified then we default to whatever was
210+
// specified via --block-setup, or the default
211+
opts.block_setup.unwrap_or_default()
212+
} else {
213+
// If there was no default filesystem, then there's no default block setup,
214+
// and we need to error out.
215+
anyhow::bail!("No install configuration found, and no filesystem specified")
216+
};
217+
println!("Using block setup: {block_setup}");
218+
199219
let root_size = opts
200220
.root_size
201221
.as_deref()
@@ -305,18 +325,7 @@ pub(crate) fn install_create_rootfs(
305325
};
306326

307327
let base_rootdev = findpart(ROOTPN)?;
308-
// Use the install configuration to find the block setup, if we have one
309-
let block_setup = if let Some(config) = state.install_config.as_ref() {
310-
config.get_block_setup(opts.block_setup.as_ref().copied())?
311-
} else if opts.filesystem.is_some() {
312-
// Otherwise, if a filesystem is specified then we default to whatever was
313-
// specified via --block-setup, or the default
314-
opts.block_setup.unwrap_or_default()
315-
} else {
316-
// If there was no default filesystem, then there's no default block setup,
317-
// and we need to error out.
318-
anyhow::bail!("No install configuration found, and no filesystem specified")
319-
};
328+
320329
let (rootdev, root_blockdev_kargs) = match block_setup {
321330
BlockSetup::Direct => (base_rootdev, None),
322331
BlockSetup::Tpm2Luks => {

0 commit comments

Comments
 (0)