outsource
This commit is contained in:
parent
30c77b4419
commit
ce79bd0c08
111
misc/build.func
111
misc/build.func
@ -68,61 +68,61 @@ fi
|
||||
# exit 143
|
||||
# }
|
||||
|
||||
# Check if the shell is using bash
|
||||
shell_check() {
|
||||
if [[ "$(basename "$SHELL")" != "bash" ]]; then
|
||||
clear
|
||||
msg_error "Your default shell is currently not set to Bash. To use these scripts, please switch to the Bash shell."
|
||||
echo -e "\nExiting..."
|
||||
sleep 2
|
||||
exit
|
||||
fi
|
||||
}
|
||||
# # Check if the shell is using bash
|
||||
# shell_check() {
|
||||
# if [[ "$(basename "$SHELL")" != "bash" ]]; then
|
||||
# clear
|
||||
# msg_error "Your default shell is currently not set to Bash. To use these scripts, please switch to the Bash shell."
|
||||
# echo -e "\nExiting..."
|
||||
# sleep 2
|
||||
# exit
|
||||
# fi
|
||||
# }
|
||||
|
||||
# Run as root only
|
||||
root_check() {
|
||||
if [[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]; then
|
||||
clear
|
||||
msg_error "Please run this script as root."
|
||||
echo -e "\nExiting..."
|
||||
sleep 2
|
||||
exit
|
||||
fi
|
||||
}
|
||||
# # Run as root only
|
||||
# root_check() {
|
||||
# if [[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]; then
|
||||
# clear
|
||||
# msg_error "Please run this script as root."
|
||||
# echo -e "\nExiting..."
|
||||
# sleep 2
|
||||
# exit
|
||||
# fi
|
||||
# }
|
||||
|
||||
# This function checks the version of Proxmox Virtual Environment (PVE) and exits if the version is not supported.
|
||||
# Supported: Proxmox VE 8.0.x – 8.9.x and 9.0 (NOT 9.1+)
|
||||
pve_check() {
|
||||
local PVE_VER
|
||||
PVE_VER="$(pveversion | awk -F'/' '{print $2}' | awk -F'-' '{print $1}')"
|
||||
# # This function checks the version of Proxmox Virtual Environment (PVE) and exits if the version is not supported.
|
||||
# # Supported: Proxmox VE 8.0.x – 8.9.x and 9.0 (NOT 9.1+)
|
||||
# pve_check() {
|
||||
# local PVE_VER
|
||||
# PVE_VER="$(pveversion | awk -F'/' '{print $2}' | awk -F'-' '{print $1}')"
|
||||
|
||||
# Check for Proxmox VE 8.x: allow 8.0–8.9
|
||||
if [[ "$PVE_VER" =~ ^8\.([0-9]+) ]]; then
|
||||
local MINOR="${BASH_REMATCH[1]}"
|
||||
if ((MINOR < 0 || MINOR > 9)); then
|
||||
msg_error "This version of Proxmox VE is not supported."
|
||||
msg_error "Supported: Proxmox VE version 8.0 – 8.9"
|
||||
exit 1
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
# # Check for Proxmox VE 8.x: allow 8.0–8.9
|
||||
# if [[ "$PVE_VER" =~ ^8\.([0-9]+) ]]; then
|
||||
# local MINOR="${BASH_REMATCH[1]}"
|
||||
# if ((MINOR < 0 || MINOR > 9)); then
|
||||
# msg_error "This version of Proxmox VE is not supported."
|
||||
# msg_error "Supported: Proxmox VE version 8.0 – 8.9"
|
||||
# exit 1
|
||||
# fi
|
||||
# return 0
|
||||
# fi
|
||||
|
||||
# Check for Proxmox VE 9.x: allow ONLY 9.0
|
||||
if [[ "$PVE_VER" =~ ^9\.([0-9]+) ]]; then
|
||||
local MINOR="${BASH_REMATCH[1]}"
|
||||
if ((MINOR != 0)); then
|
||||
msg_error "This version of Proxmox VE is not yet supported."
|
||||
msg_error "Supported: Proxmox VE version 9.0"
|
||||
exit 1
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
# # Check for Proxmox VE 9.x: allow ONLY 9.0
|
||||
# if [[ "$PVE_VER" =~ ^9\.([0-9]+) ]]; then
|
||||
# local MINOR="${BASH_REMATCH[1]}"
|
||||
# if ((MINOR != 0)); then
|
||||
# msg_error "This version of Proxmox VE is not yet supported."
|
||||
# msg_error "Supported: Proxmox VE version 9.0"
|
||||
# exit 1
|
||||
# fi
|
||||
# return 0
|
||||
# fi
|
||||
|
||||
# All other unsupported versions
|
||||
msg_error "This version of Proxmox VE is not supported."
|
||||
msg_error "Supported versions: Proxmox VE 8.0 – 8.x or 9.0"
|
||||
exit 1
|
||||
}
|
||||
# # All other unsupported versions
|
||||
# msg_error "This version of Proxmox VE is not supported."
|
||||
# msg_error "Supported versions: Proxmox VE 8.0 – 8.x or 9.0"
|
||||
# exit 1
|
||||
# }
|
||||
|
||||
# When a node is running tens of containers, it's possible to exceed the kernel's cryptographic key storage allocations.
|
||||
# These are tuneable, so verify if the currently deployment is approaching the limits, advise the user on how to tune the limits, and exit the script.
|
||||
@ -170,17 +170,6 @@ maxkeys_check() {
|
||||
echo -e "${CM}${GN} All kernel key limits are within safe thresholds.${CL}"
|
||||
}
|
||||
|
||||
# This function checks the system architecture and exits if it's not "amd64".
|
||||
arch_check() {
|
||||
if [ "$(dpkg --print-architecture)" != "amd64" ]; then
|
||||
echo -e "\n ${INFO}${YWB}This script will not work with PiMox! \n"
|
||||
echo -e "\n ${YWB}Visit https://github.com/asylumexp/Proxmox for ARM64 support. \n"
|
||||
echo -e "Exiting..."
|
||||
sleep 2
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to get the current IP address based on the distribution
|
||||
get_current_ip() {
|
||||
if [ -f /etc/os-release ]; then
|
||||
|
@ -208,6 +208,73 @@ silent() {
|
||||
return $rc
|
||||
}
|
||||
|
||||
# Check if the shell is using bash
|
||||
shell_check() {
|
||||
if [[ "$(basename "$SHELL")" != "bash" ]]; then
|
||||
clear
|
||||
msg_error "Your default shell is currently not set to Bash. To use these scripts, please switch to the Bash shell."
|
||||
echo -e "\nExiting..."
|
||||
sleep 2
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
# Run as root only
|
||||
root_check() {
|
||||
if [[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]; then
|
||||
clear
|
||||
msg_error "Please run this script as root."
|
||||
echo -e "\nExiting..."
|
||||
sleep 2
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
# This function checks the version of Proxmox Virtual Environment (PVE) and exits if the version is not supported.
|
||||
# Supported: Proxmox VE 8.0.x – 8.9.x and 9.0 (NOT 9.1+)
|
||||
pve_check() {
|
||||
local PVE_VER
|
||||
PVE_VER="$(pveversion | awk -F'/' '{print $2}' | awk -F'-' '{print $1}')"
|
||||
|
||||
# Check for Proxmox VE 8.x: allow 8.0–8.9
|
||||
if [[ "$PVE_VER" =~ ^8\.([0-9]+) ]]; then
|
||||
local MINOR="${BASH_REMATCH[1]}"
|
||||
if ((MINOR < 0 || MINOR > 9)); then
|
||||
msg_error "This version of Proxmox VE is not supported."
|
||||
msg_error "Supported: Proxmox VE version 8.0 – 8.9"
|
||||
exit 1
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Check for Proxmox VE 9.x: allow ONLY 9.0
|
||||
if [[ "$PVE_VER" =~ ^9\.([0-9]+) ]]; then
|
||||
local MINOR="${BASH_REMATCH[1]}"
|
||||
if ((MINOR != 0)); then
|
||||
msg_error "This version of Proxmox VE is not yet supported."
|
||||
msg_error "Supported: Proxmox VE version 9.0"
|
||||
exit 1
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
# All other unsupported versions
|
||||
msg_error "This version of Proxmox VE is not supported."
|
||||
msg_error "Supported versions: Proxmox VE 8.0 – 8.x or 9.0"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# This function checks the system architecture and exits if it's not "amd64".
|
||||
arch_check() {
|
||||
if [ "$(dpkg --print-architecture)" != "amd64" ]; then
|
||||
echo -e "\n ${INFO}${YWB}This script will not work with PiMox! \n"
|
||||
echo -e "\n ${YWB}Visit https://github.com/asylumexp/Proxmox for ARM64 support. \n"
|
||||
echo -e "Exiting..."
|
||||
sleep 2
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to download & save header files
|
||||
get_header() {
|
||||
local app_name=$(echo "${APP,,}" | tr -d ' ')
|
||||
|
Loading…
x
Reference in New Issue
Block a user