mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-11-04 05:12:30 +00:00 
			
		
		
		
	adding parsing NM resolv.conf for dns entries (if there is no lease file)
This commit is contained in:
		@@ -580,6 +580,7 @@ elif [ "$1" = "-s" ];then
 | 
			
		||||
            str_inst_mask=`grep subnet-mask $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'`
 | 
			
		||||
            str_inst_gateway=`grep routers $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'`
 | 
			
		||||
            str_inst_dns=`grep domain-name-servers $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'`
 | 
			
		||||
            str_inst_dns_search=`grep domain-search $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'`
 | 
			
		||||
        else
 | 
			
		||||
            if [ -n "$MACADDRESS" ];then
 | 
			
		||||
                str_inst_mac=$MACADDRESS
 | 
			
		||||
@@ -594,6 +595,11 @@ elif [ "$1" = "-s" ];then
 | 
			
		||||
                    fi
 | 
			
		||||
                fi
 | 
			
		||||
                str_inst_gateway=`ip ro ls|grep default|awk '{print $3}'|head -1`
 | 
			
		||||
		str_resolv_file=/var/run/NetworkManager/resolv.conf
 | 
			
		||||
		if [ -f $str_resolv_file ];then
 | 
			
		||||
                    str_inst_dns=`grep ^nameserver $str_resolv_file | sed 's/^nameserver //g'`
 | 
			
		||||
                    str_inst_dns_search=`grep ^search $str_resolv_file | sed 's/^search //g'`
 | 
			
		||||
	        fi
 | 
			
		||||
            fi
 | 
			
		||||
        fi
 | 
			
		||||
    fi
 | 
			
		||||
@@ -755,6 +761,11 @@ elif [ "$1" = "-s" ];then
 | 
			
		||||
		        nmcli con modify $con_name ipv4.dns ${str_inst_dns}
 | 
			
		||||
                fi
 | 
			
		||||
        fi
 | 
			
		||||
        if [ -n "${str_inst_dns_search}" ];then
 | 
			
		||||
	        if [ $networkmanager_active -eq 1 ]; then
 | 
			
		||||
		        nmcli con modify $con_name ipv4.dns-search "${str_inst_dns_search}"
 | 
			
		||||
                fi
 | 
			
		||||
        fi
 | 
			
		||||
        if [ -n "${str_inst_mtu}" ];then
 | 
			
		||||
	        if [ $networkmanager_active -eq 1 ]; then
 | 
			
		||||
		        nmcli con modify $con_name mtu ${str_inst_mtu}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user