More PEP
This commit is contained in:
parent
beb911863b
commit
db7577b9f8
@ -27,5 +27,6 @@ def run():
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
returnCode = chroot_call(["update-initramfs", "-k", "all", "-u"])
|
returnCode = chroot_call(["update-initramfs", "-k", "all", "-u"])
|
||||||
|
|
||||||
if returnCode != 0:
|
if returnCode != 0:
|
||||||
return ("Failed to run update-initramfs on the target", "The exit code was {}".format(returnCode))
|
return "Failed to run update-initramfs on the target", "The exit code was {}".format(returnCode)
|
||||||
|
@ -27,9 +27,9 @@ import libcalamares
|
|||||||
|
|
||||||
def run():
|
def run():
|
||||||
""" Create locale """
|
""" Create locale """
|
||||||
|
|
||||||
us = '#en_US'
|
us = '#en_US'
|
||||||
locale = libcalamares.globalstorage.value("lcLocale")
|
locale = libcalamares.globalstorage.value("lcLocale")
|
||||||
|
|
||||||
if not locale:
|
if not locale:
|
||||||
locale = 'en_US.UTF-8 UTF-8'
|
locale = 'en_US.UTF-8 UTF-8'
|
||||||
|
|
||||||
@ -43,6 +43,7 @@ def run():
|
|||||||
# run locale-gen if detected
|
# run locale-gen if detected
|
||||||
if os.path.exists('/etc/locale.gen'):
|
if os.path.exists('/etc/locale.gen'):
|
||||||
text = []
|
text = []
|
||||||
|
|
||||||
with open("{!s}/etc/locale.gen".format(install_path), "r") as gen:
|
with open("{!s}/etc/locale.gen".format(install_path), "r") as gen:
|
||||||
text = gen.readlines()
|
text = gen.readlines()
|
||||||
|
|
||||||
@ -52,15 +53,18 @@ def run():
|
|||||||
if us in line and line[0] == "#":
|
if us in line and line[0] == "#":
|
||||||
# uncomment line
|
# uncomment line
|
||||||
line = line[1:]
|
line = line[1:]
|
||||||
|
|
||||||
if locale in line and line[0] == "#":
|
if locale in line and line[0] == "#":
|
||||||
# uncomment line
|
# uncomment line
|
||||||
line = line[1:]
|
line = line[1:]
|
||||||
|
|
||||||
gen.write(line)
|
gen.write(line)
|
||||||
|
|
||||||
libcalamares.utils.chroot_call(['locale-gen'])
|
libcalamares.utils.chroot_call(['locale-gen'])
|
||||||
print('locale.gen done')
|
print('locale.gen done')
|
||||||
|
|
||||||
locale_conf_path = os.path.join(install_path, "etc/locale.conf")
|
locale_conf_path = os.path.join(install_path, "etc/locale.conf")
|
||||||
|
|
||||||
with open(locale_conf_path, "w") as locale_conf:
|
with open(locale_conf_path, "w") as locale_conf:
|
||||||
locale_split = locale.split(' ')[0]
|
locale_split = locale.split(' ')[0]
|
||||||
locale_conf.write("LANG={!s}\n".format(locale_split))
|
locale_conf.write("LANG={!s}\n".format(locale_split))
|
||||||
|
@ -33,16 +33,22 @@ def run():
|
|||||||
enable_dbus = libcalamares.job.configuration["dbus"]
|
enable_dbus = libcalamares.job.configuration["dbus"]
|
||||||
enable_symlink = libcalamares.job.configuration["symlink"]
|
enable_symlink = libcalamares.job.configuration["symlink"]
|
||||||
target_systemd_machineid_file = "{}/etc/machine-id".format(root_mount_point)
|
target_systemd_machineid_file = "{}/etc/machine-id".format(root_mount_point)
|
||||||
|
|
||||||
if enable_systemd:
|
if enable_systemd:
|
||||||
if os.path.exists(target_systemd_machineid_file):
|
if os.path.exists(target_systemd_machineid_file):
|
||||||
os.remove(target_systemd_machineid_file)
|
os.remove(target_systemd_machineid_file)
|
||||||
|
|
||||||
check_chroot_call("systemd-machine-id-setup")
|
check_chroot_call("systemd-machine-id-setup")
|
||||||
|
|
||||||
if enable_dbus:
|
if enable_dbus:
|
||||||
target_dbus_machineid_file = "{}/var/lib/dbus/machine-id".format(root_mount_point)
|
target_dbus_machineid_file = "{}/var/lib/dbus/machine-id".format(root_mount_point)
|
||||||
|
|
||||||
if os.path.exists(target_dbus_machineid_file):
|
if os.path.exists(target_dbus_machineid_file):
|
||||||
os.remove(target_dbus_machineid_file)
|
os.remove(target_dbus_machineid_file)
|
||||||
|
|
||||||
if enable_symlink and os.path.exists(target_systemd_machineid_file):
|
if enable_symlink and os.path.exists(target_systemd_machineid_file):
|
||||||
check_chroot_call(["ln", "-s", "/etc/machine-id", "/var/lib/dbus/machine-id"])
|
check_chroot_call(["ln", "-s", "/etc/machine-id", "/var/lib/dbus/machine-id"])
|
||||||
else:
|
else:
|
||||||
check_chroot_call(["dbus-uuidgen", "--ensure"])
|
check_chroot_call(["dbus-uuidgen", "--ensure"])
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
@ -35,16 +35,15 @@ def mount_partitions(root_mount_point, partitions):
|
|||||||
# Create mount point with `+` rather than `os.path.join()` because
|
# Create mount point with `+` rather than `os.path.join()` because
|
||||||
# `partition["mountPoint"]` starts with a '/'.
|
# `partition["mountPoint"]` starts with a '/'.
|
||||||
mount_point = root_mount_point + partition["mountPoint"]
|
mount_point = root_mount_point + partition["mountPoint"]
|
||||||
|
|
||||||
fstype = partition.get("fs", "")
|
fstype = partition.get("fs", "")
|
||||||
|
|
||||||
if fstype == "fat16" or fstype == "fat32":
|
if fstype == "fat16" or fstype == "fat32":
|
||||||
fstype = "vfat"
|
fstype = "vfat"
|
||||||
|
|
||||||
libcalamares.utils.mount(
|
libcalamares.utils.mount(partition["device"],
|
||||||
partition["device"],
|
|
||||||
mount_point,
|
mount_point,
|
||||||
fstype,
|
fstype,
|
||||||
partition.get("options", "")
|
partition.get("options", ""),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -61,14 +60,14 @@ def run():
|
|||||||
# Sort by mount points to ensure / is mounted before the rest
|
# Sort by mount points to ensure / is mounted before the rest
|
||||||
partitions.sort(key=lambda x: x["mountPoint"])
|
partitions.sort(key=lambda x: x["mountPoint"])
|
||||||
mount_partitions(root_mount_point, partitions)
|
mount_partitions(root_mount_point, partitions)
|
||||||
|
|
||||||
mount_partitions(root_mount_point, extra_mounts)
|
mount_partitions(root_mount_point, extra_mounts)
|
||||||
|
|
||||||
fw_type = libcalamares.globalstorage.value("firmwareType")
|
fw_type = libcalamares.globalstorage.value("firmwareType")
|
||||||
|
|
||||||
if fw_type == 'efi':
|
if fw_type == 'efi':
|
||||||
mount_partitions(root_mount_point, extra_mounts_efi)
|
mount_partitions(root_mount_point, extra_mounts_efi)
|
||||||
|
|
||||||
libcalamares.globalstorage.insert("rootMountPoint", root_mount_point)
|
libcalamares.globalstorage.insert("rootMountPoint", root_mount_point)
|
||||||
|
|
||||||
# Remember the extra mounts for the unpackfs module
|
# Remember the extra mounts for the unpackfs module
|
||||||
if fw_type == 'efi':
|
if fw_type == 'efi':
|
||||||
libcalamares.globalstorage.insert("extraMounts", extra_mounts + extra_mounts_efi)
|
libcalamares.globalstorage.insert("extraMounts", extra_mounts + extra_mounts_efi)
|
||||||
|
@ -30,8 +30,7 @@ def run():
|
|||||||
|
|
||||||
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
|
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
|
||||||
source_nm = "/etc/NetworkManager/system-connections/"
|
source_nm = "/etc/NetworkManager/system-connections/"
|
||||||
target_nm = os.path.join(root_mount_point,
|
target_nm = os.path.join(root_mount_point, "etc/NetworkManager/system-connections/")
|
||||||
"etc/NetworkManager/system-connections/")
|
|
||||||
|
|
||||||
# Sanity checks. We don't want to do anything if a network
|
# Sanity checks. We don't want to do anything if a network
|
||||||
# configuration already exists on the target
|
# configuration already exists on the target
|
||||||
@ -50,8 +49,7 @@ def run():
|
|||||||
try:
|
try:
|
||||||
shutil.copy(source_network, target_network)
|
shutil.copy(source_network, target_network)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
libcalamares.utils.debug(
|
libcalamares.utils.debug("Can't copy network configuration files in {}".format(source_network))
|
||||||
"Can't copy network configuration files in {}".format(source_network))
|
|
||||||
except FileExistsError:
|
except FileExistsError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user