From 31f4d9254f6b26134a37398d06ec3899ecd42dcd Mon Sep 17 00:00:00 2001 From: Ivan Kolodiazhnyi <ikolodiazhny@nvidia.com> Date: Tue, 17 Dec 2024 14:19:38 +0200 Subject: [PATCH] Skip kernel parameters configuration for Ubuntu 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 <ikolodiazhny@nvidia.com> --- bindata/scripts/kargs.sh | 78 +++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/bindata/scripts/kargs.sh b/bindata/scripts/kargs.sh index 8d118456e..119d570da 100755 --- a/bindata/scripts/kargs.sh +++ b/bindata/scripts/kargs.sh @@ -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