]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bootctl: do not allow -x and -p to be used together
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 19 May 2019 10:01:32 +0000 (12:01 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 19 May 2019 10:01:32 +0000 (12:01 +0200)
-x already prints the path to ESP in some circumstances, and allowing
both to be printed seems confusing.

man/bootctl.xml
src/boot/bootctl.c

index 3e1f9b588b3dc6dad1d3499a688ddedcdebed934..46b9738b148acc4a9a08752c8c2373b0a1340df5 100644 (file)
       <varlistentry>
         <term><option>-p</option></term>
         <term><option>--print-esp-path</option></term>
-        <listitem><para>This option modifies the behaviour of <command>status</command>.  Prints only the
-        path to the EFI System Partition (ESP) to standard output and exits.</para></listitem>
+        <listitem><para>This option modifies the behaviour of <command>status</command>. Only prints the path
+        to the EFI System Partition (ESP) to standard output and exits.</para></listitem>
       </varlistentry>
 
       <varlistentry>
         <term><option>-x</option></term>
         <term><option>--print-boot-path</option></term>
-        <listitem><para>This option modifies the behaviour of <command>status</command>.  Prints only the
-        path to the Extended Boot Loader partition if it exists, and the path to the ESP otherwise to
-        standard output and exit. This command is useful to determine where to place boot loader entries, as
-        they are preferably placed in the Extended Boot Loader partition if it exists and in the ESP
-        otherwise.</para></listitem>
+        <listitem><para>This option modifies the behaviour of <command>status</command>. Only prints the path
+        to the Extended Boot Loader partition if it exists, and the path to the ESP otherwise to standard
+        output and exit. This command is useful to determine where to place boot loader entries, as they are
+        preferably placed in the Extended Boot Loader partition if it exists and in the ESP otherwise.
+        </para></listitem>
       </varlistentry>
 
       <varlistentry>
index c3ebdd7c4ea01e328d062467981997297b0115cd..55924adf069cdd0daf10c3d38b62d4e61a9a8e0f 100644 (file)
@@ -1067,10 +1067,16 @@ static int parse_argv(int argc, char *argv[]) {
                         break;
 
                 case 'p':
+                        if (arg_print_dollar_boot_path)
+                                return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+                                                       "--print-boot-path/-x cannot be combined with --print-esp-path/-p");
                         arg_print_esp_path = true;
                         break;
 
                 case 'x':
+                        if (arg_print_esp_path)
+                                return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+                                                       "--print-boot-path/-x cannot be combined with --print-esp-path/-p");
                         arg_print_dollar_boot_path = true;
                         break;