[initcpiocfg][plymouthcfg] Consistent find-plymouth code

- drop the debugging line because that has already been
  logged by the call to `runCommand()` that backs
  `target_env_call()`.
- use the same (top-level) function rather than having a
  function and elsewhere a very-similar method.
main
Adriaan de Groot 4 years ago
parent 039370d410
commit cf0119ed4a

@ -92,6 +92,7 @@ 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():
"""
Checks existence (runnability) of plymouth in the target system.
@ -99,10 +100,8 @@ def detect_plymouth():
@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 target_env_call(["sh", "-c", "which plymouth"]) == 0
return isPlymouth == 0
def modify_mkinitcpio_conf(partitions, root_mount_point):
"""

@ -27,6 +27,16 @@ def pretty_name():
return _("Configure Plymouth theme")
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 PlymouthController:
def __init__(self):
@ -42,14 +52,8 @@ class PlymouthController:
plymouth_theme + '|', "-i",
"/etc/plymouth/plymouthd.conf"])
def detect(self):
isPlymouth = target_env_call(["sh", "-c", "which plymouth"])
debug("which plymouth exit code: {!s}".format(isPlymouth))
return isPlymouth
def run(self):
if self.detect() == 0:
if detect_plymouth():
if (("plymouth_theme" in libcalamares.job.configuration) and
(libcalamares.job.configuration["plymouth_theme"] is not None)):
self.setTheme()

Loading…
Cancel
Save