Compare commits

...

4 Commits

Author SHA1 Message Date
tteckster 4b5069f2bc
Update CHANGELOG.md 2023-09-14 12:21:17 -04:00
tteckster 43d7740960
Update CHANGELOG.md 2023-09-14 12:20:58 -04:00
tteckster 64bdc91b67
Update microcode.sh
code refactoring
2023-09-14 12:16:26 -04:00
tteckster 6df6d1c2fb
Update postgresql-install.sh
postgresql-16
2023-09-14 10:21:18 -04:00
3 changed files with 79 additions and 63 deletions

View File

@ -4,6 +4,13 @@
- All LXC instances created using this repository come pre-installed with Midnight Commander, which is a command-line tool (`mc`) that offers a user-friendly file and directory management interface for the terminal environment. - All LXC instances created using this repository come pre-installed with Midnight Commander, which is a command-line tool (`mc`) that offers a user-friendly file and directory management interface for the terminal environment.
## 2023-09-14
### Changed
- **Proxmox VE Processor Microcode**
- Allow users to select available microcode packages.
## 2023-09-13 ## 2023-09-13
### Changed ### Changed

View File

@ -30,7 +30,7 @@ msg_info "Installing PostgreSQL"
$STD apt-get update $STD apt-get update
$STD apt-get install -y postgresql $STD apt-get install -y postgresql
cat <<EOF >/etc/postgresql/15/main/pg_hba.conf cat <<EOF >/etc/postgresql/16/main/pg_hba.conf
# PostgreSQL Client Authentication Configuration File # PostgreSQL Client Authentication Configuration File
local all postgres peer local all postgres peer
# TYPE DATABASE USER ADDRESS METHOD # TYPE DATABASE USER ADDRESS METHOD
@ -49,7 +49,7 @@ host replication all 127.0.0.1/32 scram-sha-256
host replication all ::1/128 scram-sha-256 host replication all ::1/128 scram-sha-256
EOF EOF
cat <<EOF >/etc/postgresql/15/main/postgresql.conf cat <<EOF >/etc/postgresql/16/main/postgresql.conf
# ----------------------------- # -----------------------------
# PostgreSQL configuration file # PostgreSQL configuration file
# ----------------------------- # -----------------------------
@ -58,10 +58,10 @@ cat <<EOF >/etc/postgresql/15/main/postgresql.conf
# FILE LOCATIONS # FILE LOCATIONS
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
data_directory = '/var/lib/postgresql/15/main' data_directory = '/var/lib/postgresql/16/main'
hba_file = '/etc/postgresql/15/main/pg_hba.conf' hba_file = '/etc/postgresql/16/main/pg_hba.conf'
ident_file = '/etc/postgresql/15/main/pg_ident.conf' ident_file = '/etc/postgresql/16/main/pg_ident.conf'
external_pid_file = '/var/run/postgresql/15-main.pid' external_pid_file = '/var/run/postgresql/16-main.pid'
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION # CONNECTIONS AND AUTHENTICATION
@ -107,7 +107,7 @@ log_timezone = 'Etc/UTC'
# PROCESS TITLE # PROCESS TITLE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
cluster_name = '15/main' cluster_name = '16/main'
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# CLIENT CONNECTION DEFAULTS # CLIENT CONNECTION DEFAULTS

View File

@ -5,8 +5,8 @@
# https://github.com/tteck/Proxmox/raw/main/LICENSE # https://github.com/tteck/Proxmox/raw/main/LICENSE
function header_info { function header_info {
clear clear
cat <<"EOF" cat <<"EOF"
____ __ ____ __ ____ __ ____ __
/ __ \_________ ________ ______________ _____ / |/ (_)_____________ _________ ____/ /__ / __ \_________ ________ ______________ _____ / |/ (_)_____________ _________ ____/ /__
/ /_/ / ___/ __ \/ ___/ _ \/ ___/ ___/ __ \/ ___/ / /|_/ / / ___/ ___/ __ \/ ___/ __ \/ __ / _ \ / /_/ / ___/ __ \/ ___/ _ \/ ___/ ___/ __ \/ ___/ / /|_/ / / ___/ ___/ __ \/ ___/ __ \/ __ / _ \
@ -25,90 +25,99 @@ HOLD="-"
CM="${GN}${CL}" CM="${GN}${CL}"
CROSS="${RD}${CL}" CROSS="${RD}${CL}"
msg_info() { msg_info() { echo -ne " ${HOLD} ${YW}$1..."; }
local msg="$1" msg_ok() { echo -e "${BFR} ${CM} ${GN}$1${CL}"; }
echo -ne " ${HOLD} ${YW}${msg}..." msg_error() { echo -e "${BFR} ${CROSS} ${RD}$1${CL}"; }
}
msg_ok() {
local msg="$1"
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
}
msg_error() {
local msg="$1"
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
}
header_info header_info
current_microcode=$(dmesg | grep -o 'microcode updated early to revision [^,]*, date = [0-9\-]*') current_microcode=$(journalctl -k | grep -E "microcode: microcode" | awk -F 'microcode: microcode updated early to revision |, date = ' '{print $2 ", date = " $3}')
while true; do [ -z "$current_microcode" ] && current_microcode="Not found."
if [ -z "${current_microcode}" ]; then
msg_error "Microcode update information not found."
else
msg_ok "Current ${current_microcode}"
fi
read -p "Install the latest Processor Microcode (y/n)?" yn
case $yn in
[Yy]*) break ;;
[Nn]*) exit ;;
*) echo "Please answer yes or no." ;;
esac
done
header_info
intel() { intel() {
if ! dpkg -s iucode-tool >/dev/null 2>&1; then if ! dpkg -s iucode-tool >/dev/null 2>&1; then
msg_info "Installing iucode-tool: a tool for updating Intel processor microcode" msg_info "Installing iucode-tool (Intel microcode updater)"
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"
else else
msg_ok "Intel iucode-tool is already installed" msg_ok "Intel iucode-tool is already installed"
sleep 1
fi fi
msg_info "Downloading the latest Intel Processor Microcode Package for Linux" intel_microcode=$(curl -fsSL "https://ftp.debian.org/debian/pool/non-free-firmware/i/intel-microcode//" | grep -o 'href="[^"]*amd64.deb"' | sed 's/href="//;s/"//')
wget -q http://ftp.debian.org/debian/pool/non-free-firmware/i/intel-microcode/intel-microcode_3.20230808.1_amd64.deb [ -z "$intel_microcode" ] && { whiptail --backtitle "Proxmox VE Helper Scripts" --title "No Microcode Found" --msgbox "It appears there were no microcode packages found\n Try again later." 10 68; msg_info "Exiting"; sleep 1; msg_ok "Done"; exit; }
msg_ok "Downloaded the latest Intel Processor Microcode Package"
msg_info "Installing the Intel Processor Microcode (Patience)" CTID_MENU=()
dpkg -i intel-microcode_3.20230808.1_amd64.deb &>/dev/null MSG_MAX_LENGTH=0
msg_ok "Installed the Intel Processor Microcode"
while read -r TAG ITEM; do
OFFSET=2
(( ${#ITEM} + OFFSET > MSG_MAX_LENGTH )) && MSG_MAX_LENGTH=${#ITEM}+OFFSET
CTID_MENU+=("$TAG" "$ITEM " "OFF")
done < <(echo "$intel_microcode")
microcode=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Current Microcode revision:${current_microcode}" --radiolist "\nSelect a microcode package to install:\n" 16 $((MSG_MAX_LENGTH + 58)) 6 "${CTID_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"') || exit
[ -z "$microcode" ] && { whiptail --backtitle "Proxmox VE Helper Scripts" --title "No Microcode Selected" --msgbox "It appears that no microcode packages were selected" 10 68; msg_info "Exiting"; sleep 1; msg_ok "Done"; exit; }
msg_info "Downloading the Intel Processor Microcode Package $microcode"
wget -q http://ftp.debian.org/debian/pool/non-free-firmware/i/intel-microcode/$microcode
msg_ok "Downloaded the Intel Processor Microcode Package $microcode"
msg_info "Installing $microcode (Patience)"
dpkg -i $microcode &>/dev/null
msg_ok "Installed $microcode"
msg_info "Cleaning up" msg_info "Cleaning up"
rm intel-microcode_3.20230808.1_amd64.deb rm $microcode
msg_ok "Cleaned" msg_ok "Cleaned"
echo -e "\nIn order to apply the changes, a system reboot will be necessary.\n"
echo -e "\n To apply the changes, the system will need to be rebooted.\n"
} }
amd() { amd() {
msg_info "Downloading the latest AMD Processor Microcode Package for Linux" amd_microcode=$(curl -fsSL "https://ftp.debian.org/debian/pool/non-free-firmware/a/amd64-microcode///" | grep -o 'href="[^"]*amd64.deb"' | sed 's/href="//;s/"//')
wget -q http://ftp.debian.org/debian/pool/non-free-firmware/a/amd64-microcode/amd64-microcode_3.20230808.1.1_amd64.deb
msg_ok "Downloaded the latest AMD Processor Microcode Package"
msg_info "Installing the AMD Processor Microcode (Patience)" [ -z "$amd_microcode" ] && { whiptail --backtitle "Proxmox VE Helper Scripts" --title "No Microcode Found" --msgbox "It appears there were no microcode packages found\n Try again later." 10 68; msg_info "Exiting"; sleep 1; msg_ok "Done"; exit; }
dpkg -i amd64-microcode_3.20230808.1.1_amd64.deb &>/dev/null
msg_ok "Installed the AMD Processor Microcode" CTID_MENU=()
MSG_MAX_LENGTH=0
while read -r TAG ITEM; do
OFFSET=2
(( ${#ITEM} + OFFSET > MSG_MAX_LENGTH )) && MSG_MAX_LENGTH=${#ITEM}+OFFSET
CTID_MENU+=("$TAG" "$ITEM " "OFF")
done < <(echo "$amd_microcode")
microcode=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Current Microcode revision:${current_microcode}" --radiolist "\nSelect a microcode package to install:\n" 16 $((MSG_MAX_LENGTH + 58)) 6 "${CTID_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"') || exit
[ -z "$microcode" ] && { whiptail --backtitle "Proxmox VE Helper Scripts" --title "No Microcode Selected" --msgbox "It appears that no microcode packages were selected" 10 68; msg_info "Exiting"; sleep 1; msg_ok "Done"; exit; }
msg_info "Downloading the AMD Processor Microcode Package $microcode"
wget -q https://ftp.debian.org/debian/pool/non-free-firmware/a/amd64-microcode/$microcode
msg_ok "Downloaded the AMD Processor Microcode Package $microcode"
msg_info "Installing $microcode (Patience)"
dpkg -i $microcode &>/dev/null
msg_ok "Installed $microcode"
msg_info "Cleaning up" msg_info "Cleaning up"
rm amd64-microcode_3.20230808.1.1_amd64.deb rm $microcode
msg_ok "Cleaned" msg_ok "Cleaned"
echo -e "\nIn order to apply the changes, a system reboot will be necessary.\n"
echo -e "\n To apply the changes, the system will need to be rebooted.\n"
} }
if ! command -v pveversion >/dev/null 2>&1; then if ! command -v pveversion >/dev/null 2>&1; then header_info; msg_error "No PVE Detected!"; exit; fi
header_info
msg_error "\n No PVE Detected!\n" whiptail --backtitle "Proxmox VE Helper Scripts" --title "Proxmox VE Processor Microcode" --yesno "This will check for CPU microcode packages with the option to install. Proceed?" 10 58 || exit
exit
fi
msg_info "Checking CPU Vendor" msg_info "Checking CPU Vendor"
cpu=$(lscpu | grep -oP 'Vendor ID:\s*\K\S+' | head -n 1) cpu=$(lscpu | grep -oP 'Vendor ID:\s*\K\S+' | head -n 1)
if [ "$cpu" == "GenuineIntel" ]; then if [ "$cpu" == "GenuineIntel" ]; then
msg_ok "${cpu} was detected" msg_ok "${cpu} was detected"
sleep 1
intel intel
elif [ "$cpu" == "AuthenticAMD" ]; then elif [ "$cpu" == "AuthenticAMD" ]; then
msg_ok "${cpu} was detected" msg_ok "${cpu} was detected"
sleep 1
amd amd
else else
msg_error "${cpu} is not supported" msg_error "${cpu} is not supported"