[__hostname] Source sysconfig file instead of processing through AWK
This way quotes and expansions will be handled correctly.
This commit is contained in:
		
					parent
					
						
							
								74568e8a0a
							
						
					
				
			
			
				commit
				
					
						3e7cf68de5
					
				
			
		
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
					@ -38,7 +38,8 @@ in
 | 
				
			||||||
		[ -f /etc/HOSTNAME ] && cat /etc/HOSTNAME
 | 
							[ -f /etc/HOSTNAME ] && cat /etc/HOSTNAME
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
	centos|fedora|redhat|scientific)
 | 
						centos|fedora|redhat|scientific)
 | 
				
			||||||
		[ -f /etc/sysconfig/network ] && awk -F= '/^HOSTNAME=/ { print $2 }' /etc/sysconfig/network
 | 
							[ -f /etc/sysconfig/network ] \
 | 
				
			||||||
 | 
								&& (. /etc/sysconfig/network && echo "$HOSTNAME")
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
	freebsd)
 | 
						freebsd)
 | 
				
			||||||
		(. /etc/rc.conf && echo "$hostname")
 | 
							(. /etc/rc.conf && echo "$hostname")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue