X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=Makefile;h=bd944e23b4221050344e2395d1dde7c04b10f1e2;hb=8a24000e9c2f3db53c0298936a095503f564b123;hp=01242507749f858bb7e3b6f5502a1d5842576e8d;hpb=1835c920726e5ce4f012ba1fc4cba0d33c9b316a;p=virt-p2v.git diff --git a/Makefile b/Makefile index 0124250..bd944e2 100644 --- a/Makefile +++ b/Makefile @@ -1,59 +1,145 @@ +# Makefile for virt-p2v +# +# Copyright (C) 2007 Red Hat Inc. +# Written by Richard W.M. Jones +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# # $Id$ #---------------------------------------------------------------------- # General configuration -VERSION := 0.1 +PACKAGE := virt-p2v +VERSION := 0.9 # i386 images also work on x86-64, so best to stick with i386. ARCH := i386 +# Base repository. +BASE := 8 +BASEURL := http://download.fedora.redhat.com/pub/fedora/linux/releases/$(BASE)/Everything/$(ARCH)/os/ + LANG := en_US.UTF-8 KEYBOARD := us TIMEZONE := US/Eastern -BASEREPO := http://download.fedora.redhat.com/pub/fedora/linux/releases/7/Fedora/$(ARCH)/os/ - # Select a suitable HTTP proxy. # The default assumes a local squid proxy. export http_proxy := http://127.0.0.1:3128/ export ftp_proxy := http://127.0.0.1:3128/ -LABEL := virt-p2v-$(VERSION) +LABEL := $(PACKAGE)-$(VERSION) + +ISO := $(LABEL).iso #---------------------------------------------------------------------- all: - @echo "make build Build the live CD ISO" - @echo "make boot [ISO=foo.iso] Boot built/named ISO (uses qemu)" + @echo "make build Build the live CD ISO" + @echo "make boot [HDA=hda.img] [HDB=hdb.img] [ISO=livecd.iso]" + @echo " Boot built/named ISO (uses qemu)" + @echo "make update Update an existing live CD ISO with new" + @echo " virt-p2v script, without doing full rebuild" -build: livecd.ks - rm -f $(LABEL).iso - livecd-creator --config=$< --fslabel=$(LABEL) - ls -lhtr *.iso - -ISO = $(LABEL).iso +# Build live CD. -boot: - qemu -m 512 -cdrom $(ISO) +build: checkroot checkscript livecd.ks + rm -f $(ISO) + livecd-creator --config=livecd.ks --fslabel=$(LABEL) + ls -lhtr *.iso livecd.ks: livecd.ks.in livecd-post.sh Makefile + rm -f $@ sed \ - -e 's|@BASEREPO@|$(BASEREPO)|g' \ + -e 's|@ARCH@|$(ARCH)|g' \ + -e 's|@BASE@|$(BASE)|g' \ + -e 's|@BASEURL@|$(BASEURL)|g' \ -e 's|@LANG@|$(LANG)|g' \ -e 's|@KEYBOARD@|$(KEYBOARD)|g' \ -e 's|@TIMEZONE@|$(TIMEZONE)|g' \ < $< | cat - livecd-post.sh > $@ -livecd-post.sh: livecd-post.sh.in p2v.init virt-p2v.sh inittab Makefile +livecd-post.sh: livecd-post.sh.in virt-p2v.ml inittab lvm.conf Makefile + rm -f $@ sed \ - -e '/@P2V.INIT@/ r p2v.init' \ - -e '/@P2V.INIT@/ d' \ - -e '/@VIRT-P2V.SH@/ r virt-p2v.sh' \ - -e '/@VIRT-P2V.SH@/ d' \ + -e '/@VIRT-P2V.ML@/ r virt-p2v.ml' \ + -e '/@VIRT-P2V.ML@/ d' \ -e '/@INITTAB@/ r inittab' \ -e '/@INITTAB@/ d' \ + -e '/@LVM.CONF@/ r lvm.conf' \ + -e '/@LVM.CONF@/ d' \ < $< > $@ +# Run live CD under qemu. + +QEMU := qemu +HDA := +HDB := + +QEMU_ARGS := -m 512 -cdrom $(ISO) -boot d +ifneq ($(HDA),) +QEMU_ARGS += -hda $(HDA) +endif +ifneq ($(HDB),) +QEMU_ARGS += -hdb $(HDB) +endif + +boot: + $(QEMU) $(QEMU_ARGS) + +# Update an existing ISO. + +update: checkroot checkscript + -./iso-attach delete $(ISO) + ./iso-attach add $(ISO) virt-p2v.ml + +# Check that we are root. + +checkroot: + @if [ `id -u` -ne 0 ]; then \ + echo "You must be root to perform this operation."; \ + exit 1; \ + fi + +# Check that the script compiles. + +checkscript: + ./virt-p2v.ml --test + +# Clean. + clean: rm -f *~ core livecd.ks livecd-post.sh + +# Manifest. + +dist: + $(MAKE) check-manifest + rm -rf $(PACKAGE)-$(VERSION) + mkdir $(PACKAGE)-$(VERSION) + tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf - + tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION) + rm -rf $(PACKAGE)-$(VERSION) + ls -l $(PACKAGE)-$(VERSION).tar.gz + +check-manifest: + @hg manifest | sort > .check-manifest; \ + sort MANIFEST > .orig-manifest; \ + diff -u .orig-manifest .check-manifest; rv=$$?; \ + rm -f .orig-manifest .check-manifest; \ + exit $$rv + +.PHONY: build boot checkroot \ No newline at end of file