From patchwork Sun Mar 24 12:37:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7672 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4V2bFD0rBtz3wtq for ; Sun, 24 Mar 2024 12:37:52 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4V2bF56scvz2DP; Sun, 24 Mar 2024 12:37:45 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4V2bF54CHtz2yqF; Sun, 24 Mar 2024 12:37:45 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4V2bF35HxCz2xpL for ; Sun, 24 Mar 2024 12:37:43 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4V2bF238cDz1Gx; Sun, 24 Mar 2024 12:37:42 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1711283862; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=EHv1O42qRZWyCBDyuJz/uBGUMkBiNrnl0sbMx5ZXrwQ=; b=3aUWhXDKqZoZW2tvIoHGfoz2FdKCa+4E1c4yiOWR7Xxm1oHDIlxCNxVRslqFFwu4vHVIeM LqZyGUk01mQo1gBA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1711283862; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=EHv1O42qRZWyCBDyuJz/uBGUMkBiNrnl0sbMx5ZXrwQ=; b=lEeHkShNXlRlxOJMW08NYlJflEbfAON479YZITzX+p5N013Lxp7QHc1W3GcNFipRUV6Sn6 9ukUSRLVlyOeAkRdrdsrh62yF8UQQFwCpeZNneweJ4XZ1OeeVBYYMR68FIsozRcHeO18wS UbhzNenUuPfkqCRlsVzao550PpFssz4C2cFQYS3WeSCJa9FRoKgPvS655dpOfgSA2lw3rr IsAFI7XX4ORSzvjaZLLa8rvtSA0blYMf6a9q36yr3ZWXwTPWg3/jWV6mZVlINzOZyhMnI9 4XxuuFUTs258GxbA7NU7G4Nxd0gM7If9gh0QNxAMZiQnXR44cIP/aw1cj/ucig== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH] installer: Pass choosen filesystem to hw_make_destination Date: Sun, 24 Mar 2024 13:37:35 +0100 Message-Id: <20240324123735.633148-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: HQHRR26BWVZZZ7WEHXKAPCJ2224BFQXP X-Message-ID-Hash: HQHRR26BWVZZZ7WEHXKAPCJ2224BFQXP X-MailFrom: stefan.schantl@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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.