]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
man: add more details for IMPORT, PROGRAM and RUN keys
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 16 Jul 2020 12:56:16 +0000 (14:56 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 16 Jul 2020 16:38:03 +0000 (18:38 +0200)
967de8faceaa83c11a1215515cb135d7a8c0c32c added a note that I found very hard
to understand. Reword it, and also describe how IMPORT and PROGRAM are different
from RUN.

Minor markup adjustements too.

man/udev.xml

index 9b97ee63d91d943d629670ab87d8a1b8acdb6b5d..350ebcf5a2db5ef94869f940bc20c1b4114d397d 100644 (file)
         <varlistentry>
           <term><varname>PROGRAM</varname></term>
           <listitem>
-            <para>Execute a program to determine whether there
-            is a match; the key is true if the program returns
-            successfully. The device properties are made available to the
-            executed program in the environment. The program's standard output
-            is available in the <varname>RESULT</varname> key.</para>
-            <para>This can only be used for very short-running foreground tasks. For details,
-            see <varname>RUN</varname>.</para>
+            <para>Execute a program to determine whether there is a match; the key is true if the program
+            returns successfully. The device properties are made available to the executed program in the
+            environment. The program's standard output is available in the <varname>RESULT</varname>
+            key.</para>
+
+            <para>This can only be used for very short-running foreground tasks. For details, see
+            <varname>RUN</varname>.</para>
+
+            <para>Note that multiple <varname>PROGRAM</varname> keys may be specified in one rule, and
+            <literal>=</literal>, <literal>:=</literal>, and <literal>+=</literal> have the same effect as
+            <literal>==</literal>.</para>
           </listitem>
         </varlistentry>
 
         <varlistentry>
           <term><varname>RUN{<replaceable>type</replaceable>}</varname></term>
           <listitem>
-            <para>Add a program to the list of programs to be executed after
-            processing all the rules for a specific event, depending on
-            <literal>type</literal>:</para>
+            <para>Specify a program to be executed after processing of all the rules for the event. With
+            <literal>+=</literal>, this invocation is added to the list, and with <literal>=</literal> or
+            <literal>:=</literal>, it replaces any previous contents of the list. Please note that both
+            <literal>program</literal> and <literal>builtin</literal> types described below use a single
+            list, so clearing the list with <literal>:=</literal> and <literal>=</literal> affects both
+            types.</para>
+
+            <para><replaceable>type</replaceable> may be:</para>
             <variablelist>
               <varlistentry>
                 <term><literal>program</literal></term>
                 </listitem>
               </varlistentry>
             </variablelist>
-            <para>The program name and following arguments are separated by spaces.
-            Single quotes can be used to specify arguments with spaces.</para>
-            <para>This can only be used for very short-running foreground tasks. Running an
-            event process for a long period of time may block all further events for
-            this or a dependent device.</para>
-            <para>Starting daemons or other long-running processes is not appropriate
-            for udev; the forked processes, detached or not, will be unconditionally
-            killed after the event handling has finished.</para>
-            <para>Note that running programs that access the network or mount/unmount
-            filesystems is not allowed inside of udev rules, due to the default sandbox
-            that is enforced on <filename>systemd-udevd.service</filename>.</para>
-            <para>Please also note that <literal>:=</literal> and <literal>=</literal> are clearing
-            both, program and builtin commands.</para>
-            <para>In order to activate long-running processes from udev rules, provide a service unit, and
-            pull it in from a udev device using the <varname>SYSTEMD_WANTS</varname> device property. See
+
+            <para>The program name and following arguments are separated by spaces. Single quotes can be
+            used to specify arguments with spaces.</para>
+
+            <para>This can only be used for very short-running foreground tasks. Running an event process for
+            a long period of time may block all further events for this or a dependent device.</para>
+
+            <para>Note that running programs that access the network or mount/unmount filesystems is not
+            allowed inside of udev rules, due to the default sandbox that is enforced on
+            <filename>systemd-udevd.service</filename>.</para>
+
+            <para>Starting daemons or other long-running processes is not allowed; the forked processes,
+            detached or not, will be unconditionally killed after the event handling has finished. In order
+            to activate long-running processes from udev rules, provide a service unit and pull it in from a
+            udev device using the <varname>SYSTEMD_WANTS</varname> device property. See
             <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>
             for details.</para>
           </listitem>
         <varlistentry>
           <term><varname>IMPORT{<replaceable>type</replaceable>}</varname></term>
           <listitem>
-            <para>Import a set of variables as device properties,
-            depending on <literal>type</literal>:</para>
+            <para>Import a set of variables as device properties, depending on
+            <replaceable>type</replaceable>:</para>
+
             <variablelist>
               <varlistentry>
                 <term><literal>program</literal></term>
                 </listitem>
               </varlistentry>
             </variablelist>
-            <para>This can only be used for very short-running foreground tasks. For details
-            see <option>RUN</option>.</para>
+
+            <para>This can only be used for very short-running foreground tasks. For details see
+            <option>RUN</option>.</para>
+
+            <para>Note that multiple <varname>IMPORT{}</varname> keys may be specified in one rule, and
+            <literal>=</literal>, <literal>:=</literal>, and <literal>+=</literal> have the same effect as
+            <literal>==</literal>. The key is true if the import is successful, unless <literal>!=</literal>
+            is used as the operator which causes the key to be true if the import failed.</para>
           </listitem>
         </varlistentry>
 
         <varlistentry>
           <term><option>$number</option>, <option>%n</option></term>
           <listitem>
-            <para>The kernel number for this device. For example,
-              <literal>sda3</literal> has kernel number <literal>3</literal>.
-            </para>
+            <para>The kernel number for this device. For example, <literal>sda3</literal> has kernel number
+            3.</para>
           </listitem>
         </varlistentry>