summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2010-11-16 17:37:30 +0000
committerRichard W.M. Jones <rjones@redhat.com>2010-11-16 18:36:33 +0000
commitfcc631dedb894379cde01af563df3f6a364db7cb (patch)
tree41d8d1184c9e086d1d322538a6a5bc488cf897c3
parent9becb385b78eddb9b3817c6accaa6cdb3db0b5af (diff)
downloadlibguestfs-fcc631dedb894379cde01af563df3f6a364db7cb.tar.gz
libguestfs-fcc631dedb894379cde01af563df3f6a364db7cb.tar.xz
libguestfs-fcc631dedb894379cde01af563df3f6a364db7cb.zip
images: Make phony Windows image for testing.
-rw-r--r--.gitignore1
-rw-r--r--images/Makefile.am31
-rwxr-xr-ximages/guest-aux/make-windows-img.sh54
-rwxr-xr-ximages/guest-aux/minimal-hivebin0 -> 8192 bytes
-rwxr-xr-ximages/guest-aux/windows-softwarebin0 -> 12288 bytes
-rw-r--r--images/guest-aux/windows-software.reg32
-rwxr-xr-ximages/guest-aux/windows-systembin0 -> 12288 bytes
-rw-r--r--images/guest-aux/windows-system.reg8
8 files changed, 124 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 1442a04f..16f2925d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -134,6 +134,7 @@ images/initrd-x86_64.img.gz
images/test.iso
images/test-grep.txt.gz
images/ubuntu.img
+images/windows.img
initramfs
initramfs.timestamp
inspector/virt-inspector.1
diff --git a/images/Makefile.am b/images/Makefile.am
index d97dd458..56880804 100644
--- a/images/Makefile.am
+++ b/images/Makefile.am
@@ -42,13 +42,19 @@ EXTRA_DIST = \
guest-aux/make-fedora-img.sh \
guest-aux/fedora-name.db.txt \
guest-aux/fedora-name.db \
- guest-aux/make-ubuntu-img.sh
+ guest-aux/make-ubuntu-img.sh \
+ guest-aux/make-windows-img.sh \
+ guest-aux/windows-software \
+ guest-aux/windows-software.reg \
+ guest-aux/windows-system \
+ guest-aux/windows-system.reg \
+ guest-aux/minimal-hive
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 = debian.img fedora.img ubuntu.img
+check_DATA = debian.img fedora.img ubuntu.img windows.img
CLEANFILES = \
test.iso test.sqsh \
@@ -181,3 +187,24 @@ ubuntu.img: guest-aux/make-ubuntu-img.sh
LIBGUESTFS_PATH=../appliance \
LD_LIBRARY_PATH=../src/.libs \
bash $<
+
+# Make a (dummy) Windows image.
+windows.img: guest-aux/make-windows-img.sh \
+ guest-aux/windows-software guest-aux/windows-system
+ LIBGUESTFS_PATH=../appliance \
+ LD_LIBRARY_PATH=../src/.libs \
+ bash $<
+
+# Since users might not have the tools needed to create this, we
+# also distribute these files.
+guest-aux/windows-software: guest-aux/windows-software.reg
+ rm -f $@ $@-t
+ cp guest-aux/minimal-hive $@-t
+ hivexregedit --merge $@-t --prefix 'HKEY_LOCAL_MACHINE\SOFTWARE' $<
+ mv $@-t $@
+
+guest-aux/windows-system: guest-aux/windows-system.reg
+ rm -f $@ $@-t
+ cp guest-aux/minimal-hive $@-t
+ hivexregedit --merge $@-t --prefix 'HKEY_LOCAL_MACHINE\SYSTEM' $<
+ mv $@-t $@
diff --git a/images/guest-aux/make-windows-img.sh b/images/guest-aux/make-windows-img.sh
new file mode 100755
index 00000000..5a0cd6de
--- /dev/null
+++ b/images/guest-aux/make-windows-img.sh
@@ -0,0 +1,54 @@
+#!/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 Windows image which is enough to fool the inspection heuristics.
+
+export LANG=C
+set -e
+
+# Create a disk image.
+../fish/guestfish <<'EOF'
+sparse windows.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
+
+# Phony boot loader filesystem.
+mkfs ntfs /dev/sda1
+
+# Phony root filesystem.
+mkfs ntfs /dev/sda2
+
+# Enough to fool inspection API.
+mount-options "" /dev/sda2 /
+mkdir-p /Windows/System32/Config
+
+upload guest-aux/windows-software /Windows/System32/Config/SOFTWARE
+upload guest-aux/windows-system /Windows/System32/Config/SYSTEM
+
+upload bin-win32.exe /Windows/System32/cmd.exe
+
+mkdir "/Program Files"
+touch /autoexec.bat
+
+EOF
+
+mv windows.img.tmp windows.img
diff --git a/images/guest-aux/minimal-hive b/images/guest-aux/minimal-hive
new file mode 100755
index 00000000..3f4ee58c
--- /dev/null
+++ b/images/guest-aux/minimal-hive
Binary files differ
diff --git a/images/guest-aux/windows-software b/images/guest-aux/windows-software
new file mode 100755
index 00000000..1091c13e
--- /dev/null
+++ b/images/guest-aux/windows-software
Binary files differ
diff --git a/images/guest-aux/windows-software.reg b/images/guest-aux/windows-software.reg
new file mode 100644
index 00000000..984cbe42
--- /dev/null
+++ b/images/guest-aux/windows-software.reg
@@ -0,0 +1,32 @@
+[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft]
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT]
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
+"ProductName"=str(1):"Microsoft Windows 7 Phony Edition"
+"CurrentVersion"=str(1):"6.1"
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows]
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion]
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall]
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\test1]
+"DisplayName"=str(1):"Test1 is not real software"
+"URLInfoAbout"=str(1):"http://libguestfs.org/"
+"DisplayVersion"=str(1):"1.2.3"
+"VersionMajor"=dword:00000001
+"VersionMinor"=dword:00000002
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\test2]
+"DisplayName"=str(1):"Test2 is not real software"
+"URLInfoAbout"=str(1):"http://libguestfs.org/"
+"DisplayVersion"=str(1):"1.2.4"
+"Comments"=str(1):"Longer description about phony test2 software"
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\test3]
+"DisplayName"=str(1):"Test3 is not real software"
+"DisplayVersion"=str(1):"1.2.5"
+"Publisher"=str(1):"Red Hat Inc."
+"InstallLocation"=str(1):"C:\\Program Files\\Red Hat\\test3"
diff --git a/images/guest-aux/windows-system b/images/guest-aux/windows-system
new file mode 100755
index 00000000..7d935b02
--- /dev/null
+++ b/images/guest-aux/windows-system
Binary files differ
diff --git a/images/guest-aux/windows-system.reg b/images/guest-aux/windows-system.reg
new file mode 100644
index 00000000..87ae7796
--- /dev/null
+++ b/images/guest-aux/windows-system.reg
@@ -0,0 +1,8 @@
+[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001]
+
+[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services]
+
+[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip]
+
+[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters]
+"Hostname"=str(1):"windows.invalid"