[Ovirt-devel] [PATCH] Moves building ovirt-node-image.iso into the ovirt-node repo.

Darryl L. Pierce
Fri, 26 Mar 2010 21:31:09 -0000

The ISO can now be built by going into the recipe directory and building
the ovirt-node-image.iso target.

Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 recipe/Makefile.am |   68 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/recipe/Makefile.am b/recipe/Makefile.am
index c8a7b94..a925f01 100644
--- a/recipe/Makefile.am
+++ b/recipe/Makefile.am
@@ -7,6 +7,14 @@ OVIRT_REPO_URL    =
http://ovirt.org/repos/ovirt/$(FEDORA)/$(ARCH)

 FEDORA            = $(shell rpm --eval '%{fedora}')
 ARCH              = $(shell rpm --eval '%{_arch}')
+OVIRT_NODE_RECIPE = ovirt-node-recipe.ks
+PKG_FMT           = iso
+PACKAGE           = ovirt-node-image
+NODE_TMP          = $(OVIRT_CACHE_DIR)/$(PACKAGE)-$(ARCH)-tmp
+OVIRT_LOCAL_REPO  ?= file://$(OVIRT_CACHE_DIR)/ovirt
+NODE_KS           = $(NODE_TMP)/node.ks
+NVR               = $(PACKAGE)-$(VERSION)-$(ARCH)
+SUM               ?= sha1sum

 OVIRT_NODE_TOOLSdir = $(datadir)/ovirt-node-tools
 OVIRT_NODE_TOOLS_DATA = 	\
@@ -51,4 +59,64 @@ ovirt-node-recipe.ks:
 # XXX broken ksflatten leaves %include
 	sed -i 's/^%include /#&/' $@

+keys:
+	if [ "$(_ovirt_dev)" = 1 -a -f $(AUTH_KEYS) ]; then \
+	    cp -va $(AUTH_KEYS) ovirt-authorized_keys ;\
+	fi
+
+no_nscd:
+	if pgrep -xl nscd; then \
+	    echo "Please stop nscd" ;\
+	    exit 1 ;\
+	fi
+
+# For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT-
+# annotated rpm version strings.
+_ovirt_dev = \
+ $(shell grep -q '^[[:space:]]*Release:[[:space:]]*0' \
+   $(srcdir)/*.spec.in && echo 1 || :)
+
+SELINUX_ENFORCING=$(shell /usr/sbin/getenforce)
+$(NVR).$(PKG_FMT): no_nscd keys
+	mkdir -p $(NODE_TMP)
+	mkdir -p $(OVIRT_CACHE_DIR)/yum-$(ARCH)
+	( \
+	    case $(SELINUX_ENFORCING) in \
+		Enforcing) sudo /usr/sbin/setenforce Permissive ;; \
+		Permissive) ;; \
+		*) if grep -q '^selinux --disabled' $(OVIRT_NODE_RECIPE); \
+		   then \
+		       echo WARNING: SELinux disabled in kickstart ;\
+		   else \
+		       echo ERROR: SELinux enabled in kickstart, \
+		       but disabled on the build machine ;\
+		       exit 1 ;\
+		   fi ;; \
+	    esac ;\
+	)
+	rm -f $(NODE_KS)
+	if [ "$(_ovirt_dev)" = 1 ]; then \
+	    echo "repo --name=ovirt-local --baseurl=$(OVIRT_LOCAL_REPO)"
> $(NODE_KS) ;\
+	fi
+	cat $(OVIRT_NODE_RECIPE) >> $(NODE_KS)
+	sudo livecd-creator --skip-minimize -c  $(NODE_KS)\
+	    -f $(PACKAGE) \
+	    --tmpdir='$(NODE_TMP)' \
+	    --cache='$(OVIRT_CACHE_DIR)/yum-$(ARCH)'
+	sudo chown $${USER} $(PACKAGE).$(PKG_FMT)
+	( \
+	    if [ $(SELINUX_ENFORCING) = Enforcing ]; then \
+		sudo /usr/sbin/setenforce Enforcing || exit 1 ;\
+	    fi \
+	)
+
+	ln -nf $(PACKAGE).$(PKG_FMT) $(NVR).$(PKG_FMT)
+
+$(NVR).$(PKG_FMT).$(SUM): $(NVR).$(PKG_FMT)
+	$(SUM) $(NVR).$(PKG_FMT) > $(NVR).$(PKG_FMT).$(SUM)
+
+$(PACKAGE).$(PKG_FMT) node: ovirt-node-recipe.ks $(NVR).$(PKG_FMT).$(SUM)
+
+PUNGI = $(NODE_TMP)/tree/pungi
+
 .PHONY: ovirt-node-recipe.ks repos.ks
--
1.6.6.1