[PEP 8] General Style Part 1
This commit is contained in:
parent
5d5519b7b0
commit
d8df3d7a59
@ -22,9 +22,11 @@
|
|||||||
import libcalamares
|
import libcalamares
|
||||||
from libcalamares.utils import chroot_call
|
from libcalamares.utils import chroot_call
|
||||||
|
|
||||||
|
|
||||||
def run_dracut():
|
def run_dracut():
|
||||||
return chroot_call(['dracut', '-f'])
|
return chroot_call(['dracut', '-f'])
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
returnCode = run_dracut()
|
returnCode = run_dracut()
|
||||||
if returnCode != 0:
|
if returnCode != 0:
|
||||||
|
@ -61,7 +61,7 @@ def disk_name_for_partition(partition):
|
|||||||
|
|
||||||
class FstabGenerator(object):
|
class FstabGenerator(object):
|
||||||
def __init__(self, partitions, root_mount_point, mount_options,
|
def __init__(self, partitions, root_mount_point, mount_options,
|
||||||
ssd_extra_mount_options):
|
ssd_extra_mount_options):
|
||||||
self.partitions = partitions
|
self.partitions = partitions
|
||||||
self.root_mount_point = root_mount_point
|
self.root_mount_point = root_mount_point
|
||||||
self.mount_options = mount_options
|
self.mount_options = mount_options
|
||||||
@ -98,7 +98,7 @@ class FstabGenerator(object):
|
|||||||
fs="tmpfs",
|
fs="tmpfs",
|
||||||
options="defaults,noatime,mode=1777",
|
options="defaults,noatime,mode=1777",
|
||||||
check=0,
|
check=0,
|
||||||
)
|
)
|
||||||
self.print_fstab_line(dct, file=fl)
|
self.print_fstab_line(dct, file=fl)
|
||||||
|
|
||||||
def generate_fstab_line_info(self, partition):
|
def generate_fstab_line_info(self, partition):
|
||||||
@ -149,6 +149,7 @@ class FstabGenerator(object):
|
|||||||
if partition["mountPoint"]:
|
if partition["mountPoint"]:
|
||||||
mkdir_p(self.root_mount_point + partition["mountPoint"])
|
mkdir_p(self.root_mount_point + partition["mountPoint"])
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
gs = libcalamares.globalstorage
|
gs = libcalamares.globalstorage
|
||||||
conf = libcalamares.job.configuration
|
conf = libcalamares.job.configuration
|
||||||
@ -159,5 +160,5 @@ def run():
|
|||||||
ssd_extra_mount_options = conf.get("ssdExtraMountOptions", {})
|
ssd_extra_mount_options = conf.get("ssdExtraMountOptions", {})
|
||||||
|
|
||||||
generator = FstabGenerator(partitions, root_mount_point,
|
generator = FstabGenerator(partitions, root_mount_point,
|
||||||
mount_options, ssd_extra_mount_options)
|
mount_options, ssd_extra_mount_options)
|
||||||
return generator.run()
|
return generator.run()
|
||||||
|
@ -37,15 +37,23 @@ def install_grub(boot_loader, fw_type):
|
|||||||
distribution = branding["bootloaderEntryName"]
|
distribution = branding["bootloaderEntryName"]
|
||||||
file_name_sanitizer = str.maketrans(" /", "_-")
|
file_name_sanitizer = str.maketrans(" /", "_-")
|
||||||
efi_bootloader_id = distribution.translate(file_name_sanitizer)
|
efi_bootloader_id = distribution.translate(file_name_sanitizer)
|
||||||
check_chroot_call([libcalamares.job.configuration["grubInstall"], "--target=x86_64-efi", "--efi-directory={!s}".format(efi_directory), "--bootloader-id={!s}".format(efi_bootloader_id)])
|
check_chroot_call(
|
||||||
|
[libcalamares.job.configuration["grubInstall"], "--target=x86_64-efi",
|
||||||
|
"--efi-directory={!s}".format(efi_directory),
|
||||||
|
"--bootloader-id={!s}".format(efi_bootloader_id)])
|
||||||
# Workaround for some UEFI firmwares
|
# Workaround for some UEFI firmwares
|
||||||
check_chroot_call(["mkdir", "-p", "{!s}/boot".format(efi_directory_firmware)])
|
check_chroot_call(["mkdir", "-p", "{!s}/boot".format(efi_directory_firmware)])
|
||||||
check_chroot_call(["cp", "{!s}/{!s}/grubx64.efi".format(efi_directory_firmware,efi_bootloader_id), "{!s}/boot/bootx64.efi".format(efi_directory_firmware)])
|
check_chroot_call(["cp", "{!s}/{!s}/grubx64.efi".format(efi_directory_firmware,
|
||||||
|
efi_bootloader_id),
|
||||||
|
"{!s}/boot/bootx64.efi".format(efi_directory_firmware)])
|
||||||
else:
|
else:
|
||||||
install_path = boot_loader["installPath"]
|
install_path = boot_loader["installPath"]
|
||||||
check_chroot_call([libcalamares.job.configuration["grubInstall"], "--target=i386-pc", install_path])
|
check_chroot_call(
|
||||||
|
[libcalamares.job.configuration["grubInstall"], "--target=i386-pc",
|
||||||
|
install_path])
|
||||||
|
|
||||||
check_chroot_call([libcalamares.job.configuration["grubMkconfig"], "-o", libcalamares.job.configuration["grubCfg"]])
|
check_chroot_call([libcalamares.job.configuration["grubMkconfig"], "-o",
|
||||||
|
libcalamares.job.configuration["grubCfg"]])
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
@ -3,27 +3,26 @@
|
|||||||
#
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014 - 2015, Philip Müller <philm@manjaro.org>
|
# Copyright 2014 - 2015, Philip Müller <philm@manjaro.org>
|
||||||
#
|
#
|
||||||
# Calamares is free software: you can redistribute it and/or modify
|
# Calamares is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# Calamares is distributed in the hope that it will be useful,
|
# Calamares is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import libcalamares
|
import libcalamares
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
def modify_grub_default(partitions, root_mount_point, distributor):
|
def modify_grub_default(partitions, root_mount_point, distributor):
|
||||||
|
|
||||||
default_dir = os.path.join(root_mount_point, "etc/default")
|
default_dir = os.path.join(root_mount_point, "etc/default")
|
||||||
default_grub = os.path.join(default_dir, "grub")
|
default_grub = os.path.join(default_dir, "grub")
|
||||||
distributor_replace = distributor.replace("'", "'\\''")
|
distributor_replace = distributor.replace("'", "'\\''")
|
||||||
@ -39,7 +38,7 @@ def modify_grub_default(partitions, root_mount_point, distributor):
|
|||||||
swap_uuid = partition["uuid"]
|
swap_uuid = partition["uuid"]
|
||||||
|
|
||||||
if swap_uuid != "":
|
if swap_uuid != "":
|
||||||
kernel_cmd = "GRUB_CMDLINE_LINUX_DEFAULT=\"resume=UUID={!s} quiet {!s}\"".format(swap_uuid,use_splash)
|
kernel_cmd = "GRUB_CMDLINE_LINUX_DEFAULT=\"resume=UUID={!s} quiet {!s}\"".format(swap_uuid, use_splash)
|
||||||
else:
|
else:
|
||||||
kernel_cmd = "GRUB_CMDLINE_LINUX_DEFAULT=\"quiet {!s}\"".format(use_splash)
|
kernel_cmd = "GRUB_CMDLINE_LINUX_DEFAULT=\"quiet {!s}\"".format(use_splash)
|
||||||
|
|
||||||
@ -81,7 +80,7 @@ def modify_grub_default(partitions, root_mount_point, distributor):
|
|||||||
escaped_value = "false"
|
escaped_value = "false"
|
||||||
else:
|
else:
|
||||||
escaped_value = str(value).replace("'", "'\\''")
|
escaped_value = str(value).replace("'", "'\\''")
|
||||||
lines.append("{!s}=\"{!s}\"".format(key,escaped_value))
|
lines.append("{!s}=\"{!s}\"".format(key, escaped_value))
|
||||||
|
|
||||||
if not have_kernel_cmd:
|
if not have_kernel_cmd:
|
||||||
lines.append(kernel_cmd)
|
lines.append(kernel_cmd)
|
||||||
@ -94,6 +93,7 @@ def modify_grub_default(partitions, root_mount_point, distributor):
|
|||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
partitions = libcalamares.globalstorage.value("partitions")
|
partitions = libcalamares.globalstorage.value("partitions")
|
||||||
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
|
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
|
||||||
|
@ -42,7 +42,7 @@ def mount_partitions(root_mount_point, partitions):
|
|||||||
mount_point,
|
mount_point,
|
||||||
fstype,
|
fstype,
|
||||||
partition.get("options", "")
|
partition.get("options", "")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
Loading…
Reference in New Issue
Block a user