traiter les anciennes occurences de host, même si pas localhost
This commit is contained in:
		
							parent
							
								
									a0130ab206
								
							
						
					
					
						commit
						445bbe90ff
					
				
							
								
								
									
										11
									
								
								ulib/debian
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								ulib/debian
									
									
									
									
									
								
							@ -163,9 +163,16 @@ function __network_fix_exim4() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
function __network_hosts() {
 | 
					function __network_hosts() {
 | 
				
			||||||
    local host="$1" hostname="${1%%.*}" ip="$2"
 | 
					    local host="$1" hostname="${1%%.*}" ip="$2"
 | 
				
			||||||
 | 
					    local shost="${host//./\\.}"
 | 
				
			||||||
    local tmpfile; ac_set_tmpfile tmpfile
 | 
					    local tmpfile; ac_set_tmpfile tmpfile
 | 
				
			||||||
    </etc/hosts sed "/^127\\./s/$hostname\\(\\.[^ $TAB]*\\)\\?[ $TAB]*//g;
 | 
					    awkrun </etc/hosts >"$tmpfile" host="$host" hostname="$hostname" ip="$ip" '
 | 
				
			||||||
/^127\\.[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+[ $TAB]*\$/d" >"$tmpfile"
 | 
					/^[^# \t]/ {
 | 
				
			||||||
 | 
					  gsub("[ \\t]+" host "[ \\t]*", " ")
 | 
				
			||||||
 | 
					  gsub("[ \\t]+" hostname "[ \\t]*", " ")
 | 
				
			||||||
 | 
					  if ($0 ~ /^[^ \t]+[ \t]*$/) next
 | 
				
			||||||
 | 
					  gsub(/[ \t]*$/, "")
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					{ print }'
 | 
				
			||||||
    local sip="${ip//./\\.}" shost="${host//./\\.}"
 | 
					    local sip="${ip//./\\.}" shost="${host//./\\.}"
 | 
				
			||||||
    if ! quietgrep "^$sip[ $TAB]\\+$shost[ $TAB]\\+$hostname" "$tmpfile"; then
 | 
					    if ! quietgrep "^$sip[ $TAB]\\+$shost[ $TAB]\\+$hostname" "$tmpfile"; then
 | 
				
			||||||
        sed -i "/^$sip[ $TAB]/d" "$tmpfile"
 | 
					        sed -i "/^$sip[ $TAB]/d" "$tmpfile"
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user