grubby-bls: check if entry exists before attempting to print its info
The grubby --info option didn't check if an entry existed for a kernel and printed wrong information about it. Fix this and also for --update-kernel and --set-default options that have the same issue. Resolves: rhbz#1634712 Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
parent
cf425061aa
commit
b40ea5be18
12
grubby-bls
12
grubby-bls
@ -188,6 +188,10 @@ param_to_indexes() {
|
||||
display_info_values() {
|
||||
local indexes=($(param_to_indexes "$1"))
|
||||
|
||||
if [[ $indexes = "-1" ]]; then
|
||||
print_error "The param $1 is incorrect"
|
||||
fi
|
||||
|
||||
for i in ${indexes[*]}; do
|
||||
echo "index=$i"
|
||||
echo "kernel=${bls_linux[$i]}"
|
||||
@ -358,6 +362,10 @@ update_bls_fragment() {
|
||||
local add_args=$1 && shift
|
||||
local initrd=$1 && shift
|
||||
|
||||
if [[ $indexes = "-1" ]]; then
|
||||
print_error "The param $1 is incorrect"
|
||||
fi
|
||||
|
||||
for i in ${indexes[*]}; do
|
||||
if [[ -n $remove_args || -n $add_args ]]; then
|
||||
local new_args="$(update_args "${bls_options[$i]}" "${remove_args}" "${add_args}")"
|
||||
@ -375,6 +383,10 @@ update_bls_fragment() {
|
||||
set_default_bls() {
|
||||
local index=($(param_to_indexes "$1"))
|
||||
|
||||
if [[ $index = "-1" ]]; then
|
||||
print_error "The param $1 is incorrect"
|
||||
fi
|
||||
|
||||
if [[ $bootloader = grub2 ]]; then
|
||||
grub2-editenv "${env}" set saved_entry="${bls_id[$index]}"
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user