]> code.delx.au - refind/blob - refind.spec
76d95333bb3094bcf344348f1bf95d32315a9c74
[refind] / refind.spec
1 Summary: EFI boot manager software
2 Name: refind
3 Version: 0.8.6.1
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.zip
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. EFI-compatbile
40 OSes, including Linux, provide boot loaders that rEFInd can detect and
41 launch. rEFInd can launch Linux EFI boot loaders such as ELILO, GRUB
42 Legacy, GRUB 2, and 3.3.0 and later kernels with EFI stub support. EFI
43 filesystem drivers for ext2/3/4fs, ReiserFS, HFS+, and ISO-9660 enable
44 rEFInd to read boot loaders from these filesystems, too. rEFInd's ability
45 to detect boot loaders at runtime makes it very easy to use, particularly
46 when paired with Linux kernels that provide EFI stub support.
47
48 %prep
49 %setup -q
50
51 %build
52 if [[ -d /usr/local/UDK2014 ]] ; then
53 make
54 make fs
55 else
56 make gnuefi
57 make fs_gnuefi
58 fi
59
60 %install
61 rm -rf $RPM_BUILD_ROOT
62 mkdir -p $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/
63
64 # Copy the rEFInd binaries (rEFInd proper and drivers) to /usr/share/refind-%{version},
65 # including signing the binaries if sbsign is installed and a %{keydir}/refind.key file
66 # is available
67 declare SBSign=`which sbsign 2> /dev/null`
68 if [[ -f %{keydir}/refind.key && -x $SBSign ]] ; then
69 $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
70 mkdir -p $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/drivers_%{efiarch}
71 for File in `ls drivers_%{efiarch}/*_x64.efi` ; do
72 $SBSign --key %{keydir}/refind.key --cert %{keydir}/refind.crt --output $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/$File $File
73 done
74 mkdir -p $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/tools_%{efiarch}
75 $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
76 else
77 install -Dp -m0644 refind/refind*.efi $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/
78 mkdir -p $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/drivers_%{efiarch}
79 cp -a drivers_%{efiarch}/* $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/drivers_%{efiarch}/
80 mkdir -p $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/tools_%{efiarch}
81 install -Dp -m0644 gptsync/gptsync_%{efiarch}.efi $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/tools_%{efiarch}/gptsync_%{efiarch}.efi
82 fi
83
84 # Copy configuration and support files to /usr/share/refind-%{version}
85 install -Dp -m0644 refind.conf-sample $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/
86 cp -a icons $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/
87 install -Dp -m0755 install.sh $RPM_BUILD_ROOT/usr/share/refind-%{version}/
88
89 # Copy documentation to /usr/share/doc/refind-%{version}
90 mkdir -p $RPM_BUILD_ROOT/usr/share/doc/refind-%{version}
91 cp -a docs/* $RPM_BUILD_ROOT/usr/share/doc/refind-%{version}/
92 install -Dp -m0644 NEWS.txt COPYING.txt LICENSE.txt README.txt CREDITS.txt $RPM_BUILD_ROOT/usr/share/doc/refind-%{version}
93
94 # Copy keys to /etc/refind.d/keys
95 mkdir -p $RPM_BUILD_ROOT/etc/refind.d/keys
96 install -Dp -m0644 keys/* $RPM_BUILD_ROOT/etc/refind.d/keys
97
98 # Copy scripts to /usr/sbin
99 mkdir -p $RPM_BUILD_ROOT/usr/sbin
100 install -Dp -m0755 mkrlconf.sh $RPM_BUILD_ROOT/usr/sbin/
101 install -Dp -m0755 mvrefind.sh $RPM_BUILD_ROOT/usr/sbin/
102
103 # Copy banners and fonts to /usr/share/refind-%{version}
104 cp -a banners $RPM_BUILD_ROOT/usr/share/refind-%{version}/
105 cp -a fonts $RPM_BUILD_ROOT/usr/share/refind-%{version}/
106
107 %clean
108 #rm -rf $RPM_BUILD_ROOT
109
110 %files
111 %defattr(-,root,root -)
112 %doc /usr/share/doc/refind-%{version}
113 /usr/sbin/mkrlconf.sh
114 /usr/sbin/mvrefind.sh
115 /usr/share/refind-%{version}
116 /etc/refind.d/
117
118 %post
119 PATH=$PATH:/usr/local/bin
120 # Remove any existing NVRAM entry for rEFInd, to avoid creating a duplicate.
121 ExistingEntry=`efibootmgr | grep "rEFInd Boot Manager" | cut -c 5-8`
122 if [[ -n $ExistingEntry ]] ; then
123 efibootmgr --bootnum $ExistingEntry --delete-bootnum
124 fi
125
126 cd /usr/share/refind-%{version}
127
128 if [[ -f /sys/firmware/efi/vars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c/data ]] ; then
129 IsSecureBoot=`od -An -t u1 /sys/firmware/efi/vars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c/data | tr -d '[[:space:]]'`
130 else
131 IsSecureBoot="0"
132 fi
133 # Note: Two find operations for ShimFile favors shim over PreLoader -- if both are
134 # present, the script uses shim rather than PreLoader.
135 declare ShimFile=`find /boot -name shim\.efi -o -name shimx64\.efi -o -name PreLoader\.efi 2> /dev/null | head -n 1`
136 if [[ ! -n $ShimFile ]] ; then
137 declare ShimFile=`find /boot -name PreLoader\.efi 2> /dev/null | head -n 1`
138 fi
139 declare SBSign=`which sbsign 2> /dev/null`
140 declare OpenSSL=`which openssl 2> /dev/null`
141
142 # Run the rEFInd installation script. Do so with the --shim option
143 # if Secure Boot mode is suspected and if a shim program can be
144 # found, or without it if not. If a shim installation is attempted
145 # and the sbsign and openssl programs can be found, do the install
146 # using a local signing key. Note that this option is undesirable
147 # for a distribution, since it would then require the user to
148 # enroll an extra MOK. I'm including it here because I'm NOT a
149 # distribution maintainer, and I want to encourage users to use
150 # their own local keys.
151 if [[ $IsSecureBoot == "1" && -n $ShimFile ]] ; then
152 if [[ -n $SBSign && -n $OpenSSL ]] ; then
153 ./install.sh --shim $ShimFile --localkeys --yes
154 else
155 ./install.sh --shim $ShimFile --yes
156 fi
157 else
158 ./install.sh --yes
159 fi
160
161 # CAUTION: Don't create a %preun or a %postun script that deletes the files
162 # installed by install.sh, since that script will run after an update, thus
163 # wiping out the just-updated files.
164
165 %changelog
166 * Sun Feb 8 2015 R Smith <rodsmith@rodsbooks.com> - 0.8.6
167 - Updated spec file for 0.8.6
168 * Sun Feb 2 2015 R Smith <rodsmith@rodsbooks.com> - 0.8.5
169 - Updated spec file for 0.8.5
170 * Mon Dec 8 2014 R Smith <rodsmith@rodsbooks.com> - 0.8.4
171 - Updated spec file for 0.8.4
172 * Sun Jul 6 2014 R Smith <rodsmith@rodsbooks.com> - 0.8.3
173 - Updated spec file for 0.8.3
174 * Sun Jun 8 2014 R Smith <rodsmith@rodsbooks.com> - 0.8.2
175 - Updated spec file for 0.8.2
176 * Thu May 15 2014 R Smith <rodsmith@rodsbooks.com> - 0.8.1
177 - Updated spec file for 0.8.1
178 * Sun May 4 2014 R Smith <rodsmith@rodsbooks.com> - 0.8.0
179 - Updated spec file for 0.8.0
180 * Sun Apr 20 2014 R Smith <rodsmith@rodsbooks.com> - 0.7.9
181 - Updated spec file for 0.7.9
182 * Sun Mar 9 2014 R Smith <rodsmith@rodsbooks.com> - 0.7.8
183 - Updated spec file for 0.7.8
184 * Fri Jan 3 2014 R Smith <rodsmith@rodsbooks.com> - 0.7.7
185 - Created spec file for 0.7.7 release