1 # Makefile for virt-p2v
3 # Copyright (C) 2007 Red Hat Inc.
4 # Written by Richard W.M. Jones <rjones@redhat.com>
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #----------------------------------------------------------------------
23 # General configuration
28 # i386 images also work on x86-64, so best to stick with i386.
33 BASEURL := http://download.fedora.redhat.com/pub/fedora/linux/releases/$(BASE)/Everything/$(ARCH)/os/
37 TIMEZONE := US/Eastern
39 # Select a suitable HTTP proxy.
40 # The default assumes a local squid proxy.
41 export http_proxy := http://127.0.0.1:3128/
42 export ftp_proxy := http://127.0.0.1:3128/
44 LABEL := $(PACKAGE)-$(VERSION)
48 #----------------------------------------------------------------------
51 @echo "make build Build the live CD ISO"
52 @echo "make boot [HDA=hda.img] [HDB=hdb.img] [ISO=livecd.iso]"
53 @echo " Boot built/named ISO (uses qemu)"
54 @echo "make update Update an existing live CD ISO with new"
55 @echo " virt-p2v script, without doing full rebuild"
59 build: checkroot checkscript livecd.ks
61 livecd-creator --config=livecd.ks --fslabel=$(LABEL)
64 livecd.ks: livecd.ks.in livecd-post.sh Makefile
67 -e 's|@ARCH@|$(ARCH)|g' \
68 -e 's|@BASE@|$(BASE)|g' \
69 -e 's|@BASEURL@|$(BASEURL)|g' \
70 -e 's|@LANG@|$(LANG)|g' \
71 -e 's|@KEYBOARD@|$(KEYBOARD)|g' \
72 -e 's|@TIMEZONE@|$(TIMEZONE)|g' \
73 < $< | cat - livecd-post.sh > $@
75 livecd-post.sh: livecd-post.sh.in virt-p2v.ml inittab lvm.conf Makefile
78 -e '/@VIRT-P2V.ML@/ r virt-p2v.ml' \
79 -e '/@VIRT-P2V.ML@/ d' \
80 -e '/@INITTAB@/ r inittab' \
82 -e '/@LVM.CONF@/ r lvm.conf' \
86 # Run live CD under qemu.
92 QEMU_ARGS := -m 512 -cdrom $(ISO) -boot d
94 QEMU_ARGS += -hda $(HDA)
97 QEMU_ARGS += -hdb $(HDB)
103 # Update an existing ISO.
105 update: checkroot checkscript
106 -./update-iso.ml delete $(ISO)
107 ./update-iso.ml add $(ISO) virt-p2v.ml
109 # Check that we are root.
112 @if [ `id -u` -ne 0 ]; then \
113 echo "You must be root to perform this operation."; \
117 # Check that the script compiles.
125 rm -f *~ core livecd.ks livecd-post.sh
130 $(MAKE) check-manifest
131 rm -rf $(PACKAGE)-$(VERSION)
132 mkdir $(PACKAGE)-$(VERSION)
133 tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
134 tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
135 rm -rf $(PACKAGE)-$(VERSION)
136 ls -l $(PACKAGE)-$(VERSION).tar.gz
139 @hg manifest | sort > .check-manifest; \
140 sort MANIFEST > .orig-manifest; \
141 diff -u .orig-manifest .check-manifest; rv=$$?; \
142 rm -f .orig-manifest .check-manifest; \
145 .PHONY: build boot checkroot