[install.sh] Fix CPU cstates configuration. (#7222)

The motivation of these changes is to fix (#6051):

- Why I did it
To fix CPU cstates configuration

- How I did it
Updated code to be POSIX compatible

- How to verify it
root@sonic:/home/admin# sonic_installer install sonic-mellanox.bin

Signed-off-by: Nazarii Hnydyn <nazariig@nvidia.com>
This commit is contained in:
Nazarii Hnydyn 2021-04-04 10:40:53 +03:00 committed by GitHub
parent 9fa5a6135c
commit 01b0330797
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -562,9 +562,10 @@ trap_push "rm $grub_cfg || true"
[ -r ./platform.conf ] && . ./platform.conf [ -r ./platform.conf ] && . ./platform.conf
# Check if the CPU vendor is 'Intel' and disable c-states if True # Check if the CPU vendor is 'Intel' and disable c-states if True
CPUVENDOR=$(cat /proc/cpuinfo | grep -m 1 vendor_id | awk '{print $3}') CPUVENDOR="$(cat /proc/cpuinfo | grep -m 1 vendor_id | awk '{print $3}')"
echo "Switch CPU vendor is: $CPUVENDOR" echo "Switch CPU vendor is: $CPUVENDOR"
if [[ $(echo $CPUVENDOR | grep -i "Intel") ]] ; then if echo "$CPUVENDOR" | grep -i 'Intel' >/dev/null 2>&1; then
echo "Switch CPU cstates are: disabled"
CSTATES="intel_idle.max_cstate=0" CSTATES="intel_idle.max_cstate=0"
else else
CSTATES="" CSTATES=""