From ad73749dabdd0630475048c7c71c7b3deb157972 Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Sun, 24 Mar 2024 13:37:35 +0100 Subject: [PATCH] installer: Pass choosen filesystem to hw_make_destination This is required to proper choose if a seperate boot partition should be created or must not created (BTRFS) Signed-off-by: Stefan Schantl Reviewed-by: Michael Tremer Signed-off-by: Arne Fitzenreiter --- src/installer/hw.c | 9 ++++--- src/installer/hw.h | 2 +- src/installer/main.c | 58 +++++++++++++++++++++++--------------------- 3 files changed, 36 insertions(+), 33 deletions(-) diff --git a/src/installer/hw.c b/src/installer/hw.c index 77789e35e..46330ce43 100644 --- a/src/installer/hw.c +++ b/src/installer/hw.c @@ -631,9 +631,13 @@ static int hw_calculate_partition_table(struct hw* hw, struct hw_destination* de return 0; } -struct hw_destination* hw_make_destination(struct hw* hw, int part_type, struct hw_disk** disks, int disable_swap) { +struct hw_destination* hw_make_destination(struct hw* hw, int part_type, struct hw_disk** disks, + int disable_swap, int filesystem) { struct hw_destination* dest = malloc(sizeof(*dest)); + // Assign filesystem + dest->filesystem = filesystem; + if (part_type == HW_PART_TYPE_NORMAL) { dest->disk1 = *disks; dest->disk2 = NULL; @@ -655,9 +659,6 @@ struct hw_destination* hw_make_destination(struct hw* hw, int part_type, struct if (r) return NULL; - // Set default filesystem - dest->filesystem = HW_FS_DEFAULT; - return dest; } diff --git a/src/installer/hw.h b/src/installer/hw.h index 7fbea86de..bba06da95 100644 --- a/src/installer/hw.h +++ b/src/installer/hw.h @@ -141,7 +141,7 @@ struct hw_disk** hw_select_disks(struct hw_disk** disks, int* selection); struct hw_disk** hw_select_first_disk(const struct hw_disk** disks); struct hw_destination* hw_make_destination(struct hw* hw, int part_type, struct hw_disk** disks, - int disable_swap); + int disable_swap, int filesystem); unsigned long long hw_memory(); diff --git a/src/installer/main.c b/src/installer/main.c index 30f02d8cb..c31c032c2 100644 --- a/src/installer/main.c +++ b/src/installer/main.c @@ -685,34 +685,9 @@ int main(int argc, char *argv[]) { hw_free_disks(disks); - struct hw_destination* destination = hw_make_destination(hw, part_type, - selected_disks, config.disable_swap); - - if (!destination) { - errorbox(_("Your harddisk is too small.")); - goto EXIT; - } - - fprintf(flog, "Destination drive: %s\n", destination->path); - fprintf(flog, " bootldr: %s (%lluMB)\n", destination->part_bootldr, BYTES2MB(destination->size_bootldr)); - fprintf(flog, " boot : %s (%lluMB)\n", destination->part_boot, BYTES2MB(destination->size_boot)); - fprintf(flog, " ESP : %s (%lluMB)\n", destination->part_boot_efi, BYTES2MB(destination->size_boot_efi)); - fprintf(flog, " swap : %s (%lluMB)\n", destination->part_swap, BYTES2MB(destination->size_swap)); - fprintf(flog, " root : %s (%lluMB)\n", destination->part_root, BYTES2MB(destination->size_root)); - fprintf(flog, "Memory : %lluMB\n", BYTES2MB(hw_memory())); - - // Warn the user if there is not enough space to create a swap partition - if (!config.unattended) { - if (!config.disable_swap && !*destination->part_swap) { - rc = newtWinChoice(title, _("OK"), _("Cancel"), - _("Your harddisk is very small, but you can continue without a swap partition.")); - - if (rc != 1) - goto EXIT; - } - } - // Filesystem selection + int filesystem = HW_FS_DEFAULT; + if (!config.unattended) { struct filesystems { int fstype; @@ -741,7 +716,34 @@ int main(int argc, char *argv[]) { if (rc == 2) goto EXIT; - destination->filesystem = filesystems[fs_choice].fstype; + filesystem = filesystems[fs_choice].fstype; + } + + struct hw_destination* destination = hw_make_destination(hw, part_type, + selected_disks, config.disable_swap, filesystem); + + if (!destination) { + errorbox(_("Your harddisk is too small.")); + goto EXIT; + } + + fprintf(flog, "Destination drive: %s\n", destination->path); + fprintf(flog, " bootldr: %s (%lluMB)\n", destination->part_bootldr, BYTES2MB(destination->size_bootldr)); + fprintf(flog, " boot : %s (%lluMB)\n", destination->part_boot, BYTES2MB(destination->size_boot)); + fprintf(flog, " ESP : %s (%lluMB)\n", destination->part_boot_efi, BYTES2MB(destination->size_boot_efi)); + fprintf(flog, " swap : %s (%lluMB)\n", destination->part_swap, BYTES2MB(destination->size_swap)); + fprintf(flog, " root : %s (%lluMB)\n", destination->part_root, BYTES2MB(destination->size_root)); + fprintf(flog, "Memory : %lluMB\n", BYTES2MB(hw_memory())); + + // Warn the user if there is not enough space to create a swap partition + if (!config.unattended) { + if (!config.disable_swap && !*destination->part_swap) { + rc = newtWinChoice(title, _("OK"), _("Cancel"), + _("Your harddisk is very small, but you can continue without a swap partition.")); + + if (rc != 1) + goto EXIT; + } } // Setting up RAID if needed. -- 2.39.2