refs #2858 improve detection of BCD files for the menu entries

pull/127/head
Natalia Serrano 2025-10-02 14:23:15 +02:00
parent ab552d571d
commit ae48530b95
2 changed files with 11 additions and 6 deletions

View File

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.7.2] - 2025-10-02
### Fixed
- Improve detection of BCD files for the menu entries
## [1.7.1] - 2025-10-02
### Fixed

View File

@ -462,15 +462,14 @@ def ogGetOsVersion(disk, part):
# Para cargador Windows: buscar versión en fichero BCD (basado en os-prober).
if not version:
type = 'WinLoader'
file = FileLib.ogGetPath (file=f'{mntdir}/boot/bcd')
if not file:
file = FileLib.ogGetPath (file=f'{mntdir}/EFI/Microsoft/boot/bcd')
if file:
find_out = subprocess.run (['find', mntdir, '-type', 'f'], capture_output=True, text=True).stdout
bcd_files = list (filter (lambda x: 'Boot/BCD' in x, find_out.splitlines()))
if bcd_files:
for distrib in 'Windows Recovery', 'Windows Boot':
with open (file, 'rb') as fd:
contents = fd.read()
distrib_utf16_regex = re.sub (r'(.)', '\\1.', distrib)
distrib_utf16_regex = bytes (distrib_utf16_regex, 'ascii')
with open (bcd_files[0], 'rb') as fd:
contents = fd.read()
if re.search (distrib_utf16_regex, contents):
version = f'{distrib} loader'
# Para macOS: detectar kernel y completar con fichero plist de información del sistema.