mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
repart: Default to swap format for swap partitions
This commit is contained in:
+14
-5
@@ -1733,11 +1733,20 @@ static int partition_read_definition(Partition *p, const char *path, const char
|
|||||||
return log_syntax(NULL, LOG_ERR, path, 1, SYNTHETIC_ERRNO(EINVAL),
|
return log_syntax(NULL, LOG_ERR, path, 1, SYNTHETIC_ERRNO(EINVAL),
|
||||||
"Format=swap and CopyFiles= cannot be combined, refusing.");
|
"Format=swap and CopyFiles= cannot be combined, refusing.");
|
||||||
|
|
||||||
if (!p->format && (!strv_isempty(p->copy_files) || !strv_isempty(p->make_directories) || (p->encrypt != ENCRYPT_OFF && !(p->copy_blocks_path || p->copy_blocks_auto)))) {
|
if (!p->format) {
|
||||||
/* Pick "vfat" as file system for esp and xbootldr partitions, otherwise default to "ext4". */
|
const char *format = NULL;
|
||||||
p->format = strdup(IN_SET(p->type.designator, PARTITION_ESP, PARTITION_XBOOTLDR) ? "vfat" : "ext4");
|
|
||||||
if (!p->format)
|
if (!strv_isempty(p->copy_files) || !strv_isempty(p->make_directories) || (p->encrypt != ENCRYPT_OFF && !(p->copy_blocks_path || p->copy_blocks_auto)))
|
||||||
return log_oom();
|
/* Pick "vfat" as file system for esp and xbootldr partitions, otherwise default to "ext4". */
|
||||||
|
format = IN_SET(p->type.designator, PARTITION_ESP, PARTITION_XBOOTLDR) ? "vfat" : "ext4";
|
||||||
|
else if (p->type.designator == PARTITION_SWAP)
|
||||||
|
format = "swap";
|
||||||
|
|
||||||
|
if (format) {
|
||||||
|
p->format = strdup(format);
|
||||||
|
if (!p->format)
|
||||||
|
return log_oom();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->minimize != MINIMIZE_OFF && !p->format && p->verity != VERITY_HASH)
|
if (p->minimize != MINIMIZE_OFF && !p->format && p->verity != VERITY_HASH)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ test_append_files() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
inst_binary mcopy
|
inst_binary mcopy
|
||||||
|
image_install mkswap
|
||||||
if command -v openssl >/dev/null 2>&1; then
|
if command -v openssl >/dev/null 2>&1; then
|
||||||
inst_binary openssl
|
inst_binary openssl
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user