]> code.delx.au - refind/commitdiff
Improvements to installation script.
authorsrs5694 <srs5694@users.sourceforge.net>
Thu, 3 Jan 2013 03:08:29 +0000 (22:08 -0500)
committersrs5694 <srs5694@users.sourceforge.net>
Thu, 3 Jan 2013 03:08:29 +0000 (22:08 -0500)
docs/refind/installing.html
install.sh
mkdistrib
refind.spec

index 05ebb419cf5940a594ebc73a5f93edcf5b0f64b1..5fd14bb3704c41d2ae1eceb3bd7d808bb30f2c21 100644 (file)
@@ -114,8 +114,6 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
    <li class="tight"><a href="#extra_installsh">Extra <tt>install.sh</tt> Instructions</a></li>
 
-   <li class="tight"><a href="#unhijack">Using <tt>refind-unhijack.sh</tt></li>
-
    </ul></li>
 
 <li class="tight"><a href="#manual">Installing rEFInd Manually</a>
@@ -130,7 +128,15 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
    <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="#naming">Alternative Naming Options</a>
+
+   <ul>
+
+   <li class="tight"><a href="#mvrefind">Using <tt>mvrefind.sh</tt></li>
+
+   <li class="tight"><a href="#manual_renaming">Renaming Files Manually</li>
+
+   </ul></li>
 
 <li class="tight"><a href="#upgrading">Upgrading rEFInd</a></li>
 
@@ -158,7 +164,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <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.3, the installation script makes an attempt to install rEFInd in a bootable way even if you run the script from a BIOS-mode boot, and therefore the RPM and Debian packages do the same. I cannot guarantee that this will work, though, and even if it does, some of the tricks that <tt>install.sh</tt> uses might not last for long. You might therefore want to run the <tt><a href="#unhijack">refind-unhijack.sh</a></tt> script after you boot Linux in EFI mode for the first time.</p>
+<p>Since version 0.6.3, the installation script makes an attempt to install rEFInd in a bootable way even if you run the script from a BIOS-mode boot, and therefore the RPM and Debian packages do the same. I cannot guarantee that this will work, though, and even if it does, some of the tricks that <tt>install.sh</tt> uses might not last for long. You might therefore want to use <tt><a href="#mvrefind">mvrefind.sh</a></tt> to move your rEFInd installation to another name after you boot Linux for the first time from 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>
 
@@ -175,7 +181,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <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>
 
-<p>Before running this script under Linux, you should ensure that your ESP is mounted at <tt>/boot</tt> or <tt>/boot/efi</tt>, as described in more detail in the <a href="#linux">Installing rEFInd Manually Using Linux</a> section. (If you installed Linux in EFI mode, chances are your ESP is properly mounted.) This precaution isn't necessary under OS X. If you run <tt>install.sh</tt> from a BIOS/legacy-mode boot, particularly on a computer that also runs Windows, you should be aware that the tricks the script uses to install itself from BIOS mode are rather delicate. You can convert to a more conventional configuration using the <a href="#unhijack"><tt>refind-unhijack.sh</tt> script.</a></p>
+<p>Before running this script under Linux, you should ensure that your ESP is mounted at <tt>/boot</tt> or <tt>/boot/efi</tt>, as described in more detail in the <a href="#linux">Installing rEFInd Manually Using Linux</a> section. (If you installed Linux in EFI mode, chances are your ESP is properly mounted.) This precaution isn't necessary under OS X. If you run <tt>install.sh</tt> from a BIOS/legacy-mode boot, particularly on a computer that also runs Windows, you should be aware that the tricks the script uses to install itself from BIOS mode are rather delicate. You can convert to a more conventional configuration using the <a href="#mvrefind"><tt>mvrefind.sh</tt> script.</a></p>
 
 <p>A sample run under Linux looks something like this:</p>
 
@@ -342,44 +348,6 @@ install.sh [--esp | --usedefault <tt class="variable">device-file</tt> | --root
 
 <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="unhijack">
-<h3>Using <tt>refind-unhijack.sh</tt></h3>
-</a>
-
-<p>Sometimes it's necessary to install rEFInd from a BIOS/legacy-mode boot. This can happen because you've accidentally installed Linux in this mode or because you're using a BIOS-mode emergency disc to do the installation, for instance. Ordinarily, such installations are unlikely to work, particularly if the computer already has an EFI-mode OS installed. Since version 0.6.3, though, rEFInd's <tt>install.sh</tt> script has attempted to install in one of three ways when run from BIOS mode:</p>
-
-<ul>
-
-<li>It attempts to locate existing rEFInd installations and upgrades
-    them.</li>
-
-<li>It installs rEFInd as <tt>EFI/BOOT/bootx64.efi</tt> (and
-    <tt>EFI/BOOT/bootia32.efi</tt>), the default filenames for EFI-mode
-    booting if no entries exist in the computer's NVRAM.</li>
-
-<li>It copies the Windows boot loader
-    (<tt>EFI/Microsoft/Boot/bootmgfw.efi</tt>), if present, down one level,
-    to <tt>EFI/Microsoft/bootmgfw.efi</tt>, and installs rEFInd as
-    <tt>EFI/Microsoft/Boot/bootmgfw.efi</tt>.</li>
-
-</ul>
-
-<p>The first two approaches are perfectly legitimate and are unlikely to cause problems, although they also might not work in all circumstances. The third approach is essentially an act of desperation, and it violates the usual rule that each OS should manage its own boot loader directory. It has the benefit of working, though; and in fact on some computers with buggy firmware, this approach may be the only way to get rEFInd (or any other non-Microsoft boot loader) to work. When <tt>install.sh</tt> uses this method, it notifies you of the fact:</p>
-
-<pre class="listing">Running in BIOS mode with a suspected Windows installation; moving boot loader
-files so as to install to /boot/efi/EFI/Microsoft/Boot.</pre>
-
-<p>The <tt>install.sh</tt> script preserves the Windows boot loader, and rEFInd should continue to be able to boot Windows when installed in this way. It's possible, though, that Windows will notice the change and will attempt to "fix" the "damage," which will remove rEFInd from the boot process. To avoid this problem, you can run the <tt>refind-unhijack.sh</tt> script. This script moves the rEFInd installation files to a more appropriate location on the ESP (<tt>EFI/refind</tt>) and registers rEFInd with the EFI in the officially-sanctioned manner.</p>
-
-<p>Unfortunately, on some systems you really should leave rEFInd installed as <tt>EFI/Microsoft/Boot/bootmgfw.efi</tt>; some EFIs have bugs that prevent them from launching any boot loader but that one. Thus, there are no hard-and-fast rules; you'll have to determine what works on your system and run <tt>refind-unhijack.sh</tt> or not as you deem best.</p>
-
-<p>To run the script, type its name (and perhaps its path) as <tt>root</tt>. It will report on what it does:</p>
-
-<pre class="listing"># <tt class="userinput">./refind-unhijack.sh</tt>
-I'm not yet written!</pre>
-
-<p>If you run this script on a system whose Windows boot loader has <i>not</i> been "hijacked" by rEFInd, no harm will come of it; the script only does its thing when it detects that rEFInd is installed where the Windows boot loader should be.</p>
-
 <a name="manual">
 <h2>Installing rEFInd Manually</h2>
 </a>
@@ -678,19 +646,83 @@ $ <b>ioreg -l -p IODeviceTree | grep firmware-abi</b>
 <h2>Alternative Naming Options</h2>
 </a>
 
+<p>Some EFI implementations do a poor job of honoring the boot options set via Linux's <tt>efibootmgr</tt> or other tools. You may also lack access to such utilities, such as if you must install rEFInd in Windows. In such cases, you may need to change the boot loader's name so that the EFI will see it as the default boot loader. rEFInd should then boot when your NVRAM lacks information on specific boot loaders to use. Broadly speaking, there are two alternative names that are most useful:</p>
+<ul>
+
+<li><tt class="userinput">EFI/BOOT/boot<i>arch</i>.efi</tt>&mdash;This name
+    is the official EFI fallback filename. It's most commonly used on
+    bootable removable disks, but it can be used on hard disks. It's
+    typically used only if no NVRAM entry points to a valid boot
+    loader.</li>
+
+<li><tt class="userinput">EFI/Microsoft/Boot/bootmgfw.efi</tt>&mdash;This
+    filename has no official special standing in the EFI specification, but
+    as a practical matter, many EFI implementations use it as a fallback
+    boot loader in addition to or instead of
+    <tt>EFI/BOOT/boot<i>arch</i>.efi</tt>. In fact, some give it such a
+    high precedence that you can't boot anything that's not given this
+    name!
+
+</ul>
+
+<p>If you need to use one of these names, or something more exotic, you can do so in either of two ways: You can <a href="#mvrefind">use the <tt>mvrefind.sh</tt> script</a> to move your installation in one step, or you can <a href="#manual_renaming">move and rename your files manually.</a></p>
+
+<a name="mvrefind">
+<h3>Using <tt>mvrefind.sh</tt></h3>
+</a>
+
+<p>The easiest way to move a rEFInd installation, at least in Linux, is to use the <tt>mvrefind.sh</tt> script. If you installed from one of my RPM or Debian packages, this script should be installed in <tt>/usr/sbin</tt>, so you can use it like a regular Linux command; otherwise you'll need to install it to your path yourself or type its complete path. Either way, it works much like the Linux <tt>mv</tt> command, but you pass it the directory in which a rEFInd installation appears and a target location:</p>
+
+<pre class="listing">
+# <tt class="userinput">mvrefind.sh /boot/efi/EFI/BOOT /boot/efi/EFI/refind</tt>
+</pre>
+
+<p>This example moves rEFInd from <tt>/boot/efi/EFI/BOOT</tt> to <tt>/boot/efi/EFI/refind</tt>. It differs from <tt>mv</tt> in several ways:
+
+<ul>
+
+<li>The script renames rEFInd in a way that's sensitive to its source and
+    destination directories&mdash;for instance, <tt>mvrefind.sh</tt> knows
+    that rEFInd (or shim, for Secure Boot installations) must be called
+    <tt>bootx64.efi</tt> on a 64-bit installation in
+    <tt>/boot/efi/EFI/BOOT</tt>, so it looks for rEFInd under that name
+    when copying from this directory, or it renames rEFInd to that name
+    when copying to it.</li>
+
+<li>The script creates a new NVRAM entry for rEFInd when it copies to any
+    location but <tt>EFI/BOOT</tt> or <tt>EFI/Microsoft/Boot</tt>. It
+    refuses to copy to such locations if it's not run from an EFI-mode
+    boot.</li>
+
+<li>The script knows enough to back up existing boot loaders stored in
+    <tt>EFI/BOOT</tt> or <tt>EFI/Microsoft/Boot</tt> when copying to these
+    locations. For the former location, the script backs up
+    <tt>EFI/BOOT</tt> as <tt>EFI/BOOT-rEFIndBackup</tt>; for the latter, it
+    moves <tt>EFI/Microsoft/Boot/bootmgfw.efi</tt> to
+    <tt>EFI/Microsoft/bootmgfw.efi</tt>.</li>
+
+</ul>
+
+<p>The <tt>mvrefind.sh</tt> script is likely to be useful in resolving boot problems&mdash;if your system won't boot, you can try copying the installation to <tt>/boot/efi/EFI/BOOT</tt>, <tt>/boot/efi/EFI/Microsoft/Boot</tt>, and <tt>/boot/efi/EFI/refind</tt> in turn, testing the boot process after each attempt. (These filenames all assume your ESP is mounted at <tt>/boot/efi</tt>.) You could also copy a BIOS-mode install from <tt>/boot/efi/EFI/BOOT</tt> or <tt>/boot/efi/EFI/Microsoft/Boot</tt> to <tt>/boot/efi/EFI/refind</tt> to make it more robust against Windows repairs (assuming your firmware isn't broken).</p>
+
+<a name="manual_renaming">
+<h3>Renaming Files Manually</h3>
+</a>
+
 <p>Some EFI implementations do a poor job of honoring the boot options set via Linux's <tt>efibootmgr</tt> or other tools. You may also lack access to such utilities, such as if you must install rEFInd in Windows. In such cases, you may need to change the boot loader's name so that the EFI will see it as the default boot loader. rEFInd should then boot when your NVRAM lacks information on specific boot loaders to use. To do this, follow these steps:</p>
  
 <ol>
 
 <li>Access your ESP and install rEFInd to it, as described in earlier sections.</li>
 
-<li>Look for an existing directory called <tt>EFI/BOOT</tt> or <tt>EFI/Microsoft/BOOT</tt>. If neither of these directories exist, skip the next step. (Note that FAT is case-insensitive, so the name may vary in case.)</li>
+<li>Look for an existing directory called <tt>EFI/BOOT</tt> or <tt>EFI/Microsoft/Boot</tt>. If neither of these directories exist, skip the next step. (Note that FAT is case-insensitive, so the name may vary in case.)</li>
 
-<li>Rename the existing directory or boot loader file to something else. For <tt>EFI/BOOT</tt>, try renaming it to <tt>EFI/Oldboot</tt>. For <tt>EFI/Microsoft/BOOT</tt>, move or rename the <tt>bootmgfw.efi</tt> file it contains. For instance, you can move it to <tt>EFI/Microsoft</tt>. This will keep the boot loader accessible to rEFInd's menu, while preventing the firmware from launching it automatically.</li>
+<li>Rename the existing directory or boot loader file to something else. For <tt>EFI/BOOT</tt>, try renaming it to <tt>EFI/Oldboot</tt>. For <tt>EFI/Microsoft/Boot</tt>, move or rename the <tt>bootmgfw.efi</tt> file it contains. For instance, you can move it to <tt>EFI/Microsoft</tt>. This will keep the boot loader accessible to rEFInd's menu, while preventing the firmware from launching it automatically.</li>
 
-<li>Rename/move your <tt>EFI/refind</tt> directory to <tt>EFI/BOOT</tt>. If you're working from <tt>EFI/Microsoft/BOOT</tt>, you should move the contents of your rEFInd directory to <tt>EFI/Microsoft/BOOT</tt>.</li>
+<li>Rename/move your <tt>EFI/refind</tt> directory to <tt>EFI/BOOT</tt>. If you're working from <tt>EFI/Microsoft/Boot</tt>, you should move the contents of your rEFInd directory to <tt>EFI/Microsoft/Boot</tt>.</li>
 
-<li>Rename <tt>EFI/BOOT/refind_x64.efi</tt> to the name of the boot loader it's replacing&mdash;it should become <tt>EFI/BOOT/bootx64.efi</tt> or <tt>EFI/Microsoft/BOOT/bootmgfw.efi</tt>.</li>
+<li>Rename <tt>EFI/BOOT/refind_x64.efi</tt> to the name of the boot loader it's replacing&mdash;it should become <tt>EFI/BOOT/bootx64.efi</tt> or <tt>EFI/Microsoft/Boot/bootmgfw.efi</tt>.</li>
 
 </ol>
 
@@ -726,7 +758,16 @@ $ <b>ioreg -l -p IODeviceTree | grep firmware-abi</b>
     icons directory (<tt>icons-backup</tt>, which holds the original icons,
     whereas <tt>icons</tt> holds the icons from the new package). Normally
     this just wastes some disk space; but if you've customized your icons,
-    you'll need to copy your altered icons back.</li>
+    you'll need to copy your altered icons back. Since version 0.6.2,
+    <tt>install.sh</tt> has searched for rEFInd in several locations on the
+    ESP, and will upgrade whatever it finds.</li>
+
+<li>Under an RPM- or Debian-based Linux distribution, you can use your
+    package system to install a newer version of the RPM or Debian package
+    that I provide. This will upgrade the files in your Linux filesystem
+    and re-run the <tt>install.sh</tt> script, so as with the previous
+    options, you'll waste a little disk space on duplicated icons, but the
+    process should otherwise work quite well.</li>
 
 </ul>
 
@@ -824,6 +865,8 @@ $ <tt class="userinput">sudo rm -r /EFI/refind</tt>
 
 <p>Many variants of both of these commands are possible on both OS X and Linux. For instance, you'd probably use <tt>sudo</tt> on Ubuntu; and if you installed rEFInd to your ESP on a Mac, you'd need to first mount the ESP and include its path in the <tt>rm</tt> command.</p>
 
+<p>If you installed via an RPM or Debian package in Linux, using your package manager will remove the package files, but not the files that the installer places on your ESP. Thus, you must uninstall those files manually, as just described. To complete the job, you'll also have to remove <tt>/boot/refind_linux.conf</tt>, and perhaps the <tt>/etc/refind.d</tt> directory.</p>
+
 <p>From Windows, you must reverse the directions for <a href="#windows">installing in Windows</a>&mdash;type <tt class="userinput">mountvol S: /S</tt> to mount your ESP as <tt>S:</tt>, then navigate to the <tt>S:\EFI</tt> directory and delete the <tt>refind</tt> subdirectory.</p>
 
 <p>In any of these cases, when the computer boots and cannot find the rEFInd files, it should move on to the next boot loader in its list. In my experience, some EFI firmware implementations remove boot loaders they can't find from their NVRAM lists, so nothing else will be required, provided you have another working boot loader in your firmware's list. If your firmware doesn't automatically clean up its NVRAM entries, rEFInd's entry will do little harm; however, you can delete it with the <tt>efibootmgr</tt> utility in Linux:</p>
index 91e66a4cffd49821e99b42264cafcab474c327bf..2aa1491561455f84de39ecd696345c83bcd96f3b 100755 (executable)
@@ -589,7 +589,7 @@ FindLinuxESP() {
       exit 1
    fi
    echo "ESP was found at $InstallDir using $EspFilesystem"
-} # MountLinuxESP
+} # FindLinuxESP
 
 # Uses efibootmgr to add an entry for rEFInd to the EFI's NVRAM.
 # If this fails, sets Problems=1
index 47942b291b6c9a8db8ca514535950a846761f597..972d74e119df58cdfaea78aabfad6d4a2ecd93e0 100755 (executable)
--- a/mkdistrib
+++ b/mkdistrib
@@ -47,7 +47,7 @@ make clean
 # Prepare a place and copy files there....
 mkdir -p ../snapshots/$1/refind-$1/icons
 cp --preserve=timestamps icons/*icns ../snapshots/$1/refind-$1/icons/
-cp -a docs images keys include EfiLib libeg mok refind filesystems refind.spec install.sh mkrlconf.sh CREDITS.txt NEWS.txt BUILDING.txt COPYING.txt LICENSE.txt README.txt refind.inf Make.tiano Make.common Makefile refind.conf-sample ../snapshots/$1/refind-$1
+cp -a docs images keys include EfiLib libeg mok refind filesystems refind.spec install.sh mkrlconf.sh mvrefind.sh CREDITS.txt NEWS.txt BUILDING.txt COPYING.txt LICENSE.txt README.txt refind.inf Make.tiano Make.common Makefile refind.conf-sample ../snapshots/$1/refind-$1
 
 # Go there and prepare a souce code zip file....
 cd ../snapshots/$1/
@@ -84,7 +84,7 @@ else
    cp refind/refind_x64.efi refind-bin-$1/refind/refind_x64.efi
 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
+cp -a docs keys COPYING.txt LICENSE.txt README.txt CREDITS.txt NEWS.txt install.sh mkrlconf.sh mvrefind.sh refind-bin-$1
 
 # Prepare the final .zip file
 zip -9r ../refind-bin-$1.zip refind-bin-$1
index b0ca30ef443ea17654716a2ab6d04d5f9e322633..ff883271503f0a8874742c84f6dca95a0a36fc0e 100644 (file)
@@ -1,7 +1,7 @@
 Summary: EFI boot manager software
 Name: refind
-Version: 0.6.2
-Release: 4%{?dist}
+Version: 0.6.2.1
+Release: 1%{?dist}
 License: GPLv3
 URL: http://www.rodsbooks.com/refind/
 Group: System Environment/Base
@@ -89,9 +89,10 @@ install -Dp -m0644 NEWS.txt COPYING.txt LICENSE.txt README.txt CREDITS.txt $RPM_
 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
+# Copy scripts to /usr/sbin
 mkdir -p $RPM_BUILD_ROOT/usr/sbin
 install -Dp -m0755 mkrlconf.sh $RPM_BUILD_ROOT/usr/sbin/
+install -Dp -m0755 mvrefind.sh $RPM_BUILD_ROOT/usr/sbin/
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -100,6 +101,7 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(-,root,root -)
 %doc /usr/share/doc/refind-%{version}
 /usr/sbin/mkrlconf.sh
+/usr/sbin/mvrefind.sh
 /usr/share/refind-%{version}
 /etc/refind.d/