Update microcode.sh

add CPU Vendor check
This commit is contained in:
tteckster 2023-05-07 16:10:15 -04:00 committed by GitHub
parent 0d977e3881
commit 3486bba827
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -23,12 +23,14 @@ cat <<"EOF"
EOF
RD=$(echo "\033[01;31m")
YW=$(echo "\033[33m")
GN=$(echo "\033[1;92m")
CL=$(echo "\033[m")
BFR="\\r\\033[K"
HOLD="-"
CM="${GN}${CL}"
CROSS="${RD}${CL}"
set -euo pipefail
shopt -s inherit_errexit nullglob
@ -43,6 +45,20 @@ msg_ok() {
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
}
msg_error() {
local msg="$1"
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
}
msg_info "Checking CPU Vendor"
cpu=$(lscpu | grep -oP 'Vendor ID:\s*\K\S+')
if [ "$cpu" == "GenuineIntel" ]; then
msg_ok "${cpu} was detected"
else
msg_error "${cpu} is not supported"
exit
fi
msg_info "Installing iucode-tool: a tool for updating Intel processor microcode"
apt-get install -y iucode-tool &>/dev/null
msg_ok "Installed iucode-tool"