mirror of
				https://github.com/community-scripts/ProxmoxVE.git
				synced 2025-11-04 10:22:50 +00:00 
			
		
		
		
	Update build.func
validate IPv4 CIDR address
This commit is contained in:
		@@ -247,16 +247,25 @@ advanced_settings() {
 | 
			
		||||
    exit-script
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  if NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" 3>&1 1>&2 2>&3); then
 | 
			
		||||
    if [ -z $NET ]; then
 | 
			
		||||
      NET="dhcp"
 | 
			
		||||
  while true; do
 | 
			
		||||
    NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address (/24)" 8 58 dhcp --title "IP ADDRESS" 3>&1 1>&2 2>&3)
 | 
			
		||||
    exit_status=$?
 | 
			
		||||
    if [ $exit_status -eq 0 ]; then
 | 
			
		||||
      if [ "$NET" = "dhcp" ]; then
 | 
			
		||||
        echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
 | 
			
		||||
        break
 | 
			
		||||
      else
 | 
			
		||||
        if [[ "$NET" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}/([0-9]|[1-2][0-9]|3[0-2])$ ]]; then
 | 
			
		||||
          echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
 | 
			
		||||
          break
 | 
			
		||||
        else
 | 
			
		||||
          whiptail --msgbox "$NET is an invalid IPv4 CIDR address. Please enter a valid IPv4 CIDR address or 'dhcp'" 8 58
 | 
			
		||||
        fi
 | 
			
		||||
      fi
 | 
			
		||||
    else
 | 
			
		||||
      exit-script
 | 
			
		||||
    fi
 | 
			
		||||
  done
 | 
			
		||||
 | 
			
		||||
  if GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" 3>&1 1>&2 2>&3); then
 | 
			
		||||
    if [ -z $GATE1 ]; then
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user