]> code.delx.au - refind/blob - refind.spec
Fixed bug that could hang system if a filesystem name was shorter than
[refind] / refind.spec
1 Summary: EFI boot manager software
2 Name: refind
3 Version: 0.6.3.2
4 Release: 1%{?dist}
5 License: GPLv3
6 URL: http://www.rodsbooks.com/refind/
7 Group: System Environment/Base
8 Source: refind-src-%version.zip
9 Requires: efibootmgr
10 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
11
12 %define efiarch unknown
13 %ifarch i386
14 %define efiarch ia32
15 %endif
16 %ifarch i486
17 %define efiarch ia32
18 %endif
19 %ifarch i586
20 %define efiarch ia32
21 %endif
22 %ifarch i686
23 %define efiarch ia32
24 %endif
25 %ifarch x86_64
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.
31 %define keydir /mnt/refind
32
33 %description
34
35 A graphical boot manager for EFI- and UEFI-based computers, such as all
36 Intel-based Macs and recent (most 2011 and later) PCs. rEFInd presents a
37 boot menu showing all the EFI boot loaders on the EFI-accessible
38 partitions, and optionally BIOS-bootable partitions on Macs. EFI-compatbile
39 OSes, including Linux, provide boot loaders that rEFInd can detect and
40 launch. rEFInd can launch Linux EFI boot loaders such as ELILO, GRUB
41 Legacy, GRUB 2, and 3.3.0 and later kernels with EFI stub support. EFI
42 filesystem drivers for ext2/3/4fs, ReiserFS, HFS+, and ISO-9660 enable
43 rEFInd to read boot loaders from these filesystems, too. rEFInd's ability
44 to detect boot loaders at runtime makes it very easy to use, particularly
45 when paired with Linux kernels that provide EFI stub support.
46
47 %prep
48 %setup -q
49
50 %build
51 if [[ -d /usr/local/UDK2010 ]] ; then
52 make
53 make fs
54 else
55 make gnuefi
56 make fs_gnuefi
57 fi
58
59 %install
60 rm -rf $RPM_BUILD_ROOT
61 mkdir -p $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/
62
63 # Copy the rEFInd binaries (rEFInd proper and drivers) to /usr/share/refind-%{version},
64 # including signing the binaries if sbsign is installed and a %{keydir}/refind.key file
65 # is available
66 declare SBSign=`which sbsign 2> /dev/null`
67 if [[ -f %{keydir}/refind.key && -x $SBSign ]] ; then
68 $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
69 mkdir -p $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/drivers_%{efiarch}
70 for File in `ls drivers_%{efiarch}/*_x64.efi` ; do
71 $SBSign --key %{keydir}/refind.key --cert %{keydir}/refind.crt --output $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/$File $File
72 done
73 else
74 install -Dp -m0644 refind/refind*.efi $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/
75 mkdir -p $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/drivers_%{efiarch}
76 cp -a drivers_%{efiarch}/* $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/drivers_%{efiarch}/
77 fi
78
79 # Copy configuration and support files to /usr/share/refind-%{version}
80 install -Dp -m0644 refind.conf-sample $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/
81 cp -a icons $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/
82 install -Dp -m0755 install.sh $RPM_BUILD_ROOT/usr/share/refind-%{version}/
83
84 # Copy documentation to /usr/share/doc/refind-%{version}
85 mkdir -p $RPM_BUILD_ROOT/usr/share/doc/refind-%{version}
86 cp -a docs/* $RPM_BUILD_ROOT/usr/share/doc/refind-%{version}/
87 install -Dp -m0644 NEWS.txt COPYING.txt LICENSE.txt README.txt CREDITS.txt $RPM_BUILD_ROOT/usr/share/doc/refind-%{version}
88
89 # Copy keys to /etc/refind.d/keys
90 mkdir -p $RPM_BUILD_ROOT/etc/refind.d/keys
91 install -Dp -m0644 keys/* $RPM_BUILD_ROOT/etc/refind.d/keys
92
93 # Copy scripts to /usr/sbin
94 mkdir -p $RPM_BUILD_ROOT/usr/sbin
95 install -Dp -m0755 mkrlconf.sh $RPM_BUILD_ROOT/usr/sbin/
96 install -Dp -m0755 mvrefind.sh $RPM_BUILD_ROOT/usr/sbin/
97
98 %clean
99 #rm -rf $RPM_BUILD_ROOT
100
101 %files
102 %defattr(-,root,root -)
103 %doc /usr/share/doc/refind-%{version}
104 /usr/sbin/mkrlconf.sh
105 /usr/sbin/mvrefind.sh
106 /usr/share/refind-%{version}
107 /etc/refind.d/
108
109 %post
110 PATH=$PATH:/usr/local/bin
111 # Remove any existing NVRAM entry for rEFInd, to avoid creating a duplicate.
112 ExistingEntry=`efibootmgr | grep "rEFInd Boot Manager" | cut -c 5-8`
113 if [[ -n $ExistingEntry ]] ; then
114 efibootmgr --bootnum $ExistingEntry --delete-bootnum
115 fi
116
117 cd /usr/share/refind-%{version}
118
119 declare VarFile=`ls -d /sys/firmware/efi/vars/SecureBoot* 2> /dev/null`
120 declare ShimFile=`find /boot -name shim\.efi 2> /dev/null | grep -v refind | head -n 1`
121 declare SBSign=`which sbsign 2> /dev/null`
122 declare OpenSSL=`which openssl 2> /dev/null`
123
124 # Run the rEFInd installation script. Do so with the --shim option
125 # if Secure Boot mode is suspected and if a shim program can be
126 # found, or without it if not. If a shim installation is attempted
127 # and the sbsign and openssl programs can be found, do the install
128 # using a local signing key. Note that this option is undesirable
129 # for a distribution, since it would then require the user to
130 # enroll an extra MOK. I'm including it here because I'm NOT a
131 # distribution maintainer, and I want to encourage users to use
132 # their own local keys.
133 if [[ -n $VarFile && -n $ShimFile ]] ; then
134 if [[ -n $SBSign && -n $OpenSSL ]] ; then
135 ./install.sh --shim $ShimFile --localkeys --yes
136 else
137 ./install.sh --shim $ShimFile --yes
138 fi
139 else
140 ./install.sh --yes
141 fi
142
143 # CAUTION: Don't create a %preun or a %postun script that deletes the files
144 # installed by install.sh, since that script will run after an update, thus
145 # wiping out the just-updated files.
146
147 %changelog
148 * Sun Jan 6 2013 R Smith <rodsmith@rodsbooks.com> - 0.6.3-2
149 - Fixed accidental inclusion of "env" as part of installation script
150 * Sun Jan 6 2013 R Smith <rodsmith@rodsbooks.com> - 0.6.3
151 - Created spec file for 0.6.3 release