analyze: always recommend saving the output to a file

The command will refuse to write to a TTY, so give a strong hint
that redirecting to a file is recommended. This makes the synopsis,
man page text, and --help output consistent.

Also drop the space after the redirection operator everywhere.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2024-02-20 18:14:53 +01:00 committed by Luca Boccassi
parent 8e94bb62a5
commit 0615abef62
2 changed files with 10 additions and 4 deletions

View file

@ -178,6 +178,7 @@
<command>systemd-analyze</command>
<arg choice="opt" rep="repeat">OPTIONS</arg>
<arg choice="plain">srk</arg>
<arg choice="opt"><replaceable>&gt;FILE</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>systemd-analyze</command>
@ -939,12 +940,17 @@ NR NAME SHA256
</refsect2>
<refsect2>
<title><command>systemd-analyze srk &gt; <replaceable>FILE</replaceable></command></title>
<title><command>systemd-analyze srk <optional>&gt;<replaceable>FILE</replaceable></optional></command></title>
<para>This command reads the Storage Root Key (SRK) from the TPM2 device, and writes it in marshalled
TPM2B_PUBLIC format to stdout. Example:</para>
TPM2B_PUBLIC format to stdout. The output is non-printable data, so it should be redirected to a file
or into a pipe.</para>
<programlisting>systemd-analyze srk &gt; srk.tpm2b_public</programlisting>
<example>
<title>Save the Storage Root Key to <filename>srk.tpm2b_public</filename></title>
<programlisting>systemd-analyze srk &gt;srk.tpm2b_public</programlisting>
</example>
</refsect2>
<refsect2>

View file

@ -240,7 +240,7 @@ static int help(int argc, char *argv[], void *userdata) {
" fdstore SERVICE... Show file descriptor store contents of service\n"
" image-policy POLICY... Analyze image policy string\n"
" pcrs [PCR...] Show TPM2 PCRs and their names\n"
" srk > FILE Write TPM2 SRK to stdout\n"
" srk [>FILE] Write TPM2 SRK (to FILE)\n"
"\nOptions:\n"
" --recursive-errors=MODE Control which units are verified\n"
" --offline=BOOL Perform a security review on unit file(s)\n"