1 |
martinw |
1876339 |
--- a/refind-install 2022-04-12 18:02:46.000000000 +0100 |
2 |
|
|
+++ b/refind-install 2022-08-08 21:28:07.779458769 +0100 |
3 |
martinw |
1258332 |
@@ -27,6 +27,8 @@ |
4 |
|
|
# Valid only under Linux. |
5 |
|
|
# "--keepname" to keep refind_x64.efi name as such even when using shim. |
6 |
|
|
# Valid only under Linux. |
7 |
|
|
+# "--nvramonly" to just restore the boot entry in NVRAM. |
8 |
|
|
+# Valid only under Linux. |
9 |
|
|
# "--yes" to assume a "yes" response to all prompts |
10 |
|
|
# |
11 |
martinw |
1583319 |
# This program is copyright (c) 2012-2020 by Roderick W. Smith |
12 |
martinw |
1876339 |
@@ -166,6 +168,8 @@ |
13 |
martinw |
1258332 |
;; |
14 |
|
|
--keepname) KeepName=1 |
15 |
|
|
;; |
16 |
|
|
+ --nvramonly) NvramOnly=1 |
17 |
|
|
+ ;; |
18 |
|
|
--drivers | --alldrivers) InstallDrivers="all" |
19 |
|
|
;; |
20 |
|
|
--nodrivers) InstallDrivers="none" |
21 |
martinw |
1876339 |
@@ -175,7 +179,7 @@ |
22 |
martinw |
1258332 |
* ) echo "Usage: $0 [--notesp | --usedefault {device-file} | --root {dir} |" |
23 |
|
|
echo " --ownhfs {device-file} ] [--keepname]" |
24 |
|
|
echo " [--nodrivers | --alldrivers] [--shim {shimfile}]" |
25 |
|
|
- echo " [--localkeys [--encryptkeys]] [--keepname] [--yes]" |
26 |
|
|
+ echo " [--localkeys [--encryptkeys]] [--nvramonly] [--yes]" |
27 |
|
|
exit 1 |
28 |
|
|
esac |
29 |
|
|
shift |
30 |
martinw |
1876339 |
@@ -205,6 +209,10 @@ |
31 |
martinw |
1258332 |
echo "The --keepname option is incompatible with --usedefault! Aborting!" |
32 |
|
|
exit 1 |
33 |
|
|
fi |
34 |
|
|
+ if [[ "$NvramOnly" == 1 && "$OSTYPE" != "linux" && "$OSTYPE" != "linux-gnu" ]] ; then |
35 |
|
|
+ echo "The --nvramonly option is valid only under Linux! Aborting!" |
36 |
|
|
+ exit 1 |
37 |
|
|
+ fi |
38 |
|
|
if [[ "$InstallDrivers" == "all" && "$TargetDir" != "/EFI/BOOT" ]] ; then |
39 |
|
|
echo "The --alldrivers option is meant for creating USB flash drives with (near-)" |
40 |
|
|
echo "universal boot support. Using it on a hard disk partition runs the risk of" |
41 |
martinw |
1876339 |
@@ -1265,6 +1274,20 @@ |
42 |
martinw |
1258332 |
echo "ESP was found at $InstallDir using $EspFilesystem" |
43 |
|
|
} # FindMountedESP |
44 |
|
|
|
45 |
|
|
+# Identifies the rEFInd EFI boot image filename. |
46 |
|
|
+DetermineBootImageName() { |
47 |
|
|
+ if [[ "$TargetDir" == '/EFI/BOOT' ]] ; then |
48 |
|
|
+ Refind="boot$Platform.efi" |
49 |
|
|
+ elif [[ "$ShimSource" != "none" ]] ; then |
50 |
|
|
+ if [[ "$TargetShim" == "default" ]] ; then |
51 |
|
|
+ TargetShim=`basename "$ShimSource"` |
52 |
|
|
+ fi |
53 |
|
|
+ Refind="$TargetShim" |
54 |
|
|
+ else |
55 |
|
|
+ Refind="refind_$Platform.efi" |
56 |
|
|
+ fi |
57 |
|
|
+} # DetermineBootImageName |
58 |
|
|
+ |
59 |
|
|
# Uses efibootmgr to add an entry for rEFInd to the EFI's NVRAM, if necessary. |
60 |
|
|
# If this fails, sets Problems=1 |
61 |
|
|
AddBootEntry() { |
62 |
martinw |
1876339 |
@@ -1455,6 +1478,12 @@ |
63 |
martinw |
1258332 |
DetermineTargetDir |
64 |
|
|
fi |
65 |
|
|
|
66 |
|
|
+ if [[ $NvramOnly == 1 ]] ; then |
67 |
|
|
+ DetermineBootImageName |
68 |
|
|
+ AddBootEntry |
69 |
|
|
+ return |
70 |
|
|
+ fi |
71 |
|
|
+ |
72 |
|
|
if [[ $LocalKeys == 1 ]] ; then |
73 |
|
|
ReSignBinaries |
74 |
|
|
fi |