[dracut] Add an options setting for additional Dracut parameters
This commit is contained in:
parent
9cc4cb356f
commit
119f3fb4bd
@ -8,3 +8,8 @@
|
||||
# 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"
|
||||
|
@ -7,3 +7,4 @@ additionalProperties: false
|
||||
type: object
|
||||
properties:
|
||||
initramfsName: { type: string }
|
||||
options: { type: array, items: { type: string } }
|
||||
|
@ -35,15 +35,22 @@ def run_dracut():
|
||||
|
||||
:return:
|
||||
"""
|
||||
# Fetch the job configuration
|
||||
cli_options = ["-f"]
|
||||
initramfs_name = libcalamares.job.configuration.get('initramfsName', None)
|
||||
dracut_options = libcalamares.job.configuration.get('options', [])
|
||||
|
||||
# Parse the custom options if there are any
|
||||
for option in dracut_options:
|
||||
# Deduplication check
|
||||
if option not in cli_options:
|
||||
cli_options.append(option)
|
||||
|
||||
if initramfs_name:
|
||||
cli_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'] + cli_options)
|
||||
except subprocess.CalledProcessError as cpe:
|
||||
libcalamares.utils.warning(f"Dracut failed with output: {cpe.output}")
|
||||
return cpe.returncode
|
||||
|
Loading…
Reference in New Issue
Block a user