2
# libvirt 'run' programs locally script
3
# Copyright (C) 2012 Red Hat, Inc.
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
10
# This program 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
13
# GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program; If not, see <http://www.gnu.org/licenses/>.
18
#----------------------------------------------------------------------
20
# With this script you can run libvirt programs without needing to
21
# install them first. You just have to do for example:
23
# ./run ./tools/virsh [args ...]
25
# If you are already in the tools/ subdirectory, then the following
26
# command will also work:
28
# ../run ./virsh [...]
30
# You can also run the C programs under valgrind like this:
32
# ./run valgrind [valgrind opts...] ./program
36
# ./run gdb --args ./program
38
# This also works with sudo (eg. if you need root access for libvirt):
40
# sudo ./run ./tools/virsh list --all
42
#----------------------------------------------------------------------
47
library_path="$b/src/.libs"
48
if [ -z "$LD_LIBRARY_PATH" ]; then
49
LD_LIBRARY_PATH=$library_path
51
LD_LIBRARY_PATH="$library_path:$LD_LIBRARY_PATH"
53
export LD_LIBRARY_PATH
55
export LIBVIRT_DRIVER_DIR="$b/src/.libs"
56
export LIBVIRTD_PATH="$b/daemon/libvirtd"
59
export PYTHON=@PYTHON@
60
if [ -z "$PYTHONPATH" ]; then
61
PYTHONPATH="$b/python:$b/python/.libs"
63
PYTHONPATH="$b/python:$b/python/.libs:$PYTHONPATH"
67
# This is a cheap way to find some use-after-free and uninitialized
68
# read problems when using glibc.
69
random_val="$(awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)"
70
export MALLOC_PERTURB_=$random_val
73
exec $b/libtool --mode=execute "$@"