mirror of
https://github.com/Metabolix/HackBGRT.git
synced 2025-12-06 17:15:42 -08:00
Allow overriding ESP path
This commit is contained in:
@@ -53,6 +53,7 @@ The *shim* boot loader is maintained by Red Hat, Inc, and the included signed co
|
||||
* `uninstall` – disable and remove completely.
|
||||
* `show-boot-log` – show the debug log collected during boot (if `log=1` is set in `config.txt`).
|
||||
* `arch=...` – force architecture.
|
||||
* `esp=...` – force EFI System Partition path.
|
||||
* `dry-run` – skip actual changes.
|
||||
* For example, run `setup.exe batch install allow-secure-boot enable-overwrite` to copy files and overwrite the MS boot loader regardless of Secure Boot status.
|
||||
|
||||
|
||||
11
src/Setup.cs
11
src/Setup.cs
@@ -106,6 +106,9 @@ public class Setup {
|
||||
/** @var Dry run? */
|
||||
protected bool DryRun;
|
||||
|
||||
/** @var User-defined ESP path */
|
||||
protected string UserEspPath;
|
||||
|
||||
/** @var Run in batch mode? */
|
||||
protected bool Batch;
|
||||
|
||||
@@ -289,6 +292,11 @@ public class Setup {
|
||||
if (DryRun) {
|
||||
Directory.CreateDirectory(Path.Combine("dry-run", "EFI"));
|
||||
Esp.TryPath("dry-run", false);
|
||||
} else if (UserEspPath != null) {
|
||||
WriteLine($"Using user-defined ESP path: {UserEspPath}");
|
||||
if (!Esp.TryPath(UserEspPath, false)) {
|
||||
throw new SetupException("The ESP path doesn't look like an EFI System Partition.");
|
||||
}
|
||||
}
|
||||
if (Esp.Location == null && !Esp.Find() && !Esp.Mount() && !Batch) {
|
||||
WriteLine("EFI System Partition was not found.");
|
||||
@@ -1045,7 +1053,7 @@ public class Setup {
|
||||
AllowSecureBoot = args.Contains("allow-secure-boot");
|
||||
AllowBitLocker = args.Contains("allow-bitlocker");
|
||||
SkipShim = args.Contains("skip-shim");
|
||||
ForwardArguments = String.Join(" ", args.Where(s => ForwardableArguments.Contains(s) || s.StartsWith("arch=")));
|
||||
ForwardArguments = String.Join(" ", args.Where(s => ForwardableArguments.Contains(s) || s.StartsWith("arch=") || s.StartsWith("esp=")));
|
||||
try {
|
||||
if (!(Directory.Exists("efi") || Directory.Exists("efi-signed")) || !File.Exists("config.txt")) {
|
||||
WriteLine("This setup program is not in the correct directory!");
|
||||
@@ -1053,6 +1061,7 @@ public class Setup {
|
||||
return 1;
|
||||
}
|
||||
SetArch(args.Where(s => s.StartsWith("arch=")).Select(s => s.Substring(5)).LastOrDefault());
|
||||
UserEspPath = args.Where(s => s.StartsWith("esp=")).Select(s => s.Substring(4)).LastOrDefault();
|
||||
if (args.Contains("is-elevated") && !HasPrivileges() && !DryRun) {
|
||||
WriteLine("This installer needs to be run as administrator!");
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user