efibootdude 0.0__py3-none-any.whl → 0.1__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 CHANGED
@@ -26,10 +26,11 @@ class EfiBootDude:
26
26
  """ Main class for curses atop efibootmgr"""
27
27
  singleton = None
28
28
 
29
- def __init__(self):
29
+ def __init__(self, testfile=None):
30
30
  # self.cmd_loop = CmdLoop(db=False) # just running as command
31
31
  assert not EfiBootDude.singleton
32
32
  EfiBootDude.singleton = self
33
+ self.testfile = testfile
33
34
 
34
35
  spin = self.spin = OptionSpinner()
35
36
  spin.add_key('help_mode', '? - toggle help screen', vals=[False, True])
@@ -113,10 +114,14 @@ class EfiBootDude:
113
114
  def digest_boots(self):
114
115
  """ Digest the output of 'efibootmgr'."""
115
116
  # Define the command to run
116
- command = 'efibootmgr'.split()
117
- # Run the command and capture the output
118
- result = subprocess.run(command, stdout=subprocess.PIPE, text=True, check=True)
119
- lines = result.stdout.splitlines()
117
+ lines = []
118
+ if self.testfile:
119
+ with open(self.testfile, 'r', encoding='utf-8') as fh:
120
+ lines = fh.readlines()
121
+ else:
122
+ command = 'efibootmgr'.split()
123
+ result = subprocess.run(command, stdout=subprocess.PIPE, text=True, check=True)
124
+ lines = result.stdout.splitlines()
120
125
  rv = []
121
126
  width1 = 0 # width of info1
122
127
  label_wid = 0
@@ -141,8 +146,8 @@ class EfiBootDude:
141
146
  )
142
147
 
143
148
  mat = re.match(r'\bBoot([0-9a-f]+)\b(\*?)' # Boot0024*
144
- + r'\s+(\w.*\w)\s+' # Linux Boot Manager
145
- + r'\b(\w+\(.*)$', # HD(4,GPT,cd15e3b1-...
149
+ + r'\s+(\S.*\S|\S)\s*\t' # Linux Boot Manager
150
+ + r'\s*(\S.*\S|\S)\s*$', # HD(4,GPT,cd15e3b1-...
146
151
  line, re.IGNORECASE)
147
152
  if not mat:
148
153
  ns.ident = key
@@ -243,7 +248,7 @@ class EfiBootDude:
243
248
  os.system('/bin/echo; /bin/echo')
244
249
 
245
250
  for cmd in cmds:
246
- os.system(f'set -x; {cmd}; /bin/echo " <<<ExitCode=$?>>>"')
251
+ os.system(f'(set -x; {cmd}); /bin/echo " <<<ExitCode=$?>>>"')
247
252
 
248
253
  os.system(r'/bin/echo -e "\n\n===== Press ENTER for menu ====> \c"; read FOO')
249
254
  self.reinit()
@@ -380,7 +385,7 @@ class EfiBootDude:
380
385
  answer = 'y'
381
386
  if self.mods.dirty:
382
387
  answer = self.win.answer(
383
- prompt='Enter "y" to abandon edits and exit [then Enter]')
388
+ prompt='Enter "y" to abandon edits and exit')
384
389
  if answer.strip().lower().startswith('y'):
385
390
  self.win.stop_curses()
386
391
  os.system('clear; stty sane')
@@ -394,7 +399,7 @@ class EfiBootDude:
394
399
  seed = ns.label.split()[0]
395
400
  while True:
396
401
  answer = self.win.answer(
397
- prompt='Enter timeout seconds or clear to abort [then Enter]',
402
+ prompt='Enter timeout seconds or clear to abort',
398
403
  seed=seed, width=80)
399
404
  seed = answer = answer.strip()
400
405
  if not answer:
@@ -452,7 +457,7 @@ class EfiBootDude:
452
457
  if key == ord('t') and ns.is_boot:
453
458
  seed = ns.label
454
459
  while True:
455
- answer = self.win.answer(prompt='Enter new label or clear to abort [then Enter], ',
460
+ answer = self.win.answer(prompt='Enter new label or clear to abort',
456
461
  seed=seed, width=80)
457
462
  seed = answer = answer.strip()
458
463
  if not answer:
@@ -465,7 +470,7 @@ class EfiBootDude:
465
470
 
466
471
  if key == ord('f') and self.mods.dirty:
467
472
  answer = self.win.answer(
468
- prompt='Enter "y" to clear edits and refresh [then Enter]')
473
+ prompt='Enter "y" to clear edits and refresh')
469
474
  if answer.strip().lower().startswith('y'):
470
475
  self.reinit()
471
476
  return None
@@ -480,8 +485,12 @@ class EfiBootDude:
480
485
 
481
486
  def main():
482
487
  """ The program """
488
+ import argparse
489
+ parser = argparse.ArgumentParser()
490
+ parser.add_argument('testfile', nargs='?', default=None)
491
+ opts = parser.parse_args()
483
492
 
484
- dude = EfiBootDude()
493
+ dude = EfiBootDude(testfile=opts.testfile)
485
494
  dude.main_loop()
486
495
 
487
496
  if __name__ == '__main__':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: efibootdude
3
- Version: 0.0
3
+ Version: 0.1
4
4
  Summary: A visual wrapper for efibootmgr
5
5
  Author-email: Joe Defen <joedef@google.com>
6
6
  License: MIT
@@ -32,11 +32,14 @@ boot menu and parameters while running Linux.
32
32
  * setting boot entries active or inactive, and
33
33
  * setting the boot menu timeout value (until it boots the default entry).
34
34
 
35
- To be sure, there are many other esoteric uses of `efibootmanager`.
35
+ To be sure, there are many other esoteric uses of `efibootmanager` including adding
36
+ a new boot entry; for such needs, just use `efibootmgr` directly.
36
37
 
37
38
  ## Usage
38
39
  After running `efibootdude`, you'll see a screen like this:
40
+
39
41
  ![efibootdude-screenshot](https://github.com/joedefen/efibootdude/blob/main/images/efibootdude-screenshot.png?raw=true).
42
+
40
43
  At this point
41
44
  * The current line starts with `>` and is highlighted.
42
45
  * The top line shows actions for the current line.
@@ -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=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,,
@@ -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=xl6_bKWJVxzbN31SUWUAWWI5DH5F_iX5HpR-i23JjJ0,17609
4
- efibootdude-0.0.dist-info/LICENSE,sha256=qB9OdnyyF6WYHiEIXVm0rOSdcf8e2ctorrtWs6CC5lU,1062
5
- efibootdude-0.0.dist-info/METADATA,sha256=hNAKcQp31odNUlDLHVZ41ngqLq19Y0WuttYgXw08ZtY,2995
6
- efibootdude-0.0.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
7
- efibootdude-0.0.dist-info/entry_points.txt,sha256=3KZ_86ZSy4f-weuSruTlMGaQ96jZUm7mjyITVnjE184,54
8
- efibootdude-0.0.dist-info/top_level.txt,sha256=BrMsK3JmOrVJUNkHX1dicqWrdjbm4itRtmXJMxte-VU,12
9
- efibootdude-0.0.dist-info/RECORD,,