Improve APT-Cacher IP validation and handling in config_file function
This commit is contained in:
parent
adb5031166
commit
d76551cd43
@ -1113,6 +1113,7 @@ config_file() {
|
|||||||
APT_CACHER_IP=""
|
APT_CACHER_IP=""
|
||||||
else
|
else
|
||||||
if [[ -n "${APT_CACHER_IP-}" ]]; then
|
if [[ -n "${APT_CACHER_IP-}" ]]; then
|
||||||
|
if [[ ! $APT_CACHER_IP == "none" ]]; then
|
||||||
if [[ "$APT_CACHER_IP" =~ $ip_regex ]]; then
|
if [[ "$APT_CACHER_IP" =~ $ip_regex ]]; then
|
||||||
APT_CACHER="yes"
|
APT_CACHER="yes"
|
||||||
echo -e "${NETWORK}${BOLD}${DGN}APT-CACHER IP Address: ${BGN}$APT_CACHER_IP${CL}"
|
echo -e "${NETWORK}${BOLD}${DGN}APT-CACHER IP Address: ${BGN}$APT_CACHER_IP${CL}"
|
||||||
@ -1120,10 +1121,17 @@ config_file() {
|
|||||||
msg_error "Invalid IP Address format for APT-Cacher. Needs to be 0.0.0.0, was ${APT_CACHER_IP}"
|
msg_error "Invalid IP Address format for APT-Cacher. Needs to be 0.0.0.0, was ${APT_CACHER_IP}"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
APT_CACHER=""
|
||||||
|
echo -e "${NETWORK}${BOLD}${DGN}APT-Cacher IP Address: ${BGN}No${CL}"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
if APT_CACHER_IP=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set APT-Cacher IP (leave blank for none)" 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 none)" 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}${BOLD}${DGN}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}"
|
||||||
|
if [[ -n $APT_CACHER_IP ]]; then
|
||||||
|
APT_CACHER_IP="none"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
exit_script
|
exit_script
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user