]> code.delx.au - refind/blobdiff - install.sh
Added ability to boot the previously-booted loader if
[refind] / install.sh
index 6ca86f50d38698f4fa27f528fd8181db64b7726b..67df9ee3e5c851ec6bfab490214ddcee0d73db1a 100755 (executable)
@@ -35,6 +35,7 @@
 #
 # Revision history:
 #
+# 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
 #            to locate and mount ESP on Linux, if it's not mounted
 # 0.7.6   -- Added --ownhfs {device-filename} option
@@ -445,7 +446,27 @@ MountDefaultTarget() {
 MountOSXESP() {
    # Identify the ESP. Note: This returns the FIRST ESP found;
    # if the system has multiple disks, this could be wrong!
-   Temp=`diskutil list | grep " EFI " | grep -o 'disk.*'`
+   Temp=$(mount | sed -n -E "/^(\/dev\/disk[0-9]+s[0-9]+) on \/ \(.*$/s//\1/p")
+   if [ $Temp ]; then
+      Temp=$(diskutil list $Temp | 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 "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"`
@@ -473,7 +494,6 @@ SetupMacHfs() {
    cp -n "$InstallDir/$TargetDir/boot.efi" "$InstallDir/$TargetDir/boot.efi-backup" &> /dev/null
    ln -f "$InstallDir/$TargetDir/$1" "$InstallDir/$TargetDir/boot.efi"
    touch "$InstallDir/mach_kernel"
-   cp -n "$RefindDir/icons/os_refind.icns" "$InstallDir/.VolumeIcon.icns" &> /dev/null
    rm "$InstallDir/$TargetDir/SystemVersion.plist" &> /dev/null
    cat - << ENDOFHERE >> "$InstallDir/$TargetDir/SystemVersion.plist"
 <xml version="1.0" encoding="UTF-8"?>