1 <?xml version='
1.0'
?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
6 <refentry id=
"systemd-vpick"
7 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
10 <title>systemd-vpick
</title>
11 <productname>systemd
</productname>
15 <refentrytitle>systemd-vpick
</refentrytitle>
16 <manvolnum>1</manvolnum>
20 <refname>systemd-vpick
</refname>
21 <refpurpose>Resolve paths to
<literal>.v/
</literal> versioned directories
</refpurpose>
26 <command>systemd-vpick
<arg choice=
"opt" rep=
"repeat">OPTIONS
</arg> <arg choice=
"opt" rep=
"repeat">PATH
</arg></command>
31 <title>Description
</title>
33 <para><command>systemd-vpick
</command> resolves a file system path referencing a
<literal>.v/
</literal>
34 versioned directory to a path to the newest (by version) file contained therein. This tool provides a
35 command line interface for the
36 <citerefentry><refentrytitle>systemd.v
</refentrytitle><manvolnum>7</manvolnum></citerefentry>
39 <para>The tool expects a path to a
<literal>.v/
</literal> directory as argument (either directly, or with
40 a triple underscore pattern as final component). It then determines the newest file contained in that
41 directory, and writes its path to standard output.
</para>
43 <para>Unless the triple underscore pattern is passed as last component of the path, it is typically
44 necessary to at least specify the
<option>--suffix=
</option> switch to configure the file suffix to look
47 <para>If the specified path does not reference a
<literal>.v/
</literal> path (i.e. neither the final
48 component ends in
<literal>.v
</literal>, nor the penultimate does or the final one does contain a triple
49 underscore) it specified path is written unmodified to standard output.
</para>
53 <title>Options
</title>
55 <para>The following options are understood:
</para>
59 <term><option>--basename=
</option></term>
60 <term><option>-B
</option></term>
62 <listitem><para>Overrides the
"basename" of the files to look for, i.e. the part to the left of the
63 variable part of the filenames. Normally this is derived automatically from the filename of the
64 <literal>.v
</literal> component of the specified path, or from the triple underscore pattern in the
65 last component of the specified path.
</para>
67 <xi:include href=
"version-info.xml" xpointer=
"v256"/></listitem>
71 <term><option>-V
</option></term>
73 <listitem><para>Explicitly configures the version to select. If specified, a filename with the
74 specified version string will be looked for, instead of the newest version
77 <xi:include href=
"version-info.xml" xpointer=
"v256"/></listitem>
81 <term><option>-A
</option></term>
83 <listitem><para>Explicitly configures the architecture to select. If specified, a filename with the
84 specified architecture identifier will be looked for. If not specified only filenames with a locally
85 supported architecture are considered, or those without any architecture identifier.
</para>
87 <xi:include href=
"version-info.xml" xpointer=
"v256"/></listitem>
91 <term><option>--suffix=
</option></term>
92 <term><option>-S
</option></term>
94 <listitem><para>Configures the suffix of the filenames to consider. For the
<literal>.v/
</literal>
95 logic it is necessary to specify the suffix to look for, and the
<literal>.v/
</literal> component
96 must also carry the suffix immediately before
<literal>.v
</literal> in its name.
</para>
98 <xi:include href=
"version-info.xml" xpointer=
"v256"/></listitem>
102 <term><option>--type=
</option></term>
103 <term><option>-t
</option></term>
105 <listitem><para>Configures the inode type to look for in the
<literal>.v/
</literal> directory. Takes
106 one of
<literal>reg
</literal>,
<literal>dir
</literal>,
<literal>sock
</literal>,
107 <literal>fifo
</literal>,
<literal>blk
</literal>,
<literal>chr
</literal>,
<literal>lnk
</literal> as
108 argument, each identifying an inode type. See
<citerefentry
109 project='man-pages'
><refentrytitle>inode
</refentrytitle><manvolnum>7</manvolnum></citerefentry> for
110 details about inode types. If this option is used inodes not matching the specified type are filtered
111 and not taken into consideration.
</para>
113 <xi:include href=
"version-info.xml" xpointer=
"v256"/></listitem>
117 <term><option>--print=
</option></term>
118 <term><option>-p
</option></term>
120 <listitem><para>Configures what precisely to write to standard output. If not specified prints the
121 full, resolved path of the newest matching file in the
<literal>.v/
</literal> directory. This switch can be set to one of the following:
</para>
124 <listitem><para>If set to
<literal>filename
</literal>, will print only the filename instead of the full path of the resolved file.
</para></listitem>
125 <listitem><para>If set to
<literal>version
</literal>, will print only the version of the resolved file.
</para></listitem>
126 <listitem><para>If set to
<literal>type
</literal>, will print only the inode type of the resolved
127 file (i.e. a string such as
<literal>reg
</literal> for regular files, or
<literal>dir
</literal> for
128 directories).
</para></listitem>
129 <listitem><para>If set to
<literal>arch
</literal>, will print only the architecture of the resolved
130 file.
</para></listitem>
131 <listitem><para>If set to
<literal>tries
</literal>, will print only the tries left/tries done of the
132 resolved file.
</para></listitem>
133 <listitem><para>If set to
<literal>all
</literal>, will print all of the above in a simple tabular
134 output.
</para></listitem>
137 <xi:include href=
"version-info.xml" xpointer=
"v256"/></listitem>
141 <term><option>--resolve=
</option></term>
143 <listitem><para>Takes a boolean argument. If true the path to the versioned file is fully
144 canonicalized (i.e. symlinks resolved, and redundant path components removed) before it is shown. If
145 false (the default) this is not done, and the path is shown without canonicalization.
</para>
147 <xi:include href=
"version-info.xml" xpointer=
"v256"/></listitem>
150 <xi:include href=
"standard-options.xml" xpointer=
"help" />
151 <xi:include href=
"standard-options.xml" xpointer=
"version" />
156 <title>Examples
</title>
158 <para>Use a command like the following to automatically pick the newest raw disk image from a
159 <literal>.v/
</literal> directory:
</para>
161 <programlisting>$ systemd-vpick --suffix=.raw --type=reg /var/lib/machines/quux.raw.v/
</programlisting>
163 <para>This will enumerate all regular files matching
164 <filename>/var/lib/machines/quux.raw.v/quux*.raw
</filename>, filter and sort them according to the rules
166 <citerefentry><refentrytitle>systemd.v
</refentrytitle><manvolnum>7</manvolnum></citerefentry>, and then
167 write the path to the newest (by version) file to standard output.
</para>
169 <para>Use a command like the following to automatically pick the newest OS directory tree from a
170 <literal>.v/
</literal> directory:
</para>
172 <programlisting>$ systemd-vpick --type=dir /var/lib/machines/waldo.v/
</programlisting>
174 <para>This will enumerate all directory inodes matching
175 <filename>/var/lib/machines/waldo.v/waldo*
</filename>, filter and sort them according to the rules
177 <citerefentry><refentrytitle>systemd.v
</refentrytitle><manvolnum>7</manvolnum></citerefentry>, and then
178 write the path to the newest (by version) directory to standard output.
</para>
180 <para>For further examples see
181 <citerefentry><refentrytitle>systemd.v
</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
</para>
185 <title>Exit status
</title>
187 <para>On success,
0 is returned, a non-zero failure code
192 <title>See Also
</title>
193 <para><simplelist type=
"inline">
194 <member><citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
195 <member><citerefentry><refentrytitle>systemd.v
</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>