@@ -357,14 +357,17 @@ async fn deploy(
357357} 
358358
359359#[ 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 >  { 
361361    let  origin = glib:: KeyFile :: new ( ) ; 
362362    let  imgref = OstreeImageReference :: from ( imgref. clone ( ) ) ; 
363363    origin. set_string ( 
364364        "origin" , 
365365        ostree_container:: deploy:: ORIGIN_CONTAINER , 
366366        imgref. to_string ( ) . as_str ( ) , 
367367    ) ; 
368+     if  backend == Backend :: Container  { 
369+         origin. set_string ( "bootc" ,  "backend" ,  "container" ) ; 
370+     } 
368371    Ok ( origin) 
369372} 
370373
@@ -377,7 +380,7 @@ pub(crate) async fn stage(
377380    spec :  & RequiredHostSpec < ' _ > , 
378381)  -> Result < ( ) >  { 
379382    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 ) ?; 
381384    crate :: deploy:: deploy ( 
382385        sysroot, 
383386        merge_deployment. as_ref ( ) , 
@@ -478,9 +481,13 @@ fn find_newest_deployment_name(deploysdir: &Dir) -> Result<String> {
478481} 
479482
480483// 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 >  { 
482489    // First, just create the new origin file 
483-     let  origin = origin_from_imageref ( imgref) ?; 
490+     let  origin = origin_from_imageref ( imgref,  backend ) ?; 
484491    let  serialized_origin = origin. to_data ( ) ; 
485492
486493    // Now, we can't rely on being officially booted (e.g. with the `ostree=` karg) 
@@ -540,7 +547,7 @@ fn test_switch_inplace() -> Result<()> {
540547        signature :  None , 
541548    } ; 
542549    { 
543-         let  origin = origin_from_imageref ( & orig_imgref) ?; 
550+         let  origin = origin_from_imageref ( & orig_imgref,   Backend :: OstreeContainer ) ?; 
544551        deploydir. atomic_write ( 
545552            format ! ( "{target_deployment}.origin" ) , 
546553            origin. to_data ( ) . as_bytes ( ) , 
@@ -553,7 +560,7 @@ fn test_switch_inplace() -> Result<()> {
553560        signature :  None , 
554561    } ; 
555562
556-     let  replaced = switch_origin_inplace ( & td,  & target_imgref) . unwrap ( ) ; 
563+     let  replaced = switch_origin_inplace ( & td,  & target_imgref,   Backend :: OstreeContainer ) . unwrap ( ) ; 
557564    assert_eq ! ( replaced,  target_deployment) ; 
558565    Ok ( ( ) ) 
559566} 
0 commit comments