Merge commit 'et/master'
[libguestfs.git] / images / Makefile.am
1 # libguestfs test images
2 # Copyright (C) 2009 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 EXTRA_DIST      = \
19         helloworld.tar \
20         helloworld.tar.gz \
21         mbr-ext2-empty.img.gz \
22         empty known-1 known-2 known-3
23
24 noinst_DATA = test.sqsh
25
26 CLEANFILES = test.sqsh
27
28 squash_files = helloworld.tar helloworld.tar.gz empty known-1 known-2 known-3 \
29         100kallzeroes 100kallnewlines 100kallspaces 100krandom 10klines \
30         initrd
31
32 test.sqsh: $(squash_files)
33         rm -f $@
34         $(MKSQUASHFS) $(squash_files) $@
35
36 100kallzeroes:
37         rm -f $@ $@-t
38         dd if=/dev/zero of=$@-t bs=1024 count=100
39         mv $@-t $@
40
41 100kallnewlines: 100kallzeroes
42         rm -f $@ $@-t
43         tr '\0' '\n' < $< > $@-t
44         mv $@-t $@
45
46 100kallspaces: 100kallzeroes
47         rm -f $@ $@-t
48         tr '\0' ' ' < $< > $@-t
49         mv $@-t $@
50
51 100krandom:
52         rm -f $@ $@-t
53         dd if=/dev/urandom of=$@-t bs=1024 count=100
54         mv $@-t $@
55
56 10klines:
57         rm -f $@ $@-t
58         i=0; \
59         while [ $$i -lt 10000 ]; do \
60           echo "$${i}abcdefghijklmnopqrstuvwxyz"; \
61           i=$$(($$i+1)); \
62         done > $@-t
63         mv $@-t $@
64
65 initrd: empty known-1 known-2 known-3
66         rm -f $@ $@-t
67         for f in $^; do echo $$f; done | cpio -o -H newc | gzip --best > $@-t
68         mv $@-t $@