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.
## 2023-09-14
### Changed
- **Proxmox VE Processor Microcode**
- Allow users to select available microcode packages.
## 2023-09-13
### Changed

View File

@ -30,7 +30,7 @@ msg_info "Installing PostgreSQL"
$STD apt-get update
$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
local all postgres peer
# 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
EOF
cat <<EOF >/etc/postgresql/15/main/postgresql.conf
cat <<EOF >/etc/postgresql/16/main/postgresql.conf
# -----------------------------
# PostgreSQL configuration file
# -----------------------------
@ -58,10 +58,10 @@ cat <<EOF >/etc/postgresql/15/main/postgresql.conf
# FILE LOCATIONS
#------------------------------------------------------------------------------
data_directory = '/var/lib/postgresql/15/main'
hba_file = '/etc/postgresql/15/main/pg_hba.conf'
ident_file = '/etc/postgresql/15/main/pg_ident.conf'
external_pid_file = '/var/run/postgresql/15-main.pid'
data_directory = '/var/lib/postgresql/16/main'
hba_file = '/etc/postgresql/16/main/pg_hba.conf'
ident_file = '/etc/postgresql/16/main/pg_ident.conf'
external_pid_file = '/var/run/postgresql/16-main.pid'
#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
@ -107,7 +107,7 @@ log_timezone = 'Etc/UTC'
# PROCESS TITLE
#------------------------------------------------------------------------------
cluster_name = '15/main'
cluster_name = '16/main'
#------------------------------------------------------------------------------
# CLIENT CONNECTION DEFAULTS

View File

@ -25,90 +25,99 @@ HOLD="-"
CM="${GN}${CL}"
CROSS="${RD}${CL}"
msg_info() {
local msg="$1"
echo -ne " ${HOLD} ${YW}${msg}..."
}
msg_ok() {
local msg="$1"
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
}
msg_error() {
local msg="$1"
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
}
msg_info() { echo -ne " ${HOLD} ${YW}$1..."; }
msg_ok() { echo -e "${BFR} ${CM} ${GN}$1${CL}"; }
msg_error() { echo -e "${BFR} ${CROSS} ${RD}$1${CL}"; }
header_info
current_microcode=$(dmesg | grep -o 'microcode updated early to revision [^,]*, date = [0-9\-]*')
while true; do
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
current_microcode=$(journalctl -k | grep -E "microcode: microcode" | awk -F 'microcode: microcode updated early to revision |, date = ' '{print $2 ", date = " $3}')
[ -z "$current_microcode" ] && current_microcode="Not found."
intel() {
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
msg_ok "Installed iucode-tool"
else
msg_ok "Intel iucode-tool is already installed"
sleep 1
fi
msg_info "Downloading the latest Intel Processor Microcode Package for Linux"
wget -q http://ftp.debian.org/debian/pool/non-free-firmware/i/intel-microcode/intel-microcode_3.20230808.1_amd64.deb
msg_ok "Downloaded the latest Intel Processor Microcode Package"
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/"//')
[ -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_info "Installing the Intel Processor Microcode (Patience)"
dpkg -i intel-microcode_3.20230808.1_amd64.deb &>/dev/null
msg_ok "Installed the Intel 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 "$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"
rm intel-microcode_3.20230808.1_amd64.deb
rm $microcode
msg_ok "Cleaned"
echo -e "\n To apply the changes, the system will need to be rebooted.\n"
echo -e "\nIn order to apply the changes, a system reboot will be necessary.\n"
}
amd() {
msg_info "Downloading the latest AMD Processor Microcode Package for Linux"
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"
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/"//')
msg_info "Installing the AMD Processor Microcode (Patience)"
dpkg -i amd64-microcode_3.20230808.1.1_amd64.deb &>/dev/null
msg_ok "Installed the AMD Processor Microcode"
[ -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; }
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"
rm amd64-microcode_3.20230808.1.1_amd64.deb
rm $microcode
msg_ok "Cleaned"
echo -e "\n To apply the changes, the system will need to be rebooted.\n"
echo -e "\nIn order to apply the changes, a system reboot will be necessary.\n"
}
if ! command -v pveversion >/dev/null 2>&1; then
header_info
msg_error "\n No PVE Detected!\n"
exit
fi
if ! command -v pveversion >/dev/null 2>&1; then header_info; msg_error "No PVE Detected!"; exit; fi
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
msg_info "Checking CPU Vendor"
cpu=$(lscpu | grep -oP 'Vendor ID:\s*\K\S+' | head -n 1)
if [ "$cpu" == "GenuineIntel" ]; then
msg_ok "${cpu} was detected"
sleep 1
intel
elif [ "$cpu" == "AuthenticAMD" ]; then
msg_ok "${cpu} was detected"
sleep 1
amd
else
msg_error "${cpu} is not supported"