From c8f7a7adf81d2296745c260fb1e3cc1fe3ab18b5 Mon Sep 17 00:00:00 2001 From: Francesco Basile <59255877+parmigggiana@users.noreply.github.com> Date: Fri, 15 Nov 2024 15:35:11 +0100 Subject: [PATCH] tentative fix for issue #130 --- basilico.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/basilico.py b/basilico.py index d9748bf..fdfd41d 100755 --- a/basilico.py +++ b/basilico.py @@ -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):