@@ -57,6 +57,12 @@ pub(crate) enum BlockSetup {
57
57
Tpm2Luks ,
58
58
}
59
59
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
+
60
66
impl Default for BlockSetup {
61
67
fn default ( ) -> Self {
62
68
Self :: Direct
@@ -196,6 +202,20 @@ pub(crate) fn install_create_rootfs(
196
202
. context ( "Absolute device path in /dev/ required" ) ?;
197
203
let device = devdir. join ( reldevice) ;
198
204
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
+
199
219
let root_size = opts
200
220
. root_size
201
221
. as_deref ( )
@@ -305,18 +325,7 @@ pub(crate) fn install_create_rootfs(
305
325
} ;
306
326
307
327
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
+
320
329
let ( rootdev, root_blockdev_kargs) = match block_setup {
321
330
BlockSetup :: Direct => ( base_rootdev, None ) ,
322
331
BlockSetup :: Tpm2Luks => {
0 commit comments