]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
man: document new generator env vars
authorLennart Poettering <lennart@poettering.net>
Tue, 12 Apr 2022 21:29:36 +0000 (23:29 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 13 Apr 2022 08:44:56 +0000 (10:44 +0200)
man/systemd.generator.xml

index 287d4a8f4b6925a48f312e867cf3f77e8c155b8c..1f916ac65eb11cdfadfd466e9d6822c31386abf9 100644 (file)
     </orderedlist>
   </refsect1>
 
+  <refsect1>
+    <title>Environment</title>
+
+    <para>The service manager sets a number of environment variables when invoking generator
+    executables. They carry information about the execution context of the generator, in order to simplify
+    conditionalizing generators to specific environments. The following environment variables are set:</para>
+
+    <variablelist class='environment-variables'>
+      <varlistentry>
+        <term><varname>$SYSTEMD_SCOPE</varname></term>
+
+        <listitem><para>If the generator is invoked from the system service manager this variable is set to
+        <literal>system</literal>; if invoked from the per-user service manager it is set to
+        <literal>user</literal>.</para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><varname>$SYSTEMD_IN_INITRD</varname></term>
+
+        <listitem><para>If the generator is run as part of an initial RAM file system (initrd) this is set to
+        <literal>1</literal>. If it is run from the regular host (i.e. after the transition from initrd to
+        host) it is set to <literal>0</literal>. This environment variable is only set for system
+        generators.</para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><varname>$SYSTEMD_FIRST_BOOT</varname></term>
+
+        <listitem><para>If this boot-up cycle is considered a "first boot", this is set to
+        <literal>1</literal>; if it is a subsequent, regular boot it is set to <literal>0</literal>. For
+        details see the documentation of <varname>ConditionFirstBoot=</varname> in
+        <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. This
+        environment variable is only set for system generators.</para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><varname>$SYSTEMD_VIRTUALIZATION</varname></term>
+
+        <listitem><para>If the service manager is run in a virtualized environment,
+        <varname>$SYSTEMD_VIRTUALIZATION</varname> is set to a pair of strings, separated by a colon. The
+        first string is either <literal>vm</literal> or <literal>container</literal>, categorizing the type
+        of virtualization. The second string identifies the implementation of the virtualization
+        technology. If no virtualization is detected this variable will not be set. This data is identical to
+        what
+        <citerefentry><refentrytitle>systemd-detect-virt</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        detects and reports, and uses the same vocabulary of virtualization implementation
+        identifiers.</para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><varname>$SYSTEMD_ARCHITECTURE</varname></term>
+
+        <listitem><para>This variable is set to a short identifier of the reported architecture of the
+        system. For details about defined values, see documentation of
+        <varname>ConditionArchitecture=</varname> in
+        <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para></listitem>
+      </varlistentry>
+    </variablelist>
+  </refsect1>
+
   <refsect1>
     <title>Notes about writing generators</title>