New tool: virt-sparsify to make disk images sparse.
[libguestfs.git] / run.in
1 #!/bin/bash -
2 # libguestfs 'run' programs locally script
3 # Copyright (C) 2011 Red Hat Inc.
4 #
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.
9 #
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.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 #----------------------------------------------------------------------
20
21 # With this script you can run all the virt tools without needing to
22 # install them first.  You just have to do for example:
23 #
24 #   ./run ./inspector/virt-inspector [args ...]
25 #
26 # This works for any C, OCaml or Perl virt tools in the libguestfs
27 # distribution.  Also you can make a symbolic link to this 'run'
28 # script from anywhere (eg. $HOME/bin/run) if you wish.
29
30 #----------------------------------------------------------------------
31
32 # Find this script.
33 b=@abs_builddir@
34
35 # Set TMPDIR so the appliance doesn't conflict with globally
36 # installed libguestfs.
37 export TMPDIR="$b"
38
39 # Set local environment relative to this script.
40 export LD_LIBRARY_PATH="$b/src/.libs"
41 export LIBGUESTFS_PATH="$b/appliance"
42 export PERL5LIB="$b/perl/blib/lib:$b/perl/blib/arch"
43
44 # Do we have libtool?  If we have it then we can use it to make
45 # running valgrind simpler.  However don't depend on it.
46 if libtool --help >/dev/null 2>&1; then
47     libtool="libtool --mode=execute"
48 fi
49
50 # Run the program.
51 exec $libtool "$@"