grubby-bls: fix corner case when a kernel param value contains a '='

If a kernel command line parameter has a '=' character, grubby fails
to update the options field in the BLS snippet, for example:

$ grubby --update-kernel=foo --args="bar=https://test?token="
sed: -e expression #1, char 30: unknown option to `s'

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
Javier Martinez Canillas 2020-04-29 12:05:04 +02:00
parent 8c7d866907
commit f57406f3ab
No known key found for this signature in database
GPG Key ID: C751E590D63F3D69
1 changed files with 2 additions and 2 deletions

View File

@ -460,7 +460,7 @@ update_args() {
for arg in ${remove_args[*]}; do
if [[ $arg = *"="* ]]; then
arg=$(echo $arg | sed -e 's/\//\\\//g')
arg="$(echo $arg | sed -e 's/\//\\\//g')"
args="$(echo $args | sed -E "s/(^|[[:space:]])$arg([[:space:]]|$)/ /")"
else
args="$(echo $args | sed -E "s/(^|[[:space:]])$arg(([[:space:]]|$)|([=][^ ]*([$]*)))/ /g")"
@ -468,7 +468,7 @@ update_args() {
done
for arg in ${add_args[*]}; do
arg=${arg%=*}
arg="${arg%%=*}"
args="$(echo $args | sed -E "s/(^|[[:space:]])$arg(([[:space:]]|$)|([=][^ ]*([$]*)))/ /g")"
done