]> git.ipfire.org Git - people/jschlag/ipfire-2.x.git/commitdiff
installer: Pass choosen filesystem to hw_make_destination
authorStefan Schantl <stefan.schantl@ipfire.org>
Sun, 24 Mar 2024 12:37:35 +0000 (13:37 +0100)
committerArne Fitzenreiter <arne_f@ipfire.org>
Tue, 26 Mar 2024 07:35:43 +0000 (07:35 +0000)
This is required to proper choose if a seperate boot partition should be
created or must not created (BTRFS)

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
src/installer/hw.c
src/installer/hw.h
src/installer/main.c

index 77789e35e6e09408da008caecad0d99956297205..46330ce431b972183fd7c32a84a75780208aede6 100644 (file)
@@ -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;
 }
 
index 7fbea86de04ce92b4271016a45d3df828610f5e2..bba06da95d426fae2776530a724c17aa009ea77f 100644 (file)
@@ -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();
 
index 30f02d8cbe9ca3ff47932d55709b6778e0bea8c6..c31c032c29541aae28ca76602a32a3db5501f6a3 100644 (file)
@@ -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.