gpt-auto-generator: hook in "growfs" for the root fs if the GPT flag 59 says so

Fixes: #29791
This commit is contained in:
Lennart Poettering
2023-11-15 13:21:15 +01:00
parent 40b1224ea7
commit 6b5fe5d75e
+31 -3
View File
@@ -665,6 +665,33 @@ static int add_partition_root_rw(DissectedPartition *p) {
return 0;
}
static int add_partition_root_growfs(DissectedPartition *p) {
assert(p);
assert(!in_initrd());
/* Invoked on the main system (not initrd), to honour GPT flag 59 on the root fs (growfs) */
if (!p->growfs) {
log_debug("Root partition not marked for growing the file system in the GPT partition table, not generating drop-in for systemd-growfs-root.service.");
return 0;
}
return generator_hook_up_growfs(arg_dest, "/", SPECIAL_LOCAL_FS_TARGET);
}
static int add_partition_root_flags(DissectedPartition *p) {
int r = 0;
assert(p);
assert(!in_initrd());
RET_GATHER(r, add_partition_root_growfs(p));
RET_GATHER(r, add_partition_root_rw(p));
return r;
}
#if ENABLE_EFI
static int add_root_cryptsetup(void) {
#if HAVE_LIBCRYPTSETUP
@@ -710,8 +737,9 @@ static int add_root_mount(void) {
return r;
}
/* Note that we do not need to enable systemd-remount-fs.service here. If
* /etc/fstab exists, systemd-fstab-generator will pull it in for us. */
/* Note that we do not need to enable systemd-remount-fs.service here. If /etc/fstab exists,
* systemd-fstab-generator will pull it in for us, and otherwise add_partition_root_flags() will do
* it, after the initrd transition. */
r = partition_pick_mount_options(
PARTITION_ROOT,
@@ -860,7 +888,7 @@ static int enumerate_partitions(dev_t devnum) {
"var-tmp", "/var/tmp", "Temporary Data Partition"));
if (m->partitions[PARTITION_ROOT].found)
RET_GATHER(r, add_partition_root_rw(m->partitions + PARTITION_ROOT));
RET_GATHER(r, add_partition_root_flags(m->partitions + PARTITION_ROOT));
return r;
}