33//! See <https://github.com/osbuild/bootc-image-builder>
44//!
55
6+ use std:: process:: Command ;
7+
68use anyhow:: Result ;
9+ use bootc_utils:: CommandRunExt as _;
710use camino:: Utf8Path ;
811use cap_std_ext:: { cap_std:: fs:: Dir , cmdext:: CapStdExtCommandExt } ;
912use fn_error_context:: context;
1013
11- use crate :: task:: Task ;
12-
1314/// Handle /etc/containers readonly mount.
1415///
1516/// Ufortunately today podman requires that /etc be writable for
@@ -30,14 +31,12 @@ fn adjust_etc_containers(tempdir: &Dir) -> Result<()> {
3031 tempdir. create_dir_all ( "etc-ovl/upper" ) ?;
3132 tempdir. create_dir ( "etc-ovl/work" ) ?;
3233 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 ( ) ?;
4140 Ok ( ( ) )
4241}
4342
@@ -55,10 +54,11 @@ fn propagate_run_osbuild_containers(root: &Dir) -> Result<()> {
5554 }
5655 let relative_storage = Utf8Path :: new ( crate :: podman:: CONTAINER_STORAGE . trim_start_matches ( '/' ) ) ;
5756 root. create_dir_all ( relative_storage) ?;
58- Task :: new ( "Creating bind mount for run/osbuild/containers" , "mount" )
57+ Command :: new ( "mount" )
58+ . log_debug ( )
5959 . arg ( "--rbind" )
6060 . args ( [ osbuild_run_containers, relative_storage] )
61- . cwd ( root) ?
61+ . cwd_dir ( root. try_clone ( ) ? )
6262 . run ( ) ?;
6363 Ok ( ( ) )
6464}
0 commit comments