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

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

sync with github

File size: 1.4 KB
RevLine 
[7538]1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3#
4# === This file is part of Calamares - <https://github.com/calamares> ===
5#
6#   Copyright 2014-2015, Philip Müller <philm@manjaro.org>
7#   Copyright 2014, Teo Mrnjavac <teo@kde.org>
8#   Copyright 2017, Alf Gaida <agaid@siduction.org>
9#
10#   Calamares is free software: you can redistribute it and/or modify
11#   it under the terms of the GNU General Public License as published by
12#   the Free Software Foundation, either version 3 of the License, or
13#   (at your option) any later version.
14#
15#   Calamares is distributed in the hope that it will be useful,
16#   but WITHOUT ANY WARRANTY; without even the implied warranty of
17#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18#   GNU General Public License for more details.
19#
20#   You should have received a copy of the GNU General Public License
21#   along with Calamares. If not, see <http://www.gnu.org/licenses/>.
22
23import libcalamares
24from libcalamares.utils import target_env_call
25
26
27def run_dracut():
28    """
29    Creates initramfs, even when initramfs already exists.
30
31    :return:
32    """
33    return target_env_call(['dracut', '-f'])
34
35
36def run():
37    """
38    Starts routine to create initramfs. It passes back the exit code
39    if it fails.
40
41    :return:
42    """
43    return_code = run_dracut()
44
45    if return_code != 0:
46        return ("Failed to run dracut on the target",
47                "The exit code was {}".format(return_code))
Note: See TracBrowser for help on using the repository browser.