]> code.delx.au - refind/blobdiff - refind-install
Applied Debian packaging patches from Nobuhiro Iwamatsu.
[refind] / refind-install
index 663c612092496a1687cc21a9bf19c2e36de90127..0f4accd6e2069d0a8d4df7f8be89419d2641503d 100755 (executable)
 #
 # Revision history:
 #
-# 0.9.3   -- Enable running under OS X's recovery system & add warning about
+# 0.10.0  -- Enable running under OS X's recovery system & add warning about
 #            SIP & brief instructions on how to deal with it if SIP is
-#            detected to be enabled.
+#            detected to be enabled. Also change way refind_linux.conf default
+#            options are found; use /proc/cmdline as base.
 # 0.9.2   -- Added --keepname option.
 # 0.8.7   -- Better detection of Secure Boot mode & fixed errors when copying
 #            Shim & MokManager files over themselves; fixed bug that caused
@@ -167,7 +168,7 @@ GetParams() {
       echo "or --preloader! Aborting!"
       exit 1
    fi
-   if [[ "$KeepName" == 1 && ("$OSTYPE" != "linux" && "$OSTYPE" != "linux-gnu") ]] ; then
+   if [[ "$KeepName" == 1 && "$OSTYPE" != "linux" && "$OSTYPE" != "linux-gnu" ]] ; then
       echo "The --keepname option is valid only under Linux! Aborting!"
       exit 1
    fi
@@ -689,7 +690,7 @@ SetupMacHfs() {
         <key>ProductName</key>
         <string>rEFInd</string>
         <key>ProductVersion</key>
-        <string>0.9.2</string>
+        <string>0.10.0</string>
 </dict>
 </plist>
 ENDOFHERE
@@ -697,7 +698,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! ****"
@@ -760,7 +762,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
@@ -1073,15 +1075,12 @@ GenerateRefindLinuxConf() {
    else
       echo "Creating $RLConfFile; edit it to adjust kernel options."
       RootFS=`df "$RootDir" | grep dev | cut -f 1 -d " "`
-      echo "RootFS starts as $RootFS"
       StartOfDevname=`echo "$RootFS" | cut -b 1-7`
       if [[ "$StartOfDevname" == "/dev/sd" || "$StartOfDevName" == "/dev/hd" ]] ; then
          # Identify root filesystem by UUID rather than by device node, if possible
          Uuid=`blkid -o export -s UUID "$RootFS" 2> /dev/null | grep UUID=`
          if [[ -n $Uuid ]] ; then
             RootFS="$Uuid"
-            echo "Uuid is $Uuid"
-            echo "Adjusting RootFS to $RootFS"
          fi
       fi
       if [[ $RootDir == "/" ]] ; then
@@ -1135,9 +1134,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
@@ -1221,7 +1219,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