Update post-pve-install.sh

If an Intel N-series processor is detected, the script provides options to install both the Proxmox 6.2 kernel and the Intel microcode.
pull/1460/head
tteckster 2023-05-27 21:59:30 -04:00 committed by GitHub
parent e43ec5423e
commit fed3fd387a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 72 additions and 79 deletions

View File

@ -10,10 +10,10 @@ header_info() {
cat <<"EOF"
____ _ _____________ ____ __ ____ __ ____
/ __ \ | / / ____/__ / / __ \____ _____/ /_ / _/___ _____/ /_____ _/ / /
/ /_/ / | / / __/ / / / /_/ / __ \/ ___/ __/ / // __ \/ ___/ __/ __ / / /
/ ____/| |/ / /___ / / / ____/ /_/ (__ ) /_ _/ // / / (__ ) /_/ /_/ / / /
/_/ |___/_____/ /_/ /_/ \____/____/\__/ /___/_/ /_/____/\__/\__,_/_/_/
/ /_/ / | / / __/ / / / /_/ / __ \/ ___/ __/ / // __ \/ ___/ __/ __ / / /
/ ____/| |/ / /___ / / / ____/ /_/ (__ ) /_ _/ // / / (__ ) /_/ /_/ / / /
/_/ |___/_____/ /_/ /_/ \____/____/\__/ /___/_/ /_/____/\__/\__,_/_/_/
EOF
}
@ -30,13 +30,13 @@ set -euo pipefail
shopt -s inherit_errexit nullglob
msg_info() {
local msg="$1"
echo -ne " ${HOLD} ${YW}${msg}..."
local msg="$1"
echo -ne " ${HOLD} ${YW}${msg}..."
}
msg_ok() {
local msg="$1"
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
local msg="$1"
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
}
msg_error() {
@ -44,23 +44,12 @@ msg_error() {
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
}
exit_script() {
clear
echo -e "⚠ User exited script \n"
exit
}
start_routines() {
header_info
CHOICE=$(
whiptail --title "Proxmox VE 7 Post Install" --menu "The 'pve-enterprise' repository is only available to users who have purchased a Proxmox VE subscription.\n \nDisable 'pve-enterprise' repository?" 14 58 2 \
"yes" " " \
"no" " " 3>&2 2>&1 1>&3
)
exit_status=$?
if [ $exit_status == 1 ]; then
exit_script
fi
header_info
CHOICE=$(whiptail --title "Proxmox VE 7 Post Install" --menu "The 'pve-enterprise' repository is only available to users who have purchased a Proxmox VE subscription.\n \nDisable 'pve-enterprise' repository?" 14 58 2 \
"yes" " " \
"no" " " 3>&2 2>&1 1>&3)
case $CHOICE in
yes)
msg_info "Disabling 'pve-enterprise' repository"
@ -72,15 +61,9 @@ start_routines() {
;;
esac
CHOICE=$(
whiptail --title "Proxmox VE 7 Post Install" --menu "The package manager will use the correct sources to update and install packages on your Proxmox VE 7 server.\n \nCorrect Proxmox VE 7 sources?" 14 58 2 \
"yes" " " \
"no" " " 3>&2 2>&1 1>&3
)
exit_status=$?
if [ $exit_status == 1 ]; then
exit_script
fi
CHOICE=$(whiptail --title "Proxmox VE 7 Post Install" --menu "The package manager will use the correct sources to update and install packages on your Proxmox VE 7 server.\n \nCorrect Proxmox VE 7 sources?" 14 58 2 \
"yes" " " \
"no" " " 3>&2 2>&1 1>&3)
case $CHOICE in
yes)
msg_info "Correcting Proxmox VE 7 Sources"
@ -96,15 +79,9 @@ EOF
;;
esac
CHOICE=$(
whiptail --title "Proxmox VE 7 Post Install" --menu "The 'pve-no-subscription' repository provides access to all of the open-source components of Proxmox VE.\n \nEnable 'pve-no-subscription' repository?" 14 58 2 \
"yes" " " \
"no" " " 3>&2 2>&1 1>&3
)
exit_status=$?
if [ $exit_status == 1 ]; then
exit_script
fi
CHOICE=$(whiptail --title "Proxmox VE 7 Post Install" --menu "The 'pve-no-subscription' repository provides access to all of the open-source components of Proxmox VE.\n \nEnable 'pve-no-subscription' repository?" 14 58 2 \
"yes" " " \
"no" " " 3>&2 2>&1 1>&3)
case $CHOICE in
yes)
msg_info "Enabling 'pve-no-subscription' repository"
@ -118,15 +95,9 @@ EOF
;;
esac
CHOICE=$(
whiptail --title "Proxmox VE 7 Post Install" --menu "The 'pvetest' repository can give advanced users access to new features and updates before they are officially released.\n \nAdd (Disabled) 'pvetest' repository?" 14 58 2 \
"yes" " " \
"no" " " 3>&2 2>&1 1>&3
)
exit_status=$?
if [ $exit_status == 1 ]; then
exit_script
fi
CHOICE=$(whiptail --title "Proxmox VE 7 Post Install" --menu "The 'pvetest' repository can give advanced users access to new features and updates before they are officially released.\n \nAdd (Disabled) 'pvetest' repository?" 14 58 2 \
"yes" " " \
"no" " " 3>&2 2>&1 1>&3)
case $CHOICE in
yes)
msg_info "Adding 'pvetest' repository and set disabled"
@ -140,15 +111,9 @@ EOF
;;
esac
CHOICE=$(
whiptail --title "Proxmox VE 7 Post Install" --menu "This will disable the nag message reminding you to purchase a subscription every time you log in to the web interface.\n \nDisable subscription nag?" 14 58 2 \
"yes" " " \
"no" " " 3>&2 2>&1 1>&3
)
exit_status=$?
if [ $exit_status == 1 ]; then
exit_script
fi
CHOICE=$(whiptail --title "Proxmox VE 7 Post Install" --menu "This will disable the nag message reminding you to purchase a subscription every time you log in to the web interface.\n \nDisable subscription nag?" 14 58 2 \
"yes" " " \
"no" " " 3>&2 2>&1 1>&3)
case $CHOICE in
yes)
msg_info "Disabling subscription nag"
@ -161,36 +126,64 @@ EOF
;;
esac
CHOICE=$(
whiptail --title "Proxmox VE 7 Post Install" --menu "\nUpdate Proxmox VE 7 now?" 11 58 2 \
"yes" " " \
"no" " " 3>&2 2>&1 1>&3
)
exit_status=$?
if [ $exit_status == 1 ]; then
exit_script
fi
CHOICE=$(whiptail --title "Proxmox VE 7 Post Install" --menu "\nUpdate Proxmox VE 7 now?" 11 58 2 \
"yes" " " \
"no" " " 3>&2 2>&1 1>&3)
case $CHOICE in
yes)
msg_info "Updating Proxmox VE 7 (Patience)"
apt-get update &>/dev/null
apt-get -y dist-upgrade &>/dev/null
msg_ok "Updated Proxmox VE 7 (Reboot recommended)"
msg_ok "Updated Proxmox VE 7"
;;
no)
msg_error "Selected no to Updating Proxmox VE 7"
;;
esac
CHOICE=$(
whiptail --title "Proxmox VE 7 Post Install" --menu "\nReboot Proxmox VE 7 now?" 11 58 2 \
"yes" " " \
"no" " " 3>&2 2>&1 1>&3
)
exit_status=$?
if [ $exit_status == 1 ]; then
exit_script
microcode=""
cpu=$(lscpu | grep -oP 'Vendor ID:\s*\K\S+')
if [ "$cpu" == "GenuineIntel" ]; then
if lscpu | awk '/Model name:.*N/ {exit 0} END {exit 1}'; then
CHOICE=$(whiptail --title "N-SERIES PROCESSOR DETECTED" --menu "\nTo ensure compatibility with Proxmox VE on systems equipped with N-series processors, it is recommended to install the Proxmox 6.2 kernel.\n\nInstall the Proxmox 6.2 kernel now?" 16 58 2 \
"yes" " " \
"no" " " 3>&1 1>&2 2>&3)
case $CHOICE in
yes)
msg_info "Installing Proxmox 6.2 kernel"
apt install pve-kernel-6.2
microcode="need"
msg_ok "Installed Proxmox 6.2 kernel"
;;
no)
msg_error "Selected no to Installing the Proxmox 6.2 kernel"
;;
esac
fi
fi
if [ "$microcode" == "need" ]; then
CHOICE=$(whiptail --title "INTEL MICROCODE" --menu "\nMicrocode updates can fix hardware bugs, improve performance, and enhance security features of the processor.\n\nInstall the Intel Microcode now?" 16 58 2 \
"yes" " " \
"no" " " 3>&2 2>&1 1>&3)
case $CHOICE in
yes)
msg_info "Installing Intel Microcode"
apt-get install -y iucode-tool &>/dev/null
wget -q http://ftp.debian.org/debian/pool/non-free-firmware/i/intel-microcode/intel-microcode_3.20230512.1_amd64.deb
dpkg -i intel-microcode_3.20230512.1_amd64.deb &>/dev/null
rm intel-microcode_3.20230512.1_amd64.deb
msg_ok "Installed Intel Microcode"
;;
no)
msg_error "Selected no to Installing the Intel Microcode"
;;
esac
fi
CHOICE=$(whiptail --title "Proxmox VE 7 Post Install" --menu "\nReboot Proxmox VE 7 now? (recommended)" 11 58 2 \
"yes" " " \
"no" " " 3>&2 2>&1 1>&3)
case $CHOICE in
yes)
msg_info "Rebooting Proxmox VE 7"
@ -199,7 +192,7 @@ EOF
reboot
;;
no)
msg_error "Selected no to Rebooting Proxmox VE 7"
msg_error "Selected no to Rebooting Proxmox VE 7 (Reboot recommended)"
msg_ok "Completed Post Install Routines"
;;
esac
@ -211,7 +204,7 @@ while true; do
read -p "Start the Proxmox VE 7 Post Install Script (y/n)?" yn
case $yn in
[Yy]*) break ;;
[Nn]*) exit_script ;;
[Nn]*) clear; exit ;;
*) echo "Please answer yes or no." ;;
esac
done