6bf717083e0cbad101902686ff7ed977fe1dd35f
[refind] / refind.spec
1 Summary: EFI boot manager software
2 Name: refind
3 Version: 0.10.3
4 Release: 1%{?dist}
5 Summary: EFI boot manager software
6 License: GPLv3
7 URL: http://www.rodsbooks.com/refind/
8 Group: System Environment/Base
9 Source: refind-src-%version.tar.gz
10 Requires: efibootmgr
11 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
12
13 %define efiarch unknown
14 %ifarch i386
15 %define efiarch ia32
16 %endif
17 %ifarch i486
18 %define efiarch ia32
19 %endif
20 %ifarch i586
21 %define efiarch ia32
22 %endif
23 %ifarch i686
24 %define efiarch ia32
25 %endif
26 %ifarch x86_64
27 %define efiarch x64
28 %endif
29
30 # Directory in which refind.key and refind.crt files are found for
31 # signing of binaries. If absent, binaries are copied unsigned.
32 %define keydir /mnt/refind
33
34 %description
35
36 A graphical boot manager for EFI- and UEFI-based computers, such as all
37 Intel-based Macs and recent (most 2011 and later) PCs. rEFInd presents a
38 boot menu showing all the EFI boot loaders on the EFI-accessible
39 partitions, and optionally BIOS-bootable partitions on Macs and BIOS boot
40 entries on UEFI PCs with CSMs. EFI-compatbile OSes, including Linux,
41 provide boot loaders that rEFInd can detect and launch. rEFInd can launch
42 Linux EFI boot loaders such as ELILO, GRUB Legacy, GRUB 2, and 3.3.0 and
43 later kernels with EFI stub support. EFI filesystem drivers for ext2/3/4fs,
44 ReiserFS, Btrfs, NTFS, HFS+, and ISO-9660 enable rEFInd to read boot
45 loaders from these filesystems, too. rEFInd's ability to detect boot
46 loaders at runtime makes it very easy to use, particularly when paired with
47 Linux kernels that provide EFI stub support.
48
49 %prep
50 %setup -q
51
52 %build
53 if [[ -d /usr/local/UDK2014 ]] ; then
54 make
55 make fs
56 else
57 make gnuefi
58 make fs_gnuefi
59 fi
60
61 %install
62 rm -rf $RPM_BUILD_ROOT
63 mkdir -p $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/
64
65 # Copy the rEFInd binaries (rEFInd proper and drivers) to /usr/share/refind-%{version},
66 # including signing the binaries if sbsign is installed and a %{keydir}/refind.key file
67 # is available
68 declare SBSign=`which sbsign 2> /dev/null`
69 if [[ -f %{keydir}/refind.key && -x $SBSign ]] ; then
70 $SBSign --key %{keydir}/refind.key --cert %{keydir}/refind.crt --output $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/refind_%{efiarch}.efi refind/refind_%{efiarch}.efi
71 mkdir -p $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/drivers_%{efiarch}
72 for File in `ls drivers_%{efiarch}/*_x64.efi` ; do
73 $SBSign --key %{keydir}/refind.key --cert %{keydir}/refind.crt --output $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/$File $File
74 done
75 mkdir -p $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/tools_%{efiarch}
76 $SBSign --key %{keydir}/refind.key --cert %{keydir}/refind.crt --output $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/tools_%{efiarch}/gptsync_%{efiarch}.efi gptsync/gptsync_%{efiarch}.efi
77 else
78 install -Dp -m0644 refind/refind*.efi $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/
79 mkdir -p $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/drivers_%{efiarch}
80 cp -a drivers_%{efiarch}/* $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/drivers_%{efiarch}/
81 mkdir -p $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/tools_%{efiarch}
82 install -Dp -m0644 gptsync/gptsync_%{efiarch}.efi $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/tools_%{efiarch}/gptsync_%{efiarch}.efi
83 fi
84
85 # Copy configuration and support files to /usr/share/refind-%{version}
86 install -Dp -m0644 refind.conf-sample $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/
87 cp -a icons $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/
88 rm -rf $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/icons/svg
89 install -Dp -m0755 refind-install $RPM_BUILD_ROOT/usr/share/refind-%{version}/
90
91 # Copy documentation to /usr/share/doc/refind-%{version}
92 mkdir -p $RPM_BUILD_ROOT/usr/share/doc/refind-%{version}
93 cp -a docs/Styles $RPM_BUILD_ROOT/usr/share/doc/refind-%{version}/
94 cp -a docs/refind $RPM_BUILD_ROOT/usr/share/doc/refind-%{version}/
95 install -Dp -m0644 NEWS.txt COPYING.txt LICENSE.txt README.txt CREDITS.txt $RPM_BUILD_ROOT/usr/share/doc/refind-%{version}
96
97 # Copy man pages to /usr/share/man/man8
98 mkdir -p $RPM_BUILD_ROOT/usr/share/man/man8
99 install -Dp -m0644 docs/man/mvrefind.8 $RPM_BUILD_ROOT/usr/share/man/man8
100 install -Dp -m0644 docs/man/mkrlconf.8 $RPM_BUILD_ROOT/usr/share/man/man8
101 install -Dp -m0644 docs/man/refind-install.8 $RPM_BUILD_ROOT/usr/share/man/man8
102 install -Dp -m0644 docs/man/refind-mkdefault.8 $RPM_BUILD_ROOT/usr/share/man/man8
103
104 # Copy keys to /etc/refind.d/keys
105 mkdir -p $RPM_BUILD_ROOT/etc/refind.d/keys
106 install -Dp -m0644 keys/* $RPM_BUILD_ROOT/etc/refind.d/keys
107
108 # Copy scripts to /usr/sbin
109 mkdir -p $RPM_BUILD_ROOT/usr/sbin
110 install -Dp -m0755 mkrlconf $RPM_BUILD_ROOT/usr/sbin/
111 install -Dp -m0755 mvrefind $RPM_BUILD_ROOT/usr/sbin/
112 install -Dp -m0755 refind-mkdefault $RPM_BUILD_ROOT/usr/sbin/
113 ln -sr $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind-install $RPM_BUILD_ROOT/usr/sbin
114
115 # Copy banners and fonts to /usr/share/refind-%{version}
116 cp -a banners $RPM_BUILD_ROOT/usr/share/refind-%{version}/
117 cp -a fonts $RPM_BUILD_ROOT/usr/share/refind-%{version}/
118
119 %clean
120 #rm -rf $RPM_BUILD_ROOT
121
122 %files
123 %defattr(-,root,root -)
124 %doc /usr/share/doc/refind-%{version}
125 %doc /usr/share/man/man8
126 /usr/sbin/mkrlconf
127 /usr/sbin/mvrefind
128 /usr/sbin/refind-install
129 /usr/sbin/refind-mkdefault
130 /usr/share/refind-%{version}
131 /etc/refind.d/
132
133 %post
134 PATH=$PATH:/usr/local/bin
135 # Remove any existing NVRAM entry for rEFInd, to avoid creating a duplicate.
136 ExistingEntry=`efibootmgr | grep "rEFInd Boot Manager" | cut -c 5-8`
137 if [[ -n $ExistingEntry ]] ; then
138 efibootmgr --bootnum $ExistingEntry --delete-bootnum &> /dev/null
139 fi
140
141 cd /usr/share/refind-%{version}
142
143 if [[ -f /sys/firmware/efi/vars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c/data ]] ; then
144 IsSecureBoot=`od -An -t u1 /sys/firmware/efi/vars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c/data | tr -d '[[:space:]]'`
145 else
146 IsSecureBoot="0"
147 fi
148 # Note: Two find operations for ShimFile favors shim over PreLoader -- if both are
149 # present, the script uses shim rather than PreLoader.
150 declare ShimFile=`find /boot -name shim\.efi -o -name shimx64\.efi -o -name PreLoader\.efi 2> /dev/null | head -n 1`
151 if [[ ! -n $ShimFile ]] ; then
152 declare ShimFile=`find /boot -name PreLoader\.efi 2> /dev/null | head -n 1`
153 fi
154 declare SBSign=`which sbsign 2> /dev/null`
155 declare OpenSSL=`which openssl 2> /dev/null`
156
157 # Run the rEFInd installation script. Do so with the --shim option
158 # if Secure Boot mode is suspected and if a shim program can be
159 # found, or without it if not. If the sbsign and openssl programs
160 # can be found, do the install using a local signing key. Note that
161 # this option is undesirable for a distribution, since it would
162 # then require the user to enroll an extra MOK. I'm including it
163 # here because I'm NOT a distribution maintainer, and I want to
164 # encourage users to use their own local keys.
165 if [[ $IsSecureBoot == "1" && -n $ShimFile ]] ; then
166 if [[ -n $SBSign && -n $OpenSSL ]] ; then
167 ./refind-install --shim $ShimFile --localkeys --yes
168 else
169 ./refind-install --shim $ShimFile --yes
170 fi
171 else
172 ./refind-install --yes
173 fi
174
175 # CAUTION: Don't create a %preun or a %postun script that deletes the files
176 # installed by refind-install, since that script will run after an update,
177 # thus wiping out the just-updated files.
178
179 %changelog
180 * Sun Apr 24 2016 R Smith <rodsmith@rodsbooks.com> - 0.10.3
181 - Updated spec file for 0.10.3
182 * Tue Jan 26 2016 R Smith <rodsmith@rodsbooks.com> - 0.10.2
183 - Updated spec file for 0.10.2
184 * Sat Dec 12 2015 R Smith <rodsmith@rodsbooks.com> - 0.10.1
185 - Updated spec file for 0.10.1
186 * Sun Nov 8 2015 R Smith <rodsmith@rodsbooks.com> - 0.10.0
187 - Updated spec file for 0.10.0
188 * Sat Sep 19 2015 R Smith <rodsmith@rodsbooks.com> - 0.9.2
189 - Updated spec file for 0.9.2
190 * Sun Sep 13 2015 R Smith <rodsmith@rodsbooks.com> - 0.9.1
191 - Updated spec file for 0.9.1
192 * Sun Jul 26 2015 R Smith <rodsmith@rodsbooks.com> - 0.9.0
193 - Updated spec file for 0.9.0
194 * Sun Mar 1 2015 R Smith <rodsmith@rodsbooks.com> - 0.8.7
195 - Updated spec file for 0.8.7
196 * Sun Feb 8 2015 R Smith <rodsmith@rodsbooks.com> - 0.8.6
197 - Updated spec file for 0.8.6
198 * Sun Feb 1 2015 R Smith <rodsmith@rodsbooks.com> - 0.8.5
199 - Updated spec file for 0.8.5
200 * Mon Dec 8 2014 R Smith <rodsmith@rodsbooks.com> - 0.8.4
201 - Updated spec file for 0.8.4
202 * Sun Jul 6 2014 R Smith <rodsmith@rodsbooks.com> - 0.8.3
203 - Updated spec file for 0.8.3
204 * Sun Jun 8 2014 R Smith <rodsmith@rodsbooks.com> - 0.8.2
205 - Updated spec file for 0.8.2
206 * Thu May 15 2014 R Smith <rodsmith@rodsbooks.com> - 0.8.1
207 - Updated spec file for 0.8.1
208 * Sun May 4 2014 R Smith <rodsmith@rodsbooks.com> - 0.8.0
209 - Updated spec file for 0.8.0
210 * Sun Apr 20 2014 R Smith <rodsmith@rodsbooks.com> - 0.7.9
211 - Updated spec file for 0.7.9
212 * Sun Mar 9 2014 R Smith <rodsmith@rodsbooks.com> - 0.7.8
213 - Updated spec file for 0.7.8
214 * Fri Jan 3 2014 R Smith <rodsmith@rodsbooks.com> - 0.7.7
215 - Created spec file for 0.7.7 release