@@ -359,14 +359,17 @@ async fn deploy(
359359}
360360
361361#[ 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 > {
363363 let origin = glib:: KeyFile :: new ( ) ;
364364 let imgref = OstreeImageReference :: from ( imgref. clone ( ) ) ;
365365 origin. set_string (
366366 "origin" ,
367367 ostree_container:: deploy:: ORIGIN_CONTAINER ,
368368 imgref. to_string ( ) . as_str ( ) ,
369369 ) ;
370+ if backend == Backend :: Container {
371+ origin. set_string ( "bootc" , "backend" , "container" ) ;
372+ }
370373 Ok ( origin)
371374}
372375
@@ -380,7 +383,7 @@ pub(crate) async fn stage(
380383 opts : Option < ostree:: SysrootDeployTreeOpts < ' _ > > ,
381384) -> Result < ( ) > {
382385 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 ) ?;
384387 crate :: deploy:: deploy (
385388 sysroot,
386389 merge_deployment. as_ref ( ) ,
@@ -482,9 +485,13 @@ fn find_newest_deployment_name(deploysdir: &Dir) -> Result<String> {
482485}
483486
484487// 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 > {
486493 // First, just create the new origin file
487- let origin = origin_from_imageref ( imgref) ?;
494+ let origin = origin_from_imageref ( imgref, backend ) ?;
488495 let serialized_origin = origin. to_data ( ) ;
489496
490497 // Now, we can't rely on being officially booted (e.g. with the `ostree=` karg)
@@ -544,7 +551,7 @@ fn test_switch_inplace() -> Result<()> {
544551 signature : None ,
545552 } ;
546553 {
547- let origin = origin_from_imageref ( & orig_imgref) ?;
554+ let origin = origin_from_imageref ( & orig_imgref, Backend :: OstreeContainer ) ?;
548555 deploydir. atomic_write (
549556 format ! ( "{target_deployment}.origin" ) ,
550557 origin. to_data ( ) . as_bytes ( ) ,
@@ -557,7 +564,7 @@ fn test_switch_inplace() -> Result<()> {
557564 signature : None ,
558565 } ;
559566
560- let replaced = switch_origin_inplace ( & td, & target_imgref) . unwrap ( ) ;
567+ let replaced = switch_origin_inplace ( & td, & target_imgref, Backend :: OstreeContainer ) . unwrap ( ) ;
561568 assert_eq ! ( replaced, target_deployment) ;
562569 Ok ( ( ) )
563570}
0 commit comments