./run: Adjust $PATH to include all libguestfs binaries.

Instead of typing:

  ./run ./fish/guestfish ...

you can now use:

  ./run guestfish ...

This is shorter, but there are also two good reasons for this change:
It never made any sense to run the system-installed guestfish (or
other) binary.  It would be unlikely to work.  Also binaries in
libguestfs should be able to call other binaries freely without adding
special exceptions (which we had before this change).
This commit is contained in:
Richard W.M. Jones
2013-10-26 20:23:22 +01:00
parent f114e28cc8
commit 76c20d761b
3 changed files with 15 additions and 28 deletions

21
README
View File

@@ -278,34 +278,31 @@ You can run guestfish, guestmount and the virt tools without needing
to install, using the "./run" script in the top directory. This
script sets up some environment variables. For example:
./run ./fish/guestfish [usual guestfish args ...]
./run guestfish [usual guestfish args ...]
./run ./inspector/virt-inspector [usual virt-inspector args ...]
./run virt-inspector [usual virt-inspector args ...]
If you are already in the fish/ subdirectory, then the following
command will also work:
../run ./guestfish [...]
../run guestfish [...]
You can also make a link from your $PATH to the run script, eg:
cd ~/bin
ln -s ~/libguestfs/run libguestfs-run
cd ~/libguestfs
libguestfs-run ./inspector/virt-inspector [...]
The ./run script adds every libguestfs binary to the $PATH, so the
above example runs guestfish from the build directory (not the
globally installed guestfish if there is one).
You can also run the C programs under valgrind like this:
./run valgrind [valgrind opts...] ./cat/virt-cat [virt-cat opts...]
./run valgrind [valgrind opts...] virt-cat [virt-cat opts...]
or under gdb:
./run gdb --args ./cat/virt-cat [virt-cat opts...]
./run gdb --args virt-cat [virt-cat opts...]
This also works with sudo (eg. if you need root access for libvirt or
to access a block device):
sudo ./run ./cat/virt-cat -d LinuxGuest /etc/passwd
sudo ./run virt-cat -d LinuxGuest /etc/passwd
qemu

View File

@@ -25,7 +25,7 @@ directory.
ie:
./run ./builder/virt-builder fedora-20
./run virt-builder fedora-20
will fail unless you have downloaded fedora-20.xz here.

20
run.in
View File

@@ -23,7 +23,7 @@
# With this script you can run all the virt tools without needing to
# install them first. You just have to do for example:
#
# ./run ./inspector/virt-inspector [args ...]
# ./run virt-inspector [args ...]
#
# This works for any C program, virt tools, and most non-C bindings
# and programs in the libguestfs distribution.
@@ -72,13 +72,9 @@ run: warning: has not been set automatically.
EOF
fi
# Set the PATH to contain guestunmount (called by umount-local API)
# and virt-resize (called by virt-builder).
if [ -z "$PATH" ]; then
PATH="$b/fuse:$b/resize"
else
PATH="$b/fuse:$b/resize:$PATH"
fi
# Set the PATH to contain all the libguestfs binaries. There are a
# lot of binaries, so a lot of path entries.
PATH="$d/align:$d/builder:$d/cat:$d/df:$d/edit:$d/erlang:$d/fish:$d/format:$d/fuse:$d/rescue:$d/resize:$d/sparsify:$d/sysprep:$d/test-tool:$d/tools:$PATH"
export PATH
# Set LD_LIBRARY_PATH to contain library.
@@ -148,19 +144,13 @@ else
fi
export CLASSPATH
# For Erlang.
# For Erlang (note $PATH is adjusted above to include erl-guestfs).
if [ -z "$ERL_LIBS" ]; then
ERL_LIBS="$b/erlang"
else
ERL_LIBS="$b/erlang:$ERL_LIBS"
fi
export ERL_LIBS
if [ -z "$PATH" ]; then
PATH="$b/erlang"
else
PATH="$b/erlang:$PATH"
fi
export PATH
# For Lua.
export LUA=@LUA@