]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
installer: Omit source drive by name
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 21 Aug 2014 14:57:02 +0000 (16:57 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 21 Aug 2014 14:57:02 +0000 (16:57 +0200)
src/installer/hw.c
src/installer/hw.h
src/installer/main.c

index 212deef89ef1b678be8c957e1fa2b2230253497d..ca3b430958f1080065d0c1735abcf95701561a19 100644 (file)
@@ -165,7 +165,7 @@ static unsigned long long hw_block_device_get_size(const char* dev) {
        return size;
 }
 
-struct hw_disk** hw_find_disks(struct hw* hw) {
+struct hw_disk** hw_find_disks(struct hw* hw, const char* sourcedrive) {
        struct hw_disk** ret = hw_create_disks();
        struct hw_disk** disks = ret;
 
@@ -192,15 +192,15 @@ struct hw_disk** hw_find_disks(struct hw* hw) {
                        continue;
                }
 
-               // DEVTYPE must be disk (otherwise we will see all sorts of partitions here)
-               const char* devtype = udev_device_get_property_value(dev, "DEVTYPE");
-               if (devtype && (strcmp(devtype, "disk") != 0)) {
+               // Skip sourcedrive if we need to
+               if (sourcedrive && (strcmp(dev_path, sourcedrive) == 0)) {
                        udev_device_unref(dev);
                        continue;
                }
 
-               // Skip all source mediums
-               if (hw_test_source_medium(dev_path) == 0) {
+               // DEVTYPE must be disk (otherwise we will see all sorts of partitions here)
+               const char* devtype = udev_device_get_property_value(dev, "DEVTYPE");
+               if (devtype && (strcmp(devtype, "disk") != 0)) {
                        udev_device_unref(dev);
                        continue;
                }
index 123d89f7ca813d32daf7e3214a7d5c9e0f86f24c..e4bb18b920c58ab7a8541aa0e5a043650ff5a99c 100644 (file)
@@ -105,7 +105,7 @@ int hw_umount(const char* target);
 
 char* hw_find_source_medium(struct hw* hw);
 
-struct hw_disk** hw_find_disks(struct hw* hw);
+struct hw_disk** hw_find_disks(struct hw* hw, const char* sourcedrive);
 void hw_free_disks(struct hw_disk** disks);
 unsigned int hw_count_disks(struct hw_disk** disks);
 struct hw_disk** hw_select_disks(struct hw_disk** disks, int* selection);
index 45420e13e4dfca505c7a9fa7089c780cbc1687ce..4a550105dbd4c9d37ea8b343d4f66d168dcc9477 100644 (file)
@@ -384,7 +384,7 @@ int main(int argc, char *argv[]) {
        int part_type = HW_PART_TYPE_NORMAL;
 
        // Scan for disks to install on.
-       struct hw_disk** disks = hw_find_disks(hw);
+       struct hw_disk** disks = hw_find_disks(hw, sourcedrive);
 
        struct hw_disk** selected_disks = NULL;
        unsigned int num_selected_disks = 0;