diff --git a/src/modules/initramfs/main.py b/src/modules/initramfs/main.py index 73faa1f9b..6b9fd1348 100644 --- a/src/modules/initramfs/main.py +++ b/src/modules/initramfs/main.py @@ -27,5 +27,6 @@ def run(): :return: """ returnCode = chroot_call(["update-initramfs", "-k", "all", "-u"]) + 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) diff --git a/src/modules/localecfg/main.py b/src/modules/localecfg/main.py index ae477fec0..8f6330fe3 100644 --- a/src/modules/localecfg/main.py +++ b/src/modules/localecfg/main.py @@ -27,9 +27,9 @@ import libcalamares def run(): """ Create locale """ - us = '#en_US' locale = libcalamares.globalstorage.value("lcLocale") + if not locale: locale = 'en_US.UTF-8 UTF-8' @@ -43,6 +43,7 @@ def run(): # run locale-gen if detected if os.path.exists('/etc/locale.gen'): text = [] + with open("{!s}/etc/locale.gen".format(install_path), "r") as gen: text = gen.readlines() @@ -52,15 +53,18 @@ def run(): if us in line and line[0] == "#": # uncomment line line = line[1:] + if locale in line and line[0] == "#": # uncomment line line = line[1:] + gen.write(line) libcalamares.utils.chroot_call(['locale-gen']) print('locale.gen done') locale_conf_path = os.path.join(install_path, "etc/locale.conf") + with open(locale_conf_path, "w") as locale_conf: locale_split = locale.split(' ')[0] locale_conf.write("LANG={!s}\n".format(locale_split)) diff --git a/src/modules/machineid/main.py b/src/modules/machineid/main.py index 5bd807428..ddf134f5a 100644 --- a/src/modules/machineid/main.py +++ b/src/modules/machineid/main.py @@ -33,16 +33,22 @@ def run(): enable_dbus = libcalamares.job.configuration["dbus"] enable_symlink = libcalamares.job.configuration["symlink"] target_systemd_machineid_file = "{}/etc/machine-id".format(root_mount_point) + if enable_systemd: if os.path.exists(target_systemd_machineid_file): os.remove(target_systemd_machineid_file) + check_chroot_call("systemd-machine-id-setup") + if enable_dbus: target_dbus_machineid_file = "{}/var/lib/dbus/machine-id".format(root_mount_point) + if os.path.exists(target_dbus_machineid_file): os.remove(target_dbus_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"]) else: check_chroot_call(["dbus-uuidgen", "--ensure"]) + return None diff --git a/src/modules/mount/main.py b/src/modules/mount/main.py index 5d17b8ba0..f5b0e09e9 100644 --- a/src/modules/mount/main.py +++ b/src/modules/mount/main.py @@ -35,17 +35,16 @@ def mount_partitions(root_mount_point, partitions): # Create mount point with `+` rather than `os.path.join()` because # `partition["mountPoint"]` starts with a '/'. mount_point = root_mount_point + partition["mountPoint"] - fstype = partition.get("fs", "") + if fstype == "fat16" or fstype == "fat32": fstype = "vfat" - libcalamares.utils.mount( - partition["device"], - mount_point, - fstype, - partition.get("options", "") - ) + libcalamares.utils.mount(partition["device"], + mount_point, + fstype, + partition.get("options", ""), + ) def run(): @@ -61,14 +60,14 @@ def run(): # Sort by mount points to ensure / is mounted before the rest partitions.sort(key=lambda x: x["mountPoint"]) mount_partitions(root_mount_point, partitions) - mount_partitions(root_mount_point, extra_mounts) - fw_type = libcalamares.globalstorage.value("firmwareType") + if fw_type == 'efi': mount_partitions(root_mount_point, extra_mounts_efi) libcalamares.globalstorage.insert("rootMountPoint", root_mount_point) + # Remember the extra mounts for the unpackfs module if fw_type == 'efi': libcalamares.globalstorage.insert("extraMounts", extra_mounts + extra_mounts_efi) diff --git a/src/modules/networkcfg/main.py b/src/modules/networkcfg/main.py index 4a558b946..b9c347d45 100644 --- a/src/modules/networkcfg/main.py +++ b/src/modules/networkcfg/main.py @@ -30,8 +30,7 @@ def run(): root_mount_point = libcalamares.globalstorage.value("rootMountPoint") source_nm = "/etc/NetworkManager/system-connections/" - target_nm = os.path.join(root_mount_point, - "etc/NetworkManager/system-connections/") + target_nm = os.path.join(root_mount_point, "etc/NetworkManager/system-connections/") # Sanity checks. We don't want to do anything if a network # configuration already exists on the target @@ -50,8 +49,7 @@ def run(): try: shutil.copy(source_network, target_network) except FileNotFoundError: - libcalamares.utils.debug( - "Can't copy network configuration files in {}".format(source_network)) + libcalamares.utils.debug("Can't copy network configuration files in {}".format(source_network)) except FileExistsError: pass