Browse Source

Update microcode.sh

add CPU Vendor check
tteckster 2 years ago
parent
commit
3486bba827
1 changed files with 16 additions and 0 deletions
  1. 16 0
      misc/microcode.sh

+ 16 - 0
misc/microcode.sh

@@ -23,12 +23,14 @@ cat <<"EOF"
 
 
 EOF
 EOF
 
 
+RD=$(echo "\033[01;31m")
 YW=$(echo "\033[33m")
 YW=$(echo "\033[33m")
 GN=$(echo "\033[1;92m")
 GN=$(echo "\033[1;92m")
 CL=$(echo "\033[m")
 CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 BFR="\\r\\033[K"
 HOLD="-"
 HOLD="-"
 CM="${GN}✓${CL}"
 CM="${GN}✓${CL}"
+CROSS="${RD}✗${CL}"
 
 
 set -euo pipefail
 set -euo pipefail
 shopt -s inherit_errexit nullglob
 shopt -s inherit_errexit nullglob
@@ -43,6 +45,20 @@ msg_ok() {
     echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
     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"
 msg_info "Installing iucode-tool: a tool for updating Intel processor microcode"
 apt-get install -y iucode-tool &>/dev/null
 apt-get install -y iucode-tool &>/dev/null
 msg_ok "Installed iucode-tool"
 msg_ok "Installed iucode-tool"