| 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 --> |
| 5 |
|
| 6 |
<refentry id="systemd-vpick" |
| 7 |
xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 8 |
|
| 9 |
<refentryinfo> |
| 10 |
<title>systemd-vpick</title> |
| 11 |
<productname>systemd</productname> |
| 12 |
</refentryinfo> |
| 13 |
|
| 14 |
<refmeta> |
| 15 |
<refentrytitle>systemd-vpick</refentrytitle> |
| 16 |
<manvolnum>1</manvolnum> |
| 17 |
</refmeta> |
| 18 |
|
| 19 |
<refnamediv> |
| 20 |
<refname>systemd-vpick</refname> |
| 21 |
<refpurpose>Resolve paths to <literal>.v/</literal> versioned directories</refpurpose> |
| 22 |
</refnamediv> |
| 23 |
|
| 24 |
<refsynopsisdiv> |
| 25 |
<cmdsynopsis> |
| 26 |
<command>systemd-vpick <arg choice="opt" rep="repeat">OPTIONS</arg> <arg choice="opt" rep="repeat">PATH</arg></command> |
| 27 |
</cmdsynopsis> |
| 28 |
</refsynopsisdiv> |
| 29 |
|
| 30 |
<refsect1> |
| 31 |
<title>Description</title> |
| 32 |
|
| 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> |
| 37 |
logic.</para> |
| 38 |
|
| 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> |
| 42 |
|
| 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 |
| 45 |
for.</para> |
| 46 |
|
| 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) its specified path is written unmodified to standard output.</para> |
| 50 |
</refsect1> |
| 51 |
|
| 52 |
<refsect1> |
| 53 |
<title>Options</title> |
| 54 |
|
| 55 |
<para>The following options are understood:</para> |
| 56 |
|
| 57 |
<variablelist> |
| 58 |
<varlistentry> |
| 59 |
<term><option>--basename=</option></term> |
| 60 |
<term><option>-B</option></term> |
| 61 |
|
| 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> |
| 66 |
|
| 67 |
<xi:include href="version-info.xml" xpointer="v256"/></listitem> |
| 68 |
</varlistentry> |
| 69 |
|
| 70 |
<varlistentry> |
| 71 |
<term><option>-V</option></term> |
| 72 |
|
| 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 |
| 75 |
available.</para> |
| 76 |
|
| 77 |
<xi:include href="version-info.xml" xpointer="v256"/></listitem> |
| 78 |
</varlistentry> |
| 79 |
|
| 80 |
<varlistentry> |
| 81 |
<term><option>-A</option></term> |
| 82 |
|
| 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> |
| 86 |
|
| 87 |
<xi:include href="version-info.xml" xpointer="v256"/></listitem> |
| 88 |
</varlistentry> |
| 89 |
|
| 90 |
<varlistentry> |
| 91 |
<term><option>--suffix=</option></term> |
| 92 |
<term><option>-S</option></term> |
| 93 |
|
| 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> |
| 97 |
|
| 98 |
<xi:include href="version-info.xml" xpointer="v256"/></listitem> |
| 99 |
</varlistentry> |
| 100 |
|
| 101 |
<varlistentry> |
| 102 |
<term><option>--type=</option></term> |
| 103 |
<term><option>-t</option></term> |
| 104 |
|
| 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> |
| 112 |
|
| 113 |
<xi:include href="version-info.xml" xpointer="v256"/></listitem> |
| 114 |
</varlistentry> |
| 115 |
|
| 116 |
<varlistentry> |
| 117 |
<term><option>--print=</option></term> |
| 118 |
<term><option>-p</option></term> |
| 119 |
|
| 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> |
| 122 |
|
| 123 |
<itemizedlist> |
| 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> |
| 135 |
</itemizedlist> |
| 136 |
|
| 137 |
<xi:include href="version-info.xml" xpointer="v256"/></listitem> |
| 138 |
</varlistentry> |
| 139 |
|
| 140 |
<varlistentry> |
| 141 |
<term><option>--resolve=</option></term> |
| 142 |
|
| 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> |
| 146 |
|
| 147 |
<xi:include href="version-info.xml" xpointer="v256"/></listitem> |
| 148 |
</varlistentry> |
| 149 |
|
| 150 |
<xi:include href="standard-options.xml" xpointer="help" /> |
| 151 |
<xi:include href="standard-options.xml" xpointer="version" /> |
| 152 |
</variablelist> |
| 153 |
</refsect1> |
| 154 |
|
| 155 |
<refsect1> |
| 156 |
<title>Examples</title> |
| 157 |
|
| 158 |
<para>Use a command like the following to automatically pick the newest raw disk image from a |
| 159 |
<literal>.v/</literal> directory:</para> |
| 160 |
|
| 161 |
<programlisting>$ systemd-vpick --suffix=.raw --type=reg /var/lib/machines/quux.raw.v/</programlisting> |
| 162 |
|
| 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 |
| 165 |
described in |
| 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> |
| 168 |
|
| 169 |
<para>Use a command like the following to automatically pick the newest OS directory tree from a |
| 170 |
<literal>.v/</literal> directory:</para> |
| 171 |
|
| 172 |
<programlisting>$ systemd-vpick --type=dir /var/lib/machines/waldo.v/</programlisting> |
| 173 |
|
| 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 |
| 176 |
described in |
| 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> |
| 179 |
|
| 180 |
<para>For further examples see |
| 181 |
<citerefentry><refentrytitle>systemd.v</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para> |
| 182 |
</refsect1> |
| 183 |
|
| 184 |
<refsect1> |
| 185 |
<title>Exit status</title> |
| 186 |
|
| 187 |
<para>On success, 0 is returned, a non-zero failure code |
| 188 |
otherwise.</para> |
| 189 |
</refsect1> |
| 190 |
|
| 191 |
<refsect1> |
| 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> |
| 196 |
</simplelist></para> |
| 197 |
</refsect1> |
| 198 |
</refentry> |