forked from skhare-r7/hivex
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.in
executable file
·108 lines (93 loc) · 3.19 KB
/
run.in
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/bash -
# hivex 'run' programs locally script
# Copyright (C) 2011-2016 Red Hat Inc.
#
# @configure_input@
#
# 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 all the hivex tools without needing to
# install them first. You just have to do for example:
#
# ./run hivexregedit [args ...]
#
# This works for any C program, hivex tool, and most non-C bindings.
#----------------------------------------------------------------------
# Source and build directories (absolute paths so this works from any
# directory).
s="$(cd @abs_srcdir@ && pwd)"
b="$(cd @abs_builddir@ && pwd)"
# Set PATH to contain all local programs.
PATH="$b/sh:$b/regedit:$b/xml:$PATH"
export PATH
# Set LD_LIBRARY_PATH to contain library.
if [ -z "$LD_LIBRARY_PATH" ]; then
LD_LIBRARY_PATH="$b/lib/.libs"
else
LD_LIBRARY_PATH="$b/lib/.libs:$LD_LIBRARY_PATH"
fi
export LD_LIBRARY_PATH
# For Perl.
if [ -z "$PERL5LIB" ]; then
PERL5LIB="$b/perl/blib/lib:$b/perl/blib/arch"
else
PERL5LIB="$b/perl/blib/lib:$b/perl/blib/arch:$PERL5LIB"
fi
export PERL5LIB
# Enable Perl valgrinding.
# XXX Unclear if this actually makes any difference. It seems you
# have to recompile the Perl interpreter with debugging enabled.
export PERL_DEBUG=1
export PERL_VALGRIND=1
export PERL_DESTRUCT_LEVEL=2
# For Python.
export PYTHON="@PYTHON@"
if [ -z "$PYTHONPATH" ]; then
PYTHONPATH="$s/python:$b/python:$b/python/.libs"
else
PYTHONPATH="$s/python:$b/python:$b/python/.libs:$PYTHONPATH"
fi
export PYTHONPATH
# For Ruby.
export RUBY="@RUBY@"
export RAKE="@RAKE@"
if [ -z "$RUBYLIB" ]; then
RUBYLIB="$s/ruby/lib:$b/ruby/ext/hivex"
else
RUBYLIB="$s/ruby/lib:$b/ruby/ext/hivex:$RUBYLIB"
fi
export RUBYLIB
export LD_LIBRARY_PATH="$b/ruby/ext/hivex:$LD_LIBRARY_PATH"
# For OCaml.
if [ -z "$CAML_LD_LIBRARY_PATH" ]; then
CAML_LD_LIBRARY_PATH="$b/ocaml"
else
CAML_LD_LIBRARY_PATH="$b/ocaml:$CAML_LD_LIBRARY_PATH"
fi
export CAML_LD_LIBRARY_PATH
# 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
# Avoid GNOME keyring stupidity
export GNOME_KEYRING_CONTROL=
export GNOME_KEYRING_PID=
# Run the program.
exec $libtool "$@"