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