]> code.delx.au - refind/blobdiff - install.sh
install.sh: Fixed bug in creation of tools directory when $InstallDir has a space.
[refind] / install.sh
index 05e52fc40da2816a3778541c57a56c37b18c5f5c..ede3e083780bff8c4b25cdd895303e903b803d2b 100755 (executable)
@@ -35,6 +35,7 @@
 #
 # Revision history:
 #
+# 0.8.5   -- Refinement/cleanup of new OS X ESP-as-default policy
 # 0.8.4   -- OS X default changed to install to ESP under /EFI/BOOT
 # 0.7.9   -- Fixed bug that caused errors if dmraid utility not installed
 # 0.7.7   -- Fixed bug that created mangled refind_linux.conf file; added ability
@@ -135,7 +136,6 @@ GetParams() {
       esac
       shift
    done
-
    if [[ "$InstallToEspOnMac" == 0 && "$RootDir" == '/' && "$TargetDir" == '/EFI/BOOT' ]] ; then
       echo "You may use --notesp OR --usedefault, but not both! Aborting!"
       exit 1
@@ -148,7 +148,6 @@ GetParams() {
       echo "If you use --ownhfs, you may NOT use --usedefault! Aborting!"
       exit 1
    fi
-   exit
    RLConfFile="$RootDir/boot/refind_linux.conf"
    EtcKeysDir="$RootDir/etc/refind.d/keys"
 } # GetParams()
@@ -308,7 +307,7 @@ CopyDrivers() {
 # directory on the ESP. Must be passed a suitable architecture code (ia32
 # or x64).
 CopyTools() {
-   mkdir -p $InstallDir/EFI/tools
+   mkdir -p "$InstallDir/EFI/tools"
    if [[ $OSName == 'Darwin' ]] ; then
       cp -f "$RefindDir/tools_$1/gptsync_$1.efi" "$InstallDir/EFI/tools/"
       if [[ -f "$InstallDir/EFI/tools/gptsync.efi" ]] ; then
@@ -496,9 +495,16 @@ MountOSXESP() {
    if [[ "$InstallDir" == '' ]] ; then
       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
-         echo "Unable to mount ESP! Aborting!\n"
-         exit 1
+         mount -t hfs "$Esp" /Volumes/Esp
+         OwnHfs=1
+         InstallToEspOnMac=0
+         if [[ $? != 0 ]] ; then
+            echo "Unable to mount ESP! Aborting!\n"
+            exit 1
+         fi
       fi
       UnmountEsp=1
       InstallDir="/Volumes/ESP"
@@ -1053,7 +1059,6 @@ InstallOnLinux() {
 # performs a few startup checks, and then calls functions to
 # install under OS X or Linux, depending on the detected platform.
 #
-
 OSName=`uname -s`
 GetParams "$@"
 ThisDir="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"