From 849bd62e3cc11418d8645c067dea5ec088b3c30a Mon Sep 17 00:00:00 2001 From: srs5694 Date: Tue, 26 Jan 2016 14:29:34 -0500 Subject: [PATCH] Fixed refind-install bug that could cause mountesp script to be installed as a FILE called /usr/local/bin, if that directory did not exist. --- Makefile | 2 +- docs/refind/sip.html | 12 ++++++------ refind-install | 7 +++++-- refind/legacy.h | 1 + refind/lib.c | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 588fe2d..17a181e 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ MOK_DIR=mok GPTSYNC_DIR=gptsync EFILIB_DIR=EfiLib export EDK2BASE=/usr/local/UDK2014/MyWorkSpace -export REFIND_VERSION='L"0.10.1.3"' +export REFIND_VERSION='L"0.10.2"' # The "all" target builds with the TianoCore library if possible, but falls # back on the more easily-installed GNU-EFI library if TianoCore isn't diff --git a/docs/refind/sip.html b/docs/refind/sip.html index dbedfa8..e3ae392 100644 --- a/docs/refind/sip.html +++ b/docs/refind/sip.html @@ -201,7 +201,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

  • Type df -h in the Terminal. This produces a list of partitions that are mounted. Locate the one on which you unpacked the rEFInd files. It will normally be /Volumes/Somename, where Somename is the volume's name.
  • -
  • In the Terminal, use cd to change to the directory where the rEFInd files you unpacked earlier are stored. For instance, on my MacBook, I would type cd /Volumes/Macintosh\ HD/Users/rodsmith/Destkop/refind-0.10.0. Note that if any element of this path includes a space, you must either enclose the entire path in quotes or precede the space with a backslash (\), as in this example's Macintosh\ HD volume name.
  • +
  • In the Terminal, use cd to change to the directory where the rEFInd files you unpacked earlier are stored. For instance, on my MacBook, I would type cd /Volumes/Macintosh\ HD/Users/rodsmith/Destkop/refind-0.10.2. Note that if any element of this path includes a space, you must either enclose the entire path in quotes or precede the space with a backslash (\), as in this example's Macintosh\ HD volume name.
  • Type ls to verify that refind-install is present in this directory.
  • @@ -237,13 +237,13 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

    Disabling SIP with rEFInd

    -

    As described later on this page, rEFInd 0.10.0 provides SIP control features, but they're disabled by default—except on the USB flash drive and CD-R images available from the rEFInd downloads page. On these images, the SIP control features are enabled, and can toggle between the two main modes you can set via csrutil enable and csrutil disable in the Recovery HD system. Thus, to disable SIP to install rEFInd, you can:

    +

    As described later on this page, rEFInd 0.10.0 and later provide SIP control features, but they're disabled by default—except on the USB flash drive and CD-R images available from the rEFInd downloads page. On these images, the SIP control features are enabled, and can toggle between the two main modes you can set via csrutil enable and csrutil disable in the Recovery HD system. Thus, to disable SIP to install rEFInd, you can:

    1. Download the USB flash drive or CD-R version of rEFInd, as suitable for your computer.
    2. -
    3. Prepare a boot medium. With the CD-R image, you can use your favorite disc-burning software. With the USB flash drive image, you can use dd to copy the image to a blank disk, as in dd if=refind-flashdrive-0.10.0.img of=/dev/disk3 to write the image to /dev/disk3. Any existing data on the target disk will be destroyed! For this reason, it's imperative that you specify the correct target (of=) disk; if you accidentally point this command to your regular hard disk, recovery will be difficult!
    4. +
    5. Prepare a boot medium. With the CD-R image, you can use your favorite disc-burning software. With the USB flash drive image, you can use dd to copy the image to a blank disk, as in dd if=refind-flashdrive-0.10.2.img of=/dev/disk3 to write the image to /dev/disk3. Any existing data on the target disk will be destroyed! For this reason, it's imperative that you specify the correct target (of=) disk; if you accidentally point this command to your regular hard disk, recovery will be difficult!
    6. Reboot and hold down the Option (or Alt) key to see the Mac's built-in boot manager.
    7. @@ -283,7 +283,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

      Once rEFInd is installed, you can use it to manage SIP features; however, the rEFInd features needed to do this are disabled by default. You must uncomment or add two lines to your refind.conf file:

      - + -

      Note that both of these options must be set appropriately. If either of them is missing or misconfigured, rEFInd will not display the new SIP tool. A typical configuration using these features might look like this:

      +

      Note that both of these options must be set appropriately. If either of them is missing or misconfigured, rEFInd will not display the SIP tool. A typical configuration using these features might look like this:

      showtools shell,memtest,gdisk,csr_rotate,apple_recovery,windows_recovery,about,shutdown,reboot
       csr_values 10,77
      @@ -324,7 +324,7 @@ csr_values 10,77
      -

      copyright © 2015 by Roderick W. Smith

      +

      copyright © 2015-2016 by Roderick W. Smith

      This document is licensed under the terms of the GNU Free Documentation License (FDL), version 1.3.

      diff --git a/refind-install b/refind-install index 84d6615..5005bfe 100755 --- a/refind-install +++ b/refind-install @@ -39,7 +39,9 @@ # Revision history: # -# 0.10.2 -- Improved Secure Boot detection in Linux & fixed --usedefault in OS X. +# 0.10.2 -- Improved Secure Boot detection in Linux, fixed --usedefault in OS X, +# and fixed bug that could cause mountesp to be installed as a FILE +# called /usr/local/bin in OS X. # 0.10.1 -- Improve extraction of default kernel options from /proc/cmdline. # Add support for AMD64 (aka AARCH64, aa64) platform. Added # warning when --alldrivers used without --usedefault. @@ -863,7 +865,8 @@ InstallOnOSX() { DetermineTargetDir CheckForSIP CopyRefindFiles - cp "$ThisDir/mountesp" /usr/local/bin &> /dev/null + mkdir -p /usr/local/bin &> /dev/null + cp "$ThisDir/mountesp" /usr/local/bin/ &> /dev/null if [[ $InstallToEspOnMac == "1" && -z "$TargetPart" ]] ; then bless --mount "$InstallDir" --setBoot --file "$InstallDir/$TargetDir/$Refind" --shortform elif [[ "$TargetDir" != "/EFI/BOOT" ]] ; then diff --git a/refind/legacy.h b/refind/legacy.h index 3da42f2..db29673 100644 --- a/refind/legacy.h +++ b/refind/legacy.h @@ -44,6 +44,7 @@ #include "global.h" +VOID ScanShell(VOID); VOID StartLegacy(IN LEGACY_ENTRY *Entry, IN CHAR16 *SelectionName); VOID StartLegacyUEFI(LEGACY_ENTRY *Entry, CHAR16 *SelectionName); VOID ScanLegacyDisc(VOID); diff --git a/refind/lib.c b/refind/lib.c index 9c7d1f6..f38ac64 100644 --- a/refind/lib.c +++ b/refind/lib.c @@ -1094,12 +1094,12 @@ VOID ScanVolumes(VOID) // get all filesystem handles Status = LibLocateHandle(ByProtocol, &BlockIoProtocol, NULL, &HandleCount, &Handles); - UuidList = AllocateZeroPool(sizeof(EFI_GUID) * HandleCount); if (Status == EFI_NOT_FOUND) { return; // no filesystems. strange, but true... } if (CheckError(Status, L"while listing all file systems")) return; + UuidList = AllocateZeroPool(sizeof(EFI_GUID) * HandleCount); // first pass: collect information about all handles for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) { -- 2.39.2