| 392 | } |
| 393 | |
| 394 | pub fn validate_sandbox_rootfs(rootfs: &Path) -> Result<(), String> { |
| 395 | require_rootfs_path(rootfs, SANDBOX_GUEST_INIT_PATH)?; |
| 396 | require_rootfs_path(rootfs, SANDBOX_SUPERVISOR_PATH)?; |
| 397 | require_rootfs_path(rootfs, SANDBOX_UMOCI_PATH)?; |
| 398 | require_any_rootfs_path(rootfs, &["/bin/bash"])?; |
| 399 | require_any_rootfs_path(rootfs, &["/bin/mount", "/usr/bin/mount"])?; |
| 400 | require_any_rootfs_path( |
| 401 | rootfs, |
| 402 | &[ |
| 403 | "/usr/sbin/chroot", |
| 404 | "/usr/bin/chroot", |
| 405 | "/sbin/chroot", |
| 406 | "/bin/chroot", |
| 407 | ], |
| 408 | )?; |
| 409 | require_any_rootfs_path( |
| 410 | rootfs, |
| 411 | &["/sbin/ip", "/usr/sbin/ip", "/bin/ip", "/usr/bin/ip"], |
| 412 | )?; |
| 413 | require_any_rootfs_path(rootfs, &["/bin/sed", "/usr/bin/sed"])?; |
| 414 | Ok(()) |
| 415 | } |
| 416 | |
| 417 | fn create_sandbox_mountpoint(path: &Path) -> Result<(), String> { |
| 418 | fs::create_dir_all(path).map_err(|e| format!("create {}: {e}", path.display()))?; |