move blacklisting into separate kickstart include
[ovirt-node-image.git] / ovirt-node-image.spec.in
blob585bfdb9c7f043d97921f988bd42dc9c6eb390a3
1 %{!?ovirt_cache_dir: %define ovirt_cache_dir /var/tmp/ovirt-cache}
2 %{!?ovirt_local_repo: %define ovirt_local_repo file://%{ovirt_cache_dir}/ovirt}
3 %{!?ovirt_url: %define ovirt_url http://ovirt.org/repos/ovirt}
4 %define fedora_mirror http://mirrors.fedoraproject.org/mirrorlist
6 Summary: oVirt Node ISO image
7 Name: ovirt-node-image
8 Version: @VERSION@
9 Release: 0%{?dist}%{?extra_release}
10 Source0: %{name}-%{version}.tar.gz
11 License: GPLv2+
12 Group: Applications/System
13 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
14 URL: http://ovirt.org/
15 BuildRequires: livecd-tools >= 017.1-2ovirt
16 BuildRequires: syslinux
17 BuildRequires: appliance-tools >= 002-3
19 %define app_root %{_datadir}/%{name}
20 %define tftpboot %{_var}/lib/tftpboot
22 # disable debuginfo, makes no sense for boot image and it is created empty anyway
23 %define debug_package %{nil}
25 %description
26 The ISO boot image for oVirt Node booting from CDROM device.
27 At the moment, this RPM just packages prebuilt ISO.
29 %package pxe
30 Summary: oVirt Node PXE image
31 Group: Applications/System
33 %description pxe
34 The PXE boot image for oVirt Node network boot from oVirt Server.
36 %prep
37 %setup -q
39 %build
40 if [ -n "%{?fedora_url}" ]; then
41 cat > repos.ks << EOF
42 repo --name=f%{fedora} --baseurl=%{fedora_url}/releases/%{fedora}/Everything/%{_arch}/os
43 repo --name=f%{fedora}-updates --baseurl=%{fedora_url}/updates/%{fedora}/%{_arch}
44 repo --name=f%{fedora}-updates-newkey --baseurl=%{fedora_url}/updates/%{fedora}/%{_arch}.newkey
45 EOF
46 else
47 cat > repos.ks << EOF
48 repo --name=f%{fedora} --mirrorlist=%{fedora_mirror}?repo=fedora-%{fedora}&arch=%{_arch}
49 repo --name=f%{fedora}-updates --mirrorlist=%{fedora_mirror}?repo=updates-released-f%{fedora}&arch=%{_arch}
50 repo --name=f%{fedora}-updates-newkey --mirrorlist=%{fedora_mirror}?repo=updates-released-f%{fedora}.newkey&arch=%{_arch}
51 EOF
54 cat >> repos.ks << EOF
55 repo --name=ovirt-org --baseurl=%{ovirt_url}/%{fedora}/%{_arch}
56 repo --name=ovirt-local --baseurl=%{ovirt_local_repo}
57 EOF
59 mkdir -p %{ovirt_cache_dir}/node-image-tmp
60 mkdir -p %{ovirt_cache_dir}/yum
62 sudo su - -c "cd $(pwd) &&
63 enforcing=\$(getenforce)
64 case \$enforcing in
65 Enforcing) setenforce Permissive ;;
66 Permissive) ;;
67 *) if ksflatten %{name}.ks 2>/dev/null \
68 | grep -q '^selinux --disabled$'; then
69 echo WARNING: SELinux disabled in kickstart
70 else
71 echo ERROR: SELinux enabled in kickstart, \
72 but disabled on the build machine
73 exit 1
74 fi ;;
75 esac
76 livecd-creator --skip-minimize -c %{name}.ks -f %{name} \
77 --tmpdir='%{ovirt_cache_dir}/node-image-tmp' \
78 --cache='%{ovirt_cache_dir}/yum'
79 if [ \$enforcing = Enforcing ]; then
80 setenforce Enforcing || exit 1
81 fi"
82 sudo su - -c "cd $(pwd) && ./ovirt-pxe %{name}.iso"
83 sudo su - -c "cd $(pwd) && chown -R $USER ."
85 %install
86 %{__rm} -rf %{buildroot}
87 mkdir %{buildroot}
89 %{__install} -d -m0755 %{buildroot}%{tftpboot}
90 %{__install} -d -m0755 %{buildroot}%{tftpboot}/pxelinux.cfg
91 %{__install} -p -m0644 tftpboot/pxelinux.cfg/default %{buildroot}%{tftpboot}/pxelinux.cfg/default
92 %{__install} -p -m0644 tftpboot/pxelinux.0 %{buildroot}%{tftpboot}
93 %{__install} -p -m0644 tftpboot/initrd0.img %{buildroot}%{tftpboot}
94 %{__install} -p -m0644 tftpboot/vmlinuz0 %{buildroot}%{tftpboot}
95 %{__install} -d -m0755 %{buildroot}%{app_root}
96 %{__install} -p -m0644 %{name}.iso %{buildroot}%{app_root}
97 %{__install} -d -m0755 %{buildroot}%{_sbindir}
98 %{__install} -p -m0755 ovirt-pxe %{buildroot}%{_sbindir}
99 %{__install} -p -m0755 ovirt-flash %{buildroot}%{_sbindir}
100 %{__install} -p -m0755 ovirt-flash-static %{buildroot}%{_sbindir}
102 %clean
103 %{__rm} -rf %{buildroot}
105 %post pxe
106 cobbler sync > /dev/null 2>&1 || :
108 %files
109 %defattr(-,root,root,0644)
110 %{app_root}/%{name}.iso
111 %defattr(-,root,root,0755)
112 %{_sbindir}/ovirt-pxe
113 %{_sbindir}/ovirt-flash
114 %{_sbindir}/ovirt-flash-static
116 %files pxe
117 %defattr(-,root,root,0644)
118 %config(noreplace) %{tftpboot}/pxelinux.cfg/default
119 %{tftpboot}/pxelinux.0
120 %{tftpboot}/initrd0.img
121 %{tftpboot}/vmlinuz0
123 %changelog
124 * Thu Jul 03 2008 Perry Myers <pmyers@redhat.com> 0.92-0
125 - Only store ISO in SRPM, and generate PXE from that during build
127 * Tue Jun 03 2008 Alan Pevec <apevec@redhat.com> 0.0.5-1
128 - Initial build.