Drop support for f16, f17 (obsolete) and add support for f19.
[a-fedora-appliance.git] / a-fedora-appliance.spec.in
1 # If you have trouble building locally ('make local') try adding
2 #   %libguestfs_buildnet 1
3 # to your ~/.rpmmacros file.
4
5 # Enable to build using a network repo
6 # Default is disabled
7 %if %{defined libguestfs_buildnet}
8 %global buildnet %{libguestfs_buildnet}
9 %else
10 %global buildnet 0
11 %endif
12
13 %global supermindir %{_libdir}/a-fedora-appliance/supermin.d
14 %global appliancedir %{_localstatedir}/lib/a-fedora-appliance
15
16
17 Name:           a-fedora-appliance
18 Version:        @VERSION@
19 Release:        @RELEASE@%{?dist}
20 Summary:        A package that contains a Fedora appliance
21
22 Group:          Applications/Emulators
23 License:        GPLv2+
24 #URL:            http://people.redhat.com/~rjones/
25 Source0:        %{name}-%{version}.tar.gz
26
27 BuildRequires:  @PACKAGELIST@
28 Requires:       @PACKAGELIST@
29
30 BuildRequires:  createrepo
31
32 BuildRequires:  febootstrap >= 3.3
33 Requires(post): febootstrap-supermin-helper >= 3.3
34
35 Requires:       qemu-kvm >= 0.12
36
37 # Provide our own custom requires for the supermin appliance.
38 Source1:        extra-find-requires.sh
39 %global _use_internal_dependency_generator 0
40 %global __find_provides %{_rpmconfigdir}/find-provides
41 %global __find_requires %{SOURCE1} %{_rpmconfigdir}/find-requires
42
43
44 %description
45 This is a package that contains a Fedora appliance, otherwise known as
46 a small Fedora virtual machine.
47
48 You can boot this virtual machine, log into it, and use it as a
49 throwaway to test Fedora things.  Or you can use it as a test of your
50 hypervisor or virtual machine management tools.
51
52 Note: The appliance only contains command line tools (no X11 or office
53 suites).  rpm and yum installation of packages is not supported.
54
55 %if 0%{?fedora} >= 1
56 This package contains an appliance built for Fedora %{fedora}.
57 %endif
58
59
60 %prep
61 %setup -q
62
63
64 %build
65 %if %{buildnet}
66 %define extra %{nil}
67 %else
68 mkdir repo
69 find /var/cache/yum -type f -name '*.rpm' -print0 | xargs -0 cp -t repo
70 createrepo repo
71 cat > yum.conf <<EOF
72 [main]
73 cachedir=/var/cache/yum
74 debuglevel=1
75 logfile=/var/log/yum.log
76 retries=20
77 obsoletes=1
78 gpgcheck=0
79 assumeyes=1
80 reposdir=/dev/null
81
82 [local]
83 name=local
84 baseurl=file://$(pwd)/repo
85 failovermethod=priority
86 enabled=1
87 gpgcheck=0
88 EOF
89 %define extra --with-yum-config=$(pwd)/yum.conf
90 %endif
91
92 %configure %{extra}
93
94 make
95
96
97 %install
98 make DESTDIR=$RPM_BUILD_ROOT install
99
100 mkdir -p $RPM_BUILD_ROOT%{appliancedir}
101
102
103 %post
104 # XXX We should add an RPM trigger so that this gets rebuilt after any
105 # dependent package install (recursively).
106
107 %{_libexecdir}/build-a-fedora-appliance "%{supermindir}" \
108   "%{appliancedir}/kernel" "%{appliancedir}/initrd" "%{appliancedir}/root" && \
109   echo "Fedora %{fedora} appliance built in %{appliancedir}"
110
111
112 %preun
113 if [ "$1" -eq 0 ]; then
114    rm -f "%{appliancedir}/kernel" "%{appliancedir}/initrd" "%{appliancedir}/root"
115 fi
116
117
118 %files
119 %defattr(-,root,root,-)
120 %doc README COPYING
121 %dir %{appliancedir}
122 %{_libdir}/a-fedora-appliance/
123 %{_libexecdir}/build-a-fedora-appliance
124 %{_bindir}/boot-a-fedora-appliance
125
126
127 %changelog
128 * Mon Oct 10 2011 Richard W.M. Jones <rjones@redhat.com> - 1.0-@RELEASE@
129 - Initial release.