@@ -13,6 +13,7 @@ pub(crate) mod config;
1313mod osbuild;
1414pub ( crate ) mod osconfig;
1515
16+ use std:: collections:: HashMap ;
1617use std:: io:: Write ;
1718use std:: os:: fd:: { AsFd , AsRawFd } ;
1819use std:: os:: unix:: process:: CommandExt ;
@@ -37,11 +38,11 @@ use chrono::prelude::*;
3738use clap:: ValueEnum ;
3839use fn_error_context:: context;
3940use ostree:: gio;
40- use ostree_ext:: container as ostree_container;
4141use ostree_ext:: oci_spec;
4242use ostree_ext:: ostree;
4343use ostree_ext:: prelude:: Cast ;
4444use ostree_ext:: sysroot:: SysrootLock ;
45+ use ostree_ext:: { container as ostree_container, ostree_prepareroot} ;
4546#[ cfg( feature = "install-to-disk" ) ]
4647use rustix:: fs:: FileTypeExt ;
4748use rustix:: fs:: MetadataExt as _;
@@ -349,6 +350,8 @@ pub(crate) struct State {
349350 #[ allow( dead_code) ]
350351 pub ( crate ) config_opts : InstallConfigOpts ,
351352 pub ( crate ) target_imgref : ostree_container:: OstreeImageReference ,
353+ #[ allow( dead_code) ]
354+ pub ( crate ) prepareroot_config : HashMap < String , String > ,
352355 pub ( crate ) install_config : Option < config:: InstallConfiguration > ,
353356 /// The parsed contents of the authorized_keys (not the file path)
354357 pub ( crate ) root_ssh_authorized_keys : Option < String > ,
@@ -1267,6 +1270,20 @@ async fn prepare_install(
12671270 tracing:: debug!( "No install configuration found" ) ;
12681271 }
12691272
1273+ // Convert the keyfile to a hashmap because GKeyFile isnt Send for probably bad reasons.
1274+ let prepareroot_config = {
1275+ let kf = ostree_prepareroot:: require_config_from_root ( & rootfs) ?;
1276+ let mut r = HashMap :: new ( ) ;
1277+ for grp in kf. groups ( ) {
1278+ for key in kf. keys ( & grp) ? {
1279+ let key = key. as_str ( ) ;
1280+ let value = kf. value ( & grp, key) ?;
1281+ r. insert ( format ! ( "{grp}.{key}" ) , value. to_string ( ) ) ;
1282+ }
1283+ }
1284+ r
1285+ } ;
1286+
12701287 // Eagerly read the file now to ensure we error out early if e.g. it doesn't exist,
12711288 // instead of much later after we're 80% of the way through an install.
12721289 let root_ssh_authorized_keys = config_opts
@@ -1284,6 +1301,7 @@ async fn prepare_install(
12841301 config_opts,
12851302 target_imgref,
12861303 install_config,
1304+ prepareroot_config,
12871305 root_ssh_authorized_keys,
12881306 container_root : rootfs,
12891307 tempdir,
0 commit comments