source: calamares/trunk/fuentes/src/modules/plymouthcfg/main.py @ 7538

Last change on this file since 7538 was 7538, checked in by kbut, 13 months ago

sync with github

File size: 1.9 KB
Line 
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3#
4# === This file is part of Calamares - <https://github.com/calamares> ===
5#
6#   Copyright 2016, Artoo <artoo@manjaro.org>
7#   Copyright 2017, Alf Gaida <agaida@siduction.org>
8#
9#   Calamares is free software: you can redistribute it and/or modify
10#   it under the terms of the GNU General Public License as published by
11#   the Free Software Foundation, either version 3 of the License, or
12#   (at your option) any later version.
13#
14#   Calamares is distributed in the hope that it will be useful,
15#   but WITHOUT ANY WARRANTY; without even the implied warranty of
16#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17#   GNU General Public License for more details.
18#
19#   You should have received a copy of the GNU General Public License
20#   along with Calamares. If not, see <http://www.gnu.org/licenses/>.
21
22import libcalamares
23
24from libcalamares.utils import debug, target_env_call
25
26
27class PlymouthController:
28
29    def __init__(self):
30        self.__root = libcalamares.globalstorage.value('rootMountPoint')
31
32    @property
33    def root(self):
34        return self.__root
35
36    def setTheme(self):
37        plymouth_theme = libcalamares.job.configuration["plymouth_theme"]
38        target_env_call(["sed", "-e", 's|^.*Theme=.*|Theme=' +
39                         plymouth_theme + '|', "-i",
40                         "/etc/plymouth/plymouthd.conf"])
41
42    def detect(self):
43        isPlymouth = target_env_call(["sh", "-c", "which plymouth"])
44        debug("which plymouth exit code: {!s}".format(isPlymouth))
45
46        return isPlymouth
47
48    def run(self):
49        if self.detect() == 0:
50            if (("plymouth_theme" in libcalamares.job.configuration) and
51               (libcalamares.job.configuration["plymouth_theme"] is not None)):
52                self.setTheme()
53        return None
54
55
56def run():
57    pc = PlymouthController()
58    return pc.run()
Note: See TracBrowser for help on using the repository browser.