mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[grub] add fallback to same major version
This commit is contained in:
parent
08b6ce38c2
commit
8aeaa4d645
2 changed files with 31 additions and 16 deletions
37
src/rufus.c
37
src/rufus.c
|
@ -1352,7 +1352,7 @@ static BOOL BootCheck(void)
|
||||||
fd = fopen(tmp, "rb");
|
fd = fopen(tmp, "rb");
|
||||||
if (fd != NULL) {
|
if (fd != NULL) {
|
||||||
// If a file already exists in the current directory, use that one
|
// If a file already exists in the current directory, use that one
|
||||||
uprintf("Will reuse '%s' from './" FILES_DIR "/%s-%s/' for Grub 2.x installation\n",
|
uprintf("Will reuse '%s' from './" FILES_DIR "/%s-%s/' for Grub 2.x installation",
|
||||||
core_img, grub, img_report.grub2_version);
|
core_img, grub, img_report.grub2_version);
|
||||||
fseek(fd, 0, SEEK_END);
|
fseek(fd, 0, SEEK_END);
|
||||||
grub2_len = ftell(fd);
|
grub2_len = ftell(fd);
|
||||||
|
@ -1374,17 +1374,32 @@ static BOOL BootCheck(void)
|
||||||
else if (r == IDYES) {
|
else if (r == IDYES) {
|
||||||
static_sprintf(tmp, "%s-%s", grub, img_report.grub2_version);
|
static_sprintf(tmp, "%s-%s", grub, img_report.grub2_version);
|
||||||
IGNORE_RETVAL(_mkdir(tmp));
|
IGNORE_RETVAL(_mkdir(tmp));
|
||||||
|
IGNORE_RETVAL(_chdir(tmp));
|
||||||
static_sprintf(tmp, "%s/%s-%s/%s", FILES_URL, grub, img_report.grub2_version, core_img);
|
static_sprintf(tmp, "%s/%s-%s/%s", FILES_URL, grub, img_report.grub2_version, core_img);
|
||||||
PrintInfoDebug(0, MSG_085, tmp);
|
PrintInfoDebug(0, MSG_085, tmp);
|
||||||
PromptOnError = FALSE;
|
PromptOnError = FALSE;
|
||||||
grub2_len = (long)DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog);
|
grub2_len = (long)DownloadFile(tmp, core_img, hMainDialog);
|
||||||
PromptOnError = TRUE;
|
PromptOnError = TRUE;
|
||||||
|
if ((grub2_len == 0) && (DownloadStatus == 404)) {
|
||||||
|
// Couldn't locate the file on the server => try to download without the version extra
|
||||||
|
uprintf("Extended version was not found, trying main version...");
|
||||||
|
safe_strcpy(tmp2, sizeof(tmp2), img_report.grub2_version);
|
||||||
|
// Isolate the #.### part
|
||||||
|
for (i = 0; ((tmp2[i] >= '0') && (tmp2[i] <= '9')) || (tmp2[i] == '.'); i++);
|
||||||
|
tmp2[i] = 0;
|
||||||
|
static_sprintf(tmp, "%s/%s-%s/%s", FILES_URL, grub, tmp2, core_img);
|
||||||
|
PrintInfoDebug(0, MSG_085, tmp);
|
||||||
|
PromptOnError = FALSE;
|
||||||
|
grub2_len = (long)DownloadFile(tmp, core_img, hMainDialog);
|
||||||
|
PromptOnError = TRUE;
|
||||||
|
static_sprintf(tmp, "%s/%s-%s/%s", FILES_URL, grub, img_report.grub2_version, core_img);
|
||||||
|
}
|
||||||
if (grub2_len <= 0) {
|
if (grub2_len <= 0) {
|
||||||
PrintInfo(0, MSG_195, "Grub2");
|
PrintInfo(0, MSG_195, "Grub2");
|
||||||
uprintf("%s was not found - will use embedded version\n", tmp);
|
uprintf("%s was not found - will use embedded version", tmp);
|
||||||
} else {
|
} else {
|
||||||
PrintInfo(0, MSG_193, tmp);
|
PrintInfo(0, MSG_193, tmp);
|
||||||
fd = fopen(&tmp[sizeof(FILES_URL)], "rb");
|
fd = fopen(core_img, "rb");
|
||||||
grub2_buf = malloc(grub2_len);
|
grub2_buf = malloc(grub2_len);
|
||||||
if ((fd == NULL) || (grub2_buf == NULL) || (fread(grub2_buf, 1, (size_t)grub2_len, fd) != (size_t)grub2_len)) {
|
if ((fd == NULL) || (grub2_buf == NULL) || (fread(grub2_buf, 1, (size_t)grub2_len, fd) != (size_t)grub2_len)) {
|
||||||
uprintf("Failed to read '%s' data - will use embedded version", core_img);
|
uprintf("Failed to read '%s' data - will use embedded version", core_img);
|
||||||
|
@ -1411,7 +1426,7 @@ static BOOL BootCheck(void)
|
||||||
fd = fopen(tmp, "rb");
|
fd = fopen(tmp, "rb");
|
||||||
if (fd != NULL) {
|
if (fd != NULL) {
|
||||||
// If a file already exists in the current directory, use that one
|
// If a file already exists in the current directory, use that one
|
||||||
uprintf("Will replace obsolete '%s' from ISO with the one found in './" FILES_DIR "/%s'\n", old_c32_name[i], tmp);
|
uprintf("Will replace obsolete '%s' from ISO with the one found in './" FILES_DIR "/%s'", old_c32_name[i], tmp);
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
use_own_c32[i] = TRUE;
|
use_own_c32[i] = TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1424,7 +1439,7 @@ static BOOL BootCheck(void)
|
||||||
PrintInfo(0, MSG_085, old_c32_name[i]);
|
PrintInfo(0, MSG_085, old_c32_name[i]);
|
||||||
len = DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog);
|
len = DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
uprintf("Could not download file - cancelling\n");
|
uprintf("Could not download file - cancelling");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
use_own_c32[i] = TRUE;
|
use_own_c32[i] = TRUE;
|
||||||
|
@ -1450,7 +1465,7 @@ static BOOL BootCheck(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((syslinux_ldlinux_len[0] != 0) && (syslinux_ldlinux_len[1] != 0)) {
|
if ((syslinux_ldlinux_len[0] != 0) && (syslinux_ldlinux_len[1] != 0)) {
|
||||||
uprintf("Will reuse '%s.%s' and '%s.%s' from './" FILES_DIR "/%s/%s-%s%s/' for Syslinux installation\n",
|
uprintf("Will reuse '%s.%s' and '%s.%s' from './" FILES_DIR "/%s/%s-%s%s/' for Syslinux installation",
|
||||||
ldlinux, ldlinux_ext[0], ldlinux, ldlinux_ext[1], FILES_DIR, syslinux,
|
ldlinux, ldlinux_ext[0], ldlinux, ldlinux_ext[1], FILES_DIR, syslinux,
|
||||||
img_report.sl_version_str, img_report.sl_version_ext);
|
img_report.sl_version_str, img_report.sl_version_ext);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1475,7 +1490,7 @@ static BOOL BootCheck(void)
|
||||||
PromptOnError = TRUE;
|
PromptOnError = TRUE;
|
||||||
if ((syslinux_ldlinux_len[i] == 0) && (DownloadStatus == 404) && (*img_report.sl_version_ext != 0)) {
|
if ((syslinux_ldlinux_len[i] == 0) && (DownloadStatus == 404) && (*img_report.sl_version_ext != 0)) {
|
||||||
// Couldn't locate the file on the server => try to download without the version extra
|
// Couldn't locate the file on the server => try to download without the version extra
|
||||||
uprintf("Extended version was not found, trying main version\n");
|
uprintf("Extended version was not found, trying main version...");
|
||||||
static_sprintf(tmp, "%s/%s-%s/%s.%s", FILES_URL, syslinux, img_report.sl_version_str,
|
static_sprintf(tmp, "%s/%s-%s/%s.%s", FILES_URL, syslinux, img_report.sl_version_str,
|
||||||
ldlinux, ldlinux_ext[i]);
|
ldlinux, ldlinux_ext[i]);
|
||||||
PrintInfo(0, MSG_085, tmp);
|
PrintInfo(0, MSG_085, tmp);
|
||||||
|
@ -1493,7 +1508,7 @@ static BOOL BootCheck(void)
|
||||||
if (img_report.sl_version == embedded_sl_version[1]) {
|
if (img_report.sl_version == embedded_sl_version[1]) {
|
||||||
uprintf("Could not download the file - will try to use embedded %s version instead", img_report.sl_version_str);
|
uprintf("Could not download the file - will try to use embedded %s version instead", img_report.sl_version_str);
|
||||||
} else {
|
} else {
|
||||||
uprintf("Could not download the file - cancelling\n");
|
uprintf("Could not download the file - cancelling");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1508,7 +1523,7 @@ static BOOL BootCheck(void)
|
||||||
static_sprintf(tmp, "%s-%s/%s.%s", syslinux, embedded_sl_version_str[1], ldlinux, ldlinux_ext[2]);
|
static_sprintf(tmp, "%s-%s/%s.%s", syslinux, embedded_sl_version_str[1], ldlinux, ldlinux_ext[2]);
|
||||||
fd = fopenU(tmp, "rb");
|
fd = fopenU(tmp, "rb");
|
||||||
if (fd != NULL) {
|
if (fd != NULL) {
|
||||||
uprintf("Will reuse './%s/%s' for Syslinux installation\n", FILES_DIR, tmp);
|
uprintf("Will reuse './%s/%s' for Syslinux installation", FILES_DIR, tmp);
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
} else {
|
} else {
|
||||||
static_sprintf(tmp, "%s.%s", ldlinux, ldlinux_ext[2]);
|
static_sprintf(tmp, "%s.%s", ldlinux, ldlinux_ext[2]);
|
||||||
|
@ -1540,7 +1555,7 @@ static BOOL BootCheck(void)
|
||||||
static_sprintf(tmp, "grub4dos-%s/grldr", GRUB4DOS_VERSION);
|
static_sprintf(tmp, "grub4dos-%s/grldr", GRUB4DOS_VERSION);
|
||||||
fd = fopenU(tmp, "rb");
|
fd = fopenU(tmp, "rb");
|
||||||
if (fd != NULL) {
|
if (fd != NULL) {
|
||||||
uprintf("Will reuse './%s/%s' for Grub4DOS installation\n", FILES_DIR, tmp);
|
uprintf("Will reuse './%s/%s' for Grub4DOS installation", FILES_DIR, tmp);
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
} else {
|
} else {
|
||||||
static_sprintf(tmp, "grldr");
|
static_sprintf(tmp, "grldr");
|
||||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
IDD_DIALOG DIALOGEX 12, 12, 242, 376
|
IDD_DIALOG DIALOGEX 12, 12, 242, 376
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
EXSTYLE WS_EX_ACCEPTFILES
|
EXSTYLE WS_EX_ACCEPTFILES
|
||||||
CAPTION "Rufus 2.12.1016"
|
CAPTION "Rufus 2.12.1017"
|
||||||
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
|
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
|
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
|
||||||
|
@ -334,8 +334,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 2,12,1016,0
|
FILEVERSION 2,12,1017,0
|
||||||
PRODUCTVERSION 2,12,1016,0
|
PRODUCTVERSION 2,12,1017,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -352,13 +352,13 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
|
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
|
||||||
VALUE "FileDescription", "Rufus"
|
VALUE "FileDescription", "Rufus"
|
||||||
VALUE "FileVersion", "2.12.1016"
|
VALUE "FileVersion", "2.12.1017"
|
||||||
VALUE "InternalName", "Rufus"
|
VALUE "InternalName", "Rufus"
|
||||||
VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)"
|
VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)"
|
||||||
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
||||||
VALUE "OriginalFilename", "rufus.exe"
|
VALUE "OriginalFilename", "rufus.exe"
|
||||||
VALUE "ProductName", "Rufus"
|
VALUE "ProductName", "Rufus"
|
||||||
VALUE "ProductVersion", "2.12.1016"
|
VALUE "ProductVersion", "2.12.1017"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue