@@ -358,14 +358,17 @@ async fn deploy(
358358}
359359
360360#[ 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 > {
362362 let origin = glib:: KeyFile :: new ( ) ;
363363 let imgref = OstreeImageReference :: from ( imgref. clone ( ) ) ;
364364 origin. set_string (
365365 "origin" ,
366366 ostree_container:: deploy:: ORIGIN_CONTAINER ,
367367 imgref. to_string ( ) . as_str ( ) ,
368368 ) ;
369+ if backend == Backend :: Container {
370+ origin. set_string ( "bootc" , "backend" , "container" ) ;
371+ }
369372 Ok ( origin)
370373}
371374
@@ -379,7 +382,7 @@ pub(crate) async fn stage(
379382 opts : Option < ostree:: SysrootDeployTreeOpts < ' _ > > ,
380383) -> Result < ( ) > {
381384 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 ) ?;
383386 crate :: deploy:: deploy (
384387 sysroot,
385388 merge_deployment. as_ref ( ) ,
@@ -479,9 +482,13 @@ fn find_newest_deployment_name(deploysdir: &Dir) -> Result<String> {
479482}
480483
481484// 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 > {
483490 // First, just create the new origin file
484- let origin = origin_from_imageref ( imgref) ?;
491+ let origin = origin_from_imageref ( imgref, backend ) ?;
485492 let serialized_origin = origin. to_data ( ) ;
486493
487494 // Now, we can't rely on being officially booted (e.g. with the `ostree=` karg)
@@ -541,7 +548,7 @@ fn test_switch_inplace() -> Result<()> {
541548 signature : None ,
542549 } ;
543550 {
544- let origin = origin_from_imageref ( & orig_imgref) ?;
551+ let origin = origin_from_imageref ( & orig_imgref, Backend :: OstreeContainer ) ?;
545552 deploydir. atomic_write (
546553 format ! ( "{target_deployment}.origin" ) ,
547554 origin. to_data ( ) . as_bytes ( ) ,
@@ -554,7 +561,7 @@ fn test_switch_inplace() -> Result<()> {
554561 signature : None ,
555562 } ;
556563
557- let replaced = switch_origin_inplace ( & td, & target_imgref) . unwrap ( ) ;
564+ let replaced = switch_origin_inplace ( & td, & target_imgref, Backend :: OstreeContainer ) . unwrap ( ) ;
558565 assert_eq ! ( replaced, target_deployment) ;
559566 Ok ( ( ) )
560567}
0 commit comments