cleaned up boot entries in relchk, added todo for bootsync

brent s. 2021-01-20 23:55:11 -05:00
parent 06b32e7154
commit 6c0f0fb195
Signed by: bts
GPG Key ID: 8C004C2F93481F6B
1 changed files with 47 additions and 0 deletions

TODO 100644
View File

@ -0,0 +1,47 @@
Incorporate prep.txt with config file?
should look something like this:

#!/usr/bin/env python

import os
import re
import shutil
import subprocess

esp = {'/dev/vdb': ('Arch (Fallback)', '/mnt/boot2'),
'/dev/vda': ('Arch', '/mnt/boot1')}
part = 1

for dev, (label, mnt) in esp.items():
grubdir = os.path.join(mnt, 'grub')
if os.path.isdir(grubdir):
efi =['efibootmgr'], stdout = subprocess.PIPE)
efi_lines = efi.stdout.decode('utf-8').strip().splitlines()
efi_entries = {}
for l in efi_lines:
i = l.split(None, 1)
k = i[1].strip()
v = re.sub(r'^Boot(?P<boot_id>[A-Fa-f0-9]+).*$', r'\g<boot_id>', i[0])
efi_entries[k] = v
boot_id = efi_entries.get(label)
if not boot_id:
print('Could not find {0}'.format(label))
cmd =['efibootmgr',
'-b', boot_id,
stdout = subprocess.PIPE)
cmd =['grub-install',
cmd =['efibootmgr',
'--disk', dev,
'--part', str(part),
'--loader', '/EFI/Arch/grubx64.efi',
'--label', label])