]> code.delx.au - refind/commitdiff
Added new mountesp script to help OS X users mount the ESP.
authorsrs5694 <srs5694@users.sourceforge.net>
Mon, 2 Nov 2015 02:08:46 +0000 (21:08 -0500)
committersrs5694 <srs5694@users.sourceforge.net>
Mon, 2 Nov 2015 02:08:46 +0000 (21:08 -0500)
docs/refind/configfile.html
mkdistrib
mountesp [new file with mode: 0755]
refind-install

index 57f4445b28e81334e99799d6e891dffbecdcebfc..5e8fc004b8b87ab7c7862e03dbcf2abad5493f29 100644 (file)
@@ -208,7 +208,21 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 <h2>Adjusting the Global Configuration</h2>
 </a>
 
-<p>You can adjust many of rEFInd's options by editing its configuration file. This file is called <tt>refind.conf</tt> by default; but you can use another filename by passing <tt>-c <tt class="variable">filename</tt></tt> as an option, as in <tt>refind_x64.efi -c myrefind.conf</tt> to use <tt>myrefind.conf</tt> in rEFInd's main directory. You can specify a configuration file in another directory, but to do so, you <i>must</i> use backslashes as directory separators, as in <tt>-c \EFI\other\refind.conf</tt>. 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&mdash;for instance, to have a secondary rEFInd that provides boot options hidden by the main one. In this scenario, the default <tt>refind.conf</tt> would have a <a href="#stanzas">manual boot stanza</a> defining the new rEFInd instance, including its <tt>-c</tt> option.</p>
+<p class="sidebar">You can tell rEFInd to use any configuration filename by passing <tt>-c <tt class="variable">filename</tt></tt> as an option, as in <tt>refind_x64.efi -c myrefind.conf</tt> to use <tt>myrefind.conf</tt> in rEFInd's main directory. You can specify a configuration file in another directory, but to do so, you <i>must</i> use backslashes as directory separators, as in <tt>-c \EFI\other\refind.conf</tt>. 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&mdash;for instance, to have a secondary rEFInd that provides boot options hidden by the main one. In this scenario, the default <tt>refind.conf</tt> would have a <a href="#stanzas">manual boot stanza</a> defining the new rEFInd instance, including its <tt>-c</tt> option.</p>
+
+<p>You can adjust many of rEFInd's options by editing its configuration file, which is called <tt>refind.conf</tt>. 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 <a href="http://en.wikipedia.org/wiki/EFI_System_partition">EFI System Partition (ESP),</a> which can be in any number of places:</p>
+
+<ul>
+
+<li>Under Linux, the ESP is usually mounted at <tt>/boot/efi</tt>, although some users, particularly in Arch and Gentoo, prefer to mount the ESP at <tt>/boot</tt>.</li>
+
+<li>Under OS X, the ESP is not mounted by default, so you must mount it yourself to access it. Since 0.9.3, rEFInd has provided a script called <tt>mountesp</tt>, which locates and mounts the ESP. Open a Terminal and type <tt class="userinput">sudo mountesp</tt> to mount the ESP. The program should tell you where it's mounted the ESP. It will remain mounted until you manually unmount it or until you reboot.</li>
+
+<li>Under Windows, the ESP is not mounted by default. You can do so manually by opening an Administrator Command Prompt window and typing <tt class="userinput">mountvol S: /S</tt> to mount it at <tt>S:</tt>. (You can change the drive letter if you like.) Note that you will be able to access the ESP only from this Administrator Command Prompt window.</li>
+
+</ul>
+
+<p>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 <tt>EFI/refind</tt> directory, or sometimes in <tt>EFI/BOOT</tt> or elsewhere. Thus, the rEFInd configuration file might be <tt>/boot/efi/EFI/refind/refind.conf</tt>, <tt>/boot/EFI/BOOT/refind.conf</tt>, <tt>/Volumes/ESP/EFI/refind/refind.conf</tt>, <tt>S:\EFI\refind\refind.conf</tt>, or something else, depending on your OS and mount point.</p>
 
 <p>You can use any text editor you like to edit <tt>refind.conf</tt>, 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 <b><tt>edit refind.conf</tt></b> 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.</p>
 
index 9be32c971bd883532eb797d0d23e7356e3cc9f47..78ee30a8163cadf66b33572bc4d116544ef54318 100755 (executable)
--- 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 (executable)
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
index cd9b07b1dfe7e0f5575f5dae468e676ff8e19ae9..a59c1580a0f3881f4e794de1efc51f92ce6c142a 100755 (executable)
@@ -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