|
|
|
@ -28,6 +28,7 @@ import subprocess
|
|
|
|
|
|
|
|
|
|
from libcalamares.utils import check_chroot_call
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def detect_firmware_type():
|
|
|
|
|
# Check for EFI variables support
|
|
|
|
|
if(os.path.exists("/sys/firmware/efi/efivars")):
|
|
|
|
@ -35,6 +36,7 @@ def detect_firmware_type():
|
|
|
|
|
else:
|
|
|
|
|
fw_type = 'bios'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_uuid():
|
|
|
|
|
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
|
|
|
|
|
print(root_mount_point)
|
|
|
|
@ -46,6 +48,7 @@ def get_uuid():
|
|
|
|
|
return partition["uuid"]
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_conf(uuid, conf_path):
|
|
|
|
|
distribution = libcalamares.job.configuration["distribution"]
|
|
|
|
|
lines = [
|
|
|
|
@ -63,6 +66,7 @@ def create_conf(uuid, conf_path):
|
|
|
|
|
f.write(l)
|
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_loader(loader_path):
|
|
|
|
|
distribution = libcalamares.job.configuration["distribution"]
|
|
|
|
|
timeout = libcalamares.job.configuration["timeout"]
|
|
|
|
@ -76,14 +80,18 @@ def create_loader(loader_path):
|
|
|
|
|
f.write(l)
|
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def install_bootloader(boot_loader, fw_type):
|
|
|
|
|
if fw_type == 'efi':
|
|
|
|
|
install_path = libcalamares.globalstorage.value( "rootMountPoint" )
|
|
|
|
|
install_path = libcalamares.globalstorage.value("rootMountPoint")
|
|
|
|
|
uuid = get_uuid()
|
|
|
|
|
distribution = libcalamares.job.configuration["distribution"]
|
|
|
|
|
conf_path = os.path.join(install_path, "boot", "loader", "entries", "%s.conf" % distribution)
|
|
|
|
|
loader_path = os.path.join(install_path, "boot", "loader", "loader.conf")
|
|
|
|
|
subprocess.call(["gummiboot", "--path=%s/boot" % install_path, "install"])
|
|
|
|
|
conf_path = os.path.join(
|
|
|
|
|
install_path, "boot", "loader", "entries", "%s.conf" % distribution)
|
|
|
|
|
loader_path = os.path.join(
|
|
|
|
|
install_path, "boot", "loader", "loader.conf")
|
|
|
|
|
subprocess.call(
|
|
|
|
|
["gummiboot", "--path=%s/boot" % install_path, "install"])
|
|
|
|
|
create_conf(uuid, conf_path)
|
|
|
|
|
create_loader(loader_path)
|
|
|
|
|
else:
|
|
|
|
@ -91,6 +99,7 @@ def install_bootloader(boot_loader, fw_type):
|
|
|
|
|
check_chroot_call(["grub-install", install_path])
|
|
|
|
|
check_chroot_call(["grub-mkconfig", "-o", "/boot/grub/grub.cfg"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run():
|
|
|
|
|
detect_firmware_type()
|
|
|
|
|
boot_loader = libcalamares.globalstorage.value("bootLoader")
|
|
|
|
|