remove syslinux from Node image
[ovirt-node-image.git] / Makefile.am
blob79230e98fb73870fbdae287278feb90dd3752958
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
21 SUM              ?= sha1sum
22 PKG_FMT           = iso
23 AUTH_KEYS        ?= ~/.ssh/authorized_keys
25 FEDORA_MIRROR     = http://mirrors.fedoraproject.org/mirrorlist
26 CUR_RAWHIDE       = 11
28 FEDORA            = $(shell rpm --eval '%{fedora}')
29 ARCH              = $(shell rpm --eval '%{_arch}')
31 NVR               = $(PACKAGE)-$(VERSION)-$(ARCH)
33 EXTRA_DIST =                            \
34   .gitignore                            \
35   $(PACKAGE).spec                       \
36   $(PACKAGE).spec.in                    \
37   README.krb5                           \
38   common-blacklist.ks                   \
39   common-install.ks                     \
40   common-pkgs.ks                        \
41   common-post.ks                        \
42   ovirt-flash                           \
43   $(PACKAGE).ks                         \
44   ovirt-pxe                             \
45   create-ovirt-iso-nodes                \
46   edit-livecd                           \
47   livecd-setauth
49 DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz \
50   $(PACKAGE).$(PKG_FMT) \
51   $(NVR).$(PKG_FMT) \
52   $(NVR).$(PKG_FMT).$(SUM) \
53   repos.ks ovirt-authorized_keys
55 # For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT-
56 # annotated rpm version strings.
57 _ovirt_dev = \
58  $(shell grep -q '^[[:space:]]*Release:[[:space:]]*0' \
59    $(srcdir)/*.spec.in && echo 1 || :)
61 git_head        = $$(git log -1 --pretty=format:%h)
62 GIT_RELEASE     = $(shell date --utc +%Y%m%d%H%M%S)git$(git_head)
63 RPMDIR          = $$(rpm --eval '%{_rpmdir}')
64 RPM_FLAGS       = --define "ovirt_cache_dir $(OVIRT_CACHE_DIR)"
65 RPM_FLAGS       += $(if $(_ovirt_dev),--define "extra_release .$(GIT_RELEASE)")
67 repos.ks:
68         ( \
69             if [ 0$(FEDORA) == 0$(CUR_RAWHIDE) ]; then \
70                 FEDORA_REPO=rawhide ;\
71                 FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/development/$(ARCH)/os,--mirrorlist=$(FEDORA_MIRROR)?repo=rawhide&arch=$(ARCH))" ;\
72                 OVIRT_DISTRO=development ;\
73             else \
74                 FEDORA_REPO=f$(FEDORA) ;\
75                 FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/releases/$(FEDORA)/Everything/${ARCH}/os,--mirrorlist=$(FEDORA_MIRROR)?repo=fedora-$(FEDORA)&arch=$(ARCH))" ;\
76                 OVIRT_DISTRO=$(FEDORA) ;\
77                 UPDATE_REPO_LINE="repo --name=$${FEDORA_REPO}-updates $(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/updates/$(FEDORA)/${ARCH},--mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-f$(FEDORA)&arch=$(ARCH))" ;\
78             fi ;\
79             echo "repo --name=$${FEDORA_REPO} $${FEDORA_REPO_LOC}" > $@ ;\
80             echo "repo --name=ovirt-org --baseurl=$(OVIRT_URL)/$${OVIRT_DISTRO}/$(ARCH)" >> $@ ;\
81             echo "$${UPDATE_REPO_LINE}" >> $@ ;\
82             echo "repo --name=ovirt-local --baseurl=$(OVIRT_LOCAL_REPO)" >> $@ \
83         )
85 keys:
86         if [ "$(_ovirt_dev)" = 1 -a -f $(AUTH_KEYS) ]; then \
87             cp -va $(AUTH_KEYS) ovirt-authorized_keys ;\
88         fi
90 SELINUX_ENFORCING=$(shell /usr/sbin/getenforce)
91 $(NVR).$(PKG_FMT): repos.ks keys
92         mkdir -p $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp
93         mkdir -p $(OVIRT_CACHE_DIR)/yum
94         ( \
95             case $(SELINUX_ENFORCING) in \
96                 Enforcing) sudo /usr/sbin/setenforce Permissive ;; \
97                 Permissive) ;; \
98                 *) if ksflatten $(PACKAGE).ks 2>/dev/null \
99                        | grep -q '^selinux --disabled'; then \
100                        echo WARNING: SELinux disabled in kickstart ;\
101                    else \
102                        echo ERROR: SELinux enabled in kickstart, \
103                        but disabled on the build machine ;\
104                        exit 1 ;\
105                    fi ;; \
106             esac ;\
107         )
108         sudo livecd-creator --skip-minimize -c $(PACKAGE).ks \
109             -f $(PACKAGE) \
110             --tmpdir='$(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp' \
111             --cache='$(OVIRT_CACHE_DIR)/yum'
112         sudo chown $${USER} $(PACKAGE).$(PKG_FMT)
113         ( \
114             if [ $(SELINUX_ENFORCING) = Enforcing ]; then \
115                 sudo /usr/sbin/setenforce Enforcing || exit 1 ;\
116             fi \
117         )
119         ln -nf $(PACKAGE).$(PKG_FMT) $(NVR).$(PKG_FMT)
121 $(NVR).$(PKG_FMT).$(SUM): $(NVR).$(PKG_FMT)
122         $(SUM) $(NVR).$(PKG_FMT) > $(NVR).$(PKG_FMT).$(SUM)
124 $(PACKAGE).$(PKG_FMT) node: $(NVR).$(PKG_FMT).$(SUM)
126 rpms: dist node
127         rpmbuild $(RPM_FLAGS) -ts $(distdir).tar.gz
128         rpmbuild $(RPM_FLAGS) --define "source_iso 1" -tb $(distdir).tar.gz
130 publish: rpms
131         mkdir -p $(OVIRT_CACHE_DIR)
132         rsync -aq $(shell rpm --eval '%{_rpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/
133         rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/src
134         createrepo $(OVIRT_CACHE_DIR)/ovirt
136 .PHONY: rpms publish $(NVR).$(PKG_FMT).$(SUM) $(NVR).$(PKG_FMT) \
137   $(PACKAGE).$(PKG_FMT) keys repos.ks