diff options
-rw-r--r-- | disk-utils/sfdisk.8 | 3 | ||||
-rw-r--r-- | libfdisk/src/script.c | 9 |
2 files changed, 9 insertions, 3 deletions
diff --git a/disk-utils/sfdisk.8 b/disk-utils/sfdisk.8 index ff54760ca..c7630bb37 100644 --- a/disk-utils/sfdisk.8 +++ b/disk-utils/sfdisk.8 @@ -462,7 +462,8 @@ GPT partition UUID. GPT partition name. .TP .BI type= code -A hexadecimal number (without 0x) for an MBR partition, or a GUID for a GPT partition. +A hexadecimal number (without 0x) for an MBR partition, a GUID for a GPT partition, +or a shortcut as for unnamed-fields format. For backward compatibility the \fBId=\fR field has the same meaning. .RE .RE diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c index 3db76c87b..a28983dba 100644 --- a/libfdisk/src/script.c +++ b/libfdisk/src/script.c @@ -61,6 +61,8 @@ struct fdisk_script { force_label : 1; /* label: <name> specified */ }; +static struct fdisk_parttype *translate_type_shortcuts(struct fdisk_script *dp, char *str); + static void fdisk_script_free_header(struct fdisk_scriptheader *fi) { @@ -1054,8 +1056,11 @@ static int parse_line_nameval(struct fdisk_script *dp, char *s) rc = next_string(&p, &type); if (rc) break; - pa->type = fdisk_label_parse_parttype( - script_get_label(dp), type); + + pa->type = translate_type_shortcuts(dp, type); + if (!pa->type) + pa->type = fdisk_label_parse_parttype( + script_get_label(dp), type); free(type); if (!pa->type) { |