From 3486bba827b2b1b9a6a4027e551abc19e14e7693 Mon Sep 17 00:00:00 2001
From: tteckster <tteckster@gmail.com>
Date: Sun, 7 May 2023 16:10:15 -0400
Subject: [PATCH] Update microcode.sh

add CPU Vendor check
---
 misc/microcode.sh | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/misc/microcode.sh b/misc/microcode.sh
index 07b2fff50..2758138aa 100644
--- a/misc/microcode.sh
+++ b/misc/microcode.sh
@@ -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"