1nbdkit-probing(1)                   NBDKIT                   nbdkit-probing(1)
2
3
4

NAME

6       nbdkit-probing - how to probe for nbdkit configuration and plugins
7

SYNOPSIS

9        nbdkit --dump-config
10
11        nbdkit PLUGIN --dump-plugin
12
13        nbdkit --version
14
15        nbdkit PLUGIN --version
16
17        nbdkit --filter=FILTER null --version
18

DESCRIPTION

20       You can query information about nbdkit and available plugins and
21       filters using the nbdkit binary.  This can include whether nbdkit is
22       installed, and whether plugins or filters and installed.
23
24   Query if nbdkit is installed
25       Use this command to see if the nbdkit program is installed:
26
27        nbdkit --version
28
29       This will fail with an error and non-zero exit code if nbdkit is not
30       installed or not working.
31
32   Query basic configuration
33        nbdkit --dump-config
34
35       lists information about how nbdkit was configured.  The most important
36       fields in the output are the name of the directory where nbdkit looks
37       for plugins and the version of nbdkit, eg:
38
39        plugindir=/usr/lib64/nbdkit/plugins
40        version=1.20.1
41        version_major=1
42        version_minor=20
43
44   Test nbdkit ≥ version
45       To test if nbdkit ≥ a particular version is installed, use the
46       --dump-config option and look for the "version_major" and
47       "version_minor" fields:
48
49        $ nbdkit --dump-config | grep ^version_minor
50        version_minor=20
51        $ major=$( nbdkit --dump-config | grep ^version_major | cut -d= -f2 )
52        $ minor=$( nbdkit --dump-config | grep ^version_minor | cut -d= -f2 )
53        $ if [ $major -eq 1 ] && [ $minor -lt 12 ]
54          then echo 'nbdkit >= 1.12 is required'; exit 1; fi
55
56       These fields were first added in nbdkit 1.16.5 and were not present in
57       earlier versions.
58
59       You can also probe the minimum version using pkg-config(1).  See
60       "PKG-CONFIG/PKGCONF" in nbdkit-plugin(3).
61
62   Query information about a particular plugin
63        nbdkit pluginname --dump-plugin
64
65       (where pluginname is the name or full path of a plugin) will dump
66       information about that plugin, eg:
67
68        $ nbdkit file --dump-plugin
69        path=/usr/lib64/nbdkit/plugins/nbdkit-file-plugin.so
70        name=file
71        version=1.20.1
72        api_version=1
73        struct_size=176
74        thread_model=serialize_requests
75        [etc]
76
77       Plugins which ship with nbdkit usually have the same version as the
78       corresponding nbdkit binary.  The nbdkit binary will always be able to
79       utilize plugins compiled against an older version of the header;
80       however, newer plugins may not be fully supported by an older nbdkit
81       binary (for example, a plugin compiled with "NBDKIT_API_VERSION" of 2
82       fails to load with an older nbdkit that only knows "NBDKIT_API_VERSION"
83       1).
84
85   Detect if a plugin is installed
86       To find out if a plugin is installed (and working) in the plugin
87       directory, use:
88
89        $ nbdkit foo --version
90        nbdkit: error: cannot open plugin 'foo': /usr/lib64/nbdkit/plugins/nbdkit-foo-plugin.so: cannot open shared object file: No such file or directory
91        Use 'nbdkit --help' or read the nbdkit(1) manual page for documentation.
92
93       This will fail with an error and non-zero exit code if the "foo" plugin
94       cannot be loaded.
95
96       Note it is better to test for the existence of plugins this way rather
97       than just seeing if the .so file exists, because nbdkit will load the
98       plugin and check that all its dependencies can be satisfied, and also
99       that plugin registration works.
100
101   List all plugins in the plugin directory
102       You could simply get the plugin directory (from --dump-config) and list
103       all files in this directory called nbdkit-*-plugin.so.
104
105       However a better test is to run --dump-plugin (see above) on each one
106       to check that it is working and all of its dependencies are installed.
107       A complete shell script which does this is:
108
109        #!/bin/sh -
110        plugindir=`nbdkit --dump-config | grep ^plugindir= | sed 's/[^=]*=//'`
111        for f in $plugindir/nbdkit-*-plugin.so; do
112            if nbdkit "$f" --version >/dev/null 2>&1; then
113                b=`echo "$f" | sed 's,.*/nbdkit-\(.*\)-plugin.so$,\1,'`
114                echo "$b ($f)"
115            fi
116        done
117
118   Detect if a filter is installed
119       To find out if a filter is installed (and working) use --version with
120       the "null" plugin and the name of the filter to test:
121
122        nbdkit --version --filter=foo null
123
124       This will fail with an error and non-zero exit code if the "foo" filter
125       cannot be loaded.
126

SEE ALSO

128       nbdkit(1).
129

AUTHORS

131       Eric Blake
132
133       Richard W.M. Jones
134
135       Pino Toscano
136
138       Copyright (C) 2013-2020 Red Hat Inc.
139

LICENSE

141       Redistribution and use in source and binary forms, with or without
142       modification, are permitted provided that the following conditions are
143       met:
144
145       ·   Redistributions of source code must retain the above copyright
146           notice, this list of conditions and the following disclaimer.
147
148       ·   Redistributions in binary form must reproduce the above copyright
149           notice, this list of conditions and the following disclaimer in the
150           documentation and/or other materials provided with the
151           distribution.
152
153       ·   Neither the name of Red Hat nor the names of its contributors may
154           be used to endorse or promote products derived from this software
155           without specific prior written permission.
156
157       THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
158       EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
159       IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
160       PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
161       LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
162       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
163       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
164       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
165       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
166       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
167       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
168
169
170
171nbdkit-1.24.2                     2021-03-02                 nbdkit-probing(1)
Impressum