aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-03-10 10:31:25 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-03-10 10:31:25 -0300
commit18dd324736a9a1fcfa577922235be69633a6d77b (patch)
tree3c1eaf8a342ef42a9ac3a4c50d5339366fd31a02
parent203d80db1862160e3bf2609da56288c039d436a4 (diff)
downloadkvmx-18dd324736a9a1fcfa577922235be69633a6d77b.tar.gz
kvmx-18dd324736a9a1fcfa577922235be69633a6d77b.tar.bz2
Provision: desktop-basic: fix hostname config
-rwxr-xr-xprovision/desktop-basic9
1 files changed, 7 insertions, 2 deletions
diff --git a/provision/desktop-basic b/provision/desktop-basic
index b25f186..8181edf 100755
--- a/provision/desktop-basic
+++ b/provision/desktop-basic
@@ -12,8 +12,13 @@ MIRROR="$3"
APT_INSTALL="sudo LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y"
# Set hostname
-echo "$HOSTNAME.$DOMAIN" | sudo tee /etc/hostname > /dev/null
-echo "127.0.0.1 $HOSTNAME.$DOMAIN" | sudo tee -a /etc/hosts > /dev/null
+echo "$HOSTNAME.$DOMAIN" | sudo tee /etc/hostname > /dev/null
+sudo hostname $HOSTNAME.$DOMAIN
+
+# Set hosts entry
+if ! grep -q "^127.0.0.1 $HOSTNAME.$DOMAIN $HOSTNAME$" /etc/hosts; then
+ echo "127.0.0.1 $HOSTNAME.$DOMAIN $HOSTNAME" | sudo tee -a /etc/hosts > /dev/null
+fi
# Configure keyboard
cat <<-EOF | sudo tee /etc/default/keyboard > /dev/null