1 # Copyright (C) 2008 Red Hat, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; version 2 of the License.
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License for more details.
12 # You should have received a copy of the GNU General Public License
13 # along with this program; if not, write to the Free Software
14 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
15 # MA 02110-1301, USA. A copy of the GNU General Public License is
16 # also available at http://www.gnu.org/copyleft/gpl.html.
18 OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache
19 OVIRT_LOCAL_REPO ?= file://$(OVIRT_CACHE_DIR)/ovirt
20 OVIRT_URL ?= http://ovirt.org/repos/ovirt
24 ovirt-node-image.spec \
25 ovirt-node-image.spec.in \
36 # For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT-
37 # annotated rpm version strings.
39 $(shell grep -q '^[[:space:]]*Release:[[:space:]]*0' \
40 $(srcdir)/*.spec.in && echo 1 || :)
42 git_head = $$(git log -1 --pretty=format:%h)
43 GIT_RELEASE = $$(date --utc +%Y%m%d%H%M%S)git$(git_head)
44 RPMDIR = $$(rpm --eval '%{_rpmdir}')
45 RPM_FLAGS = --define "ovirt_cache_dir $(OVIRT_CACHE_DIR)"
46 RPM_FLAGS += $(if $(_ovirt_dev),--define "extra_release .$(GIT_RELEASE)")
48 FEDORA=$(shell rpm --eval '%{fedora}')
49 ARCH=$(shell rpm --eval '%{_arch}')
50 FEDORA_MIRROR=http://mirrors.fedoraproject.org/mirrorlist
55 if [ 0$(FEDORA) == 0$(CUR_RAWHIDE) ]; then \
56 FEDORA_REPO=rawhide ;\
57 FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/development/$(ARCH)/os,--mirrorlist=$(FEDORA_MIRROR)?repo=rawhide&arch=$(ARCH))" ;\
58 OVIRT_DISTRO=development ;\
60 FEDORA_REPO=f$(FEDORA) ;\
61 FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/releases/$(FEDORA)/Everything/${ARCH}/os,--mirrorlist=$(FEDORA_MIRROR)?repo=fedora-$(FEDORA)&arch=$(ARCH))" ;\
62 OVIRT_DISTRO=$(FEDORA) ;\
63 UPDATE_REPO_LINE="repo --name=$${FEDORA_REPO}-updates-newkey $(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/updates/$(FEDORA)/${ARCH}.newkey,--mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-f$(FEDORA).newkey&arch=$(ARCH))" ;\
65 echo "repo --name=$${FEDORA_REPO} $${FEDORA_REPO_LOC}" > $@ ;\
66 echo "repo --name=ovirt-org --baseurl=$(OVIRT_URL)/$${OVIRT_DISTRO}/$(ARCH)" >> $@ ;\
67 echo "$${UPDATE_REPO_LINE}" >> $@ ;\
68 echo "repo --name=ovirt-local --baseurl=$(OVIRT_LOCAL_REPO)" >> $@ \
71 SELINUX_ENFORCING=$(shell /usr/sbin/getenforce)
72 ovirt-node-image.iso: repos.ks
73 mkdir -p $(OVIRT_CACHE_DIR)/node-image-tmp
74 mkdir -p $(OVIRT_CACHE_DIR)/yum
76 case $(SELINUX_ENFORCING) in \
77 Enforcing) sudo /usr/sbin/setenforce Permissive ;; \
79 *) if ksflatten ovirt-image-node.ks 2>/dev/null \
80 | grep -q '^selinux --disabled'; then \
81 echo WARNING: SELinux disabled in kickstart ;\
83 echo ERROR: SELinux enabled in kickstart, \
84 but disabled on the build machine ;\
89 sudo livecd-creator --skip-minimize -c ovirt-node-image.ks \
91 --tmpdir='$(OVIRT_CACHE_DIR)/node-image-tmp' \
92 --cache='$(OVIRT_CACHE_DIR)/yum'
93 sudo chown $${USER} ovirt-node-image.iso
95 if [ $(SELINUX_ENFORCING) = Enforcing ]; then \
96 sudo /usr/sbin/setenforce Enforcing || exit 1 ;\
101 rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz
104 mkdir -p $(OVIRT_CACHE_DIR)
105 rsync -aq $(shell rpm --eval '%{_rpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/
106 rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/src
107 createrepo $(OVIRT_CACHE_DIR)/ovirt
109 .PHONY: rpms publish ovirt-node-image.iso