installer: Detect if we are running in EFI mode

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer
2018-05-31 15:24:39 +01:00
parent 6b44fee76f
commit 5fb499f13b
3 changed files with 10 additions and 2 deletions

View File

@@ -61,7 +61,7 @@ static int system_chroot(const char* output, const char* path, const char* cmd)
}
struct hw* hw_init() {
struct hw* hw = malloc(sizeof(*hw));
struct hw* hw = calloc(1, sizeof(*hw));
assert(hw);
// Initialize libudev
@@ -71,6 +71,11 @@ struct hw* hw_init() {
exit(1);
}
// Detect if we are running in EFI mode
int ret = access("/sys/firmware/efi", R_OK);
if (ret == 0)
hw->efi = 1;
return hw;
}

View File

@@ -57,6 +57,7 @@
struct hw {
struct udev *udev;
int efi;
};
struct hw_disk {

View File

@@ -383,7 +383,9 @@ int main(int argc, char *argv[]) {
}
fprintf(flog, "Install program started.\n");
if (hw->efi)
fprintf(flog, "EFI mode enabled\n");
newtInit();
newtCls();