Package: autopartkit
Followup-For: Bug #248884

Patch attached - tested and works. 
Tested with both 2.4 and 2.6-kernel on i386

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.11-x300
Locale: LANG=nb_NO, LC_CTYPE=nb_NO (charmap=ISO-8859-1)
diff -ur autopartkit-1.08/debian/postinst autopartkit-1.08-lvm2/debian/postinst
--- autopartkit-1.08/debian/postinst	2004-03-30 21:08:26.000000000 +0200
+++ autopartkit-1.08-lvm2/debian/postinst	2005-05-14 23:52:21.000000000 +0200
@@ -26,10 +26,10 @@
 }
 # Try to load LVM support
 depmod -a >> $log 2>&1 || true
-modprobe lvm-mod >> $log 2>&1 || true
+modprobe dm-mod >> $log 2>&1 || true
 
 # Make sure it is installed into /target/ as well
-apt-install lvm10 || true
+apt-install lvm2 || true
 
 # Run all scripts to choose table file
 run_parts /usr/lib/autopartkit.d
diff -ur autopartkit-1.08/lvm.c autopartkit-1.08-lvm2/lvm.c
--- autopartkit-1.08/lvm.c	2005-03-19 10:44:46.000000000 +0100
+++ autopartkit-1.08-lvm2/lvm.c	2005-05-15 01:10:48.000000000 +0200
@@ -56,10 +56,11 @@
         return FALSE;
     }
 
-    /* Is /proc/lvm a directory? */
-    if ( 0 != stat("/proc/lvm", &statbuf) || ! S_ISDIR(statbuf.st_mode) )
+    /* Is /proc/lvm a directory, or device-mapper loaded ? */
+    if ((0 != system("grep -q \"[0-9] device-mapper\" /proc/misc" )) &&
+        (0 != stat("/proc/lvm", &statbuf) || ! S_ISDIR(statbuf.st_mode)))
     {
-        autopartkit_error(0, "Missing /proc/lvm/, no LVM support available.");
+        autopartkit_error(0, "Missing /proc/lvm/ and no device-mapper in /proc/nmisc, no LVM support available.");
         isinstalled = FALSE;
         return FALSE;
     }
@@ -294,7 +295,7 @@
     memset(&(spaceinfo->geom), 0, sizeof(spaceinfo->geom));
     autopartkit_log(2, "  Locating free space on volumegroup %s\n", vgname);
 
-    asprintf(&command, "/sbin/vgdisplay -c %s 2>&1", vgname);
+    asprintf(&command, "/sbin/vgdisplay -c %s 2>/dev/null", vgname);
     autopartkit_log(2, "  Running command: %s\n", command);
     vgdisplay = popen(command, "r");
     if (! vgdisplay ){
@@ -353,6 +354,7 @@
 	free(command);
         return 0;
     }
+    pclose (vgdisplay);
     free(command);
     return 1;
 }

Reply via email to