Skip to content

Commit

Permalink
Merge pull request calamares#2046 from calamares/dracut_conf
Browse files Browse the repository at this point in the history
[dracut] add option to make the kernel name configurable
  • Loading branch information
adriaandegroot committed Sep 8, 2022
2 parents f9f4c6f + 9191748 commit 6235e04
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
4 changes: 3 additions & 1 deletion CHANGES-3.3
Expand Up @@ -12,12 +12,14 @@ the history of the 3.2 series (2018-05 - 2022-08).

This release contains contributions from (alphabetically by first name):
- Adriaan de Groot
- Anke Boersma

## Core ##
- No core changes yet

## Modules ##
- No module changes yet
- **Dracut** add option to set a configurable kernel name
- **Localeq** & **Keyboard** moved to using Drawer instead of ComboBox


# 3.3.0-alpha2 (2022-08-23)
Expand Down
10 changes: 10 additions & 0 deletions src/modules/dracut/dracut.conf
@@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: no
# SPDX-License-Identifier: CC0-1.0
#
# Run dracut(8) with an optional kernel name
---
# Dracut defaults to setting initramfs-<kernel-version>.img
# If you want to specify another filename for the resulting image,
# set a custom kernel name, including the path
#
# kernelName: /boot/initramfs-linux.img
9 changes: 9 additions & 0 deletions src/modules/dracut/dracut.schema.yaml
@@ -0,0 +1,9 @@
# SPDX-FileCopyrightText: 2022 Anke Boersma <demm@kaosx.us>
# SPDX-License-Identifier: GPL-3.0-or-later
---
$schema: https://json-schema.org/schema#
$id: https://calamares.io/schemas/dracut
additionalProperties: false
type: object
properties:
kernelName: { type: string }
14 changes: 10 additions & 4 deletions src/modules/dracut/main.py
Expand Up @@ -7,13 +7,14 @@
# 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-FileCopyrightText: 2022 Anke Boersma <demm@kaosx.us>
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Calamares is Free Software: see the License-Identifier above.
#

import libcalamares
from libcalamares.utils import target_env_call
from libcalamares.utils import check_target_env_call


import gettext
Expand All @@ -33,7 +34,12 @@ def run_dracut():
:return:
"""
return target_env_call(['dracut', '-f'])
kernelName = libcalamares.job.configuration['kernelName']

if not kernelName:
return check_target_env_call(['dracut', '-f'])
else:
return check_target_env_call(['dracut', '-f', '{}'.format(kernelName)])


def run():
Expand All @@ -46,5 +52,5 @@ def run():
return_code = run_dracut()

if return_code != 0:
return ( _("Failed to run dracut on the target"),
_("The exit code was {}").format(return_code) )
return (_("Failed to run dracut on the target"),
_("The exit code was {}").format(return_code))

0 comments on commit 6235e04

Please sign in to comment.