2 # libvirt 'run' programs locally script
3 # Copyright (C) 2012-2013 Red Hat, Inc.
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; If not, see
17 # <http://www.gnu.org/licenses/>.
19 #----------------------------------------------------------------------
21 # With this script you can run libvirt programs without needing to
22 # install them first. You just have to do for example:
24 # ./run ./tools/virsh [args ...]
26 # If you are already in the tools/ subdirectory, then the following
27 # command will also work:
29 # ../run ./virsh [...]
31 # You can also run the C programs under valgrind like this:
33 # ./run valgrind [valgrind opts...] ./program
37 # ./run gdb --args ./program
39 # This also works with sudo (eg. if you need root access for libvirt):
41 # sudo ./run ./tools/virsh list --all
43 #----------------------------------------------------------------------
48 library_path="$b/src/.libs"
49 if [ -z "$LD_LIBRARY_PATH" ]; then
50 LD_LIBRARY_PATH=$library_path
52 LD_LIBRARY_PATH="$library_path:$LD_LIBRARY_PATH"
54 export LD_LIBRARY_PATH
56 export LIBVIRT_DRIVER_DIR="$b/src/.libs"
57 export LIBVIRT_LOCK_MANAGER_PLUGIN_DIR="$b/src/.libs"
58 export VIRTLOCKD_PATH="$b/src"
59 export LIBVIRTD_PATH="$b/daemon"
61 # This is a cheap way to find some use-after-free and uninitialized
62 # read problems when using glibc.
63 random_val="$(awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)"
64 export MALLOC_PERTURB_=$random_val
67 exec $b/libtool --mode=execute "$@"