context/unshare: mount proc and dev/pts
This commit is contained in:
@@ -172,9 +172,12 @@ impl UnshareDriver {
|
|||||||
|
|
||||||
cmd.arg("--map-user=65536")
|
cmd.arg("--map-user=65536")
|
||||||
.arg("--map-group=65536")
|
.arg("--map-group=65536")
|
||||||
|
.arg("--mount-proc")
|
||||||
.arg("--pid")
|
.arg("--pid")
|
||||||
.arg("--ipc")
|
.arg("--ipc")
|
||||||
.arg("--uts")
|
.arg("--uts")
|
||||||
|
.arg("--user")
|
||||||
|
.arg("--cgroup")
|
||||||
.arg("--map-auto")
|
.arg("--map-auto")
|
||||||
.arg("-r")
|
.arg("-r")
|
||||||
.arg("--mount")
|
.arg("--mount")
|
||||||
@@ -186,7 +189,11 @@ impl UnshareDriver {
|
|||||||
cmd.arg("-w").arg(dir);
|
cmd.arg("-w").arg(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.arg("--").arg(program).args(args);
|
cmd.arg("--").arg("bash").arg("-c").arg(format!(
|
||||||
|
"mount -t devpts devpts /dev/pts; mount --bind /dev/pts/ptmx /dev/ptmx; {} {}",
|
||||||
|
program,
|
||||||
|
args.join(" ")
|
||||||
|
));
|
||||||
|
|
||||||
cmd
|
cmd
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ impl EphemeralContextGuard {
|
|||||||
.command("mmdebstrap")
|
.command("mmdebstrap")
|
||||||
.arg("--variant=buildd")
|
.arg("--variant=buildd")
|
||||||
.arg("--mode=unshare")
|
.arg("--mode=unshare")
|
||||||
|
.arg("--include=mount")
|
||||||
.arg("--format=tar")
|
.arg("--format=tar")
|
||||||
.arg(series)
|
.arg(series)
|
||||||
.arg(tarball_path.to_string_lossy().to_string())
|
.arg(tarball_path.to_string_lossy().to_string())
|
||||||
@@ -112,7 +113,7 @@ impl EphemeralContextGuard {
|
|||||||
|
|
||||||
impl Drop for EphemeralContextGuard {
|
impl Drop for EphemeralContextGuard {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
log::debug!("Cleaning up ephemeral context...");
|
log::debug!("Cleaning up ephemeral context ({:?})...", &self.chroot_path);
|
||||||
// Reset to normal context
|
// Reset to normal context
|
||||||
if let Err(e) = context::manager().set_current(&self.previous_context) {
|
if let Err(e) = context::manager().set_current(&self.previous_context) {
|
||||||
log::error!("Failed to restore context {}: {}", self.previous_context, e);
|
log::error!("Failed to restore context {}: {}", self.previous_context, e);
|
||||||
|
|||||||
Reference in New Issue
Block a user