]> code.delx.au - refind/blobdiff - install.sh
Fixed bug in install.sh that could cause it to display errors if the
[refind] / install.sh
index 41d1817efdec839eb54f01d8d61c7495fb08a6ff..6ca86f50d38698f4fa27f528fd8181db64b7726b 100755 (executable)
@@ -248,13 +248,16 @@ CopyKeys() {
 # honoring the $InstallDrivers condition. Must be passed a suitable
 # architecture code (ia32 or x64).
 CopyDrivers() {
+   local Blkid
+
+   Blkid=`which blkid 2> /dev/null`
    if [[ $InstallDrivers == "all" ]] ; then
       mkdir -p "$InstallDir/$TargetDir/drivers_$1"
       cp "$ThisDir"/drivers_$1/*_$1.efi "$InstallDir/$TargetDir/drivers_$1/" 2> /dev/null
       cp "$RefindDir"/drivers_$1/*_$1.efi "$InstallDir/$TargetDir/drivers_$1/" 2> /dev/null
-   elif [[ "$InstallDrivers" == "boot" && -x `which blkid` ]] ; then
+   elif [[ "$InstallDrivers" == "boot" && -x "$Blkid" ]] ; then
       BootPart=`df /boot | grep dev | cut -f 1 -d " "`
-      BootFS=`blkid -o export $BootPart 2> /dev/null | grep TYPE= | cut -f 2 -d =`
+      BootFS=`$Blkid -o export $BootPart 2> /dev/null | grep TYPE= | cut -f 2 -d =`
       DriverType=""
       case $BootFS in
          ext2 | ext3) DriverType="ext2"
@@ -696,10 +699,22 @@ FindLinuxESP() {
    local Drive
    local PartNum
    local TableType
+   local DmStatus
+   local SkipIt
+   local Dmraid
    for Drive in `ls /dev/[sh]d?` ; do
-      TableType=`parted $Drive print -m -s 2> /dev/null | head -n 2 | tail -n 1 | cut -d ":" -f 6`
-      if [[ $TableType == 'gpt' ]] ; then # read only GPT disks
-         PartNum=`parted $Drive print -m -s 2> /dev/null | grep ":boot[,;]" | cut -d ":" -f 1`
+      SkipIt=0
+      Dmraid=`which dmraid 2> /dev/null`
+      if [ -x "$Dmraid" ] ; then
+         DmStatus=`dmraid -r | grep $Drive`
+         if [ -n "$DmStatus" ] ; then
+            echo "$Drive seems to be part of a RAID array; skipping!"
+            SkipIt=1
+         fi
+      fi
+      TableType=`parted $Drive print -m -s 2>/dev/null | awk -F: '$1 == "'$Drive'" { print $6 }'`
+      if [[ $TableType == 'gpt' && $SkipIt == 0 ]] ; then # read only GPT disks that aren't part of dmraid array
+         PartNum=`LANG=C parted $Drive print -m -s 2>/dev/null | awk -F: '$7 ~ "(^boot| boot)" { print $1 }' | head -n 1`
          if [ "$PartNum" -eq "$PartNum" ] 2> /dev/null ; then
             InstallDir="$RootDir/boot/efi"
             mkdir -p $InstallDir
@@ -721,6 +736,8 @@ FindLinuxESP() {
 # either location.
 # Sets InstallDir to the ESP mount point.
 FindMountedESP() {
+   mount /boot &> /dev/null
+   mount /boot/efi &> /dev/null
    EspLine=`df "$RootDir/boot/efi" 2> /dev/null | grep boot/efi`
    if [[ ! -n "$EspLine" ]] ; then
       EspLine=`df "$RootDir"/boot | grep boot`