grubby-bls: fix logic to check if the kernelopts var is defined in a BLS
The logic to check if a kernelopts variable is defined in a BLS entry was wrong and caused grubby to expand the variables even when it was defined. Resolves: rhbz#1726514 Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
parent
5dafc374ee
commit
08153fc1d6
@ -224,10 +224,10 @@ has_kernelopts()
|
|||||||
local opts=(${args})
|
local opts=(${args})
|
||||||
|
|
||||||
for opt in ${opts[*]}; do
|
for opt in ${opts[*]}; do
|
||||||
[[ $opt = "\$kernelopts" ]] && return 0
|
[[ $opt = "\$kernelopts" ]] && echo "true"
|
||||||
done
|
done
|
||||||
|
|
||||||
return 1
|
echo "false"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_bls_args() {
|
get_bls_args() {
|
||||||
@ -504,11 +504,11 @@ update_bls_fragment() {
|
|||||||
local old_args="$(get_bls_args "$i")"
|
local old_args="$(get_bls_args "$i")"
|
||||||
local new_args="$(update_args "${old_args}" "${remove_args}" "${add_args}")"
|
local new_args="$(update_args "${old_args}" "${remove_args}" "${add_args}")"
|
||||||
|
|
||||||
if [[ $param != "ALL" || ! "$(has_kernelopts "$i")" ]]; then
|
if [[ $param != "ALL" || "$(has_kernelopts "$i")" = "false" ]]; then
|
||||||
set_bls_value "${bls_file[$i]}" "options" "${new_args}"
|
set_bls_value "${bls_file[$i]}" "options" "${new_args}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $bootloader = grub2 && ! "$(has_kernelopts "$i")" && $opts = $new_args ]]; then
|
if [[ $bootloader = grub2 && "$(has_kernelopts "$i")" = "false" && $opts = $new_args ]]; then
|
||||||
set_bls_value "${bls_file[$i]}" "options" "\$kernelopts"
|
set_bls_value "${bls_file[$i]}" "options" "\$kernelopts"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user