From 118e18ac6060c5df285f808023b64d5ade4fa9bf Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 21 Sep 2021 13:03:13 +0200 Subject: [PATCH] [initcpiocfg] Code-shuffle - put the system-information and -detection functions at top and the "do the actual work" things below - don't mix the boolean do-we-use-this flags with the lists of files and modules which are the important parts of modify_mkinitcpio_conf --- src/modules/initcpiocfg/main.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/modules/initcpiocfg/main.py b/src/modules/initcpiocfg/main.py index fe0712a9a..b91a46086 100644 --- a/src/modules/initcpiocfg/main.py +++ b/src/modules/initcpiocfg/main.py @@ -28,6 +28,16 @@ def pretty_name(): return _("Configuring mkinitcpio.") +def detect_plymouth(): + """ + Checks existence (runnability) of plymouth in the target system. + + @return True if plymouth exists in the target, False otherwise + """ + # Used to only check existence of path /usr/bin/plymouth in target + return target_env_call(["sh", "-c", "which plymouth"]) == 0 + + class cpuinfo(object): """ Object describing the current CPU's characteristics. It may be @@ -115,16 +125,6 @@ def write_mkinitcpio_lines(hooks, modules, files, root_mount_point): mkinitcpio_file.write("\n".join(mklins) + "\n") -def detect_plymouth(): - """ - Checks existence (runnability) of plymouth in the target system. - - @return True if plymouth exists in the target, False otherwise - """ - # Used to only check existence of path /usr/bin/plymouth in target - return target_env_call(["sh", "-c", "which plymouth"]) == 0 - - def modify_mkinitcpio_conf(partitions, root_mount_point): """ Modifies mkinitcpio.conf @@ -132,13 +132,13 @@ def modify_mkinitcpio_conf(partitions, root_mount_point): :param partitions: :param root_mount_point: """ + hooks = ["base", "udev", "autodetect", "modconf", "block", "keyboard", "keymap"] + modules = [] + files = [] + swap_uuid = "" uses_btrfs = False uses_lvm2 = False - hooks = ["base", "udev", "autodetect", "modconf", "block", "keyboard", - "keymap"] - modules = [] - files = [] encrypt_hook = False openswap_hook = False unencrypted_separate_boot = False