* apt-pkg/contrib/fileutl.cc, apt-pkg/deb/dpkgpm.cc:
authorMichael Vogt <michael.vogt@ubuntu.com>
Thu, 3 Mar 2011 16:09:30 +0000 (17:09 +0100)
committerMichael Vogt <michael.vogt@ubuntu.com>
Thu, 3 Mar 2011 16:09:30 +0000 (17:09 +0100)
  - honor Dpkg::Chroot-Directory in the RunScripts*() methods

apt-pkg/contrib/fileutl.cc
apt-pkg/deb/dpkgpm.cc
debian/changelog

index 52f517e..935c4be 100644 (file)
@@ -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);
         
index 7d0d34a..5747f11 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";
index 68c8380..ff5675a 100644 (file)
@@ -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