From 4b7cfe96d621ab8fc0cec1334f0cd5f9ea87bf6d Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 21 Jul 2009 13:52:48 +0200 Subject: * apt-pkg/deb/dpkgpm.cc: - provide DPkg::Chroot-Directory config option (useful for testing) --- apt-pkg/deb/dpkgpm.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 416860f35..f787f365e 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -866,6 +866,15 @@ bool pkgDPkgPM::Go(int OutStatusFd) } close(fd[0]); // close the read end of the pipe + if (_config->FindDir("DPkg::Chroot-Directory","/") != "/") + { + std::cerr << "Chrooting into " + << _config->FindDir("DPkg::Chroot-Directory") + << std::endl; + if (chroot(_config->FindDir("DPkg::Chroot-Directory","/").c_str()) != 0) + _exit(100); + } + if (chdir(_config->FindDir("DPkg::Run-Directory","/").c_str()) != 0) _exit(100); -- cgit v1.2.3