@@ -255,6 +255,7 @@ async fn initialize_ostree_root_from_self(
255
255
root_setup : & RootSetup ,
256
256
kargs : & [ & str ] ,
257
257
) -> Result < InstallAleph > {
258
+ let rootfs_dir = & root_setup. rootfs_fd ;
258
259
let rootfs = root_setup. rootfs . as_path ( ) ;
259
260
let opts = & state. opts ;
260
261
let cancellable = gio:: Cancellable :: NONE ;
@@ -312,18 +313,17 @@ async fn initialize_ostree_root_from_self(
312
313
[ "admin" , "init-fs" , "--modern" , rootfs. as_str ( ) ] ,
313
314
) ?;
314
315
315
- let repopath = & rootfs. join ( "ostree/repo" ) ;
316
316
for ( k, v) in [ ( "sysroot.bootloader" , "none" ) , ( "sysroot.readonly" , "true" ) ] {
317
317
Task :: new ( "Configuring ostree repo" , "ostree" )
318
- . args ( [ "config" , "--repo" , repopath. as_str ( ) , "set" , k, v] )
318
+ . args ( [ "config" , "--repo" , "ostree/repo" , "set" , k, v] )
319
+ . root ( rootfs_dir) ?
319
320
. quiet ( )
320
321
. run ( ) ?;
321
322
}
322
- Task :: new_and_run (
323
- "Initializing sysroot" ,
324
- "ostree" ,
325
- [ "admin" , "os-init" , stateroot, "--sysroot" , rootfs. as_str ( ) ] ,
326
- ) ?;
323
+ Task :: new ( "Initializing sysroot" , "ostree" )
324
+ . args ( [ "admin" , "os-init" , stateroot, "--sysroot" , "." ] )
325
+ . root ( rootfs_dir) ?
326
+ . run ( ) ?;
327
327
328
328
// Ensure everything in the ostree repo is labeled
329
329
lsm_label ( & rootfs. join ( "ostree" ) , "/usr" . into ( ) , true ) ?;
@@ -376,9 +376,7 @@ async fn initialize_ostree_root_from_self(
376
376
. ok_or_else ( || anyhow:: anyhow!( "Failed to find deployment" ) ) ?;
377
377
// SAFETY: There must be a path
378
378
let path = sysroot. deployment_dirpath ( & deployment) . unwrap ( ) ;
379
- let sysroot_dir = cap_std:: fs:: Dir :: open_ambient_dir ( rootfs, cap_std:: ambient_authority ( ) )
380
- . context ( "Opening rootfs" ) ?;
381
- let root = sysroot_dir
379
+ let root = rootfs_dir
382
380
. open_dir ( path. as_str ( ) )
383
381
. context ( "Opening deployment dir" ) ?;
384
382
let mut f = {
@@ -782,11 +780,10 @@ pub(crate) async fn install(opts: InstallOpts) -> Result<()> {
782
780
println ! ( "Installed Ignition config from {ignition_file}" ) ;
783
781
}
784
782
785
- Task :: new_and_run (
786
- "Setting root immutable bit" ,
787
- "chattr" ,
788
- [ "+i" , rootfs. rootfs . as_str ( ) ] ,
789
- ) ?;
783
+ Task :: new ( "Setting root immutable bit" , "chattr" )
784
+ . root ( & rootfs. rootfs_fd ) ?
785
+ . args ( [ "+i" , "." ] )
786
+ . run ( ) ?;
790
787
791
788
Task :: new_and_run ( "Trimming filesystems" , "fstrim" , [ "-a" , "-v" ] ) ?;
792
789
0 commit comments