2 # - add efi-boot-update pld script support
3 # - review inlined scriptlets
4 # - note: invoking efibootmgr can cause firmware corruption on some mactel firmware
5 # http://www.rodsbooks.com/refind/installing.html, but then you probably won't install this tool there
6 Summary: EFI boot manager software
7 Summary(pl.UTF-8): Boot manager dla platform EFI
13 URL: http://www.rodsbooks.com/refind/
14 Source0: https://downloads.sourceforge.net/project/refind/%{version}/%{name}-src-%{version}.zip
15 # Source0-md5: f118fd9fbc88f47b804746fbcbfb22e6
16 BuildRequires: gnu-efi
19 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
21 %define efiarch unknown
29 # Directory in which refind.key and refind.crt files are found for
30 # signing of binaries. If absent, binaries are copied unsigned.
31 %define keydir /mnt/refind
34 A graphical boot manager for EFI- and UEFI-based computers, such as
35 all Intel-based Macs and recent (most 2011 and later) PCs. rEFInd
36 presents a boot menu showing all the EFI boot loaders on the
37 EFI-accessible partitions, and optionally BIOS-bootable partitions on
38 Macs. EFI-compatible OSes, including Linux, provide boot loaders that
39 rEFInd can detect and launch. rEFInd can launch Linux EFI boot loaders
40 such as ELILO, GRUB Legacy, GRUB 2, and 3.3.0 and later kernels with
41 EFI stub support. EFI filesystem drivers for ext2/3/4fs, ReiserFS,
42 HFS+, and ISO-9660 enable rEFInd to read boot loaders from these
43 filesystems, too. rEFInd's ability to detect boot loaders at runtime
44 makes it very easy to use, particularly when paired with Linux kernels
45 that provide EFI stub support.
47 %description -l pl.UTF-8
48 Graficzny boot manager dla komputerów opartych na EFI i UEFI, takich
49 jak wszystkie komputery Mac z procesorem Intela oraz nowsze PC
50 (większość wyprodukowanych od 2011 roku). rEFInd prezentuje menu
51 startowe pokazujące boot loadery EFI na partycjach dostępnych dla EFI
52 oraz opcjonalnie opartycje startowe BIOS-u na Makach. Systemy
53 operacyjne zgodne z EFI, w tym Linux, udostępniają boot loadery, które
54 rEFInd jest w stanie wykryć i uruchomić. rEFInd potrafi uruchomić
55 takie programy, jak ELILO, GRUB Legacy, GRUB 2 oraz jądra Linuksa w
56 wersji 3.3.0 lub nowszej z obsługą zaślepki EFI. Sterowniki EFI do
57 systemów plików ext2/3/4, ReiserFS, HFS+ oraz ISO-9660 umożliwiają
58 rEFIndowi uruchamianie programów także z tych systmów plików. rEFInd
59 potrafi wykrywać boot loadery w czasie działania, dzięki czemu jest
60 łatwy w użyciu, w szczególności w połączeniu z jądrami Linuksa z
67 %{__make} gnuefi fs_gnuefi -j1 \
70 CXXFLAGS="-fpic -D_REENTRANT -D_GNU_SOURCE -Wall %{rpmcxxflags}" \
71 GNUEFILIB=%{_libdir} \
76 rm -rf $RPM_BUILD_ROOT
77 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}/%{name}
79 # Copy the rEFInd binaries (rEFInd proper and drivers) to %{_datadir}/%{name}-%{version},
80 # including signing the binaries if sbsign is installed and a %{keydir}/refind.key file
82 SBSign=$(which sbsign 2> /dev/null || :)
83 if [ -f %{keydir}/refind.key -a -x $SBSign ] ; then
84 $SBSign --key %{keydir}/refind.key --cert %{keydir}/refind.crt --output $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}/%{name}/refind_%{efiarch}.efi refind/refind_%{efiarch}.efi
85 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}/%{name}/drivers_%{efiarch}
86 for File in $(ls drivers_%{efiarch}/*_x64.efi); do
87 $SBSign --key %{keydir}/refind.key --cert %{keydir}/refind.crt --output $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}/%{name}/$File $File
90 install -Dp refind/refind*.efi $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}/%{name}
91 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}/%{name}/drivers_%{efiarch}
92 cp -a drivers_%{efiarch}/* $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}/%{name}/drivers_%{efiarch}
95 # Copy configuration and support files to %{_datadir}/%{name}-%{version}
96 install -p refind.conf-sample $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}/%{name}
97 cp -a icons $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}/%{name}
98 install -p install.sh $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}
100 # Copy keys to %{_sysconfdir}/refind.d/keys
101 install -d $RPM_BUILD_ROOT%{_sysconfdir}/refind.d/keys
102 cp -a keys/* $RPM_BUILD_ROOT%{_sysconfdir}/refind.d/keys
104 # Copy scripts to %{_sbindir}
105 install -d $RPM_BUILD_ROOT%{_sbindir}
106 install -p mkrlconf.sh $RPM_BUILD_ROOT%{_sbindir}
107 install -p mvrefind.sh $RPM_BUILD_ROOT%{_sbindir}
109 # Copy banners and fonts to %{_datadir}/%{name}-%{version}
110 cp -a banners $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}
111 cp -a fonts $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}
114 rm -rf $RPM_BUILD_ROOT
118 PATH=$PATH:%{_prefix}/local/bin
119 # Remove any existing NVRAM entry for rEFInd, to avoid creating a duplicate.
120 ExistingEntry=$(efibootmgr | grep "rEFInd Boot Manager" | cut -c 5-8)
121 if [ -n $ExistingEntry ]; then
122 efibootmgr --bootnum $ExistingEntry --delete-bootnum
125 cd %{_datadir}/%{name}-%{version}
127 VarFile=$(ls -d /sys/firmware/efi/vars/SecureBoot* 2> /dev/null)
128 ShimFile=$(find /boot -name shim\.efi 2> /dev/null | head -n 1)
129 SBSign=$(which sbsign 2> /dev/null)
130 OpenSSL=$(which openssl 2> /dev/null)
132 # Run the rEFInd installation script. Do so with the --shim option
133 # if Secure Boot mode is suspected and if a shim program can be
134 # found, or without it if not. If a shim installation is attempted
135 # and the sbsign and openssl programs can be found, do the install
136 # using a local signing key. Note that this option is undesirable
137 # for a distribution, since it would then require the user to
138 # enroll an extra MOK. I'm including it here because I'm NOT a
139 # distribution maintainer, and I want to encourage users to use
140 # their own local keys.
141 if [ -n $VarFile -a -n $ShimFile ]; then
142 if [ -n $SBSign -a -n $OpenSSL ]; then
143 ./install.sh --shim $ShimFile --localkeys --yes
145 ./install.sh --shim $ShimFile --yes
151 # CAUTION: Don't create a %preun or a %postun script that deletes the files
152 # installed by install.sh, since that script will run after an update, thus
153 # wiping out the just-updated files.
157 %defattr(644,root,root,755)
158 %doc NEWS.txt LICENSE.txt README.txt CREDITS.txt docs/*
159 %dir %{_sysconfdir}/refind.d
160 %dir %{_sysconfdir}/refind.d/keys
161 %{_sysconfdir}/refind.d/keys/*
162 %attr(755,root,root) %{_sbindir}/mkrlconf.sh
163 %attr(755,root,root) %{_sbindir}/mvrefind.sh
164 %{_datadir}/%{name}-%{version}