From 3f9245d5822c1ff747954a1a05d4ceb832cd6b6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Floure?= Date: Sun, 24 May 2020 08:26:18 +0200 Subject: [PATCH] Debian ONE image: set hostname --- opennebula-images/debian-build-opennebula-image.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/opennebula-images/debian-build-opennebula-image.sh b/opennebula-images/debian-build-opennebula-image.sh index 67714bf..577f573 100755 --- a/opennebula-images/debian-build-opennebula-image.sh +++ b/opennebula-images/debian-build-opennebula-image.sh @@ -14,6 +14,7 @@ ARCH=amd64 IMAGE_PATH=debian-$RELEASE-$(date --iso-8601).img.qcow2 IMAGE_SIZE=10G NBD_DEVICE=/dev/nbd0 +HOSTNAME=debian # TODO: find the package definition and built ourself, publish in some RPM repository. ONE_CONTEXT_DEB_URL="https://github.com/OpenNebula/addon-context-linux/releases/download/v5.10.0/one-context_5.10.0-1.deb" @@ -94,11 +95,13 @@ cp /etc/resolv.conf /mnt/etc/resolv.conf # Initialize /etc/hosts. cat > /mnt/etc/hosts << EOF -127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 -::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 +127.0.0.1 $HOSTNAME localhost localhost.localdomain localhost4 localhost4.localdomain4 +::1 $HOSTNAME localhost localhost.localdomain localhost6 localhost6.localdomain6 EOF +run_root hostnamectl set-hostname $HOSTNAME + # Configure package sources and update package index. cat >/mnt/etc/apt/sources.list <