Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
37f094c099 | ||
|
6fadbea615 | ||
|
f399c55bb7 |
32
grubby-bls
32
grubby-bls
@ -218,8 +218,20 @@ expand_var() {
|
|||||||
echo $var
|
echo $var
|
||||||
}
|
}
|
||||||
|
|
||||||
|
has_kernelopts()
|
||||||
|
{
|
||||||
|
local args=${bls_options[$1]}
|
||||||
|
local opts=(${args})
|
||||||
|
|
||||||
|
for opt in ${opts[*]}; do
|
||||||
|
[[ $opt = "\$kernelopts" ]] && return 0
|
||||||
|
done
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
get_bls_args() {
|
get_bls_args() {
|
||||||
local args=${bls_options[$i]}
|
local args=${bls_options[$1]}
|
||||||
local opts=(${args})
|
local opts=(${args})
|
||||||
|
|
||||||
for opt in ${opts[*]}; do
|
for opt in ${opts[*]}; do
|
||||||
@ -473,18 +485,34 @@ update_bls_fragment() {
|
|||||||
local remove_args=$1 && shift
|
local remove_args=$1 && shift
|
||||||
local add_args=$1 && shift
|
local add_args=$1 && shift
|
||||||
local initrd=$1 && shift
|
local initrd=$1 && shift
|
||||||
|
local opts
|
||||||
|
|
||||||
if [[ $indexes = "-1" ]]; then
|
if [[ $indexes = "-1" ]]; then
|
||||||
print_error "The param $(get_prefix)${param} is incorrect"
|
print_error "The param $(get_prefix)${param} is incorrect"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $param = "ALL" && $bootloader = grub2 ]] && [[ -n $remove_args || -n $add_args ]]; then
|
||||||
|
local old_args="$(grub2-editenv "${env}" list | grep kernelopts | sed -e "s/kernelopts=//")"
|
||||||
|
opts="$(update_args "${old_args}" "${remove_args}" "${add_args}")"
|
||||||
|
grub2-editenv "${env}" set kernelopts="${opts}"
|
||||||
|
elif [[ $bootloader = grub2 ]]; then
|
||||||
|
opts="$(grub2-editenv "${env}" list | grep kernelopts | sed -e "s/kernelopts=//")"
|
||||||
|
fi
|
||||||
|
|
||||||
for i in ${indexes[*]}; do
|
for i in ${indexes[*]}; do
|
||||||
if [[ -n $remove_args || -n $add_args ]]; then
|
if [[ -n $remove_args || -n $add_args ]]; then
|
||||||
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
|
||||||
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
|
||||||
|
set_bls_value "${bls_file[$i]}" "options" "\$kernelopts"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -n $initrd ]]; then
|
if [[ -n $initrd ]]; then
|
||||||
set_bls_value "${bls_file[$i]}" "initrd" "${initrd}"
|
set_bls_value "${bls_file[$i]}" "initrd" "${initrd}"
|
||||||
fi
|
fi
|
||||||
@ -706,7 +734,7 @@ while [ ${#} -gt 0 ]; do
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -z $update_kernel ]] && [[ -n $args || -n $remove_args ]]; then
|
if [[ -z $update_kernel && -z $kernel ]] && [[ -n $args || -n $remove_args ]]; then
|
||||||
print_error "no action specified"
|
print_error "no action specified"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
22
grubby.spec
22
grubby.spec
@ -1,6 +1,6 @@
|
|||||||
Name: grubby
|
Name: grubby
|
||||||
Version: 8.40
|
Version: 8.40
|
||||||
Release: 27%{?dist}
|
Release: 30%{?dist}
|
||||||
Summary: Command line tool for updating bootloader configs
|
Summary: Command line tool for updating bootloader configs
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: https://github.com/rhinstaller/grubby
|
URL: https://github.com/rhinstaller/grubby
|
||||||
@ -84,13 +84,8 @@ sed -e "s,@@LIBEXECDIR@@,%{_libexecdir}/installkernel,g" %{SOURCE3} \
|
|||||||
%post
|
%post
|
||||||
if [ "$1" = 2 ]; then
|
if [ "$1" = 2 ]; then
|
||||||
arch=$(uname -m)
|
arch=$(uname -m)
|
||||||
if [[ $arch == "s390x" ]]; then
|
[[ $arch == "s390x" ]] && \
|
||||||
command=zipl-switch-to-blscfg
|
zipl-switch-to-blscfg --backup-suffix=.rpmsave &>/dev/null || :
|
||||||
else
|
|
||||||
command=grub2-switch-to-blscfg
|
|
||||||
fi
|
|
||||||
|
|
||||||
$command --backup-suffix=.rpmsave &>/dev/null || :
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%package deprecated
|
%package deprecated
|
||||||
@ -132,6 +127,17 @@ current boot environment.
|
|||||||
%{_mandir}/man8/*.8*
|
%{_mandir}/man8/*.8*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Mar 21 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-30
|
||||||
|
- grubby-bls: fix --add-kernel not working when using the --args option
|
||||||
|
Resolves: rhbz#1691004
|
||||||
|
|
||||||
|
* Mon Mar 11 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-29
|
||||||
|
- Only switch to BLS config for s390x / zipl
|
||||||
|
Related: rhbz#1652806
|
||||||
|
|
||||||
|
* Fri Mar 01 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-28
|
||||||
|
- grubby-bls: make --update-kernel ALL to update kernelopts var in grubenv
|
||||||
|
|
||||||
* Thu Feb 14 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-27
|
* Thu Feb 14 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-27
|
||||||
- grubby-bls: error if args or remove-args is used without update-kernel
|
- grubby-bls: error if args or remove-args is used without update-kernel
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user