Merge pull request #2401 from lubuntu-team/tsimonq2/dracut-options

[dracut] Add an options setting for additional Dracut parameters
This commit is contained in:
Adriaan de Groot 2024-11-29 13:17:30 +01:00 committed by GitHub
commit 6176fb4d12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 8 deletions

View File

@ -8,3 +8,7 @@
# set a custom name, including the path
#
initramfsName: /boot/initramfs-freebsd.img
# Optional: define a list of strings to be passed as arguments to Dracut
# By default, -f is always included
options: [ "-f" ]

View File

@ -7,3 +7,4 @@ additionalProperties: false
type: object
properties:
initramfsName: { type: string }
options: { type: array, items: { type: string } }

View File

@ -35,15 +35,15 @@ def run_dracut():
:return:
"""
# Fetch the job configuration
initramfs_name = libcalamares.job.configuration.get('initramfsName', None)
dracut_options = libcalamares.job.configuration.get('options', ['-f'])
if initramfs_name:
dracut_options.append(initramfs_name)
try:
initramfs_name = libcalamares.job.configuration['initramfsName']
target_env_process_output(['dracut', '-f', initramfs_name])
except KeyError:
try:
target_env_process_output(['dracut', '-f'])
except subprocess.CalledProcessError as cpe:
libcalamares.utils.warning(f"Dracut failed with output: {cpe.output}")
return cpe.returncode
target_env_process_output(['dracut'] + dracut_options)
except subprocess.CalledProcessError as cpe:
libcalamares.utils.warning(f"Dracut failed with output: {cpe.output}")
return cpe.returncode