From e3f4d247692ee70479d55d024db46bc410cff975 Mon Sep 17 00:00:00 2001 From: Dan Kenigsberg Date: Mon, 20 Oct 2008 16:40:55 +0200 Subject: [PATCH] Move iso-making code from spec to Makefile Signed-off-by: Dan Kenigsberg --- Makefile.am | 53 +++++++++++++++++++++++++++++++++++++++ ovirt-node-image.spec.in | 65 ++---------------------------------------------- 2 files changed, 55 insertions(+), 63 deletions(-) diff --git a/Makefile.am b/Makefile.am index 17b26c0..37e52c6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -47,6 +47,59 @@ RPM_FLAGS += $(if $(FEDORA_URL),--define "fedora_url $(FEDORA_URL)") # OVIRT_URL env var can be set to the root of an ovirt.org mirror RPM_FLAGS += $(if $(OVIRT_URL),--define "ovirt_url $(OVIRT_URL)") +FEDORA=$(shell rpm --eval '%{fedora}') +ARCH=$(shell rpm --eval '%{_arch}') +FEDORA_MIRROR=http://mirrors.fedoraproject.org/mirrorlist +CUR_RAWHIDE=10 +OVIRT_URL=http://ovirt.org/repos/ovirt + +repos.ks: + ( \ + if [ 0$(FEDORA) == 0$(CUR_RAWHIDE) ]; then \ + FEDORA_REPO=rawhide ;\ + FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/development/$(ARCH)/os,--mirrorlist=$(FEDORA_MIRROR)?repo=rawhide&arch=$(ARCH))" ;\ + OVIRT_DISTRO=development ;\ + else \ + FEDORA_REPO=f$(FEDORA) ;\ + FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/releases/$(FEDORA)/Everything/${ARCH}/os,--mirrorlist=$(FEDORA_MIRROR)?repo=fedora-$(FEDORA)&arch=$(ARCH))" ;\ + OVIRT_DISTRO=$(FEDORA) ;\ + 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)&arch=$(ARCH))" ;\ + fi ;\ + echo "repo --name=$${FEDORA_REPO} $${FEDORA_REPO_LOC}" > $@ ;\ + echo "repo --name=ovirt-org --baseurl=$(OVIRT_URL)/$${OVIRT_DISTRO}/$(ARCH)" >> $@ ;\ + echo "$${UPDATE_REPO_LINE}" >> $@ ;\ + echo "repo --name=ovirt-local --baseurl=file://$(OVIRT_CACHE_DIR)/ovirt" >> $@ \ + ) + +SELINUX_ENFORCING=$(shell /usr/sbin/getenforce) +ovirt-node-image.iso: repos.ks + mkdir -p $(OVIRT_CACHE_DIR)/node-image-tmp + mkdir -p $(OVIRT_CACHE_DIR)/yum + ( \ + case $(SELINUX_ENFORCING) in \ + Enforcing) sudo /usr/sbin/setenforce Permissive ;; \ + Permissive) ;; \ + *) if ksflatten ovirt-image-node.ks 2>/dev/null \ + | grep -q '^selinux --disabled'; then \ + echo WARNING: SELinux disabled in kickstart ;\ + else \ + echo ERROR: SELinux enabled in kickstart, \ + but disabled on the build machine ;\ + exit 1 ;\ + fi ;; \ + esac ;\ + ) + sudo livecd-creator --skip-minimize -c ovirt-node-image.ks \ + -f ovirt-node-image \ + --tmpdir='$(OVIRT_CACHE_DIR)/node-image-tmp' \ + --cache='$(OVIRT_CACHE_DIR)/yum' + sudo chown $${USER} ovirt-node-image.iso + ( \ + if [ $(SELINUX_ENFORCING) = Enforcing ]; then \ + sudo /usr/sbin/setenforce Enforcing || exit 1 ;\ + fi \ + ) + rpms: dist rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz diff --git a/ovirt-node-image.spec.in b/ovirt-node-image.spec.in index 6f9ddac..6fb968f 100644 --- a/ovirt-node-image.spec.in +++ b/ovirt-node-image.spec.in @@ -1,8 +1,3 @@ -%{!?ovirt_cache_dir: %define ovirt_cache_dir /var/tmp/ovirt-cache} -%{!?ovirt_local_repo: %define ovirt_local_repo file://%{ovirt_cache_dir}/ovirt} -%{!?ovirt_url: %define ovirt_url http://ovirt.org/repos/ovirt} -%define fedora_mirror http://mirrors.fedoraproject.org/mirrorlist - Summary: oVirt Node ISO image Name: ovirt-node-image Version: @VERSION@ @@ -35,66 +30,10 @@ The PXE boot image for oVirt Node network boot from oVirt Server. %prep %setup -q +./configure %build -%if 0%{?fedora} == 010 - # XXX current rawhide - %if "%{?fedora_url}" == "" -cat > repos.ks << EOF -repo --name=rawhide --mirrorlist=%{fedora_mirror}?repo=rawhide&arch=%{_arch} -EOF - %else -cat > repos.ks << EOF -repo --name=rawhide --baseurl=%{fedora_url}/development/%{_arch}/os -EOF - %endif -cat >> repos.ks << EOF -repo --name=ovirt-org --baseurl=%{ovirt_url}/development/%{_arch} -EOF -%else - %if "%{?fedora_url}" == "" -cat > repos.ks << EOF -repo --name=f%{fedora} --mirrorlist=%{fedora_mirror}?repo=fedora-%{fedora}&arch=%{_arch} -repo --name=f%{fedora}-updates-newkey --mirrorlist=%{fedora_mirror}?repo=updates-released-f%{fedora}.newkey&arch=%{_arch} -EOF - %else -cat > repos.ks << EOF -repo --name=f%{fedora} --baseurl=%{fedora_url}/releases/%{fedora}/Everything/%{_arch}/os -repo --name=f%{fedora}-updates-newkey --baseurl=%{fedora_url}/updates/%{fedora}/%{_arch}.newkey -EOF - %endif -cat >> repos.ks << EOF -repo --name=ovirt-org --baseurl=%{ovirt_url}/%{fedora}/%{_arch} -EOF -%endif - -cat >> repos.ks << EOF -repo --name=ovirt-local --baseurl=%{ovirt_local_repo} -EOF - -mkdir -p %{ovirt_cache_dir}/node-image-tmp -mkdir -p %{ovirt_cache_dir}/yum - -sudo su - -c "cd $(pwd) && - enforcing=\$(getenforce) - case \$enforcing in - Enforcing) setenforce Permissive ;; - Permissive) ;; - *) if ksflatten %{name}.ks 2>/dev/null \ - | grep -q '^selinux --disabled$'; then - echo WARNING: SELinux disabled in kickstart - else - echo ERROR: SELinux enabled in kickstart, \ - but disabled on the build machine - exit 1 - fi ;; - esac - livecd-creator --skip-minimize -c %{name}.ks -f %{name} \ - --tmpdir='%{ovirt_cache_dir}/node-image-tmp' \ - --cache='%{ovirt_cache_dir}/yum' - if [ \$enforcing = Enforcing ]; then - setenforce Enforcing || exit 1 - fi" +make ovirt-node-image.iso sudo su - -c "cd $(pwd) && ./ovirt-pxe %{name}.iso" sudo su - -c "cd $(pwd) && chown -R $USER ." -- 2.11.4.GIT