3
3
//! See <https://github.com/osbuild/bootc-image-builder>
4
4
//!
5
5
6
+ use std:: process:: Command ;
7
+
6
8
use anyhow:: Result ;
9
+ use bootc_utils:: CommandRunExt as _;
7
10
use camino:: Utf8Path ;
8
11
use cap_std_ext:: { cap_std:: fs:: Dir , cmdext:: CapStdExtCommandExt } ;
9
12
use fn_error_context:: context;
10
13
11
- use crate :: task:: Task ;
12
-
13
14
/// Handle /etc/containers readonly mount.
14
15
///
15
16
/// Ufortunately today podman requires that /etc be writable for
@@ -30,14 +31,12 @@ fn adjust_etc_containers(tempdir: &Dir) -> Result<()> {
30
31
tempdir. create_dir_all ( "etc-ovl/upper" ) ?;
31
32
tempdir. create_dir ( "etc-ovl/work" ) ?;
32
33
let opts = format ! ( "lowerdir={etc_containers},workdir=etc-ovl/work,upperdir=etc-ovl/upper" ) ;
33
- let mut t = Task :: new (
34
- & format ! ( "Mount transient overlayfs for {etc_containers}" ) ,
35
- "mount" ,
36
- )
37
- . args ( [ "-t" , "overlay" , "overlay" , "-o" , opts. as_str ( ) ] )
38
- . arg ( etc_containers) ;
39
- t. cmd . cwd_dir ( tempdir. try_clone ( ) ?) ;
40
- t. run ( ) ?;
34
+ Command :: new ( "mount" )
35
+ . log_debug ( )
36
+ . args ( [ "-t" , "overlay" , "overlay" , "-o" , opts. as_str ( ) ] )
37
+ . arg ( etc_containers)
38
+ . cwd_dir ( tempdir. try_clone ( ) ?)
39
+ . run ( ) ?;
41
40
Ok ( ( ) )
42
41
}
43
42
@@ -55,10 +54,11 @@ fn propagate_run_osbuild_containers(root: &Dir) -> Result<()> {
55
54
}
56
55
let relative_storage = Utf8Path :: new ( crate :: podman:: CONTAINER_STORAGE . trim_start_matches ( '/' ) ) ;
57
56
root. create_dir_all ( relative_storage) ?;
58
- Task :: new ( "Creating bind mount for run/osbuild/containers" , "mount" )
57
+ Command :: new ( "mount" )
58
+ . log_debug ( )
59
59
. arg ( "--rbind" )
60
60
. args ( [ osbuild_run_containers, relative_storage] )
61
- . cwd ( root) ?
61
+ . cwd_dir ( root. try_clone ( ) ? )
62
62
. run ( ) ?;
63
63
Ok ( ( ) )
64
64
}
0 commit comments