init.d/hostname: do not use localhost as a default hostname
This allows the operating system default hostname to be used if no hostname is configured.
This commit is contained in:
		@@ -24,7 +24,11 @@ start()
 | 
				
			|||||||
	else
 | 
						else
 | 
				
			||||||
		# HOSTNAME variable used to be defined in caps in conf.d/hostname.
 | 
							# HOSTNAME variable used to be defined in caps in conf.d/hostname.
 | 
				
			||||||
		# It is also a magic variable in bash.
 | 
							# It is also a magic variable in bash.
 | 
				
			||||||
		h=${hostname-${HOSTNAME-localhost}} # checkbashisms: false positive
 | 
							h=${hostname-${HOSTNAME}} # checkbashisms: false positive
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
						if [ -z "$h" ]; then
 | 
				
			||||||
 | 
							einfo "Using default system hostname"
 | 
				
			||||||
 | 
							return 0
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	ebegin "Setting hostname to $h $source"
 | 
						ebegin "Setting hostname to $h $source"
 | 
				
			||||||
	hostname "$h"
 | 
						hostname "$h"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user