diff options
-rw-r--r-- | apt-pkg/contrib/fileutl.cc | 9 | ||||
-rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 9 | ||||
-rw-r--r-- | debian/changelog | 2 |
3 files changed, 20 insertions, 0 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 52f517ee0..935c4bebf 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -62,6 +62,15 @@ bool RunScripts(const char *Cnf) // This is the child if (Child == 0) { + 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("/tmp/") != 0) _exit(100); diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 7d0d34a46..5747f1164 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -308,6 +308,15 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf) SetCloseExec(STDIN_FILENO,false); SetCloseExec(STDERR_FILENO,false); + 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); + } + const char *Args[4]; Args[0] = "/bin/sh"; Args[1] = "-c"; diff --git a/debian/changelog b/debian/changelog index 68c83808b..ff5675a0c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,8 @@ apt (0.8.12) UNRELEASED; urgency=low * apt-pkg/deb/debindexfile.cc: - ignore missing deb-src files in /var/lib/apt/lists, thanks to Thorsten Spindler (LP: #85590) + * apt-pkg/contrib/fileutl.cc, apt-pkg/deb/dpkgpm.cc: + - honor Dpkg::Chroot-Directory in the RunScripts*() methods -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 10 Feb 2011 17:37:56 +0100 |