mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[iso] fix GRUB version detection for Fedora Rawhide
* How nice of "Open Source proponent" IBM/Red-Hat/Fedora to fix double space typos while making sure the provenance of the software they are using is hidden: https://src.fedoraproject.org/rpms/grub2/blob/rawhide/f/0024-Don-t-say-GNU-Linux-in-generated-menus.patch * Long story short: Fedora fixed the double space in "GRUB version", but of course they didn't upstream this change since it is part of a patch that removes every possible mention of GNU. This made our GRUB version detection break, since it relies on finding a "GRUB version" string. * Fix this by looking for both "GRUB version" and "GRUB version". * This, however, does not fix Fedora Rawhide BIOS boot, since they also added custom GRUB calls such as 'grub_debug_is_enabled', which we don't have in our vanilla produced GRUB binary. * Closes #2002.
This commit is contained in:
		
							parent
							
								
									a2e9b6fee0
								
							
						
					
					
						commit
						eda1f59a38
					
				
					 3 changed files with 25 additions and 15 deletions
				
			
		|  | @ -1,16 +1,17 @@ | ||||||
| o Version 3.20 (2022.08.??) | o Version 3.20 (2022.08.??) | ||||||
|     Enable applicable Windows User Experience options for Windows 10 |     Enable applicable Windows User Experience options for Windows 10 | ||||||
|     Make Windows User Experience options persist between sessions |     Remember last Windows User Experience selection between sessions | ||||||
|     Add automatic local account creation and regional options duplication |     Add automatic local account creation and regional options duplication | ||||||
|     (NB: This is limited to creating an account with the same name as the current user and |     (NB: This is limited to creating an account with the same name as the current user and | ||||||
|      with an empty password that the user will be prompted to change after first reboot) |      with an empty password that the user will be prompted to change after first reboot) | ||||||
|     Add a workaround for ISOs that have a 'syslinux' symbolic link to '/isolinux/' (Knoppix) |     Add a workaround for ISOs that have a 'syslinux' symbolic link to '/isolinux/' (Knoppix) | ||||||
|     Revert to inserting registry keys for the TPM/SB/RAM bypass where possible |     Revert to offline insertion of registry keys for the TPM/SB/RAM bypass where possible | ||||||
|     Remove storage bypass, since this is a bogus bypass that doesn't do anything |     Remove storage bypass, since this is a bogus bypass that doesn't do anything | ||||||
|     Improve BIOS compatibility when displaying the "UEFI boot only" alert message |     Improve BIOS compatibility when displaying the "UEFI boot only" alert message | ||||||
|     Fix Windows User Experience dialog appearing twice for Windows To Go |     Fix Windows User Experience dialog appearing twice for Windows To Go | ||||||
|     Fix Windows User Experience options not being applied for ARM64 |     Fix Windows User Experience options not being applied for ARM64 | ||||||
|     Fix Microsoft Account bypass not being applied unless TPM/SB/RAM bypass is selected |     Fix Microsoft Account bypass not being applied unless TPM/SB/RAM bypass is selected | ||||||
|  |     Fix overeager detection of GRUB2 bootloaders with nonstandard prefixes | ||||||
| 
 | 
 | ||||||
| o Version 3.19 (2022.07.01) | o Version 3.19 (2022.07.01) | ||||||
|     Add a new selection dialog for Windows 11 setup customization: |     Add a new selection dialog for Windows 11 setup customization: | ||||||
|  |  | ||||||
							
								
								
									
										19
									
								
								src/iso.c
									
										
									
									
									
								
							
							
						
						
									
										19
									
								
								src/iso.c
									
										
									
									
									
								
							|  | @ -847,16 +847,25 @@ out: | ||||||
| 
 | 
 | ||||||
| void GetGrubVersion(char* buf, size_t buf_size) | void GetGrubVersion(char* buf, size_t buf_size) | ||||||
| { | { | ||||||
|  | 	// In typical "I'll make my own Open Source... with blackjack and hookers!" fashion,
 | ||||||
|  | 	// IBM/Red-Hat/Fedora took it upon themselves to "fix" the double space typo from the
 | ||||||
|  | 	// GRUB version string. But of course, just like their introduction of GRUB calls like
 | ||||||
|  | 	// 'grub_debug_is_enabled', they didn't want to bother upstreaming their changes...
 | ||||||
|  | 	// On the other hand, boy do they want to leech of FSF/GNU developed software, while
 | ||||||
|  | 	// not having it mention GNU anywhere. See:
 | ||||||
|  | 	// https://src.fedoraproject.org/rpms/grub2/blob/rawhide/f/0024-Don-t-say-GNU-Linux-in-generated-menus.patch
 | ||||||
|  | 	const char* grub_version_str[] = { "GRUB  version %s", "GRUB version %s" }; | ||||||
| 	char *p, unauthorized[] = {'<', '>', ':', '|', '*', '?', '\\', '/'}; | 	char *p, unauthorized[] = {'<', '>', ':', '|', '*', '?', '\\', '/'}; | ||||||
| 	size_t i; | 	size_t i, j; | ||||||
| 	const char grub_version_str[] = "GRUB  version %s"; |  | ||||||
| 
 | 
 | ||||||
| 	for (i = 0; i < buf_size; i++) { | 	for (i = 0; i < buf_size; i++) { | ||||||
| 		if (memcmp(&buf[i], grub_version_str, sizeof(grub_version_str)) == 0) { | 		for (j = 0; j < ARRAYSIZE(grub_version_str); j++) { | ||||||
| 			static_strcpy(img_report.grub2_version, &buf[i + sizeof(grub_version_str)]); | 			if (memcmp(&buf[i], grub_version_str[j], strlen(grub_version_str[j]) + 1) == 0) { | ||||||
|  | 				static_strcpy(img_report.grub2_version, &buf[i + strlen(grub_version_str[j]) + 1]); | ||||||
| 				break; | 				break; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | 	} | ||||||
| 	// Sanitize the string
 | 	// Sanitize the string
 | ||||||
| 	for (p = &img_report.grub2_version[0]; *p; p++) { | 	for (p = &img_report.grub2_version[0]; *p; p++) { | ||||||
| 		for (i = 0; i < sizeof(unauthorized); i++) { | 		for (i = 0; i < sizeof(unauthorized); i++) { | ||||||
|  | @ -1139,7 +1148,7 @@ out: | ||||||
| 				// when using '/boot/grub2' as a prefix is very small and always located at the
 | 				// when using '/boot/grub2' as a prefix is very small and always located at the
 | ||||||
| 				// very end the file to patch the damn thing and get on with our life!
 | 				// very end the file to patch the damn thing and get on with our life!
 | ||||||
| 				uprintf("  Detected Grub version: %s%s", img_report.grub2_version, | 				uprintf("  Detected Grub version: %s%s", img_report.grub2_version, | ||||||
| 					img_report.has_grub2 >= 1 ? " with NONSTANDARD prefix" : ""); | 					img_report.has_grub2 > 1 ? " with NONSTANDARD prefix" : ""); | ||||||
| 				for (k = 0; k < ARRAYSIZE(grub_patch); k++) { | 				for (k = 0; k < ARRAYSIZE(grub_patch); k++) { | ||||||
| 					if (strcmp(img_report.grub2_version, grub_patch[k].version) == 0) | 					if (strcmp(img_report.grub2_version, grub_patch[k].version) == 0) | ||||||
| 						break; | 						break; | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 232, 326 | IDD_DIALOG DIALOGEX 12, 12, 232, 326 | ||||||
| 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 3.20.1926" | CAPTION "Rufus 3.20.1927" | ||||||
| FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | ||||||
| BEGIN | BEGIN | ||||||
|     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP |     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP | ||||||
|  | @ -395,8 +395,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 3,20,1926,0 |  FILEVERSION 3,20,1927,0 | ||||||
|  PRODUCTVERSION 3,20,1926,0 |  PRODUCTVERSION 3,20,1927,0 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -414,13 +414,13 @@ BEGIN | ||||||
|             VALUE "Comments", "https://rufus.ie" |             VALUE "Comments", "https://rufus.ie" | ||||||
|             VALUE "CompanyName", "Akeo Consulting" |             VALUE "CompanyName", "Akeo Consulting" | ||||||
|             VALUE "FileDescription", "Rufus" |             VALUE "FileDescription", "Rufus" | ||||||
|             VALUE "FileVersion", "3.20.1926" |             VALUE "FileVersion", "3.20.1927" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2022 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2022 Pete Batard (GPL v3)" | ||||||
|             VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" |             VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" | ||||||
|             VALUE "OriginalFilename", "rufus-3.20.exe" |             VALUE "OriginalFilename", "rufus-3.20.exe" | ||||||
|             VALUE "ProductName", "Rufus" |             VALUE "ProductName", "Rufus" | ||||||
|             VALUE "ProductVersion", "3.20.1926" |             VALUE "ProductVersion", "3.20.1927" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue