]> code.delx.au - refind/blobdiff - refind-install
Added "kernel*" as Linux kernel matching string, since Gentoo uses
[refind] / refind-install
index c851952d7052eb7ea6ff5e362fa4940bf9167fb0..2562d1ea0c52b74a7de91ebb121bae3a66214bd6 100755 (executable)
@@ -194,9 +194,24 @@ ReadYesNo() {
 
 # Abort if the rEFInd files can't be found.
 # Also sets $ConfFile to point to the configuration file,
-# $IconsDir to point to the icons directory, and
-# $ShimSource to the source of the shim.efi file (if necessary).
+# $IconsDir to point to the icons directory,
+# $ShimSource to the source of the shim.efi file (if necessary),
+# $ThisDir to point to the directory in which this script resides,
+# and $RefindDir to point to where the rEFInd binaries live
 CheckForFiles() {
+   # Note: $ThisDir points to real (not symlinked) script home on Linux,
+   # enabling creating a symlink in /usr/sbin (or wherever); but on OS X,
+   # "readlink" doesn't do the same thing as under Linux, so the script
+   # must not be a symlink under OS X.
+   case "$OSTYPE" in
+      darwin*)
+           ThisDir="$( cd -P "${BASH_SOURCE%/*}" && pwd )"
+           ;;
+      linux*)
+           ThisDir="$(dirname "$(readlink -f "$0")")"
+           ;;
+   esac
+   RefindDir="$ThisDir/refind"
    # Note: This check is satisfied if EITHER the 32- or the 64-bit version
    # is found, even on the wrong platform. This is because the platform
    # hasn't yet been determined. This could obviously be improved, but it
@@ -690,7 +705,7 @@ SetupMacHfs() {
         <key>ProductName</key>
         <string>rEFInd</string>
         <key>ProductVersion</key>
-        <string>0.9.2</string>
+        <string>0.10.0</string>
 </dict>
 </plist>
 ENDOFHERE
@@ -698,7 +713,8 @@ ENDOFHERE
 
 CheckForSIP() {
    if [[ -x "/usr/bin/csrutil" ]] ; then
-      local OKToInstall=`/usr/bin/csrutil status | grep "Protection status: enabled (Custom Configuration\|Apple Internal)"`
+      local OKToInstall=`/usr/bin/csrutil status | \
+                         grep "Protection status: disabled\|enabled (Apple Internal)\|NVRAM Protections: disabled"`
       if [[ -z "$OKToInstall" ]] ; then
          echo
          echo "**** ALERT: SIP ENABLED! ****"
@@ -761,7 +777,7 @@ InstallOnOSX() {
    CheckForSIP
    Platform=`ioreg -l -p IODeviceTree | grep firmware-abi | cut -d "\"" -f 4`
    CopyRefindFiles
-   cp "$ThisDir/mountesp" /usr/local/bin
+   cp "$ThisDir/mountesp" /usr/local/bin &> /dev/null
    if [[ $InstallToEspOnMac == "1" ]] ; then
       bless --mount "$InstallDir" --setBoot --file "$InstallDir/$TargetDir/$Refind" --shortform
    elif [[ "$TargetDir" != "/EFI/BOOT" ]] ; then
@@ -1133,9 +1149,8 @@ InstallOnLinux() {
          echo "CAUTION: This Linux installation uses a 32-bit kernel. 32-bit EFI-based"
          echo "computers are VERY RARE. If you've installed a 32-bit version of Linux"
          echo "on a 64-bit computer, you should manually install the 64-bit version of"
-         echo "rEFInd. If you're installing on a Mac, you should do so from OS X. If"
-         echo "you're positive you want to continue with this installation, answer 'Y'"
-         echo "to the following question..."
+         echo "rEFInd. If you're positive you want to continue with this installation,"
+         echo "answer 'Y' to the following question..."
          echo
          echo -n "Are you sure you want to continue (Y/N)? "
          ReadYesNo
@@ -1168,8 +1183,6 @@ InstallOnLinux() {
 # install under OS X or Linux, depending on the detected platform.
 #
 GetParams "$@"
-ThisDir="$( cd -P "${BASH_SOURCE%/*}" && pwd )"
-RefindDir="$ThisDir/refind"
 if [[ $UID != 0 ]] ; then
    echo "Not running as root; attempting to elevate privileges via sudo...."
    sudo "$BASH_SOURCE" "$@"
@@ -1219,7 +1232,14 @@ fi
 
 if [[ $UnmountEsp == '1' ]] ; then
    echo "Unmounting install dir"
-   umount $InstallDir
+   case "$OSTYPE" in
+   darwin*)
+      diskutil unmount $InstallDir
+      ;;
+   *)
+      umount $InstallDir
+      ;;
+   esac
 fi
 
 if [[ "$InstallDir" == /tmp/refind_install ]] ; then