forked from forkanization/Proxmox-arm64
Merge remote-tracking branch 'upstream/main'
This commit is contained in:
16
CHANGELOG.md
16
CHANGELOG.md
@@ -10,6 +10,22 @@
|
||||
- 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.
|
||||
- 🚨 **The scripts in the repository will no longer provide support for Proxmox VE 7 starting from July 2024 (scripts will not execute on PVE7). Subsequent <a href='https://forum.proxmox.com/threads/proxmox-ve-support-lifecycle.35755/' target='_blank' rel='noopener noreferrer'>Proxmox VE - Support Lifecycle</a>**
|
||||
|
||||
## 2024-05-08
|
||||
|
||||
### Changed
|
||||
|
||||
- **Kernel Pin**
|
||||
- NEW Script
|
||||
- **Home Assistant Core LXC**
|
||||
- Ubuntu 24.04 ONLY
|
||||
|
||||
## 2024-05-07
|
||||
|
||||
### Changed
|
||||
|
||||
- **Pocketbase LXC**
|
||||
- NEW Script
|
||||
|
||||
## 2024-05-05
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -22,8 +22,8 @@ APP="Home Assistant-Core"
|
||||
var_disk="8"
|
||||
var_cpu="2"
|
||||
var_ram="1024"
|
||||
var_os="debian"
|
||||
var_version="12"
|
||||
var_os="ubuntu"
|
||||
var_version="24.04"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
@@ -29,7 +29,7 @@ color
|
||||
catch_errors
|
||||
|
||||
function default_settings() {
|
||||
CT_TYPE="0"
|
||||
CT_TYPE="1"
|
||||
PW=""
|
||||
CT_ID=$NEXTID
|
||||
HN=$NSAPP
|
||||
|
||||
@@ -59,7 +59,6 @@ function update_script() {
|
||||
exit
|
||||
fi
|
||||
RELEASE=$(curl -s https://api.github.com/repos/paperless-ngx/paperless-ngx/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||
SER=/etc/systemd/system/paperless-task-queue.service
|
||||
|
||||
UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 2 \
|
||||
"1" "Update Paperless-ngx to $RELEASE" ON \
|
||||
@@ -67,65 +66,38 @@ function update_script() {
|
||||
3>&1 1>&2 2>&3)
|
||||
header_info
|
||||
if [ "$UPD" == "1" ]; then
|
||||
msg_info "Stopping Paperless-ngx"
|
||||
systemctl stop paperless-consumer paperless-webserver paperless-scheduler
|
||||
if [ -f "$SER" ]; then
|
||||
systemctl stop paperless-task-queue.service
|
||||
fi
|
||||
sleep 1
|
||||
msg_ok "Stopped Paperless-ngx"
|
||||
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
|
||||
msg_info "Stopping all Paperless-ngx Services"
|
||||
systemctl stop paperless-consumer paperless-webserver paperless-scheduler paperless-task-queue.service
|
||||
msg_ok "Stopped all Paperless-ngx Services"
|
||||
|
||||
msg_info "Updating to ${RELEASE}"
|
||||
cd ~
|
||||
if [ "$(dpkg -l | awk '/libmariadb-dev-compat/ {print }' | wc -l)" != 1 ]; then apt-get install -y libmariadb-dev-compat; fi &>/dev/null
|
||||
wget https://github.com/paperless-ngx/paperless-ngx/releases/download/$RELEASE/paperless-ngx-$RELEASE.tar.xz &>/dev/null
|
||||
tar -xf paperless-ngx-$RELEASE.tar.xz &>/dev/null
|
||||
cp -r /opt/paperless/paperless.conf paperless-ngx/
|
||||
cp -r paperless-ngx/* /opt/paperless/
|
||||
cd /opt/paperless
|
||||
pip install -r requirements.txt &>/dev/null
|
||||
cd /opt/paperless/src
|
||||
/usr/bin/python3 manage.py migrate &>/dev/null
|
||||
if [ -f "$SER" ]; then
|
||||
msg_ok "paperless-task-queue.service Exists."
|
||||
msg_info "Updating to ${RELEASE}"
|
||||
cd ~
|
||||
wget -q https://github.com/paperless-ngx/paperless-ngx/releases/download/$RELEASE/paperless-ngx-$RELEASE.tar.xz
|
||||
tar -xf paperless-ngx-$RELEASE.tar.xz
|
||||
cp -r /opt/paperless/paperless.conf paperless-ngx/
|
||||
cp -r paperless-ngx/* /opt/paperless/
|
||||
cd /opt/paperless
|
||||
pip install -r requirements.txt &>/dev/null
|
||||
cd /opt/paperless/src
|
||||
/usr/bin/python3 manage.py migrate &>/dev/null
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
msg_ok "Updated to ${RELEASE}"
|
||||
|
||||
msg_info "Cleaning up"
|
||||
cd ~
|
||||
rm paperless-ngx-$RELEASE.tar.xz
|
||||
rm -rf paperless-ngx
|
||||
msg_ok "Cleaned"
|
||||
|
||||
msg_info "Starting all Paperless-ngx Services"
|
||||
systemctl start paperless-consumer paperless-webserver paperless-scheduler paperless-task-queue.service
|
||||
sleep 1
|
||||
msg_ok "Started all Paperless-ngx Services"
|
||||
msg_ok "Updated Successfully!\n"
|
||||
else
|
||||
cat <<EOF >/etc/systemd/system/paperless-task-queue.service
|
||||
[Unit]
|
||||
Description=Paperless Celery Workers
|
||||
Requires=redis.service
|
||||
[Service]
|
||||
WorkingDirectory=/opt/paperless/src
|
||||
ExecStart=celery --app paperless worker --loglevel INFO
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable paperless-task-queue &>/dev/null
|
||||
msg_ok "paperless-task-queue.service Created."
|
||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||
fi
|
||||
cat <<EOF >/etc/systemd/system/paperless-scheduler.service
|
||||
[Unit]
|
||||
Description=Paperless Celery beat
|
||||
Requires=redis.service
|
||||
[Service]
|
||||
WorkingDirectory=/opt/paperless/src
|
||||
ExecStart=celery --app paperless beat --loglevel INFO
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
msg_ok "Updated to ${RELEASE}"
|
||||
|
||||
msg_info "Cleaning up"
|
||||
cd ~
|
||||
rm paperless-ngx-$RELEASE.tar.xz
|
||||
rm -rf paperless-ngx
|
||||
msg_ok "Cleaned"
|
||||
|
||||
msg_info "Starting Paperless-ngx"
|
||||
systemctl daemon-reload
|
||||
systemctl start paperless-consumer paperless-webserver paperless-scheduler paperless-task-queue.service
|
||||
sleep 1
|
||||
msg_ok "Started Paperless-ngx"
|
||||
msg_ok "Updated Successfully!\n"
|
||||
exit
|
||||
fi
|
||||
if [ "$UPD" == "2" ]; then
|
||||
|
||||
61
ct/pocketbase.sh
Normal file
61
ct/pocketbase.sh
Normal file
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func)
|
||||
# Copyright (c) 2021-2024 tteck
|
||||
# Author: tteck (tteckster)
|
||||
# License: MIT
|
||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
||||
|
||||
function header_info {
|
||||
clear
|
||||
cat <<"EOF"
|
||||
____ __ __ __
|
||||
/ __ \____ _____/ /_____ / /_/ /_ ____ _________
|
||||
/ /_/ / __ \/ ___/ //_/ _ \/ __/ __ \/ __ `/ ___/ _ \
|
||||
/ ____/ /_/ / /__/ ,< / __/ /_/ /_/ / /_/ (__ ) __/
|
||||
/_/ \____/\___/_/|_|\___/\__/_.___/\__,_/____/\___/
|
||||
|
||||
EOF
|
||||
}
|
||||
header_info
|
||||
echo -e "Loading..."
|
||||
APP="Pocketbase"
|
||||
var_disk="8"
|
||||
var_cpu="1"
|
||||
var_ram="512"
|
||||
var_os="ubuntu"
|
||||
var_version="22.04"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function default_settings() {
|
||||
CT_TYPE="1"
|
||||
PW=""
|
||||
CT_ID=$NEXTID
|
||||
HN=$NSAPP
|
||||
DISK_SIZE="$var_disk"
|
||||
CORE_COUNT="$var_cpu"
|
||||
RAM_SIZE="$var_ram"
|
||||
BRG="vmbr0"
|
||||
NET="dhcp"
|
||||
GATE=""
|
||||
APT_CACHER=""
|
||||
APT_CACHER_IP=""
|
||||
DISABLEIP6="no"
|
||||
MTU=""
|
||||
SD=""
|
||||
NS=""
|
||||
MAC=""
|
||||
VLAN=""
|
||||
SSH="no"
|
||||
VERB="no"
|
||||
echo_default
|
||||
}
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
|
||||
msg_ok "Completed Successfully!\n"
|
||||
echo -e "${APP} should be reachable by going to the following URL.
|
||||
${BL}http://${IP}:8080/_${CL}"
|
||||
@@ -29,7 +29,7 @@ color
|
||||
catch_errors
|
||||
|
||||
function default_settings() {
|
||||
CT_TYPE="0"
|
||||
CT_TYPE="1"
|
||||
PW=""
|
||||
CT_ID=$NEXTID
|
||||
HN=$NSAPP
|
||||
|
||||
@@ -43,8 +43,6 @@ if [[ "$CTTYPE" == "0" ]]; then
|
||||
chgrp video /dev/dri
|
||||
chmod 755 /dev/dri
|
||||
chmod 660 /dev/dri/*
|
||||
$STD adduser $(id -u -n) video
|
||||
$STD adduser $(id -u -n) render
|
||||
fi
|
||||
msg_ok "Set Up Hardware Acceleration"
|
||||
|
||||
|
||||
@@ -14,68 +14,15 @@ network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies (Patience)"
|
||||
$STD apt-get install -y \
|
||||
git \
|
||||
curl \
|
||||
sudo \
|
||||
mc \
|
||||
bluez \
|
||||
libffi-dev \
|
||||
libssl-dev \
|
||||
libjpeg-dev \
|
||||
zlib1g-dev \
|
||||
autoconf \
|
||||
build-essential \
|
||||
libopenjp2-7 \
|
||||
libturbojpeg0-dev \
|
||||
ffmpeg \
|
||||
liblapack3 \
|
||||
liblapack-dev \
|
||||
dbus-broker \
|
||||
libpcap-dev \
|
||||
libavdevice-dev \
|
||||
libavformat-dev \
|
||||
libavcodec-dev \
|
||||
libavutil-dev \
|
||||
libavfilter-dev \
|
||||
libmariadb-dev-compat \
|
||||
libatlas-base-dev \
|
||||
wget
|
||||
$STD apt-get install -y {git,curl,sudo,mc,bluez,libffi-dev,libssl-dev,libjpeg-dev,zlib1g-dev,autoconf,build-essential,libopenjp2-7,libturbojpeg0-dev,ffmpeg,liblapack3,liblapack-dev,dbus-broker,libpcap-dev,libavdevice-dev,libavformat-dev,libavcodec-dev,libavutil-dev,libavfilter-dev,libmariadb-dev-compat,libatlas-base-dev,python3-pip,python3.12-venv,wget}
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
#RELEASE=$(curl -s https://www.python.org/downloads/ | grep -oP 'Download Python \K\d+\.\d+\.\d+' | head -1)
|
||||
|
||||
msg_info "Compiling Python 3.12 from its source (Additional Patience)"
|
||||
$STD apt-get remove -y python3
|
||||
$STD apt-get install -y \
|
||||
checkinstall \
|
||||
libreadline-dev \
|
||||
libncursesw5-dev \
|
||||
libssl-dev \
|
||||
libsqlite3-dev \
|
||||
tk-dev \
|
||||
libgdbm-dev \
|
||||
libc6-dev \
|
||||
libbz2-dev
|
||||
|
||||
#wget -qO- https://www.python.org/ftp/python/${RELEASE}/Python-${RELEASE}.tar.xz | tar -xJ
|
||||
wget -qO- https://www.python.org/ftp/python/3.12.2/Python-3.12.2.tar.xz | tar -xJ
|
||||
cd Python-3.12.2
|
||||
$STD ./configure --enable-optimizations
|
||||
$STD make -j $(nproc)
|
||||
$STD make altinstall
|
||||
$STD update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.12 1
|
||||
cd ~
|
||||
rm -rf Python-3.12.2
|
||||
msg_ok "Installed Python 3.12"
|
||||
rm -rf /usr/local/bin/python3.*/EXTERNALLY-MANAGED
|
||||
|
||||
msg_info "Installing Home Assistant-Core"
|
||||
mkdir /srv/homeassistant
|
||||
cd /srv/homeassistant
|
||||
python3 -m venv .
|
||||
source bin/activate
|
||||
$STD pip install --upgrade pip
|
||||
$STD pip install webrtcvad
|
||||
$STD python3 -m pip install wheel
|
||||
$STD pip install homeassistant
|
||||
$STD pip install mysqlclient
|
||||
@@ -97,7 +44,7 @@ RestartForceExitStatus=100
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
$STD systemctl enable --now homeassistant
|
||||
systemctl enable -q --now homeassistant
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
|
||||
@@ -13,15 +13,6 @@ setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Python3"
|
||||
$STD apt-get install -y --no-install-recommends \
|
||||
python3 \
|
||||
python3-pip \
|
||||
python3-dev \
|
||||
python3-setuptools \
|
||||
python3-wheel
|
||||
msg_ok "Installed Python3"
|
||||
|
||||
msg_info "Installing Dependencies (Patience)"
|
||||
$STD apt-get install -y --no-install-recommends \
|
||||
redis \
|
||||
@@ -50,6 +41,15 @@ $STD apt-get install -y --no-install-recommends \
|
||||
wget
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Installing Python3 Dependencies"
|
||||
$STD apt-get install -y --no-install-recommends \
|
||||
python3 \
|
||||
python3-pip \
|
||||
python3-dev \
|
||||
python3-setuptools \
|
||||
python3-wheel
|
||||
msg_ok "Installed Python3 Dependencies"
|
||||
|
||||
msg_info "Installing OCR Dependencies (Patience)"
|
||||
$STD apt-get install -y --no-install-recommends \
|
||||
unpaper \
|
||||
@@ -92,6 +92,7 @@ sed -i -e "s|#PAPERLESS_CONSUMPTION_DIR=../consume|PAPERLESS_CONSUMPTION_DIR=/op
|
||||
sed -i -e "s|#PAPERLESS_DATA_DIR=../data|PAPERLESS_DATA_DIR=/opt/paperless/data|" /opt/paperless/paperless.conf
|
||||
sed -i -e "s|#PAPERLESS_MEDIA_ROOT=../media|PAPERLESS_MEDIA_ROOT=/opt/paperless/media|" /opt/paperless/paperless.conf
|
||||
sed -i -e "s|#PAPERLESS_STATICDIR=../static|PAPERLESS_STATICDIR=/opt/paperless/static|" /opt/paperless/paperless.conf
|
||||
echo "${Paperlessngx}" >/opt/${APPLICATION}_version.txt
|
||||
msg_ok "Installed Paperless-ngx"
|
||||
|
||||
msg_info "Installing Natural Language Toolkit (Patience)"
|
||||
@@ -99,13 +100,15 @@ $STD python3 -m nltk.downloader -d /usr/share/nltk_data all
|
||||
msg_ok "Installed Natural Language Toolkit"
|
||||
|
||||
msg_info "Setting up PostgreSQL database"
|
||||
export LC_ALL=C.UTF-8
|
||||
DB_NAME=paperlessdb
|
||||
DB_USER=paperless
|
||||
DB_PASS="$(openssl rand -base64 18 | cut -c1-13)"
|
||||
SECRET_KEY="$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)"
|
||||
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
|
||||
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER TEMPLATE template0;"
|
||||
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;"
|
||||
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
|
||||
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
|
||||
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'"
|
||||
echo "" >>~/paperless.creds
|
||||
echo -e "Paperless-ngx Database User: \e[32m$DB_USER\e[0m" >>~/paperless.creds
|
||||
echo -e "Paperless-ngx Database Password: \e[32m$DB_PASS\e[0m" >>~/paperless.creds
|
||||
|
||||
54
install/pocketbase-install.sh
Normal file
54
install/pocketbase-install.sh
Normal file
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2024 tteck
|
||||
# Author: tteck (tteckster)
|
||||
# License: MIT
|
||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
||||
|
||||
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y curl
|
||||
$STD apt-get install -y sudo
|
||||
$STD apt-get install -y mc
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Installing Pocketbase"
|
||||
RELEASE=$(curl -s https://api.github.com/repos/pocketbase/pocketbase/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
wget -q https://github.com/pocketbase/pocketbase/releases/download/v${RELEASE}/pocketbase_${RELEASE}_linux_amd64.zip -O /tmp/pocketbase.zip
|
||||
mkdir -p /opt/pocketbase/{pb_public,pb_migrations,pb_hooks}
|
||||
unzip -q -o /tmp/pocketbase.zip -d /opt/pocketbase
|
||||
|
||||
cat <<EOF >/etc/systemd/system/pocketbase.service
|
||||
[Unit]
|
||||
Description = pocketbase
|
||||
|
||||
[Service]
|
||||
Type = simple
|
||||
LimitNOFILE = 4096
|
||||
Restart = always
|
||||
RestartSec = 5s
|
||||
StandardOutput = append:/opt/pocketbase/errors.log
|
||||
StandardError = append:/opt/pocketbase/errors.log
|
||||
ExecStart = /opt/pocketbase/pocketbase serve --http=0.0.0.0:8080
|
||||
|
||||
[Install]
|
||||
WantedBy = multi-user.target
|
||||
EOF
|
||||
|
||||
systemctl enable -q --now pocketbase.service
|
||||
msg_ok "Installed Pocketbase"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
@@ -1,168 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2024 tteck
|
||||
# Author: tteck (tteckster)
|
||||
# License: MIT
|
||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
||||
|
||||
# bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/edge-kernel.sh)"
|
||||
function header_info {
|
||||
cat <<"EOF"
|
||||
____ _ ________ ______ __ __ __ __
|
||||
/ __ \ | / / ____/ / ____/___/ /___ ____ / //_/__ _________ ___ / /____
|
||||
/ /_/ / | / / __/ / __/ / __ / __ `/ _ \ / ,< / _ \/ ___/ __ \/ _ \/ / ___/
|
||||
/ ____/| |/ / /___ / /___/ /_/ / /_/ / __/ / /| / __/ / / / / / __/ (__ )
|
||||
/_/ |___/_____/ /_____/\__,_/\__, /\___/ /_/ |_\___/_/ /_/ /_/\___/_/____/
|
||||
/____/
|
||||
|
||||
EOF
|
||||
}
|
||||
set -e
|
||||
KERNEL_ON=$(uname -r)
|
||||
PVE_KERNEL=$(dpkg --list | grep 'kernel-.*-pve' | awk '{print substr($2, 12, length($2)-1) }' | tac | head -n 1)
|
||||
EDGE_KERNEL=$(dpkg --list | grep 'kernel-.*-edge' | awk '{print substr($2, 12, length($2)-1) }' | tac | head -n 1)
|
||||
VER=$(curl -s https://api.github.com/repos/fabianishere/pve-edge-kernel/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-9) }')
|
||||
KER=$(curl -s https://api.github.com/repos/fabianishere/pve-edge-kernel/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-6) }')
|
||||
clear
|
||||
header_info
|
||||
while true; do
|
||||
read -p "This is a Proxmox Edge Kernel Tool, USE AT YOUR OWN RISK. Proceed(y/n)?" yn
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*) exit ;;
|
||||
*) echo "Please answer yes or no." ;;
|
||||
esac
|
||||
done
|
||||
clear
|
||||
header_info
|
||||
show_menu() {
|
||||
normal=$(echo "\033[m")
|
||||
safe=$(echo "\033[32m")
|
||||
menu=$(echo "\033[36m")
|
||||
number=$(echo "\033[33m")
|
||||
bgred=$(echo "\033[41m")
|
||||
fgred=$(echo "\033[31m")
|
||||
proxmox-boot-tool kernel list
|
||||
echo -e "\nCurrent Kernel: ${menu}${KERNEL_ON}${normal}"
|
||||
printf "\n${menu}*********************************************${normal}\n"
|
||||
printf "${menu}**${number} 1)${normal} Install Proxmox Edge Kernel ${menu}${KER}${normal} & Reboot\n"
|
||||
printf "${menu}**${number} 2)${normal} Switch to Proxmox VE 7 ${menu}${PVE_KERNEL}${normal} Kernel & Reboot\n"
|
||||
printf "${menu}**${number} 3)${normal} Switch to Proxmox Edge ${menu}${EDGE_KERNEL}${normal} Kernel & Reboot\n"
|
||||
printf "${menu}**${number} 4)${normal} Unpin Current Kernel\n"
|
||||
printf "${menu}**${number} 5)${normal} Remove All Current ${menu}${VER}*${normal} Proxmox Edge Kernels & Reboot\n"
|
||||
printf "${menu}*********************************************${normal}\n"
|
||||
printf "Please choose an option from the menu, or ${fgred}x${normal} to exit."
|
||||
read opt
|
||||
}
|
||||
option_picked() {
|
||||
msgcolor=$(echo "\033[01;31m")
|
||||
normal=$(echo "\033[00;00m")
|
||||
message=${@:-"${normal}Error: No message passed"}
|
||||
printf "${msgcolor}${message}${normal}\n"
|
||||
}
|
||||
clear
|
||||
header_info
|
||||
show_menu
|
||||
while [ "$opt" != "" ]; do
|
||||
if [ "$opt" = "" ]; then
|
||||
exit
|
||||
else
|
||||
case $opt in
|
||||
1)
|
||||
while true; do
|
||||
read -p "Are you sure you want to Install Proxmox Edge Kernel & Reboot? Proceed(y/n)?" yn
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*) exit ;;
|
||||
*) echo "Please answer yes or no." ;;
|
||||
esac
|
||||
done
|
||||
clear
|
||||
option_picked "Installing Proxmox Edge Kernel & Rebooting"
|
||||
apt-get install -y gnupg
|
||||
curl -1sLf 'https://dl.cloudsmith.io/public/pve-edge/kernel/gpg.8EC01CCF309B98E7.key' | apt-key add -
|
||||
echo "deb https://dl.cloudsmith.io/public/pve-edge/kernel/deb/debian bullseye main" >/etc/apt/sources.list.d/pve-edge-kernel.list
|
||||
apt-get -y update
|
||||
apt-get -y install pve-kernel-${VER}-edge
|
||||
reboot
|
||||
break
|
||||
;;
|
||||
2)
|
||||
while true; do
|
||||
read -p "Are you sure you want to Switch to Proxmox VE 7 ${PVE_KERNEL} Kernel & Reboot? Proceed(y/n)?" yn
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*) exit ;;
|
||||
*) echo "Please answer yes or no." ;;
|
||||
esac
|
||||
done
|
||||
clear
|
||||
option_picked "Switching to Proxmox VE 7 Kernel & Rebooting"
|
||||
proxmox-boot-tool kernel pin ${PVE_KERNEL}
|
||||
reboot
|
||||
break
|
||||
;;
|
||||
3)
|
||||
while true; do
|
||||
read -p "Are you sure you want to Switch to Proxmox ${EDGE_KERNEL} Edge Kernel & Reboot? Proceed(y/n)?" yn
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*) exit ;;
|
||||
*) echo "Please answer yes or no." ;;
|
||||
esac
|
||||
done
|
||||
clear
|
||||
option_picked "Switching to Proxmox Edge Kernel & Rebooting"
|
||||
proxmox-boot-tool kernel pin ${EDGE_KERNEL}
|
||||
reboot
|
||||
break
|
||||
;;
|
||||
4)
|
||||
while true; do
|
||||
read -p "Are you sure you want to Unpin the Current Kernel? Proceed(y/n)?" yn
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*) exit ;;
|
||||
*) echo "Please answer yes or no." ;;
|
||||
esac
|
||||
done
|
||||
clear
|
||||
option_picked "Unpinning Current Kernel"
|
||||
proxmox-boot-tool kernel unpin
|
||||
clear
|
||||
break
|
||||
;;
|
||||
5)
|
||||
while true; do
|
||||
read -p "Are you sure you want to Remove Proxmox Edge Kernel & Reboot? Proceed(y/n)?" yn
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*) exit ;;
|
||||
*) echo "Please answer yes or no." ;;
|
||||
esac
|
||||
done
|
||||
clear
|
||||
option_picked "Removing Proxmox Edge Kernel & Rebooting"
|
||||
apt --purge remove -y pve-kernel-${VER}*edge pve-headers-${VER}*edge
|
||||
rm -rf /etc/apt/sources.list.d/pve-edge-kernel.list
|
||||
proxmox-boot-tool kernel unpin
|
||||
reboot
|
||||
break
|
||||
;;
|
||||
x)
|
||||
exit
|
||||
;;
|
||||
\n)
|
||||
exit
|
||||
;;
|
||||
*)
|
||||
clear
|
||||
option_picked "Please choose an option from the menu"
|
||||
header_info
|
||||
show_menu
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
header_info
|
||||
show_menu
|
||||
70
misc/kernel-pin.sh
Normal file
70
misc/kernel-pin.sh
Normal file
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2024 tteck
|
||||
# Author: tteck (tteckster)
|
||||
# License: MIT
|
||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
||||
|
||||
function header_info {
|
||||
clear
|
||||
cat <<"EOF"
|
||||
__ __ __ ____ _
|
||||
/ //_/__ _________ ___ / / / __ \(_)___
|
||||
/ ,< / _ \/ ___/ __ \/ _ \/ / / /_/ / / __ \
|
||||
/ /| / __/ / / / / / __/ / / ____/ / / / /
|
||||
/_/ |_\___/_/ /_/ /_/\___/_/ /_/ /_/_/ /_/
|
||||
|
||||
EOF
|
||||
}
|
||||
YW=$(echo "\033[33m")
|
||||
RD=$(echo "\033[01;31m")
|
||||
GN=$(echo "\033[1;92m")
|
||||
CL=$(echo "\033[m")
|
||||
BFR="\\r\\033[K"
|
||||
HOLD="-"
|
||||
CM="${GN}✓${CL}"
|
||||
current_kernel=$(uname -r)
|
||||
available_kernels=$(dpkg --list | grep 'kernel-.*-pve' | awk '{print substr($2, 16, length($2)-22)}')
|
||||
header_info
|
||||
|
||||
function msg_info() {
|
||||
local msg="$1"
|
||||
echo -ne " ${HOLD} ${YW}${msg}..."
|
||||
}
|
||||
|
||||
function msg_ok() {
|
||||
local msg="$1"
|
||||
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
|
||||
}
|
||||
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "Proxmox VE Kernel Pin" --yesno "This will Pin/Unpin Kernel Images, Proceed?" 10 68 || exit
|
||||
|
||||
KERNEL_MENU=()
|
||||
MSG_MAX_LENGTH=0
|
||||
while read -r TAG ITEM; do
|
||||
OFFSET=2
|
||||
((${#ITEM} + OFFSET > MSG_MAX_LENGTH)) && MSG_MAX_LENGTH=${#ITEM}+OFFSET
|
||||
KERNEL_MENU+=("$TAG" "$ITEM " "OFF")
|
||||
done < <(echo "$available_kernels")
|
||||
|
||||
pin_kernel=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Current Kernel $current_kernel" --radiolist "\nSelect Kernel to pin:\nCancel to Unpin any Kernel" 16 $((MSG_MAX_LENGTH + 58)) 6 "${KERNEL_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"') || exit
|
||||
[ -z "$pin_kernel" ] && {
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "No Kernel Selected" --msgbox "It appears that no Kernel was selected\nUnpinning any pinned Kernel" 10 68
|
||||
msg_info "Unpinning any Kernel"
|
||||
proxmox-boot-tool kernel unpin &>/dev/null
|
||||
msg_ok "Unpinned any Kernel\n"
|
||||
proxmox-boot-tool kernel list
|
||||
echo ""
|
||||
msg_ok "Finished\n"
|
||||
echo -e "${RD} REBOOT${CL}"
|
||||
exit
|
||||
}
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "Proxmox VE Kernel Pin" --yesno "Would you like to pin the $pin_kernel Kernel?" 10 68 || exit
|
||||
|
||||
msg_info "Pinning $pin_kernel"
|
||||
proxmox-boot-tool kernel pin $pin_kernel &>/dev/null
|
||||
msg_ok "Successfully Pinned $pin_kernel\n"
|
||||
proxmox-boot-tool kernel list
|
||||
echo ""
|
||||
msg_ok "Finished\n"
|
||||
echo -e "${RD} REBOOT${CL}"
|
||||
@@ -22,7 +22,7 @@ function update_container() {
|
||||
alpine) pct exec "$container" -- ash -c "apk update && apk upgrade" ;;
|
||||
archlinux) pct exec "$container" -- bash -c "pacman -Syyu --noconfirm" ;;
|
||||
fedora | rocky | centos | alma) pct exec "$container" -- bash -c "dnf -y update && dnf -y upgrade" ;;
|
||||
ubuntu | debian | devuan) pct exec "$container" -- bash -c "apt-get update 2>/dev/null | grep 'packages.*upgraded'; apt list --upgradable && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" dist-upgrade -y" ;;
|
||||
ubuntu | debian | devuan) pct exec "$container" -- bash -c "apt-get update 2>/dev/null | grep 'packages.*upgraded'; apt-get upgrade --dry-run && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" dist-upgrade -y" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user