pmb.flasher: fix "flasher boot" crash if cmdline is empty

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2575
This commit is contained in:
Anri Dellal 2025-03-20 00:53:26 +03:00 committed by Oliver Smith
parent 0ab75cfe2b
commit 15d9516c8d
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -103,6 +103,13 @@ def run(
check_partition_blacklist(deviceinfo, key, value)
command[i] = command[i].replace(key, value)
# Remove cmdline if it's empty
if "--cmdline" in command:
i = command.index("--cmdline")
if i + 1 < len(command) and not command[i + 1]:
command.pop(i) # "--cmdline"
command.pop(i) # ""
# Remove empty strings
command = [x for x in command if x != ""]
# Run the action