@@ -609,7 +609,7 @@ async fn install_container(
609
609
state : & State ,
610
610
root_setup : & RootSetup ,
611
611
sysroot : & ostree:: Sysroot ,
612
- ) -> Result < InstallAleph > {
612
+ ) -> Result < ( ostree :: Deployment , InstallAleph ) > {
613
613
let sepolicy = state. load_policy ( ) ?;
614
614
let sepolicy = sepolicy. as_ref ( ) ;
615
615
let stateroot = STATEROOT_DEFAULT ;
@@ -766,7 +766,7 @@ async fn install_container(
766
766
selinux : state. selinux_state . to_aleph ( ) . to_string ( ) ,
767
767
} ;
768
768
769
- Ok ( aleph)
769
+ Ok ( ( deployment , aleph) )
770
770
}
771
771
772
772
/// Run a command in the host mount namespace
@@ -1235,18 +1235,19 @@ async fn install_to_filesystem_impl(state: &State, rootfs: &mut RootSetup) -> Re
1235
1235
. ok_or_else ( || anyhow ! ( "No uuid for boot/root" ) ) ?;
1236
1236
tracing:: debug!( "boot uuid={boot_uuid}" ) ;
1237
1237
1238
- // Write the aleph data that captures the system state at the time of provisioning for aid in future debugging.
1238
+ // Initialize the ostree sysroot (repo, stateroot, etc.)
1239
1239
let sysroot = initialize_ostree_root ( state, rootfs) . await ?;
1240
- {
1241
- let aleph = install_container ( state, rootfs, & sysroot) . await ?;
1242
- rootfs
1243
- . rootfs_fd
1244
- . atomic_replace_with ( BOOTC_ALEPH_PATH , |f| {
1245
- serde_json:: to_writer ( f, & aleph) ?;
1246
- anyhow:: Ok ( ( ) )
1247
- } )
1248
- . context ( "Writing aleph version" ) ?;
1249
- }
1240
+ // And actually set up the container in that root, returning a deployment and
1241
+ // the aleph state (see below).
1242
+ let ( deployment, aleph) = install_container ( state, rootfs, & sysroot) . await ?;
1243
+ // Write the aleph data that captures the system state at the time of provisioning for aid in future debugging.
1244
+ rootfs
1245
+ . rootfs_fd
1246
+ . atomic_replace_with ( BOOTC_ALEPH_PATH , |f| {
1247
+ serde_json:: to_writer ( f, & aleph) ?;
1248
+ anyhow:: Ok ( ( ) )
1249
+ } )
1250
+ . context ( "Writing aleph version" ) ?;
1250
1251
if cfg ! ( target_arch = "s390x" ) {
1251
1252
// TODO: Integrate s390x support into install_via_bootupd
1252
1253
crate :: bootloader:: install_via_zipl ( & rootfs. device_info , boot_uuid) ?;
@@ -1258,6 +1259,10 @@ async fn install_to_filesystem_impl(state: &State, rootfs: &mut RootSetup) -> Re
1258
1259
) ?;
1259
1260
}
1260
1261
1262
+ // After this point, we need to drop all open references to the filesystem
1263
+ drop ( deployment) ;
1264
+ drop ( sysroot) ;
1265
+
1261
1266
tracing:: debug!( "Installed bootloader" ) ;
1262
1267
1263
1268
// Finalize mounted filesystems
0 commit comments