Skip to content

Commit

Permalink
Skip kernel parameters configuration for Ubuntu
Browse files Browse the repository at this point in the history
It's enouph to configure ib_core module in /etc/moprobe.d/ for
Ubuntu OS to change RDMA subsystem mode.

Also this commit fixes kargs.sh error because 'grubby' isn't
available in official Ubuntu repositories.

Signed-off-by: Ivan Kolodiazhnyi <[email protected]>
  • Loading branch information
e0ne committed Dec 17, 2024
1 parent d172b52 commit 31f4d92
Showing 1 changed file with 41 additions and 37 deletions.
78 changes: 41 additions & 37 deletions bindata/scripts/kargs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,53 @@ declare -a kargs=( "$@" )
ret=0
args=$(chroot /host/ cat /proc/cmdline)

if chroot /host/ test -f /run/ostree-booted ; then
for t in "${kargs[@]}";do
if [[ $command == "add" ]];then
if [[ $args != *${t}* ]];then
if chroot /host/ rpm-ostree kargs | grep -vq ${t}; then
chroot /host/ rpm-ostree kargs --append ${t} > /dev/null 2>&1
IS_OS_UBUNTU=true; [[ "$(grep -i ubuntu /etc/os-release -c)" == "0" ]] && IS_OS_UBUNTU=false

if ! ${IS_OS_UBUNTU} ; then
if chroot /host/ test -f /run/ostree-booted ; then
for t in "${kargs[@]}";do
if [[ $command == "add" ]];then
if [[ $args != *${t}* ]];then
if chroot /host/ rpm-ostree kargs | grep -vq ${t}; then
chroot /host/ rpm-ostree kargs --append ${t} > /dev/null 2>&1
fi
let ret++
fi
let ret++
fi
fi
if [[ $command == "remove" ]];then
if [[ $args == *${t}* ]];then
if chroot /host/ rpm-ostree kargs | grep -q ${t}; then
chroot /host/ rpm-ostree kargs --delete ${t} > /dev/null 2>&1
fi
let ret++
fi
fi
done
else
chroot /host/ which grubby > /dev/null 2>&1
# if grubby is not there, let's tell it
if [ $? -ne 0 ]; then
exit 127
fi
for t in "${kargs[@]}";do
if [[ $command == "add" ]];then
if [[ $args != *${t}* ]];then
if chroot /host/ grubby --info=DEFAULT | grep args | grep -vq ${t}; then
chroot /host/ grubby --update-kernel=DEFAULT --args=${t} > /dev/null 2>&1
if [[ $command == "remove" ]];then
if [[ $args == *${t}* ]];then
if chroot /host/ rpm-ostree kargs | grep -q ${t}; then
chroot /host/ rpm-ostree kargs --delete ${t} > /dev/null 2>&1
fi
let ret++
fi
fi
let ret++
done
else
chroot /host/ which grubby > /dev/null 2>&1
# if grubby is not there, let's tell it
if [ $? -ne 0 ]; then
exit 127
fi
fi
if [[ $command == "remove" ]];then
if [[ $args == *${t}* ]];then
if chroot /host/ grubby --info=DEFAULT | grep args | grep -q ${t}; then
chroot /host/ grubby --update-kernel=DEFAULT --remove-args=${t} > /dev/null 2>&1
for t in "${kargs[@]}";do
if [[ $command == "add" ]];then
if [[ $args != *${t}* ]];then
if chroot /host/ grubby --info=DEFAULT | grep args | grep -vq ${t}; then
chroot /host/ grubby --update-kernel=DEFAULT --args=${t} > /dev/null 2>&1
fi
let ret++
fi
let ret++
fi
fi
done
if [[ $command == "remove" ]];then
if [[ $args == *${t}* ]];then
if chroot /host/ grubby --info=DEFAULT | grep args | grep -q ${t}; then
chroot /host/ grubby --update-kernel=DEFAULT --remove-args=${t} > /dev/null 2>&1
fi
let ret++
fi
fi
done
fi
fi

echo $ret

0 comments on commit 31f4d92

Please sign in to comment.