appliance: Ignore unreadable dbus helper programs.
[libguestfs.git] / appliance / Makefile.am
1 # libguestfs
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 include $(top_srcdir)/subdir-rules.mk
19
20 EXTRA_DIST = \
21         libguestfs-supermin-helper \
22         kmod.whitelist.in \
23         packagelist.in \
24         init \
25         debian/modules/install_kernel \
26         debian/modules/y0_install-guestfsd \
27         debian/modules/z99_final-cleanups \
28         debian/debirf.conf.in \
29         make.sh.in
30
31 # Build the root filesystem (appliance).
32 # Currently this is arch-dependent, so it seems like putting it in
33 # $(libdir) is best.  When we build cross-architecture filesystems we
34 # should probably move them to $(datadir).
35 fsdir = $(libdir)/guestfs
36 fs_DATA = $(APPLIANCE_FILES)
37
38 # These are the resulting output files from the whole process:
39 #   VMLINUZ        kernel for the full appliance
40 #   INITRAMFSIMG   initramfs (ie. root fs) for the full appliance
41 # For details of the supermin appliance, read the README file:
42 #   SUPERMINIMG    initramfs (ie. partial root fs) for the supermin appliance
43 #   SUPERMINFILES  list of missing files (the ones we will pull out of the
44 #                    host filesystem at runtime) in the supermin appliance
45 APPLIANCE_FILES = $(INITRAMFSIMG) $(VMLINUZ)
46 if SUPERMIN
47 APPLIANCE_FILES += $(SUPERMINIMG) $(SUPERMINFILES) kmod.whitelist
48 bin_SCRIPTS = libguestfs-supermin-helper
49 endif
50
51 # Don't change these names - they must be the same as in '*.sh' scripts.
52 INITRAMFSIMG = initramfs.$(REPO).$(host_cpu).img
53 VMLINUZ = vmlinuz.$(REPO).$(host_cpu)
54 if SUPERMIN
55 SUPERMINIMG = initramfs.$(REPO).$(host_cpu).supermin.img
56 SUPERMINFILES = initramfs.$(REPO).$(host_cpu).supermin.hostfiles
57 endif
58
59 # This is for building the normal appliance:
60 $(INITRAMFSIMG) $(VMLINUZ): $(top_builddir)/initramfs/fakeroot.log
61
62 $(top_builddir)/initramfs/fakeroot.log: make.sh kmod.whitelist packagelist $(top_builddir)/daemon/guestfsd
63         mv $(INITRAMFSIMG) $(INITRAMFSIMG).bak 2>/dev/null; :
64         mv $(VMLINUZ) $(VMLINUZ).bak 2>/dev/null; :
65         if ! bash make.sh; then rm -f $@; exit 1; fi
66
67 # This used to be a configure-generated file (as is update.sh still).
68 # However config.status always touches the destination file, which
69 # means the appliance got rebuilt too often.
70 make.sh: make.sh.in
71         cd $(top_builddir) && \
72           ./config.status --file=appliance/$@-t:appliance/$<
73         chmod +x $@-t
74         mv $@-t $@
75
76 $(INITRAMFSIMG): $(top_builddir)/initramfs/fakeroot.log $(top_builddir)/daemon/guestfsd init update.sh
77         rm -f $@
78         bash update.sh
79         touch $@
80
81 kmod.whitelist: kmod.whitelist.in
82         grep -v '^[[:space:]]*$$' < $< | grep -v '^#' > $@
83
84 packagelist: packagelist.in
85         cpp -undef -D$(DIST)=1 < $< | \
86         grep -v '^[[:space:]]*$$' | grep -v '^#' > $@
87
88 # This is for building the supermin appliance.  It has to be enabled
89 # specifically with './configure --enable-supermin'.  You really need
90 # to read the README file.
91
92 if SUPERMIN
93
94 # First we need to decide which files go in and out of the supermin
95 # appliance.  This decision is made by 'supermin-split.sh'.
96 $(SUPERMINFILES): supermin.incfiles
97 supermin.incfiles: $(top_builddir)/initramfs/fakeroot.log $(top_builddir)/daemon/guestfsd supermin-split.sh
98         rm -f supermin.incfiles $(SUPERMINFILES)
99         bash supermin-split.sh
100
101 # Second we need to create a supermin appliance with just the included
102 # files (leaving out the host files, which we'll add back at runtime).
103 $(SUPERMINIMG): supermin.incfiles supermin-make.sh
104         rm -f $@
105         bash supermin-make.sh
106
107 endif
108
109 # Extra symlinks needed by the Debian appliance.
110 debirf_symlinks = \
111         a0_prep-root \
112         z0_remove-aptitude \
113         z0_remove-locales \
114         z1_clean-root
115 noinst_DATA = $(debirf_symlinks:%=debian/modules/%)
116 $(debirf_symlinks:%=debian/modules/%): stamp-debirf-modules
117 stamp-debirf-modules:
118         mkdir -p debian/modules
119         for f in $(debirf_symlinks); do \
120           ln -sf /usr/share/debirf/modules/$$f debian/modules/$$f; \
121         done
122         touch $@
123
124 #----------------------------------------------------------------------
125 # Extra rules for testing the appliance.
126
127 # Test-boot the appliance.
128
129 test-boot: emptydisk
130         qemu-system-$(host_cpu) \
131           -m 384 \
132           -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
133           -hda emptydisk
134
135 emptydisk:
136         rm -f emptydisk
137         dd if=/dev/zero of=emptydisk bs=1024 count=1440
138         echo 0, | sfdisk -q -C 80 -H 2 -S 18 emptydisk > /dev/null
139
140 # This is a more realistic test boot command line which better
141 # reflects what the library does.
142
143 test-boot-realistic: emptydisk
144         qemu-system-$(host_cpu) \
145           -m 384 \
146           -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
147           -hda emptydisk \
148           -append "console=ttyS0 guestfs=10.0.2.4:6666 guestfs_rescue=1" \
149           -nographic \
150           -serial stdio \
151           -net channel,6666:unix:/tmp/sock,server,nowait \
152           -net user,vlan=0 \
153           -net nic,model=virtio,vlan=0
154
155 # Make clean.
156
157 CLEANFILES = $(APPLIANCE_FILES) packagelist kmod.whitelist supermin.incfiles
158
159 clean-local:
160         rm -rf $(top_builddir)/initramfs