Skip to content

Commit

Permalink
tentative fix for issue #130
Browse files Browse the repository at this point in the history
  • Loading branch information
parmigggiana committed Nov 15, 2024
1 parent 24f2e0b commit c8f7a7a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions basilico.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,11 +599,11 @@ def _get_last_linux_partition_path_and_number(dev: str) -> tuple[str, str] | tup
# PARTTYPENAME could be useful, too
output = subprocess.getoutput(f"lsblk -o PATH,PARTN,PARTTYPE -J {dev}")
jsonized = json.loads(output)
for entry in reversed(jsonized["blockdevices"]):
for i, entry in reversed(enumerate(jsonized["blockdevices"])):
if entry["path"]: # lsblk also returns the device itself, which has no partitions
# GPT or MBR Linux partition ID
if entry["parttype"] == "0fc63daf-8483-4772-8e79-3d69d8477de4" or entry["parttype"] == "0x83":
return entry["path"], int(entry["path"][-1]) # Breaks if more than 9 partitions
return entry["path"], (entry["partn"] if "partn" in entry else i)
return None, None

def cannolo(self, _cmd: str, dev_and_iso: str):
Expand Down

0 comments on commit c8f7a7a

Please sign in to comment.