Fix indentation / naming / echos

This commit is contained in:
CanbiZ 2024-12-04 11:42:15 +01:00
parent 99fdc2f17e
commit d07274ce7b
3 changed files with 156 additions and 163 deletions

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2024 tteck # Copyright (c) 2021-2024 tteck
# Author: tteck (tteckster) # Author: tteck (tteckster)
# Revision 1.0 (MickLesk 12/2024) # Co-Author: MickLesk
# License: MIT # License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
@ -66,7 +66,7 @@ function spinner() {
# This function displays an informational message with a yellow color. # This function displays an informational message with a yellow color.
function msg_info() { function msg_info() {
local msg="$1" local msg="$1"
echo -ne " ${TAB}${YW}${msg} " echo -ne " ${TAB}${YW}${msg}"
spinner & spinner &
SPINNER_PID=$! SPINNER_PID=$!
} }
@ -137,7 +137,7 @@ function select_storage() {
else else
local STORAGE local STORAGE
while [ -z "${STORAGE:+x}" ]; do while [ -z "${STORAGE:+x}" ]; do
STORAGE=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --title "Storage Pools" --radiolist \ STORAGE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Storage Pools" --radiolist \
"Which storage pool you would like to use for the ${CONTENT_LABEL,,}?\nTo make a selection, use the Spacebar.\n" \ "Which storage pool you would like to use for the ${CONTENT_LABEL,,}?\nTo make a selection, use the Spacebar.\n" \
16 $(($MSG_MAX_LENGTH + 23)) 6 \ 16 $(($MSG_MAX_LENGTH + 23)) 6 \
"${MENU[@]}" 3>&1 1>&2 2>&3) || exit "Menu aborted." "${MENU[@]}" 3>&1 1>&2 2>&3) || exit "Menu aborted."

View File

@ -1,6 +1,6 @@
# Copyright (c) 2021-2024 tteck # Copyright (c) 2021-2024 tteck
# Author: tteck (tteckster) # Author: tteck (tteckster)
# Revision 1.0 (MickLesk 12/2024) # Co-Author: MickLesk
# License: MIT # License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
@ -91,7 +91,7 @@ spinner() {
# This function displays an informational message with a yellow color. # This function displays an informational message with a yellow color.
msg_info() { msg_info() {
local msg="$1" local msg="$1"
echo -ne " ${TAB}${YW}${msg} " echo -ne " ${TAB}${YW}${msg}"
spinner & spinner &
SPINNER_PID=$! SPINNER_PID=$!
} }
@ -158,9 +158,7 @@ arch_check() {
# This function sets the APP-Name into an ASCII Header in Slant, figlet needed on proxmox main node. # This function sets the APP-Name into an ASCII Header in Slant, figlet needed on proxmox main node.
header_info() { header_info() {
if ! command -v figlet &> /dev/null; then
apt-get install -y figlet &> /dev/null apt-get install -y figlet &> /dev/null
fi
ascii_art=$(figlet -f slant "$APP") ascii_art=$(figlet -f slant "$APP")
clear clear
cat <<EOF cat <<EOF
@ -170,9 +168,9 @@ EOF
# This function checks if the script is running through SSH and prompts the user to confirm if they want to proceed or exit. # This function checks if the script is running through SSH and prompts the user to confirm if they want to proceed or exit.
ssh_check() { ssh_check() {
if command -v pveversion >/dev/null 2>&1 && [ -n "${SSH_CLIENT:+x}" ]; then if [ -n "${SSH_CLIENT:+x}" ]; then
if whiptail --backtitle "ProxmoxVE Community-Scripts" --defaultno --title "SSH DETECTED" --yesno "It's advisable to utilize the Proxmox shell rather than SSH, as there may be potential complications with variable retrieval. Proceed using SSH?" 10 72; then if whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "SSH DETECTED" --yesno "It's advisable to utilize the Proxmox shell rather than SSH, as there may be potential complications with variable retrieval. Proceed using SSH?" 10 72; then
whiptail --backtitle "ProxmoxVE Community-Scripts" --msgbox --title "Proceed using SSH" "You've chosen to proceed using SSH. If any issues arise, please run the script in the Proxmox shell before creating a repository issue." 10 72 whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "Proceed using SSH" "You've chosen to proceed using SSH. If any issues arise, please run the script in the Proxmox shell before creating a repository issue." 10 72
else else
clear clear
echo "Exiting due to SSH usage. Please consider using the Proxmox shell." echo "Exiting due to SSH usage. Please consider using the Proxmox shell."
@ -246,28 +244,35 @@ echo_default() {
} }
# This function is called when the user decides to exit the script. It clears the screen and displays an exit message. # This function is called when the user decides to exit the script. It clears the screen and displays an exit message.
exit-script() { exit_script() {
clear clear
echo -e "${CROSS}${RD}User exited script${CL}\n" echo -e "${CROSS}${RD}User exited script${CL}\n"
# Stop any running spinner
if [ -n "$SPINNER_PID" ] && kill -0 "$SPINNER_PID" 2>/dev/null; then
kill "$SPINNER_PID"
wait "$SPINNER_PID" 2>/dev/null
fi
exit exit
} }
# This function allows the user to configure advanced settings for the script. # This function allows the user to configure advanced settings for the script.
advanced_settings() { advanced_settings() {
whiptail --backtitle "ProxmoxVE Community-Scripts" --msgbox --title "Here is an instructional tip:" "To make a selection, use the Spacebar." 8 58 whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "Here is an instructional tip:" "To make a selection, use the Spacebar." 8 58
whiptail --backtitle "ProxmoxVE Community-Scripts" --msgbox --title "Default distribution for $APP" "${var_os} ${var_version} \n \nIf the default Linux distribution is not adhered to, script support will be discontinued. \n" 10 58 whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "Default distribution for $APP" "${var_os} ${var_version} \n \nIf the default Linux distribution is not adhered to, script support will be discontinued. \n" 10 58
if [ "$var_os" != "alpine" ]; then if [ "$var_os" != "alpine" ]; then
var_os="" var_os=""
while [ -z "$var_os" ]; do while [ -z "$var_os" ]; do
if var_os=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --title "DISTRIBUTION" --radiolist "Choose Distribution:" 10 58 2 \ if var_os=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "DISTRIBUTION" --radiolist "Choose Distribution:" 10 58 2 \
"debian" "" OFF \ "debian" "" OFF \
"ubuntu" "" OFF \ "ubuntu" "" OFF \
3>&1 1>&2 2>&3); then 3>&1 1>&2 2>&3); then
if [ -n "$var_os" ]; then if [ -n "$var_os" ]; then
echo -e "${OS}${DGN}Using Distribution: ${BGN}$var_os${CL}" echo -e "${OS}${BOLD}${DGN}Operating System: ${BGN}$var_os${CL}"
fi fi
else else
exit-script exit_script
fi fi
done done
fi fi
@ -275,15 +280,15 @@ advanced_settings() {
if [ "$var_os" == "debian" ]; then if [ "$var_os" == "debian" ]; then
var_version="" var_version=""
while [ -z "$var_version" ]; do while [ -z "$var_version" ]; do
if var_version=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ if var_version=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \
"11" "Bullseye" OFF \ "11" "Bullseye" OFF \
"12" "Bookworm" OFF \ "12" "Bookworm" OFF \
3>&1 1>&2 2>&3); then 3>&1 1>&2 2>&3); then
if [ -n "$var_version" ]; then if [ -n "$var_version" ]; then
echo -e "${OSVERSION}${DGN}Using $var_os Version: ${BGN}$var_version${CL}" echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}"
fi fi
else else
exit-script exit_script
fi fi
done done
fi fi
@ -291,207 +296,207 @@ advanced_settings() {
if [ "$var_os" == "ubuntu" ]; then if [ "$var_os" == "ubuntu" ]; then
var_version="" var_version=""
while [ -z "$var_version" ]; do while [ -z "$var_version" ]; do
if var_version=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 3 \ if var_version=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \
"20.04" "Focal" OFF \ "20.04" "Focal" OFF \
"22.04" "Jammy" OFF \ "22.04" "Jammy" OFF \
"24.04" "Noble" OFF \ "24.04" "Noble" OFF \
"24.10" "Oracular" OFF \ "24.10" "Oracular" OFF \
3>&1 1>&2 2>&3); then 3>&1 1>&2 2>&3); then
if [ -n "$var_version" ]; then if [ -n "$var_version" ]; then
echo -e "${OSVERSION}${DGN}Using $var_os Version: ${BGN}$var_version${CL}" echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}"
fi fi
else else
exit-script exit_script
fi fi
done done
fi fi
CT_TYPE="" CT_TYPE=""
while [ -z "$CT_TYPE" ]; do while [ -z "$CT_TYPE" ]; do
if CT_TYPE=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --title "CONTAINER TYPE" --radiolist "Choose Type" 10 58 2 \ if CT_TYPE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "CONTAINER TYPE" --radiolist "Choose Type" 10 58 2 \
"1" "Unprivileged" OFF \ "1" "Unprivileged" OFF \
"0" "Privileged" OFF \ "0" "Privileged" OFF \
3>&1 1>&2 2>&3); then 3>&1 1>&2 2>&3); then
if [ -n "$CT_TYPE" ]; then if [ -n "$CT_TYPE" ]; then
echo -e "${CONTAINERTYPE}${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" echo -e "${CONTAINERTYPE}${BOLD}${DGN}Container Type: ${BGN}$CT_TYPE_DESC${CL}"
fi fi
else else
exit-script exit_script
fi fi
done done
while true; do while true; do
if PW1=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --passwordbox "\nSet Root Password (needed for root ssh access)" 9 58 --title "PASSWORD (leave blank for automatic login)" 3>&1 1>&2 2>&3); then if PW1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --passwordbox "\nSet Root Password (needed for root ssh access)" 9 58 --title "PASSWORD (leave blank for automatic login)" 3>&1 1>&2 2>&3); then
if [[ ! -z "$PW1" ]]; then if [[ ! -z "$PW1" ]]; then
if [[ "$PW1" == *" "* ]]; then if [[ "$PW1" == *" "* ]]; then
whiptail --msgbox "Password cannot contain spaces. Please try again." 8 58 whiptail --msgbox "Password cannot contain spaces. Please try again." 8 58
elif [ ${#PW1} -lt 5 ]; then elif [ ${#PW1} -lt 5 ]; then
whiptail --msgbox "Password must be at least 5 characters long. Please try again." 8 58 whiptail --msgbox "Password must be at least 5 characters long. Please try again." 8 58
else else
if PW2=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --passwordbox "\nVerify Root Password" 9 58 --title "PASSWORD VERIFICATION" 3>&1 1>&2 2>&3); then if PW2=$(whiptail --backtitle "Proxmox VE Helper Scripts" --passwordbox "\nVerify Root Password" 9 58 --title "PASSWORD VERIFICATION" 3>&1 1>&2 2>&3); then
if [[ "$PW1" == "$PW2" ]]; then if [[ "$PW1" == "$PW2" ]]; then
PW="-password $PW1" PW="-password $PW1"
echo -e "${VERIFYPW}${DGN}Using Root Password: ${BGN}********${CL}" echo -e "${VERIFYPW}${BOLD}${DGN}Root Password: ${BGN}********${CL}"
break break
else else
whiptail --msgbox "Passwords do not match. Please try again." 8 58 whiptail --msgbox "Passwords do not match. Please try again." 8 58
fi fi
else else
exit-script exit_script
fi fi
fi fi
else else
PW1="Automatic Login" PW1="Automatic Login"
PW="" PW=""
echo -e "${VERIFYPW}${DGN}Using Root Password: ${BGN}$PW1${CL}" echo -e "${VERIFYPW}${BOLD}${DGN}Root Password: ${BGN}$PW1${CL}"
break break
fi fi
else else
exit-script exit_script
fi fi
done done
if CT_ID=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 3>&1 1>&2 2>&3); then if CT_ID=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 3>&1 1>&2 2>&3); then
if [ -z "$CT_ID" ]; then if [ -z "$CT_ID" ]; then
CT_ID="$NEXTID" CT_ID="$NEXTID"
echo -e "${CONTAINERID}${DGN}Using Container ID: ${BGN}$CT_ID${CL}" echo -e "${CONTAINERID}${BOLD}${DGN}Container ID: ${BGN}$CT_ID${CL}"
else else
echo -e "${CONTAINERID}${DGN}Container ID: ${BGN}$CT_ID${CL}" echo -e "${CONTAINERID}${BOLD}${DGN}Container ID: ${BGN}$CT_ID${CL}"
fi fi
else else
exit exit
fi fi
if CT_NAME=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3); then if CT_NAME=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3); then
if [ -z "$CT_NAME" ]; then if [ -z "$CT_NAME" ]; then
HN="$NSAPP" HN="$NSAPP"
else else
HN=$(echo ${CT_NAME,,} | tr -d ' ') HN=$(echo ${CT_NAME,,} | tr -d ' ')
fi fi
echo -e "${HOSTNAME}${DGN}Using Hostname: ${BGN}$HN${CL}" echo -e "${HOSTNAME}${BOLD}${DGN}Hostname: ${BGN}$HN${CL}"
else else
exit-script exit_script
fi fi
if DISK_SIZE=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 3>&1 1>&2 2>&3); then if DISK_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 3>&1 1>&2 2>&3); then
if [ -z "$DISK_SIZE" ]; then if [ -z "$DISK_SIZE" ]; then
DISK_SIZE="$var_disk" DISK_SIZE="$var_disk"
echo -e "${DISKSIZE}${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" echo -e "${DISKSIZE}${DGN}Disk Size: ${BGN}$DISK_SIZE${CL}"
else else
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
echo -e "{INFO}${HOLD}${RD} DISK SIZE MUST BE AN INTEGER NUMBER!${CL}" echo -e "{INFO}${HOLD}${RD} DISK SIZE MUST BE AN INTEGER NUMBER!${CL}"
advanced_settings advanced_settings
fi fi
echo -e "${DISKSIZE}${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" echo -e "${DISKSIZE}${BOLD}${DGN}Disk Size: ${BGN}$DISK_SIZE${CL}"
fi fi
else else
exit-script exit_script
fi fi
if CORE_COUNT=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 3>&1 1>&2 2>&3); then if CORE_COUNT=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 3>&1 1>&2 2>&3); then
if [ -z "$CORE_COUNT" ]; then if [ -z "$CORE_COUNT" ]; then
CORE_COUNT="$var_cpu" CORE_COUNT="$var_cpu"
echo -e "${CPUCORE}${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" echo -e "${CPUCORE}${BOLD}${DGN}CPU Cores: ${BGN}$CORE_COUNT${CL}"
else else
echo -e "${CPUCORE}${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" echo -e "${CPUCORE}${BOLD}${DGN}CPU Cores: ${BGN}$CORE_COUNT${CL}"
fi fi
else else
exit-script exit_script
fi fi
if RAM_SIZE=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3); then if RAM_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3); then
if [ -z "$RAM_SIZE" ]; then if [ -z "$RAM_SIZE" ]; then
RAM_SIZE="$var_ram" RAM_SIZE="$var_ram"
echo -e "${RAMSIZE}${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" echo -e "${RAMSIZE}${BOLD}${DGN}RAM Size: ${BGN}$RAM_SIZE${CL}"
else else
echo -e "${RAMSIZE}${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" echo -e "${RAMSIZE}${BOLD}${DGN}RAM Size: ${BGN}$RAM_SIZE${CL}"
fi fi
else else
exit-script exit_script
fi fi
if BRG=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3); then if BRG=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3); then
if [ -z "$BRG" ]; then if [ -z "$BRG" ]; then
BRG="vmbr0" BRG="vmbr0"
echo -e "${BRIDGE}${DGN}Using Bridge: ${BGN}$BRG${CL}" echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}"
else else
echo -e "${BRIDGE}${DGN}Using Bridge: ${BGN}$BRG${CL}" echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}"
fi fi
else else
exit-script exit_script
fi fi
while true; do while true; do
NET=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --inputbox "Set a Static IPv4 CIDR Address (/24)" 8 58 dhcp --title "IP ADDRESS" 3>&1 1>&2 2>&3) NET=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Static IPv4 CIDR Address (/24)" 8 58 dhcp --title "IP ADDRESS" 3>&1 1>&2 2>&3)
exit_status=$? exit_status=$?
if [ $exit_status -eq 0 ]; then if [ $exit_status -eq 0 ]; then
if [ "$NET" = "dhcp" ]; then if [ "$NET" = "dhcp" ]; then
echo -e "${NETWORK}${DGN}Using IP Address: ${BGN}$NET${CL}" echo -e "${NETWORK}${BOLD}${DGN}IP Address: ${BGN}$NET${CL}"
break break
else else
if [[ "$NET" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}/([0-9]|[1-2][0-9]|3[0-2])$ ]]; then if [[ "$NET" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}/([0-9]|[1-2][0-9]|3[0-2])$ ]]; then
echo -e "${NETWORK}${DGN}Using IP Address: ${BGN}$NET${CL}" echo -e "${NETWORK}${BOLD}${DGN}IP Address: ${BGN}$NET${CL}"
break break
else else
whiptail --backtitle "ProxmoxVE Community-Scripts" --msgbox "$NET is an invalid IPv4 CIDR address. Please enter a valid IPv4 CIDR address or 'dhcp'" 8 58 whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox "$NET is an invalid IPv4 CIDR address. Please enter a valid IPv4 CIDR address or 'dhcp'" 8 58
fi fi
fi fi
else else
exit-script exit_script
fi fi
done done
if [ "$NET" != "dhcp" ]; then if [ "$NET" != "dhcp" ]; then
while true; do while true; do
GATE1=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --inputbox "Enter gateway IP address" 8 58 --title "Gateway IP" 3>&1 1>&2 2>&3) GATE1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Enter gateway IP address" 8 58 --title "Gateway IP" 3>&1 1>&2 2>&3)
if [ -z "$GATE1" ]; then if [ -z "$GATE1" ]; then
whiptail --backtitle "ProxmoxVE Community-Scripts" --msgbox "Gateway IP address cannot be empty" 8 58 whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox "Gateway IP address cannot be empty" 8 58
elif [[ ! "$GATE1" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]]; then elif [[ ! "$GATE1" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]]; then
whiptail --backtitle "ProxmoxVE Community-Scripts" --msgbox "Invalid IP address format" 8 58 whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox "Invalid IP address format" 8 58
else else
GATE=",gw=$GATE1" GATE=",gw=$GATE1"
echo -e "${GATEWAY}${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" echo -e "${GATEWAY}${BOLD}${DGN}Gateway IP Address: ${BGN}$GATE1${CL}"
break break
fi fi
done done
else else
GATE="" GATE=""
echo -e "${GATEWAY}${DGN}Using Gateway IP Address: ${BGN}Default${CL}" echo -e "${GATEWAY}${BOLD}${DGN}Gateway IP Address: ${BGN}Default${CL}"
fi fi
if [ "$var_os" == "alpine" ]; then if [ "$var_os" == "alpine" ]; then
APT_CACHER="" APT_CACHER=""
APT_CACHER_IP="" APT_CACHER_IP=""
else else
if APT_CACHER_IP=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --inputbox "Set APT-Cacher IP (leave blank for default)" 8 58 --title "APT-Cacher IP" 3>&1 1>&2 2>&3); then if APT_CACHER_IP=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set APT-Cacher IP (leave blank for default)" 8 58 --title "APT-Cacher IP" 3>&1 1>&2 2>&3); then
APT_CACHER="${APT_CACHER_IP:+yes}" APT_CACHER="${APT_CACHER_IP:+yes}"
echo -e "${NETWORK}${DGN}Using APT-Cacher IP Address: ${BGN}${APT_CACHER_IP:-Default}${CL}" echo -e "${NETWORK}${BOLD}${DGN}APT-Cacher IP Address: ${BGN}${APT_CACHER_IP:-Default}${CL}"
else else
exit-script exit_script
fi fi
fi fi
if (whiptail --backtitle "ProxmoxVE Community-Scripts" --defaultno --title "IPv6" --yesno "Disable IPv6?" 10 58); then if (whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "IPv6" --yesno "Disable IPv6?" 10 58); then
DISABLEIP6="yes" DISABLEIP6="yes"
else else
DISABLEIP6="no" DISABLEIP6="no"
fi fi
echo -e "${DISABLEIPV6}${DGN}Disable IPv6: ${BGN}$DISABLEIP6${CL}" echo -e "${DISABLEIPV6}${BOLD}${DGN}Disable IPv6: ${BGN}$DISABLEIP6${CL}"
if MTU1=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --inputbox "Set Interface MTU Size (leave blank for default)" 8 58 --title "MTU SIZE" 3>&1 1>&2 2>&3); then if MTU1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Interface MTU Size (leave blank for default)" 8 58 --title "MTU SIZE" 3>&1 1>&2 2>&3); then
if [ -z $MTU1 ]; then if [ -z $MTU1 ]; then
MTU1="Default" MTU1="Default"
MTU="" MTU=""
else else
MTU=",mtu=$MTU1" MTU=",mtu=$MTU1"
fi fi
echo -e "${DEFAULT}${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" echo -e "${DEFAULT}${BOLD}${DGN}Interface MTU Size: ${BGN}$MTU1${CL}"
else else
exit-script exit_script
fi fi
if SD=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --inputbox "Set a DNS Search Domain (leave blank for HOST)" 8 58 --title "DNS Search Domain" 3>&1 1>&2 2>&3); then if SD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a DNS Search Domain (leave blank for HOST)" 8 58 --title "DNS Search Domain" 3>&1 1>&2 2>&3); then
if [ -z $SD ]; then if [ -z $SD ]; then
SX=Host SX=Host
SD="" SD=""
@ -499,72 +504,72 @@ advanced_settings() {
SX=$SD SX=$SD
SD="-searchdomain=$SD" SD="-searchdomain=$SD"
fi fi
echo -e "${SEARCH}${DGN}Using DNS Search Domain: ${BGN}$SX${CL}" echo -e "${SEARCH}${BOLD}${DGN}DNS Search Domain: ${BGN}$SX${CL}"
else else
exit-script exit_script
fi fi
if NX=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --inputbox "Set a DNS Server IP (leave blank for HOST)" 8 58 --title "DNS SERVER IP" 3>&1 1>&2 2>&3); then if NX=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a DNS Server IP (leave blank for HOST)" 8 58 --title "DNS SERVER IP" 3>&1 1>&2 2>&3); then
if [ -z $NX ]; then if [ -z $NX ]; then
NX=Host NX=Host
NS="" NS=""
else else
NS="-nameserver=$NX" NS="-nameserver=$NX"
fi fi
echo -e "${NETWORK}${DGN}Using DNS Server IP Address: ${BGN}$NX${CL}" echo -e "${NETWORK}${BOLD}${DGN}DNS Server IP Address: ${BGN}$NX${CL}"
else else
exit-script exit_script
fi fi
if MAC1=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 3>&1 1>&2 2>&3); then if MAC1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 3>&1 1>&2 2>&3); then
if [ -z $MAC1 ]; then if [ -z $MAC1 ]; then
MAC1="Default" MAC1="Default"
MAC="" MAC=""
else else
MAC=",hwaddr=$MAC1" MAC=",hwaddr=$MAC1"
echo -e "${MACADDRESS}${DGN}Using MAC Address: ${BGN}$MAC1${CL}" echo -e "${MACADDRESS}${BOLD}${DGN}MAC Address: ${BGN}$MAC1${CL}"
fi fi
else else
exit-script exit_script
fi fi
if VLAN1=$(whiptail --backtitle "ProxmoxVE Community-Scripts" --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 3>&1 1>&2 2>&3); then if VLAN1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 3>&1 1>&2 2>&3); then
if [ -z $VLAN1 ]; then if [ -z $VLAN1 ]; then
VLAN1="Default" VLAN1="Default"
VLAN="" VLAN=""
else else
VLAN=",tag=$VLAN1" VLAN=",tag=$VLAN1"
fi fi
echo -e "${VLANTAG}${DGN}Using Vlan: ${BGN}$VLAN1${CL}" echo -e "${VLANTAG}${BOLD}${DGN}Vlan: ${BGN}$VLAN1${CL}"
else else
exit-script exit_script
fi fi
if [[ "$PW" == -password* ]]; then if [[ "$PW" == -password* ]]; then
if (whiptail --backtitle "ProxmoxVE Community-Scripts" --defaultno --title "SSH ACCESS" --yesno "Enable Root SSH Access?" 10 58); then if (whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "SSH ACCESS" --yesno "Enable Root SSH Access?" 10 58); then
SSH="yes" SSH="yes"
else else
SSH="no" SSH="no"
fi fi
echo -e "${ROOTSSH}${DGN}Enable Root SSH Access: ${BGN}$SSH${CL}" echo -e "${ROOTSSH}${BOLD}${DGN}Root SSH Access: ${BGN}$SSH${CL}"
else else
SSH="no" SSH="no"
echo -e "${ROOTSSH}${DGN}Enable Root SSH Access: ${BGN}$SSH${CL}" echo -e "${ROOTSSH}${BOLD}${DGN}Root SSH Access: ${BGN}$SSH${CL}"
fi fi
if (whiptail --backtitle "ProxmoxVE Community-Scripts" --defaultno --title "VERBOSE MODE" --yesno "Enable Verbose Mode?" 10 58); then if (whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "VERBOSE MODE" --yesno "Enable Verbose Mode?" 10 58); then
VERB="yes" VERB="yes"
else else
VERB="no" VERB="no"
fi fi
echo -e "${SEARCH}${DGN}Enable Verbose Mode: ${BGN}$VERB${CL}" echo -e "${SEARCH}${DGN}Enable Verbose Mode: ${BGN}$VERB${CL}"
if (whiptail --backtitle "ProxmoxVE Community-Scripts" --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 10 58); then if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 10 58); then
echo -e "${CREATING}${RD}Creating a ${APP} LXC using the above advanced settings${CL}" echo -e "${CREATING}${BOLD}${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
else else
clear clear
header_info header_info
echo -e "${ADVANCED}${RD}Using Advanced Settings${CL}" echo -e "${ADVANCED}${BOLD}${RD}Using Advanced Settings${CL}"
advanced_settings advanced_settings
fi fi
} }
@ -582,7 +587,7 @@ install_script() {
NEXTID=$(pvesh get /cluster/nextid) NEXTID=$(pvesh get /cluster/nextid)
timezone=$(cat /etc/timezone) timezone=$(cat /etc/timezone)
header_info header_info
if (whiptail --backtitle "ProxmoxVE Community-Scripts" --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
header_info header_info
echo -e "${DEFAULT}${BOLD}${BL}Using Default Settings${CL}" echo -e "${DEFAULT}${BOLD}${BL}Using Default Settings${CL}"
base_settings base_settings
@ -633,7 +638,7 @@ check_container_storage() {
start() { start() {
if command -v pveversion >/dev/null 2>&1; then if command -v pveversion >/dev/null 2>&1; then
if ! (whiptail --backtitle "ProxmoxVE Community-Scripts" --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then if ! (whiptail --backtitle "Proxmox VE Helper Scripts" --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
clear clear
exit_script exit_script
exit exit
@ -643,7 +648,7 @@ start() {
fi fi
if ! command -v pveversion >/dev/null 2>&1; then if ! command -v pveversion >/dev/null 2>&1; then
if ! (whiptail --backtitle "ProxmoxVE Community-Scripts" --title "${APP} LXC UPDATE" --yesno "Support/Update functions for ${APP} LXC. Proceed?" 10 58); then if ! (whiptail --backtitle "Proxmox VE Helper Scripts" --title "${APP} LXC UPDATE" --yesno "Support/Update functions for ${APP} LXC. Proceed?" 10 58); then
clear clear
exit_script exit_script
exit exit

View File

@ -1,6 +1,6 @@
# Copyright (c) 2021-2024 tteck # Copyright (c) 2021-2024 tteck
# Author: tteck (tteckster) # Author: tteck (tteckster)
# Revision 1.0 (MickLesk 12/2024) # Co-Author: MickLesk
# License: MIT # License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
@ -86,7 +86,7 @@ spinner() {
# This function displays an informational message with a yellow color. # This function displays an informational message with a yellow color.
msg_info() { msg_info() {
local msg="$1" local msg="$1"
echo -ne " ${TAB}${YW}${msg} " echo -ne " ${TAB}${YW}${msg}"
spinner & spinner &
SPINNER_PID=$! SPINNER_PID=$!
} }
@ -142,8 +142,6 @@ network_check() {
ipv4_connected=false ipv4_connected=false
ipv6_connected=false ipv6_connected=false
sleep 1 sleep 1
sysctl -w net.ipv6.conf.all.disable_ipv6=0 &>/dev/nul
sysctl -w net.ipv6.conf.default.disable_ipv6=0 &>/dev/nul
# Check IPv4 connectivity # Check IPv4 connectivity
if ping -c 1 -W 1 1.1.1.1 &>/dev/null || ping -c 1 -W 1 8.8.8.8 &>/dev/null || ping -c 1 -W 1 9.9.9.9 &>/dev/null; then if ping -c 1 -W 1 1.1.1.1 &>/dev/null || ping -c 1 -W 1 8.8.8.8 &>/dev/null || ping -c 1 -W 1 9.9.9.9 &>/dev/null; then
msg_ok "IPv4 Internet Connected"; msg_ok "IPv4 Internet Connected";
@ -192,26 +190,16 @@ fi
EOF EOF
chmod +x /usr/local/bin/apt-proxy-detect.sh chmod +x /usr/local/bin/apt-proxy-detect.sh
fi fi
if grep -qEi "debian|ubuntu" /etc/os-release; then
$STD apt-get update $STD apt-get update
$STD apt-get -o Dpkg::Options::="--force-confold" -y dist-upgrade $STD apt-get -o Dpkg::Options::="--force-confold" -y dist-upgrade
# RPM-based systems rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
elif grep -qEi "fedora|centos|rocky|almalinux" /etc/os-release; then
$STD dnf -y upgrade
# openSUSE
elif grep -qEi "opensuse" /etc/os-release; then
$STD zypper -n update
else
msg_error "Unsupported OS detected!"
exit 1
fi
msg_ok "Updated Container OS" msg_ok "Updated Container OS"
} }
# This function modifies the message of the day (motd) and SSH settings # This function modifies the message of the day (motd) and SSH settings
motd_ssh() { motd_ssh() {
# Set terminal to 256-color mode if not already set # Set terminal to 256-color mode
grep -qxF "export TERM='xterm-256color'" /root/.bashrc || echo "export TERM='xterm-256color'" >> /root/.bashrc echo "export TERM='xterm-256color'" >>/root/.bashrc
# Get the current private IP address # Get the current private IP address
IP=$(hostname -I | awk '{print $1}') # Private IP IP=$(hostname -I | awk '{print $1}') # Private IP