]> code.delx.au - refind/commitdiff
Changes to RPM .spec file and installation script to make for better
authorsrs5694 <srs5694@users.sourceforge.net>
Tue, 1 Jan 2013 01:28:20 +0000 (20:28 -0500)
committersrs5694 <srs5694@users.sourceforge.net>
Tue, 1 Jan 2013 01:28:20 +0000 (20:28 -0500)
RPM version.

NEWS.txt
docs/Styles/styles.css
docs/refind/getting.html
docs/refind/installing.html
install.sh
keys/README.txt
mkdistrib
refind.spec

index 231a5ca23a4794f365a6454b3b1135a0a44c92fb..535eae4e10598543aaf7374aba8dec3db7d8d36e 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -1,3 +1,8 @@
+0.6.3 (?/?/2013):
+-----------------
+
+
+
 0.6.2 (12/30/2012):
 -------------------
 
index 5721247a8cd857cf0e5fc60bde9dfcc46ef249bc..9ecaddad68dcae10859e4ba250309622936319a5 100644 (file)
@@ -62,6 +62,15 @@ h1,h2,h3,h4 {
     background-color:#EEE;
 }
 
+.navbar {
+    width: 40%;
+    float: none;
+    padding: 5px;
+    border: 5px solid gray;
+    margin: 10px;
+    background-color:#EEE;
+}
+
 .subhead {
     font-family:"Verdana", "Trebuchet", "Helvetica", sans-serif;
     font-size:150%;
@@ -72,3 +81,8 @@ h1,h2,h3,h4 {
 .left {
     text-align:left;
 }
+
+.tight {
+    margin-top: 0.25em;
+    margin-bottom: 0.5em;
+}
index d7cd60593820de838c04a58e00d2a81b79e04ea8..0db57ee20954c42b2fc039251485bb2fbf91b6e6 100644 (file)
@@ -15,7 +15,7 @@
 href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <p>Originally written: 3/14/2012; last Web page update:
-12/30/2012, referencing rEFInd 0.6.2</p>
+12/31/2012, referencing rEFInd 0.6.2</p>
 
 <p>I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!</p>
 
@@ -102,7 +102,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
     source code zip file</a></b>&mdash;This is useful if you want to compile
     the software locally. Note that I use Linux with the <a
     href="https://sourceforge.net/projects/tianocore/">TianoCore EFI
-    Development Kit 2 (EDK2)</a> to build my binary zip package (below),
+    Development Kit 2 (EDK2)</a> to build my binary packages (below),
     although the <a href="http://sourceforge.net/projects/gnu-efi">GNU-EFI</a>
     development tools are also supported.</li>
 
@@ -116,6 +116,28 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
     Which you install depends on your architecture, as described on the <a
     href="installing.html">Installing rEFInd</a> page.</li>
 
+<li><b><a
+    href="http://sourceforge.net/projects/refind/files/0.6.2/refind-0.6.2-2.x86_64.rpm/download">A
+    binary RPM file</a></b>&mdash;If you use an RPM-based <i>x</i>86-64
+    Linux system such as Fedora or openSUSE, you can install the binary RPM
+    package rather than use the binary zip file. (I don't provide an
+    equivalent 32-bit package.) This package runs the <tt>install.sh</tt>
+    script (described on the <a href="installing.html">Installing
+    rEFInd</a> page) as part of the installation process. Distribution
+    maintainers can examine the <tt>refind.spec</tt> file in the source
+    package and tweak it to their needs. The <a
+    href="http://sourceforge.net/projects/refind/files/0.6.2/refind-0.6.2-2.src.rpm/download">source
+    RPM file</a> might or might not build on your system as-is; it relies
+    on assumptions about the locations of the GNU-EFI development
+    files.</li>
+
+<li><b><a
+    href="http://sourceforge.net/projects/refind/files/0.6.2/refind_0.6.2-2_amd64.deb/download">A
+    binary Debian package</a></b>&mdash;If you use an <i>x</i>86-64 version
+    of Debian, Ubuntu, Mint, or another Debian-based distribution, you can
+    install from this package, which was converted from the binary RPM
+    package using <tt>alien</tt>.</li>
+
 <!--
 <li><b><a
     href="http://sourceforge.net/projects/refind/files/0.4.7/refind-bin-gnuefi-0.4.7.zip/download">A
@@ -146,26 +168,6 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
     be an extremely valuable diagnostic tool if you know how to use an EFI
     shell.</li>
 
-<li><b><a
-    href="http://sourceforge.net/projects/refind/files/0.6.2/refind-0.6.2-1.src.rpm/download">Source</a>
-    and <a
-    href="http://sourceforge.net/projects/refind/files/0.6.2/refind-0.6.2-1.x86_64.rpm/download">binary</a>
-    RPM files</b>&mdash;These files are intended more as demonstrations than
-    as practical packages. If you use an RPM-based <i>x</i>86-64 Linux system,
-    though, you can install the binary RPM package. (I don't provide an
-    equivalent 32-bit package.) Note, however, that this package's files are
-    not signed for use with shim or Secure Boot, and it installs four
-    filesystem drivers, which can slow down the boot process. It was also
-    compiled with GNU-EFI, which means that it lacks the ability to boot
-    BIOS-based OSes. Thus, I recommend using the binary zip file instead. If
-    you do use the RPM file, be aware that it installs rEFInd directly to
-    <tt>/boot/efi/EFI/refind</tt>, so your ESP must be mounted at
-    <tt>/boot/efi</tt>. The post-installation script, which adds rEFInd to the
-    NVRAM entries, requires <tt>efibootmgr</tt> and is likely to fail if you
-    try to install from a live CD. Distribution maintainers can examine the
-    <tt>refind.spec</tt> file in the source package and tweak it to their
-    needs and to eliminate some or all of these deficiencies.</li>
-
 <li><b><a href="https://sourceforge.net/p/refind/code">Source code via
     git</a></b>&mdash;If you want to peruse the source code in your Web
     browser or get the very latest version (including pre-release bug fixes
@@ -198,23 +200,15 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
     Tianocore toolkit, and so support booting BIOS/legacy boot loaders on
     UEFI-based PCs.</li>
 
+<li><b><a href="http://distro.ibiblio.org/fatdog/web/">Fat
+    Dog</a></b>&mdash;This variant of Puppy Linux uses a combination of
+    rEFInd and GRUB 2 to boot its installation medium in EFI mode and
+    provides a rEFInd package in its repository set.</li>
+
 <li><b>The <a href="http://nixos.org/nixpkgs/">Nix Packages
     collection</a></b>&mdash;This site creates packages for a number of
     OSes using its own packaging system.</li>
 
-<li><b><a
-    href="https://build.opensuse.org/package/show?package=refind&project=home%3Amichael-chang%3AUEFI">OpenSUSE
-    Build Service (OBS)</a></b>&mdash;This site holds a binary x86-64 build
-    of rEFInd that should install on any RPM-based distribution. It doesn't
-    completely set up rEFInd, though; it just places the rEFInd files in
-    the <tt>/usr/share/refind</tt> directory, and a copy of
-    <tt>install.sh</tt> as <tt>/usr/sbin/refind_install</tt>.
-    Unfortunately, the script makes assumptions about the locations of
-    files and so is useless when files are moved around in this way. Thus,
-    you'll need to install manually after installing this RPM, so you might
-    as well download the rEFInd binary <tt>.zip</tt> file from Sourceforge
-    instead.</li>
-
 <li><b>Slackware</b>&mdash;Although it doesn't seem to provide an official
     build, <a href="http://franck-barbenoire.fr/spip.php?article198">this
     site</a> has links to rEFInd binary packages for Slackware 13.37 and
index 68a93c874d62cbd116e78dbf53e656667d77d7f6..14f72ac62d553fa92577ffe37e06b19644cfcab7 100644 (file)
@@ -15,7 +15,7 @@
 href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <p>Originally written: 3/14/2012; last Web page update:
-12/30/2012, referencing rEFInd 0.6.2</p>
+12/31/2012, referencing rEFInd 0.6.2-2</p>
 
 
 <p>I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!</p>
@@ -90,9 +90,73 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <hr />
 
-<p class="sidebar"><b>Important:</b> A rEFInd zip file, when uncompressed, creates a directory called <tt>refind-<i>version</i></tt>, where <tt><i>version</i></tt> is the version number. This directory includes a subdirectory called <tt>refind</tt> that holds the boot loader, along with another that holds documentation, as well as miscellaneous files in <tt>refind-<i>version</i></tt> itself. When I refer to "the <tt>refind</tt> directory" on this page, I mean the directory with that precise name, not the <tt>refind-<i>version</i></tt> directory that is its parent.</p>
+<div style="float:right; width:55%">
 
-<p>Once you've uncompressed a rEFInd binary zip file, you must install it to your computer's ESP (or conceivably to some other location). The details of how you do this depend on your OS and your computer (UEFI-based PC vs. Macintosh). The upcoming sections provide details. For Linux and Mac OS X, you can use the installation script, <a href="#installsh"><tt>install.sh</tt>,</a> which provides easy one-command installation on most systems. Occasionally this script will fail, though, so I also provide explicit instructions for <a href="#linux">Linux</a> and <a href="#osx">Mac OS X.</a> Installation under <a href="#windows">Windows</a> also must be done manually. You can even install rEFInd using an <a href="#efishell">EFI shell</a> (version 2 only). In some cases, you'll have to deviate from the default naming conventions, as described in <a href="#naming">a section on this topic.</a> If you're upgrading rEFInd, see the <a href="#upgrading">section on upgrading.</a> Finally, I describe how to install some <a href="#addons">additional components</a> you might find useful.</a></p>
+<p>Once you've obtained a rEFInd binary file, you must install it to your computer's ESP (or conceivably to some other location). The details of how you do this depend on your OS and your computer (UEFI-based PC vs. Macintosh). The upcoming sections provide details. See the Contents sidebar to the left for links to specific installation procedures. For most Linux users, an RPM or Debian package is the best way to go. If your Linux system doesn't support these formats, though, or if you're running OS X, using the <tt>install.sh</tt> script can be a good way to go. If you're using Windows, you'll have to install manually.</p>
+
+<p class="sidebar" style="width:95%"><b>Important:</b> A rEFInd zip file, when uncompressed, creates a directory called <tt>refind-<i>version</i></tt>, where <tt><i>version</i></tt> is the version number. This directory includes a subdirectory called <tt>refind</tt> that holds the boot loader, along with another that holds documentation, as well as miscellaneous files in <tt>refind-<i>version</i></tt> itself. When I refer to "the <tt>refind</tt> directory" on this page, I mean the directory with that precise name, not the <tt>refind-<i>version</i></tt> directory that is its parent.</p>
+
+</div>
+
+<div class="navbar">
+
+<h4 class="tight">Contents</h4>
+
+<ul class="tight">
+
+<li class="tight"><a href="#packagefile">Installing rEFInd using an RPM or Debian package file</a></li>
+
+<li class="tight"><a href="#installsh">Installing rEFInd Using <tt>install.sh</tt> under Linux or Mac OS X</a>
+
+   <ul class="tight">
+
+   <li class="tight"><a href="#quickstart">Quick <tt>install.sh</tt> Instructions</a></li>
+
+   <li class="tight"><a href="#extra_installsh">Extra <tt>install.sh</tt> Instructions</a></li>
+
+   </ul></li>
+
+<li class="tight"><a href="#manual">Installing rEFInd Manually</a>
+
+   <ul>
+
+   <li class="tight"><a href="#linux">Installing rEFInd Manually Using Linux</a></li>
+
+   <li class="tight"><a href="#osx">Installing rEFInd Manually Using Mac OS X</a></li>
+
+   <li class="tight"><a href="#windows">Installing rEFInd Manually Using Windows</a></li>
+
+   <li class="tight"><a href="#efishell">Installing rEFInd Manually Using an EFI Shell</a></ul></li>
+
+<li class="tight"><a href="#naming">Alternative Naming Options</a></li>
+
+<li class="tight"><a href="#upgrading">Upgrading rEFInd</a></li>
+
+<li class="tight"><a href="#addons">Installing Additional Components</a></li>
+
+<li class="tight"><a href="#sluggish">Fixing a Sluggish Macintosh Boot</a></li>
+
+<li class="tight"><a href="#uninstalling">Uninstalling rEFInd</a></li>
+
+</ul>
+
+</div>
+
+<a name="packagefile">
+<h2>Installing rEFInd Using an RPM or Debian Package File</h2>
+</a>
+
+<p>Beginning with version 0.6.2, I've included an RPM package file for rEFInd, and I quickly updated this (in 0.6.2-2) to be more sophisticated and to include a Debian package file, as well. If you have a working RPM-based or Debian-based Linux installation that boots in EFI mode, using one of these files is likely to be the easiest way to install rEFInd: You need only download the file and issue an appropriate installation command. In some cases, double-clicking the package in your file manager will install it. If that doesn't work, a command like the following will install the RPM on an RPM-based system:</p>
+
+<pre class="listing"># <tt class="userinput">rpm -Uvh refind-0.6.2-2.x86_64.rpm</tt></pre>
+
+<p>On a Debian-based system, the equivalent command is:</p>
+
+<pre class="listing"># <tt class="userinput">dpkg -i refind_0.6.2-2_amd64.deb</tt></pre>
+
+<p>Either command produces output similar to that described for <a href="#installsh">using the <tt>install.sh</tt> script,</a> so you can check it for error messages and other signs of trouble. The package file installs rEFInd and registers it with the EFI to be the default boot loader. The script that runs as part of the installation process tries to determine if you're using Secure Boot, and if so it will try to configure rEFInd to launch using shim; however, this won't work correctly on all systems. Ubuntu 12.10 users who are booting with Secure Boot active should be wary, since the resulting installation will probably try to use Ubuntu's version of shim, which won't work correctly with rEFInd.</p>
+
+<p>Since version 0.6.2-2, my package files have installed the rEFInd binaries to <tt>/usr/share/refind-<tt class="variable">version</tt></tt>, the documentation to <tt>/usr/share/doc/refind-<tt class="variable">version</tt></tt>, and a few miscellaneous files elsewhere. Upon installation, the package runs the <tt>install.sh</tt> script to copy the files to the ESP. This enables you to re-install rEFInd after the fact by running <tt>install.sh</tt>, should some other tool or OS wipe the ESP or should the installation go awry. In such cases you can <a href="#installsh">use <tt>install.sh</tt></a> or <a href="#manual">install manually.</a></p>
 
 <a name="installsh">
 <h2>Installing rEFInd Using <tt>install.sh</tt> under Linux or Mac OS X</h2>
@@ -101,7 +165,9 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <p>If you're using Linux or Mac OS X, the easiest way to install rEFInd is to use the <tt>install.sh</tt> script. This script automatically copies rEFInd's files to your ESP or other target location and makes changes to your firmware's NVRAM settings so that rEFInd will start the next time you boot. If you've booted to OS X or in non-Secure-Boot EFI mode to Linux on a UEFI-based PC, <tt>install.sh</tt> will probably do the right thing, so you can get by with the quick instructions. If your setup is unusual, if your computer uses Secure Boot, or if you want to create a USB flash drive with rEFInd on it, you should read the <a href="#extra_installsh">extra instructions</a> for this utility.</p>
 
+<a name="quickstart">
 <h3>Quick <tt>install.sh</tt> Instructions</h3>
+</quickstart>
 
 <p>Under Linux, the <tt>install.sh</tt> script installs rEFInd to your disk's ESP. Under Mac OS X, the script installs rEFInd to your current OS X boot partition by default; but you can install to your ESP instead by passing the script the <tt>--esp</tt> option. Under either OS, you can install to something other than the currently-running OS by using the <tt>--root <tt class="variable">/mountpoint</tt></tt> option. (See <a href="#table1">Table 1</a> for details.)</p>
 
@@ -226,10 +292,10 @@ Installation has completed successfully.</pre>
 
 <pre class="listing">
 install.sh [--esp | --usedefault <tt class="variable">device-file</tt> | --root <tt class="variable">mount-point</tt> ] \
-           [--nodrivers | --alldrivers] [--shim <tt class="variable">shim-filename</tt>] [--localkeys]
+           [--nodrivers | --alldrivers] [--shim <tt class="variable">shim-filename</tt>] [--localkeys] [--yes]
 </pre>
 
-<p>The details of the options are summarized in <a href="#table1">Table 1.</a> Broadly speaking, they come in three classes: installation location options (<tt>--esp</tt>, <tt>--usedefault</tt>, and <tt>--root</tt>), driver options (<tt>--nodrivers</tt> and <tt>--alldrivers</tt>), and Secure Boot options (<tt>--shim</tt> and <tt>--localkeys</tt>). Using some of these options in unusual conditions can generate warnings and prompts to confirm your actions. In particular, using <tt>--shim</tt> or <tt>--localkeys</tt> when you're <i>not</i> booted in Secure Boot mode, or failing to use <tt>--shim</tt> when you <i>are</i> booted in Secure Boot mode, will generate a query and a request to confirm your installation. Consult the <a href="secureboot.html">Managing Secure Boot</a> page for more on this topic.</p>
+<p>The details of the options are summarized in <a href="#table1">Table 1.</a> Broadly speaking, they come in four classes: installation location options (<tt>--esp</tt>, <tt>--usedefault</tt>, and <tt>--root</tt>), driver options (<tt>--nodrivers</tt> and <tt>--alldrivers</tt>), Secure Boot options (<tt>--shim</tt> and <tt>--localkeys</tt>), and a user input option (<tt>--yes</tt>). Using some of these options in unusual conditions can generate warnings and prompts to confirm your actions. In particular, using <tt>--shim</tt> or <tt>--localkeys</tt> when you're <i>not</i> booted in Secure Boot mode, or failing to use <tt>--shim</tt> when you <i>are</i> booted in Secure Boot mode, will generate a query and a request to confirm your installation. Consult the <a href="secureboot.html">Managing Secure Boot</a> page for more on this topic.</p>
 
 <table border="1" cellpadding="1" cellspacing="2" summary="Table 1: Options to <tt>install.sh</tt>"><a name="table1"><caption><b>Table 1: Options to <tt>install.sh</tt></b></caption></a>
 <tr>
@@ -264,12 +330,22 @@ install.sh [--esp | --usedefault <tt class="variable">device-file</tt> | --root
    <td><tt>--localkeys</tt></td>
    <td>This option tells <tt>install.sh</tt> to generate a new Machine Owner Key (MOK), store it in <tt>/etc/refind.d/keys</tt> as <tt>refind_local.*</tt>, and re-sign all the 64-bit rEFInd binaries with this key before installing them. This is the preferable way to install rEFInd in Secure Boot mode, since it means your binaries will be signed locally rather than with my own key, which is used to sign many other users' binaries; however, this method requires that both the <tt>openssl</tt> and <tt>sbsign</tt> binaries be installed. The former is readily available in most distributions' repositories, but the latter is not, so this option is not the default.</td>
 </tr>
+<tr>
+   <td><tt>--yes</tt></td>
+   <td>This option causes the script to assume a <tt>Y</tt> input to every yes/no prompt that can be generated under certain conditions, such as if you specify <tt>--shim</tt> but <tt>install.sh</tt> detects no evidence of a Secure Boot installation. This option is intended mainly for use by scripts such as those that might be used as part of an installation via an RPM or Debian package. <b>Note:</b> I introduced this option with the 0.6.2-2 incremental release, which was primarily an update of the 0.6.2 RPM package; it's not yet available in the mainline 0.6.2 version.</td>
+</tr>
 </table>
 
 <p>In any event, you should peruse the script's output to ensure that everything looks OK. <tt>install.sh</tt> displays error messages when it encounters errors, such as if the ESP is mounted read-only or if you run out of disk space. You may need to correct such problems manually and re-run the script. In some cases you may need to fall back on manual installation, which gives you better control over details such as which partition to use for installation.</p>
 
+<a name="manual">
+<h2>Installing rEFInd Manually</h2>
+</a>
+
+<p>Sometimes the <tt>install.sh</tt> script just won't do the job, or you may need to install using an OS that it doesn't support, such as Windows. In these cases, you'll have to install rEFInd the old-fashioned way, using file-copying commands and utilities to add the program to your EFI's boot loader list. I describe how to do this with <a href="#linux">Linux</a>, <a href="#osx">OS X</a>, <a href="#windows">Windows</a>, and <a href="#efishell">the EFI shell.</a></p>
+
 <a name="linux">
-<h2>Installing rEFInd Manually Using Linux</h2>
+<h3>Installing rEFInd Manually Using Linux</h3>
 </a>
 
 <p>On a UEFI-based PC, you'll normally install rEFInd to the ESP, which is usually mounted at <tt>/boot/efi</tt>. You can verify that this is the case by using the <tt>df</tt> command:</p>
@@ -313,7 +389,7 @@ Filesystem     1K-blocks  Used Available Use% Mounted on
 <p>On some systems, <tt>efibootmgr</tt> won't do what you expect. On such systems, you may have better luck renaming the rEFInd files, as described in the <a href="#naming">Alternative Naming Options</a> section.</p>
 
 <a name="osx">
-<h2>Installing rEFInd Manually Using Mac OS X</h2>
+<h3>Installing rEFInd Manually Using Mac OS X</h3>
 </a>
 
 <p>Before installing rEFInd on a Mac, you must determine whether it uses a 32-bit or 64-bit EFI implementation. Most Intel-based Macs have 64-bit EFIs, so you should use the <tt>refind_x64.efi</tt> file with them; but very early Intel-based Macs have 32-bit EFIs (and sometimes 32-bit CPUs), which require the <tt>refind_ia32.efi</tt> file. You can determine whether your Mac needs the <i>x</i>86-64 or IA32 build by typing the following command in a Mac Terminal window:</p>
@@ -410,7 +486,7 @@ $ <b>ioreg -l -p IODeviceTree | grep firmware-abi</b>
 <p>If you want to remove rEFInd from your system, you can delete its files. The Mac will revert to booting using whatever standard boot loader it can find. Alternatively, you can use <tt>bless</tt> to bless another EFI boot loader. The GUI Startup Disk utility in System Preferences provides a simplified interface that enables you to select which OS X installation to boot, but it doesn't look for non-Apple boot loaders, so you can't use it to enable rEFInd.</p>
 
 <a name="windows">
-<h2>Installing rEFInd Manually Using Windows</h2>
+<h3>Installing rEFInd Manually Using Windows</h3>
 </a>
 
 <p class="sidebar"><b>Warning:</b> Windows 8 implements a fast shutdown feature that helps speed up shutdown and startup operations on a single-boot computer. Unfortunately, this feature can cause filesystem corruption if it's used on a multi-boot computer. You can disable the feature by launching an Administrator Command Prompt window and typing <tt class="userinput">powercfg /h off</tt> in it.</p>
@@ -456,7 +532,7 @@ $ <b>ioreg -l -p IODeviceTree | grep firmware-abi</b>
 </ul>
 
 <a name="efishell">
-<h2>Installing rEFInd Manually Using Windows</h2>
+<h3>Installing rEFInd Manually Using an EFI Shell</h3>
 </a>
 
 <p>If you can't currently boot any OS (say, because a firmware update has wiped your NVRAM entries), you may find it convenient to install rEFInd using an EFI version 2 shell. Unfortunately, the <tt>bcfg</tt> command described here is not available in the EFI version 1 shell, and the version 2 shell is unusable on many firmware implementations prior to 2.3.1. Thus, this procedure won't work for all systems.</p>
index 10b274ef0648bcf1b82a76313a3bce224328f70f..d89c9ed24d6dbe066fc8d81af92091ad29af5082 100755 (executable)
@@ -29,6 +29,7 @@
 #
 # Revision history:
 #
+# 0.6.2-1 -- Added --yes option & tweaked key-copying for use with RPM install script
 # 0.6.1   -- Added --root option; minor bug fixes
 # 0.6.0   -- Changed --drivers to --alldrivers and added --nodrivers option;
 #            changed default driver installation behavior in Linux to install
@@ -56,6 +57,7 @@ TargetX64="refind_x64.efi"
 TargetIA32="refind_ia32.efi"
 LocalKeys=0
 DeleteRefindDir=0
+AlwaysYes=0
 
 #
 # Functions used by both OS X and Linux....
@@ -91,9 +93,11 @@ GetParams() {
               ;;
          --nodrivers) InstallDrivers="none"
               ;;
+         --yes) AlwaysYes=1
+              ;;
          * ) echo "Usage: $0 [--esp | --usedefault {device-file} | --root {directory} ]"
              echo "                  [--nodrivers | --alldrivers] [--shim {shim-filename}]"
-             echo "                  [--localkeys]"
+             echo "                  [--localkeys] [--yes]"
              exit 1
       esac
       shift
@@ -116,6 +120,18 @@ GetParams() {
    EtcKeysDir="$RootDir/etc/refind.d/keys"
 } # GetParams()
 
+# Get a yes/no response from the user and place it in the YesNo variable.
+# If the AlwaysYes variable is set to 1, skip the user input and set "Y"
+# in the YesNo variable.
+ReadYesNo() {
+   if [[ $AlwaysYes == 1 ]] ; then
+      YesNo="Y"
+      echo "Y"
+   else
+      read YesNo
+   fi
+}
+
 # Abort if the rEFInd files can't be found.
 # Also sets $ConfFile to point to the configuration file,
 # $IconsDir to point to the icons directory, and
@@ -220,7 +236,7 @@ CopyDrivers() {
 # Copy the rEFInd files to the ESP or OS X root partition.
 # Sets Problems=1 if any critical commands fail.
 CopyRefindFiles() {
-   mkdir -p $InstallDir/$TargetDir &> /dev/null
+   mkdir -p $InstallDir/$TargetDir
    if [[ $TargetDir == '/EFI/BOOT' ]] ; then
       cp $RefindDir/refind_ia32.efi $InstallDir/$TargetDir/$TargetIA32 2> /dev/null
       if [[ $? != 0 ]] ; then
@@ -262,8 +278,8 @@ CopyRefindFiles() {
          if [[ $LocalKeys == 0 ]] ; then
             echo "Storing copies of rEFInd Secure Boot public keys in $EtcKeysDir"
             mkdir -p $EtcKeysDir
-            cp $ThisDir/keys/refind.cer $EtcKeysDir
-            cp $ThisDir/keys/refind.crt $EtcKeysDir
+            cp $ThisDir/keys/refind.cer $EtcKeysDir 2> /dev/null
+            cp $ThisDir/keys/refind.crt $EtcKeysDir 2> /dev/null
          fi
       fi
    else
@@ -281,7 +297,9 @@ CopyRefindFiles() {
    if [[ $? != 0 ]] ; then
       Problems=1
    fi
-   cp -rf $ThisDir/keys $InstallDir/$TargetDir/
+   mkdir -p $InstallDir/$TargetDir/keys
+   cp -rf $ThisDir/keys/*.[cd]er $InstallDir/$TargetDir/keys/ 2> /dev/null
+   cp -rf $EtcKeysDir/*.[cd]er $InstallDir/$TargetDir/keys/ 2> /dev/null
    if [[ -f $InstallDir/$TargetDir/refind.conf ]] ; then
       echo "Existing refind.conf file found; copying sample file as refind.conf-sample"
       echo "to avoid overwriting your customizations."
@@ -377,7 +395,7 @@ InstallOnOSX() {
       echo "/Library/StartupItems/rEFItBlesser found!"
       echo "This program is part of rEFIt, and will cause rEFInd to fail to work after"
       echo -n "its first boot. Do you want to remove rEFItBlesser (Y/N)? "
-      read YesNo
+      ReadYesNo
       if [[ $YesNo == "Y" || $YesNo == "y" ]] ; then
          echo "Deleting /Library/StartupItems/rEFItBlesser..."
          rm -r /Library/StartupItems/rEFItBlesser
@@ -418,8 +436,8 @@ CheckSecureBoot() {
       echo "http://www.rodsbooks.com/refind/secureboot.html."
       echo ""
       echo -n "Do you want to proceed with installation (Y/N)? "
-      read ContYN
-      if [[ $ContYN == "Y" || $ContYN == "y" ]] ; then
+      ReadYesNo
+      if [[ $YesNo == "Y" || $YesNo == "y" ]] ; then
          echo "OK; continuing with the installation..."
       else
          exit 0
@@ -436,8 +454,8 @@ CheckSecureBoot() {
       echo "http://www.rodsbooks.com/refind/secureboot.html."
       echo ""
       echo -n "Do you want to proceed with installation (Y/N)? "
-      read ContYN
-      if [[ $ContYN == "Y" || $ContYN == "y" ]] ; then
+      ReadYesNo
+      if [[ $YesNo == "Y" || $YesNo == "y" ]] ; then
          echo "OK; continuing with the installation..."
       else
          exit 0
@@ -453,8 +471,8 @@ CheckSecureBoot() {
       echo "more about it at http://www.rodsbooks.com/refind/secureboot.html."
       echo ""
       echo -n "Do you want to proceed with installation (Y/N)? "
-      read ContYN
-      if [[ $ContYN == "Y" || $ContYN == "y" ]] ; then
+      ReadYesNo
+      if [[ $YesNo == "Y" || $YesNo == "y" ]] ; then
          echo "OK; continuing with the installation..."
       else
          exit 0
@@ -621,7 +639,9 @@ AddBootEntry() {
 
 # Create a minimal/sample refind_linux.conf file in /boot.
 GenerateRefindLinuxConf() {
-   if [[ ! -f $RLConfFile ]] ; then
+   if [[ -f $RLConfFile ]] ; then
+      echo "Existing $RLConfFile found; not overwriting."
+   else
       if [[ -f "$RootDir/etc/default/grub" ]] ; then
          # We want the default options used by the distribution, stored here....
          source "$RootDir/etc/default/grub"
@@ -675,8 +695,8 @@ InstallOnLinux() {
       echo "to the following question..."
       echo
       echo -n "Are you sure you want to continue (Y/N)? "
-      read ContYN
-      if [[ $ContYN == "Y" || $ContYN == "y" ]] ; then
+      ReadYesNo
+      if [[ $YesNo == "Y" || $YesNo == "y" ]] ; then
          echo "OK; continuing with the installation..."
       else
          exit 0
index 537657052b75daace77a07b38a73d77a8c7dd301..bcf1bf3177ea253c1dc6db470860eb432f71a46d 100644 (file)
@@ -22,5 +22,8 @@ The files in this directory are:
 - canonical-uefi-ca.der -- Canonical's public key, used to sign Ubuntu
   boot loaders and kernels.
 
+- fedora-ca.cer -- Fedora's public key, used to sign Fedora 18's version of
+  shim and Fedora 18's kernels.
+
 - refind.cer & refind.crt -- My own (Roderick W. Smith's) public key,
   used to sign refind_x64.efi and the 64-bit rEFInd drivers.
index 4ce2c68c84b32c6c74c19eac9d988c7f1096501a..47942b291b6c9a8db8ca514535950a846761f597 100755 (executable)
--- a/mkdistrib
+++ b/mkdistrib
@@ -86,19 +86,24 @@ fi
 cp refind-bin-$1/refind/refind_x64.efi $StartDir
 cp -a docs keys COPYING.txt LICENSE.txt README.txt CREDITS.txt NEWS.txt install.sh mkrlconf.sh refind-bin-$1
 
-# Prepare the final .zip file and clean up
-if [[ $SignIt == 1 ]] ; then
-   umount $KeysDir
-fi
+# Prepare the final .zip file
 zip -9r ../refind-bin-$1.zip refind-bin-$1
 cd ..
 rm -r refind-$1
 
-# Prepare the RPM files
+# Prepare the RPM & Debian package files
 cp refind-src-$1.zip ~/rpmbuild/SOURCES/
 rpmbuild -ba $StartDir/refind.spec
 mv ~/rpmbuild/RPMS/*/refind-$1* ./
 mv ~/rpmbuild/SRPMS/refind-$1* ./
+sudo alien --to-deb -k -c refind-$1*x86_64.rpm
+sudo chown rodsmith: refind*deb
+rm ~/rpmbuild/SOURCES/refind-src-$1.zip
+
+# Clean up
+if [[ $SignIt == 1 ]] ; then
+   umount $KeysDir
+fi
 
 # Finish
 cd $StartDir
index 5df8cd0be0039207db944b84eb1e0bd49bf874c0..57563af56778248d17d7a59da53720ac86757fa4 100644 (file)
@@ -1,7 +1,7 @@
 Summary: EFI boot manager software
 Name: refind
 Version: 0.6.2
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: GPLv3
 URL: http://www.rodsbooks.com/refind/
 Group: System Environment/Base
@@ -9,6 +9,27 @@ Source: refind-src-%version.zip
 Requires: efibootmgr
 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 
+%define efiarch unknown
+%ifarch i386
+%define efiarch ia32
+%endif
+%ifarch i486
+%define efiarch ia32
+%endif
+%ifarch i586
+%define efiarch ia32
+%endif
+%ifarch i686
+%define efiarch ia32
+%endif
+%ifarch x86_64
+%define efiarch x64
+%endif
+
+# Directory in which refind.key and refind.crt files are found for
+# signing of binaries. If absent, binaries are copied unsigned.
+%define keydir /mnt/refind
+
 %description
 
 A graphical boot manager for EFI- and UEFI-based computers, such as all
@@ -27,50 +48,101 @@ when paired with Linux kernels that provide EFI stub support.
 %setup -q
 
 %build
-make gnuefi
-make fs_gnuefi
-rm filesystems/ext2*.efi
+if [[ -d /usr/local/UDK2010 ]] ; then
+   make
+   make fs
+else
+   make gnuefi
+   make fs_gnuefi
+fi
 
 %install
 rm -rf $RPM_BUILD_ROOT
-mkdir -p $RPM_BUILD_ROOT/boot/efi/EFI/refind
-cp -a refind/refind*.efi $RPM_BUILD_ROOT/boot/efi/EFI/refind/refind.efi
-cp -a refind.conf-sample $RPM_BUILD_ROOT/boot/efi/EFI/refind/refind.conf
-mkdir -p $RPM_BUILD_ROOT/boot/efi/EFI/refind/drivers/
-cp -a filesystems/*.efi $RPM_BUILD_ROOT/boot/efi/EFI/refind/drivers/
-cp -a icons $RPM_BUILD_ROOT/boot/efi/EFI/refind/
-cp -a keys $RPM_BUILD_ROOT/boot/efi/EFI/refind/
+mkdir -p $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/
+
+# Copy the rEFInd binaries (rEFInd proper and drivers) to /usr/share/refind-%{version},
+# including signing the binaries if sbsign is installed and a %{keydir}/refind.key file
+# is available
+declare SBSign=`which sbsign 2> /dev/null`
+if [[ -f %{keydir}/refind.key && -x $SBSign ]] ; then
+   $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
+   mkdir -p $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/drivers_%{efiarch}
+   for File in `ls drivers_%{efiarch}/*_x64.efi` ; do
+      $SBSign --key %{keydir}/refind.key --cert %{keydir}/refind.crt --output $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/$File $File
+   done
+else
+   install -Dp -m0644 refind/refind*.efi $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/
+   cp -a drivers_* $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/
+fi
+
+# Copy configuration and support files to /usr/share/refind-%{version}
+install -Dp -m0644 refind.conf-sample $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/
+cp -a icons $RPM_BUILD_ROOT/usr/share/refind-%{version}/refind/
+install -Dp -m0755 install.sh $RPM_BUILD_ROOT/usr/share/refind-%{version}/
+
+# Copy documentation to /usr/share/doc/refind-%{version}
 mkdir -p $RPM_BUILD_ROOT/usr/share/doc/refind-%{version}
 cp -a docs/* $RPM_BUILD_ROOT/usr/share/doc/refind-%{version}/
-cp -a NEWS.txt COPYING.txt LICENSE.txt README.txt CREDITS.txt $RPM_BUILD_ROOT/usr/share/doc/refind-%{version}
-mkdir -p $RPM_BUILD_ROOT/usr/share/refind
-cp -a install.sh $RPM_BUILD_ROOT/usr/share/refind/
+install -Dp -m0644 NEWS.txt COPYING.txt LICENSE.txt README.txt CREDITS.txt $RPM_BUILD_ROOT/usr/share/doc/refind-%{version}
+
+# Copy keys to /etc/refind.d/keys
+mkdir -p $RPM_BUILD_ROOT/etc/refind.d/keys
+install -Dp -m0644 keys/* $RPM_BUILD_ROOT/etc/refind.d/keys
+
+# Copy mkrlconf.sh to /usr/sbin
 mkdir -p $RPM_BUILD_ROOT/usr/sbin
-cp -a mkrlconf.sh $RPM_BUILD_ROOT/usr/sbin/
+install -Dp -m0755 mkrlconf.sh $RPM_BUILD_ROOT/usr/sbin/
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(-,root,root -)
-%doc /usr/share/doc/refind-%{version}/*.txt
-%doc /usr/share/doc/refind-%{version}/Styles/styles.css
-%doc /usr/share/doc/refind-%{version}/refind/*
-/usr/share/refind/install.sh
+%doc /usr/share/doc/refind-%{version}
 /usr/sbin/mkrlconf.sh
-/boot/efi/EFI/refind
-%config /boot/efi/EFI/refind/refind.conf
+/usr/share/refind-%{version}
+/etc/refind.d/
 
 %post
+PATH=$PATH:/usr/local/bin
+# Remove any existing NVRAM entry for rEFInd, to avoid creating a duplicate.
 ExistingEntry=`efibootmgr | grep "rEFInd Boot Manager" | cut -c 5-8`
-if [[ ! -n $ExistingEntry ]] ; then
-   InstallDisk=`grep /boot/efi /etc/mtab | cut -d " " -f 1 | cut -c 1-8`
-   PartNum=`grep /boot/efi /etc/mtab | cut -d " " -f 1 | cut -c 9-10`
-   efibootmgr -c -d $InstallDisk -p $PartNum -l \\EFI\\refind\\refind.efi -L "rEFInd Boot Manager"
+if [[ -n $ExistingEntry ]] ; then
+   efibootmgr --bootnum $ExistingEntry --delete-bootnum
+fi
+
+cd /usr/share/refind-%{version}
+
+declare VarFile=`ls -d /sys/firmware/efi/vars/SecureBoot* 2> /dev/null`
+declare ShimFile=`find /boot -name shim\.efi 2> /dev/null | grep -v refind | head -n 1`
+declare SBSign=`which sbsign 2> /dev/null`
+declare OpenSSL=`which openssl 2> /dev/null`
+
+# Run the rEFInd installation script. Do so with the --shim option
+# if Secure Boot mode is suspected and if a shim program can be
+# found, or without it if not. If a shim installation is attempted
+# and the sbsign and openssl programs can be found, do the install
+# using a local signing key. Note that this option is undesirable
+# for a distribution, since it would then require the user to
+# enroll an extra MOK. I'm including it here because I'm NOT a
+# distribution maintainer, and I want to encourage users to use
+# their own local keys.
+if [[ -n $VarFile && -n $ShimFile ]] ; then
+   if [[ -n $SBSign && -n $OpenSSL ]] ; then
+      ./install.sh --shim $ShimFile --localkeys --yes
+   else
+      ./install.sh --shim $ShimFile --yes
+   fi
+else
+   ./install.sh --yes
 fi
-/usr/sbin/mkrlconf.sh
 
+# CAUTION: Don't create a %preun or a %postun script that deletes the files
+# installed by install.sh, since that script will run after an update, thus
+# wiping out the just-updated files.
 
 %changelog
+* Mon Dec 31 2012 R Smith <rodsmith@rodsbooks.com> - 0.6.2-2
+- Improved installation procedures
 * Sun Dec 30 2012 R Smith <rodsmith@rodsbooks.com> - 0.6.2
 - Created spec file for 0.6.2 release