2013-02-23 00:10:48 +00:00
|
|
|
#!/bin/sh
|
2012-09-14 09:08:54 +00:00
|
|
|
# libvirt 'run' programs locally script
|
2013-02-23 00:10:48 +00:00
|
|
|
# Copyright (C) 2012-2013 Red Hat, Inc.
|
2012-09-14 09:08:54 +00:00
|
|
|
#
|
2013-02-23 00:10:48 +00:00
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
2012-09-14 09:08:54 +00:00
|
|
|
#
|
2013-02-23 00:10:48 +00:00
|
|
|
# This library is distributed in the hope that it will be useful,
|
2012-09-14 09:08:54 +00:00
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2013-02-23 00:10:48 +00:00
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Lesser General Public License for more details.
|
2012-09-14 09:08:54 +00:00
|
|
|
#
|
2013-02-23 00:10:48 +00:00
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this library; If not, see
|
|
|
|
# <http://www.gnu.org/licenses/>.
|
2012-09-14 09:08:54 +00:00
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# With this script you can run libvirt programs without needing to
|
|
|
|
# install them first. You just have to do for example:
|
|
|
|
#
|
|
|
|
# ./run ./tools/virsh [args ...]
|
|
|
|
#
|
|
|
|
# If you are already in the tools/ subdirectory, then the following
|
|
|
|
# command will also work:
|
|
|
|
#
|
|
|
|
# ../run ./virsh [...]
|
|
|
|
#
|
|
|
|
# You can also run the C programs under valgrind like this:
|
|
|
|
#
|
|
|
|
# ./run valgrind [valgrind opts...] ./program
|
|
|
|
#
|
|
|
|
# or under gdb:
|
|
|
|
#
|
|
|
|
# ./run gdb --args ./program
|
|
|
|
#
|
|
|
|
# This also works with sudo (eg. if you need root access for libvirt):
|
|
|
|
#
|
|
|
|
# sudo ./run ./tools/virsh list --all
|
|
|
|
#
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
# Find this script.
|
|
|
|
b=@abs_builddir@
|
|
|
|
|
|
|
|
library_path="$b/src/.libs"
|
|
|
|
if [ -z "$LD_LIBRARY_PATH" ]; then
|
|
|
|
LD_LIBRARY_PATH=$library_path
|
|
|
|
else
|
|
|
|
LD_LIBRARY_PATH="$library_path:$LD_LIBRARY_PATH"
|
|
|
|
fi
|
|
|
|
export LD_LIBRARY_PATH
|
|
|
|
|
|
|
|
export LIBVIRT_DRIVER_DIR="$b/src/.libs"
|
2011-07-06 16:30:08 +00:00
|
|
|
export LIBVIRT_LOCK_MANAGER_PLUGIN_DIR="$b/src/.libs"
|
|
|
|
export VIRTLOCKD_PATH="$b/src/virtlockd"
|
2012-09-14 09:08:54 +00:00
|
|
|
export LIBVIRTD_PATH="$b/daemon/libvirtd"
|
|
|
|
|
|
|
|
# For Python.
|
|
|
|
export PYTHON=@PYTHON@
|
|
|
|
if [ -z "$PYTHONPATH" ]; then
|
|
|
|
PYTHONPATH="$b/python:$b/python/.libs"
|
|
|
|
else
|
|
|
|
PYTHONPATH="$b/python:$b/python/.libs:$PYTHONPATH"
|
|
|
|
fi
|
|
|
|
export PYTHONPATH
|
|
|
|
|
|
|
|
# This is a cheap way to find some use-after-free and uninitialized
|
|
|
|
# read problems when using glibc.
|
|
|
|
random_val="$(awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)"
|
|
|
|
export MALLOC_PERTURB_=$random_val
|
|
|
|
|
|
|
|
# Run the program.
|
|
|
|
exec $b/libtool --mode=execute "$@"
|