void-packages/srcpkgs/refind/patches/refind-install-abs-path.patch

112 lines
4.9 KiB
Diff

--- a/refind-install
+++ b/refind-install
@@ -344,19 +344,8 @@ DeterminePlatform() {
# $ThisDir to point to the directory in which this script resides,
# and $RefindDir to point to where the rEFInd binaries live
CheckForFiles() {
- # Note: $ThisDir points to real (not symlinked) script home on Linux,
- # enabling creating a symlink in /usr/sbin (or wherever); but on OS X,
- # "readlink" doesn't do the same thing as under Linux, so the script
- # must not be a symlink under OS X.
- case "$OSTYPE" in
- darwin*)
- ThisDir="$( cd -P "${BASH_SOURCE%/*}" && pwd )"
- ;;
- linux*)
- ThisDir="$(dirname "$(readlink -f "$0")")"
- ;;
- esac
- RefindDir="$ThisDir/refind"
+ ThisDir="/do/not/use/this/var"
+ RefindDir="/usr/share/refind"
if [[ ! -f "$RefindDir/refind_$Platform.efi" ]] ; then
echo "The rEFInd binary file is missing! Aborting installation!"
@@ -365,8 +354,6 @@ CheckForFiles() {
if [[ -f "$RefindDir/refind.conf-sample" ]] ; then
ConfFile="$RefindDir/refind.conf-sample"
- elif [[ -f "$ThisDir/refind.conf-sample" ]] ; then
- ConfFile="$ThisDir/refind.conf-sample"
else
echo "The sample configuration file is missing! Aborting installation!"
exit 1
@@ -374,8 +361,6 @@ CheckForFiles() {
if [[ -d "$RefindDir/icons" ]] ; then
IconsDir="$RefindDir/icons"
- elif [[ -d "$ThisDir/icons" ]] ; then
- IconsDir="$ThisDir/icons"
else
echo "The icons directory is missing! Aborting installation!"
exit 1
@@ -613,7 +598,6 @@ SetBootFS() {
CopyDrivers() {
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" ]] ; then
SetBootFS
@@ -638,7 +622,6 @@ CopyDrivers() {
if [[ -n $BootFS ]] ; then
echo "Installing driver for $BootFS (${DriverType}_$1.efi)"
mkdir -p "$InstallDir/$TargetDir/drivers_$1"
- cp "$ThisDir/drivers_$1/${DriverType}_$1.efi" "$InstallDir/$TargetDir/drivers_$1/" 2> /dev/null
cp "$RefindDir/drivers_$1/${DriverType}_$1.efi" "$InstallDir/$TargetDir/drivers_$1"/ 2> /dev/null
fi
fi
@@ -679,7 +662,6 @@ CopyRefindFiles() {
fi
if [[ $InstallDrivers == "all" ]] ; then
cp -r "$RefindDir"/drivers_* "$InstallDir/$TargetDir/" 2> /dev/null
- cp -r "$ThisDir"/drivers_* "$InstallDir/$TargetDir/" 2> /dev/null
elif [[ $Upgrade == 1 || $InstallToEspOnMac == 1 ]] ; then
CopyDrivers "$Platform"
CopyTools "$Platform"
@@ -703,8 +685,8 @@ CopyRefindFiles() {
if [[ $LocalKeys == 0 ]] ; then
echo "Storing copies of rEFInd Secure Boot public keys in $EtcKeysDir"
mkdir -p "$EtcKeysDir"
- cp "$ThisDir/keys/refind.cer" "$EtcKeysDir" 2> /dev/null
- cp "$ThisDir/keys/refind.crt" "$EtcKeysDir" 2> /dev/null
+ cp "$RefindDir/keys/refind.cer" "$EtcKeysDir" 2> /dev/null
+ cp "$RefindDir/keys/refind.crt" "$EtcKeysDir" 2> /dev/null
fi
fi
if [[ "$TargetDir" == '/System/Library/CoreServices' ]] ; then
@@ -741,7 +723,7 @@ CopyRefindFiles() {
Problems=1
fi
mkdir -p "$InstallDir/$TargetDir/keys"
- cp -rf "$ThisDir"/keys/*.[cd]er "$InstallDir/$TargetDir/keys/" 2> /dev/null
+ cp -rf "$RefindDir"/keys/*.[cd]er "$InstallDir/$TargetDir/keys/" 2> /dev/null
cp -rf "$EtcKeysDir"/*.[cd]er "$InstallDir/$TargetDir/keys/" 2> /dev/null
if [[ -f "$InstallDir/$TargetDir/refind.conf" ]] ; then
echo "Existing refind.conf file found; copying sample file as refind.conf-sample"
@@ -1149,14 +1131,12 @@ ReSignBinaries() {
GenerateKeys
mkdir -p "$TempDir/drivers_$Platform"
cp "$RefindDir"/refind.conf-sample "$TempDir" 2> /dev/null
- cp "$ThisDir"/refind.conf-sample "$TempDir" 2> /dev/null
cp "$RefindDir"/refind_ia32.efi "$TempDir" 2> /dev/null
cp -a "$RefindDir"/drivers_ia32 "$TempDir" 2> /dev/null
- cp -a "$ThisDir"/drivers_ia32 "$TempDir" 2> /dev/null
SignOneBinary "$RefindDir/refind_$Platform.efi" "$TempDir/refind_$Platform.efi"
SaveIFS=$IFS
IFS=$(echo -en "\n\b")
- for Driver in "$RefindDir"/drivers_"$Platform"/*.efi "$ThisDir"/drivers_"$Platform"/*.efi ; do
+ for Driver in "$RefindDir"/drivers_"$Platform"/*.efi ; do
[[ -e "$Driver" ]] || break # handle the case of no files
TempName=$(basename "$Driver")
SignOneBinary "$Driver" "$TempDir/drivers_$Platform/$TempName"
@@ -1416,7 +1396,7 @@ InstallSBKey() {
if [ "$LocalKeys" == "1" ] ; then
UsedDerKey="$DerKey"
else
- UsedDerKey="$ThisDir/keys/refind.cer"
+ UsedDerKey="$RefindDir/keys/refind.cer"
fi
if command -v mokutil &>/dev/null ; then
if mokutil --test-key "$UsedDerKey" &> /dev/null ; then