[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#448316: apt does not work in initramfs



I hope your solution for successful test patch is put to good use. The Debian project benefits greatly.
 
Peace and blessings,
Luke

 
On 11/25/07, Amos Waterland <apw@us.ibm.com> wrote:
Here is a patch that I have tested successfully.

--- cmdline/apt-get.cc.orig     2007-11-26 02:46:17.000000000 +0000
+++ cmdline/apt-get.cc  2007-11-26 02:56:53.000000000 +0000
@@ -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>
@@ -62,6 +63,8 @@
#include <sys/wait.h>
                                                                       /*}}}*/

+#define RAMFS_MAGIC     0x858458f6
+
using namespace std;

ostream c0out(0);
@@ -846,8 +849,13 @@
        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
@@ -1989,8 +1997,13 @@
      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)



--
To UNSUBSCRIBE, email to deity-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: