efibootdude 0.1__tar.gz → 0.3__tar.gz
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.
- {efibootdude-0.1/src/efibootdude.egg-info → efibootdude-0.3}/PKG-INFO +10 -4
- {efibootdude-0.1 → efibootdude-0.3}/README.md +9 -3
- {efibootdude-0.1 → efibootdude-0.3}/pyproject.toml +1 -1
- {efibootdude-0.1 → efibootdude-0.3}/src/efibootdude/main.py +37 -29
- {efibootdude-0.1 → efibootdude-0.3/src/efibootdude.egg-info}/PKG-INFO +10 -4
- {efibootdude-0.1 → efibootdude-0.3}/LICENSE +0 -0
- {efibootdude-0.1 → efibootdude-0.3}/setup.cfg +0 -0
- {efibootdude-0.1 → efibootdude-0.3}/src/efibootdude/PowerWindow.py +0 -0
- {efibootdude-0.1 → efibootdude-0.3}/src/efibootdude/__init__.py +0 -0
- {efibootdude-0.1 → efibootdude-0.3}/src/efibootdude.egg-info/SOURCES.txt +0 -0
- {efibootdude-0.1 → efibootdude-0.3}/src/efibootdude.egg-info/dependency_links.txt +0 -0
- {efibootdude-0.1 → efibootdude-0.3}/src/efibootdude.egg-info/entry_points.txt +0 -0
- {efibootdude-0.1 → efibootdude-0.3}/src/efibootdude.egg-info/requires.txt +0 -0
- {efibootdude-0.1 → efibootdude-0.3}/src/efibootdude.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: efibootdude
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3
|
|
4
4
|
Summary: A visual wrapper for efibootmgr
|
|
5
5
|
Author-email: Joe Defen <joedef@google.com>
|
|
6
6
|
License: MIT
|
|
@@ -36,20 +36,26 @@ 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
|
+
* The entries with `*` on the left are active boot entries; toggle whether
|
|
56
|
+
active by pressing `*`.
|
|
57
|
+
* Use the `ESC` key to abandon any changes and reload the boot information.
|
|
58
|
+
* When ready to write the changes to the BIOS, enter `w`.
|
|
53
59
|
* When writing the changes, `efibootdude` drops out of menu mode so you can
|
|
54
60
|
verify the underlying commands, error codes, and error messages.
|
|
55
61
|
|
|
@@ -18,20 +18,26 @@ To be sure, there are many other esoteric uses of `efibootmanager` including add
|
|
|
18
18
|
a new boot entry; for such needs, just use `efibootmgr` directly.
|
|
19
19
|
|
|
20
20
|
## Usage
|
|
21
|
-
After running `efibootdude
|
|
21
|
+
After running `efibootdude` and making some changes, you'll see a screen comparable to this:
|
|
22
22
|
|
|
23
23
|
.
|
|
24
24
|
|
|
25
25
|
At this point
|
|
26
26
|
* The current line starts with `>` and is highlighted.
|
|
27
|
-
* The top line shows actions for the current line
|
|
27
|
+
* The top line shows actions for the current line; type the underscored letter
|
|
28
|
+
to effect the action.
|
|
28
29
|
* Enter `?` for a more complete explanation of the keys, navigation keys, etc.
|
|
30
|
+
* **ALWAYS** view the help at least once if unfamiliar with this tool,
|
|
31
|
+
it navigation, and/or uncertain of keys not shown on top line.
|
|
29
32
|
* With this current line, we can:
|
|
30
33
|
* Use `u` or `d` to move it up or down in the boot order.
|
|
31
34
|
* Use `t` to relabel the boot entry.
|
|
32
35
|
* Use `r` to remove it.
|
|
33
36
|
* And so forth.
|
|
34
|
-
*
|
|
37
|
+
* The entries with `*` on the left are active boot entries; toggle whether
|
|
38
|
+
active by pressing `*`.
|
|
39
|
+
* Use the `ESC` key to abandon any changes and reload the boot information.
|
|
40
|
+
* When ready to write the changes to the BIOS, enter `w`.
|
|
35
41
|
* When writing the changes, `efibootdude` drops out of menu mode so you can
|
|
36
42
|
verify the underlying commands, error codes, and error messages.
|
|
37
43
|
|
|
@@ -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
|
|
|
@@ -90,35 +90,37 @@ class EfiBootDude:
|
|
|
90
90
|
def get_part_uuids(self):
|
|
91
91
|
""" Get all the Partition UUIDS"""
|
|
92
92
|
uuids = {}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
partuuid_path = '/dev/disk/by-partuuid/'
|
|
94
|
+
|
|
95
|
+
if not os.path.exists(partuuid_path):
|
|
96
|
+
return uuids
|
|
97
|
+
for entry in os.listdir(partuuid_path):
|
|
98
|
+
full_path = os.path.join(partuuid_path, entry)
|
|
99
|
+
if os.path.islink(full_path):
|
|
100
|
+
device_path = os.path.realpath(full_path)
|
|
101
|
+
uuids[entry] = device_path
|
|
102
|
+
if device_path in self.mounts:
|
|
103
|
+
uuids[entry] = self.mounts[device_path]
|
|
102
104
|
return uuids
|
|
103
105
|
|
|
104
106
|
@staticmethod
|
|
105
|
-
def
|
|
107
|
+
def extract_uuids(line):
|
|
106
108
|
""" Find uuid string in a line """
|
|
107
109
|
# Define the regex pattern for UUID (e.g., 25d2dea1-9f68-1644-91dd-4836c0b3a30a)
|
|
108
110
|
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
|
-
|
|
110
|
-
|
|
111
|
-
return match.group(0).lower() if match else None
|
|
112
|
-
|
|
111
|
+
mats = re.findall(pattern, line, re.IGNORECASE)
|
|
112
|
+
return mats
|
|
113
113
|
|
|
114
114
|
def digest_boots(self):
|
|
115
115
|
""" Digest the output of 'efibootmgr'."""
|
|
116
116
|
# Define the command to run
|
|
117
117
|
lines = []
|
|
118
118
|
if self.testfile:
|
|
119
|
+
# if given a "testfile" (which should be just the
|
|
120
|
+
# raw output of 'efibootmgr'), then parse it
|
|
119
121
|
with open(self.testfile, 'r', encoding='utf-8') as fh:
|
|
120
122
|
lines = fh.readlines()
|
|
121
|
-
else:
|
|
123
|
+
else: # run efibootmgr
|
|
122
124
|
command = 'efibootmgr'.split()
|
|
123
125
|
result = subprocess.run(command, stdout=subprocess.PIPE, text=True, check=True)
|
|
124
126
|
lines = result.stdout.splitlines()
|
|
@@ -165,16 +167,19 @@ class EfiBootDude:
|
|
|
165
167
|
label_wid = max(label_wid, len(ns.label))
|
|
166
168
|
other = mat.group(4)
|
|
167
169
|
|
|
168
|
-
|
|
170
|
+
pat = r'(?:/?\b\w*\(|/)(\\[^/()]+)(?:$|[()/])'
|
|
171
|
+
mat = re.search(pat, other, re.IGNORECASE)
|
|
169
172
|
device, subpath = '', '' # e.g., /boot/efi, \EFI\UBUNTU\SHIMX64.EFI
|
|
170
173
|
if mat:
|
|
171
174
|
subpath = mat.group(1) + ' '
|
|
172
175
|
start, end = mat.span()
|
|
173
176
|
other = other[:start] + other[end:]
|
|
174
177
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
+
uuids = self.extract_uuids(other)
|
|
179
|
+
for uuid in uuids:
|
|
180
|
+
if uuid and uuid in self.uuids:
|
|
181
|
+
device = self.uuids[uuid]
|
|
182
|
+
break
|
|
178
183
|
|
|
179
184
|
if device:
|
|
180
185
|
ns.info1 = device
|
|
@@ -232,7 +237,8 @@ class EfiBootDude:
|
|
|
232
237
|
cmds.append(f'{prefix} --bootnum {ident} --label "{tag}"')
|
|
233
238
|
if self.mods.order:
|
|
234
239
|
orders = [ns.ident for ns in self.digests if ns.is_boot]
|
|
235
|
-
|
|
240
|
+
orders = ','.join(orders)
|
|
241
|
+
cmds.append(f'{prefix} --bootorder {orders}')
|
|
236
242
|
if self.mods.next:
|
|
237
243
|
cmds.append(f'{prefix} --bootnext {self.mods.next}')
|
|
238
244
|
if self.mods.timeout:
|
|
@@ -280,7 +286,7 @@ class EfiBootDude:
|
|
|
280
286
|
' * - toggle whether entry is active'
|
|
281
287
|
' m - modify - modify the value'
|
|
282
288
|
' w - write - write the changes',
|
|
283
|
-
'
|
|
289
|
+
' ESC - abandon changes and re-read boot state',
|
|
284
290
|
]
|
|
285
291
|
for line in lines:
|
|
286
292
|
self.win.put_body(line)
|
|
@@ -341,7 +347,6 @@ class EfiBootDude:
|
|
|
341
347
|
actions['m'] = 'modify'
|
|
342
348
|
if self.mods.dirty:
|
|
343
349
|
actions['w'] = 'write'
|
|
344
|
-
actions['f'] = 'fresh'
|
|
345
350
|
|
|
346
351
|
return actions
|
|
347
352
|
|
|
@@ -468,10 +473,13 @@ class EfiBootDude:
|
|
|
468
473
|
self.mods.dirty = True
|
|
469
474
|
break
|
|
470
475
|
|
|
471
|
-
if key ==
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
476
|
+
if key == 27: # ESC
|
|
477
|
+
if self.mods.dirty:
|
|
478
|
+
answer = self.win.answer(
|
|
479
|
+
prompt='Enter "y" to clear edits and refresh')
|
|
480
|
+
if answer.strip().lower().startswith('y'):
|
|
481
|
+
self.reinit()
|
|
482
|
+
else:
|
|
475
483
|
self.reinit()
|
|
476
484
|
return None
|
|
477
485
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: efibootdude
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3
|
|
4
4
|
Summary: A visual wrapper for efibootmgr
|
|
5
5
|
Author-email: Joe Defen <joedef@google.com>
|
|
6
6
|
License: MIT
|
|
@@ -36,20 +36,26 @@ 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
|
+
* The entries with `*` on the left are active boot entries; toggle whether
|
|
56
|
+
active by pressing `*`.
|
|
57
|
+
* Use the `ESC` key to abandon any changes and reload the boot information.
|
|
58
|
+
* When ready to write the changes to the BIOS, enter `w`.
|
|
53
59
|
* When writing the changes, `efibootdude` drops out of menu mode so you can
|
|
54
60
|
verify the underlying commands, error codes, and error messages.
|
|
55
61
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|