Set spec 'Release' to 1
[ovirt-node-image.git] / ovirt-node-image.spec.in
blob0859daafb14e1872efd7bbb1c1d1ae9761ee65b5
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: 1%{?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 0%{?fedora} == 010
41 # XXX current rawhide
42 %if "%{?fedora_url}" == ""
43 cat > repos.ks << EOF
44 repo --name=rawhide --mirrorlist=%{fedora_mirror}?repo=rawhide&arch=%{_arch}
45 EOF
46 %else
47 cat > repos.ks << EOF
48 repo --name=rawhide --baseurl=%{fedora_url}/development/%{_arch}/os
49 EOF
50 %endif
51 cat >> repos.ks << EOF
52 repo --name=ovirt-org --baseurl=%{ovirt_url}/development/%{_arch}
53 EOF
54 %else
55 %if "%{?fedora_url}" == ""
56 cat > repos.ks << EOF
57 repo --name=f%{fedora} --mirrorlist=%{fedora_mirror}?repo=fedora-%{fedora}&arch=%{_arch}
58 repo --name=f%{fedora}-updates-newkey --mirrorlist=%{fedora_mirror}?repo=updates-released-f%{fedora}.newkey&arch=%{_arch}
59 EOF
60 %else
61 cat > repos.ks << EOF
62 repo --name=f%{fedora} --baseurl=%{fedora_url}/releases/%{fedora}/Everything/%{_arch}/os
63 repo --name=f%{fedora}-updates-newkey --baseurl=%{fedora_url}/updates/%{fedora}/%{_arch}.newkey
64 EOF
65 %endif
66 cat >> repos.ks << EOF
67 repo --name=ovirt-org --baseurl=%{ovirt_url}/%{fedora}/%{_arch}
68 EOF
69 %endif
71 cat >> repos.ks << EOF
72 repo --name=ovirt-local --baseurl=%{ovirt_local_repo}
73 EOF
75 mkdir -p %{ovirt_cache_dir}/node-image-tmp
76 mkdir -p %{ovirt_cache_dir}/yum
78 sudo su - -c "cd $(pwd) &&
79 enforcing=\$(getenforce)
80 case \$enforcing in
81 Enforcing) setenforce Permissive ;;
82 Permissive) ;;
83 *) if ksflatten %{name}.ks 2>/dev/null \
84 | grep -q '^selinux --disabled$'; then
85 echo WARNING: SELinux disabled in kickstart
86 else
87 echo ERROR: SELinux enabled in kickstart, \
88 but disabled on the build machine
89 exit 1
90 fi ;;
91 esac
92 livecd-creator --skip-minimize -c %{name}.ks -f %{name} \
93 --tmpdir='%{ovirt_cache_dir}/node-image-tmp' \
94 --cache='%{ovirt_cache_dir}/yum'
95 if [ \$enforcing = Enforcing ]; then
96 setenforce Enforcing || exit 1
97 fi"
98 sudo su - -c "cd $(pwd) && ./ovirt-pxe %{name}.iso"
99 sudo su - -c "cd $(pwd) && chown -R $USER ."
101 %install
102 %{__rm} -rf %{buildroot}
103 mkdir %{buildroot}
105 %{__install} -d -m0755 %{buildroot}%{tftpboot}
106 %{__install} -d -m0755 %{buildroot}%{tftpboot}/pxelinux.cfg
107 %{__install} -p -m0644 tftpboot/pxelinux.cfg/default %{buildroot}%{tftpboot}/pxelinux.cfg/default
108 %{__install} -p -m0644 tftpboot/pxelinux.0 %{buildroot}%{tftpboot}
109 %{__install} -p -m0644 tftpboot/initrd0.img %{buildroot}%{tftpboot}
110 %{__install} -p -m0644 tftpboot/vmlinuz0 %{buildroot}%{tftpboot}
111 %{__install} -d -m0755 %{buildroot}%{app_root}
112 %{__install} -p -m0644 %{name}.iso %{buildroot}%{app_root}
113 %{__install} -d -m0755 %{buildroot}%{_sbindir}
114 %{__install} -p -m0755 ovirt-pxe %{buildroot}%{_sbindir}
115 %{__install} -p -m0755 ovirt-flash %{buildroot}%{_sbindir}
116 %{__install} -p -m0755 ovirt-flash-static %{buildroot}%{_sbindir}
118 %clean
119 %{__rm} -rf %{buildroot}
121 %post pxe
122 cobbler sync > /dev/null 2>&1 || :
124 %files
125 %defattr(-,root,root,0644)
126 %{app_root}/%{name}.iso
127 %defattr(-,root,root,0755)
128 %{_sbindir}/ovirt-pxe
129 %{_sbindir}/ovirt-flash
130 %{_sbindir}/ovirt-flash-static
132 %files pxe
133 %defattr(-,root,root,0644)
134 %config(noreplace) %{tftpboot}/pxelinux.cfg/default
135 %{tftpboot}/pxelinux.0
136 %{tftpboot}/initrd0.img
137 %{tftpboot}/vmlinuz0
139 %changelog
140 * Thu Jul 03 2008 Perry Myers <pmyers@redhat.com> 0.92-0
141 - Only store ISO in SRPM, and generate PXE from that during build
143 * Tue Jun 03 2008 Alan Pevec <apevec@redhat.com> 0.0.5-1
144 - Initial build.