diff options
| author | Karel Zak <kzak@redhat.com> | 2020-03-03 16:07:00 +0100 |
|---|---|---|
| committer | Karel Zak <kzak@redhat.com> | 2020-03-03 16:15:39 +0100 |
| commit | 5839a4ea032b47813d4be6406e6d1ad7ee33afe1 (patch) | |
| tree | 6eed3d0e91b51142c1f54344b0d753524f09ddb6 /disk-utils/sfdisk.c | |
| parent | f94e753b35cf7a8bdd3a27edb72e094917757334 (diff) | |
| download | util-linux-5839a4ea032b47813d4be6406e6d1ad7ee33afe1.tar.gz | |
sfdisk: extend --part-type, support aliases
* add support for aliases to sfdisk scripts
* add shortcuts and aliases to --part-type command
Note that --part-type evaluates shortcuts and aliases as the last
possibility (so after regular type string). This is necessary for
backward compatibility.
Example ('raid' type alias):
# sfdisk --part-type /dev/sdc 1 raid
# fdisk -l /dev/sdc
...
Device Boot Start End Sectors Size Id Type
/dev/sdc1 2048 204799 202752 99M fd Linux raid autodetect
Example ('L' type shortcut):
# sfdisk --part-type /dev/sdc 1 L
# fdisk -l /dev/sdc
...
Device Boot Start End Sectors Size Id Type
/dev/sdc1 2048 204799 202752 99M 83 Linux
Addresses: https://github.com/karelzak/util-linux/issues/958
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/sfdisk.c')
| -rw-r--r-- | disk-utils/sfdisk.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c index bc6b22e011..d8f90b74fc 100644 --- a/disk-utils/sfdisk.c +++ b/disk-utils/sfdisk.c @@ -1152,7 +1152,10 @@ static int command_parttype(struct sfdisk *sf, int argc, char **argv) backup_partition_table(sf, devname); /* parse <type> and apply to PT */ - type = fdisk_label_parse_parttype(lb, typestr); + type = fdisk_label_advparse_parttype(lb, typestr, + FDISK_PARTTYPE_PARSE_DATA + | FDISK_PARTTYPE_PARSE_ALIAS + | FDISK_PARTTYPE_PARSE_SHORTCUT); if (!type) errx(EXIT_FAILURE, _("failed to parse %s partition type '%s'"), fdisk_label_get_name(lb), typestr); @@ -1467,7 +1470,7 @@ static void command_fdisk_help(void) fputc('\n', stdout); fputs(_(" <type> The partition type. Default is a Linux data partition.\n"), stdout); - fputs(_(" MBR: hex or L,S,E,X,U,R,V shortcuts.\n"), stdout); + fputs(_(" MBR: hex or L,S,Ex,X,U,R,V shortcuts.\n"), stdout); fputs(_(" GPT: UUID or L,S,H,U,R,V shortcuts.\n"), stdout); fputc('\n', stdout); |
