]> code.delx.au - refind/commitdiff
Improved handling of non-sd?/non-hd? disks in refind-install.
authorsrs5694 <srs5694@users.sourceforge.net>
Thu, 3 Nov 2016 17:12:53 +0000 (13:12 -0400)
committersrs5694 <srs5694@users.sourceforge.net>
Thu, 3 Nov 2016 17:12:53 +0000 (13:12 -0400)
NEWS.txt
docs/refind/bootmode.html
refind-install

index 87604c97bf53c727d58b860893b06315b1695326..6a890f3e6c69a1e08d6ab38af17bb555f97af878 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -1,6 +1,9 @@
 0.10.5 (??/??/201?):
 --------------------
 
+- Fix to refind-install to work better with disks other than /dev/sd? and
+  /dev/hd? devices.
+
 - Fixes to touch/tablet support to improve reliability.
 
 0.10.4 (10/9/2016):
index b0a2d060ce188690c13b25eff16e891a6355a1e7..cc10660fa3953062732b2b093b784e82e6cd0d5d 100644 (file)
@@ -17,7 +17,7 @@
 href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>\r
 \r
 <p>Originally written: 3/14/2012; last Web page update:\r
-10/9/2016, referencing rEFInd 0.10.4</p>\r
+10/29/2016, referencing rEFInd 0.10.4</p>\r
 \r
 \r
 <p>This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!</p>\r
index 861c2b4245e125aec1ce2a298692f6dad1054c04..60d9669d0b870b29e6264c102a9146942523c64e 100755 (executable)
@@ -39,6 +39,7 @@
 
 # Revision history:
 #
+# 0.10.5  -- More improvement to handling of disks (other than /dev/[sh]d? disks).
 # 0.10.4  -- Improved handling of disks (other than /dev/[sh]d? disks).
 # 0.10.2  -- Improved Secure Boot detection in Linux, fixed --usedefault in OS X,
 #            and fixed bug that could cause mountesp to be installed as a FILE
@@ -1127,10 +1128,24 @@ FindMountedESP() {
 # If this fails, sets Problems=1
 AddBootEntry() {
    local PartNum
+   local InstallDisk
+   local InstallPart
+   local Name
    Efibootmgr=`which efibootmgr 2> /dev/null`
    if [[ "$Efibootmgr" ]] ; then
-      InstallDisk=`grep "$InstallDir" /etc/mtab | cut -d " " -f 1 | cut -c 1-8`
-      PartNum=`grep "$InstallDir" /etc/mtab | cut -d " " -f 1 | cut -c 9-10`
+      InstallPart=`grep "$InstallDir" /etc/mtab | cut -d " " -f 1`
+      for Name in `lsblk -r | grep disk | cut -f 1 -d " "` ; do
+         if [[ $InstallPart == *"$Name"* ]] ; then
+            InstallDisk="/dev/"$Name
+            PartNum=${InstallPart#$InstallDisk}
+            break
+         fi
+      done
+      if [[ -z $InstallDisk || -z $PartNum ]] ; then
+         echo "Could not identify ESP in AddBootEntry()!"
+         Problems=1
+         return 1
+      fi
       EntryFilename="$TargetDir/$Refind"
       EfiEntryFilename=`echo ${EntryFilename//\//\\\}`
       EfiEntryFilename2=`echo ${EfiEntryFilename} | sed s/\\\\\\\\/\\\\\\\\\\\\\\\\/g`