1
1
//! Perform initial setup for a container image based system root
2
2
3
3
use std:: collections:: HashSet ;
4
+ #[ cfg( feature = "bootc" ) ]
4
5
use std:: os:: fd:: BorrowedFd ;
5
- use std:: process:: Command ;
6
6
7
7
use anyhow:: Result ;
8
- use bootc_utils:: CommandRunExt ;
9
- use cap_std_ext:: cmdext:: CapStdExtCommandExt ;
10
8
use fn_error_context:: context;
11
- use ocidir:: cap_std:: fs:: Dir ;
12
9
use ostree:: glib;
13
10
14
11
use super :: store:: { gc_image_layers, LayeredImageState } ;
@@ -58,6 +55,7 @@ pub struct DeployOpts<'a> {
58
55
59
56
// Access the file descriptor for a sysroot
60
57
#[ allow( unsafe_code) ]
58
+ #[ cfg( feature = "bootc" ) ]
61
59
pub ( crate ) fn sysroot_fd ( sysroot : & ostree:: Sysroot ) -> BorrowedFd {
62
60
unsafe { BorrowedFd :: borrow_raw ( sysroot. fd ( ) ) }
63
61
}
@@ -72,7 +70,6 @@ pub async fn deploy(
72
70
imgref : & OstreeImageReference ,
73
71
options : Option < DeployOpts < ' _ > > ,
74
72
) -> Result < Box < LayeredImageState > > {
75
- let sysroot_dir = & Dir :: reopen_dir ( & sysroot_fd ( sysroot) ) ?;
76
73
let cancellable = ostree:: gio:: Cancellable :: NONE ;
77
74
let options = options. unwrap_or_default ( ) ;
78
75
let repo = & sysroot. repo ( ) ;
@@ -147,9 +144,15 @@ pub async fn deploy(
147
144
// doesn't try to invoke this, as that won't work right now.
148
145
#[ cfg( feature = "bootc" ) ]
149
146
if !options. skip_completion {
147
+ use bootc_utils:: CommandRunExt ;
148
+ use cap_std_ext:: cmdext:: CapStdExtCommandExt ;
149
+ use ocidir:: cap_std:: fs:: Dir ;
150
+
151
+ let sysroot_dir = & Dir :: reopen_dir ( & sysroot_fd ( sysroot) ) ?;
152
+
150
153
// Note that the sysroot is provided as `.` but we use cwd_dir to
151
154
// make the process current working directory the sysroot.
152
- let st = Command :: new ( "/proc/self/exe" )
155
+ let st = std :: process :: Command :: new ( "/proc/self/exe" )
153
156
. args ( [ "internals" , "bootc-install-completion" , "." , stateroot] )
154
157
. cwd_dir ( sysroot_dir. try_clone ( ) ?)
155
158
. lifecycle_bind ( )
0 commit comments