Makefile.in
Makefile
aclocal.m4
+appliance/initramfs.*.img
+appliance/make-initramfs.sh
+appliance/make-initramfs.sh.in.old
+appliance/update-initramfs.sh
+appliance/vmlinuz.*
autom4te.cache
compile
config.h
html/virt-inspector.1.html
initramfs
initramfs.timestamp
-initramfs.*.img
inspector/virt-inspector.1
install-sh
java/api
libguestfs-*.tar.gz
libtool
ltmain.sh
-make-initramfs.sh
-make-initramfs.sh.in.old
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
test*.img
test*.tmp
tests
-update-initramfs.sh
-vmlinuz.*
Directories
----------------------------------------------------------------------
+appliance/
+ The qemu appliance, build scripts and so on.
+
contrib/
Outside contributions, experimental parts.
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = src daemon fish po examples images
+SUBDIRS = src daemon appliance fish po examples images
if HAVE_OCAML
SUBDIRS += ocaml
EXTRA_DIST = \
config.rpath \
- make-initramfs.sh update-initramfs.sh \
guestfs.pod guestfs-actions.pod guestfs-structs.pod \
guestfish.pod guestfish-actions.pod \
html/pod.css \
contrib/febootstrap/install.sh \
test-bootbootboot.sh
-# Build the root filesystem.
-# Currently this is arch-dependent, so it seems like putting it in
-# $(libdir) is best. When we build cross-architecture filesystems we
-# should probably move them to $(datadir).
-
-fsdir = $(libdir)/guestfs
-
-INITRAMFSIMG = initramfs.$(REPO).$(host_cpu).img
-VMLINUZ = vmlinuz.$(REPO).$(host_cpu)
-
-fs_DATA = $(INITRAMFSIMG) $(VMLINUZ)
-
-$(INITRAMFSIMG) $(VMLINUZ): initramfs/fakeroot.log
-
-initramfs/fakeroot.log: make-initramfs.sh.in
- -mv $(INITRAMFSIMG) $(INITRAMFSIMG).bak
- -mv $(VMLINUZ) $(VMLINUZ).bak
- if ! bash $(top_builddir)/make-initramfs.sh; then rm -f $@; exit 1; fi
-
-$(INITRAMFSIMG): initramfs/fakeroot.log daemon/guestfsd
- rm -f $@
- bash $(top_builddir)/update-initramfs.sh
- touch $@
-
-make-initramfs.sh: make-initramfs.sh.in
- ./config.status $@
-
# Tests. These are auto-generated from the test descriptions
# in the generator.
SKIP_TEST_ZEROFREE=$(shell test -x initramfs/usr/sbin/zerofree || echo 1) \
$(VG)
-$(TESTS): $(INITRAMFS) $(VMLINUZ)
-
# Run the tests under valgrind.
valgrind:
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libguestfs.pc
-# Test-boot the image.
-
-test-boot: emptydisk
- qemu-system-$(host_cpu) \
- -m 384 \
- -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
- -hda emptydisk
-
-emptydisk:
- rm -f emptydisk
- dd if=/dev/zero of=emptydisk bs=1024 count=1440
- echo 0, | sfdisk -q -C 80 -H 2 -S 18 emptydisk > /dev/null
-
-# This is a more realistic test boot command line which better
-# reflects what the library does.
-
-test-boot-realistic: emptydisk
- qemu-system-$(host_cpu) \
- -m 384 \
- -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
- -hda emptydisk \
- -append "console=ttyS0 guestfs=10.0.2.4:6666" \
- -nographic \
- -serial stdio \
- -net channel,6666:unix:/tmp/sock,server,nowait \
- -net user,vlan=0 \
- -net nic,model=virtio,vlan=0
-
# Make clean.
CLEANFILES = $(fs_DATA) emptydisk pod2htm?.tmp
--- /dev/null
+# libguestfs
+# Copyright (C) 2009 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+EXTRA_DIST = \
+ make-initramfs.sh update-initramfs.sh
+
+# Build the root filesystem (appliance).
+# Currently this is arch-dependent, so it seems like putting it in
+# $(libdir) is best. When we build cross-architecture filesystems we
+# should probably move them to $(datadir).
+
+fsdir = $(libdir)/guestfs
+
+INITRAMFSIMG = initramfs.$(REPO).$(host_cpu).img
+VMLINUZ = vmlinuz.$(REPO).$(host_cpu)
+
+fs_DATA = $(INITRAMFSIMG) $(VMLINUZ)
+
+$(INITRAMFSIMG) $(VMLINUZ): $(top_builddir)/initramfs/fakeroot.log
+
+$(top_builddir)/initramfs/fakeroot.log: make-initramfs.sh.in
+ -mv $(INITRAMFSIMG) $(INITRAMFSIMG).bak
+ -mv $(VMLINUZ) $(VMLINUZ).bak
+ if ! bash make-initramfs.sh; then rm -f $@; exit 1; fi
+
+$(INITRAMFSIMG): $(top_builddir)/initramfs/fakeroot.log $(top_builddir)/daemon/guestfsd
+ rm -f $@
+ bash update-initramfs.sh
+ touch $@
+
+make-initramfs.sh: make-initramfs.sh.in
+ ./config.status $@
+
+# Test-boot the image.
+
+test-boot: emptydisk
+ qemu-system-$(host_cpu) \
+ -m 384 \
+ -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
+ -hda emptydisk
+
+emptydisk:
+ rm -f emptydisk
+ dd if=/dev/zero of=emptydisk bs=1024 count=1440
+ echo 0, | sfdisk -q -C 80 -H 2 -S 18 emptydisk > /dev/null
+
+# This is a more realistic test boot command line which better
+# reflects what the library does.
+
+test-boot-realistic: emptydisk
+ qemu-system-$(host_cpu) \
+ -m 384 \
+ -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
+ -hda emptydisk \
+ -append "console=ttyS0 guestfs=10.0.2.4:6666" \
+ -nographic \
+ -serial stdio \
+ -net channel,6666:unix:/tmp/sock,server,nowait \
+ -net user,vlan=0 \
+ -net nic,model=virtio,vlan=0
+
+# Make clean.
+
+CLEANFILES = $(fs_DATA)
+
+clean-local:
+ rm -rf $(top_builddir)/initramfs
+
# This is called from the Makefile to build the initramfs.
+unset CDPATH
+
set -e
-unset CDPATH
+cd @top_builddir@
modules="
-i augeas-libs
"
# Decide on names for the final output. These have to match Makefile.am.
-output=initramfs.@REPO@.@host_cpu@.img
-koutput=vmlinuz.@REPO@.@host_cpu@
+output=appliance/initramfs.@REPO@.@host_cpu@.img
+koutput=appliance/vmlinuz.@REPO@.@host_cpu@
rm -f $output
rm -f $koutput
#@FEBOOTSTRAP_RUN@ initramfs -- ln -f /init /sbin/init
# Copy the daemon into the filesystem.
-@FEBOOTSTRAP_INSTALL@ initramfs @abs_builddir@/daemon/guestfsd /sbin/guestfsd 0755 root.root
+@FEBOOTSTRAP_INSTALL@ initramfs daemon/guestfsd /sbin/guestfsd 0755 root.root
# Generate final image.
@FEBOOTSTRAP_TO_INITRAMFS@ initramfs > $output-t
set -e
-output=initramfs.@REPO@.@host_cpu@.img
+cd @top_builddir@
+
+output=appliance/initramfs.@REPO@.@host_cpu@.img
# Copy the daemon into the filesystem.
-@FEBOOTSTRAP_INSTALL@ initramfs @abs_builddir@/daemon/guestfsd /sbin/guestfsd 0755 root.root
+@FEBOOTSTRAP_INSTALL@ initramfs daemon/guestfsd /sbin/guestfsd 0755 root.root
# Generate final image.
@FEBOOTSTRAP_TO_INITRAMFS@ initramfs > $output-t
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile
src/Makefile fish/Makefile po/Makefile.in examples/Makefile
+ appliance/Makefile
+ appliance/make-initramfs.sh appliance/update-initramfs.sh
images/Makefile
ocaml/Makefile ocaml/examples/Makefile
perl/Makefile
java/Makefile
haskell/Makefile
inspector/Makefile
- make-initramfs.sh update-initramfs.sh
libguestfs.pc
ocaml/META perl/Makefile.PL])
AC_OUTPUT
dnl WTF?
-chmod +x make-initramfs.sh update-initramfs.sh
+chmod +x appliance/make-initramfs.sh appliance/update-initramfs.sh
dnl Produce summary.
echo
LIBGUESTFS_DEBUG=1
(2) If you haven't installed libguestfs, run the examples like this:
-LIBGUESTFS_PATH=. examples/to-xml
+LIBGUESTFS_PATH=appliance examples/to-xml
(the path should point to the directory containing vmlinuz.* and
initramfs.* files).
guestfs_set_autosync (g, 1);
- /* If developing, add . to the path. Note that libtools interferes
- * with this because uninstalled guestfish is a shell script that runs
- * the real program with an absolute path. Detect that too.
+ /* If developing, add ./appliance to the path. Note that libtools
+ * interferes with this because uninstalled guestfish is a shell
+ * script that runs the real program with an absolute path. Detect
+ * that too.
*
* BUT if LIBGUESTFS_PATH environment variable is already set by
* the user, then don't override it.
if (getenv ("LIBGUESTFS_PATH") == NULL &&
argv[0] &&
(argv[0][0] != '/' || strstr (argv[0], "/.libs/lt-") != NULL))
- guestfs_set_path (g, ".:" GUESTFS_DEFAULT_PATH);
+ guestfs_set_path (g, "appliance:" GUESTFS_DEFAULT_PATH);
for (;;) {
c = getopt_long (argc, argv, options, long_options, NULL);
if HAVE_HASKELL
TESTS_ENVIRONMENT = \
- LD_LIBRARY_PATH=$(abs_top_builddir)/src/.libs \
- LIBGUESTFS_PATH=$(abs_top_builddir) \
+ LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
+ LIBGUESTFS_PATH=$(top_builddir)/appliance \
$(VG)
TESTS = Guestfs005Load Guestfs010Launch Guestfs050LVCreate
# ./inspector/run-inspector-locally [usual virt-inspector args ...]
export LD_LIBRARY_PATH=$(pwd)/src/.libs
-export LIBGUESTFS_PATH=$(pwd)
+export LIBGUESTFS_PATH=$(pwd)/appliance
export PERL5LIB=$(pwd)/perl/blib/lib:$(pwd)/perl/blib/arch
perl ./inspector/virt-inspector.pl "$@"
TESTS_ENVIRONMENT = \
JAVA=$(JAVA) \
CLASSPATH=t:libguestfs-$(VERSION).jar \
- LIBGUESTFS_PATH=$(abs_top_builddir) \
+ LIBGUESTFS_PATH=$(top_builddir)/appliance \
./run-java-test
t/%.class: t/%.java
TESTS_ENVIRONMENT = \
LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
- LIBGUESTFS_PATH=$(top_builddir) \
+ LIBGUESTFS_PATH=$(top_builddir)/appliance \
$(VG)
TESTS = t/guestfs_005_load t/guestfs_010_launch t/guestfs_050_lvcreate
LIBGUESTFS_PATH as in this example (if run from the root directory of
the source distribution):
- LIBGUESTFS_PATH=$(pwd) \
+ LIBGUESTFS_PATH=$(pwd)/appliance \
PERL5LIB=$(pwd)/perl/blib/lib:$(pwd)/perl/blib/arch/auto/Sys/Guestfs \
perl/examples/foo
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
export LD_LIBRARY_PATH=../src/.libs
-export LIBGUESTFS_PATH=$(cd .. > /dev/null && pwd)
+export LIBGUESTFS_PATH=../appliance
make -f Makefile-pl test "$@"
libguestfsmod_la_LIBADD = $(top_builddir)/src/libguestfs.la
TESTS_ENVIRONMENT = \
- LIBGUESTFS_PATH=$(abs_top_builddir) \
- PYTHONPATH=$(abs_top_builddir)/python:$(abs_top_builddir)/python/.libs \
+ LIBGUESTFS_PATH=$(top_builddir)/appliance \
+ PYTHONPATH=$(top_builddir)/python:$(top_builddir)/python/.libs \
$(PYTHON)
TESTS = t/005-import.py t/010-launch.py t/050-lvcreate.py
To run a script before libguestfs has been installed, you can do
something like this:
- LIBGUESTFS_PATH=.. PATH=../fish:$PATH ./show-devices.sh disk.img
+ LIBGUESTFS_PATH=../appliance PATH=../fish:$PATH ./show-devices.sh disk.img
You can apply these recipes in your own programs by translating the
guestfish commands into API calls in the language of your choice. The
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
export LD_LIBRARY_PATH=../src/.libs
-export LIBGUESTFS_PATH=$(cd .. > /dev/null && pwd)
+export LIBGUESTFS_PATH=../appliance
rake test "$@"
srcdir = getenv (\"srcdir\");
if (!srcdir) srcdir = \".\";
chdir (srcdir);
- guestfs_set_path (g, \".\");
+ guestfs_set_path (g, \"appliance\");
filename = \"test1.img\";
fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);
srcdir = getenv ("srcdir");
if (!srcdir) srcdir = ".";
chdir (srcdir);
- guestfs_set_path (g, ".");
+ guestfs_set_path (g, "appliance");
filename = "test1.img";
fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);