aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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