Add images/guestfs-aux/fedora-packages.db{,.txt} to EXTRA_DIST.
[libguestfs.git] / images / Makefile.am
1 # libguestfs test images
2 # Copyright (C) 2009-2010 Red Hat Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 include $(top_srcdir)/subdir-rules.mk
19
20 # Old RHEL 5 autoconf doesn't have builddir.
21 builddir ?= $(top_builddir)/images
22
23 EXTRA_DIST = \
24         helloworld.tar \
25         helloworld.tar.gz \
26         helloworld.tar.xz \
27         mbr-ext2-empty.img.gz \
28         empty known-1 known-2 known-3 known-4 known-5 \
29         bin-i586-dynamic \
30         bin-sparc-dynamic \
31         bin-win32.exe \
32         bin-win64.exe \
33         bin-x86_64-dynamic \
34         lib-i586.so \
35         lib-sparc.so \
36         lib-win32.dll \
37         lib-win64.dll \
38         lib-x86_64.so \
39         test-grep.txt \
40         guest-aux/make-debian-img.sh \
41         guest-aux/debian-packages \
42         guest-aux/make-fedora-img.sh \
43         guest-aux/fedora-name.db.txt \
44         guest-aux/fedora-name.db \
45         guest-aux/fedora-packages.db.txt \
46         guest-aux/fedora-packages.db \
47         guest-aux/make-ubuntu-img.sh \
48         guest-aux/make-windows-img.sh \
49         guest-aux/windows-software \
50         guest-aux/windows-software.reg \
51         guest-aux/windows-system \
52         guest-aux/windows-system.reg \
53         guest-aux/minimal-hive
54
55 noinst_DATA = test.iso
56
57 # This is 'check_DATA' because we don't need it until 'make check'
58 # time and we need the tools we have built in order to make it.
59 check_DATA = debian.img fedora.img ubuntu.img windows.img
60
61 CLEANFILES = \
62         test.iso test.sqsh \
63         100kallzeroes 100kallnewlines 100kallspaces 100krandom 10klines \
64         initrd $(check_DATA)
65
66 images_files_src = \
67         $(srcdir)/helloworld.tar \
68         $(srcdir)/helloworld.tar.gz \
69         $(srcdir)/helloworld.tar.xz \
70         $(srcdir)/empty \
71         $(srcdir)/known-1 \
72         $(srcdir)/known-2 \
73         $(srcdir)/known-3 \
74         $(srcdir)/known-4 \
75         $(srcdir)/known-5 \
76         $(srcdir)/bin-i586-dynamic \
77         $(srcdir)/bin-sparc-dynamic \
78         $(srcdir)/bin-win32.exe \
79         $(srcdir)/bin-win64.exe \
80         $(srcdir)/bin-x86_64-dynamic \
81         $(srcdir)/lib-i586.so \
82         $(srcdir)/lib-sparc.so \
83         $(srcdir)/lib-win32.dll \
84         $(srcdir)/lib-win64.dll \
85         $(srcdir)/lib-x86_64.so \
86         $(srcdir)/test-grep.txt
87
88 images_files_build = \
89         $(builddir)/100kallzeroes \
90         $(builddir)/100kallnewlines \
91         $(builddir)/100kallspaces \
92         $(builddir)/100krandom \
93         $(builddir)/10klines \
94         $(builddir)/abssymlink \
95         $(builddir)/hello.b64 \
96         $(builddir)/initrd \
97         $(builddir)/initrd-x86_64.img \
98         $(builddir)/initrd-x86_64.img.gz \
99         $(builddir)/test-grep.txt.gz
100
101 images_files = $(images_files_src) $(images_files_build)
102
103 test.iso: $(images_files)
104         rm -f $@ $@-t
105         mkdir -p directory
106         $(GENISOIMAGE) -J -r -graft-points \
107           -o $@-t \
108           $(images_files) /directory=directory
109         rmdir directory
110         mv $@-t $@
111
112 $(builddir)/100kallzeroes:
113         rm -f $@ $@-t
114         dd if=/dev/zero of=$@-t bs=1024 count=100
115         mv $@-t $@
116
117 $(builddir)/100kallnewlines: $(builddir)/100kallzeroes
118         rm -f $@ $@-t
119         tr '\0' '\n' < $< > $@-t
120         mv $@-t $@
121
122 $(builddir)/100kallspaces: $(builddir)/100kallzeroes
123         rm -f $@ $@-t
124         tr '\0' ' ' < $< > $@-t
125         mv $@-t $@
126
127 $(builddir)/100krandom:
128         rm -f $@ $@-t
129         dd if=/dev/urandom of=$@-t bs=1024 count=100
130         mv $@-t $@
131
132 $(builddir)/10klines:
133         rm -f $@ $@-t
134         i=0; \
135         while [ $$i -lt 10000 ]; do \
136           echo "$${i}abcdefghijklmnopqrstuvwxyz"; \
137           i=$$(($$i+1)); \
138         done > $@-t
139         mv $@-t $@
140
141 $(builddir)/abssymlink:
142         ln -sf /10klines $@
143
144 $(builddir)/hello.b64:
145         echo "hello" | base64 > $@
146
147 $(builddir)/initrd: empty known-1 known-2 known-3 known-4 known-5
148         rm -f $@ $@-t
149         for f in $^; do echo $$f; done | cpio -o -H newc | gzip --best > $@-t
150         mv $@-t $@
151
152 # Create a dummy initrd with a single file called 'bin/nash' which
153 # is used to test the Sys::Guestfs::Lib::file_architecture function.
154 $(builddir)/initrd-x86_64.img: bin-x86_64-dynamic
155         rm -rf bin $@ $@-t
156         mkdir bin
157         cp $< bin/nash
158         echo bin/nash | cpio -o -H newc > $@-t
159         mv $@-t $@
160         rm -rf bin $@-t
161
162 $(builddir)/initrd-x86_64.img.gz: initrd-x86_64.img
163         rm -f $@ $@-t
164         gzip --best -c $< > $@-t
165         mv $@-t $@
166
167 $(builddir)/test-grep.txt.gz: test-grep.txt
168         rm -f $@ $@-t
169         gzip --best -c $< > $@-t
170         mv $@-t $@
171
172 # Make a (dummy) Fedora image.
173 fedora.img: guest-aux/make-fedora-img.sh \
174                 guest-aux/fedora-name.db \
175                 guest-aux/fedora-packages.db
176         LIBGUESTFS_PATH=../appliance \
177         LD_LIBRARY_PATH=../src/.libs \
178         bash $<
179
180 guest-aux/fedora-name.db: guest-aux/fedora-name.db.txt
181         rm -f $@ $@-t
182         $(DB_LOAD) $@-t < $<
183         mv $@-t $@
184
185 guest-aux/fedora-packages.db: guest-aux/fedora-packages.db.txt
186         rm -f $@ $@-t
187         $(DB_LOAD) $@-t < $<
188         mv $@-t $@
189
190 # Make a (dummy) Debian image.
191 debian.img: guest-aux/make-debian-img.sh
192         LIBGUESTFS_PATH=../appliance \
193         LD_LIBRARY_PATH=../src/.libs \
194         bash $<
195
196 # Make a (dummy) Ubuntu image.
197 ubuntu.img: guest-aux/make-ubuntu-img.sh
198         LIBGUESTFS_PATH=../appliance \
199         LD_LIBRARY_PATH=../src/.libs \
200         bash $<
201
202 # Make a (dummy) Windows image.
203 windows.img: guest-aux/make-windows-img.sh \
204              guest-aux/windows-software guest-aux/windows-system
205         LIBGUESTFS_PATH=../appliance \
206         LD_LIBRARY_PATH=../src/.libs \
207         bash $<
208
209 # Since users might not have the tools needed to create this, we
210 # also distribute these files.
211 guest-aux/windows-software: guest-aux/windows-software.reg
212         rm -f $@ $@-t
213         cp guest-aux/minimal-hive $@-t
214         hivexregedit --merge $@-t --prefix 'HKEY_LOCAL_MACHINE\SOFTWARE' $<
215         mv $@-t $@
216
217 guest-aux/windows-system: guest-aux/windows-system.reg
218         rm -f $@ $@-t
219         cp guest-aux/minimal-hive $@-t
220         hivexregedit --merge $@-t --prefix 'HKEY_LOCAL_MACHINE\SYSTEM' $<
221         mv $@-t $@