summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2010-11-16 16:17:33 +0000
committerRichard W.M. Jones <rjones@redhat.com>2010-11-16 18:36:33 +0000
commit858d75d3911c9715bf62c3e8088cce3e991fb0fc (patch)
tree6840b348e586d5379c85c068eaa0c3323e2cca6e
parent6d4815d3a4921219379bc9ec3cceead217668426 (diff)
downloadlibguestfs-858d75d3911c9715bf62c3e8088cce3e991fb0fc.tar.gz
libguestfs-858d75d3911c9715bf62c3e8088cce3e991fb0fc.tar.xz
libguestfs-858d75d3911c9715bf62c3e8088cce3e991fb0fc.zip
images: Make a phony Debian image for testing.
-rw-r--r--.gitignore1
-rw-r--r--images/Makefile.am12
-rw-r--r--images/guest-aux/debian-packages48
-rwxr-xr-ximages/guest-aux/make-debian-img.sh92
4 files changed, 151 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 9fe53f01..d8bcffa7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -124,6 +124,7 @@ images/100kallzeroes
images/100krandom
images/10klines
images/abssymlink
+images/debian.img
images/fedora.img
images/guest-aux/fedora-name.db
images/hello.b64
diff --git a/images/Makefile.am b/images/Makefile.am
index a2eb199f..8fd3ba43 100644
--- a/images/Makefile.am
+++ b/images/Makefile.am
@@ -37,6 +37,8 @@ EXTRA_DIST = \
lib-win64.dll \
lib-x86_64.so \
test-grep.txt \
+ guest-aux/make-debian-img.sh \
+ guest-aux/debian-packages \
guest-aux/make-fedora-img.sh \
guest-aux/fedora-name.db.txt \
guest-aux/fedora-name.db
@@ -45,12 +47,12 @@ noinst_DATA = test.iso
# This is 'check_DATA' because we don't need it until 'make check'
# time and we need the tools we have built in order to make it.
-check_DATA = fedora.img
+check_DATA = debian.img fedora.img
CLEANFILES = \
test.iso test.sqsh \
100kallzeroes 100kallnewlines 100kallspaces 100krandom 10klines \
- initrd fedora.img
+ initrd $(check_DATA)
images_files_src = \
$(srcdir)/helloworld.tar \
@@ -166,3 +168,9 @@ fedora.img: guest-aux/make-fedora-img.sh guest-aux/fedora-name.db
guest-aux/fedora-name.db: guest-aux/fedora-name.db.txt
db_load $@ < $<
+
+# Make a (dummy) Debian image.
+debian.img: guest-aux/make-debian-img.sh
+ LIBGUESTFS_PATH=../appliance \
+ LD_LIBRARY_PATH=../src/.libs \
+ bash $<
diff --git a/images/guest-aux/debian-packages b/images/guest-aux/debian-packages
new file mode 100644
index 00000000..38afc975
--- /dev/null
+++ b/images/guest-aux/debian-packages
@@ -0,0 +1,48 @@
+Package: test1
+Status: installed ok
+Priority: optional
+Section: libs
+Installed-Size: 123
+Architecture: amd64
+Source: test
+Version: 1.2.3-1
+Config-Version: 1.2.3-1
+Depends: libc6 (>= 2.3)
+Description: this is a test package
+ This is a test package.
+ .
+ Don't confuse it with a real package.
+Homepage: http://libguestfs.org/
+
+Package: test2
+Status: installed ok
+Priority: optional
+Section: libs
+Installed-Size: 123
+Architecture: amd64
+Source: test
+Version: 1.2.3-1
+Config-Version: 1.2.3-1
+Depends: libc6 (>= 2.3)
+Description: this is a test package
+ This is a test package.
+ .
+ Don't confuse it with a real package.
+Homepage: http://libguestfs.org/
+
+Package: test3
+Status: installed ok
+Priority: optional
+Section: libs
+Installed-Size: 123
+Architecture: amd64
+Source: test
+Version: 1.2.3-1
+Config-Version: 1.2.3-1
+Depends: libc6 (>= 2.3)
+Description: this is a test package
+ This is a test package.
+ .
+ Don't confuse it with a real package.
+Homepage: http://libguestfs.org/
+
diff --git a/images/guest-aux/make-debian-img.sh b/images/guest-aux/make-debian-img.sh
new file mode 100755
index 00000000..bb34672c
--- /dev/null
+++ b/images/guest-aux/make-debian-img.sh
@@ -0,0 +1,92 @@
+#!/bin/bash -
+# libguestfs
+# Copyright (C) 2010 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.
+
+# Make a Debian image which is enough to fool the inspection heuristics.
+
+export LANG=C
+set -e
+
+# fstab file.
+cat > fstab.tmp <<EOF
+LABEL=BOOT /boot ext2 default 0 0
+/dev/debian/root / ext2 default 0 0
+/dev/debian/usr /usr ext2 default 1 2
+/dev/debian/var /var ext2 default 1 2
+/dev/debian/home /home ext2 default 1 2
+EOF
+
+# Create a disk image.
+../fish/guestfish <<'EOF'
+sparse debian.img.tmp 512M
+run
+
+# Format the disk.
+part-init /dev/sda mbr
+part-add /dev/sda p 64 524287
+part-add /dev/sda p 524288 -64
+
+pvcreate /dev/sda2
+vgcreate debian /dev/sda2
+lvcreate root debian 64
+lvcreate usr debian 32
+lvcreate var debian 32
+lvcreate home debian 32
+
+# Phony /boot filesystem.
+mkfs-b ext2 4096 /dev/sda1
+set-e2label /dev/sda1 BOOT
+set-e2uuid /dev/sda1 01234567-0123-0123-0123-012345678901
+
+# Phony root and other filesystems.
+mkfs-b ext2 4096 /dev/debian/root
+set-e2uuid /dev/debian/root 01234567-0123-0123-0123-012345678902
+mkfs-b ext2 4096 /dev/debian/usr
+set-e2uuid /dev/debian/usr 01234567-0123-0123-0123-012345678903
+mkfs-b ext2 4096 /dev/debian/var
+set-e2uuid /dev/debian/var 01234567-0123-0123-0123-012345678904
+mkfs-b ext2 4096 /dev/debian/home
+set-e2uuid /dev/debian/home 01234567-0123-0123-0123-012345678905
+
+# Enough to fool inspection API.
+mount-options "" /dev/debian/root /
+mkdir /boot
+mount-options "" /dev/sda1 /boot
+mkdir /usr
+mount-options "" /dev/debian/usr /usr
+mkdir /var
+mount-options "" /dev/debian/var /var
+mkdir /home
+mount-options "" /dev/debian/home /home
+mkdir /bin
+mkdir /etc
+mkdir-p /var/lib/dpkg
+
+upload fstab.tmp /etc/fstab
+write /etc/debian_version "5.0.1"
+write /etc/hostname "debian.invalid"
+
+upload guest-aux/debian-packages /var/lib/dpkg/status
+
+upload bin-x86_64-dynamic /bin/ls
+
+mkdir /boot/grub
+touch /boot/grub/grub.conf
+EOF
+
+rm fstab.tmp
+mv debian.img.tmp debian.img