Update build.func

This commit is contained in:
CanbiZ 2025-03-21 09:26:50 +01:00
parent 4761ead586
commit 50afd96523

View File

@ -911,7 +911,7 @@ EOF
fi fi
} }
config_file(){ config_file() {
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 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
@ -967,15 +967,15 @@ config_file(){
MIN_ID=${BASH_REMATCH[1]} MIN_ID=${BASH_REMATCH[1]}
MAX_ID=${BASH_REMATCH[2]} MAX_ID=${BASH_REMATCH[2]}
if (( MIN_ID >= MAX_ID )); then if ((MIN_ID >= MAX_ID)); then
msg_error "Invalid Container ID range. The first number must be smaller than the second number, was ${CT_ID}" msg_error "Invalid Container ID range. The first number must be smaller than the second number, was ${CT_ID}"
exit exit
fi fi
LIST_OF_IDS=$(pvesh get /cluster/resources --type vm --output-format json | grep -oP '"vmid":\s*\K\d+' ) LIST_OF_IDS=$(pvesh get /cluster/resources --type vm --output-format json | grep -oP '"vmid":\s*\K\d+')
for ((ID=MIN_ID; ID<=MAX_ID; ID++)); do for ((ID = MIN_ID; ID <= MAX_ID; ID++)); do
if ! grep -q "^$ID$" <<< "$LIST_OF_IDS"; then if ! grep -q "^$ID$" <<<"$LIST_OF_IDS"; then
CT_ID=$ID CT_ID=$ID
break break
fi fi
@ -985,8 +985,8 @@ config_file(){
elif [[ "$CT_ID" =~ ^[0-9]+$ ]]; then elif [[ "$CT_ID" =~ ^[0-9]+$ ]]; then
LIST_OF_IDS=$(pvesh get /cluster/resources --type vm --output-format json | grep -oP '"vmid":\s*\K\d+' ) LIST_OF_IDS=$(pvesh get /cluster/resources --type vm --output-format json | grep -oP '"vmid":\s*\K\d+')
if ! grep -q "^$CT_ID$" <<< "$LIST_OF_IDS"; then if ! grep -q "^$CT_ID$" <<<"$LIST_OF_IDS"; then
echo -e "${CONTAINERID}${BOLD}${DGN}Container ID: ${BGN}$CT_ID${CL}" echo -e "${CONTAINERID}${BOLD}${DGN}Container ID: ${BGN}$CT_ID${CL}"
else else
msg_error "Container ID $CT_ID already exists" msg_error "Container ID $CT_ID already exists"
@ -1081,7 +1081,6 @@ config_file(){
exit exit
fi fi
local ip_cidr_regex='^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/([0-9]{1,2})$' local ip_cidr_regex='^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/([0-9]{1,2})$'
local ip_regex='^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$' local ip_regex='^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$'
@ -1090,7 +1089,8 @@ config_file(){
echo -e "${NETWORK}${BOLD}${DGN}IP Address: ${BGN}DHCP${CL}" echo -e "${NETWORK}${BOLD}${DGN}IP Address: ${BGN}DHCP${CL}"
echo -e "${GATEWAY}${BOLD}${DGN}Gateway IP Address: ${BGN}Default${CL}" echo -e "${GATEWAY}${BOLD}${DGN}Gateway IP Address: ${BGN}Default${CL}"
elif elif
[[ "$NET" =~ $ip_cidr_regex ]]; then [[ "$NET" =~ $ip_cidr_regex ]]
then
echo -e "${NETWORK}${BOLD}${DGN}IP Address: ${BGN}$NET${CL}" echo -e "${NETWORK}${BOLD}${DGN}IP Address: ${BGN}$NET${CL}"
else else
msg_error "Invalid IP Address format. Needs to be 0.0.0.0/0, was ${NET}" msg_error "Invalid IP Address format. Needs to be 0.0.0.0/0, was ${NET}"
@ -1110,7 +1110,6 @@ config_file(){
exit exit
fi fi
if [[ ! -z "$APT_CACHER_IP" ]]; then if [[ ! -z "$APT_CACHER_IP" ]]; then
if [[ "$APT_CACHER_IP" =~ $ip_regex ]]; then if [[ "$APT_CACHER_IP" =~ $ip_regex ]]; then
APT_CACHER="yes" APT_CACHER="yes"
@ -1152,7 +1151,6 @@ config_file(){
echo -e "${SEARCH}${BOLD}${DGN}DNS Search Domain: ${BGN}HOST${CL}" echo -e "${SEARCH}${BOLD}${DGN}DNS Search Domain: ${BGN}HOST${CL}"
fi fi
if [[ ! -z "$NS" ]]; then if [[ ! -z "$NS" ]]; then
if [[ "$NS" =~ $ip_regex ]]; then if [[ "$NS" =~ $ip_regex ]]; then
echo -e "${NETWORK}${BOLD}${DGN}DNS Server IP Address: ${BGN}$NS${CL}" echo -e "${NETWORK}${BOLD}${DGN}DNS Server IP Address: ${BGN}$NS${CL}"