* Applied patch from Amos Waterland <apw@us.ibm.com> to allow apt to
authorOtavio Salvador <otavio@ossystems.com.br>
Sun, 16 Dec 2007 20:22:24 +0000 (18:22 -0200)
committerOtavio Salvador <otavio@ossystems.com.br>
Sun, 16 Dec 2007 20:22:24 +0000 (18:22 -0200)
  work properly in initramfs, closes: #448316.

cmdline/apt-get.cc
debian/changelog

index efb618c..3bcacb2 100644 (file)
@@ -53,6 +53,7 @@
 #include <termios.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
+#include <sys/statfs.h>
 #include <sys/statvfs.h>
 #include <signal.h>
 #include <unistd.h>
@@ -63,6 +64,8 @@
 #include <sstream>
                                                                        /*}}}*/
 
+#define RAMFS_MAGIC     0x858458f6
+
 using namespace std;
 
 ostream c0out(0);
@@ -861,8 +864,13 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
         return _error->Errno("statvfs",_("Couldn't determine free space in %s"),
                              OutputDir.c_str());
       if (unsigned(Buf.f_bfree) < (FetchBytes - FetchPBytes)/Buf.f_bsize)
-        return _error->Error(_("You don't have enough free space in %s."),
-                             OutputDir.c_str());
+      {
+         struct statfs Stat;
+         if (statfs(OutputDir.c_str(),&Stat) != 0 ||
+                        unsigned(Stat.f_type) != RAMFS_MAGIC)
+            return _error->Error(_("You don't have enough free space in %s."),
+                OutputDir.c_str());
+      }
    }
    
    // Fail safe check
@@ -2188,8 +2196,13 @@ bool DoSource(CommandLine &CmdL)
       return _error->Errno("statvfs",_("Couldn't determine free space in %s"),
                           OutputDir.c_str());
    if (unsigned(Buf.f_bfree) < (FetchBytes - FetchPBytes)/Buf.f_bsize)
-      return _error->Error(_("You don't have enough free space in %s"),
-                          OutputDir.c_str());
+     {
+       struct statfs Stat;
+       if (statfs(OutputDir.c_str(),&Stat) != 0 || 
+           unsigned(Stat.f_type) != RAMFS_MAGIC) 
+          return _error->Error(_("You don't have enough free space in %s"),
+              OutputDir.c_str());
+      }
    
    // Number of bytes
    if (DebBytes != FetchBytes)
index 2d267a6..aa32414 100644 (file)
@@ -14,6 +14,8 @@ apt (0.7.10) UNRELEASED; urgency=low
     closes: #452862.
   * Applied patch from Alexander Winston <alexander.winston@comcast.net>
     to use 'min' as symbol for minute, closes: #219034.
+  * Applied patch from Amos Waterland <apw@us.ibm.com> to allow apt to
+    work properly in initramfs, closes: #448316.
 
   [ Program translations ]
     - Basque updated. Closes: #453088
@@ -39,7 +41,7 @@ apt (0.7.10) UNRELEASED; urgency=low
   * ftparchive/multicompress.cc:
     - support lzma output
 
- -- Otavio Salvador <otavio@ossystems.com.br>  Sat, 08 Dec 2007 12:13:58 -0200
+ -- Otavio Salvador <otavio@ossystems.com.br>  Sun, 16 Dec 2007 18:21:14 -0200
 
 apt (0.7.9) unstable; urgency=low