[__hostname] Small fixes
This commit is contained in:
		
					parent
					
						
							
								5eb9fec550
							
						
					
				
			
			
				commit
				
					
						c939bd6bf6
					
				
			
		
					 2 changed files with 4 additions and 7 deletions
				
			
		|  | @ -66,15 +66,12 @@ in | |||
|             "&& hostnamectl set-hostname '$name_should'" \ | ||||
|             "|| hostname '$name_should'" | ||||
|     ;; | ||||
|     centos|fedora|redhat|scientific|freebsd|netbsd|gentoo|slackware|void) | ||||
|     centos|fedora|redhat|scientific|freebsd|netbsd|openbsd|gentoo|slackware|void) | ||||
|         echo "hostname '$name_should'" | ||||
|     ;; | ||||
|     macosx) | ||||
|         echo "scutil --set HostName '$name_should'" | ||||
|     ;; | ||||
|     openbsd) | ||||
|         echo 'hostname -F /etc/myname' | ||||
|     ;; | ||||
|     suse) | ||||
|         echo 'hostname -F /etc/HOSTNAME' | ||||
|     ;; | ||||
|  |  | |||
|  | @ -52,7 +52,7 @@ else | |||
|     esac | ||||
| fi | ||||
| 
 | ||||
| if test -n "${max_len}" -a "$(printf '%s' "${name_should}" | wc -c)" -gt "${max_len}" | ||||
| if test -n "${max_len}" && test "$(printf '%s' "${name_should}" | wc -c)" -gt "${max_len}" | ||||
| then | ||||
|     printf "Host name too long. Up to %u characters allowed.\n" "${max_len}" >&2 | ||||
|     exit 1 | ||||
|  | @ -69,8 +69,8 @@ in | |||
|             set_hostname_systemd "$name_should" | ||||
|         else | ||||
|             # Only for ancient ArchLinux, write to /etc/rc.conf on pre-systemd | ||||
|             # versions. | ||||
| 			# There are some versions which use /etc/hostname but not systemd. It is unclear which ones these are. | ||||
|             # versions.  There are some versions which use /etc/hostname but not | ||||
| 			# systemd. It is unclear which ones these are. | ||||
|             __key_value '/etc/rc.conf:HOSTNAME' \ | ||||
|                 --file /etc/rc.conf \ | ||||
|                 --delimiter '=' --exact_delimiter \ | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue