#!/bin/bash -

# Enable core dumps.
ulimit -c unlimited

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

# Location of self-compiled qemu (from git):
export LIBGUESTFS_QEMU=~/d/qemu/qemu.wrapper
export PATH=~/d/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://192.168.0.249/scratch/winxp.img"
format="raw"

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

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