# "--nodrivers" to suppress driver installation (default in Linux is
# driver used on /boot; --nodrivers is OS X default)
# "--shim {shimfile}" to install a shim.efi file for Secure Boot
+# "--preloader" is synonymous with "--shim"
# "--localkeys" to re-sign x86-64 binaries with a locally-generated key
# "--yes" to assume a "yes" response to all prompts
#
#
# Revision history:
#
+# 0.7.5 -- Fixed bug when installing to ESP on recent versions of OS X
+# 0.7.2 -- Fixed code that could be confused by use of autofs to mount the ESP
+# 0.7.0 -- Added support for the new Btrfs driver
+# 0.6.12 -- Added support for PreLoader as well as for shim
# 0.6.11 -- Improvements in script's ability to handle directories with spaces
# in their names
# 0.6.9 -- Install gptsync on Macs
TargetDir=/EFI/refind
LocalKeysBase="refind_local"
ShimSource="none"
+ShimType="none"
TargetShim="default"
TargetX64="refind_x64.efi"
TargetIA32="refind_ia32.efi"
;;
--localkeys) LocalKeys=1
;;
- --shim) ShimSource="$2"
+ --shim | --preloader) ShimSource="$2"
+ ShimType=`basename $ShimSource`
shift
;;
--drivers | --alldrivers) InstallDrivers="all"
if [[ "$ShimSource" != "none" ]] ; then
if [[ -f "$ShimSource" ]] ; then
- TargetX64="grubx64.efi"
- MokManagerSource=`dirname "$ShimSource"`/MokManager.efi
+ if [[ $ShimType == "shimx64.efi" || $ShimType == "shim.efi" ]] ; then
+ TargetX64="grubx64.efi"
+ MokManagerSource=`dirname "$ShimSource"`/MokManager.efi
+ elif [[ $ShimType == "preloader.efi" || $ShimType == "PreLoader.efi" ]] ; then
+ TargetX64="loader.efi"
+ MokManagerSource=`dirname "$ShimSource"`/HashTool.efi
+ else
+ echo "Unknown shim/PreBootloader filename: $ShimType!"
+ echo "Known filenames are shimx64.efi, shim.efi, and PreLoader.efi. Aborting!"
+ exit 1
+ fi
else
- echo "The specified shim file, $ShimSource, doesn't exist!"
+ echo "The specified shim/PreBootloader file, $ShimSource, doesn't exist!"
echo "Aborting installation!"
exit 1
fi
;;
reiserfs) DriverType="reiserfs"
;;
+ btrfs) DriverType="btrfs"
+ ;;
hfsplus) DriverType="hfs"
;;
*) BootFS=""
MountOSXESP() {
# Identify the ESP. Note: This returns the FIRST ESP found;
# if the system has multiple disks, this could be wrong!
- Temp=`diskutil list | grep " EFI "`
- Esp=/dev/`echo $Temp | cut -f 5 -d ' '`
+ Temp=`diskutil list | grep " EFI " | grep -o 'disk.*'`
+ Esp=/dev/`echo $Temp`
# If the ESP is mounted, use its current mount point....
- Temp=`df | grep "$Esp"`
+ Temp=`df -P | grep "$Esp"`
InstallDir=`echo $Temp | cut -f 6 -d ' '`
if [[ "$InstallDir" == '' ]] ; then
mkdir /Volumes/ESP &> /dev/null
fi
InstallDir=`echo $EspLine | cut -d " " -f 6`
if [[ -n "$InstallDir" ]] ; then
- EspFilesystem=`grep "$InstallDir" /etc/mtab | uniq | cut -d " " -f 3`
+ EspFilesystem=`grep "$InstallDir" /etc/mtab | uniq | grep -v autofs | cut -d " " -f 3`
fi
- echo "EspFilesystem is '$EspFilesystem'"
if [[ $EspFilesystem != 'vfat' ]] ; then
echo "$RootDir/boot/efi doesn't seem to be on a VFAT filesystem. The ESP must be"
echo "mounted at $RootDir/boot or $RootDir/boot/efi and it must be VFAT! Aborting!"
echo "rename the $Refind binary to the default name (EFI/boot/bootx64.efi"
echo "on x86-64 systems or EFI/boot/bootia32.efi on x86 systems) to have it run!"
echo
+ else
+ echo "rEFInd has been set as the default boot manager."
fi
} # AddBootEntry()
if [[ -f "$RLConfFile" ]] ; then
echo "Existing $RLConfFile found; not overwriting."
else
+ echo "Creating $RLConfFile; edit it to adjust kernel options."
if [[ -f "$RootDir/etc/default/grub" ]] ; then
# We want the default options used by the distribution, stored here....
source "$RootDir/etc/default/grub"
+ echo "Setting default boot options based on $RootDir/etc/default/grub"
fi
RootFS=`df "$RootDir" | grep dev | cut -f 1 -d " "`
StartOfDevname=`echo "$RootFS" | cut -b 1-7`
TargetX64="bootx64.efi"
TargetIA32="bootia32.efi"
else
- TargetX64="grubx64.efi"
+ if [[ $ShimType == "shim.efi" || $ShimType == "shimx64.efi" ]] ; then
+ TargetX64="grubx64.efi"
+ elif [[ $ShimType == "preloader.efi" || $ShimType == "PreLoader.efi" ]] ; then
+ TargetX64="loader.efi"
+ else
+ echo "Unknown shim/PreBootloader type: $ShimType"
+ echo "Aborting!"
+ exit 1
+ fi
TargetIA32="bootia32.efi"
TargetShim="bootx64.efi"
fi
if [[ $ShimSource == "none" ]] ; then
TargetX64="bootmgfw.efi"
else
- TargetX64="grubx64.efi"
+ if [[ $ShimType == "shim.efi" || $ShimType == "shimx64.efi" ]] ; then
+ TargetX64="grubx64.efi"
+ elif [[ $ShimType == "preloader.efi" || $ShimType == "PreLoader.efi" ]] ; then
+ TargetX64="loader.efi"
+ else
+ echo "Unknown shim/PreBootloader type: $ShimType"
+ echo "Aborting!"
+ exit 1
+ fi
TargetShim="bootmgfw.efi"
fi
}