#!/bin/bash -

# Enable core dumps.
ulimit -c unlimited

# Location of self-compiled Curl (from git):
export LD_LIBRARY_PATH=~/3rd/curl/lib/.libs

# Location of self-compiled qemu (from git):
export LIBGUESTFS_QEMU=~/bin/qemu.wrapper
export PATH=~/qemu:$PATH

# Set up libguestfs to run qemu directly instead of using libvirt:
export LIBGUESTFS_BACKEND=direct

# Enable libguestfs debugging (optional):
export LIBGUESTFS_DEBUG=1
export LIBGUESTFS_TRACE=1

# Location of remote disk image over http:
disk="http://localhost/vm/arch.raw"
disk="/stor/vm/arch.raw"
format="raw"

# Location of libguestfs directory (compiled from git):
cd ~/3rd/libguestfs

# Run guestfish script.
./run ./fish/guestfish --ro --format="$format" -a "$disk" -i <<EOF
  find /
EOF
