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"
56 @echo "make man Make man pages (needs POD)"
60 build: checkroot checkscript livecd.ks
62 livecd-creator --config=livecd.ks --fslabel=$(LABEL)
65 livecd.ks: livecd.ks.in livecd-post.sh Makefile
68 -e 's|@ARCH@|$(ARCH)|g' \
69 -e 's|@BASE@|$(BASE)|g' \
70 -e 's|@BASEURL@|$(BASEURL)|g' \
71 -e 's|@LANG@|$(LANG)|g' \
72 -e 's|@KEYBOARD@|$(KEYBOARD)|g' \
73 -e 's|@TIMEZONE@|$(TIMEZONE)|g' \
74 < $< | cat - livecd-post.sh > $@
76 livecd-post.sh: livecd-post.sh.in virt-p2v virt-p2v-update-wrapper iso-attach inittab lvm.conf Makefile
79 -e '/@VIRT-P2V@/ r virt-p2v' \
81 -e '/@VIRT-P2V-UPDATE-WRAPPER@/ r virt-p2v-update-wrapper' \
82 -e '/@VIRT-P2V-UPDATE-WRAPPER@/ d' \
83 -e '/@ISO-ATTACH@/ r iso-attach' \
84 -e '/@ISO-ATTACH@/ d' \
85 -e '/@INITTAB@/ r inittab' \
87 -e '/@LVM.CONF@/ r lvm.conf' \
91 # Run live CD under qemu.
97 QEMU_ARGS := -m 512 -cdrom $(ISO) -boot d
99 QEMU_ARGS += -hda $(HDA)
102 QEMU_ARGS += -hdb $(HDB)
108 # Update an existing ISO.
110 update: checkroot checkscript
111 -./iso-attach delete $(ISO)
112 ./iso-attach add $(ISO) virt-p2v
114 # Check that we are root.
117 @if [ `id -u` -ne 0 ]; then \
118 echo "You must be root to perform this operation."; \
122 # Check that the script compiles.
130 rm -f *~ core livecd.ks livecd-post.sh
135 $(MAKE) check-manifest
136 rm -rf $(PACKAGE)-$(VERSION)
137 mkdir $(PACKAGE)-$(VERSION)
138 tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
139 tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
140 rm -rf $(PACKAGE)-$(VERSION)
141 ls -l $(PACKAGE)-$(VERSION).tar.gz
144 @hg manifest | sort > .check-manifest; \
145 sort MANIFEST > .orig-manifest; \
146 diff -u .orig-manifest .check-manifest; rv=$$?; \
147 rm -f .orig-manifest .check-manifest; \
152 MAN_SECTION := Virtualization Support
154 man: virt-p2v.1 virt-p2v.1.txt virt-p2v.1.html
156 virt-p2v.1: virt-p2v.pod
157 pod2man -c "$(MAN_SECTION)" --release "$(PACKAGE)-$(VERSION)" $< > $@
159 virt-p2v.1.txt: virt-p2v.pod
162 virt-p2v.1.html: virt-p2v.pod
163 pod2html -css virt-p2v.1.css $< > $@
167 WEBSITE_DIR := ../redhat/et-website/virt-p2v
170 cp virt-p2v.1.html $(WEBSITE_DIR)
171 cp virt-p2v.1.css $(WEBSITE_DIR)
172 cp $(PACKAGE)-$(VERSION).tar.gz $(WEBSITE_DIR)
174 .PHONY: build boot checkroot