]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
sfdisk: allow to disable bootable flag on all partitions
authorKarel Zak <kzak@redhat.com>
Thu, 2 Nov 2017 12:50:30 +0000 (13:50 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 2 Nov 2017 12:50:30 +0000 (13:50 +0100)
Let use '-' rather than a partition number to disable the bootable flag
on all partitions:

 sfdisk --activate /dev/sdc -

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

index 5266ca744e2c822f72eb1005f52447ebaf26f6e0..31f64fd79c607900a98769639b6ebde7b7a5efe0 100644 (file)
@@ -78,10 +78,14 @@ partitions may be smaller.  In this case \fBsfdisk\fR follows the default
 values from the partition table and does not use built-in defaults for the
 unused partition given with \fB\-N\fR.  See also \fB\-\-append\fR.
 .TP
-.BR \-A , " \-\-activate \fIdevice " [ \fIpartition-number ...]
-Switch on the bootable flag for the specified partitions.
-If no \fIpartition-number\fR is specified,
-then list the partitions with an enabled flag.
+.BR \-A , " \-\-activate \fIdevice " [ \fIpartition-number...]
+Switch on the bootable flag for the specified partitions and switch off the
+bootable flag on all unspecified partitions. The special placeholder '-'
+may be used instead of the partition numbers to switch off the bootable flag
+on all partitions.
+
+If no \fIpartition-number\fR is specified, then list the partitions with an
+enabled flag.
 .TP
 .BR "\-\-delete \fIdevice " [ \fIpartition-number ...]
 Delete all or the specified partitions.
index 46b7e54db916348f96c46fd1b1dbe16371abafea..ac4f711066b1a5952e7512409f27c385111b54de 100644 (file)
@@ -853,7 +853,11 @@ static int command_activate(struct sfdisk *sf, int argc, char **argv)
 
        /* sfdisk --activate <partno> [..] */
        for (i = 1; i < argc; i++) {
-               int n = strtou32_or_err(argv[i], _("failed to parse partition number"));
+               int n;
+
+               if (i == 1 && strcmp(argv[1], "-") == 0)
+                       break;
+               n = strtou32_or_err(argv[i], _("failed to parse partition number"));
 
                rc = fdisk_toggle_partition_flag(sf->cxt, n - 1, DOS_FLAG_ACTIVE);
                if (rc)