strum_macros = "0.18.0"
# See discussion in https://github.com/coreos/rpm-ostree/pull/2569#issuecomment-780569188
rpmostree-client = { git = "https://github.com/coreos/rpm-ostree", tag = "v2021.3" }
+xshell = "0.2.3"
# This one I might publish to crates.io, not sure yet
with-procspawn-tempdir = { git = "https://github.com/cgwalters/with-procspawn-tempdir" }
use cap_std_ext::dirext::*;
use cap_std_ext::rustix::fs::MetadataExt;
use rand::Rng;
-use sh_inline::bash;
use std::fs::File;
use std::io::prelude::*;
use std::os::unix::fs::FileExt as UnixFileExt;
use std::path::Path;
+use xshell::cmd;
use crate::test::*;
ostref: &str,
percentage: u32,
) -> Result<()> {
+ let sh = xshell::Shell::new()?;
assert!(percentage > 0 && percentage <= 100);
let repo_path = repo_path.as_ref();
let tempdir = tempfile::tempdir_in(repo_path.join("tmp"))?;
}
assert!(mutated > 0);
println!("Mutated ELF files: {}", mutated);
- bash!("ostree --repo=${repo} commit --consume -b ${ostref} --base=${ostref} --tree=dir=${tempdir} --owner-uid 0 --owner-gid 0 --selinux-policy-from-base --link-checkout-speedup --no-bindings --no-xattrs",
- repo = repo_path,
- ostref = ostref,
- tempdir = tempdir.path()).context("Failed to commit updated content")?;
- Ok(())
+ let tempdir = tempdir.path();
+ cmd!(sh, "ostree --repo={repo_path} commit --consume -b {ostref} --base={ostref} --tree=dir={tempdir} --owner-uid 0 --owner-gid 0 --selinux-policy-from-base --link-checkout-speedup --no-bindings --no-xattrs").run().context("Failed to commit updated content")
}