Skip to content

Commit

Permalink
Fix overwrite of kiwi_oemunattended
Browse files Browse the repository at this point in the history
In case rd.kiwi.oem.installdevice is set, there is an overwrite
of the kiwi_oemunattended setting. However the variable was set
in local scope of a function and therefore the change was not
effective in other methods which also evaluates this variable.
This commit fixes it such that the overwrite happens in the early
initialize method which provides the environment for all code
running in the dracut module. This is related to jira#PED-7180
  • Loading branch information
schaefi committed Jan 4, 2024
1 parent 5146ec8 commit 11eea68
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
13 changes: 0 additions & 13 deletions dracut/modules.d/90kiwi-dump/kiwi-dump-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,6 @@ function get_disk_list {
)
device_size=$(echo "${device_meta}" | cut -f2 -d:)
list_items="${device} ${device_size}"
# activate unattended mode. In case a user explicitly
# provides the device name to deploy the image to via
# the kernel commandline, no further questions if this
# is wanted should appear
message="rd.kiwi.oem.installdevice set via cmdline to: ${device}"
message="${message} The following OEM device settings will be ignored:"
message="${message} oem-unattended,"
message="${message} oem-unattended-id,"
message="${message} oem-device-filter"
export kiwi_oemunattended="true"
export kiwi_oemunattended_id=""
export kiwi_oemdevicefilter=""
info "${message}" >&2
fi
if [ -z "${list_items}" ];then
local no_device_text="No device(s) for installation found"
Expand Down
19 changes: 19 additions & 0 deletions dracut/modules.d/99kiwi-lib/kiwi-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,29 @@ function initialize {
# The method will exit from the initrd if the profile
# file does not exist
# """
local kiwi_oem_installdevice
local profile=/.profile

test -f ${profile} || \
report_and_quit "No profile setup found"

import_file ${profile}

# Handle overwrites
kiwi_oem_installdevice=$(getarg rd.kiwi.oem.installdevice=)
if [ -n "${kiwi_oem_installdevice}" ];then
# activate unattended mode. In case a user explicitly
# provides the device name to deploy the image to via
# the kernel commandline, no further questions if this
# is wanted should appear
message="rd.kiwi.oem.installdevice explicitly set via cmdline."
message="${message} The following OEM device settings will be ignored:"
message="${message} oem-unattended,"
message="${message} oem-unattended-id,"
message="${message} oem-device-filter"
export kiwi_oemunattended="true"
export kiwi_oemunattended_id=""
export kiwi_oemdevicefilter=""
info "${message}" >&2
fi
}

0 comments on commit 11eea68

Please sign in to comment.