From a3da47cd9cff94945ef58ddc8300b86acc438919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20M=C3=BCller?= Date: Mon, 16 Dec 2019 09:34:21 +0100 Subject: [PATCH 1/2] [initcpiocfg] update plymouth check --- src/modules/initcpiocfg/main.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/modules/initcpiocfg/main.py b/src/modules/initcpiocfg/main.py index 166cccf44..462528cb4 100644 --- a/src/modules/initcpiocfg/main.py +++ b/src/modules/initcpiocfg/main.py @@ -4,7 +4,7 @@ # === This file is part of Calamares - === # # Copyright 2014, Rohan Garg -# Copyright 2015, Philip Müller +# Copyright 2015 - 2019, Philip Müller # Copyright 2017, Alf Gaida # Copyright 2019, Adriaan de Groot # @@ -22,6 +22,7 @@ # along with Calamares. If not, see . import libcalamares +from libcalamares.utils import debug, target_env_call import os from collections import OrderedDict @@ -100,6 +101,11 @@ def write_mkinitcpio_lines(hooks, modules, files, root_mount_point): with open(path, "w") as mkinitcpio_file: mkinitcpio_file.write("\n".join(mklins) + "\n") +def detect_plymouth(): + isPlymouth = target_env_call(["sh", "-c", "which plymouth"]) + debug("which plymouth exit code: {!s}".format(isPlymouth)) + + return isPlymouth def modify_mkinitcpio_conf(partitions, root_mount_point): """ @@ -121,8 +127,7 @@ def modify_mkinitcpio_conf(partitions, root_mount_point): unencrypted_separate_boot = False # It is important that the plymouth hook comes before any encrypt hook - plymouth_bin = os.path.join(root_mount_point, "usr/bin/plymouth") - if os.path.exists(plymouth_bin): + if detect_plymouth() == 0: hooks.append("plymouth") for partition in partitions: From fe64903d2f532441fe5f14e22dcf1a5a282fd51f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 6 Jan 2020 14:34:47 +0100 Subject: [PATCH 2/2] [initcpiocfg] Polish PR #1290 - List discrete years in copyright - Add docstrings - Massage detect_plymouth() to return bool (easier in if() context) --- src/modules/initcpiocfg/main.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/modules/initcpiocfg/main.py b/src/modules/initcpiocfg/main.py index 462528cb4..63ac9f15e 100644 --- a/src/modules/initcpiocfg/main.py +++ b/src/modules/initcpiocfg/main.py @@ -4,7 +4,7 @@ # === This file is part of Calamares - === # # Copyright 2014, Rohan Garg -# Copyright 2015 - 2019, Philip Müller +# Copyright 2015,2019, Philip Müller # Copyright 2017, Alf Gaida # Copyright 2019, Adriaan de Groot # @@ -102,10 +102,16 @@ 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 isPlymouth = target_env_call(["sh", "-c", "which plymouth"]) debug("which plymouth exit code: {!s}".format(isPlymouth)) - return isPlymouth + return isPlymouth == 0 def modify_mkinitcpio_conf(partitions, root_mount_point): """ @@ -127,7 +133,7 @@ def modify_mkinitcpio_conf(partitions, root_mount_point): unencrypted_separate_boot = False # It is important that the plymouth hook comes before any encrypt hook - if detect_plymouth() == 0: + if detect_plymouth(): hooks.append("plymouth") for partition in partitions: