@@ -357,14 +357,17 @@ async fn deploy(
357
357
}
358
358
359
359
#[ context( "Generating origin" ) ]
360
- fn origin_from_imageref ( imgref : & ImageReference ) -> Result < glib:: KeyFile > {
360
+ fn origin_from_imageref ( imgref : & ImageReference , backend : Backend ) -> Result < glib:: KeyFile > {
361
361
let origin = glib:: KeyFile :: new ( ) ;
362
362
let imgref = OstreeImageReference :: from ( imgref. clone ( ) ) ;
363
363
origin. set_string (
364
364
"origin" ,
365
365
ostree_container:: deploy:: ORIGIN_CONTAINER ,
366
366
imgref. to_string ( ) . as_str ( ) ,
367
367
) ;
368
+ if backend == Backend :: Container {
369
+ origin. set_string ( "bootc" , "backend" , "container" ) ;
370
+ }
368
371
Ok ( origin)
369
372
}
370
373
@@ -377,7 +380,7 @@ pub(crate) async fn stage(
377
380
spec : & RequiredHostSpec < ' _ > ,
378
381
) -> Result < ( ) > {
379
382
let merge_deployment = sysroot. merge_deployment ( Some ( stateroot) ) ;
380
- let origin = origin_from_imageref ( spec. image ) ?;
383
+ let origin = origin_from_imageref ( spec. image , image . backend ) ?;
381
384
crate :: deploy:: deploy (
382
385
sysroot,
383
386
merge_deployment. as_ref ( ) ,
@@ -478,9 +481,13 @@ fn find_newest_deployment_name(deploysdir: &Dir) -> Result<String> {
478
481
}
479
482
480
483
// Implementation of `bootc switch --in-place`
481
- pub ( crate ) fn switch_origin_inplace ( root : & Dir , imgref : & ImageReference ) -> Result < String > {
484
+ pub ( crate ) fn switch_origin_inplace (
485
+ root : & Dir ,
486
+ imgref : & ImageReference ,
487
+ backend : Backend ,
488
+ ) -> Result < String > {
482
489
// First, just create the new origin file
483
- let origin = origin_from_imageref ( imgref) ?;
490
+ let origin = origin_from_imageref ( imgref, backend ) ?;
484
491
let serialized_origin = origin. to_data ( ) ;
485
492
486
493
// Now, we can't rely on being officially booted (e.g. with the `ostree=` karg)
@@ -540,7 +547,7 @@ fn test_switch_inplace() -> Result<()> {
540
547
signature : None ,
541
548
} ;
542
549
{
543
- let origin = origin_from_imageref ( & orig_imgref) ?;
550
+ let origin = origin_from_imageref ( & orig_imgref, Backend :: OstreeContainer ) ?;
544
551
deploydir. atomic_write (
545
552
format ! ( "{target_deployment}.origin" ) ,
546
553
origin. to_data ( ) . as_bytes ( ) ,
@@ -553,7 +560,7 @@ fn test_switch_inplace() -> Result<()> {
553
560
signature : None ,
554
561
} ;
555
562
556
- let replaced = switch_origin_inplace ( & td, & target_imgref) . unwrap ( ) ;
563
+ let replaced = switch_origin_inplace ( & td, & target_imgref, Backend :: OstreeContainer ) . unwrap ( ) ;
557
564
assert_eq ! ( replaced, target_deployment) ;
558
565
Ok ( ( ) )
559
566
}
0 commit comments