mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-27 17:35:37 -04:00
Autopep8 pass on bootloader module.
This commit is contained in:
parent
8f250311e8
commit
97867af2aa
1 changed files with 18 additions and 9 deletions
|
@ -28,6 +28,7 @@ import subprocess
|
||||||
|
|
||||||
from libcalamares.utils import check_chroot_call
|
from libcalamares.utils import check_chroot_call
|
||||||
|
|
||||||
|
|
||||||
def detect_firmware_type():
|
def detect_firmware_type():
|
||||||
# Check for EFI variables support
|
# Check for EFI variables support
|
||||||
if(os.path.exists("/sys/firmware/efi/efivars")):
|
if(os.path.exists("/sys/firmware/efi/efivars")):
|
||||||
|
@ -35,6 +36,7 @@ def detect_firmware_type():
|
||||||
else:
|
else:
|
||||||
fw_type = 'bios'
|
fw_type = 'bios'
|
||||||
|
|
||||||
|
|
||||||
def get_uuid():
|
def get_uuid():
|
||||||
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
|
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
|
||||||
print(root_mount_point)
|
print(root_mount_point)
|
||||||
|
@ -46,6 +48,7 @@ def get_uuid():
|
||||||
return partition["uuid"]
|
return partition["uuid"]
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
def create_conf(uuid, conf_path):
|
def create_conf(uuid, conf_path):
|
||||||
distribution = libcalamares.job.configuration["distribution"]
|
distribution = libcalamares.job.configuration["distribution"]
|
||||||
lines = [
|
lines = [
|
||||||
|
@ -63,6 +66,7 @@ def create_conf(uuid, conf_path):
|
||||||
f.write(l)
|
f.write(l)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
def create_loader(loader_path):
|
def create_loader(loader_path):
|
||||||
distribution = libcalamares.job.configuration["distribution"]
|
distribution = libcalamares.job.configuration["distribution"]
|
||||||
timeout = libcalamares.job.configuration["timeout"]
|
timeout = libcalamares.job.configuration["timeout"]
|
||||||
|
@ -76,14 +80,18 @@ def create_loader(loader_path):
|
||||||
f.write(l)
|
f.write(l)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
def install_bootloader(boot_loader, fw_type):
|
def install_bootloader(boot_loader, fw_type):
|
||||||
if fw_type == 'efi':
|
if fw_type == 'efi':
|
||||||
install_path = libcalamares.globalstorage.value( "rootMountPoint" )
|
install_path = libcalamares.globalstorage.value("rootMountPoint")
|
||||||
uuid = get_uuid()
|
uuid = get_uuid()
|
||||||
distribution = libcalamares.job.configuration["distribution"]
|
distribution = libcalamares.job.configuration["distribution"]
|
||||||
conf_path = os.path.join(install_path, "boot", "loader", "entries", "%s.conf" % distribution)
|
conf_path = os.path.join(
|
||||||
loader_path = os.path.join(install_path, "boot", "loader", "loader.conf")
|
install_path, "boot", "loader", "entries", "%s.conf" % distribution)
|
||||||
subprocess.call(["gummiboot", "--path=%s/boot" % install_path, "install"])
|
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_conf(uuid, conf_path)
|
||||||
create_loader(loader_path)
|
create_loader(loader_path)
|
||||||
else:
|
else:
|
||||||
|
@ -91,6 +99,7 @@ def install_bootloader(boot_loader, fw_type):
|
||||||
check_chroot_call(["grub-install", install_path])
|
check_chroot_call(["grub-install", install_path])
|
||||||
check_chroot_call(["grub-mkconfig", "-o", "/boot/grub/grub.cfg"])
|
check_chroot_call(["grub-mkconfig", "-o", "/boot/grub/grub.cfg"])
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
detect_firmware_type()
|
detect_firmware_type()
|
||||||
boot_loader = libcalamares.globalstorage.value("bootLoader")
|
boot_loader = libcalamares.globalstorage.value("bootLoader")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue