calamares/src/modules/dracut/main.py

51 lines
1.3 KiB
Python
Raw Normal View History

2014-08-06 11:54:17 +02:00
#!/usr/bin/env python3
2015-02-18 15:06:10 +01:00
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <https://calamares.io> ===
2014-08-06 11:54:17 +02:00
#
# SPDX-FileCopyrightText: 2014-2015 Philip Müller <philm@manjaro.org>
# SPDX-FileCopyrightText: 2014 Teo Mrnjavac <teo@kde.org>
# SPDX-FileCopyrightText: 2017 Alf Gaida <agaid@siduction.org>
# SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
# SPDX-License-Identifier: GPL-3.0-or-later
2014-08-06 11:54:17 +02:00
#
# Calamares is Free Software: see the License-Identifier above.
2014-08-06 11:54:17 +02:00
#
import libcalamares
from libcalamares.utils import target_env_call
2014-08-06 11:54:17 +02:00
2015-02-18 15:37:03 +01:00
import gettext
_ = gettext.translation("calamares-python",
localedir=libcalamares.utils.gettext_path(),
languages=libcalamares.utils.gettext_languages(),
fallback=True).gettext
def pretty_name():
return _("Creating initramfs with dracut.")
2014-08-06 11:54:17 +02:00
def run_dracut():
"""
Creates initramfs, even when initramfs already exists.
2015-02-20 20:54:25 +01:00
:return:
"""
return target_env_call(['dracut', '-f'])
2014-08-06 11:54:17 +02:00
2015-02-18 15:37:03 +01:00
2014-08-06 11:54:17 +02:00
def run():
"""
Starts routine to create initramfs. It passes back the exit code
if it fails.
2015-02-20 20:54:25 +01:00
:return:
"""
2015-06-14 05:08:52 +02:00
return_code = run_dracut()
if return_code != 0:
return ( _("Failed to run dracut on the target"),
_("The exit code was {}").format(return_code) )