README: Program name does not need /usr/bin path.
[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://git.annexia.org/?p=a-fedora-appliance.git
25 Source0:        %{name}-%{version}.tar.gz
26
27 BuildRequires:  @PACKAGELIST@
28 Requires:       @PACKAGELIST@
29
30 BuildRequires:  createrepo
31
32 BuildRequires:  supermin >= 5.1.6
33
34 Requires:       qemu-kvm >= 0.12
35
36
37 %description
38 This is a package that contains a Fedora appliance, otherwise known as
39 a small Fedora virtual machine.
40
41 You can boot this virtual machine, log into it, and use it as a
42 throwaway to test Fedora things.  Or you can use it as a test of your
43 hypervisor or virtual machine management tools.
44
45 Note: The appliance only contains command line tools (no X11 or office
46 suites).  rpm and yum installation of packages is supported.
47
48 %if 0%{?fedora} >= 1
49 This package contains an appliance built for Fedora %{fedora}.
50 %endif
51
52
53 %prep
54 %setup -q
55
56
57 %build
58 %if %{buildnet}
59 %define extra %{nil}
60 %else
61 mkdir repo
62 find /var/cache/yum -type f -name '*.rpm' -print0 | xargs -0 cp -t repo
63 createrepo repo
64 cat > yum.conf <<EOF
65 [main]
66 cachedir=/var/cache/yum
67 debuglevel=1
68 logfile=/var/log/yum.log
69 retries=20
70 obsoletes=1
71 gpgcheck=0
72 assumeyes=1
73 reposdir=/dev/null
74
75 [local]
76 name=local
77 baseurl=file://$(pwd)/repo
78 failovermethod=priority
79 enabled=1
80 gpgcheck=0
81 EOF
82 %define extra --with-packager-config=$(pwd)/yum.conf
83 %endif
84
85 %configure %{extra}
86
87 make
88
89
90 %install
91 make DESTDIR=$RPM_BUILD_ROOT install
92
93 mkdir -p $RPM_BUILD_ROOT%{appliancedir}
94
95
96 %post
97 # XXX We should add an RPM trigger so that this gets rebuilt after any
98 # dependent package install (recursively).
99
100 %{_libexecdir}/build-a-fedora-appliance "%{supermindir}" "%{appliancedir}" && \
101   echo "Fedora %{fedora} appliance built in %{appliancedir}"
102
103
104 %preun
105 if [ "$1" -eq 0 ]; then
106    rm -f "%{appliancedir}/kernel" "%{appliancedir}/initrd" "%{appliancedir}/root"
107 fi
108
109
110 %files
111 %defattr(-,root,root,-)
112 %doc README COPYING
113 %dir %{appliancedir}
114 %{_libdir}/a-fedora-appliance/
115 %{_libexecdir}/build-a-fedora-appliance
116 %{_bindir}/boot-a-fedora-appliance
117
118
119 %changelog
120 * Mon Oct 10 2011 Richard W.M. Jones <rjones@redhat.com> - 1.0-@RELEASE@
121 - Initial release.