diff options
-rw-r--r-- | src/live/ogOperations.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py index 010af05..9c32cce 100644 --- a/src/live/ogOperations.py +++ b/src/live/ogOperations.py @@ -157,6 +157,33 @@ class OgLiveOperations: 'checksum': image_checksum}) return cache_contents + def _get_boot_entry_data(self): + data = {} + + if not is_uefi_supported(): + return data + + try: + efibootmgr_out = run_efibootmgr_json() + except Exception as e: + logging.warning(e) + return data + + data['entries'] = [] + for idx, entry_name in enumerate(efibootmgr_out['BootOrder']): + entry_name = 'Boot' + entry_name + for entry in efibootmgr_out['vars']: + if entry['name'] == entry_name: + entry['order'] = idx + data['entries'].append(entry) + break + + for entry in efibootmgr_out['vars']: + if not 'order' in entry: + data['entries'].append(entry) + + return data + def _compute_md5(self, path, bs=2**20): m = hashlib.md5() with open(path, 'rb') as f: @@ -756,6 +783,10 @@ class OgLiveOperations: json_body['cache'] = self._get_cache_contents() + boot_entry_data = self._get_boot_entry_data() + if boot_entry_data: + json_body['efi'] = boot_entry_data + generate_menu(json_body['partition_setup']) generate_cache_txt() self._restartBrowser(self._url) |