From: srs5694 Date: Mon, 2 Nov 2015 02:08:46 +0000 (-0500) Subject: Added new mountesp script to help OS X users mount the ESP. X-Git-Url: https://code.delx.au/refind/commitdiff_plain/fe0f3d769a97966be67a9a8c5404f574123f7b3a Added new mountesp script to help OS X users mount the ESP. --- diff --git a/docs/refind/configfile.html b/docs/refind/configfile.html index 57f4445..5e8fc00 100644 --- a/docs/refind/configfile.html +++ b/docs/refind/configfile.html @@ -208,7 +208,21 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

Adjusting the Global Configuration

-

You can adjust many of rEFInd's options by editing its configuration file. This file is called refind.conf by default; but you can use another filename by passing -c filename as an option, as in refind_x64.efi -c myrefind.conf to use myrefind.conf in rEFInd's main directory. You can specify a configuration file in another directory, but to do so, you must use backslashes as directory separators, as in -c \EFI\other\refind.conf. This feature is intended for users who want to have rEFInd appear in its own menu, with the version launched in this way behaving differently from the original—for instance, to have a secondary rEFInd that provides boot options hidden by the main one. In this scenario, the default refind.conf would have a manual boot stanza defining the new rEFInd instance, including its -c option.

+ + +

You can adjust many of rEFInd's options by editing its configuration file, which is called refind.conf. You must first find this file, though. It is located in the rEFInd directory. On a UEFI-based PC, this directory will be located on the EFI System Partition (ESP), which can be in any number of places:

+ + + +

As a further twist, on Macs rEFInd can exist on its own partition or on the main OS X partition, depending on the version of rEFInd you've installed and the options you passed to the installation script. rEFInd has installed to the ESP by default since version 0.8.4. rEFInd typically lives on the ESP in the EFI/refind directory, or sometimes in EFI/BOOT or elsewhere. Thus, the rEFInd configuration file might be /boot/efi/EFI/refind/refind.conf, /boot/EFI/BOOT/refind.conf, /Volumes/ESP/EFI/refind/refind.conf, S:\EFI\refind\refind.conf, or something else, depending on your OS and mount point.

You can use any text editor you like to edit refind.conf, but be sure it saves the file in plain ASCII text, not in a word processing format. (In theory, a UTF-16 encoding should also work, but this has been poorly tested.) Note that the EFI shell includes its own editor. If you need to make a change before you launch an OS, you can launch a shell, change to the rEFInd directory, and type edit refind.conf to edit the file. This EFI editor is quite primitive, but it gets the job done. After editing, you'll need to reboot or re-launch rEFInd for rEFInd to read the changed configuration file.

diff --git a/mkdistrib b/mkdistrib index 9be32c9..78ee30a 100755 --- a/mkdistrib +++ b/mkdistrib @@ -52,7 +52,7 @@ mkdir -p ../snapshots/$1/refind-$1/icons/licenses ../snapshots/$1/refind-$1/icon cp --preserve=timestamps icons/*png icons/README ../snapshots/$1/refind-$1/icons/ cp --preserve=timestamps -r icons/licenses/* ../snapshots/$1/refind-$1/icons/licenses/ cp --preserve=timestamps -r icons/svg/* ../snapshots/$1/refind-$1/icons/svg/ -cp -a debian docs images keys fonts banners include EfiLib libeg mok net refind filesystems gptsync refind.spec refind-install mkrlconf mvrefind 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 debian docs images keys fonts banners include EfiLib libeg mok net refind filesystems gptsync refind.spec refind-install mkrlconf mvrefind mountesp 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 tarball.... cd ../snapshots/$1/ @@ -102,7 +102,7 @@ else cp --preserve=timestamps gptsync/gptsync_x64.efi refind-bin-$1/refind/tools_x64/ fi cp refind-bin-$1/refind/refind_x64.efi $StartDir -cp -a docs keys banners fonts COPYING.txt LICENSE.txt README.txt CREDITS.txt NEWS.txt refind-install mkrlconf mvrefind refind-bin-$1 +cp -a docs keys banners fonts COPYING.txt LICENSE.txt README.txt CREDITS.txt NEWS.txt refind-install mkrlconf mvrefind mountesp refind-bin-$1 # Prepare the final .zip file zip -9r ../refind-bin-$1.zip refind-bin-$1 diff --git a/mountesp b/mountesp new file mode 100755 index 0000000..e1c35a7 --- /dev/null +++ b/mountesp @@ -0,0 +1,60 @@ +#!/bin/bash + +# Mount the ESP at /Volumes/ESP or determine its current mount +# point. +MountOSXESP() { + # Identify the ESP. Note: This returns the FIRST ESP found; + # if the system has multiple disks, this could be wrong! + Temp=$(mount | sed -n -E "/^(\/dev\/disk[0-9]+s[0-9]+) on \/ \(.*$/s//\1/p") + if [ $Temp ]; then + Temp=$(diskutil list | grep " EFI " | grep -o 'disk.*' | head -n 1) + if [ -z $Temp ]; then + echo "Warning: root device doesn't have an EFI partition" + fi + else + echo "Warning: root device could not be found" + fi + if [ -z $Temp ]; then + Temp=$(diskutil list | sed -n -E '/^ *[0-9]+:[ ]+EFI EFI[ ]+[0-9.]+ [A-Z]+[ ]+(disk[0-9]+s[0-9]+)$/ { s//\1/p + q + }' ) + + if [ -z $Temp ]; then + echo "Could not find an EFI partition. Aborting!" + exit 1 + fi + fi + Esp=/dev/`echo $Temp` + # If the ESP is mounted, use its current mount point.... + Temp=`df -P | grep "$Esp "` + MountPoint=`echo $Temp | cut -f 6- -d ' '` + if [[ "$MountPoint" == '' ]] ; then + MountPoint="/Volumes/ESP" + mkdir /Volumes/ESP &> /dev/null + mount -t msdos "$Esp" /Volumes/ESP + # Some systems have HFS+ "ESPs." They shouldn't, but they do. If this is + # detected, mount it as such and set appropriate options. + if [[ $? != 0 ]] ; then + mount -t hfs "$Esp" /Volumes/Esp + if [[ $? != 0 ]] ; then + echo "Unable to mount ESP!\n" + exit 1 + fi + fi + fi + echo "The ESP is mounted at $MountPoint" +} # MountOSXESP() + +# +# Main part of script.... +# + +case "$OSTYPE" in + darwin*) + MountOSXESP + ;; + *) + echo "This script is meant to be run under OS X *ONLY*! Exiting!" + exit + ;; +esac \ No newline at end of file diff --git a/refind-install b/refind-install index cd9b07b..a59c158 100755 --- a/refind-install +++ b/refind-install @@ -762,6 +762,7 @@ InstallOnOSX() { CheckForSIP Platform=`ioreg -l -p IODeviceTree | grep firmware-abi | cut -d "\"" -f 4` CopyRefindFiles + cp "$ThisDir/mountesp" /usr/local/bin if [[ $InstallToEspOnMac == "1" ]] ; then bless --mount "$InstallDir" --setBoot --file "$InstallDir/$TargetDir/$Refind" --shortform elif [[ "$TargetDir" != "/EFI/BOOT" ]] ; then