limine-install: Offer the option to force installation on an unrecognised MBR device instead of just failing

This commit is contained in:
mintsuki 2021-04-03 02:47:43 +02:00
parent d6f2585b09
commit fc61ae76a0

View File

@ -373,9 +373,18 @@ int main(int argc, char *argv[]) {
}
if (gpt == 0 && mbr == 0) {
fprintf(stderr, "ERROR: Could not determine if the device has a valid partition table.\n");
fprintf(stderr, " Please ensure the device has a valid MBR or GPT.\n");
goto cleanup;
fprintf(stderr, "WARNING: Could not determine if the device has a valid partition table.\n");
fprintf(stderr, " Please ensure the device has a valid MBR or GPT.\n\n");
fprintf(stderr, "Forcing installation as MBR on this device may result in LOSS OF DATA.\n\n");
fprintf(stderr, "To force installation as MBR on device '%s', type 'yes, proceed': ", argv[1]);
char buf[16];
fgets(buf, sizeof(buf), stdin);
size_t len = strlen(buf);
if (buf[len-1] == '\n')
buf[len-1] = 0;
if (strcmp(buf, "yes, proceed") != 0)
goto cleanup;
mbr = 1;
}
size_t stage2_size = bootloader_file_size - 512;