]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/deb/dpkgpm.cc
merged the lp:~mvo/apt/mvo branch
[apt.git] / apt-pkg / deb / dpkgpm.cc
index 7b0955b96bd8390849df74f5474116d4b5fa81d3..eb9abe909fef1d4b2505a4579842f096443cec27 100644 (file)
@@ -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";