Skip to content
Snippets Groups Projects
Commit 97867af2 authored by Teo Mrnjavac's avatar Teo Mrnjavac
Browse files

Autopep8 pass on bootloader module.

parent 8f250311
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......@@ -45,7 +47,8 @@ def get_uuid():
print(partition["uuid"])
return partition["uuid"]
return ""
def create_conf(uuid, conf_path):
distribution = libcalamares.job.configuration["distribution"]
lines = [
......@@ -57,12 +60,13 @@ def create_conf(uuid, conf_path):
'initrd /initramfs-linux.img\n',
'options root=UUID=%s quiet rw\n' % uuid,
]
with open(conf_path, 'w') as f:
for l in lines:
f.write(l)
f.close()
def create_loader(loader_path):
distribution = libcalamares.job.configuration["distribution"]
timeout = libcalamares.job.configuration["timeout"]
......@@ -70,20 +74,24 @@ def create_loader(loader_path):
'timeout %s\n' % timeout,
'default %s\n' % distribution,
]
with open(loader_path, 'w') as f:
for l in lines:
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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment