run opted-in agents in a user namespace with a dedicated data owner
This commit is contained in:
parent
5ae0205e1d
commit
bfdf603d12
1 changed files with 828 additions and 21 deletions
|
|
@ -512,7 +512,7 @@ fn carry_nix_state(
|
|||
/// owned by `uid:gid`), or `None` when `base` or an existing component is not a
|
||||
/// real directory. The container could have replaced any of them by a link, and
|
||||
/// this runs as root.
|
||||
fn own_dir(base: &Path, parts: &[&str], uid: u32, gid: u32) -> Result<Option<PathBuf>> {
|
||||
pub(crate) fn own_dir(base: &Path, parts: &[&str], uid: u32, gid: u32) -> Result<Option<PathBuf>> {
|
||||
let mut path = base.to_path_buf();
|
||||
if !std::fs::symlink_metadata(&path).is_ok_and(|m| m.is_dir()) {
|
||||
return Ok(None);
|
||||
|
|
@ -711,7 +711,7 @@ fn is_regular(path: &Path) -> bool {
|
|||
/// `systemctl is-active` answers `inactive` or `failed` for a unit that is not
|
||||
/// running; anything else (`active`, `activating`, `deactivating`) means the
|
||||
/// root is, or is about to be, in use.
|
||||
fn unit_is_stopped(container: &str) -> Result<bool> {
|
||||
pub(crate) fn unit_is_stopped(container: &str) -> Result<bool> {
|
||||
let out = std::process::Command::new("systemctl")
|
||||
.args(["is-active", &format!("container@{container}.service")])
|
||||
.output()
|
||||
|
|
|
|||
Loading…
Reference in a new issue