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