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

Bug#385888: autopartkit: should use update-dev



Package: autopartkit
Version: 1.19
Severity: wishlist

Instead of the sleep() hack, autopartkit should come into line with the
rest of d-i and use update-dev from di-utils to poke the kernel and udev
into creating devices. The attached patch should do the job, but I
haven't committed it because I can't test it myself. Could somebody
please try this out and commit it if it works?

Changelog entry:

  * Use update-dev rather than the sleep() hack to get the kernel and
    udev to create device nodes.

Thanks,

-- 
Colin Watson                                       [cjwatson@debian.org]
Index: debian/control
===================================================================
--- debian/control	(revision 40452)
+++ debian/control	(working copy)
@@ -9,7 +9,7 @@
 Package: autopartkit
 XC-Package-Type: udeb
 Architecture: any
-Depends: ${shlibs:Depends}, e2fsprogs-udeb, cdebconf-udeb (>= 0.43), disk-detect, md-modules, lvm10-udeb | lvm2-udeb, partconf-mkfstab, di-utils (>= 1.15)
+Depends: ${shlibs:Depends}, e2fsprogs-udeb, cdebconf-udeb (>= 0.43), disk-detect, md-modules, lvm10-udeb | lvm2-udeb, partconf-mkfstab, di-utils (>= 1.19)
 Provides: mounted-partitions, created-fstab, made-filesystems, partitioned-harddrives
 XB-Installer-Menu-Item: 50
 Description: Automatically Partition Hard Drives (unsafe)
Index: autopartkit.c
===================================================================
--- autopartkit.c	(revision 40452)
+++ autopartkit.c	(working copy)
@@ -106,9 +106,6 @@
 /* Ignore devfs devices, used in choose_dev */
 #define IGNORE_DEVFS_DEVICES 1
 
-/* sleep period to give udev time to create the devices */
-#define UDEV_SLEEP_HACK 3
-
 #if 1
 #define log_line() \
   autopartkit_log(2, "  Error bounding: %s %d\n",__FILE__,__LINE__)
@@ -1155,7 +1152,7 @@
                  * sure the device file is available when we need it.
                 */
                 ped_disk_commit(disk_maybe);
-                sleep(UDEV_SLEEP_HACK); /* Give the kernel a moment to create the device */
+                system("update-dev"); /* persuade the kernel to create the device */
 
                 makefs(mountmap[partcount].devpath, req_tmp->fstype);
 	    }
@@ -1186,7 +1183,7 @@
 		   make sure the device file is available when we need
 		   it. */
 		ped_disk_commit(disk_maybe);
-		sleep(UDEV_SLEEP_HACK); /* Give the kernel a moment to create the device */
+		system("update-dev"); /* persuade the kernel to create the device */
 
 		lvm_pv_stack_push(lvm_pv_stack, req_tmp->mountpoint, devpath);
 	    }
@@ -1265,7 +1262,7 @@
         free(vgname);
         free(devpath);
     }
-    sleep(UDEV_SLEEP_HACK); /* Give the kernel a moment to create the devices */
+    system("update-dev"); /* persuade the kernel to create the devices */
 
     /* Distribute logical volumes (andread@linpro.no) */
     lvm_vg_stack = lvm_vg_stack_new();
@@ -1363,7 +1360,7 @@
 		autopartkit_log(1, "  LVM lv created ok, devpath=%s\n",
 				devpath);
 		autopartkit_log(1, "  LVM creating fs: %s\n", fstype);
-		sleep(UDEV_SLEEP_HACK); /* Give the kernel a moment to create the device */
+		system("update-dev"); /* persuade the kernel to create the device */
 		if (0 == makefs(devpath, fstype))
 		  { /* Replace devpath placeholder with real path */
 		    char buf[1024];

Reply to: