Changed from 4 spaces to 2 spaces

# Changed from 4 spaces to 2 spaces

## Description

Just cleaned script codes

Fixes # (issue)
Tabular length changed

## Type of change

Please delete options that are not relevant.

- [x] Bug fix
- [ ] New feature
- [ ] New Script
- [ ] This change requires a documentation update
pull/1652/head^2
X-Anonymous-Y 2 years ago
parent 571c46f8c4
commit 62f71f067a
  1. 166
      install/magicmirror-install.sh
  2. 10
      install/prometheus-install.sh
  3. 10
      install/shinobi-install.sh
  4. 26
      misc/bluetooth.sh
  5. 42
      misc/code-server.sh
  6. 44
      misc/container-restore-from-backup.sh
  7. 44
      misc/core-restore-from-backup.sh
  8. 38
      misc/crowdsec.sh
  9. 252
      misc/edge-kernel.sh
  10. 34
      misc/filebrowser.sh
  11. 154
      misc/kernel-clean.sh
  12. 66
      misc/scaling-governor.sh
  13. 12
      misc/webmin.sh

@ -37,88 +37,92 @@ $STD npm install --only=prod --omit=dev
cat <<EOF >/opt/magicmirror/config/config.js cat <<EOF >/opt/magicmirror/config/config.js
let config = { let config = {
address: "0.0.0.0", address: "0.0.0.0",
port: 8080, port: 8080,
basePath: "/", basePath: "/",
ipWhitelist: [], ipWhitelist: [],
useHttps: false, useHttps: false,
httpsPrivateKey: "", httpsPrivateKey: "",
httpsCertificate: "", httpsCertificate: "",
language: "en", language: "en",
locale: "en-US", locale: "en-US",
logLevel: ["INFO", "LOG", "WARN", "ERROR"], logLevel: [
timeFormat: 24, "INFO",
units: "metric", "LOG",
serverOnly: true, "WARN",
modules: [ "ERROR"],
{ timeFormat: 24,
module: "alert", units: "metric",
}, serverOnly: true,
{ modules: [
module: "updatenotification", {
position: "top_bar" module: "alert",
}, },
{ {
module: "clock", module: "updatenotification",
position: "top_left" position: "top_bar"
}, },
{ {
module: "calendar", module: "clock",
header: "US Holidays", position: "top_left"
position: "top_left", },
config: { {
calendars: [ module: "calendar",
{ header: "US Holidays",
symbol: "calendar-check", position: "top_left",
url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics" config: {
} calendars: [
] {
} symbol: "calendar-check",
}, url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics"
{ }
module: "compliments",
position: "lower_third"
},
{
module: "weather",
position: "top_right",
config: {
weatherProvider: "openweathermap",
type: "current",
location: "New York",
locationID: "5128581", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
apiKey: "YOUR_OPENWEATHER_API_KEY"
}
},
{
module: "weather",
position: "top_right",
header: "Weather Forecast",
config: {
weatherProvider: "openweathermap",
type: "forecast",
location: "New York",
locationID: "5128581", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
apiKey: "YOUR_OPENWEATHER_API_KEY"
}
},
{
module: "newsfeed",
position: "bottom_bar",
config: {
feeds: [
{
title: "New York Times",
url: "https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml"
}
],
showSourceTitle: true,
showPublishDate: true,
broadcastNewsFeeds: true,
broadcastNewsUpdates: true
}
},
] ]
}
},
{
module: "compliments",
position: "lower_third"
},
{
module: "weather",
position: "top_right",
config: {
weatherProvider: "openweathermap",
type: "current",
location: "New York",
locationID: "5128581", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
apiKey: "YOUR_OPENWEATHER_API_KEY"
}
},
{
module: "weather",
position: "top_right",
header: "Weather Forecast",
config: {
weatherProvider: "openweathermap",
type: "forecast",
location: "New York",
locationID: "5128581", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
apiKey: "YOUR_OPENWEATHER_API_KEY"
}
},
{
module: "newsfeed",
position: "bottom_bar",
config: {
feeds: [
{
title: "New York Times",
url: "https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml"
}
],
showSourceTitle: true,
showPublishDate: true,
broadcastNewsFeeds: true,
broadcastNewsUpdates: true
}
},
]
}; };
/*************** DO NOT EDIT THE LINE BELOW ***************/ /*************** DO NOT EDIT THE LINE BELOW ***************/

@ -43,11 +43,11 @@ User=root
Restart=always Restart=always
Type=simple Type=simple
ExecStart=/usr/local/bin/prometheus \ ExecStart=/usr/local/bin/prometheus \
--config.file=/etc/prometheus/prometheus.yml \ --config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/var/lib/prometheus/ \ --storage.tsdb.path=/var/lib/prometheus/ \
--web.console.templates=/etc/prometheus/consoles \ --web.console.templates=/etc/prometheus/consoles \
--web.console.libraries=/etc/prometheus/console_libraries \ --web.console.libraries=/etc/prometheus/console_libraries \
--web.listen-address=0.0.0.0:9090 --web.listen-address=0.0.0.0:9090
[Install] [Install]
WantedBy=multi-user.target" >$service_path WantedBy=multi-user.target" >$service_path

@ -15,11 +15,11 @@ update_os
ubuntuversion=$(lsb_release -r | awk '{print $2}' | cut -d . -f1) ubuntuversion=$(lsb_release -r | awk '{print $2}' | cut -d . -f1)
if [ "$ubuntuversion" = "18" ] || [ "$ubuntuversion" -le "18" ]; then if [ "$ubuntuversion" = "18" ] || [ "$ubuntuversion" -le "18" ]; then
apt install sudo wget -y apt install sudo wget -y
sudo apt install -y software-properties-common sudo apt install -y software-properties-common
sudo add-apt-repository universe -y sudo add-apt-repository universe -y
apt update -y apt update -y
apt update --fix-missing -y apt update --fix-missing -y
fi fi
msg_info "Installing Dependencies" msg_info "Installing Dependencies"

@ -6,19 +6,19 @@
# https://github.com/tteck/Proxmox/raw/main/LICENSE # https://github.com/tteck/Proxmox/raw/main/LICENSE
if command -v pveversion >/dev/null 2>&1; then if command -v pveversion >/dev/null 2>&1; then
echo -e "⚠ Can't Run from the Proxmox Shell" echo -e "⚠ Can't Run from the Proxmox Shell"
exit exit
fi fi
set -e set -e
clear clear
while true; do while true; do
read -p "Start the Bluetooth Integration Preparation (y/n)?" yn read -p "Start the Bluetooth Integration Preparation (y/n)?" yn
case $yn in case $yn in
[Yy]*) break ;; [Yy]*) break ;;
[Nn]*) exit ;; [Nn]*) exit ;;
*) echo "Please answer yes or no." ;; *) echo "Please answer yes or no." ;;
esac esac
done done
clear clear
@ -45,17 +45,17 @@ cat <<"EOF"
EOF EOF
read -r -p "Switch from dbus-daemon to dbus-broker? <y/N> " prompt read -r -p "Switch from dbus-daemon to dbus-broker? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
cat <<EOF >>/etc/apt/sources.list cat <<EOF >>/etc/apt/sources.list
deb http://deb.debian.org/debian bullseye-backports main contrib non-free deb http://deb.debian.org/debian bullseye-backports main contrib non-free
deb-src http://deb.debian.org/debian bullseye-backports main contrib non-free deb-src http://deb.debian.org/debian bullseye-backports main contrib non-free
EOF EOF
apt-get update &>/dev/null apt-get update &>/dev/null
apt-get -t bullseye-backports install -y dbus-broker &>/dev/null apt-get -t bullseye-backports install -y dbus-broker &>/dev/null
systemctl enable dbus-broker.service &>/dev/null systemctl enable dbus-broker.service &>/dev/null
fi fi
read -r -p "Install BlueZ? <y/N> " prompt read -r -p "Install BlueZ? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
apt-get -t bullseye-backports install -y bluez* &>/dev/null apt-get -t bullseye-backports install -y bluez* &>/dev/null
fi fi
echo -e "Finished, reboot for changes to take affect" echo -e "Finished, reboot for changes to take affect"

@ -6,7 +6,7 @@
# https://github.com/tteck/Proxmox/raw/main/LICENSE # https://github.com/tteck/Proxmox/raw/main/LICENSE
function header_info { function header_info {
cat <<"EOF" cat <<"EOF"
______ __ _____ ______ __ _____
/ ____/___ ____/ /__ / ___/___ ______ _____ _____ / ____/___ ____/ /__ / ___/___ ______ _____ _____
/ / / __ \/ __ / _ \ \__ \/ _ \/ ___/ | / / _ \/ ___/ / / / __ \/ __ / _ \ \__ \/ _ \/ ___/ | / / _ \/ ___/
@ -37,36 +37,36 @@ alias die='EXIT=$? LINE=$LINENO error_exit'
trap die ERR trap die ERR
function error_exit() { function error_exit() {
trap - ERR trap - ERR
local reason="Unknown failure occured." local reason="Unknown failure occured."
local msg="${1:-$reason}" local msg="${1:-$reason}"
local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE" local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
echo -e "$flag $msg" 1>&2 echo -e "$flag $msg" 1>&2
exit $EXIT exit $EXIT
} }
clear clear
header_info header_info
if command -v pveversion >/dev/null 2>&1; then if command -v pveversion >/dev/null 2>&1; then
echo -e "⚠ Can't Install on Proxmox " echo -e "⚠ Can't Install on Proxmox "
exit exit
fi fi
while true; do while true; do
read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn
case $yn in case $yn in
[Yy]*) break ;; [Yy]*) break ;;
[Nn]*) exit ;; [Nn]*) exit ;;
*) echo "Please answer yes or no." ;; *) echo "Please answer yes or no." ;;
esac esac
done done
function msg_info() { function msg_info() {
local msg="$1" local msg="$1"
echo -ne " ${HOLD} ${YW}${msg}..." echo -ne " ${HOLD} ${YW}${msg}..."
} }
function msg_ok() { function msg_ok() {
local msg="$1" local msg="$1"
echo -e "${BFR} ${CM} ${GN}${msg}${CL}" echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
} }
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
@ -76,8 +76,8 @@ apt-get install -y git &>/dev/null
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
VERSION=$(curl -s https://api.github.com/repos/coder/code-server/releases/latest | VERSION=$(curl -s https://api.github.com/repos/coder/code-server/releases/latest |
grep "tag_name" | grep "tag_name" |
awk '{print substr($2, 3, length($2)-4) }') awk '{print substr($2, 3, length($2)-4) }')
msg_info "Installing Code-Server v${VERSION}" msg_info "Installing Code-Server v${VERSION}"
curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server_${VERSION}_amd64.deb &>/dev/null curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server_${VERSION}_amd64.deb &>/dev/null

@ -7,8 +7,8 @@
clear clear
if command -v pveversion >/dev/null 2>&1; then if command -v pveversion >/dev/null 2>&1; then
echo -e "⚠ Can't Run from the Proxmox Shell" echo -e "⚠ Can't Run from the Proxmox Shell"
exit exit
fi fi
YW=$(echo "\033[33m") YW=$(echo "\033[33m")
BL=$(echo "\033[36m") BL=$(echo "\033[36m")
@ -23,16 +23,16 @@ CM="${GN}✓${CL}"
CROSS="${RD}${CL}" CROSS="${RD}${CL}"
APP="Home Assistant Container" APP="Home Assistant Container"
while true; do while true; do
read -p "This will restore ${APP} from a backup. Proceed(y/n)?" yn read -p "This will restore ${APP} from a backup. Proceed(y/n)?" yn
case $yn in case $yn in
[Yy]*) break ;; [Yy]*) break ;;
[Nn]*) exit ;; [Nn]*) exit ;;
*) echo "Please answer yes or no." ;; *) echo "Please answer yes or no." ;;
esac esac
done done
clear clear
function header_info { function header_info {
cat <<"EOF" cat <<"EOF"
__ __ ___ _ __ __ __ __ ___ _ __ __
/ / / /___ ____ ___ ___ / | __________(_)____/ /_____ _____ / /_ / / / /___ ____ ___ ___ / | __________(_)____/ /_____ _____ / /_
/ /_/ / __ \/ __ `__ \/ _ \ / /| | / ___/ ___/ / ___/ __/ __ `/ __ \/ __/ / /_/ / __ \/ __ `__ \/ _ \ / /| | / ___/ ___/ / ___/ __/ __ `/ __ \/ __/
@ -45,34 +45,34 @@ EOF
header_info header_info
function msg_info() { function msg_info() {
local msg="$1" local msg="$1"
echo -ne " ${HOLD} ${YW}${msg}..." echo -ne " ${HOLD} ${YW}${msg}..."
} }
function msg_ok() { function msg_ok() {
local msg="$1" local msg="$1"
echo -e "${BFR} ${CM} ${GN}${msg}${CL}" echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
} }
function msg_error() { function msg_error() {
local msg="$1" local msg="$1"
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
} }
if [ -z "$(ls -A /var/lib/docker/volumes/hass_config/_data/backups/)" ]; then if [ -z "$(ls -A /var/lib/docker/volumes/hass_config/_data/backups/)" ]; then
msg_error "No backups found! \n" msg_error "No backups found! \n"
exit 1 exit 1
fi fi
DIR=/var/lib/docker/volumes/hass_config/_data/restore DIR=/var/lib/docker/volumes/hass_config/_data/restore
if [ -d "$DIR" ]; then if [ -d "$DIR" ]; then
msg_ok "Restore Directory Exists." msg_ok "Restore Directory Exists."
else else
mkdir -p /var/lib/docker/volumes/hass_config/_data/restore mkdir -p /var/lib/docker/volumes/hass_config/_data/restore
msg_ok "Created Restore Directory." msg_ok "Created Restore Directory."
fi fi
cd /var/lib/docker/volumes/hass_config/_data/backups/ cd /var/lib/docker/volumes/hass_config/_data/backups/
PS3="Please enter your choice: " PS3="Please enter your choice: "
files="$(ls -A .)" files="$(ls -A .)"
select filename in ${files}; do select filename in ${files}; do
msg_ok "You selected ${BL}${filename}${CL}" msg_ok "You selected ${BL}${filename}${CL}"
break break
done done
msg_info "Stopping Home Assistant" msg_info "Stopping Home Assistant"
docker stop homeassistant &>/dev/null docker stop homeassistant &>/dev/null

@ -7,8 +7,8 @@
clear clear
if command -v pveversion >/dev/null 2>&1; then if command -v pveversion >/dev/null 2>&1; then
echo -e "⚠ Can't Run from the Proxmox Shell" echo -e "⚠ Can't Run from the Proxmox Shell"
exit exit
fi fi
YW=$(echo "\033[33m") YW=$(echo "\033[33m")
BL=$(echo "\033[36m") BL=$(echo "\033[36m")
@ -23,16 +23,16 @@ CM="${GN}✓${CL}"
CROSS="${RD}${CL}" CROSS="${RD}${CL}"
APP="Home Assistant Core" APP="Home Assistant Core"
while true; do while true; do
read -p "This will restore ${APP} from a backup. Proceed(y/n)?" yn read -p "This will restore ${APP} from a backup. Proceed(y/n)?" yn
case $yn in case $yn in
[Yy]*) break ;; [Yy]*) break ;;
[Nn]*) exit ;; [Nn]*) exit ;;
*) echo "Please answer yes or no." ;; *) echo "Please answer yes or no." ;;
esac esac
done done
clear clear
function header_info { function header_info {
cat <<"EOF" cat <<"EOF"
__ __ ___ _ __ __ ______ __ __ ___ _ __ __ ______
/ / / /___ ____ ___ ___ / | __________(_)____/ /_____ _____ / /_ / ____/___ ________ / / / /___ ____ ___ ___ / | __________(_)____/ /_____ _____ / /_ / ____/___ ________
/ /_/ / __ \/ __ `__ \/ _ \ / /| | / ___/ ___/ / ___/ __/ __ `/ __ \/ __/ / / / __ \/ ___/ _ \ / /_/ / __ \/ __ `__ \/ _ \ / /| | / ___/ ___/ / ___/ __/ __ `/ __ \/ __/ / / / __ \/ ___/ _ \
@ -45,34 +45,34 @@ EOF
header_info header_info
function msg_info() { function msg_info() {
local msg="$1" local msg="$1"
echo -ne " ${HOLD} ${YW}${msg}..." echo -ne " ${HOLD} ${YW}${msg}..."
} }
function msg_ok() { function msg_ok() {
local msg="$1" local msg="$1"
echo -e "${BFR} ${CM} ${GN}${msg}${CL}" echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
} }
function msg_error() { function msg_error() {
local msg="$1" local msg="$1"
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
} }
if [ -z "$(ls -A /root/.homeassistant/backups/)" ]; then if [ -z "$(ls -A /root/.homeassistant/backups/)" ]; then
msg_error "No backups found! \n" msg_error "No backups found! \n"
exit 1 exit 1
fi fi
DIR=/root/.homeassistant/restore DIR=/root/.homeassistant/restore
if [ -d "$DIR" ]; then if [ -d "$DIR" ]; then
msg_ok "Restore Directory Exists." msg_ok "Restore Directory Exists."
else else
mkdir -p /root/.homeassistant/restore mkdir -p /root/.homeassistant/restore
msg_ok "Created Restore Directory." msg_ok "Created Restore Directory."
fi fi
cd /root/.homeassistant/backups/ cd /root/.homeassistant/backups/
PS3="Please enter your choice: " PS3="Please enter your choice: "
files="$(ls -A .)" files="$(ls -A .)"
select filename in ${files}; do select filename in ${files}; do
msg_ok "You selected ${BL}${filename}${CL}" msg_ok "You selected ${BL}${filename}${CL}"
break break
done done
msg_info "Stopping Home Assistant" msg_info "Stopping Home Assistant"
sudo service homeassistant stop sudo service homeassistant stop

@ -26,28 +26,28 @@ alias die='EXIT=$? LINE=$LINENO error_exit'
trap die ERR trap die ERR
function error_exit() { function error_exit() {
trap - ERR trap - ERR
local reason="Unknown failure occured." local reason="Unknown failure occured."
local msg="${1:-$reason}" local msg="${1:-$reason}"
local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE" local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
echo -e "$flag $msg" 1>&2 echo -e "$flag $msg" 1>&2
exit $EXIT exit $EXIT
} }
if command -v pveversion >/dev/null 2>&1; then if command -v pveversion >/dev/null 2>&1; then
echo -e "⚠ Can't Install on Proxmox " echo -e "⚠ Can't Install on Proxmox "
exit exit
fi fi
while true; do while true; do
read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn
case $yn in case $yn in
[Yy]*) break ;; [Yy]*) break ;;
[Nn]*) exit ;; [Nn]*) exit ;;
*) echo "Please answer yes or no." ;; *) echo "Please answer yes or no." ;;
esac esac
done done
clear clear
function header_info { function header_info {
echo -e "${BL} echo -e "${BL}
_____ _ _____ _____ _ _____
/ ____| | |/ ____| / ____| | |/ ____|
| | _ __ _____ ____| | (___ ___ ___ | | _ __ _____ ____| | (___ ___ ___
@ -60,13 +60,13 @@ ${CL}"
header_info header_info
function msg_info() { function msg_info() {
local msg="$1" local msg="$1"
echo -ne " ${HOLD} ${YW}${msg}..." echo -ne " ${HOLD} ${YW}${msg}..."
} }
function msg_ok() { function msg_ok() {
local msg="$1" local msg="$1"
echo -e "${BFR} ${CM} ${GN}${msg}${CL}" echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
} }
msg_info "Setting up ${APP} Repository" msg_info "Setting up ${APP} Repository"

@ -7,7 +7,7 @@
# bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/edge-kernel.sh)" # bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/edge-kernel.sh)"
function header_info { function header_info {
cat <<"EOF" cat <<"EOF"
____ _ ________ ______ __ __ __ __ ____ _ ________ ______ __ __ __ __
/ __ \ | / / ____/ / ____/___/ /___ ____ / //_/__ _________ ___ / /____ / __ \ | / / ____/ / ____/___/ /___ ____ / //_/__ _________ ___ / /____
/ /_/ / | / / __/ / __/ / __ / __ `/ _ \ / ,< / _ \/ ___/ __ \/ _ \/ / ___/ / /_/ / | / / __/ / __/ / __ / __ `/ _ \ / ,< / _ \/ ___/ __ \/ _ \/ / ___/
@ -26,143 +26,143 @@ KER=$(curl -s https://api.github.com/repos/fabianishere/pve-edge-kernel/releases
clear clear
header_info header_info
while true; do while true; do
read -p "This is a Proxmox Edge Kernel Tool, USE AT YOUR OWN RISK. Proceed(y/n)?" yn read -p "This is a Proxmox Edge Kernel Tool, USE AT YOUR OWN RISK. Proceed(y/n)?" yn
case $yn in case $yn in
[Yy]*) break ;; [Yy]*) break ;;
[Nn]*) exit ;; [Nn]*) exit ;;
*) echo "Please answer yes or no." ;; *) echo "Please answer yes or no." ;;
esac esac
done done
clear clear
header_info header_info
show_menu() { show_menu() {
normal=$(echo "\033[m") normal=$(echo "\033[m")
safe=$(echo "\033[32m") safe=$(echo "\033[32m")
menu=$(echo "\033[36m") menu=$(echo "\033[36m")
number=$(echo "\033[33m") number=$(echo "\033[33m")
bgred=$(echo "\033[41m") bgred=$(echo "\033[41m")
fgred=$(echo "\033[31m") fgred=$(echo "\033[31m")
proxmox-boot-tool kernel list proxmox-boot-tool kernel list
echo -e "\nCurrent Kernel: ${menu}${KERNEL_ON}${normal}" echo -e "\nCurrent Kernel: ${menu}${KERNEL_ON}${normal}"
printf "\n${menu}*********************************************${normal}\n" printf "\n${menu}*********************************************${normal}\n"
printf "${menu}**${number} 1)${normal} Install Proxmox Edge Kernel ${menu}${KER}${normal} & Reboot\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} 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} 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} 4)${normal} Unpin Current Kernel\n"
printf "${menu}**${number} 5)${normal} Remove All Current ${menu}${VER}*${normal} Proxmox Edge Kernels & Reboot\n" printf "${menu}**${number} 5)${normal} Remove All Current ${menu}${VER}*${normal} Proxmox Edge Kernels & Reboot\n"
printf "${menu}*********************************************${normal}\n" printf "${menu}*********************************************${normal}\n"
printf "Please choose an option from the menu, or ${fgred}x${normal} to exit." printf "Please choose an option from the menu, or ${fgred}x${normal} to exit."
read opt read opt
} }
option_picked() { option_picked() {
msgcolor=$(echo "\033[01;31m") msgcolor=$(echo "\033[01;31m")
normal=$(echo "\033[00;00m") normal=$(echo "\033[00;00m")
message=${@:-"${normal}Error: No message passed"} message=${@:-"${normal}Error: No message passed"}
printf "${msgcolor}${message}${normal}\n" printf "${msgcolor}${message}${normal}\n"
} }
clear clear
header_info header_info
show_menu show_menu
while [ "$opt" != "" ]; do while [ "$opt" != "" ]; do
if [ "$opt" = "" ]; then if [ "$opt" = "" ]; then
exit exit
else else
case $opt in case $opt in
1) 1)
while true; do while true; do
read -p "Are you sure you want to Install Proxmox Edge Kernel & Reboot? Proceed(y/n)?" yn read -p "Are you sure you want to Install Proxmox Edge Kernel & Reboot? Proceed(y/n)?" yn
case $yn in case $yn in
[Yy]*) break ;; [Yy]*) break ;;
[Nn]*) exit ;; [Nn]*) exit ;;
*) echo "Please answer yes or no." ;; *) echo "Please answer yes or no." ;;
esac esac
done done
clear clear
option_picked "Installing Proxmox Edge Kernel & Rebooting" option_picked "Installing Proxmox Edge Kernel & Rebooting"
apt-get install -y gnupg apt-get install -y gnupg
curl -1sLf 'https://dl.cloudsmith.io/public/pve-edge/kernel/gpg.8EC01CCF309B98E7.key' | apt-key add - 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 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 update
apt-get -y install pve-kernel-${VER}-edge apt-get -y install pve-kernel-${VER}-edge
reboot reboot
break break
;; ;;
2) 2)
while true; do while true; do
read -p "Are you sure you want to Switch to Proxmox VE 7 ${PVE_KERNEL} Kernel & Reboot? Proceed(y/n)?" yn read -p "Are you sure you want to Switch to Proxmox VE 7 ${PVE_KERNEL} Kernel & Reboot? Proceed(y/n)?" yn
case $yn in case $yn in
[Yy]*) break ;; [Yy]*) break ;;
[Nn]*) exit ;; [Nn]*) exit ;;
*) echo "Please answer yes or no." ;; *) echo "Please answer yes or no." ;;
esac esac
done done
clear clear
option_picked "Switching to Proxmox VE 7 Kernel & Rebooting" option_picked "Switching to Proxmox VE 7 Kernel & Rebooting"
proxmox-boot-tool kernel pin ${PVE_KERNEL} proxmox-boot-tool kernel pin ${PVE_KERNEL}
reboot reboot
break break
;; ;;
3) 3)
while true; do while true; do
read -p "Are you sure you want to Switch to Proxmox ${EDGE_KERNEL} Edge Kernel & Reboot? Proceed(y/n)?" yn read -p "Are you sure you want to Switch to Proxmox ${EDGE_KERNEL} Edge Kernel & Reboot? Proceed(y/n)?" yn
case $yn in case $yn in
[Yy]*) break ;; [Yy]*) break ;;
[Nn]*) exit ;; [Nn]*) exit ;;
*) echo "Please answer yes or no." ;; *) 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 esac
fi 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 done
header_info header_info
show_menu show_menu

@ -6,7 +6,7 @@
# https://github.com/tteck/Proxmox/raw/main/LICENSE # https://github.com/tteck/Proxmox/raw/main/LICENSE
function header_info { function header_info {
cat <<"EOF" cat <<"EOF"
_______ __ ____ _______ __ ____
/ ____(_) /__ / __ )_________ _ __________ _____ / ____(_) /__ / __ )_________ _ __________ _____
/ /_ / / / _ \/ __ / ___/ __ \ | /| / / ___/ _ \/ ___/ / /_ / / / _ \/ __ / ___/ __ \ | /| / / ___/ _ \/ ___/
@ -37,33 +37,33 @@ alias die='EXIT=$? LINE=$LINENO error_exit'
trap die ERR trap die ERR
function error_exit() { function error_exit() {
trap - ERR trap - ERR
local reason="Unknown failure occured." local reason="Unknown failure occured."
local msg="${1:-$reason}" local msg="${1:-$reason}"
local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE" local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
echo -e "$flag $msg" 1>&2 echo -e "$flag $msg" 1>&2
exit $EXIT exit $EXIT
} }
clear clear
header_info header_info
while true; do while true; do
read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn
case $yn in case $yn in
[Yy]*) break ;; [Yy]*) break ;;
[Nn]*) exit ;; [Nn]*) exit ;;
*) echo "Please answer yes or no." ;; *) echo "Please answer yes or no." ;;
esac esac
done done
clear clear
header_info header_info
function msg_info() { function msg_info() {
local msg="$1" local msg="$1"
echo -ne " ${HOLD} ${YW}${msg}..." echo -ne " ${HOLD} ${YW}${msg}..."
} }
function msg_ok() { function msg_ok() {
local msg="$1" local msg="$1"
echo -e "${BFR} ${CM} ${GN}${msg}${CL}" echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
} }
msg_info "Installing ${APP}" msg_info "Installing ${APP}"

@ -6,7 +6,7 @@
# https://github.com/tteck/Proxmox/raw/main/LICENSE # https://github.com/tteck/Proxmox/raw/main/LICENSE
function header_info { function header_info {
cat <<"EOF" cat <<"EOF"
__ __ __ ________ __ __ __ ________
/ //_/__ _________ ___ / / / ____/ /__ ____ _____ / //_/__ _________ ___ / / / ____/ /__ ____ _____
/ ,< / _ \/ ___/ __ \/ _ \/ / / / / / _ \/ __ `/ __ \ / ,< / _ \/ ___/ __ \/ _ \/ / / / / / _ \/ __ `/ __ \
@ -33,108 +33,108 @@ current_kernel=$(uname -r)
clear clear
header_info header_info
while true; do while true; do
read -p "This will Clean Unused Kernel Images, USE AT YOUR OWN RISK. Proceed(y/n)?" yn read -p "This will Clean Unused Kernel Images, USE AT YOUR OWN RISK. Proceed(y/n)?" yn
case $yn in case $yn in
[Yy]*) break ;; [Yy]*) break ;;
[Nn]*) exit ;; [Nn]*) exit ;;
*) echo -e "${RD}Please answer y/n${CL}" ;; *) echo -e "${RD}Please answer y/n${CL}" ;;
esac esac
done done
clear clear
function msg_info() { function msg_info() {
local msg="$1" local msg="$1"
echo -ne " ${HOLD} ${YW}${msg}..." echo -ne " ${HOLD} ${YW}${msg}..."
} }
function msg_ok() { function msg_ok() {
local msg="$1" local msg="$1"
echo -e "${BFR} ${CM} ${GN}${msg}${CL}" echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
} }
function check_root() { function check_root() {
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
echo -e "${CROSS}${RD}Error: This script must be ran as the root user.\n${CL}" echo -e "${CROSS}${RD}Error: This script must be ran as the root user.\n${CL}"
exit 1 exit 1
else else
header_info header_info
other_kernel other_kernel
kernel_info kernel_info
kernel_clean kernel_clean
fi fi
} }
VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)" VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)"
function other_kernel() { function other_kernel() {
if [[ "${VERSION}" == "bullseye" ]]; then if [[ "${VERSION}" == "bullseye" ]]; then
if [[ "$current_kernel" == *"edge"* ]]; then if [[ "$current_kernel" == *"edge"* ]]; then
echo -e "\n${CROSS} ${RD}ERROR:${CL} Proxmox ${BL}${current_kernel}${CL} Kernel Active" echo -e "\n${CROSS} ${RD}ERROR:${CL} Proxmox ${BL}${current_kernel}${CL} Kernel Active"
echo -e "\nAn Active PVE Kernel is required to use Kernel Clean\n" echo -e "\nAn Active PVE Kernel is required to use Kernel Clean\n"
exit 1 exit 1
fi fi
if [[ "$current_kernel" == *"6.1"* || "$current_kernel" == *"6.2"* ]]; then if [[ "$current_kernel" == *"6.1"* || "$current_kernel" == *"6.2"* ]]; then
echo -e "\n${CROSS} ${RD}ERROR:${CL} Proxmox ${BL}${current_kernel}${CL} Kernel Active" echo -e "\n${CROSS} ${RD}ERROR:${CL} Proxmox ${BL}${current_kernel}${CL} Kernel Active"
echo -e "\nThe script cannot be used when running opt-in kernels. \nProxmox VE's package management relies directly on the current default kernel, which is 5.15. \nTherefore, it is not possible to utilize this script. In this case, you should use autoremove instead. \n$(apt-get autoremove)\n" echo -e "\nThe script cannot be used when running opt-in kernels. \nProxmox VE's package management relies directly on the current default kernel, which is 5.15. \nTherefore, it is not possible to utilize this script. In this case, you should use autoremove instead. \n$(apt-get autoremove)\n"
exit 1 exit 1
fi
fi fi
fi
} }
function kernel_info() { function kernel_info() {
if [[ "$MODE" != "PBS" ]]; then if [[ "$MODE" != "PBS" ]]; then
echo -e "${YW}PVE Version: ${BL}$(pveversion)\n${CL}" echo -e "${YW}PVE Version: ${BL}$(pveversion)\n${CL}"
fi fi
if [[ "$current_kernel" == *"pve"* ]]; then if [[ "$current_kernel" == *"pve"* ]]; then
echo -e "${YW}Current Kernel: ${BL}$current_kernel\n${CL}" echo -e "${YW}Current Kernel: ${BL}$current_kernel\n${CL}"
else else
echo -e "\n${CROSS} ${RD}ERROR: No PVE Kernel Found\n${CL}" echo -e "\n${CROSS} ${RD}ERROR: No PVE Kernel Found\n${CL}"
exit 1 exit 1
fi fi
} }
function kernel_clean() { function kernel_clean() {
kernels=$(dpkg --list | grep 'kernel-.*-pve' | awk '{print $2}' | sort -V) kernels=$(dpkg --list | grep 'kernel-.*-pve' | awk '{print $2}' | sort -V)
remove_kernels="" remove_kernels=""
for kernel in $kernels; do for kernel in $kernels; do
if [ "$(echo $kernel | grep $current_kernel)" ]; then if [ "$(echo $kernel | grep $current_kernel)" ]; then
break break
else
echo -e "${BL}'$kernel' ${CL}${YW}has been added to the remove Kernel list\n${CL}"
remove_kernels+=" $kernel"
fi
done
msg_ok "Kernel Search Completed\n"
if [[ "$remove_kernels" != *"pve"* ]]; then
echo -e "${PARTY} ${GN}It appears there are no old Kernels on your system. \n${CL}"
msg_info "Exiting"
sleep 2
msg_ok "Done"
else else
read -p "Would you like to remove the $(echo $remove_kernels | awk '{print NF}') selected Kernels listed above? [y/n]: " -n 1 -r echo -e "${BL}'$kernel' ${CL}${YW}has been added to the remove Kernel list\n${CL}"
echo remove_kernels+=" $kernel"
if [[ $REPLY =~ ^[Yy]$ ]]; then
msg_info "Removing ${CL}${RD}$(echo $remove_kernels | awk '{print NF}') ${CL}${YW}old Kernels${CL}"
/usr/bin/apt purge -y $remove_kernels >/dev/null 2>&1
msg_ok "Successfully Removed Kernels"
msg_info "Updating GRUB"
/usr/sbin/update-grub >/dev/null 2>&1
msg_ok "Successfully Updated GRUB"
msg_info "Exiting"
sleep 2
msg_ok "Done"
else
msg_info "Exiting"
sleep 2
msg_ok "Done"
fi
fi fi
done
msg_ok "Kernel Search Completed\n"
if [[ "$remove_kernels" != *"pve"* ]]; then
echo -e "${PARTY} ${GN}It appears there are no old Kernels on your system. \n${CL}"
msg_info "Exiting"
sleep 2
msg_ok "Done"
else
read -p "Would you like to remove the $(echo $remove_kernels | awk '{print NF}') selected Kernels listed above? [y/n]: " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
msg_info "Removing ${CL}${RD}$(echo $remove_kernels | awk '{print NF}') ${CL}${YW}old Kernels${CL}"
/usr/bin/apt purge -y $remove_kernels >/dev/null 2>&1
msg_ok "Successfully Removed Kernels"
msg_info "Updating GRUB"
/usr/sbin/update-grub >/dev/null 2>&1
msg_ok "Successfully Updated GRUB"
msg_info "Exiting"
sleep 2
msg_ok "Done"
else
msg_info "Exiting"
sleep 2
msg_ok "Done"
fi
fi
} }
if ! command -v pveversion >/dev/null 2>&1; then if ! command -v pveversion >/dev/null 2>&1; then
echo -e " Switching to PBS mode" echo -e " Switching to PBS mode"
MODE="PBS" MODE="PBS"
sleep 2 sleep 2
else else
MODE="PVE" MODE="PVE"
fi fi
check_root check_root

@ -6,8 +6,8 @@
# https://github.com/tteck/Proxmox/raw/main/LICENSE # https://github.com/tteck/Proxmox/raw/main/LICENSE
header_info() { header_info() {
clear clear
cat <<EOF cat <<EOF
__________ __ __ __________ __ __
/ ____/ __ \/ / / / / ____/ __ \/ / / /
/ / / /_/ / / / / / / / /_/ / / / /
@ -17,41 +17,41 @@ Scaling Governors
EOF EOF
} }
while true; do while true; do
header_info header_info
read -p "View CPU Scaling Governors. Proceed(y/n)?" yn read -p "View CPU Scaling Governors. Proceed(y/n)?" yn
case $yn in case $yn in
[Yy]*) break ;; [Yy]*) break ;;
[Nn]*) exit ;; [Nn]*) exit ;;
*) echo "Please answer yes or no." ;; *) echo "Please answer yes or no." ;;
esac esac
done done
show_menu() { show_menu() {
header_info header_info
echo -e "\nProxmox IP \033[36m$(hostname -I)\033[m" echo -e "\nProxmox IP \033[36m$(hostname -I)\033[m"
echo -e "Current Kernel \033[36m$(uname -r)\033[m\n" echo -e "Current Kernel \033[36m$(uname -r)\033[m\n"
available_governors=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors) available_governors=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors)
echo -e "Available CPU Scaling Governors\n\033[36m${available_governors}\033[m\n" echo -e "Available CPU Scaling Governors\n\033[36m${available_governors}\033[m\n"
echo -e "Current CPU Scaling Governor\n\033[36m$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)\033[m\n" echo -e "Current CPU Scaling Governor\n\033[36m$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)\033[m\n"
options="" options=""
i=1 i=1
for governor in $available_governors; do for governor in $available_governors; do
options+="** ${i}) \033[36m${governor}\033[m CPU Scaling Governor\n" options+="** ${i}) \033[36m${governor}\033[m CPU Scaling Governor\n"
((i = i + 1)) ((i = i + 1))
done done
echo -e "${options}" echo -e "${options}"
echo -e "\033[31mNOTE: Settings return to default after reboot\033[m\n" echo -e "\033[31mNOTE: Settings return to default after reboot\033[m\n"
read -p "Please choose an option from the menu and press [ENTER] or x to exit." opt read -p "Please choose an option from the menu and press [ENTER] or x to exit." opt
} }
show_menu show_menu
while [[ "$opt" != "" ]]; do while [[ "$opt" != "" ]]; do
num_governors=$(echo "$available_governors" | wc -w) num_governors=$(echo "$available_governors" | wc -w)
if [[ $opt -gt 0 ]] && [[ $opt -le $num_governors ]]; then if [[ $opt -gt 0 ]] && [[ $opt -le $num_governors ]]; then
governor=$(echo "$available_governors" | cut -d' ' -f $opt) governor=$(echo "$available_governors" | cut -d' ' -f $opt)
echo "${governor}" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor echo "${governor}" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
elif [[ $opt == "x" ]] || [[ $opt == "\n" ]]; then elif [[ $opt == "x" ]] || [[ $opt == "\n" ]]; then
exit exit
else else
show_menu
fi
show_menu show_menu
fi
show_menu
done done

@ -12,12 +12,12 @@ CM='\xE2\x9C\x94\033'
GN=$(echo "\033[1;92m") GN=$(echo "\033[1;92m")
CL=$(echo "\033[m") CL=$(echo "\033[m")
while true; do while true; do
read -p "This will Install Webmin, Proceed(y/n)?" yn read -p "This will Install Webmin, Proceed(y/n)?" yn
case $yn in case $yn in
[Yy]*) break ;; [Yy]*) break ;;
[Nn]*) exit ;; [Nn]*) exit ;;
*) echo "Please answer yes or no." ;; *) echo "Please answer yes or no." ;;
esac esac
done done
clear clear

Loading…
Cancel
Save