installer: Omit source drive by name

This commit is contained in:
Michael Tremer
2014-08-21 16:57:02 +02:00
parent d78fffa049
commit ee00d203d1
3 changed files with 8 additions and 8 deletions

View 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;
}

View 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);

View 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;