]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
sfdisk: support for type="partition type name"
authorKarel Zak <kzak@redhat.com>
Tue, 23 Feb 2021 08:21:40 +0000 (09:21 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 23 Feb 2021 08:25:36 +0000 (09:25 +0100)
For example:

 # echo 'size=10MiB, type="linux usr x86"' | sfdisk /dev/sdc
 ...
 New situation:

 Device     Start   End Sectors Size Type
 /dev/sdc1   2048 22527   20480  10M Linux /usr (x86)

Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/sfdisk.8
disk-utils/sfdisk.c

index 0c1453e8d8563b47f7409d7702081edf329e40bb..6e92bf8f5e1f0d9e6b5e488da9b6dc6955910125 100644 (file)
@@ -467,6 +467,10 @@ as a shortcut as a first possibility in partitioning scripts although on other p
 Since v2.36 libfdisk supports partition type aliases as extension to shortcuts. The alias is a
 simple human readable word (e.g. "linux").
 
+Since v2.37 libfdisk supports partition type names on input, ignoring the case
+of the characters and all non-alphanumeric and non-digit characters in the name
+(e.g. "Linux /usr x86" is the same as "linux usr-x86").
+
 Supported shortcuts and aliases:
 .TP
 .B L - alias 'linux'
@@ -550,7 +554,8 @@ GPT partition name.
 .TP
 .BI type= code
 A hexadecimal number (without 0x) for an MBR partition, a GUID for a GPT partition,
-or a shortcut as for unnamed-fields format.
+a shortcut as for unnamed-fields format or a type name (e.g. type="Linux /usr (x86)").
+See above the section about the unnamed-fields format for more details.
 For backward compatibility the \fBId=\fR field has the same meaning.
 .SH EMPTY DISK LABEL
 .B sfdisk
index 963cc745c2067e37d67e5c417a803493c183c0b8..193dcebfc13abad4ad7fa2d974f00188bc90d236 100644 (file)
@@ -1165,6 +1165,7 @@ static int command_parttype(struct sfdisk *sf, int argc, char **argv)
        type = fdisk_label_advparse_parttype(lb, typestr,
                        FDISK_PARTTYPE_PARSE_DATA
                        | FDISK_PARTTYPE_PARSE_ALIAS
+                       | FDISK_PARTTYPE_PARSE_NAME
                        | FDISK_PARTTYPE_PARSE_SHORTCUT);
        if (!type)
                errx(EXIT_FAILURE, _("failed to parse %s partition type '%s'"),