]>
Commit | Line | Data |
---|---|---|
2d0e8e66 | 1 | # TODO |
cacb0e42 | 2 | # - add efi-boot-update pld script support |
2d0e8e66 | 3 | # - review inlined scriptlets |
d99d017c ER |
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 | |
2d0e8e66 | 6 | Summary: EFI boot manager software |
9d74d1fa | 7 | Summary(pl.UTF-8): Boot manager dla platform EFI |
2d0e8e66 | 8 | Name: refind |
d99d017c | 9 | Version: 0.6.7 |
2d0e8e66 ER |
10 | Release: 0.1 |
11 | License: GPL v3 | |
12 | Group: Base | |
13 | URL: http://www.rodsbooks.com/refind/ | |
d99d017c ER |
14 | Source0: https://downloads.sourceforge.net/project/refind/%{version}/%{name}-src-%{version}.zip |
15 | # Source0-md5: f118fd9fbc88f47b804746fbcbfb22e6 | |
cacb0e42 | 16 | BuildRequires: gnu-efi |
2d0e8e66 ER |
17 | BuildRequires: unzip |
18 | Requires: efibootmgr | |
19 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
20 | ||
21 | %define efiarch unknown | |
d99d017c | 22 | %ifarch %{ix86} |
2d0e8e66 ER |
23 | %define efiarch ia32 |
24 | %endif | |
d99d017c | 25 | %ifarch %{x8664} |
2d0e8e66 ER |
26 | %define efiarch x64 |
27 | %endif | |
28 | ||
29 | # Directory in which refind.key and refind.crt files are found for | |
30 | # signing of binaries. If absent, binaries are copied unsigned. | |
9d74d1fa | 31 | %define keydir /mnt/refind |
2d0e8e66 ER |
32 | |
33 | %description | |
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 | |
9d74d1fa | 38 | Macs. EFI-compatible OSes, including Linux, provide boot loaders that |
2d0e8e66 ER |
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. | |
46 | ||
9d74d1fa JB |
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 | |
61 | obsługą zaślepki EFI. | |
62 | ||
2d0e8e66 ER |
63 | %prep |
64 | %setup -q | |
65 | ||
66 | %build | |
f1504eb8 | 67 | %{__make} gnuefi fs_gnuefi -j1 \ |
2d0e8e66 ER |
68 | CC="%{__cc}" \ |
69 | CXX="%{__cxx}" \ | |
9d74d1fa JB |
70 | CXXFLAGS="-fpic -D_REENTRANT -D_GNU_SOURCE -Wall %{rpmcxxflags}" \ |
71 | GNUEFILIB=%{_libdir} \ | |
72 | EFILIB=%{_libdir} \ | |
73 | EFICRT0=%{_libdir} | |
2d0e8e66 ER |
74 | |
75 | %install | |
76 | rm -rf $RPM_BUILD_ROOT | |
d99d017c | 77 | install -d $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}/%{name} |
2d0e8e66 ER |
78 | |
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 | |
81 | # is available | |
82 | SBSign=$(which sbsign 2> /dev/null || :) | |
83 | if [ -f %{keydir}/refind.key -a -x $SBSign ] ; then | |
d99d017c ER |
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} | |
2d0e8e66 | 86 | for File in $(ls drivers_%{efiarch}/*_x64.efi); do |
d99d017c | 87 | $SBSign --key %{keydir}/refind.key --cert %{keydir}/refind.crt --output $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}/%{name}/$File $File |
2d0e8e66 ER |
88 | done |
89 | else | |
d99d017c ER |
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} | |
2d0e8e66 ER |
93 | fi |
94 | ||
95 | # Copy configuration and support files to %{_datadir}/%{name}-%{version} | |
d99d017c ER |
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} | |
2d0e8e66 | 99 | |
2d0e8e66 ER |
100 | # Copy keys to %{_sysconfdir}/refind.d/keys |
101 | install -d $RPM_BUILD_ROOT%{_sysconfdir}/refind.d/keys | |
d99d017c | 102 | cp -a keys/* $RPM_BUILD_ROOT%{_sysconfdir}/refind.d/keys |
2d0e8e66 ER |
103 | |
104 | # Copy scripts to %{_sbindir} | |
105 | install -d $RPM_BUILD_ROOT%{_sbindir} | |
d99d017c ER |
106 | install -p mkrlconf.sh $RPM_BUILD_ROOT%{_sbindir} |
107 | install -p mvrefind.sh $RPM_BUILD_ROOT%{_sbindir} | |
2d0e8e66 ER |
108 | |
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} | |
112 | ||
113 | %clean | |
114 | rm -rf $RPM_BUILD_ROOT | |
115 | ||
44c450bd | 116 | %if 0 |
2d0e8e66 ER |
117 | %post |
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 | |
123 | fi | |
124 | ||
125 | cd %{_datadir}/%{name}-%{version} | |
126 | ||
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) | |
131 | ||
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 | |
144 | else | |
145 | ./install.sh --shim $ShimFile --yes | |
146 | fi | |
147 | else | |
148 | ./install.sh --yes | |
149 | fi | |
150 | ||
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. | |
44c450bd | 154 | %endif |
2d0e8e66 ER |
155 | |
156 | %files | |
157 | %defattr(644,root,root,755) | |
44c450bd | 158 | %doc NEWS.txt LICENSE.txt README.txt CREDITS.txt docs/* |
2d0e8e66 ER |
159 | %dir %{_sysconfdir}/refind.d |
160 | %dir %{_sysconfdir}/refind.d/keys | |
161 | %{_sysconfdir}/refind.d/keys/* | |
d99d017c ER |
162 | %attr(755,root,root) %{_sbindir}/mkrlconf.sh |
163 | %attr(755,root,root) %{_sbindir}/mvrefind.sh | |
164 | %{_datadir}/%{name}-%{version} |