File: run.in

package info (click to toggle)
libvirt 7.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 143,760 kB
  • sloc: ansic: 502,517; xml: 180,512; python: 8,627; sh: 3,992; perl: 2,763; makefile: 509; javascript: 116; cpp: 22
file content (74 lines) | stat: -rw-r--r-- 2,262 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/sh
# libvirt 'run' programs locally script
# Copyright (C) 2012-2013 Red Hat, Inc.
#
# 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.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# 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/>.

#----------------------------------------------------------------------
#
# With this script you can run libvirt programs without needing to
# install them first.  You just have to do for example:
#
#   ./run virsh [args ...]
#
# Note that this runs the locally compiled copy of virsh which
# is usually want you want.
#
# 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 virsh list --all
#
#----------------------------------------------------------------------

# Function to intelligently prepend a path to an environment variable.
# See https://stackoverflow.com/a/9631350
prepend()
{
    eval $1="$2\${$1:+:\$$1}"
}

# Find this script.
b=@abs_builddir@

prepend LD_LIBRARY_PATH "$b/src"
export LD_LIBRARY_PATH

prepend PKG_CONFIG_PATH "$b/src"
export PKG_CONFIG_PATH

prepend PATH "$b/tools"
export PATH

# Ensure that any 3rd party apps using libvirt.so from the build tree get
# files resolved to the build/source tree too. Typically useful for language
# bindings running tests against non-installed libvirt.
LIBVIRT_DIR_OVERRIDE=1
export LIBVIRT_DIR_OVERRIDE

# 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 "$@"