Remove unsupported --force from bootctl and perform manual cleanup of ESP
This commit is contained in:
@@ -283,9 +283,18 @@ def configure_system(mount_root, partition_info, user_info=None, disk_device=Non
|
|||||||
with open(os.path.join(mount_root, "etc/kernel/layout"), "w") as f:
|
with open(os.path.join(mount_root, "etc/kernel/layout"), "w") as f:
|
||||||
f.write("bls\n")
|
f.write("bls\n")
|
||||||
|
|
||||||
|
# Cleanup existing systemd-boot files to ensure a fresh install since --force is not supported
|
||||||
|
for d in ["loader", "EFI/systemd", "EFI/BOOT"]:
|
||||||
|
path = os.path.join(mount_root, "boot", d)
|
||||||
|
if os.path.exists(path):
|
||||||
|
import shutil
|
||||||
|
if os.path.isdir(path):
|
||||||
|
shutil.rmtree(path)
|
||||||
|
else:
|
||||||
|
os.remove(path)
|
||||||
|
|
||||||
# Initialize systemd-boot
|
# Initialize systemd-boot
|
||||||
# We use --force to overwrite any existing entries and ensure it's the primary bootloader
|
run_command(["chroot", mount_root, "bootctl", "install", "--path=/boot"])
|
||||||
run_command(["chroot", mount_root, "bootctl", "install", "--path=/boot", "--force"])
|
|
||||||
|
|
||||||
# Sync kernels and generate BLS entries
|
# Sync kernels and generate BLS entries
|
||||||
# Since we rsync'd, kernels are in /lib/modules and /boot
|
# Since we rsync'd, kernels are in /lib/modules and /boot
|
||||||
|
|||||||
Reference in New Issue
Block a user