@@ -13,6 +13,7 @@ pub(crate) mod config;
13
13
mod osbuild;
14
14
pub ( crate ) mod osconfig;
15
15
16
+ use std:: collections:: HashMap ;
16
17
use std:: io:: Write ;
17
18
use std:: os:: fd:: { AsFd , AsRawFd } ;
18
19
use std:: os:: unix:: process:: CommandExt ;
@@ -37,11 +38,11 @@ use chrono::prelude::*;
37
38
use clap:: ValueEnum ;
38
39
use fn_error_context:: context;
39
40
use ostree:: gio;
40
- use ostree_ext:: container as ostree_container;
41
41
use ostree_ext:: oci_spec;
42
42
use ostree_ext:: ostree;
43
43
use ostree_ext:: prelude:: Cast ;
44
44
use ostree_ext:: sysroot:: SysrootLock ;
45
+ use ostree_ext:: { container as ostree_container, ostree_prepareroot} ;
45
46
#[ cfg( feature = "install-to-disk" ) ]
46
47
use rustix:: fs:: FileTypeExt ;
47
48
use rustix:: fs:: MetadataExt as _;
@@ -349,6 +350,8 @@ pub(crate) struct State {
349
350
#[ allow( dead_code) ]
350
351
pub ( crate ) config_opts : InstallConfigOpts ,
351
352
pub ( crate ) target_imgref : ostree_container:: OstreeImageReference ,
353
+ #[ allow( dead_code) ]
354
+ pub ( crate ) prepareroot_config : HashMap < String , String > ,
352
355
pub ( crate ) install_config : Option < config:: InstallConfiguration > ,
353
356
/// The parsed contents of the authorized_keys (not the file path)
354
357
pub ( crate ) root_ssh_authorized_keys : Option < String > ,
@@ -1267,6 +1270,20 @@ async fn prepare_install(
1267
1270
tracing:: debug!( "No install configuration found" ) ;
1268
1271
}
1269
1272
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
+
1270
1287
// Eagerly read the file now to ensure we error out early if e.g. it doesn't exist,
1271
1288
// instead of much later after we're 80% of the way through an install.
1272
1289
let root_ssh_authorized_keys = config_opts
@@ -1284,6 +1301,7 @@ async fn prepare_install(
1284
1301
config_opts,
1285
1302
target_imgref,
1286
1303
install_config,
1304
+ prepareroot_config,
1287
1305
root_ssh_authorized_keys,
1288
1306
container_root : rootfs,
1289
1307
tempdir,
0 commit comments