From 2a6f6875a46f5bec3bde957e979d7b1c4e476c76 Mon Sep 17 00:00:00 2001 From: srs5694 Date: Thu, 3 Nov 2016 13:12:53 -0400 Subject: [PATCH] Improved handling of non-sd?/non-hd? disks in refind-install. --- NEWS.txt | 3 +++ docs/refind/bootmode.html | 2 +- refind-install | 19 +++++++++++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/NEWS.txt b/NEWS.txt index 87604c9..6a890f3 100644 --- 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): diff --git a/docs/refind/bootmode.html b/docs/refind/bootmode.html index b0a2d06..cc10660 100644 --- a/docs/refind/bootmode.html +++ b/docs/refind/bootmode.html @@ -17,7 +17,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

Originally written: 3/14/2012; last Web page update: -10/9/2016, referencing rEFInd 0.10.4

+10/29/2016, referencing rEFInd 0.10.4

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!

diff --git a/refind-install b/refind-install index 861c2b4..60d9669 100755 --- a/refind-install +++ b/refind-install @@ -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` -- 2.39.2