From 76c20d761b24195b3cd7a620524ae84ed0ab6ab3 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 26 Oct 2013 20:23:22 +0100 Subject: [PATCH] ./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). --- README | 21 +++++++++------------ builder/website/README | 2 +- run.in | 20 +++++--------------- 3 files changed, 15 insertions(+), 28 deletions(-) diff --git a/README b/README index 89ad90db8..cdf492e55 100644 --- a/README +++ b/README @@ -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 diff --git a/builder/website/README b/builder/website/README index f5619cd26..c8b6d8fa3 100644 --- a/builder/website/README +++ b/builder/website/README @@ -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. diff --git a/run.in b/run.in index 4a33d3853..8ca3f56a8 100755 --- a/run.in +++ b/run.in @@ -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@