feat: initial implementation of Depot package manager
- Implement source-based package management with support for archives and Git - Add multi-system build support (Autotools, CMake, Meson, Rust/Cargo, Custom) - Implement atomic installation logic using transactions and fakeroot - Add dependency resolution for build-time and runtime requirements - Implement package indexing and local repository management - Add comprehensive configuration system with system/package overrides - Include Project guidelines (AGENTS.md) and README.md
This commit is contained in:
Executable
+26
@@ -0,0 +1,26 @@
|
||||
//! Fakeroot support for running commands as pseudo-root
|
||||
//! Uses the system fakeroot command when not running as root
|
||||
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
|
||||
/// Check if we're running as root
|
||||
pub fn is_root() -> bool {
|
||||
nix::unistd::geteuid().is_root()
|
||||
}
|
||||
|
||||
/// Wrap a command for fakeroot execution
|
||||
/// For make install, we use the system fakeroot command
|
||||
pub fn wrap_install_command(program: &str, destdir: &Path) -> Command {
|
||||
if is_root() {
|
||||
Command::new(program)
|
||||
} else {
|
||||
// Use system fakeroot command which handles LD_PRELOAD internally
|
||||
let mut cmd = Command::new("fakeroot");
|
||||
cmd.arg("--");
|
||||
cmd.arg(program);
|
||||
// Fakeroot will ensure file ownership appears as root
|
||||
cmd.env("DESTDIR", destdir);
|
||||
cmd
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user