else:
cmdline = []
- cmdline += context.config.kernel_command_line
+ if roothash:
+ cmdline += [roothash]
- for name in ("root", "mount.usr"):
- type_prefix = name.removeprefix("mount.")
- if not (root := next((p.uuid for p in partitions if p.type.startswith(type_prefix)), None)):
- continue
+ cmdline += context.config.kernel_command_line
- cmdline = [f"{name}=PARTUUID={root}" if c == f"{name}=PARTUUID" else c for c in cmdline]
+ if not roothash:
+ for name in ("root", "mount.usr"):
+ type_prefix = name.removeprefix("mount.")
+ if not (root := next((p.uuid for p in partitions if p.type.startswith(type_prefix)), None)):
+ continue
- if roothash and (
- (roothash.startswith("roothash=") and not any(c.startswith("root=") for c in cmdline))
- or (roothash.startswith("usrhash=") and not any(c.startswith("mount.usr") for c in cmdline))
- ):
- cmdline += [roothash]
+ cmdline = [f"{name}=PARTUUID={root}" if c == f"{name}=PARTUUID" else c for c in cmdline]
return cmdline