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 <