efibootdude 0.1__py3-none-any.whl → 0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of efibootdude might be problematic. Click here for more details.
- efibootdude/main.py +44 -27
- {efibootdude-0.1.dist-info → efibootdude-0.2.dist-info}/METADATA +8 -4
- efibootdude-0.2.dist-info/RECORD +9 -0
- efibootdude-0.1.dist-info/RECORD +0 -9
- {efibootdude-0.1.dist-info → efibootdude-0.2.dist-info}/LICENSE +0 -0
- {efibootdude-0.1.dist-info → efibootdude-0.2.dist-info}/WHEEL +0 -0
- {efibootdude-0.1.dist-info → efibootdude-0.2.dist-info}/entry_points.txt +0 -0
- {efibootdude-0.1.dist-info → efibootdude-0.2.dist-info}/top_level.txt +0 -0
efibootdude/main.py
CHANGED
|
@@ -18,7 +18,7 @@ from types import SimpleNamespace
|
|
|
18
18
|
import subprocess
|
|
19
19
|
import traceback
|
|
20
20
|
import curses as cs
|
|
21
|
-
import xml.etree.ElementTree as ET
|
|
21
|
+
# import xml.etree.ElementTree as ET
|
|
22
22
|
from efibootdude.PowerWindow import Window, OptionSpinner
|
|
23
23
|
|
|
24
24
|
|
|
@@ -37,10 +37,10 @@ class EfiBootDude:
|
|
|
37
37
|
spin.add_key('verbose', 'v - toggle verbose', vals=[False, True])
|
|
38
38
|
|
|
39
39
|
# FIXME: keys
|
|
40
|
-
other = '
|
|
40
|
+
other = 'tudrnmw*zqx'
|
|
41
41
|
other_keys = set(ord(x) for x in other)
|
|
42
42
|
other_keys.add(cs.KEY_ENTER)
|
|
43
|
-
|
|
43
|
+
other_keys.add(27) # ESCAPE
|
|
44
44
|
other_keys.add(10) # another form of ENTER
|
|
45
45
|
self.opts = spin.default_obj
|
|
46
46
|
|
|
@@ -89,27 +89,38 @@ class EfiBootDude:
|
|
|
89
89
|
|
|
90
90
|
def get_part_uuids(self):
|
|
91
91
|
""" Get all the Partition UUIDS"""
|
|
92
|
+
# uuids = {}
|
|
93
|
+
# with open('/run/blkid/blkid.tab', encoding='utf8') as fh:
|
|
94
|
+
# # sample: <device ... TYPE="vfat"
|
|
95
|
+
# # PARTUUID="25d2dea1-9f68-1644-91dd-4836c0b3a30a">/dev/nvme0n1p1</device>
|
|
96
|
+
# for xml_line in fh:
|
|
97
|
+
# element = ET.fromstring(xml_line)
|
|
98
|
+
# if 'PARTUUID' in element.attrib:
|
|
99
|
+
# device=element.text.strip()
|
|
100
|
+
# name = self.mounts.get(device, device)
|
|
101
|
+
# uuids[element.attrib['PARTUUID'].lower()] = name
|
|
102
|
+
# return uuids
|
|
103
|
+
|
|
92
104
|
uuids = {}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
105
|
+
partuuid_path = '/dev/disk/by-partuuid/'
|
|
106
|
+
|
|
107
|
+
if not os.path.exists(partuuid_path):
|
|
108
|
+
return uuids
|
|
109
|
+
for entry in os.listdir(partuuid_path):
|
|
110
|
+
full_path = os.path.join(partuuid_path, entry)
|
|
111
|
+
if os.path.islink(full_path):
|
|
112
|
+
device_path = os.path.realpath(full_path)
|
|
113
|
+
uuids[entry] = device_path
|
|
102
114
|
return uuids
|
|
103
115
|
|
|
104
116
|
@staticmethod
|
|
105
|
-
def
|
|
117
|
+
def extract_uuids(line):
|
|
106
118
|
""" Find uuid string in a line """
|
|
107
119
|
# Define the regex pattern for UUID (e.g., 25d2dea1-9f68-1644-91dd-4836c0b3a30a)
|
|
108
120
|
pattern = r'\b[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}\b'
|
|
109
121
|
# Search for the pattern in the line
|
|
110
|
-
|
|
111
|
-
return
|
|
112
|
-
|
|
122
|
+
mats = re.findall(pattern, line, re.IGNORECASE)
|
|
123
|
+
return mats
|
|
113
124
|
|
|
114
125
|
def digest_boots(self):
|
|
115
126
|
""" Digest the output of 'efibootmgr'."""
|
|
@@ -165,16 +176,19 @@ class EfiBootDude:
|
|
|
165
176
|
label_wid = max(label_wid, len(ns.label))
|
|
166
177
|
other = mat.group(4)
|
|
167
178
|
|
|
168
|
-
|
|
179
|
+
pat = r'(?:/?\b\w*\(|/)(\\[^/()]+)(?:$|[()/])'
|
|
180
|
+
mat = re.search(pat, other, re.IGNORECASE)
|
|
169
181
|
device, subpath = '', '' # e.g., /boot/efi, \EFI\UBUNTU\SHIMX64.EFI
|
|
170
182
|
if mat:
|
|
171
183
|
subpath = mat.group(1) + ' '
|
|
172
184
|
start, end = mat.span()
|
|
173
185
|
other = other[:start] + other[end:]
|
|
174
186
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
187
|
+
uuids = self.extract_uuids(other)
|
|
188
|
+
for uuid in uuids:
|
|
189
|
+
if uuid and uuid in self.uuids:
|
|
190
|
+
device = self.uuids[uuid]
|
|
191
|
+
break
|
|
178
192
|
|
|
179
193
|
if device:
|
|
180
194
|
ns.info1 = device
|
|
@@ -232,7 +246,8 @@ class EfiBootDude:
|
|
|
232
246
|
cmds.append(f'{prefix} --bootnum {ident} --label "{tag}"')
|
|
233
247
|
if self.mods.order:
|
|
234
248
|
orders = [ns.ident for ns in self.digests if ns.is_boot]
|
|
235
|
-
|
|
249
|
+
orders = ','.join(orders)
|
|
250
|
+
cmds.append(f'{prefix} --bootorder {orders}')
|
|
236
251
|
if self.mods.next:
|
|
237
252
|
cmds.append(f'{prefix} --bootnext {self.mods.next}')
|
|
238
253
|
if self.mods.timeout:
|
|
@@ -280,7 +295,7 @@ class EfiBootDude:
|
|
|
280
295
|
' * - toggle whether entry is active'
|
|
281
296
|
' m - modify - modify the value'
|
|
282
297
|
' w - write - write the changes',
|
|
283
|
-
'
|
|
298
|
+
' ESC - abandon changes and re-read boot state',
|
|
284
299
|
]
|
|
285
300
|
for line in lines:
|
|
286
301
|
self.win.put_body(line)
|
|
@@ -341,7 +356,6 @@ class EfiBootDude:
|
|
|
341
356
|
actions['m'] = 'modify'
|
|
342
357
|
if self.mods.dirty:
|
|
343
358
|
actions['w'] = 'write'
|
|
344
|
-
actions['f'] = 'fresh'
|
|
345
359
|
|
|
346
360
|
return actions
|
|
347
361
|
|
|
@@ -468,10 +482,13 @@ class EfiBootDude:
|
|
|
468
482
|
self.mods.dirty = True
|
|
469
483
|
break
|
|
470
484
|
|
|
471
|
-
if key ==
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
485
|
+
if key == 27: # ESC
|
|
486
|
+
if self.mods.dirty:
|
|
487
|
+
answer = self.win.answer(
|
|
488
|
+
prompt='Enter "y" to clear edits and refresh')
|
|
489
|
+
if answer.strip().lower().startswith('y'):
|
|
490
|
+
self.reinit()
|
|
491
|
+
else:
|
|
475
492
|
self.reinit()
|
|
476
493
|
return None
|
|
477
494
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: efibootdude
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2
|
|
4
4
|
Summary: A visual wrapper for efibootmgr
|
|
5
5
|
Author-email: Joe Defen <joedef@google.com>
|
|
6
6
|
License: MIT
|
|
@@ -36,20 +36,24 @@ To be sure, there are many other esoteric uses of `efibootmanager` including add
|
|
|
36
36
|
a new boot entry; for such needs, just use `efibootmgr` directly.
|
|
37
37
|
|
|
38
38
|
## Usage
|
|
39
|
-
After running `efibootdude
|
|
39
|
+
After running `efibootdude` and making some changes, you'll see a screen comparable to this:
|
|
40
40
|
|
|
41
41
|
.
|
|
42
42
|
|
|
43
43
|
At this point
|
|
44
44
|
* The current line starts with `>` and is highlighted.
|
|
45
|
-
* The top line shows actions for the current line
|
|
45
|
+
* The top line shows actions for the current line; type the underscored letter
|
|
46
|
+
to effect the action.
|
|
46
47
|
* Enter `?` for a more complete explanation of the keys, navigation keys, etc.
|
|
48
|
+
* **ALWAYS** view the help at least once if unfamiliar with this tool,
|
|
49
|
+
it navigation, and/or uncertain of keys not shown on top line.
|
|
47
50
|
* With this current line, we can:
|
|
48
51
|
* Use `u` or `d` to move it up or down in the boot order.
|
|
49
52
|
* Use `t` to relabel the boot entry.
|
|
50
53
|
* Use `r` to remove it.
|
|
51
54
|
* And so forth.
|
|
52
|
-
*
|
|
55
|
+
* Use the `ESC` key to abandon any changes and reload the boot information.
|
|
56
|
+
* When ready to write the changes to the BIOS, enter `w`.
|
|
53
57
|
* When writing the changes, `efibootdude` drops out of menu mode so you can
|
|
54
58
|
verify the underlying commands, error codes, and error messages.
|
|
55
59
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
efibootdude/PowerWindow.py,sha256=pQGXsAMeuiHn-vtEiVG0rgW1eCslh3ukC-VrPhH_j3k,28587
|
|
2
|
+
efibootdude/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
efibootdude/main.py,sha256=opKAafTuw9BpwZl-Q99BmMGVarsf_fEgY-aLjbpeZtA,18460
|
|
4
|
+
efibootdude-0.2.dist-info/LICENSE,sha256=qB9OdnyyF6WYHiEIXVm0rOSdcf8e2ctorrtWs6CC5lU,1062
|
|
5
|
+
efibootdude-0.2.dist-info/METADATA,sha256=HuHORtrDzLH0ItVDm_UbRXsRVRSgBtyBcVEkzODKNCY,3380
|
|
6
|
+
efibootdude-0.2.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
|
|
7
|
+
efibootdude-0.2.dist-info/entry_points.txt,sha256=3KZ_86ZSy4f-weuSruTlMGaQ96jZUm7mjyITVnjE184,54
|
|
8
|
+
efibootdude-0.2.dist-info/top_level.txt,sha256=BrMsK3JmOrVJUNkHX1dicqWrdjbm4itRtmXJMxte-VU,12
|
|
9
|
+
efibootdude-0.2.dist-info/RECORD,,
|
efibootdude-0.1.dist-info/RECORD
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
efibootdude/PowerWindow.py,sha256=pQGXsAMeuiHn-vtEiVG0rgW1eCslh3ukC-VrPhH_j3k,28587
|
|
2
|
-
efibootdude/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
efibootdude/main.py,sha256=89TpsC_9gHLZeNtrliRNemks-XEq6du5LJzS-G131YA,17917
|
|
4
|
-
efibootdude-0.1.dist-info/LICENSE,sha256=qB9OdnyyF6WYHiEIXVm0rOSdcf8e2ctorrtWs6CC5lU,1062
|
|
5
|
-
efibootdude-0.1.dist-info/METADATA,sha256=0aKQM2AURg1N2l7R3LuEeyARSy6a0D-BrlQNmnWhiIs,3079
|
|
6
|
-
efibootdude-0.1.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
|
|
7
|
-
efibootdude-0.1.dist-info/entry_points.txt,sha256=3KZ_86ZSy4f-weuSruTlMGaQ96jZUm7mjyITVnjE184,54
|
|
8
|
-
efibootdude-0.1.dist-info/top_level.txt,sha256=BrMsK3JmOrVJUNkHX1dicqWrdjbm4itRtmXJMxte-VU,12
|
|
9
|
-
efibootdude-0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|