Просмотр исходного кода

* apt-pkg/contrib/fileutl.cc, apt-pkg/deb/dpkgpm.cc:
- honor Dpkg::Chroot-Directory in the RunScripts*() methods

Michael Vogt лет назад: 15
Родитель
Сommit
cfba4f6908
3 измененных файлов с 20 добавлено и 0 удалено
  1. 9 0
      apt-pkg/contrib/fileutl.cc
  2. 9 0
      apt-pkg/deb/dpkgpm.cc
  3. 2 0
      debian/changelog

+ 9 - 0
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);
 	 

+ 9 - 0
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";

+ 2 - 0
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