@@ -200,7 +200,7 @@ pub(crate) struct State {
200
200
pub ( crate ) setenforce_guard : Option < crate :: lsm:: SetEnforceGuard > ,
201
201
#[ allow( dead_code) ]
202
202
pub ( crate ) config_opts : InstallConfigOpts ,
203
- pub ( crate ) target_opts : InstallTargetOpts ,
203
+ pub ( crate ) target_imgref : ostree_container :: OstreeImageReference ,
204
204
pub ( crate ) install_config : config:: InstallConfiguration ,
205
205
}
206
206
@@ -435,32 +435,8 @@ async fn initialize_ostree_root_from_self(
435
435
) -> Result < InstallAleph > {
436
436
let rootfs_dir = & root_setup. rootfs_fd ;
437
437
let rootfs = root_setup. rootfs . as_path ( ) ;
438
- let opts = & state. target_opts ;
439
438
let cancellable = gio:: Cancellable :: NONE ;
440
439
441
- // Parse the target CLI image reference options and create the *target* image
442
- // reference, which defaults to pulling from a registry.
443
- let target_sigverify = if opts. target_no_signature_verification {
444
- SignatureSource :: ContainerPolicyAllowInsecure
445
- } else if let Some ( remote) = opts. target_ostree_remote . as_deref ( ) {
446
- SignatureSource :: OstreeRemote ( remote. to_string ( ) )
447
- } else {
448
- SignatureSource :: ContainerPolicy
449
- } ;
450
- let target_imgname = opts
451
- . target_imgref
452
- . as_deref ( )
453
- . unwrap_or ( state. source . imageref . name . as_str ( ) ) ;
454
- let target_transport = ostree_container:: Transport :: try_from ( opts. target_transport . as_str ( ) ) ?;
455
- let target_imgref = ostree_container:: OstreeImageReference {
456
- sigverify : target_sigverify,
457
- imgref : ostree_container:: ImageReference {
458
- transport : target_transport,
459
- name : target_imgname. to_string ( ) ,
460
- } ,
461
- } ;
462
- tracing:: debug!( "Target image reference: {target_imgref}" ) ;
463
-
464
440
// TODO: make configurable?
465
441
let stateroot = STATEROOT_DEFAULT ;
466
442
Task :: new_and_run (
@@ -535,12 +511,12 @@ async fn initialize_ostree_root_from_self(
535
511
. collect :: < Vec < _ > > ( ) ;
536
512
let mut options = ostree_container:: deploy:: DeployOpts :: default ( ) ;
537
513
options. kargs = Some ( kargs. as_slice ( ) ) ;
538
- options. target_imgref = Some ( & target_imgref) ;
514
+ options. target_imgref = Some ( & state . target_imgref ) ;
539
515
options. proxy_cfg = Some ( proxy_cfg) ;
540
516
println ! ( "Creating initial deployment" ) ;
517
+ let target_image = state. target_imgref . to_string ( ) ;
541
518
let state =
542
519
ostree_container:: deploy:: deploy ( & sysroot, stateroot, & src_imageref, Some ( options) ) . await ?;
543
- let target_image = target_imgref. to_string ( ) ;
544
520
let digest = state. manifest_digest . as_str ( ) ;
545
521
println ! ( "Installed: {target_image}" ) ;
546
522
println ! ( " Digest: {digest}" ) ;
@@ -816,6 +792,30 @@ async fn prepare_install(
816
792
817
793
let source = SourceInfo :: from_container ( & container_info) ?;
818
794
795
+ // Parse the target CLI image reference options and create the *target* image
796
+ // reference, which defaults to pulling from a registry.
797
+ let target_sigverify = if target_opts. target_no_signature_verification {
798
+ SignatureSource :: ContainerPolicyAllowInsecure
799
+ } else if let Some ( remote) = target_opts. target_ostree_remote . as_deref ( ) {
800
+ SignatureSource :: OstreeRemote ( remote. to_string ( ) )
801
+ } else {
802
+ SignatureSource :: ContainerPolicy
803
+ } ;
804
+ let target_imgname = target_opts
805
+ . target_imgref
806
+ . as_deref ( )
807
+ . unwrap_or ( source. imageref . name . as_str ( ) ) ;
808
+ let target_transport =
809
+ ostree_container:: Transport :: try_from ( target_opts. target_transport . as_str ( ) ) ?;
810
+ let target_imgref = ostree_container:: OstreeImageReference {
811
+ sigverify : target_sigverify,
812
+ imgref : ostree_container:: ImageReference {
813
+ transport : target_transport,
814
+ name : target_imgname. to_string ( ) ,
815
+ } ,
816
+ } ;
817
+ tracing:: debug!( "Target image reference: {target_imgref}" ) ;
818
+
819
819
ensure_var ( ) ?;
820
820
propagate_tmp_mounts_to_host ( ) ?;
821
821
@@ -841,7 +841,7 @@ async fn prepare_install(
841
841
setenforce_guard,
842
842
source,
843
843
config_opts,
844
- target_opts ,
844
+ target_imgref ,
845
845
install_config,
846
846
} ) ;
847
847
0 commit comments