Merge pull request #1 from X-Anonymous-Y/test

Changed from 4 spaces to 2 spaces
pull/1652/head
X-Anonymous-Y 2 years ago committed by GitHub
commit be47ec675d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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
let config = {
address: "0.0.0.0",
port: 8080,
basePath: "/",
ipWhitelist: [],
useHttps: false,
httpsPrivateKey: "",
httpsCertificate: "",
language: "en",
locale: "en-US",
logLevel: ["INFO", "LOG", "WARN", "ERROR"],
timeFormat: 24,
units: "metric",
serverOnly: true,
modules: [
{
module: "alert",
},
{
module: "updatenotification",
position: "top_bar"
},
{
module: "clock",
position: "top_left"
},
{
module: "calendar",
header: "US Holidays",
position: "top_left",
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
}
},
address: "0.0.0.0",
port: 8080,
basePath: "/",
ipWhitelist: [],
useHttps: false,
httpsPrivateKey: "",
httpsCertificate: "",
language: "en",
locale: "en-US",
logLevel: [
"INFO",
"LOG",
"WARN",
"ERROR"],
timeFormat: 24,
units: "metric",
serverOnly: true,
modules: [
{
module: "alert",
},
{
module: "updatenotification",
position: "top_bar"
},
{
module: "clock",
position: "top_left"
},
{
module: "calendar",
header: "US Holidays",
position: "top_left",
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
}
},
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/

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

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

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

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

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

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

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

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

@ -6,7 +6,7 @@
# https://github.com/tteck/Proxmox/raw/main/LICENSE
function header_info {
cat <<"EOF"
cat <<"EOF"
__ __ __ ________
/ //_/__ _________ ___ / / / ____/ /__ ____ _____
/ ,< / _ \/ ___/ __ \/ _ \/ / / / / / _ \/ __ `/ __ \
@ -33,108 +33,108 @@ current_kernel=$(uname -r)
clear
header_info
while true; do
read -p "This will Clean Unused Kernel Images, USE AT YOUR OWN RISK. Proceed(y/n)?" yn
case $yn in
[Yy]*) break ;;
[Nn]*) exit ;;
*) echo -e "${RD}Please answer y/n${CL}" ;;
esac
read -p "This will Clean Unused Kernel Images, USE AT YOUR OWN RISK. Proceed(y/n)?" yn
case $yn in
[Yy]*) break ;;
[Nn]*) exit ;;
*) echo -e "${RD}Please answer y/n${CL}" ;;
esac
done
clear
function msg_info() {
local msg="$1"
echo -ne " ${HOLD} ${YW}${msg}..."
local msg="$1"
echo -ne " ${HOLD} ${YW}${msg}..."
}
function msg_ok() {
local msg="$1"
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
local msg="$1"
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
}
function check_root() {
if [[ $EUID -ne 0 ]]; then
echo -e "${CROSS}${RD}Error: This script must be ran as the root user.\n${CL}"
exit 1
else
header_info
other_kernel
kernel_info
kernel_clean
fi
if [[ $EUID -ne 0 ]]; then
echo -e "${CROSS}${RD}Error: This script must be ran as the root user.\n${CL}"
exit 1
else
header_info
other_kernel
kernel_info
kernel_clean
fi
}
VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)"
function other_kernel() {
if [[ "${VERSION}" == "bullseye" ]]; then
if [[ "$current_kernel" == *"edge"* ]]; then
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"
exit 1
fi
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 "\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
fi
if [[ "${VERSION}" == "bullseye" ]]; then
if [[ "$current_kernel" == *"edge"* ]]; then
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"
exit 1
fi
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 "\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
fi
fi
}
function kernel_info() {
if [[ "$MODE" != "PBS" ]]; then
echo -e "${YW}PVE Version: ${BL}$(pveversion)\n${CL}"
fi
if [[ "$current_kernel" == *"pve"* ]]; then
echo -e "${YW}Current Kernel: ${BL}$current_kernel\n${CL}"
else
echo -e "\n${CROSS} ${RD}ERROR: No PVE Kernel Found\n${CL}"
exit 1
fi
if [[ "$MODE" != "PBS" ]]; then
echo -e "${YW}PVE Version: ${BL}$(pveversion)\n${CL}"
fi
if [[ "$current_kernel" == *"pve"* ]]; then
echo -e "${YW}Current Kernel: ${BL}$current_kernel\n${CL}"
else
echo -e "\n${CROSS} ${RD}ERROR: No PVE Kernel Found\n${CL}"
exit 1
fi
}
function kernel_clean() {
kernels=$(dpkg --list | grep 'kernel-.*-pve' | awk '{print $2}' | sort -V)
remove_kernels=""
for kernel in $kernels; do
if [ "$(echo $kernel | grep $current_kernel)" ]; then
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"
kernels=$(dpkg --list | grep 'kernel-.*-pve' | awk '{print $2}' | sort -V)
remove_kernels=""
for kernel in $kernels; do
if [ "$(echo $kernel | grep $current_kernel)" ]; then
break
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
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
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
echo -e " Switching to PBS mode"
MODE="PBS"
sleep 2
echo -e " Switching to PBS mode"
MODE="PBS"
sleep 2
else
MODE="PVE"
MODE="PVE"
fi
check_root

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

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

Loading…
Cancel
Save