File: run.in

package info (click to toggle)
openscap 1.2.16-2
  • links: PTS
  • area: main
  • in suites: buster
  • size: 130,144 kB
  • sloc: xml: 666,222; ansic: 102,512; sh: 18,915; makefile: 3,197; python: 1,418; perl: 443; cpp: 126
file content (67 lines) | stat: -rw-r--r-- 2,462 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
#!/bin/bash -
# openscap 'run' programs locally script
# Copyright (C) 2011-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 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

#----------------------------------------------------------------------

# With this script you can run oscap without needing to
# install the utility first.  You just have to do for example:
#
#   ./run ./utils/oscap [args ...]
#
# This works for any C program or test that uses the openscap
# libraries.

#----------------------------------------------------------------------

# Build directory
b=@abs_builddir@
# Top source directory
s=@abs_top_srcdir@

# Preload testing library.
export LD_PRELOAD=$b/src/.libs/libopenscap_testing.so${LD_PRELOAD:+:$LD_PRELOAD}

# Set library.
export LD_LIBRARY_PATH=$b/src/.libs:$b/swig/.libs${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}

# This is used for SCE check engine (if it is built and enabled)
export OSCAP_CHECK_ENGINE_PLUGIN_DIR=$b/src/SCE/.libs

# Set paths to probes, schemas, transformations and cpes.
export OVAL_PROBE_DIR=$b/src/OVAL/probes
export OSCAP_SCHEMA_PATH=$s/schemas
export OSCAP_XSLT_PATH=$s/xsl
export OSCAP_CPE_PATH=$s/cpe

# For SWIG bindings.
export PERL5LIB=$b/swig/perl:$b/swig/perl/.libs${PERL5LIB:+:$PERL5LIB}
export PYTHONPATH=$s/swig/python2:$s/swig/src:$b/swig/python2:$b/swig/python2/.libs${PYTHONPATH:+:$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

# Do we have libtool?  If we have it then we can use it to make
# running valgrind simpler.  However don't depend on it.
if libtool --help >/dev/null 2>&1; then
    libtool="libtool --mode=execute"
fi

# Run the program.
exec $libtool "$@"