images: Make phony Windows image for testing.
authorRichard W.M. Jones <rjones@redhat.com>
Tue, 16 Nov 2010 17:37:30 +0000 (17:37 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Tue, 16 Nov 2010 18:36:33 +0000 (18:36 +0000)
.gitignore
images/Makefile.am
images/guest-aux/make-windows-img.sh [new file with mode: 0755]
images/guest-aux/minimal-hive [new file with mode: 0755]
images/guest-aux/windows-software [new file with mode: 0755]
images/guest-aux/windows-software.reg [new file with mode: 0644]
images/guest-aux/windows-system [new file with mode: 0755]
images/guest-aux/windows-system.reg [new file with mode: 0644]

index 1442a04..16f2925 100644 (file)
@@ -134,6 +134,7 @@ images/initrd-x86_64.img.gz
 images/test.iso
 images/test-grep.txt.gz
 images/ubuntu.img
 images/test.iso
 images/test-grep.txt.gz
 images/ubuntu.img
+images/windows.img
 initramfs
 initramfs.timestamp
 inspector/virt-inspector.1
 initramfs
 initramfs.timestamp
 inspector/virt-inspector.1
index d97dd45..5688080 100644 (file)
@@ -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-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.
 
 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 \
 
 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 $<
        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 (executable)
index 0000000..5a0cd6d
--- /dev/null
@@ -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 (executable)
index 0000000..3f4ee58
Binary files /dev/null and b/images/guest-aux/minimal-hive differ
diff --git a/images/guest-aux/windows-software b/images/guest-aux/windows-software
new file mode 100755 (executable)
index 0000000..1091c13
Binary files /dev/null and b/images/guest-aux/windows-software differ
diff --git a/images/guest-aux/windows-software.reg b/images/guest-aux/windows-software.reg
new file mode 100644 (file)
index 0000000..984cbe4
--- /dev/null
@@ -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 (executable)
index 0000000..7d935b0
Binary files /dev/null and b/images/guest-aux/windows-system differ
diff --git a/images/guest-aux/windows-system.reg b/images/guest-aux/windows-system.reg
new file mode 100644 (file)
index 0000000..87ae779
--- /dev/null
@@ -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"