From: Stefan Schantl Date: Mon, 26 Feb 2024 17:41:51 +0000 (+0100) Subject: installer: Add code to correctly write the fstab when installing on BTRFS X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c975a8578cf58ffe8fe0fac2ba0afe49b2e6c823;p=people%2Fstevee%2Fipfire-2.x.git installer: Add code to correctly write the fstab when installing on BTRFS Signed-off-by: Stefan Schantl --- diff --git a/src/installer/hw.c b/src/installer/hw.c index b5b853e92..26c473e9c 100644 --- a/src/installer/hw.c +++ b/src/installer/hw.c @@ -1260,6 +1260,7 @@ int hw_write_fstab(struct hw_destination* dest) { return -1; char* uuid = NULL; + char mount_options[STRING_SIZE]; // boot if (*dest->part_boot) { @@ -1295,7 +1296,16 @@ int hw_write_fstab(struct hw_destination* dest) { // root uuid = hw_get_uuid(dest->part_root); if (uuid) { - fprintf(f, FSTAB_FMT, uuid, "/", "auto", "defaults", 1, 1); + if(dest->filesystem == HW_FS_BTRFS) { + // Loop through the array of known BTRFS subvolumes + for ( int i = 0; i < LEN(btrfs_subvolumes); i++ ) { + snprintf(mount_options, sizeof(mount_options), "defaults,%s,subvol=%s", BTRFS_MOUNT_OPTIONS, btrfs_subvolumes[i][0]); + fprintf(f, FSTAB_FMT, uuid, btrfs_subvolumes[i][1], "btrfs", mount_options, 1, 1); + } + } else { + fprintf(f, FSTAB_FMT, uuid, "/", "auto", "defaults", 1, 1); + } + free(uuid); }