diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2018-02-13 20:59:53 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2018-02-13 20:59:53 +0100 |
commit | 43356307c8bfccff6e4835342f782c5a87664d79 (patch) | |
tree | 7f691676dd121e878bd3a748e612b6fead947bf0 | |
parent | 541e209227c28c0a52fcfd82a6ce8b170d8ee0bd (diff) | |
download | itzks-install-script-43356307c8bfccff6e4835342f782c5a87664d79.tar.gz itzks-install-script-43356307c8bfccff6e4835342f782c5a87664d79.tar.bz2 itzks-install-script-43356307c8bfccff6e4835342f782c5a87664d79.zip |
Only change hostname if $myhost is a non-emptry string (after white-space stripping).
-rwxr-xr-x | install-itzks-workstation | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/install-itzks-workstation b/install-itzks-workstation index fa5f57b..95b1ac8 100755 --- a/install-itzks-workstation +++ b/install-itzks-workstation @@ -224,11 +224,13 @@ es mw101.intern heißen. [ENTER]' echo # Set hostname -read -p 'Wie lautet der Hostname (ohne Domain)? ' myhost +read -p 'Wie lautet der Hostname (ohne Domain, leer lassen, wenn Hostname des System nicht geändert werden muss)? ' myhost echo -hostnamectl set-hostname "$myhost" -export HOSTNAME="$myhost" +if [ -n "$(echo $myhost | xargs | cut -d" " -f1)" ]; then + hostnamectl set-hostname "$myhost" + export HOSTNAME="$myhost" +fi unset myhost # To be sure restart the following services |