1 |
--- a/refind-install 2018-09-10 10:11:58.210756087 +0100 |
2 |
+++ b/refind-install 2018-09-10 19:31:00.916507826 +0100 |
3 |
@@ -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 |
# This program is copyright (c) 2012-2017 by Roderick W. Smith |
12 |
@@ -155,6 +157,8 @@ |
13 |
;; |
14 |
--keepname) KeepName=1 |
15 |
;; |
16 |
+ --nvramonly) NvramOnly=1 |
17 |
+ ;; |
18 |
--drivers | --alldrivers) InstallDrivers="all" |
19 |
;; |
20 |
--nodrivers) InstallDrivers="none" |
21 |
@@ -164,7 +168,7 @@ |
22 |
* ) 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 |
@@ -194,6 +198,10 @@ |
31 |
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 |
@@ -1209,6 +1217,20 @@ |
42 |
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 |
@@ -1344,6 +1366,12 @@ |
63 |
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 |