mirror of
				https://github.com/mail-in-a-box/mailinabox.git
				synced 2025-10-30 18:50:53 +00:00 
			
		
		
		
	add 127.0.1.1 if it does not exist
This commit is contained in:
		
							parent
							
								
									f8a679b9c2
								
							
						
					
					
						commit
						c29eb2fb23
					
				| @ -61,7 +61,14 @@ set_system_hostname() { | ||||
|     # PRIMARY_HOSTNAME if no FQDN was given | ||||
|     local fqdn="${1:-$PRIMARY_HOSTNAME}" | ||||
|     local host="$(awk -F. '{print $1}' <<< "$fqdn")" | ||||
|     sed -i 's/^127\.0\.1\.1[ \t].*/127.0.1.1 '"$fqdn $host ip4-loopback/" /etc/hosts || return 1 | ||||
|     if ! grep '^127.0.1.1' /etc/hosts >/dev/null; then | ||||
|         # add it | ||||
|         echo "127.0.1.1 $fqdn $host" >> /etc/hosts || return 1 | ||||
|     else | ||||
|         # set it | ||||
|         sed -i 's/^127\.0\.1\.1[ \t].*/127.0.1.1 '"$fqdn $host ip4-loopback/" /etc/hosts || return 1 | ||||
|     fi | ||||
|     # ensure name is resolvable | ||||
|     if ! /usr/bin/getent hosts "$fqdn" >/dev/null; then | ||||
|         return 2 | ||||
|     fi | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user