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

114 lines
5.0 KiB
Diff

Index: refind-0.13.3.1/refind-install
===================================================================
--- refind-0.13.3.1.orig/refind-install
+++ refind-0.13.3.1/refind-install
@@ -342,19 +342,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!"
@@ -363,8 +352,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
@@ -372,8 +359,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
@@ -603,7 +588,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
@@ -628,7 +612,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
@@ -669,7 +652,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"
@@ -693,8 +675,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
@@ -731,7 +713,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"
@@ -1139,14 +1121,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 $(ls "$RefindDir"/drivers_$Platform/*.efi "$ThisDir"/drivers_$Platform/*.efi 2> /dev/null) ; do
+ for Driver in $(ls "$RefindDir"/drivers_$Platform/*.efi 2> /dev/null) ; do
TempName=$(basename "$Driver")
SignOneBinary "$Driver" "$TempDir/drivers_$Platform/$TempName"
done
@@ -1403,7 +1383,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