lint grub

This commit is contained in:
Marc Beninca 2024-06-10 09:50:13 +02:00
parent a4f49d6ac0
commit c7db231dc2
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -1,17 +1,17 @@
import cmd
import ps
cmd.need('grub-mkimage')
cmd.need("grub-mkimage")
COMPRESSION = 'xz'
COMPRESSION = "xz"
ENV_BYTES = 1024
ENV_COMMENT = '#'
ENV_HEADER = f'''{ENV_COMMENT} GRUB Environment Block
'''
ENV_COMMENT = "#"
ENV_HEADER = f"""{ENV_COMMENT} GRUB Environment Block
"""
MODULES = {
'i386-pc': [
('biosdisk',),
('ntldr',),
"i386-pc": [
("biosdisk",),
("ntldr",),
]
}
@ -19,14 +19,14 @@ MODULES = {
def make_image(image_format: str, image_path: str, modules: list[str],
memdisk_path: str, pubkey_path: str = None) -> None:
args = [
('grub-mkimage',),
('--compress', COMPRESSION),
('--format', image_format),
('--output', image_path),
('--memdisk', memdisk_path),
("grub-mkimage",),
("--compress", COMPRESSION),
("--format", image_format),
("--output", image_path),
("--memdisk", memdisk_path),
]
if pubkey_path:
args.append(('--pubkey', pubkey_path))
args.append(("--pubkey", pubkey_path))
args.extend(modules)
if modules := MODULES.get(image_format, None):
args.extend(modules)