grubby-bls: allow to specify the same kernel param multiple times
The kernel command line can contain parameters that are specified multiple times. This is supported by the old grubby tool but ins't supported by the grubby BLS wrapper. Allow the grubby wrapper to do the same. Resolves: rhbz#1652486 Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
parent
d1dd184403
commit
4b1d63cacd
26
grubby-bls
26
grubby-bls
@ -421,27 +421,21 @@ update_args() {
|
|||||||
local add_args=($1) && shift
|
local add_args=($1) && shift
|
||||||
|
|
||||||
for arg in ${remove_args[*]}; do
|
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/$arg[^ ]*//")"
|
args="$(echo $args | sed -E "s/(^|[[:space:]])$arg([[:space:]]|$)/ /")"
|
||||||
|
else
|
||||||
|
args="$(echo $args | sed -E "s/(^|[[:space:]])$arg(([[:space:]]|$)|([=][^ ]*([$]*)))/ /g")"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for arg in ${add_args[*]}; do
|
||||||
|
arg=${arg%=*}
|
||||||
|
args="$(echo $args | sed -E "s/(^|[[:space:]])$arg(([[:space:]]|$)|([=][^ ]*([$]*)))/ /g")"
|
||||||
done
|
done
|
||||||
|
|
||||||
for arg in ${add_args[*]}; do
|
for arg in ${add_args[*]}; do
|
||||||
if [[ $arg = *"="* ]]; then
|
|
||||||
value=${arg##*=}
|
|
||||||
key=${arg%%=$value}
|
|
||||||
exist=$(echo $args | grep "${key}=")
|
|
||||||
if [[ -n $exist ]]; then
|
|
||||||
value=$(echo $value | sed -e 's/\//\\\//g')
|
|
||||||
args="$(echo $args | sed -e "s/$key=[^ ]*/$key=$value/")"
|
|
||||||
else
|
|
||||||
args="$args $key=$value"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
exist=$(echo $args | grep $arg)
|
|
||||||
if ! [[ -n $exist ]]; then
|
|
||||||
args="$args $arg"
|
args="$args $arg"
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
echo ${args}
|
echo ${args}
|
||||||
|
Loading…
Reference in New Issue
Block a user