]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/install+setup/install/hw.c
installer: Wait until the kernel re-read the partition table.
[people/pmueller/ipfire-2.x.git] / src / install+setup / install / hw.c
index c86e006fb24324aa7876dafb41fa93078bec5e08..1863dfc90fac5d944c1d7fc8788b5b1a0e270d3b 100644 (file)
@@ -503,6 +503,30 @@ int hw_create_partitions(struct hw_destination* dest) {
 
        int r = mysystem(cmd);
 
+       // Wait until the system re-read the partition table
+       if (r == 0) {
+               unsigned int counter = 10;
+
+               while (counter-- > 0) {
+                       sleep(1);
+
+                       if (*dest->part_boot && (access(dest->part_boot, R_OK) != 0))
+                               continue;
+
+                       if (*dest->part_swap && (access(dest->part_swap, R_OK) != 0))
+                               continue;
+
+                       if (*dest->part_root && (access(dest->part_root, R_OK) != 0))
+                               continue;
+
+                       if (*dest->part_data && (access(dest->part_data, R_OK) != 0))
+                               continue;
+
+                       // All partitions do exist, exiting the loop.
+                       break;
+               }
+       }
+
        if (cmd)
                free(cmd);