From eea752fa798c9f5237614a7b8bc9b2d826f7b4b7 Mon Sep 17 00:00:00 2001 From: tteckster Date: Mon, 1 May 2023 17:50:43 -0400 Subject: [PATCH] Create microcode.sh --- misc/microcode.sh | 63 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 misc/microcode.sh diff --git a/misc/microcode.sh b/misc/microcode.sh new file mode 100644 index 00000000..07b2fff5 --- /dev/null +++ b/misc/microcode.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +# Copyright (c) 2021-2023 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +clear +while true; do + read -p "Install the latest Intel Processor Microcode (y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done +clear +cat <<"EOF" + ____ __ __ __ ____ __ + / _/___ / /____ / / / |/ (_)_____________ _________ ____/ /__ + / // __ \/ __/ _ \/ / / /|_/ / / ___/ ___/ __ \/ ___/ __ \/ __ / _ \ + _/ // / / / /_/ __/ / / / / / / /__/ / / /_/ / /__/ /_/ / /_/ / __/ +/___/_/ /_/\__/\___/_/ /_/ /_/_/\___/_/ \____/\___/\____/\__,_/\___/ + +EOF + +YW=$(echo "\033[33m") +GN=$(echo "\033[1;92m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" + +set -euo pipefail +shopt -s inherit_errexit nullglob + +msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +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" + +msg_info "Downloading the latest Intel Processor Microcode Package for Linux" +release=$(curl -s https://api.github.com/repos/intel/Intel-Linux-Processor-Microcode-Data-Files/releases/latest | awk -F'"' '/tag_name/{print $4}' | tr -cd '[:digit:]') +wget -q http://ftp.debian.org/debian/pool/non-free-firmware/i/intel-microcode/intel-microcode_3.${release}.1_amd64.deb +msg_ok "Downloaded the latest Intel Processor Microcode Package" + +msg_info "Installing the Intel Processor Microcode (Patience)" +dpkg -i intel-microcode_3.${release}.1_amd64.deb &>/dev/null +msg_ok "Installed the Intel Processor Microcode" + +msg_info "Cleaning up" +rm intel-microcode_3.${release}.1_amd64.deb +msg_ok "Cleaned" + +echo -e "\n To apply the settings, the system will need to be rebooted.\n"